context-mode 1.0.73 → 1.0.75

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.
@@ -6,14 +6,14 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Claude Code plugins by Mert Koseoğlu",
9
- "version": "1.0.73"
9
+ "version": "1.0.75"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "context-mode",
14
14
  "source": "./",
15
15
  "description": "Claude Code MCP plugin that saves 98% of your context window. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and intent-driven search.",
16
- "version": "1.0.73",
16
+ "version": "1.0.75",
17
17
  "author": {
18
18
  "name": "Mert Koseoğlu"
19
19
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-mode",
3
- "version": "1.0.73",
3
+ "version": "1.0.75",
4
4
  "description": "MCP server that saves 98% of your context window with session continuity. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and automatic state restore across compactions.",
5
5
  "author": {
6
6
  "name": "Mert Koseoğlu",
@@ -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.73",
6
+ "version": "1.0.75",
7
7
  "sandbox": {
8
8
  "mode": "permissive",
9
9
  "filesystem_access": "full",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-mode",
3
- "version": "1.0.73",
3
+ "version": "1.0.75",
4
4
  "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.",
5
5
  "author": {
6
6
  "name": "Mert Koseoğlu",
package/README.md CHANGED
@@ -9,12 +9,15 @@
9
9
 
10
10
  Every MCP tool call dumps raw data into your context window. A Playwright snapshot costs 56 KB. Twenty GitHub issues cost 59 KB. One access log — 45 KB. After 30 minutes, 40% of your context is gone. And when the agent compacts the conversation to free space, it forgets which files it was editing, what tasks are in progress, and what you last asked for.
11
11
 
12
- Context Mode is an MCP server that solves both halves of this problem:
12
+ Context Mode is an MCP server that solves all three sides of this problem:
13
13
 
14
14
  1. **Context Saving** — Sandbox tools keep raw data out of the context window. 315 KB becomes 5.4 KB. 98% reduction.
15
15
  2. **Session Continuity** — Every file edit, git operation, task, error, and user decision is tracked in SQLite. When the conversation compacts, context-mode doesn't dump this data back into context — it indexes events into FTS5 and retrieves only what's relevant via BM25 search. The model picks up exactly where you left off. If you don't `--continue`, previous session data is deleted immediately — a fresh session means a clean slate.
16
+ 3. **Think in Code** — The LLM should program the analysis, not compute it. Instead of reading 50 files into context to count functions, the agent writes a script that does the counting and `console.log()`s only the result. One script replaces ten tool calls and saves 100x context. This is a mandatory paradigm across all 12 platforms: stop treating the LLM as a data processor, treat it as a code generator.
16
17
 
17
- https://github.com/user-attachments/assets/07013dbf-07c0-4ef1-974a-33ea1207637b
18
+ <a href="https://www.youtube.com/watch?v=QUHrntlfPo4">
19
+ <img src="https://img.youtube.com/vi/QUHrntlfPo4/maxresdefault.jpg" alt="context-mode demo" width="100%">
20
+ </a>
18
21
 
19
22
  ## Install
20
23
 
@@ -49,6 +52,7 @@ All checks should show `[x]`. The doctor validates runtimes, hooks, FTS5, and pl
49
52
  | `/context-mode:ctx-stats` | Context savings — per-tool breakdown, tokens consumed, savings ratio. |
50
53
  | `/context-mode:ctx-doctor` | Diagnostics — runtimes, hooks, FTS5, plugin registration, versions. |
51
54
  | `/context-mode:ctx-upgrade` | Pull latest, rebuild, migrate cache, fix hooks. |
55
+ | `/context-mode:ctx-purge` | Permanently delete all indexed content from the knowledge base. |
52
56
 
53
57
  > **Note:** Slash commands are a Claude Code plugin feature. On other platforms, type `ctx stats`, `ctx doctor`, or `ctx upgrade` in the chat — the model calls the MCP tool automatically. See [Utility Commands](#utility-commands).
54
58
 
@@ -14,8 +14,8 @@ export declare const HOOK_TYPES: {
14
14
  readonly AFTER_AGENT_RESPONSE: "afterAgentResponse";
15
15
  };
16
16
  export type HookType = (typeof HOOK_TYPES)[keyof typeof HOOK_TYPES];
17
- /** Map of hook types to their script file names. */
18
- export declare const HOOK_SCRIPTS: Record<HookType, string>;
17
+ /** Map of hook types that have actual script files. */
18
+ export declare const HOOK_SCRIPTS: Partial<Record<HookType, string>>;
19
19
  /** Canonical Cursor-native matchers for tools context-mode routes proactively. */
20
20
  export declare const PRE_TOOL_USE_MATCHERS: readonly ["Shell", "Read", "Grep", "WebFetch", "mcp_web_fetch", "mcp_fetch_tool", "Task", "MCP:ctx_execute", "MCP:ctx_execute_file", "MCP:ctx_batch_execute"];
21
21
  export declare const PRE_TOOL_USE_MATCHER_PATTERN: string;
@@ -13,13 +13,12 @@ export const HOOK_TYPES = {
13
13
  STOP: "stop",
14
14
  AFTER_AGENT_RESPONSE: "afterAgentResponse",
15
15
  };
16
- /** Map of hook types to their script file names. */
16
+ /** Map of hook types that have actual script files. */
17
17
  export const HOOK_SCRIPTS = {
18
18
  [HOOK_TYPES.PRE_TOOL_USE]: "pretooluse.mjs",
19
19
  [HOOK_TYPES.POST_TOOL_USE]: "posttooluse.mjs",
20
20
  [HOOK_TYPES.SESSION_START]: "sessionstart.mjs",
21
21
  [HOOK_TYPES.STOP]: "stop.mjs",
22
- [HOOK_TYPES.AFTER_AGENT_RESPONSE]: "afteragentresponse.mjs",
23
22
  };
24
23
  /** Canonical Cursor-native matchers for tools context-mode routes proactively. */
25
24
  export const PRE_TOOL_USE_MATCHERS = [
@@ -46,10 +45,14 @@ export function isContextModeHook(entry, hookType) {
46
45
  const scriptName = HOOK_SCRIPTS[hookType];
47
46
  const cliCommand = buildHookCommand(hookType);
48
47
  if ("command" in entry) {
49
- return entry.command?.includes(scriptName) || entry.command?.includes(cliCommand) || false;
48
+ const cmd = entry.command ?? "";
49
+ return (scriptName != null && cmd.includes(scriptName)) || cmd.includes(cliCommand);
50
50
  }
51
51
  const wrappedEntry = entry;
52
- return (wrappedEntry.hooks?.some((hook) => hook.command?.includes(scriptName) || hook.command?.includes(cliCommand)) ?? false);
52
+ return (wrappedEntry.hooks?.some((hook) => {
53
+ const cmd = hook.command ?? "";
54
+ return (scriptName != null && cmd.includes(scriptName)) || cmd.includes(cliCommand);
55
+ }) ?? false);
53
56
  }
54
57
  /** Build the CLI dispatcher command for a Cursor hook type. */
55
58
  export function buildHookCommand(hookType) {
package/build/cli.js CHANGED
@@ -49,6 +49,7 @@ const HOOK_MAP = {
49
49
  pretooluse: "hooks/cursor/pretooluse.mjs",
50
50
  posttooluse: "hooks/cursor/posttooluse.mjs",
51
51
  sessionstart: "hooks/cursor/sessionstart.mjs",
52
+ stop: "hooks/cursor/stop.mjs",
52
53
  },
53
54
  "codex": {
54
55
  pretooluse: "hooks/codex/pretooluse.mjs",