context-mode
Skill1 starsChanged 4 months agoMITView on GitHub
Context window optimization for AI coding agents. Sandboxes tool output (98% reduction), persists session memory across compactions, and enforces routing across 17 platforms via MCP + hooks. Use when context window is filling up, tool outputs are too large, or session state needs to survive compaction. Works with Antigravity, Claude, Cursor, Codex, Copilot, OpenCode, and more. Source: https://github.com/mksglu/context-mode — MCP-layer sandboxing, local-only, no telemetry.
- Reads credentials
- Deletes or force-pushes
- Installs packages
7 other projects use a version of this.
Adopted by
Most recently taken up by
- kazemcodes/skill-treetheir own version, first seen Nov 8, 2026
- AthenDrakomin-hub/agent-skillstheir own version, first seen Nov 1, 2026
- pedroiff0/awesome-skillstheir own version, first seen Sep 29, 2026
- opencue/cuecardstheir own version, first seen Aug 17, 2026
- javimosch/superclitheir own version, first seen Jun 3, 2026
- iltutishrak/claude-skillstheir own version, first seen May 26, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- javimosch/supercli★ 53same name
- opencue/cuecards★ 6same name
- kazemcodes/skill-tree★ 1same name
- pedroiff0/awesome-skills★ 1same name
- AthenDrakomin-hub/agent-skills★ 0same name
- iltutishrak/claude-skills★ 0same name
- yusuf787x/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository413 other files it gives its agents.
- .agents/AGENTS.mdAGENTS.md
- AGENTS.mdAGENTS.md
- .codex/AGENTS.mdAGENTS.md
- .cursor/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- sap-router-skillCopilot instructions
- .cursor/rules/sap-router.mdcCursor rule
- abap-cloud-migrationSkill
- abap-cloudSkill
- abap-code-patternsSkill
- abap-code-reviewSkill
- abap-docs-referenceSkill
- abapgitSkill
- abapSkill
- abap-snippetSkill
- abap-sql-amdpSkill
- abap-system-infoSkill
- abap-unit-testingSkill
- arc-1-skillsSkill
- atc-cloudificationSkill
- authorization-iamSkill
- automation-pilot-catalog-explorerSkill
- automation-pilot-command-generationSkill
- automation-pilot-command-reviewSkill
- automation-pilot-content-management-via-apiSkill
- automation-pilot-debuggerSkill
- automation-pilot-executions-apiSkill
- automation-pilot-executor-executescriptSkill
- automation-pilot-executor-httprequestSkill
- automation-pilot-mcp-server-generationSkill
- automation-pilot-scheduled-executions-apiSkill
- badi-enhancementSkill
- btp-abap-environmentSkill
- btp-best-practicesSkill
- btp-build-work-zoneSkill
- btp-business-application-studioSkill
- btp-ciasSkill
- btp-cloud-foundrySkill
- btp-cloud-identitySkill
- btp-cloud-loggingSkill
- btp-cloud-platformSkill
- btp-cloud-transport-managementSkill
- btp-connectivitySkill
- btp-developer-guideSkill
- btp-diagram-generatorSkill
- btp-integration-suiteSkill
- btp-job-schedulingSkill
- btp-master-data-integrationSkill
- btp-service-managerSkill
- cap-add-remote-serviceSkill
- cap-developerSkill
- cap-triviaSkill
- capture-answerSkill
- cap-upgradeSkill
- cds-view-entitiesSkill
- claude-abap-skillsSkill
- claude-memSkill
- clean-abapSkill
- cpi-iflow-developmentSkill
- engine-cap-developmentSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 113
Add to .claude/settings.json or ~/.claude/settings.json.
- Distinctive: line 184
Every 10th external MCP tool call (Jira, Slack, Notion, etc.), Context Mode re-injects:
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Context Mode Skill
Context Mode operates at the MCP protocol layer to sandbox tool outputs, persist session memory across compactions, and enforce routing across 17 AI platforms. Nothing leaves your machine — no telemetry, no cloud sync, all SQLite-local.
Local Reference
sap-router-skill\bundled\tools\context-mode\Core Capabilities
| Problem | Context Mode Solution |
| Tool output too large (7 MB API response) | ctx_fetch_and_index → 1.8 KB indexed summary |
| Context compaction loses session state | ctx_checkpoint persists tasks, files, decisions |
| 20 Jira MCP calls flood context | Wrap with ctx_execute → compact result |
| Can't continue after compaction | ctx_restore rebuilds full session state |
Installation
# Repository-owned snapshot (already bundled)
cd bundled/tools/context-mode
npm install
# Initialize for your agent (from project directory):
# Claude Code
npx context-mode init
# Antigravity (Gemini) — copies .agents plugin files
npx context-mode init --agent antigravity
# Codex
npx context-mode init --agent codex
# Cursor
npx context-mode init --agent cursor
# Copilot
npx context-mode init --agent copilot
# OpenCode
npx context-mode init --agent opencodeMCP Tools Available
Execution Sandbox
ctx_execute - Run code in isolated subprocess, return compact result
ctx_execute_file - Run code over a file (project-boundary confined)
ctx_batch_execute - Run multiple operations, aggregate summary onlyFetch & Index
ctx_fetch_and_index - Fetch URL, store raw in SQLite, return <2 KB summary
Blocks dangerous schemes/IPs by defaultSession Memory
ctx_checkpoint - Save current session state (tasks, files, decisions)
ctx_restore - Restore full session state after compaction
ctx_stats / ctx-stats - Show session event count, token savings, context health
ctx_doctor - Diagnose storage config and environmentSecurity Model
Context Mode enforces your existing Claude/agent permission rules inside the sandbox:
{
"permissions": {
"deny": [
"Bash(sudo *)",
"Bash(rm -rf /*)",
"Read(.env)",
"Read(**/.env*)"
],
"allow": [
"Bash(git:*)",
"Bash(npm:*)"
]
}
}Add to .claude/settings.json or ~/.claude/settings.json. All 17 platforms read this same format.
denyalways wins overallow- Project-level rules override global
ctx_execute_fileis confined to project root — path traversal (../../) blocked- Credentials auto-redacted: tokens, API keys, secrets masked to
[REDACTED]before SQLite
Network Fetch Hardening
ctx_fetch_and_index blocks by default:
file://,gopher://,javascript:,data:schemes- Cloud metadata:
169.254.169.254(AWS/GCP/Azure IMDS) - Multicast, reserved IPs
# Strict mode (blocks RFC1918 too — for CI/hosted envs):
export CTX_FETCH_STRICT=1Integration with SAP Router Skill
Context Mode is critical for SAP sessions that generate large outputs:
Large Output Handling
# Instead of letting healthcheck flood context:
ctx_execute("python scripts/healthcheck.py")
# → compact: "35/35 MCPs healthy | 2 warnings: mcp-sap-gui timeout"
# Large ABAP search results via ADT:
ctx_execute("python scripts/sap_router.py code_search --query ZCL_ROUTER --max 500")
# → compact summary with file list
# iFlow package analysis:
ctx_execute("python scripts/cpi_iflow_packager.py validate --input my.zip")
# → "Valid: 12/12 artifacts | 0 errors"Session Memory for SAP Tasks
# Before starting long SAP task:
ctx_checkpoint({"task": "Implement ZROUTER_V3", "status": "planning",
"pending": ["create_class", "test_bapi", "transport"]})
# After compaction, agent restores:
ctx_restore()
# → Full task state recovered, no re-prompting neededFetch & Index SAP Documentation
# Fetch large SAP Help page:
ctx_fetch_and_index("https://help.sap.com/docs/SAP_NETWEAVER/...")
# → 2 KB indexed summary instead of 500 KB raw HTML
# Then query the index:
ctx_execute("query indexed content for BAPI_PO_CREATE1 parameters")Storage Environment
# Custom storage location:
export CONTEXT_MODE_DIR="C:\Users\William Correa\.context-mode"
# MCP nudge frequency (re-inject routing guidance every N tool calls):
export CONTEXT_MODE_EXTERNAL_MCP_NUDGE_EVERY=10 # defaultRouting Nudge Behavior
Every 10th external MCP tool call (Jira, Slack, Notion, etc.), Context Mode re-injects:
"Wrap large external-MCP payloads in
ctx_executefor 98% context reduction"
This prevents guidance from being lost after compaction in long sessions.
Commands Reference
ctx stats # Session stats (tool calls, tokens saved, context %)
ctx checkpoint # Save session state now
ctx restore # Restore after compaction
ctx doctor # Diagnose storage and env config
/context-mode:ctx-stats # In-chat commandReferences
- Repository:
bundled/tools/context-mode/ - Contributing:
bundled/tools/context-mode/CONTRIBUTING.md - Issues tracker: https://github.com/mksglu/context-mode/issues
- Security:
bundled/tools/context-mode/SECURITY.md(if present) - License: Elastic License 2.0 (source-available, no SaaS repackaging)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

