context-mode 0.5.10 → 0.5.11
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.
- package/.claude-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/skills/context-mode/SKILL.md +110 -51
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-mode",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.11",
|
|
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",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-mode",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.11",
|
|
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",
|
|
@@ -1,54 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: context-mode
|
|
3
3
|
description: |
|
|
4
|
-
Use context-mode tools (execute, execute_file
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
commit log, blame, changelog analysis.
|
|
20
|
-
|
|
21
|
-
Data Processing: parse JSON, parse CSV, analyze output, summarize output, process data,
|
|
22
|
-
filter results, extract patterns, transform data, count occurrences.
|
|
23
|
-
|
|
24
|
-
Infrastructure & Containers: list containers, container resource usage, container stats,
|
|
25
|
-
container memory, container CPU, pod status, service health, deployment status,
|
|
26
|
-
cluster info, orchestration state, compose services.
|
|
27
|
-
|
|
28
|
-
System & Processes: running processes, system resource usage, disk usage, memory usage,
|
|
29
|
-
network connections, open ports, file descriptors, system load.
|
|
30
|
-
|
|
31
|
-
Package & Dependency Management: list dependencies, outdated packages, dependency tree,
|
|
32
|
-
installed packages, audit vulnerabilities, license check.
|
|
33
|
-
|
|
34
|
-
Database: list databases, show tables, describe schema, explain query, query results.
|
|
35
|
-
|
|
36
|
-
Cloud & DevOps: cloud resources, storage buckets, compute instances, cloud functions,
|
|
37
|
-
DNS records, SSL certificates, CDN status, CI/CD pipeline output.
|
|
38
|
-
|
|
39
|
-
Code Analysis: count lines, find TODOs, analyze codebase, security audit, code metrics,
|
|
40
|
-
find patterns, codebase statistics.
|
|
41
|
-
|
|
42
|
-
API Endpoints: hit endpoint, call API, check response, test endpoint, API debugging.
|
|
43
|
-
|
|
44
|
-
Browser & UI Inspection: page snapshot, browser snapshot, extract elements, DOM structure,
|
|
45
|
-
page accessibility tree, inspect page, page elements, form fields, UI components,
|
|
46
|
-
screenshot analysis, web page structure, HTML elements, element selectors.
|
|
47
|
-
|
|
48
|
-
MCP Tool Output Routing: ANY large output from Playwright, Context7, GitHub API,
|
|
49
|
-
Sentry, or other MCP tools should be routed through index → search.
|
|
50
|
-
|
|
51
|
-
Or ANY operation where output might exceed 20 lines.
|
|
4
|
+
Use context-mode tools (execute, execute_file) instead of Bash/cat when processing
|
|
5
|
+
large outputs. Trigger phrases: "analyze logs", "summarize output", "process data",
|
|
6
|
+
"parse JSON", "filter results", "extract errors", "check build output",
|
|
7
|
+
"analyze dependencies", "process API response", "large file analysis",
|
|
8
|
+
"extract elements", "page snapshot", "browser snapshot", "take a snapshot",
|
|
9
|
+
"DOM structure", "inspect page", "form fields", "element selectors",
|
|
10
|
+
"web page structure", "accessibility tree", "Playwright snapshot",
|
|
11
|
+
"run tests", "test output", "coverage report", "git log", "recent commits",
|
|
12
|
+
"diff between branches", "list containers", "pod status", "disk usage",
|
|
13
|
+
"fetch docs", "API reference", "index documentation", "hit endpoint",
|
|
14
|
+
"call API", "check response", "query results", "show tables",
|
|
15
|
+
"find TODOs", "count lines", "codebase statistics", "security audit",
|
|
16
|
+
"outdated packages", "dependency tree", "cloud resources", "CI/CD output".
|
|
17
|
+
Also triggers on ANY MCP tool output (Playwright, Context7, GitHub API) that
|
|
18
|
+
may exceed 20 lines, and any operation where output size is uncertain.
|
|
52
19
|
---
|
|
53
20
|
|
|
54
21
|
# Context Mode: Default for All Large Output
|
|
@@ -77,8 +44,21 @@ About to run a command / read a file / call an API?
|
|
|
77
44
|
├── Fetching web documentation or HTML page?
|
|
78
45
|
│ └── Use fetch_and_index → search
|
|
79
46
|
│
|
|
80
|
-
├──
|
|
81
|
-
│ └──
|
|
47
|
+
├── Using Playwright (navigate, snapshot, console, network)?
|
|
48
|
+
│ └── ALWAYS use filename parameter to save to file, then:
|
|
49
|
+
│ browser_snapshot(filename) → index(path) or execute_file(path)
|
|
50
|
+
│ browser_console_messages(filename) → execute_file(path)
|
|
51
|
+
│ browser_network_requests(filename) → execute_file(path)
|
|
52
|
+
│ ⚠ browser_navigate returns a snapshot automatically — ignore it,
|
|
53
|
+
│ use browser_snapshot(filename) for any inspection.
|
|
54
|
+
│
|
|
55
|
+
├── Processing output from another MCP tool (Context7, GitHub API, etc.)?
|
|
56
|
+
│ ├── Output already in context from a previous tool call?
|
|
57
|
+
│ │ └── Use it directly. Do NOT re-index with index(content: ...).
|
|
58
|
+
│ ├── Need to search the output multiple times?
|
|
59
|
+
│ │ └── Save to file via execute, then index(path) → search
|
|
60
|
+
│ └── One-shot extraction?
|
|
61
|
+
│ └── Save to file via execute, then execute_file(path)
|
|
82
62
|
│
|
|
83
63
|
└── Reading a file to analyze/summarize (not edit)?
|
|
84
64
|
└── Use execute_file (file loads into FILE_CONTENT, not context)
|
|
@@ -97,7 +77,11 @@ About to run a command / read a file / call an API?
|
|
|
97
77
|
| Read a data file | `execute_file` | Analyze CSV, JSON, YAML, XML |
|
|
98
78
|
| Read source code to analyze | `execute_file` | Count functions, find patterns, extract metrics |
|
|
99
79
|
| Fetch web docs | `fetch_and_index` | Index React/Next.js/Zod docs, then search |
|
|
100
|
-
|
|
|
80
|
+
| Playwright snapshot | `browser_snapshot(filename)` → `index(path)` → `search` | Save to file, index server-side, query |
|
|
81
|
+
| Playwright snapshot (one-shot) | `browser_snapshot(filename)` → `execute_file(path)` | Save to file, extract in sandbox |
|
|
82
|
+
| Playwright console/network | `browser_*(filename)` → `execute_file(path)` | Save to file, analyze in sandbox |
|
|
83
|
+
| MCP output (already in context) | Use directly | Don't re-index — it's already loaded |
|
|
84
|
+
| MCP output (need multi-query) | `execute` to save → `index(path)` → `search` | Save to file first, index server-side |
|
|
101
85
|
|
|
102
86
|
## Automatic Triggers
|
|
103
87
|
|
|
@@ -147,6 +131,9 @@ Use context-mode for ANY of these, without being asked:
|
|
|
147
131
|
3. **Be specific in output.** Print bug details with IDs, line numbers, exact values — not just counts.
|
|
148
132
|
4. **For files you need to EDIT**: Use the normal Read tool. context-mode is for analysis, not editing.
|
|
149
133
|
5. **For tiny outputs (<5 lines guaranteed)**: Use Bash. Don't over-engineer `git status` through context-mode.
|
|
134
|
+
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.
|
|
135
|
+
7. **Always use `filename` parameter** on Playwright tools (`browser_snapshot`, `browser_console_messages`, `browser_network_requests`). Without it, the full output enters context.
|
|
136
|
+
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.
|
|
150
137
|
|
|
151
138
|
## Examples
|
|
152
139
|
|
|
@@ -186,6 +173,73 @@ print(f"Records: {len(data)}")
|
|
|
186
173
|
# ... analyze and print findings
|
|
187
174
|
```
|
|
188
175
|
|
|
176
|
+
## Browser & Playwright Integration
|
|
177
|
+
|
|
178
|
+
**When a task involves Playwright snapshots, screenshots, or page inspection, ALWAYS route through file → sandbox.**
|
|
179
|
+
|
|
180
|
+
Playwright `browser_snapshot` returns 10K–135K tokens of accessibility tree data. Calling it without `filename` dumps all of that into context. Passing the output to `index(content: ...)` sends it into context a SECOND time as a parameter. Both are wrong.
|
|
181
|
+
|
|
182
|
+
**The key insight**: `browser_snapshot` has a `filename` parameter that saves to file instead of returning to context. `index` has a `path` parameter that reads files server-side. `execute_file` processes files in a sandbox. **None of these touch context.**
|
|
183
|
+
|
|
184
|
+
### Workflow A: Snapshot → File → Index → Search (multiple queries)
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
Step 1: browser_snapshot(filename: "/tmp/playwright-snapshot.md")
|
|
188
|
+
→ saves to file, returns ~50B confirmation (NOT 135K tokens)
|
|
189
|
+
|
|
190
|
+
Step 2: index(path: "/tmp/playwright-snapshot.md", source: "Playwright snapshot")
|
|
191
|
+
→ reads file SERVER-SIDE, indexes into FTS5, returns ~80B confirmation
|
|
192
|
+
|
|
193
|
+
Step 3: search("login form email password", source: "Playwright")
|
|
194
|
+
→ returns only matching chunks (~300B)
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**Total context: ~430B** instead of 270K tokens. Real 99% savings.
|
|
198
|
+
|
|
199
|
+
### Workflow B: Snapshot → File → Execute File (one-shot extraction)
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
Step 1: browser_snapshot(filename: "/tmp/playwright-snapshot.md")
|
|
203
|
+
→ saves to file, returns ~50B confirmation
|
|
204
|
+
|
|
205
|
+
Step 2: execute_file(path: "/tmp/playwright-snapshot.md", language: "javascript", code: "
|
|
206
|
+
const links = [...FILE_CONTENT.matchAll(/- link \"([^\"]+)\"/g)].map(m => m[1]);
|
|
207
|
+
const buttons = [...FILE_CONTENT.matchAll(/- button \"([^\"]+)\"/g)].map(m => m[1]);
|
|
208
|
+
const inputs = [...FILE_CONTENT.matchAll(/- textbox|- checkbox|- radio/g)];
|
|
209
|
+
console.log('Links:', links.length, '| Buttons:', buttons.length, '| Inputs:', inputs.length);
|
|
210
|
+
console.log('Navigation:', links.slice(0, 10).join(', '));
|
|
211
|
+
")
|
|
212
|
+
→ processes in sandbox, returns ~200B summary
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
**Total context: ~250B** instead of 135K tokens.
|
|
216
|
+
|
|
217
|
+
### Workflow C: Console & Network (save to file if large)
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
browser_console_messages(level: "error", filename: "/tmp/console.md")
|
|
221
|
+
→ execute_file(path: "/tmp/console.md", ...) or index(path: "/tmp/console.md", ...)
|
|
222
|
+
|
|
223
|
+
browser_network_requests(includeStatic: false, filename: "/tmp/network.md")
|
|
224
|
+
→ execute_file(path: "/tmp/network.md", ...) or index(path: "/tmp/network.md", ...)
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### CRITICAL: Why `filename` + `path` is mandatory
|
|
228
|
+
|
|
229
|
+
| Approach | Context cost | Correct? |
|
|
230
|
+
|----------|-------------|----------|
|
|
231
|
+
| `browser_snapshot()` → raw into context | **135K tokens** | NO |
|
|
232
|
+
| `browser_snapshot()` → `index(content: raw)` | **270K tokens** (doubled!) | NO |
|
|
233
|
+
| `browser_snapshot(filename)` → `index(path)` → `search` | **~430B** | YES |
|
|
234
|
+
| `browser_snapshot(filename)` → `execute_file(path)` | **~250B** | YES |
|
|
235
|
+
|
|
236
|
+
### Key Rule
|
|
237
|
+
|
|
238
|
+
> **ALWAYS use `filename` parameter when calling `browser_snapshot`, `browser_console_messages`, or `browser_network_requests`.**
|
|
239
|
+
> Then process via `index(path: ...)` or `execute_file(path: ...)` — never `index(content: ...)`.
|
|
240
|
+
>
|
|
241
|
+
> Data flow: **Playwright → file → server-side read → context**. Never: **Playwright → context → index(content) → context again**.
|
|
242
|
+
|
|
189
243
|
## Anti-Patterns
|
|
190
244
|
|
|
191
245
|
- Using `curl http://api/endpoint` via Bash → 50KB floods context. Use `execute` with fetch instead.
|
|
@@ -193,6 +247,11 @@ print(f"Records: {len(data)}")
|
|
|
193
247
|
- Using `gh pr list` via Bash → raw JSON in context. Use `execute` with `--jq` filter instead.
|
|
194
248
|
- Piping Bash output through `| head -20` → you lose the rest. Use `execute` to analyze ALL data and print summary.
|
|
195
249
|
- Running `npm test` via Bash → full test output in context. Use `execute` to capture and summarize.
|
|
250
|
+
- Calling `browser_snapshot()` WITHOUT `filename` parameter → 135K tokens flood context. **Always** use `browser_snapshot(filename: "/tmp/snap.md")`.
|
|
251
|
+
- Calling `browser_console_messages()` or `browser_network_requests()` WITHOUT `filename` → entire output floods context. **Always** use the `filename` parameter.
|
|
252
|
+
- Passing ANY large data to `index(content: ...)` → data enters context as a parameter. **Always** use `index(path: ...)` to read server-side. The `content` parameter should only be used for small inline text you're composing yourself.
|
|
253
|
+
- Calling an MCP tool (Context7 `query-docs`, GitHub API, etc.) then passing the response to `index(content: response)` → **doubles** context usage. The response is already in context — use it directly or save to file first.
|
|
254
|
+
- Ignoring `browser_navigate` auto-snapshot → navigation response includes a full page snapshot. Don't rely on it for inspection — call `browser_snapshot(filename)` separately.
|
|
196
255
|
|
|
197
256
|
## Reference Files
|
|
198
257
|
|