|
3 | 3 | - **Type:** Static Website |
4 | 4 | - **Test:** `pre-commit run -a` |
5 | 5 | - **Lint:** `actionlint`, `prettier` |
| 6 | + |
| 7 | +# context-mode — MANDATORY routing rules |
| 8 | + |
| 9 | +You have context-mode MCP tools available. These rules are NOT optional — they protect your context window from flooding. A single unrouted command can dump 56 KB into context and waste the entire session. |
| 10 | + |
| 11 | +## BLOCKED commands — do NOT attempt these |
| 12 | + |
| 13 | +### curl / wget — BLOCKED |
| 14 | + |
| 15 | +Any shell command containing `curl` or `wget` will be intercepted and blocked by the context-mode plugin. Do NOT retry. |
| 16 | +Instead use: |
| 17 | + |
| 18 | +- `context-mode_ctx_fetch_and_index(url, source)` to fetch and index web pages |
| 19 | +- `context-mode_ctx_execute(language: "javascript", code: "const r = await fetch(...)")` to run HTTP calls in sandbox |
| 20 | + |
| 21 | +### Inline HTTP — BLOCKED |
| 22 | + |
| 23 | +Any shell command containing `fetch('http`, `requests.get(`, `requests.post(`, `http.get(`, or `http.request(` will be intercepted and blocked. Do NOT retry with shell. |
| 24 | +Instead use: |
| 25 | + |
| 26 | +- `context-mode_ctx_execute(language, code)` to run HTTP calls in sandbox — only stdout enters context |
| 27 | + |
| 28 | +### Direct web fetching — BLOCKED |
| 29 | + |
| 30 | +Do NOT use any direct URL fetching tool. Use the sandbox equivalent. |
| 31 | +Instead use: |
| 32 | + |
| 33 | +- `context-mode_ctx_fetch_and_index(url, source)` then `context-mode_ctx_search(queries)` to query the indexed content |
| 34 | + |
| 35 | +## REDIRECTED tools — use sandbox equivalents |
| 36 | + |
| 37 | +### Shell (>20 lines output) |
| 38 | + |
| 39 | +Shell is ONLY for: `git`, `mkdir`, `rm`, `mv`, `cd`, `ls`, `npm install`, `pip install`, and other short-output commands. |
| 40 | +For everything else, use: |
| 41 | + |
| 42 | +- `context-mode_ctx_batch_execute(commands, queries)` — run multiple commands + search in ONE call |
| 43 | +- `context-mode_ctx_execute(language: "shell", code: "...")` — run in sandbox, only stdout enters context |
| 44 | + |
| 45 | +### File reading (for analysis) |
| 46 | + |
| 47 | +If you are reading a file to **edit** it → reading is correct (edit needs content in context). |
| 48 | +If you are reading to **analyze, explore, or summarize** → use `context-mode_ctx_execute_file(path, language, code)` instead. Only your printed summary enters context. |
| 49 | + |
| 50 | +### grep / search (large results) |
| 51 | + |
| 52 | +Search results can flood context. Use `context-mode_ctx_execute(language: "shell", code: "grep ...")` to run searches in sandbox. Only your printed summary enters context. |
| 53 | + |
| 54 | +## Tool selection hierarchy |
| 55 | + |
| 56 | +1. **GATHER**: `context-mode_ctx_batch_execute(commands, queries)` — Primary tool. Runs all commands, auto-indexes output, returns search results. ONE call replaces 30+ individual calls. |
| 57 | +2. **FOLLOW-UP**: `context-mode_ctx_search(queries: ["q1", "q2", ...])` — Query indexed content. Pass ALL questions as array in ONE call. |
| 58 | +3. **PROCESSING**: `context-mode_ctx_execute(language, code)` | `context-mode_ctx_execute_file(path, language, code)` — Sandbox execution. Only stdout enters context. |
| 59 | +4. **WEB**: `context-mode_ctx_fetch_and_index(url, source)` then `context-mode_ctx_search(queries)` — Fetch, chunk, index, query. Raw HTML never enters context. |
| 60 | +5. **INDEX**: `context-mode_ctx_index(content, source)` — Store content in FTS5 knowledge base for later search. |
| 61 | + |
| 62 | +## Output constraints |
| 63 | + |
| 64 | +- Keep responses under 500 words. |
| 65 | +- Write artifacts (code, configs, PRDs) to FILES — never return them as inline text. Return only: file path + 1-line description. |
| 66 | +- When indexing content, use descriptive source labels so others can `search(source: "label")` later. |
| 67 | + |
| 68 | +## ctx commands |
| 69 | + |
| 70 | +| Command | Action | |
| 71 | +| ------------- | --------------------------------------------------------------------------------- | |
| 72 | +| `ctx stats` | Call the `stats` MCP tool and display the full output verbatim | |
| 73 | +| `ctx doctor` | Call the `doctor` MCP tool, run the returned shell command, display as checklist | |
| 74 | +| `ctx upgrade` | Call the `upgrade` MCP tool, run the returned shell command, display as checklist | |
0 commit comments