context-mode 0.5.22 → 0.5.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,7 @@
13
13
  "name": "context-mode",
14
14
  "source": "./",
15
15
  "description": "Claude Code MCP plugin that saves 98% of your context window. Sandboxed code execution in 10 languages, FTS5 knowledge base with BM25 ranking, and intent-driven search.",
16
- "version": "0.5.22",
16
+ "version": "0.5.24",
17
17
  "author": {
18
18
  "name": "Mert Koseoğlu"
19
19
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-mode",
3
- "version": "0.5.22",
3
+ "version": "0.5.24",
4
4
  "description": "Claude Code MCP plugin that saves 98% of your context window. Sandboxed code execution in 10 languages, FTS5 knowledge base with BM25 ranking, and intent-driven search.",
5
5
  "author": {
6
6
  "name": "Mert Koseoğlu",
@@ -33,7 +33,16 @@
33
33
  "hooks": [
34
34
  {
35
35
  "type": "prompt",
36
- "prompt": "You have mcp__context-mode__execute and mcp__context-mode__execute_file available. If this Bash command could produce more than 20 lines of output (curl, npm test, git log, cat large files, API calls, docker/kubectl commands), use mcp__context-mode__execute instead it processes output in a sandbox and only returns a summary to context. For small commands (git status, pwd, ls, echo) Bash is fine."
36
+ "prompt": "STOP. Default to mcp__context-mode__execute for ALL Bash commands. ONLY use Bash for these guaranteed-small-output operations: file mutations (mkdir, mv, cp, rm, touch, chmod), git writes (git add, git commit, git push, git checkout, git branch, git merge), navigation (cd, pwd, which), process control (kill, pkill), package management (npm install/publish, pip install), and simple echo/printf. Everything else any command that reads, queries, fetches, lists, logs, tests, builds, diffs, inspects, or calls an external service — MUST use mcp__context-mode__execute instead. When uncertain, use context-mode."
37
+ }
38
+ ]
39
+ },
40
+ {
41
+ "matcher": "Task",
42
+ "hooks": [
43
+ {
44
+ "type": "prompt",
45
+ "prompt": "IMPORTANT: The subagent inherits MCP tools but NOT skill instructions. You MUST include these tool routing rules in the subagent prompt: 'Use mcp__context-mode__execute (language, code, intent) instead of Bash for ANY command that produces more than a few lines of output. Use mcp__context-mode__fetch_and_index (url, source) instead of WebFetch to fetch web pages. Use mcp__context-mode__search (query, source) to search indexed content. Use mcp__context-mode__execute_file (path, language, code) instead of Read for large file analysis. Do NOT use Bash, cat, curl, Read, or WebFetch for large outputs.'"
37
46
  }
38
47
  ]
39
48
  }
package/README.md CHANGED
@@ -1,21 +1,14 @@
1
1
  # Context Mode
2
2
 
3
- **Stop losing context to large outputs.**
3
+ **The other half of the context problem.**
4
4
 
5
- [![npm](https://img.shields.io/npm/v/context-mode)](https://www.npmjs.com/package/context-mode) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
+ [![npm](https://img.shields.io/npm/v/context-mode)](https://www.npmjs.com/package/context-mode) [![marketplace](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fmksglu%2Fclaude-context-mode%2Fmain%2F.claude-plugin%2Fmarketplace.json&query=%24.plugins%5B0%5D.version&label=marketplace&color=brightgreen)](https://github.com/mksglu/claude-context-mode) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
6
 
7
- Run tests without burning 5K tokens. Query docs without loading raw HTML. Debug logs without reading 45KB of noise. Only summaries reach Claude everything else stays in the sandbox.
7
+ Every MCP tool call in Claude Code dumps raw data into your 200K context window. A Playwright snapshot costs 56 KB. Twenty GitHub issues cost 59 KB. One access log45 KB. After 30 minutes, 40% of your context is gone.
8
8
 
9
- ```
10
- Without Context Mode With Context Mode
11
- ───────────────────── ────────────────────
12
- Playwright snapshot → 56 KB into context → 299 B summary
13
- GitHub issues (20) → 59 KB into context → 1.1 KB summary
14
- Access log (500) → 45 KB into context → 155 B summary
15
- Context7 docs → 6 KB into context → 261 B summary
16
-
17
- Total: 166 KB = 42K tokens gone Total: 1.8 KB = ~450 tokens
18
- ```
9
+ Inspired by Cloudflare's [Code Mode](https://blog.cloudflare.com/code-mode-mcp/) — which compresses tool definitions from millions of tokens into ~1,000 — we asked: what about the other direction?
10
+
11
+ Context Mode is an MCP server that sits between Claude Code and these outputs. **315 KB becomes 5.4 KB. 98% reduction.**
19
12
 
20
13
  ## Install
21
14
 
@@ -23,7 +16,7 @@ Total: 166 KB = 42K tokens gone Total: 1.8 KB = ~450 tokens
23
16
  claude mcp add context-mode -- npx -y context-mode
24
17
  ```
25
18
 
26
- Restart Claude Code. Done. You now have 5 tools that intercept large outputs and return only what matters.
19
+ Restart Claude Code. Done.
27
20
 
28
21
  <details>
29
22
  <summary><strong>Plugin install</strong> (includes auto-routing skill)</summary>
@@ -33,7 +26,7 @@ Restart Claude Code. Done. You now have 5 tools that intercept large outputs and
33
26
  /plugin install context-mode@claude-context-mode
34
27
  ```
35
28
 
36
- Installs the MCP server + a skill that automatically guides Claude to route large outputs through Context Mode. No prompting needed.
29
+ Installs the MCP server + a skill that automatically routes large outputs through Context Mode. No prompting needed.
37
30
 
38
31
  </details>
39
32
 
@@ -46,116 +39,91 @@ claude --plugin-dir ./path/to/context-mode
46
39
 
47
40
  </details>
48
41
 
49
- ## What It Does
42
+ ## The Problem
50
43
 
51
- Every MCP tool call dumps raw data into your 200K context window. With [81+ tools active, 143K tokens (72%) get consumed before your first message](https://scottspence.com/posts/optimising-mcp-server-context-usage-in-claude-code). Context Mode intercepts these operations, processes data in isolated subprocesses, and returns only what you need.
44
+ MCP has become the standard way for AI agents to use external tools. But there is a tension at its core: every tool interaction fills the context window from both sides definitions on the way in, raw output on the way out.
52
45
 
53
- **Result:** 315 KB raw data becomes 5.4 KB of context across 14 real scenarios**98% savings**.
46
+ With [81+ tools active, 143K tokens (72%) get consumed before your first message](https://scottspence.com/posts/optimising-mcp-server-context-usage-in-claude-code). And then the tools start returning data. A single Playwright snapshot burns 56 KB. A `gh issue list` dumps 59 KB. Run a test suite, read a log file, fetch documentation each response eats into what remains.
54
47
 
55
- | Metric | Without | With |
56
- |---|---|---|
57
- | Context consumed per session | 315 KB | 5.4 KB |
58
- | Time before slowdown | ~30 min | ~3 hours |
59
- | Context remaining after 45 min | 60% | 99% |
48
+ Code Mode showed that tool definitions can be compressed by 99.9%. Context Mode applies the same principle to tool outputs — processing them in sandboxes so only summaries reach the model.
60
49
 
61
50
  ## Tools
62
51
 
63
- ### `execute` Run code in sandbox
52
+ | Tool | What it does | Context saved |
53
+ |---|---|---|
54
+ | `execute` | Run code in 10 languages. Only stdout enters context. | 56 KB → 299 B |
55
+ | `execute_file` | Process files in sandbox. Raw content never leaves. | 45 KB → 155 B |
56
+ | `index` | Chunk markdown into FTS5 with BM25 ranking. | 60 KB → 40 B |
57
+ | `search` | Query indexed content. Returns exact code blocks. | On-demand retrieval |
58
+ | `fetch_and_index` | Fetch URL, convert to markdown, index. | 60 KB → 40 B |
64
59
 
65
- Execute code in 10 languages (JS, TS, Python, Shell, Ruby, Go, Rust, PHP, Perl, R). Only stdout enters context.
60
+ ## How the Sandbox Works
66
61
 
67
- ```
68
- execute({ language: "shell", code: "gh pr list --json title,state | jq length" })
69
- → "3" ← 2 bytes instead of 8KB
70
- ```
62
+ Each `execute` call spawns an isolated subprocess with its own process boundary. Scripts can't access each other's memory or state. The subprocess runs your code, captures stdout, and only that stdout enters the conversation context. The raw data — log files, API responses, snapshots — never leaves the sandbox.
71
63
 
72
- Add `intent` for large outputs Context Mode filters to relevant sections automatically:
64
+ Ten language runtimes are available: JavaScript, TypeScript, Python, Shell, Ruby, Go, Rust, PHP, Perl, R. Bun is auto-detected for 3-5x faster JS/TS execution.
73
65
 
74
- ```
75
- execute({ language: "shell", code: "cat app.log", intent: "database connection error" })
76
- → matching sections + searchable terms ← 500B instead of 100KB
77
- ```
66
+ Authenticated CLIs work through credential passthrough — `gh`, `aws`, `gcloud`, `kubectl`, `docker` inherit environment variables and config paths without exposing them to the conversation.
78
67
 
79
- Authenticated CLIs work out of the box `gh`, `aws`, `gcloud`, `kubectl`, `docker` credentials pass through. Bun auto-detected for 3-5x faster JS/TS.
68
+ When output exceeds 5 KB and an `intent` is provided, Context Mode switches to intent-driven filtering: it indexes the full output into the knowledge base, searches for sections matching your intent, and returns only the relevant matches with a vocabulary of searchable terms for follow-up queries.
80
69
 
81
- ### `execute_file` Process files without loading
70
+ ## How the Knowledge Base Works
82
71
 
83
- File contents stay in the sandbox as `FILE_CONTENT`. Your code summarizes. Only the summary enters context.
72
+ The `index` tool chunks markdown content by headings while keeping code blocks intact, then stores them in a **SQLite FTS5** (Full-Text Search 5) virtual table. Search uses **BM25 ranking** — a probabilistic relevance algorithm that scores documents based on term frequency, inverse document frequency, and document length normalization. **Porter stemming** is applied at index time so "running", "runs", and "ran" match the same stem.
84
73
 
85
- ```
86
- execute_file({ path: "access.log", language: "python", code: "..." })
87
- → "200: 312 | 404: 89 | 500: 14" ← 30 bytes instead of 45KB
88
- ```
74
+ When you call `search`, it returns exact code blocks with their heading hierarchy — not summaries, not approximations, the actual indexed content. `fetch_and_index` extends this to URLs: fetch, convert HTML to markdown, chunk, index. The raw page never enters context.
89
75
 
90
- ### `index` + `search` — Searchable knowledge base
76
+ ## The Numbers
91
77
 
92
- Index documentation into FTS5 with BM25 ranking. Search returns exact code blocks — not summaries.
78
+ Measured across 11 real-world scenarios. Every operation under 1 KB output.
93
79
 
94
- ```
95
- index({ content: <60KB React docs>, source: "React useEffect" })
96
- "Indexed 33 sections (15 with code)" ← 40 bytes
80
+ **Playwright snapshot** — 56.2 KB raw → 299 B context (99% saved)
81
+ **GitHub Issues (20)** 58.9 KB raw 1.1 KB context (98% saved)
82
+ **Access log (500 requests)** — 45.1 KB raw 155 B context (100% saved)
83
+ **Context7 React docs** — 5.9 KB raw → 261 B context (96% saved)
84
+ **Analytics CSV (500 rows)** — 85.5 KB raw → 222 B context (100% saved)
85
+ **Git log (153 commits)** — 11.6 KB raw → 107 B context (99% saved)
86
+ **Test output (30 suites)** — 6.0 KB raw → 337 B context (95% saved)
97
87
 
98
- search({ query: "useEffect cleanup function" })
99
- → exact code example with heading context ← 500 bytes instead of 60KB
100
- ```
88
+ Over a full session: 315 KB of raw output becomes 5.4 KB. Session time before slowdown goes from ~30 minutes to ~3 hours. Context remaining after 45 minutes: 99% instead of 60%.
101
89
 
102
- ### `fetch_and_index` Fetch URLs into knowledge base
90
+ [Full benchmark data with 21 scenarios →](BENCHMARK.md)
91
+
92
+ ## Try It
103
93
 
104
- Fetches, converts HTML to markdown, indexes. Raw content never enters context. Use instead of WebFetch or Context7 when you need to reference docs multiple times.
94
+ These prompts work out of the box. Claude routes through Context Mode automatically.
105
95
 
96
+ **Git history analysis**
106
97
  ```
107
- fetch_and_index({ url: "https://react.dev/reference/react/useEffect" })
108
- "Indexed 33 sections (15 with code)" ← 40 bytes instead of 60KB
98
+ Clone https://github.com/modelcontextprotocol/servers and analyze its git history:
99
+ top contributors, commit types (feat/fix/docs/chore), and busiest weeks.
109
100
  ```
110
101
 
111
- ## Example Prompts
112
-
113
- Just ask naturally — Claude routes through Context Mode automatically when it saves tokens.
114
-
102
+ **Web page extraction**
115
103
  ```
116
- "Analyze the last 50 commits and find the most frequently changed files"
117
- "Read the access log and break down requests by HTTP status code"
118
- "Run the test suite and give me a pass/fail summary"
119
- "Fetch the React useEffect docs and find the cleanup pattern"
120
- "List all Docker containers with their memory usage"
121
- "Find all TODO comments across the codebase"
122
- "Analyze package-lock.json and find the 10 largest dependencies"
123
- "Show running Kubernetes pods and their restart counts"
104
+ Fetch the Hacker News front page and extract: top 15 posts with titles, scores,
105
+ comment counts, and domains. Group them by domain.
124
106
  ```
125
107
 
126
- ## Real-World Benchmarks
127
-
128
- | Operation | Raw | Context | Savings |
129
- |---|---|---|---|
130
- | Playwright `browser_snapshot` | 56.2 KB | 299 B | **99%** |
131
- | GitHub Issues (20) | 58.9 KB | 1.1 KB | **98%** |
132
- | Access log (500 requests) | 45.1 KB | 155 B | **100%** |
133
- | Context7 React docs | 5.9 KB | 261 B | **96%** |
134
- | Analytics CSV (500 rows) | 85.5 KB | 222 B | **100%** |
135
- | Git log (153 commits) | 11.6 KB | 107 B | **99%** |
136
- | Test output (30 suites) | 6.0 KB | 337 B | **95%** |
137
-
138
- [Full benchmark data with 21 scenarios →](BENCHMARK.md)
139
-
140
- ## How It Works
108
+ **Documentation lookup**
109
+ ```
110
+ Fetch the React useEffect docs and find the cleanup pattern.
111
+ ```
141
112
 
113
+ **Monorepo dependency audit**
142
114
  ```
143
- ┌─────────────┐ stdio / JSON-RPC ┌─────────────────────────────────┐
144
- Claude Code ◄─────────────────────► │ Context Mode MCP Server │
145
- │ │ tool calls/results │ │
146
- └─────────────┘ │ Sandboxed subprocesses │
147
- │ • 10 language runtimes │
148
- │ • Auth passthrough (gh, aws…) │
149
- │ • Intent-driven search │
150
- │ │
151
- │ SQLite FTS5 knowledge base │
152
- │ • BM25 ranking │
153
- │ • Porter stemming │
154
- │ • Heading-aware chunking │
155
- └─────────────────────────────────┘
115
+ Analyze package-lock.json: find the 10 largest dependencies,
116
+ which packages share the most common deps, and the heaviest package by count.
156
117
  ```
157
118
 
158
- Each `execute` call spawns an isolated subprocess — scripts can't access each other, but authenticated CLIs (`gh`, `aws`, `gcloud`) find their configs through secure credential passthrough.
119
+ **Parallel browser + docs analysis**
120
+ ```
121
+ Run 3 parallel tasks:
122
+ 1. Navigate to news.ycombinator.com, take a snapshot, count all links and interactive elements
123
+ 2. Navigate to jsonplaceholder.typicode.com, extract all API endpoint paths and HTTP methods
124
+ 3. Fetch the Anthropic prompt caching docs, search for cache TTL and token pricing
125
+ Present all findings in a comparison table.
126
+ ```
159
127
 
160
128
  ## Requirements
161
129
 
@@ -168,7 +136,7 @@ Each `execute` call spawns an isolated subprocess — scripts can't access each
168
136
  ```bash
169
137
  git clone https://github.com/mksglu/claude-context-mode.git
170
138
  cd claude-context-mode && npm install
171
- npm test # 100+ tests across 4 suites
139
+ npm test # run tests
172
140
  npm run test:all # full suite
173
141
  ```
174
142
 
package/build/server.js CHANGED
@@ -5,7 +5,7 @@ import { z } from "zod";
5
5
  import { PolyglotExecutor } from "./executor.js";
6
6
  import { ContentStore } from "./store.js";
7
7
  import { detectRuntimes, getRuntimeSummary, getAvailableLanguages, hasBunRuntime, } from "./runtime.js";
8
- const VERSION = "0.5.22";
8
+ const VERSION = "0.5.24";
9
9
  const runtimes = detectRuntimes();
10
10
  const available = getAvailableLanguages(runtimes);
11
11
  const server = new McpServer({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-mode",
3
- "version": "0.5.22",
3
+ "version": "0.5.24",
4
4
  "type": "module",
5
5
  "description": "Claude Code MCP plugin that saves 98% of your context window. Sandboxed code execution, FTS5 knowledge base, and intent-driven search.",
6
6
  "author": "Mert Koseoğlu",
package/server.bundle.mjs CHANGED
@@ -132,7 +132,7 @@ ${n}`}}};import{createRequire as aT}from"node:module";import{readFileSync as cT}
132
132
  `).trim();u.length!==0&&(r.push({title:this.#o(o,i),content:u,hasCode:s.some(l=>/^`{3,}/.test(l))}),s=[])},c=0;for(;c<n.length;){let u=n[c];if(/^[-_*]{3,}\s*$/.test(u)){a(),c++;continue}let l=u.match(/^(#{1,4})\s+(.+)$/);if(l){a();let m=l[1].length,f=l[2].trim();for(;o.length>0&&o[o.length-1].level>=m;)o.pop();o.push({level:m,text:f}),i=f,s.push(u),c++;continue}let d=u.match(/^(`{3,})(.*)?$/);if(d){let m=d[1],f=[u];for(c++;c<n.length;){if(f.push(n[c]),n[c].startsWith(m)&&n[c].trim()===m){c++;break}c++}s.push(...f);continue}s.push(u),c++}return a(),r}#n(e,r){let n=e.split(/\n\s*\n/);if(n.length>=3&&n.length<=200&&n.every(c=>Buffer.byteLength(c)<5e3))return n.map((c,u)=>{let l=c.trim();return{title:l.split(`
133
133
  `)[0].slice(0,80)||`Section ${u+1}`,content:l}}).filter(c=>c.content.length>0);let o=e.split(`
134
134
  `);if(o.length<=r)return[{title:"Output",content:e}];let s=[],a=Math.max(r-2,1);for(let c=0;c<o.length;c+=a){let u=o.slice(c,c+r);if(u.length===0)break;let l=c+1,d=Math.min(c+u.length,o.length),m=u[0]?.trim().slice(0,80);s.push({title:m||`Lines ${l}-${d}`,content:u.join(`
135
- `)})}return s}#o(e,r){return e.length===0?r||"Untitled":e.map(n=>n.text).join(" > ")}};var Qg="0.5.22",Wl=ai(),mT=Jg(Wl),dn=new oi({name:"context-mode",version:Qg}),Xl=new ci({runtimes:Wl}),Jl=null;function di(){return Jl||(Jl=new _o),Jl}var hT=mT.join(", "),gT=Kl()?" (Bun detected \u2014 JS/TS runs 3-5x faster)":"";dn.registerTool("execute",{title:"Execute Code",description:`Execute code in a sandboxed subprocess. Only stdout enters context \u2014 raw data stays in the subprocess. Use instead of bash/cat when output would exceed 20 lines.${gT} Available: ${hT}.`,inputSchema:ie.object({language:ie.enum(["javascript","typescript","python","shell","ruby","go","rust","php","perl","r"]).describe("Runtime language"),code:ie.string().describe("Source code to execute. Use console.log (JS/TS), print (Python/Ruby/Perl/R), echo (Shell), echo (PHP), or fmt.Println (Go) to output a summary to context."),timeout:ie.number().optional().default(3e4).describe("Max execution time in ms"),intent:ie.string().optional().describe(`What you're looking for in the output. When provided and output is large (>5KB), indexes output into knowledge base and returns section titles + previews \u2014 not full content. Use search() to retrieve specific sections. Example: 'failing tests', 'HTTP 500 errors'.
135
+ `)})}return s}#o(e,r){return e.length===0?r||"Untitled":e.map(n=>n.text).join(" > ")}};var Qg="0.5.23",Wl=ai(),mT=Jg(Wl),dn=new oi({name:"context-mode",version:Qg}),Xl=new ci({runtimes:Wl}),Jl=null;function di(){return Jl||(Jl=new _o),Jl}var hT=mT.join(", "),gT=Kl()?" (Bun detected \u2014 JS/TS runs 3-5x faster)":"";dn.registerTool("execute",{title:"Execute Code",description:`Execute code in a sandboxed subprocess. Only stdout enters context \u2014 raw data stays in the subprocess. Use instead of bash/cat when output would exceed 20 lines.${gT} Available: ${hT}.`,inputSchema:ie.object({language:ie.enum(["javascript","typescript","python","shell","ruby","go","rust","php","perl","r"]).describe("Runtime language"),code:ie.string().describe("Source code to execute. Use console.log (JS/TS), print (Python/Ruby/Perl/R), echo (Shell), echo (PHP), or fmt.Println (Go) to output a summary to context."),timeout:ie.number().optional().default(3e4).describe("Max execution time in ms"),intent:ie.string().optional().describe(`What you're looking for in the output. When provided and output is large (>5KB), indexes output into knowledge base and returns section titles + previews \u2014 not full content. Use search() to retrieve specific sections. Example: 'failing tests', 'HTTP 500 errors'.
136
136
 
137
137
  TIP: Use specific technical terms, not just concepts. Check 'Searchable terms' in the response for available vocabulary.`)})},async({language:t,code:e,timeout:r,intent:n})=>{try{let o=await Xl.execute({language:t,code:e,timeout:r});if(o.timedOut)return{content:[{type:"text",text:`Execution timed out after ${r}ms
138
138
 
@@ -25,21 +25,27 @@ description: |
25
25
 
26
26
  ## MANDATORY RULE
27
27
 
28
- **Before using Bash, curl, cat, or any command that produces output, ask yourself:**
28
+ **Default to context-mode for ALL commands. Only use Bash for guaranteed-small-output operations.**
29
29
 
30
- > "Could this output be more than 20 lines?"
30
+ Bash whitelist (safe to run directly):
31
+ - **File mutations**: `mkdir`, `mv`, `cp`, `rm`, `touch`, `chmod`
32
+ - **Git writes**: `git add`, `git commit`, `git push`, `git checkout`, `git branch`, `git merge`
33
+ - **Navigation**: `cd`, `pwd`, `which`
34
+ - **Process control**: `kill`, `pkill`
35
+ - **Package management**: `npm install`, `npm publish`, `pip install`
36
+ - **Simple output**: `echo`, `printf`
31
37
 
32
- If YES or UNCERTAIN use `execute` or `execute_file`. Not Bash. Not curl. Not cat.
38
+ **Everything else → `execute` or `execute_file`.** Any command that reads, queries, fetches, lists, logs, tests, builds, diffs, inspects, or calls an external service. This includes ALL CLIs (gh, aws, kubectl, docker, terraform, wrangler, fly, heroku, gcloud, etc.) there are thousands and we cannot list them all.
33
39
 
34
- **This is not optional.** Every KB of unnecessary context reduces the quality and speed of the entire session.
40
+ **When uncertain, use context-mode.** Every KB of unnecessary context reduces the quality and speed of the entire session.
35
41
 
36
42
  ## Decision Tree
37
43
 
38
44
  ```
39
45
  About to run a command / read a file / call an API?
40
46
 
41
- ├── Output is GUARANTEED small (<20 lines)?
42
- │ └── Use Bash (git status, pwd, ls, echo, etc.)
47
+ ├── Command is on the Bash whitelist (file mutations, git writes, navigation, echo)?
48
+ │ └── Use Bash
43
49
 
44
50
  ├── Output MIGHT be large or you're UNSURE?
45
51
  │ └── Use context-mode execute or execute_file
@@ -142,7 +148,7 @@ Use context-mode for ANY of these, without being asked:
142
148
  2. **Write analysis code, not just data dumps.** Don't `console.log(JSON.stringify(data))` — analyze first, print findings.
143
149
  3. **Be specific in output.** Print bug details with IDs, line numbers, exact values — not just counts.
144
150
  4. **For files you need to EDIT**: Use the normal Read tool. context-mode is for analysis, not editing.
145
- 5. **For tiny outputs (<5 lines guaranteed)**: Use Bash. Don't over-engineer `git status` through context-mode.
151
+ 5. **For Bash whitelist commands only**: Use Bash for file mutations, git writes, navigation, process control, package install, and echo. Everything else goes through context-mode.
146
152
  6. **Never use `index(content: large_data)`.** Use `index(path: ...)` to read files server-side. The `content` parameter sends data through context as a tool parameter — use it only for small inline text.
147
153
  7. **Always use `filename` parameter** on Playwright tools (`browser_snapshot`, `browser_console_messages`, `browser_network_requests`). Without it, the full output enters context.
148
154
  8. **Don't re-index data already in context.** If an MCP tool returned data in a previous response, it's already loaded — use it directly or save to file first.