mirror of
https://github.com/mksglu/context-mode.git
synced 2026-09-19 03:27:16 +08:00
main
25 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6b6193e71c |
Fix Windows shell runtime and PowerShell UTF-8 handling (#796)
* Fix Windows shell UTF-8 handling * Fix Windows shell UTF-8 handling * Fix Windows shell UTF-8 handling * Fix Windows shell UTF-8 handling * Fix Windows shell UTF-8 handling * fix(runtime): gate Windows bash detection through `where bash` so pwsh fallback is reachable resolveWindowsBash() probed the well-known Git Bash paths with existsSync() BEFORE consulting `where bash`. On a Windows runner with Git Bash installed, that shortcut re-detected a real bash even in the 'bash unavailable' scenario, so resolveWindowsShell() never fell through to pwsh — failing the new 'Windows prefers pwsh over powershell when bash unavailable' test. Route availability through `where bash` (the surface the test stubs): when it yields no real candidate, return null so the shell selector reaches pwsh. #826 is preserved — when `where bash` surfaces a Git Bash candidate we still canonicalize to the absolute Git\\usr\\bin\\bash.exe path (WSL/WindowsApps skipped) so native git keeps MSYS path conversion. tests/runtime.test.ts + tests/executor.test.ts green; typecheck clean. * docs(configs): propagate shell→javascript ctx_execute guidance to 13 adapters Mirror the claude-code/codex change from this PR to the remaining adapter instruction docs: the Bash/Shell routing line now recommends ctx_execute(language: "javascript") (with `language: "shell"` only when code matches the host shell), and grep/search guidance points at a portable javascript filter instead of a shell grep. Keeps cross-platform parity now that shell code is host-shell-specific on Windows. cursor/context-mode.mdc and pi/AGENTS.md lack the analogous lines (condensed / stub formats) and were intentionally left untouched. kimi has no doc. --------- Co-authored-by: Mert Koseoglu <bm.ksglu@gmail.com> |
||
|
|
675fec69c9 |
fix(codex): drop look-around from PreToolUse matcher (closes #547 partial — 1 of 1)
v1.0.124 shipped Codex matchers containing `(?!.*context-mode)` and `(?!plugin_context-mode_)`. Codex's Rust `regex` crate does NOT support look-around, so it rejects the matcher at boot with "look-around not supported" — every Codex user on v1.0.124 is broken. Pin Codex matchers to charset `[A-Za-z0-9_|]` so `is_exact_matcher` (refs/platforms/codex/codex-rs/hooks/src/events/common.rs:152) short-circuits the regex engine entirely. Hook BODY's `isExternalMcpTool()` filter (hooks/core/routing.mjs:379) preserves end-to-end semantics. RED→GREEN: tests/adapters/codex.test.ts "Codex matcher #547 — is_exact_matcher charset compliance" |
||
|
|
996f8c4420 |
feat(codex): route external MCP tools through PreToolUse (closes #529 partial — codex)
Extends PR #532's external-MCP routing protection from Claude Code to Codex CLI. Adds `mcp__(?!.*context-mode)` to the PreToolUse matcher so slack / telegram / gdrive / notion-style MCPs trigger the context-guidance nudge before their large payloads flood the model's context window. Verified Codex MCP wire shape (`mcp__<server>__<tool>`) via configs/codex/hooks.json existing matchers and tests/adapters/codex.test.ts:56-141. Codex own context-mode tools surface as both bare (ctx_*) and `mcp__<server>__ctx_*` — both already wired by the explicit entries above the new catch-all, and the negative lookahead excludes any `mcp__` server segment containing `context-mode` to prevent double-firing. - src/adapters/codex/hooks.ts: export EXTERNAL_MCP_MATCHER_PATTERN - src/adapters/codex/index.ts: append the pattern to PRE_TOOL_USE_MATCHER_PATTERN - configs/codex/hooks.json: mirror runtime matcher - README.md: update documented Codex matcher (drift-guarded by codex.test.ts) - tests/adapters/codex-external-mcp-routing.test.ts: 4-test vertical slice |
||
|
|
d05a37584e |
feat(prose): retire prose-style enforcement entirely (#482)
Issue #482 (makoMakoGo) reported that context-mode's caveman/terse injection pressures the model toward brevity on its FINAL ANSWER, not just on tool-output reporting. Cited evidence: Moonshot AI on kimi-k2.5 (anomalyco/opencode#20258, PR #20259) — aggressive brevity prompts measurably degrade coding/reasoning benchmarks because the model drops assumptions, caveats, verification evidence, failure modes, and security warnings the user actually needs. Considered: A — config switch ("injectCommunicationStyle: false"). Rejected: switches default-on become dead code. B — close FR with rationale. Rejected: ignores valid evidence. C — refine wording ("compress when reporting raw tool output, be complete for technical answers"). Rejected: still text injection, model-dependent, half-measure. D — full strip everywhere. Adopted. The decision after grilling: context-mode's value is data routing (sandbox, FTS5, session continuity), not prose styling. The brevity injection conflated three goals — keeping raw data out of context (real, hard-enforced), summarizing tool output compactly (LLMs auto- calibrate), and final-answer prose style (the wrong target). Strip all 22 sites where prose-style language landed. Sites stripped (A-Z): hooks/routing-block.mjs - <communication_style> block (Terse like caveman, fragments OK, auto-expand for security warnings) - <response_format> block (Concise summary, 2-3 bullets) src/server.ts (5 MCP tool descriptions + 2 cosmetic comments) - ctx_execute "When reporting results — terse..." - ctx_execute_file same - ctx_search same - ctx_fetch_and_index same (URL + commands shapes, both) - cosmetic comment "Caveman style — terse status line" - rewrote concurrency note: "Indexing is serial regardless of concurrency" → "Fetches parallelize up to your concurrency setting; FTS5 indexing serializes the writes after (SQLite single-writer rule)." — same fact, less jargon. configs/ (15 adapter MD files — every shipped system prompt) antigravity/GEMINI.md, claude-code/CLAUDE.md, codex/AGENTS.md, cursor/context-mode.mdc, gemini-cli/GEMINI.md, jetbrains-copilot/ copilot-instructions.md, kilo/AGENTS.md, kiro/KIRO.md, omp/SYSTEM.md, openclaw/AGENTS.md, opencode/AGENTS.md, pi/AGENTS.md, qwen-code/ QWEN.md, vscode-copilot/copilot-instructions.md, zed/AGENTS.md All had identical "## Output" block: 3 caveman lines stripped, workflow lines ("Write artifacts to FILES", "Descriptive source labels") kept. CLAUDE.md (repo root — internal dev instructions) Same caveman block stripped. We don't ship this file but we do eat our own dog food. README.md Pillar 4 ("Output Compression — Terse like caveman...") rewritten to "No prose-style enforcement" — explicitly cites the kimi-k2.5 benchmark evidence as the rationale. web/index.html Removed Ch 4b entirely (the "Output compression" chapter with before/after example pushing terse style on the model). Tests: - tests/session/continuity.test.ts: SessionStart routing-block assertion flipped from "must include 'Terse like caveman'" to "must NOT include caveman/terse-style directive". - tests/core/server.test.ts: Task hook injection assertion same flip. Two cosmetic comment renames ("Caveman style — terse status line" → "Status line: counts + sections + size"), test name rename ("caveman style" → "compact format"). Added new "prose-style policy (#482)" describe block at end of file with 3 negative-pin tests covering server.ts MCP descriptions, routing-block, and README. Full suite: 82/82 files passed, 2645 passed, 20 skipped, 0 failed. Net +3 new tests (the policy describe block). CONTRIBUTING.md New "Prose-style policy (#482)" section documents the decision so future contributors don't re-add the injection. Cites the Moonshot benchmark evidence + the regression test that pins the deletion. This addresses #482 in full. Closing the issue with a comment that walks the requester through the decision and links the policy section. |
||
|
|
043a1f52be |
[codex] add compact hook support (#492)
* feat(codex): add compact hook support * chore(codex): address hook review cleanup --------- Co-authored-by: boederzeng <86715671+boederzeng@users.noreply.github.com> |
||
|
|
990586a2d6 |
fix(codex): normalize hook errors and guard patch continuity (#479)
* ci: update install stats * ci: update install stats * ci: update install stats * ci: update install stats * ci: update install stats * ci: update install stats * ci: update install stats * docs(codex): document hooks feature flag rename * fix(codex): manage native hooks.json lifecycle * fix(codex): capture apply_patch continuity events * fix(codex): harden hooks.json lifecycle and apply_patch continuity Create ~/.codex before writing hooks.json, distinguish missing, invalid JSON, and unreadable hook configs, and refuse to overwrite malformed user hook files. Only resolve prior Read errors after successful follow-up edits, and make ctx-upgrade fail clearly when hook configuration cannot be updated instead of reporting a false success. Also document [features].hooks as the preferred key while keeping [features].codex_hooks as a legacy alias in current Codex builds. * fix(codex): normalize hook errors and guard patch continuity Normalize Codex PostToolUse error state into the extractor input, block failed apply_patch calls from emitting error_resolved, file continuity, or plan continuity events, and harden hooks.json lifecycle handling against schema-invalid but parseable shapes. Also keep context-mode upgrade running Codex hook repair on the already-latest path so doctor-driven hook fixes are not skipped. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Mert Köseoğlu <bm.ksglu@gmail.com> |
||
|
|
734bdbc2b7 |
v1.0.104 (#401)
* fix(insight): move showAllInsights useState before early return (React #310) * 1.0.102 * fix(test): normalize pluginRoot path separators for Windows (#369) buildNodeCommand() converts backslashes to forward slashes to prevent MSYS path mangling on Windows. The test assertion was comparing against raw pluginRoot (backslashes from mkdtempSync) causing CI failure on windows-latest while macOS and Ubuntu passed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(stats): persist counter + show lifetime + auto-memory + business value framing - Add tool_calls table to SessionDB — counter survives upgrades and --continue - Show persistent memory totals (events across all sessions) - Show auto-memory count from ~/.claude/projects/*/memory/ - Replace hardcoded '9 more' with actual category count - Use Opus pricing ($15/M) for cost calculations - Replace '3.0x' with '3x longer sessions' phrasing - Add 'Bottom line' footer with session/lifetime cost summary Closes the upgrade-resets-stats bug. ctx_stats now correctly shows that data persists across compaction, restart, and upgrade. * fix(windows): normalize hooks.json placeholders on startup (#378) The committed hooks/hooks.json and .claude-plugin/plugin.json use ${CLAUDE_PLUGIN_ROOT} placeholders + bare 'node' command. On Windows + Claude Code, this causes runtime loader failures (cjs/loader:1479) because: 1. bare 'node' may not resolve via PATH (Git Bash issue, see #369) 2. ${CLAUDE_PLUGIN_ROOT} resolution can hit MSYS path mangling (see #372) 3. backslash paths get corrupted in shell quoting Fix: start.mjs detects Windows on every MCP server boot. If hooks.json or plugin.json contain unresolved placeholders, rewrites them with: - process.execPath (absolute, quoted) instead of bare 'node' - Forward-slash paths (prevent MSYS translation) - Double-quoted paths (handle spaces) Idempotent — only rewrites when placeholder pattern is detected. Survives upgrades — runs at every start. Closes #378 * fix(cache-heal): use shebang on Unix, self-heal stale node paths After Brew updates Node, the versioned Cellar path written to ~/.claude/settings.json becomes stale, causing 'session start' errors: /opt/homebrew/Cellar/node/25.9.0_2/bin/node (gone after upgrade) vs the stable symlink: /opt/homebrew/bin/node (always current) Root cause: start.mjs wrote `process.execPath` directly, which on Brew returns the versioned path snapshot. Fix (2 layers): 1. New installs on Unix: write cache-heal script with shebang (#!/usr/bin/env node) + chmod +x, register hook as bare script path. `env` resolves node from PATH at runtime — survives any Node upgrade. 2. Self-heal: every MCP boot, check if existing hook command references a node path that no longer exists. If stale, rewrite using current pattern. Windows unchanged (no shebang support) — uses process.execPath + buildHookCommand pattern, plus self-heal for any breakage. Reported by @vigo on Discord. * fix(lifecycle): trigger isParentAlive re-check on stdin EOF to close 30s CPU-spin window (#388) (#389) * fix(test): normalize pluginRoot path separators for Windows (#369) buildNodeCommand() converts backslashes to forward slashes to prevent MSYS path mangling on Windows. The test assertion was comparing against raw pluginRoot (backslashes from mkdtempSync) causing CI failure on windows-latest while macOS and Ubuntu passed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci: update install stats * ci: update install stats * ci: update install stats * ci: update install stats * ci: update install stats * fix(lifecycle): trigger isParentAlive re-check on stdin EOF to close 30s CPU-spin window (#311, #388) The vendored MCP SDK's StdioServerTransport only registers 'data' and 'error' listeners on process.stdin. When the parent (e.g. Claude Code) dies abruptly without sending SIGTERM, the server keeps reading from a half-closed pipe and CPU-spins until the 30s ppid poll catches up. In practice this manifests as orphaned context-mode processes accumulating ~80h of CPU time before being SIGKILL'd manually (#388). The fix adds a single 'end' listener on process.stdin inside the lifecycle guard. It does NOT shut down on 'end' alone — that's the false-positive behavior #236 tore out. Instead, 'end' triggers the same isParentAlive() probe the periodic timer runs, just earlier: - parent alive → no-op (#236 regression test still passes) - parent dead → 30s detection window collapses to ~0 Skipped on TTY (OpenCode ts-plugin), where stdin is not the MCP channel. Tests: added a unit test that emits stdin 'end' under both alive and dead parent conditions, and updated the existing listener-invariance test to pin the new contract (only 'end' touched, restored on cleanup). All existing tests still pass. --------- Co-authored-by: Mert Koseoglu <bm.ksglu@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Ray <cho_meiko@okuribito-funeral.jp> * fix(executor): hide Windows console + drop .sh extension for shell exec (#384) On Windows, ctx_execute(language: 'shell', ...) had two problems: 1. Silent output - child_process.spawn without windowsHide:true creates a visible console window that intercepts stdout, leaving the MCP response empty. 2. Git Bash popup - temp script written as 'script.sh' triggers Windows file association for .sh files. bash.exe opens a visible window over the user's IDE. Fix (minimal, two surgical changes): - spawn(..., { windowsHide: isWin }) via buildSpawnOptions(platform) - isWin && language === 'shell' ? 'script' : 'script.{ext}' via buildScriptFilename(language, platform) Both changes are Windows-gated. Linux/macOS behavior unchanged. Does NOT change shell invocation semantics (no bash -c wrapper). Does NOT add SHELL env override. Both deferred - separate features. Helpers exposed as pure functions for unit testing without mocking spawn or filesystem. Closes #384. Supersedes #385 with smaller surface area. * fix(executor): full Windows shell coverage — bash -c source + SHELL override (#384) Builds on commit |
||
|
|
e7dbf587b7 |
feat: unified persistent memory & timeline search (#367)
* feat: unified persistent memory & timeline search (#363) Two pillars for session continuity after compaction: Pillar 1 — Unified Timeline Search: - ctx_search gains sort="timeline" mode searching 3 sources chronologically - ContentStore (current session) + SessionDB (prior sessions) + auto-memory - Default sort="relevance" preserves current behavior exactly - New searchAllSources() in src/search/unified.ts - SessionDB.searchEvents() with project_dir filter + LIKE escaping - searchAutoMemory() with adapter-aware dash-separated paths - FTS5 schema migration: 4 new UNINDEXED columns (source_category, session_id, event_id, timestamp) Pillar 2 — Auto-Injection on Compaction: - buildAutoInjection() fires ONLY on SessionStart(source="compact") - <behavioral_directive> for roles, <rules> for decisions, <active_skills> for skills - 500 token hard cap with priority-based overflow strategy - Never fires mid-session — context-mode does not pollute the context it protects Static Reinforcement (~99 tokens, session start only): - 12 adapter configs: Session Continuity + MEMORY sections (4 tiers by hook support) - routing-block.mjs: <session_continuity> tag + tool hierarchy 0. MEMORY - ctx_search tool description: SESSION STATE reminder Bug Fixes: - snapshot.ts: add missing case "role" + buildRolesSection() - extract.ts: skill priority P3 → P2 - pi-extension.ts: minPriority 2 → 3 12 New Categories: Phase 1: user-prompt, compaction, rejected-approach, session-resume, constraint, knowledge-reuse Phase 2: agent-finding, error-resolution, external-ref, blocked-on, iteration-loop, latency 8 review rounds, 16+ engineers per round, TDD-first implementation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: move rejected-approach from pretooluse to posttooluse via marker file PreToolUse cannot safely load SessionDB (native module loading breaks hook stdout on CI). Use tmpdir marker file pattern (same as latency) instead: pretooluse writes marker, posttooluse reads and writes event. Also implements knowledge-reuse event (search_hit_prior) with sessionId wiring and 3 new tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: wire searchAllSources into ctx_search handler + skip empty guard for timeline Two critical wiring bugs found by final review: 1. searchAllSources was imported but never called — sort="timeline" silently fell back to ContentStore-only search 2. Empty-index guard blocked timeline mode even when SessionDB had data Now sort="timeline" creates a read-only SessionDB connection and calls searchAllSources() for unified 3-source search. Default sort="relevance" unchanged — calls store.searchWithFallback() directly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: correct tool name prefixes in qwen-code, openclaw, kilo adapter configs - qwen-code: bare ctx_* → mcp__context-mode__ctx_* (22 refs) - openclaw: bare ctx_search → context-mode__ctx_search (line 49) - kilo: bare ctx_search → context-mode_ctx_search (line 49) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address PR review — 6 blockers resolved 1. Timeline sort: ContentStore results get timestamp fallback (new Date()) 2. Read path no longer mutates state: knowledge-reuse write removed from ctx_search (read tool should not write) 3. configDir: use CLAUDE_CONFIG_DIR env var + absolute path (fixes #290 regression) 4. SessionDB: open once before query loop, close in finally (was per-query) 5. Auto-memory: 1MB file size guard on readFileSync 6. Debug logging: all catch blocks log with DEBUG=context-mode env var Removes 3 knowledge-reuse tests that validated deleted write-on-read behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: timeline timestamp correctness + output format + CI fix 1. auto-memory: set timestamp from file mtime (was missing entirely) 2. ContentStore: use sessionStartTime instead of new Date() per-result 3. Normalize SQLite datetime format to ISO before sort 4. Output headers show origin + timestamp: [prior-session | 2026-04-27 14:30 | source] 5. pretooluse.mjs: move marker writes BEFORE stdout (fixes macOS CI timeout) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: macOS CI + auto-memory match quality + snippet boundaries 1. macOS CI: test sentinel path uses /tmp (matching sentinelDir()) instead of tmpdir() which returns /var/folders/... on macOS — fixes isMCPReady() returning false in CI, causing all redirect assertions to fail 2. Auto-memory: raise minimum term length from 2 to 3 chars, use word boundary regex instead of String.includes() (prevents "if" matching "specific", "definition", etc.) 3. Snippet extraction: walk to nearest paragraph boundary (\n\n) instead of cutting mid-word at arbitrary byte offset Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: surface real timestamps from FTS5 chunks for correct timeline sort ContentStore search results now carry actual indexing timestamps instead of falling back to Date.now(). Changes: 1. store.ts: add chunks.timestamp to all 12 search SQL SELECT statements 2. store.ts: populate timestamp on INSERT with new Date().toISOString() 3. types.ts: add timestamp to SearchResult interface 4. unified.ts: use r.timestamp from ContentStore, fallback sessionStartTime Timeline sort now produces correct chronological ordering across all 3 sources (ContentStore indexed_at, SessionDB created_at, auto-memory mtime). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove session bundle files from PR Session bundles (session-db, session-extract, session-snapshot) are CI-generated artifacts. Only server.bundle.mjs and cli.bundle.mjs belong in commits. CI will regenerate session bundles on merge. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove PRD from PR — belongs in issues, not in repo Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
91cd6dfeb2 |
feat(codex): wire prompt and stop hooks (#360)
Co-authored-by: boederzeng <86715671+boederzeng@users.noreply.github.com> Co-authored-by: Mert Köseoğlu <bm.ksglu@gmail.com> |
||
|
|
859b87cac1 |
fix: replace bare tool shorthands with correct ctx_ prefixed names (#363)
All tool references in descriptions, response messages, and docs now use registered MCP names (ctx_search, ctx_execute, etc.) instead of bare shorthands (search, execute) that agents misinterpret as callable functions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
7e35caf43e |
feat: output compression + caveman-style response rules across all 14 adapters
Replace hard "500 words" limit with linguistic compression rules: - Terse like caveman. Technical substance exact. Only fluff die. - Drop: articles, filler (just/really/basically), pleasantries, hedging. - Fragments OK. Short synonyms. Code unchanged. - Pattern: [thing] [action] [reason]. [next step]. - Auto-expand for: security warnings, irreversible actions, user confusion. Changes: - routing-block.mjs: <word_limit> → <communication_style> with soft rules - 14 adapter config MDs: compressed, 500-word limit removed - 6 MCP tool descriptions: added response style tip - README.md: "The Problem" → "How Context Mode Solves It" subheading, output compression as 4th pillar, platform count 12→14 - web/index.html: new "Output compression" section with before/after, platform count 12→14, JetBrains + Qwen Code tags added - CLAUDE.md: updated output section - 3 test files: assertions updated for new routing block text ~65-75% output token reduction with full technical accuracy. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
4e9baedc95 |
docs: add label field guidance to batch_execute across all 12 adapters (#256)
LLMs see batch_execute(commands, queries) in routing block and config
docs but label field was never documented. label serves triple duty:
markdown section header, FTS5 source key, and chunk boundary marker.
Without knowing about label, LLMs send {command, description} which
fails zod validation (label is required).
Fix: document label in routing-block.mjs GATHER section (runtime
injection for all adapters) + all 11 platform config files. No
fallback coercion — teach the LLM, don't silently patch.
Also fixes pre-existing test bug: routing test was comparing against
ROUTING_BLOCK (full) but routePreToolUse sends subagent block
(includeCommands: false).
Closes #256
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|
|
bfd7a95c65 |
feat: add ctx_purge tool, platform-isolated content DB, fix #227 and #200
BREAKING: ctx_stats no longer accepts reset parameter. /clear and /compact no longer affect context-mode data. Use ctx_purge for explicit wipe. - Add ctx_purge tool with confirm gate, honest deletion reporting - Platform-isolate content DB under ~/<configDir>/context-mode/content/ - Add adapter-based session paths via _detectedAdapter (no hardcoded .claude) - Add hashProjectDir() for consistent hashing across content/session DBs - Add CONTEXT_MODE_PROJECT_DIR universal env var in start.mjs - Add getProjectDir() with verified platform env vars only - Remove .clear-stats flag mechanism, checkClearStatsFlag, resetSessionStats - Remove ctx_stats reset parameter (ctx_purge is sole wipe mechanism) - Fix ctx_purge after --continue (_store=null path deletes from disk) - Fix legacy shared content DB cleanup on purge - Fix OPENCLAW_HOME semantic bug (install dir, not project dir) - Update 11 adapter configs, 4 skills, README, docs, llms.txt - 85 tests passing, zero type errors Fixes #227. Closes #200. |
||
|
|
071ded7a88 |
feat: Think in Code — MANDATORY paradigm across all 12 platforms
Add "Think in Code" manifesto to all instruction files, tool descriptions, and routing messages. LLMs are now instructed to PROGRAM analysis via ctx_execute instead of reading raw data into context to process mentally. Changes: - ctx_execute, ctx_execute_file, ctx_batch_execute tool descriptions updated - 4 routing block messages (curl/wget, inline HTTP, build tools, WebFetch) - 12 platform instruction files with platform-correct tool prefixes - Root CLAUDE.md manifesto Rules enforced: - Pure JavaScript only — no npm dependencies - Node.js built-ins only (fs, path, child_process) - Always try/catch, null-safe - Node.js + Bun compatible - console.log() only the answer Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
838bfd6749 |
Revert "fix(codex): remove PreToolUse from Codex hooks — additionalContext unsupported"
This reverts commit
|
||
|
|
5ade0be640 |
fix(codex): remove PreToolUse from Codex hooks — additionalContext unsupported
Codex CLI does not support additionalContext in PreToolUse responses,
causing "PreToolUse hook returned unsupported additionalContext" error.
- Remove PreToolUse from configs/codex/hooks.json
- Remove PreToolUse from CodexAdapter.generateHookConfig()
- formatPreToolUseResponse: silently drop "context" decisions (return {})
- Update README + platform-support.md: hooks.json example without PreToolUse
- Routing handled via AGENTS.md instead
Closes #225
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|
|
725951a24a |
1.0.59
fix: add PreToolUse to Codex hooks.json + stop to Cursor hooks.json README: - Codex: hooks no longer optional, PreToolUse added for routing enforcement - Codex: removed from "no hook support" references (lines 747, 830) - Codex: continuity table updated (PostToolUse/SessionStart: Yes) - Cursor: stop hook in hooks.json example Configs: - configs/codex/hooks.json: created with PreToolUse+PostToolUse+SessionStart - configs/cursor/hooks.json: added stop hook entry Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
2b0a8c2a40 |
fix: post-merge fixes for PRs #183, #190, #192
PR #183: Restrict sessionKey regex to [a-zA-Z0-9_-]+ and add startsWith containment check to prevent path traversal in writeRoutingInstructions workspace derivation. PR #190: Fix getRuntimeSummary() bun detection — use endsWith("bun") instead of === "bun" to handle full paths like ~/.bun/bin/bun. PR #192: Remove trailing whitespace from AGENTS.md blank separator lines. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
3df75cea67 |
Add Windows notes for script execution and path handling (#192)
Added Windows-specific notes regarding PowerShell cmdlets, path handling, and quoting requirements for scripts. |
||
|
|
4bbbd46a29 |
fix: platform-specific tool prefixes in configs, Kiro mcp.json rename, Cursor .mdc, README rewrite
## Config tool prefix fixes (evidence-based from official docs) - configs/opencode/AGENTS.md: mcp__context-mode__ → context-mode_ (OpenCode convention) - configs/zed/AGENTS.md: mcp__context-mode__ → mcp:context-mode: (Zed convention) - configs/codex/AGENTS.md: mcp__context-mode__ → bare ctx_ (Codex convention) - configs/openclaw/AGENTS.md: mcp__context-mode__ → bare ctx_ (OpenClaw convention) - configs/pi/AGENTS.md: mcp__context-mode__ → bare ctx_ (Pi convention) ## Kiro adapter fix - Renamed configs/kiro/mcp_config.json → mcp.json (matches official Kiro docs) - Updated src/adapters/kiro/index.ts: 5 references fixed - Updated tests/adapters/kiro.test.ts ## Cursor routing rules - Created configs/cursor/context-mode.mdc with alwaysApply: true - Uses bare tool names per Cursor convention ## README rewrite (DX Engineer) - All 12 platform install sections rewritten in consistent book format - Every section: Prerequisites → Install → Verify → Routing - Platform-correct tool names in all examples - No references to auto-created files (disabled) - Collapsible sections for advanced config Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
4d2c771ee7 |
feat: ctx_ tool prefix, Bash routing nudge, cross-platform fixes
- Rename all 9 MCP tools with ctx_ prefix to avoid conflicts with other MCP servers (ctx_execute, ctx_execute_file, ctx_batch_execute, ctx_index, ctx_search, ctx_fetch_and_index, ctx_stats, ctx_doctor, ctx_upgrade) - Update all references across server, adapters, hooks, configs, skills, tests, docs - Fix #66: inject BASH_GUIDANCE on every general Bash call (matches Read/Grep pattern) - Fix Windows: replace new URL().pathname with fileURLToPath in 8 hook files - Fix Windows: replace hardcoded /tmp with os.tmpdir() in cli.ts - Fix Windows: replace split("/") with split(/[/\\]/) in session-directive.mjs - Update Security section with .claude/settings.json placement note - Add session continuity example to Try It section - Update BENCHMARK.md tool names with ctx_ prefix - Remove Contributors/Special Thanks sections from README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
c56afc99e4 |
feat: global install + CLI hook dispatcher
Replace `node ./node_modules/context-mode/hooks/...` with `context-mode hook <platform> <event>`. All platforms now use `npm install -g context-mode` as prerequisite. MCP server configs use `context-mode` directly instead of `npx -y context-mode`. This ensures ctx-upgrade persists across sessions (no ephemeral npx cache). - Add `hook` subcommand to CLI with HOOK_MAP dispatcher - Update all adapter buildHookCommand() to use CLI dispatcher - Update all adapter configureAllHooks() and generateHookConfig() - Update all config templates (gemini-cli, vscode-copilot, opencode, codex) - Update README install instructions for all platforms Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
d6efc67eb1 |
feat: universal ctx commands via MCP meta-tools
- Add doctor and upgrade meta-tools to server.ts — return shell
commands + formatting instructions so any platform can execute them
- Add formatting directive to stats tool response ("display as-is")
- Add <ctx_commands> section to routing block for automatic LLM routing
- Add ctx commands table to all 5 platform configs
(claude-code, gemini-cli, vscode-copilot, opencode, codex)
- Update README with Utility Commands section
- No changes to existing Skills — backward compatible
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
||
|
|
956a46ab6e |
feat: multi-platform session continuity hooks + OpenCode plugin
- Add OpenCode TypeScript plugin entry point (src/opencode-plugin.ts) with routing enforcement, event capture, and compaction snapshot - Implement Gemini CLI session hooks (aftertool, precompress, sessionstart) with full lifecycle: startup cleanup, event capture, snapshot generation, and compaction/resume recovery - Implement VS Code Copilot session hooks (posttooluse, precompact, sessionstart) with sessionId camelCase support and copilot-instructions.md rule capture - Extend hooks/session-helpers.mjs with platform params (GEMINI_OPTS, VSCODE_OPTS, getProjectDir) for cross-platform DB/session paths - Fix Claude Code hook import paths (packages/session/dist → build/session) - Add 36 new tests (14 OpenCode plugin + 11 Gemini + 11 VS Code hooks) - Update README platform tables and session continuity notes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
75ae6ae394 |
feat: multi-platform adapters, session continuity, hook scripts
- Add 4 new platform adapters (Gemini CLI, VS Code Copilot, OpenCode, Codex CLI) with hooks.ts + config.ts per adapter, platform detection via env vars - Add shared hook core (routing.mjs, formatters.mjs, stdin.mjs) and platform-specific hook scripts (gemini-cli/, vscode-copilot/) - Add configs/ directory with per-platform install files (settings.json, mcp.json, hooks.json, opencode.json, config.toml, routing instructions) - Auto-write routing instruction files (CLAUDE.md, GEMINI.md, AGENTS.md, copilot-instructions.md) on MCP server startup via start.mjs - Add Session Continuity section to README with event capture table, compaction survival flow, and per-platform support matrix - Add adapter TDD tests (631 total tests across 8 new test files) - Fix plugin.json version sync, add typecheck to bundle.yml workflow - Remove obsolete pretooluse.sh, demo.md, root llms files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |