context-mode 0.5.26 → 0.6.0

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/build/store.d.ts CHANGED
@@ -44,6 +44,11 @@ export declare class ContentStore {
44
44
  label: string;
45
45
  chunkCount: number;
46
46
  }>;
47
+ /**
48
+ * Get all chunks for a given source by ID — bypasses FTS5 MATCH entirely.
49
+ * Use this for inventory/listing where you need all sections, not search.
50
+ */
51
+ getChunksBySource(sourceId: number): SearchResult[];
47
52
  getDistinctiveTerms(sourceId: number, maxTerms?: number): string[];
48
53
  getStats(): StoreStats;
49
54
  close(): void;
package/build/store.js CHANGED
@@ -195,6 +195,26 @@ export class ContentStore {
195
195
  .prepare("SELECT label, chunk_count as chunkCount FROM sources ORDER BY id DESC")
196
196
  .all();
197
197
  }
198
+ /**
199
+ * Get all chunks for a given source by ID — bypasses FTS5 MATCH entirely.
200
+ * Use this for inventory/listing where you need all sections, not search.
201
+ */
202
+ getChunksBySource(sourceId) {
203
+ const rows = this.#db
204
+ .prepare(`SELECT c.title, c.content, c.content_type, s.label
205
+ FROM chunks c
206
+ JOIN sources s ON s.id = c.source_id
207
+ WHERE c.source_id = ?
208
+ ORDER BY c.rowid`)
209
+ .all(sourceId);
210
+ return rows.map((r) => ({
211
+ title: r.title,
212
+ content: r.content,
213
+ source: r.label,
214
+ rank: 0,
215
+ contentType: r.content_type,
216
+ }));
217
+ }
198
218
  // ── Vocabulary ──
199
219
  getDistinctiveTerms(sourceId, maxTerms = 40) {
200
220
  const stats = this.#db
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-mode",
3
- "version": "0.5.26",
3
+ "version": "0.6.0",
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",
@@ -16,9 +16,7 @@ description: |
16
16
  "outdated packages", "dependency tree", "cloud resources", "CI/CD output".
17
17
  Also triggers on ANY MCP tool output (Playwright, Context7, GitHub API) that
18
18
  may exceed 20 lines, and any operation where output size is uncertain.
19
- CRITICAL: When spawning subagents (Task tool), ALWAYS include explicit MCP tool
20
- names (mcp__context-mode__execute, mcp__context-mode__fetch_and_index, etc.)
21
- in the subagent prompt. Subagents inherit tools but NOT skill instructions.
19
+ Subagent routing is handled automatically via PreToolUse hook no manual tool names needed in prompts.
22
20
  ---
23
21
 
24
22
  # Context Mode: Default for All Large Output
@@ -128,13 +126,12 @@ Use context-mode for ANY of these, without being asked:
128
126
  ## Search Query Strategy
129
127
 
130
128
  - BM25 uses **OR semantics** — results matching more terms rank higher automatically
131
- - Use 2-4 specific technical terms per query: `search("transform refine pipe")`
129
+ - Use 2-4 specific technical terms per query
132
130
  - **Always use `source` parameter** when multiple docs are indexed to avoid cross-source contamination
133
- - After `fetch_and_index` returns `source: "Zod API docs"`, use `search("refine", source: "Zod")`
134
131
  - Partial match works: `source: "Node"` matches `"Node.js v22 CHANGELOG"`
135
- - Send multiple `search()` calls **in parallel** for different aspects of a topic
136
- - Example: instead of one broad search, send 3 focused parallel queries:
137
- - `search("transform pipe", source: "Zod")` + `search("refine superRefine", source: "Zod")` + `search("coerce codec", source: "Zod")`
132
+ - **Always use `queries` array** batch ALL search questions in ONE call:
133
+ - `search(queries: ["transform pipe", "refine superRefine", "coerce codec"], source: "Zod")`
134
+ - NEVER make multiple separate search() calls put all queries in one array
138
135
 
139
136
  ## External Documentation
140
137
 
@@ -208,7 +205,7 @@ Step 1: browser_snapshot(filename: "/tmp/playwright-snapshot.md")
208
205
  Step 2: index(path: "/tmp/playwright-snapshot.md", source: "Playwright snapshot")
209
206
  → reads file SERVER-SIDE, indexes into FTS5, returns ~80B confirmation
210
207
 
211
- Step 3: search("login form email password", source: "Playwright")
208
+ Step 3: search(queries: ["login form email password"], source: "Playwright")
212
209
  → returns only matching chunks (~300B)
213
210
  ```
214
211
 
@@ -258,40 +255,9 @@ browser_network_requests(includeStatic: false, filename: "/tmp/network.md")
258
255
  >
259
256
  > Data flow: **Playwright → file → server-side read → context**. Never: **Playwright → context → index(content) → context again**.
260
257
 
261
- ## Subagent Usage (CRITICAL)
258
+ ## Subagent Usage
262
259
 
263
- **Subagents inherit MCP tools but NOT skill instructions.** When you spawn a subagent via the Task tool, the subagent has access to `mcp__context-mode__execute`, `mcp__context-mode__execute_file`, `mcp__context-mode__fetch_and_index`, and `mcp__context-mode__search` but it doesn't know it should use them instead of Bash/Read/WebFetch.
264
-
265
- **You MUST include explicit tool names in every subagent prompt.** This is the only way to ensure subagents use context-mode tools.
266
-
267
- ### Rules for spawning subagents:
268
-
269
- 1. **Never write a subagent prompt that says "analyze this URL" or "run tests"** without specifying which tool to use.
270
- 2. **Always include the full MCP tool name** in the subagent prompt: `mcp__context-mode__execute`, not "context-mode execute" or "execute".
271
- 3. **Always add "do NOT use Bash, Read, or WebFetch"** to prevent fallback to standard tools.
272
- 4. **For browser tasks**, specify `mcp__context-mode__execute` with `language: "shell"` and the exact agent-browser commands.
273
- 5. **For doc fetching**, specify `mcp__context-mode__fetch_and_index` with exact url and source parameters, then `mcp__context-mode__search` with query and source.
274
-
275
- ### Template for subagent prompts:
276
-
277
- ```
278
- Use mcp__context-mode__execute with language "[lang]" and code:
279
- [exact code here]
280
- Set intent to "[what you're looking for]".
281
- Do NOT use Bash, Read, or WebFetch.
282
- ```
283
-
284
- ### Example — parallel browser + docs analysis:
285
-
286
- ```
287
- Task 1: Use mcp__context-mode__execute with language "shell" and code:
288
- AGENT_BROWSER_SESSION="session-a" agent-browser open https://example.com 2>&1 && AGENT_BROWSER_SESSION="session-a" agent-browser snapshot -i 2>&1
289
- Set intent to "links buttons forms". Do NOT use Bash.
290
-
291
- Task 2: Use mcp__context-mode__fetch_and_index with url "https://docs.example.com" and source "Example Docs".
292
- Then use mcp__context-mode__search with query "authentication setup" and source "Example".
293
- Do NOT use WebFetch.
294
- ```
260
+ Subagents automatically receive context-mode tool routing via a PreToolUse hook. You do NOT need to manually add tool names to subagent promptsthe hook injects them. Just write natural task descriptions.
295
261
 
296
262
  ## Anti-Patterns
297
263