context-mode 1.0.64 → 1.0.66
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/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/.openclaw-plugin/openclaw.plugin.json +1 -1
- package/.openclaw-plugin/package.json +1 -1
- package/README.md +3 -1
- package/build/server.js +205 -205
- package/build/session/analytics.d.ts +381 -0
- package/build/session/analytics.js +708 -0
- package/cli.bundle.mjs +203 -143
- package/configs/antigravity/GEMINI.md +3 -0
- package/configs/claude-code/CLAUDE.md +3 -0
- package/configs/codex/AGENTS.md +3 -0
- package/configs/gemini-cli/GEMINI.md +3 -0
- package/configs/kilo/AGENTS.md +3 -0
- package/configs/kiro/KIRO.md +3 -0
- package/configs/openclaw/AGENTS.md +3 -0
- package/configs/opencode/AGENTS.md +3 -0
- package/configs/pi/AGENTS.md +3 -0
- package/configs/vscode-copilot/copilot-instructions.md +3 -0
- package/configs/zed/AGENTS.md +3 -0
- package/hooks/ensure-deps.mjs +23 -0
- package/hooks/routing-block.mjs +4 -1
- package/hooks/session-helpers.mjs +0 -12
- package/hooks/sessionstart.mjs +2 -5
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/server.bundle.mjs +134 -74
- package/skills/context-mode/SKILL.md +2 -0
- package/skills/ctx-purge/SKILL.md +35 -0
- package/skills/ctx-stats/SKILL.md +6 -0
- package/start.mjs +7 -0
|
@@ -60,3 +60,6 @@ Search results can flood context. Use `mcp__context-mode__ctx_execute(language:
|
|
|
60
60
|
| `ctx stats` | Call the `stats` MCP tool and display the full output verbatim |
|
|
61
61
|
| `ctx doctor` | Call the `doctor` MCP tool, run the returned shell command, display as checklist |
|
|
62
62
|
| `ctx upgrade` | Call the `upgrade` MCP tool, run the returned shell command, display as checklist |
|
|
63
|
+
| `ctx purge` | Call the `purge` MCP tool with confirm: true. Warns before wiping the knowledge base. |
|
|
64
|
+
|
|
65
|
+
After /clear or /compact: knowledge base and session stats are preserved. Use `ctx purge` if you want to start fresh.
|
|
@@ -64,3 +64,6 @@ When spawning subagents (Agent/Task tool), the routing block is automatically in
|
|
|
64
64
|
| `ctx stats` | Call the `ctx_stats` MCP tool and display the full output verbatim |
|
|
65
65
|
| `ctx doctor` | Call the `ctx_doctor` MCP tool, run the returned shell command, display as checklist |
|
|
66
66
|
| `ctx upgrade` | Call the `ctx_upgrade` MCP tool, run the returned shell command, display as checklist |
|
|
67
|
+
| `ctx purge` | Call the `ctx_purge` MCP tool with confirm: true. Warns before wiping the knowledge base. |
|
|
68
|
+
|
|
69
|
+
After /clear or /compact: knowledge base and session stats are preserved. Use `ctx purge` if you want to start fresh.
|
package/configs/codex/AGENTS.md
CHANGED
|
@@ -60,6 +60,9 @@ Search results can flood context. Use `ctx_execute(language: "shell", code: "gre
|
|
|
60
60
|
| `ctx stats` | Call the `stats` MCP tool and display the full output verbatim |
|
|
61
61
|
| `ctx doctor` | Call the `doctor` MCP tool, run the returned shell command, display as checklist |
|
|
62
62
|
| `ctx upgrade` | Call the `upgrade` MCP tool, run the returned shell command, display as checklist |
|
|
63
|
+
| `ctx purge` | Call the `purge` MCP tool with confirm: true. Warns before wiping the knowledge base. |
|
|
64
|
+
|
|
65
|
+
After /clear or /compact: knowledge base and session stats are preserved. Use `ctx purge` if you want to start fresh.
|
|
63
66
|
|
|
64
67
|
## Windows notes
|
|
65
68
|
|
|
@@ -60,3 +60,6 @@ Search results can flood context. Use `mcp__context-mode__ctx_execute(language:
|
|
|
60
60
|
| `ctx stats` | Call the `stats` MCP tool and display the full output verbatim |
|
|
61
61
|
| `ctx doctor` | Call the `doctor` MCP tool, run the returned shell command, display as checklist |
|
|
62
62
|
| `ctx upgrade` | Call the `upgrade` MCP tool, run the returned shell command, display as checklist |
|
|
63
|
+
| `ctx purge` | Call the `purge` MCP tool with confirm: true. Warns before wiping the knowledge base. |
|
|
64
|
+
|
|
65
|
+
After /clear or /compact: knowledge base and session stats are preserved. Use `ctx purge` if you want to start fresh.
|
package/configs/kilo/AGENTS.md
CHANGED
|
@@ -60,3 +60,6 @@ Search results can flood context. Use `context-mode_ctx_execute(language: "shell
|
|
|
60
60
|
| `ctx stats` | Call the `stats` MCP tool and display the full output verbatim |
|
|
61
61
|
| `ctx doctor` | Call the `doctor` MCP tool, run the returned shell command, display as checklist |
|
|
62
62
|
| `ctx upgrade` | Call the `upgrade` MCP tool, run the returned shell command, display as checklist |
|
|
63
|
+
| `ctx purge` | Call the `purge` MCP tool with confirm: true. Warns before wiping the knowledge base. |
|
|
64
|
+
|
|
65
|
+
After /clear or /compact: knowledge base and session stats are preserved. Use `ctx purge` if you want to start fresh.
|
package/configs/kiro/KIRO.md
CHANGED
|
@@ -60,3 +60,6 @@ Search results can flood context. Use `@context-mode/ctx_execute(language: "shel
|
|
|
60
60
|
| `ctx stats` | Call the `stats` MCP tool and display the full output verbatim |
|
|
61
61
|
| `ctx doctor` | Call the `doctor` MCP tool, run the returned shell command, display as checklist |
|
|
62
62
|
| `ctx upgrade` | Call the `upgrade` MCP tool, run the returned shell command, display as checklist |
|
|
63
|
+
| `ctx purge` | Call the `purge` MCP tool with confirm: true. Warns before wiping the knowledge base. |
|
|
64
|
+
|
|
65
|
+
After /clear or /compact: knowledge base and session stats are preserved. Use `ctx purge` if you want to start fresh.
|
|
@@ -60,3 +60,6 @@ Search results can flood context. Use `ctx_execute(language: "shell", code: "gre
|
|
|
60
60
|
| `ctx stats` | Call the `stats` MCP tool and display the full output verbatim |
|
|
61
61
|
| `ctx doctor` | Call the `doctor` MCP tool, run the returned shell command, display as checklist |
|
|
62
62
|
| `ctx upgrade` | Call the `upgrade` MCP tool, run the returned shell command, display as checklist |
|
|
63
|
+
| `ctx purge` | Call the `purge` MCP tool with confirm: true. Warns before wiping the knowledge base. |
|
|
64
|
+
|
|
65
|
+
After /clear or /compact: knowledge base and session stats are preserved. Use `ctx purge` if you want to start fresh.
|
|
@@ -60,3 +60,6 @@ Search results can flood context. Use `context-mode_ctx_execute(language: "shell
|
|
|
60
60
|
| `ctx stats` | Call the `stats` MCP tool and display the full output verbatim |
|
|
61
61
|
| `ctx doctor` | Call the `doctor` MCP tool, run the returned shell command, display as checklist |
|
|
62
62
|
| `ctx upgrade` | Call the `upgrade` MCP tool, run the returned shell command, display as checklist |
|
|
63
|
+
| `ctx purge` | Call the `purge` MCP tool with confirm: true. Warns before wiping the knowledge base. |
|
|
64
|
+
|
|
65
|
+
After /clear or /compact: knowledge base and session stats are preserved. Use `ctx purge` if you want to start fresh.
|
package/configs/pi/AGENTS.md
CHANGED
|
@@ -60,3 +60,6 @@ Search results from `grep` or `find` can flood context. Use `ctx_execute(languag
|
|
|
60
60
|
| `ctx stats` | Call the `stats` MCP tool and display the full output verbatim |
|
|
61
61
|
| `ctx doctor` | Call the `doctor` MCP tool, run the returned shell command, display as checklist |
|
|
62
62
|
| `ctx upgrade` | Call the `upgrade` MCP tool, run the returned shell command, display as checklist |
|
|
63
|
+
| `ctx purge` | Call the `purge` MCP tool with confirm: true. Warns before wiping the knowledge base. |
|
|
64
|
+
|
|
65
|
+
After /clear or /compact: knowledge base and session stats are preserved. Use `ctx purge` if you want to start fresh.
|
|
@@ -60,3 +60,6 @@ Search results can flood context. Use `ctx_execute(language: "shell", code: "gre
|
|
|
60
60
|
| `ctx stats` | Call the `ctx_stats` MCP tool and display the full output verbatim |
|
|
61
61
|
| `ctx doctor` | Call the `ctx_doctor` MCP tool, run the returned shell command, display as checklist |
|
|
62
62
|
| `ctx upgrade` | Call the `ctx_upgrade` MCP tool, run the returned shell command, display as checklist |
|
|
63
|
+
| `ctx purge` | Call the `ctx_purge` MCP tool with confirm: true. Warns before wiping the knowledge base. |
|
|
64
|
+
|
|
65
|
+
After /clear or /compact: knowledge base and session stats are preserved. Use `ctx purge` if you want to start fresh.
|
package/configs/zed/AGENTS.md
CHANGED
|
@@ -60,3 +60,6 @@ Search results can flood context. Use `mcp:context-mode:ctx_execute(language: "s
|
|
|
60
60
|
| `ctx stats` | Call the `stats` MCP tool and display the full output verbatim |
|
|
61
61
|
| `ctx doctor` | Call the `doctor` MCP tool, run the returned shell command, display as checklist |
|
|
62
62
|
| `ctx upgrade` | Call the `upgrade` MCP tool, run the returned shell command, display as checklist |
|
|
63
|
+
| `ctx purge` | Call the `mcp:context-mode:purge` MCP tool with confirm: true. Warns before wiping the knowledge base. |
|
|
64
|
+
|
|
65
|
+
After /clear or /compact: knowledge base and session stats are preserved. Use `ctx purge` if you want to start fresh.
|
package/hooks/ensure-deps.mjs
CHANGED
|
@@ -83,6 +83,7 @@ export function ensureNativeCompat(pluginRoot) {
|
|
|
83
83
|
// Fast path: cached binary for this ABI already exists
|
|
84
84
|
if (existsSync(abiCachePath)) {
|
|
85
85
|
copyFileSync(abiCachePath, binaryPath);
|
|
86
|
+
codesignBinary(binaryPath);
|
|
86
87
|
return;
|
|
87
88
|
}
|
|
88
89
|
|
|
@@ -112,6 +113,28 @@ export function ensureNativeCompat(pluginRoot) {
|
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
|
|
116
|
+
/**
|
|
117
|
+
* Ad-hoc codesign a native binary on macOS.
|
|
118
|
+
*
|
|
119
|
+
* When a cached .node binary is copied over the active one, macOS hardened
|
|
120
|
+
* runtime (e.g. Zed, VS Code with runtime hardening) will SIGKILL the
|
|
121
|
+
* process on the next dlopen because the code signature is invalidated.
|
|
122
|
+
* SIGKILL is uncatchable — the only fix is to re-sign after the copy.
|
|
123
|
+
*
|
|
124
|
+
* No-op on non-macOS. Swallows errors (codesign may not be available in
|
|
125
|
+
* all environments, e.g. Docker containers).
|
|
126
|
+
*/
|
|
127
|
+
export function codesignBinary(binaryPath) {
|
|
128
|
+
if (process.platform === "darwin") {
|
|
129
|
+
try {
|
|
130
|
+
execSync(`codesign --sign - --force "${binaryPath}"`, {
|
|
131
|
+
stdio: "pipe",
|
|
132
|
+
timeout: 10000,
|
|
133
|
+
});
|
|
134
|
+
} catch { /* codesign unavailable — continue without signing */ }
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
115
138
|
// Auto-run on import (like suppress-stderr.mjs)
|
|
116
139
|
ensureDeps();
|
|
117
140
|
ensureNativeCompat(root);
|
package/hooks/routing-block.mjs
CHANGED
|
@@ -71,7 +71,10 @@ export function createRoutingBlock(t) {
|
|
|
71
71
|
When the user says "ctx upgrade", "ctx-upgrade", "/ctx-upgrade", or asks to update context-mode:
|
|
72
72
|
→ Call the upgrade MCP tool, execute the returned shell command, display results as a checklist.
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
When the user says "ctx purge", "ctx-purge", "/ctx-purge", or asks to wipe/reset the knowledge base:
|
|
75
|
+
→ Call the purge MCP tool with confirm: true. Warn the user this is irreversible.
|
|
76
|
+
|
|
77
|
+
After /clear or /compact: knowledge base and session stats are preserved. Inform the user: "context-mode knowledge base preserved. Use \`ctx purge\` if you want to start fresh."
|
|
75
78
|
</ctx_commands>
|
|
76
79
|
</context_window_protection>`;
|
|
77
80
|
}
|
|
@@ -178,15 +178,3 @@ export function getCleanupFlagPath(opts = CLAUDE_OPTS) {
|
|
|
178
178
|
return join(dir, `${hash}${getWorktreeSuffix()}.cleanup`);
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
/**
|
|
182
|
-
* Return the per-project clear-stats flag path.
|
|
183
|
-
* Written by SessionStart hook on /clear, read by MCP server to reset stats.
|
|
184
|
-
* Path: ~/<configDir>/context-mode/sessions/<SHA256(projectDir)[:16]>.clear-stats
|
|
185
|
-
*/
|
|
186
|
-
export function getClearStatsFlagPath(opts = CLAUDE_OPTS) {
|
|
187
|
-
const projectDir = getProjectDir(opts);
|
|
188
|
-
const hash = createHash("sha256").update(projectDir).digest("hex").slice(0, 16);
|
|
189
|
-
const dir = join(homedir(), opts.configDir, "context-mode", "sessions");
|
|
190
|
-
mkdirSync(dir, { recursive: true });
|
|
191
|
-
return join(dir, `${hash}${getWorktreeSuffix()}.clear-stats`);
|
|
192
|
-
}
|
package/hooks/sessionstart.mjs
CHANGED
|
@@ -19,7 +19,7 @@ import { createRoutingBlock } from "./routing-block.mjs";
|
|
|
19
19
|
import { createToolNamer } from "./core/tool-naming.mjs";
|
|
20
20
|
|
|
21
21
|
const ROUTING_BLOCK = createRoutingBlock(createToolNamer("claude-code"));
|
|
22
|
-
import { readStdin, getSessionId, getSessionDBPath, getSessionEventsPath, getCleanupFlagPath
|
|
22
|
+
import { readStdin, getSessionId, getSessionDBPath, getSessionEventsPath, getCleanupFlagPath } from "./session-helpers.mjs";
|
|
23
23
|
import { writeSessionEventsFile, buildSessionDirective, getSessionEvents, getLatestSessionEvents } from "./session-directive.mjs";
|
|
24
24
|
import { createSessionLoaders } from "./session-loaders.mjs";
|
|
25
25
|
import { join, dirname } from "node:path";
|
|
@@ -145,10 +145,7 @@ try {
|
|
|
145
145
|
}
|
|
146
146
|
} catch { /* best effort — never block session start */ }
|
|
147
147
|
}
|
|
148
|
-
// "clear" —
|
|
149
|
-
if (source === "clear") {
|
|
150
|
-
try { writeFileSync(getClearStatsFlagPath(), String(Date.now())); } catch { /* best effort */ }
|
|
151
|
-
}
|
|
148
|
+
// "clear" — no reset needed; ctx_purge is the only wipe mechanism
|
|
152
149
|
} catch (err) {
|
|
153
150
|
// Session continuity is best-effort — never block session start
|
|
154
151
|
try {
|
package/openclaw.plugin.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "Context Mode",
|
|
4
4
|
"kind": "tool",
|
|
5
5
|
"description": "OpenClaw plugin that saves 98% of your context window. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and intent-driven search.",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.66",
|
|
7
7
|
"sandbox": {
|
|
8
8
|
"mode": "permissive",
|
|
9
9
|
"filesystem_access": "full",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-mode",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.66",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MCP plugin that saves 98% of your context window. Works with Claude Code, Gemini CLI, VS Code Copilot, OpenCode, and Codex CLI. Sandboxed code execution, FTS5 knowledge base, and intent-driven search.",
|
|
6
6
|
"author": "Mert Koseoğlu",
|