context-mode 1.0.118 → 1.0.120

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.
Files changed (47) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.openclaw-plugin/openclaw.plugin.json +1 -1
  4. package/.openclaw-plugin/package.json +1 -1
  5. package/build/adapters/openclaw/mcp-tools.js +10 -1
  6. package/build/adapters/pi/mcp-bridge.d.ts +28 -3
  7. package/build/adapters/pi/mcp-bridge.js +127 -14
  8. package/build/adapters/qwen-code/index.js +6 -2
  9. package/build/cli.js +93 -5
  10. package/build/opencode-plugin.js +2 -5
  11. package/build/server.js +104 -30
  12. package/build/session/purge.d.ts +27 -0
  13. package/build/session/purge.js +105 -3
  14. package/build/util/project-dir.js +9 -5
  15. package/cli.bundle.mjs +195 -164
  16. package/hooks/core/routing.mjs +13 -0
  17. package/openclaw.plugin.json +1 -1
  18. package/package.json +5 -6
  19. package/scripts/heal-better-sqlite3.mjs +53 -6
  20. package/scripts/heal-installed-plugins.mjs +104 -0
  21. package/scripts/postinstall.mjs +35 -1
  22. package/server.bundle.mjs +135 -113
  23. package/skills/UPSTREAM-CREDITS.md +51 -0
  24. package/skills/ctx-purge/SKILL.md +23 -9
  25. package/skills/diagnose/SKILL.md +122 -0
  26. package/skills/diagnose/scripts/hitl-loop.template.sh +41 -0
  27. package/skills/grill-me/SKILL.md +15 -0
  28. package/skills/grill-with-docs/ADR-FORMAT.md +47 -0
  29. package/skills/grill-with-docs/CONTEXT-FORMAT.md +77 -0
  30. package/skills/grill-with-docs/SKILL.md +93 -0
  31. package/skills/improve-codebase-architecture/DEEPENING.md +37 -0
  32. package/skills/improve-codebase-architecture/INTERFACE-DESIGN.md +44 -0
  33. package/skills/improve-codebase-architecture/LANGUAGE.md +53 -0
  34. package/skills/improve-codebase-architecture/SKILL.md +76 -0
  35. package/skills/tdd/SKILL.md +114 -0
  36. package/skills/tdd/deep-modules.md +33 -0
  37. package/skills/tdd/interface-design.md +31 -0
  38. package/skills/tdd/mocking.md +59 -0
  39. package/skills/tdd/refactoring.md +10 -0
  40. package/skills/tdd/tests.md +61 -0
  41. package/start.mjs +25 -1
  42. package/build/cache-heal.d.ts +0 -48
  43. package/build/cache-heal.js +0 -150
  44. package/build/routing-block.d.ts +0 -8
  45. package/build/routing-block.js +0 -86
  46. package/build/tool-naming.d.ts +0 -4
  47. package/build/tool-naming.js +0 -24
