context-mode 1.0.65 → 1.0.67

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.
@@ -100,6 +100,7 @@ About to run a command / read a file / call an API?
100
100
  | Playwright console/network | `browser_*(filename)` → `ctx_execute_file(path)` | Save to file, analyze in sandbox |
101
101
  | MCP output (already in context) | Use directly | Don't re-index — it's already loaded |
102
102
  | MCP output (need multi-query) | `ctx_execute` to save → `ctx_index(path)` → `ctx_search` | Save to file first, index server-side |
103
+ | Wipe indexed KB content | `ctx_purge(confirm: true)` | Permanently deletes all indexed content |
103
104
 
104
105
  ## Automatic Triggers
105
106
 
@@ -288,6 +289,7 @@ Subagents automatically receive context-mode tool routing via a PreToolUse hook.
288
289
  - Passing ANY large data to `ctx_index(content: ...)` → data enters context as a parameter. **Always** use `ctx_index(path: ...)` to read server-side. The `content` parameter should only be used for small inline text you're composing yourself.
289
290
  - Calling an MCP tool (Context7 `query-docs`, GitHub API, etc.) then passing the response to `ctx_index(content: response)` → **doubles** context usage. The response is already in context — use it directly or save to file first.
290
291
  - Ignoring `browser_navigate` auto-snapshot → navigation response includes a full page snapshot. Don't rely on it for inspection — call `browser_snapshot(filename)` separately.
292
+ - Expecting `ctx_stats` to reset or wipe anything → `ctx_stats` is read-only (shows stats only). Use `ctx_purge(confirm: true)` to permanently delete all indexed content.
291
293
 
292
294
  ## Reference Files
293
295
 
@@ -44,6 +44,24 @@ One untested change breaks everything. TDD is not optional, it is the gate.
44
44
  4. **Architects**: REJECT any change without tests. No exceptions, no "trivial change" excuse.
45
45
  5. **QA Engineer**: Run full suite after EVERY change. Report failures immediately.
46
46
 
47
+ ## Grill-Me Review: BLOCKING GATE
48
+
49
+ <grill_me_enforcement>
50
+ STOP. Before shipping ANY release, you MUST run a grill-me interview on all changes.
51
+ No exceptions. No "this is a small patch." No "we already tested it."
52
+ Every release gets grilled. If the grill reveals an unresolved question, the release is BLOCKED.
53
+ </grill_me_enforcement>
54
+
55
+ **The grill-me interview is MANDATORY before every release.** Summary:
56
+
57
+ 1. Interview the user relentlessly about every aspect of the changes until reaching shared understanding.
58
+ 2. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one.
59
+ 3. For each question, provide your recommended answer.
60
+ 4. Ask questions one at a time.
61
+ 5. If a question can be answered by exploring the codebase, explore the codebase instead of asking.
62
+ 6. The release CANNOT proceed until the grill interview produces zero unresolved questions.
63
+ 7. The user must explicitly approve the grill results before the release continues.
64
+
47
65
  ## You Are the Engineering Manager
48
66
 
49
67
  <delegation_enforcement>
@@ -34,6 +34,21 @@ Spawn these agents simultaneously:
34
34
 
35
35
  All must report PASS before proceeding.
36
36
 
37
+ ### 1b. Grill-Me Review — MANDATORY BLOCKING GATE
38
+
39
+ **Before ANY version bump, the EM MUST run a grill-me interview on all changes in this release.**
40
+
41
+ This is not optional. This is not skippable. Every release gets grilled.
42
+
43
+ Interview the user relentlessly about every aspect of the changes until reaching shared understanding. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one. For each question, provide your recommended answer. Ask questions one at a time. If a question can be answered by exploring the codebase, explore the codebase instead of asking.
44
+
45
+ **The release is BLOCKED until:**
46
+ - [ ] All branches of the design tree are resolved
47
+ - [ ] Zero unresolved questions remain
48
+ - [ ] User explicitly approves the grill results
49
+
50
+ Only after grill-me approval: proceed to version bump.
51
+
37
52
  ### 2. Version Bump — MANDATORY
38
53
 
39
54
  <version_bump_enforcement>
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: ctx-purge
3
+ description: |
4
+ Purge the context-mode knowledge base. Permanently deletes all indexed content
5
+ and resets session stats. This is destructive and cannot be undone.
6
+ Trigger: /context-mode:ctx-purge
7
+ user-invocable: true
8
+ ---
9
+
10
+ # Context Mode Purge
11
+
12
+ Permanently deletes ALL session data for this project: knowledge base, session events, analytics, and stats.
13
+
14
+ ## Instructions
15
+
16
+ 1. **Warn the user**: This is irreversible. Everything will be deleted:
17
+ - FTS5 knowledge base (all indexed content from `ctx_index`, `ctx_fetch_and_index`, `ctx_batch_execute`)
18
+ - Session events DB (analytics, metadata, resume snapshots)
19
+ - Session events markdown file
20
+ - In-memory session stats
21
+ 2. Call the `mcp__context-mode__ctx_purge` MCP tool with `confirm: true`.
22
+ 3. Report the result to the user — the response lists exactly what was deleted.
23
+
24
+ ## When to Use
25
+
26
+ - When the KB contains stale or incorrect content polluting search results.
27
+ - When switching between unrelated projects in the same session.
28
+ - When you want a completely fresh start for this project.
29
+
30
+ ## Important
31
+
32
+ - `ctx_purge` is the **only** way to delete session data. No other mechanism exists.
33
+ - `ctx_stats` is read-only — shows statistics only.
34
+ - `/clear` and `/compact` do NOT affect any context-mode data.
35
+ - There is no undo. Re-index content if you need it again.
@@ -3,6 +3,8 @@ name: ctx-stats
3
3
  description: |
4
4
  Show how much context window context-mode saved this session.
5
5
  Displays token consumption, context savings ratio, and per-tool breakdown.
6
+ Read-only — shows stats only, no reset capability.
7
+ To wipe the knowledge base entirely, use ctx_purge instead.
6
8
  Trigger: /context-mode:ctx-stats
7
9
  user-invocable: true
8
10
  ---
@@ -18,3 +20,7 @@ Show context savings for the current session.
18
20
  3. After the full output, add ONE sentence highlighting the key savings metric, e.g.:
19
21
  - "context-mode saved **12.4x** — 92% of data stayed in sandbox."
20
22
  - If no data yet: "No context-mode calls yet this session."
23
+
24
+ ## Purge
25
+
26
+ - **`ctx_purge(confirm: true)`** — Permanently deletes all indexed content from the knowledge base. Use `/context-mode:ctx-purge` for this.
package/start.mjs CHANGED
@@ -13,6 +13,13 @@ if (!process.env.CLAUDE_PROJECT_DIR) {
13
13
  process.env.CLAUDE_PROJECT_DIR = originalCwd;
14
14
  }
15
15
 
16
+ // Platform-agnostic project dir — guaranteed to be set for ALL platforms.
17
+ // Adapters may set their own env var (GEMINI_PROJECT_DIR, etc.) but this
18
+ // is the universal fallback so server.ts getProjectDir() never relies on cwd().
19
+ if (!process.env.CONTEXT_MODE_PROJECT_DIR) {
20
+ process.env.CONTEXT_MODE_PROJECT_DIR = originalCwd;
21
+ }
22
+
16
23
  // Routing instructions file auto-write DISABLED for all platforms (#158, #164).
17
24
  // Env vars like CLAUDE_SESSION_ID may not be set at MCP startup time, making
18
25
  // the hook-capability guard unreliable. Writing to project dirs dirties git trees