@@ -1,86 +0,0 @@
1
- export function createRoutingBlock(t, options = {}) {
2
- const { includeCommands = true } = options;
3
- return `
4
- <context_window_protection>
5
- <priority_instructions>
6
- Raw tool output floods context window. MUST use context-mode MCP tools. Keep raw data in sandbox.
7
- </priority_instructions>
8
-
9
- <tool_selection_hierarchy>
10
- 0. MEMORY: ${t("ctx_search")}(sort: "timeline")
11
- - After resume, check prior context before asking user.
12
- 1. GATHER: ${t("ctx_batch_execute")}(commands, queries)
13
- - Primary research tool. Runs commands, auto-indexes, searches. ONE call replaces many steps.
14
- - Each command: {label: "section header", command: "shell command"}
15
- - label becomes FTS5 chunk title — descriptive labels improve search.
16
- 2. FOLLOW-UP: ${t("ctx_search")}(queries: ["q1", "q2", ...])
17
- - All follow-up questions. ONE call, many queries (default relevance mode).
18
- 3. PROCESSING: ${t("ctx_execute")}(language, code) | ${t("ctx_execute_file")}(path, language, code)
19
- - API calls, log analysis, data processing.
20
- </tool_selection_hierarchy>
21
-
22
- <forbidden_actions>
23
- - NO Bash for commands producing >20 lines output.
24
- - NO Read for analysis — use execute_file. Read IS correct for files you intend to Edit.
25
- - NO WebFetch — use ${t("ctx_fetch_and_index")}.
26
- - Bash ONLY for git/mkdir/rm/mv/navigation.
27
- - NO ${t("ctx_execute")} or ${t("ctx_execute_file")} for file creation/modification.
28
- ctx_execute is for analysis, processing, computation only.
29
- </forbidden_actions>
30
-
31
- <file_writing_policy>
32
- ALWAYS use native Write/Edit tools for file creation/modification.
33
- NEVER use ${t("ctx_execute")}, ${t("ctx_execute_file")}, or Bash to write files.
34
- Applies to all file types: code, configs, plans, specs, YAML, JSON, markdown.
35
- </file_writing_policy>
36
-
37
- <output_constraints>
38
- <communication_style>
39
- Terse like caveman. Technical substance exact. Only fluff die.
40
- Use fragments when clear. Short synonyms (fix not "implement a solution for").
41
- Technical terms exact. Code blocks unchanged.
42
- Auto-expand for: security warnings, irreversible actions, user confusion.
43
- </communication_style>
44
- <artifact_policy>
45
- Write artifacts (code, configs, PRDs) to FILES. NEVER inline.
46
- Return only: file path + 1-line description.
47
- </artifact_policy>
48
- <response_format>
49
- Concise summary:
50
- - Actions taken (2-3 bullets)
51
- - File paths created/modified
52
- - Key findings
53
- </response_format>
54
- </output_constraints>
55
- <session_continuity>
56
- Skills, roles, and decisions set during this session remain active until the user revokes them.
57
- Do not drop behavioral directives as context grows.
58
- </session_continuity>
59
- ${includeCommands ? `
60
- <ctx_commands>
61
- "ctx stats" | "ctx-stats" | "/ctx-stats" | context savings question
62
- → Call stats MCP tool, display full output verbatim.
63
-
64
- "ctx doctor" | "ctx-doctor" | "/ctx-doctor" | diagnose context-mode
65
- → Call doctor MCP tool, run returned shell command, display as checklist.
66
-
67
- "ctx upgrade" | "ctx-upgrade" | "/ctx-upgrade" | update context-mode
68
- → Call upgrade MCP tool, run returned shell command, display as checklist.
69
-
70
- "ctx purge" | "ctx-purge" | "/ctx-purge" | wipe/reset knowledge base
71
- → Call purge MCP tool with confirm: true. Warn: irreversible.
72
-
73
- After /clear or /compact: knowledge base preserved. Tell user: "context-mode knowledge base preserved. Use \`ctx purge\` to start fresh."
74
- </ctx_commands>
75
- ` : ''}
76
- </context_window_protection>`;
77
- }
78
- export function createReadGuidance(t) {
79
- return '<context_guidance>\n <tip>\n Reading to Edit? Read is correct — Edit needs content in context.\n Reading to analyze/explore? Use ' + t("ctx_execute_file") + '(path, language, code) — only printed summary enters context.\n </tip>\n</context_guidance>';
80
- }
81
- export function createGrepGuidance(t) {
82
- return '<context_guidance>\n <tip>\n May flood context. Use ' + t("ctx_execute") + '(language: "shell", code: "...") to run searches in sandbox. Only printed summary enters context.\n </tip>\n</context_guidance>';
83
- }
84
- export function createBashGuidance(t) {
85
- return '<context_guidance>\n <tip>\n May produce large output. Use ' + t("ctx_batch_execute") + '(commands, queries) for multiple commands, ' + t("ctx_execute") + '(language: "shell", code: "...") for single. Only printed summary enters context. Bash only for: git, mkdir, rm, mv, navigation.\n </tip>\n</context_guidance>';
86
- }
@@ -1,4 +0,0 @@
1
- export declare function getToolName(platform: string, bareTool: string): string;
2
- export type ToolNamer = (bareTool: string) => string;
3
- export declare function createToolNamer(platform: string): ToolNamer;
4
- export declare const KNOWN_PLATFORMS: string[];
@@ -1,24 +0,0 @@
1
- const TOOL_PREFIXES = {
2
- "claude-code": (tool) => `mcp__plugin_context-mode_context-mode__${tool}`,
3
- "gemini-cli": (tool) => `mcp__context-mode__${tool}`,
4
- "antigravity": (tool) => `mcp__context-mode__${tool}`,
5
- "opencode": (tool) => `context-mode_${tool}`,
6
- "kilo": (tool) => `context-mode_${tool}`,
7
- "vscode-copilot": (tool) => `context-mode_${tool}`,
8
- "jetbrains-copilot": (tool) => `context-mode_${tool}`,
9
- "kiro": (tool) => `@context-mode/${tool}`,
10
- "zed": (tool) => `mcp:context-mode:${tool}`,
11
- "cursor": (tool) => tool,
12
- "codex": (tool) => tool,
13
- "openclaw": (tool) => tool,
14
- "pi": (tool) => tool,
15
- "qwen-code": (tool) => `mcp__context-mode__${tool}`,
16
- };
17
- export function getToolName(platform, bareTool) {
18
- const fn = TOOL_PREFIXES[platform] || TOOL_PREFIXES["claude-code"];
19
- return fn(bareTool);
20
- }
21
- export function createToolNamer(platform) {
22
- return (bareTool) => getToolName(platform, bareTool);
23
- }
24
- export const KNOWN_PLATFORMS = Object.keys(TOOL_PREFIXES);