| Clean package install |
tarball install, no source tree |
tarball install, no source tree |
npm/bun path with spaces |
Claude Desktop extension path |
install from Linux filesystem |
| Worker lifecycle |
first launch, restart, duplicate root |
marketplace/cache root convergence |
stale port, version recycle, hidden windows |
no POSIX dependency where host shell is PowerShell |
host/port env consistency |
| Claude Code |
SessionStart, UserPromptSubmit, PostToolUse, Stop |
same |
hook output JSON and fail-open |
desktop extension hook path |
same |
| Codex CLI/App |
SessionStart context, PostToolUse |
same |
PowerShell-safe command, no suppressOutput |
Git Bash fallback if present |
same |
| Cursor Agent/Tab |
beforeSubmitPrompt, afterFileEdit |
same |
path escaping and transcript handling |
n/a |
same |
| Windsurf |
prompt/write/command/MCP/cascade events |
same |
path escaping |
n/a |
same |
| Antigravity CLI |
env/cwd/session mapping |
same |
env/cwd/session mapping |
n/a |
same |
| OpenCode capture |
supported capture/plugin path only |
supported capture/plugin path only |
supported capture/plugin path only |
n/a |
same |
| OpenClaw |
documented event endpoints/SSE |
documented event endpoints/SSE |
documented event endpoints/SSE |
n/a |
same |
| Chroma/search |
uvx direct, restart search |
uvx direct, restart search |
uvx without cmd shell, cleanup |
same |
same |
| smart-explore |
packaged tree-sitter runtime |
packaged tree-sitter runtime |
packaged tree-sitter runtime |
same |
same |
| Settings/storage |
atomic write, BOM, migration |
atomic write, BOM, migration |
atomic write, BOM, migration |
same |
same |
Defect
Current main has many targeted fixes in flight, but the product can still install cleanly while core claude-mem behavior fails at runtime: packaged workers can miss runtime modules, hooks can block or emit host-invalid JSON, worker startup can split across cache/marketplace roots, stale Windows sockets can hold the configured port, Chroma/search can be unavailable after install, provider env sanitization can remove required auth/proxy variables, and settings/storage/project identity can corrupt or mis-key state.
This plan is for branch
plan/stable-working-build. The goal is not a new architecture. It is a stable, working build from current main plus only low-risk patches/backports needed for the intended claude-mem feature set to work across supported IDEs/platforms.Snapshot and Baseline
/tmp/claude-mem-three-track/backlog-full.json, captured2026-07-05T04:56:22Z.claude-mem@13.10.1, HEADe02494852, worktree branchfreckle-nail.plan/stable-working-build.Backlog Evidence
Release-quality signal
Distribution and runtime packaging
Symptoms:
Patch evidence:
Stable reading:
scripts/build-hooks.jsbuilds the worker and checks generated hook outputs, but the inspected main build path does not emit theplugin/sqliteruntime modules required by the bundled worker.Worker singleton, root resolution, and port lifecycle
Symptoms:
Patch evidence:
Stable reading:
src/build/hook-shell-template.tsis the canonical generated shell resolver for hooks/MCP, butsrc/shared/worker-utils.tshas its own worker script resolution path. The stable branch should make resolution deterministic without introducing a new service manager.Hook and platform contracts
Symptoms:
suppressOutput: tracking: Codex PostToolUse hook emits unsupported suppressOutput field — hook rejected on every tool call #2975.Patch evidence:
where bunspawnSync (findBun) #2944, fix: bypass cmd.exe when spawning .cmd files to prevent console window flash #2997, fix(windows): carry windowsHide through the remaining live Windows spawn paths (closes #2900) #2921.Stable reading:
src/cli/adapters/index.tsdeclares supported adapters:claude-code,codex,cursor,windsurf,antigravity,antigravity-cli, andraw.src/build/hook-shell-template.tsand verified byscripts/build-hooks.js; do not hand-edit generated command strings.Chroma, semantic search, MCP, and smart explore
Symptoms:
>/<dependency specifiers through cmd.exe /c, breaking semantic search (Connection closed -> FTS5 fallback) #2954, chroma-mcp subprocess leak on macOS — zombie uv+python3.13 process pairs accumulate across sessions #2950, chroma-mcp== version pinning breaks uvx — use @ instead of == (MCP error -32000) #2939, Chroma semantic search never connects with uv < 0.5.31 — bareuvx <pkg>==<ver>positional rejected → MCP -32000 Connection closed (repro: macOS) #2879.observation_search) advertised in tools/list underworkerruntime — agents call a non-functional tool; under Codex the call hangs the client #3064.Patch evidence:
--fromso uv < 0.5.31 works #2880, fix(chroma): prewarm uvx installs before the MCP connect deadline (closes #2897) #2920.Stable reading:
src/services/sync/ChromaMcpManager.tsalready uses directuvx --from chroma-mcp==0.2.6 chroma-mcpandStdioClientTransport; preserve that patch shape.Observer, provider env, and prompt safety
Symptoms:
Patch evidence:
Stable reading:
src/services/worker/agents/ResponseProcessor.tsalready treats benign non-XML/no-op output as valid; verify and avoid reworking it.src/supervisor/env-sanitizer.tsstill appears to strip proxy variables and omitsCLAUDE_CODE_SKIP_BEDROCK_AUTH/CLAUDE_CODE_SKIP_VERTEX_AUTH; this is a low-risk stable backport because it preserves caller-provided env rather than adding new behavior.Settings, storage, migration, and project identity
Symptoms:
platform_source: [upgrade] Direct schema v23 → v35 fails: worker background-init throwsno such column: platform_source#3118, Upgrade to v13.9.1 from an older DB leaves migrations v24-v35 unapplied → worker init fails with "no such column: platform_source" and stays "healthy but not ready" (blocks Claude Code) #3094..cwd-remap-applied-v1migration; unreachable after the worktree is removed (v13.3.0) #2864, Submodule cwd resolves to empty leaf project — "no memory yet" despite parent repo history #2842.Patch evidence:
busy_timeoutfrom fix(sqlite): apply busy_timeout to primary SQLite connections (closes #2821) #2849.Stable reading:
SettingsDefaultsManagerstrips BOM in one reader but uses direct writes for defaults/migrations; stable should use the existing atomic JSON writer pattern where applicable.src/utils/project-name.tsandsrc/utils/worktree.tsshould get minimal identity fixes, not a new project model.Explicitly Out Of Scope
Documentation Discovery / Allowed APIs
Use only documented/local contracts below unless a failing test proves a narrower patch is required.
docs/public/platform-integration.mdx:13,docs/public/platform-integration.mdx:23,docs/public/platform-integration.mdx:48.docs/public/platform-integration.mdx:148,docs/public/platform-integration.mdx:354,docs/public/platform-integration.mdx:475.docs/public/platform-integration.mdx:532.hookSpecificOutput.additionalContext:docs/public/hooks-architecture.mdx:30,docs/public/hooks-architecture.mdx:117,docs/public/hooks-architecture.mdx:264.docs/public/hooks-architecture.mdx:422,docs/public/hooks-architecture.mdx:521.docs/context/cursor-hooks-reference.md:16,docs/context/cursor-hooks-reference.md:239,docs/context/cursor-hooks-reference.md:328,docs/context/cursor-hooks-reference.md:356,docs/context/cursor-hooks-reference.md:425,docs/context/cursor-hooks-reference.md:494.docs/public/openclaw-integration.mdx:21,docs/public/openclaw-integration.mdx:40,docs/public/openclaw-integration.mdx:64.src/cli/types.ts:1,src/cli/adapters/index.ts:9,src/cli/adapters/claude-code.ts:8,src/cli/adapters/codex.ts:5,src/cli/adapters/cursor.ts:18,src/cli/adapters/windsurf.ts:4,src/cli/adapters/antigravity-cli.ts:4.src/build/hook-shell-template.ts:1,src/build/hook-shell-template.ts:61,src/build/hook-shell-template.ts:111,src/build/hook-shell-template.ts:163,src/build/hook-shell-template.ts:217.scripts/build-hooks.js:57,scripts/build-hooks.js:138,scripts/build-hooks.js:287,scripts/build-hooks.js:606.src/shared/worker-utils.ts:126,src/shared/worker-utils.ts:207,src/services/worker-spawner.ts:69,src/services/infrastructure/HealthMonitor.ts:8.src/services/hooks/runtime-selector.ts:39,src/services/hooks/server-client.ts:57.src/services/sync/ChromaMcpManager.ts:31,src/services/sync/ChromaMcpManager.ts:127,src/services/sync/ChromaMcpManager.ts:167,src/services/sync/ChromaMcpManager.ts:265,src/services/sync/ChromaMcpManager.ts:395.src/shared/SettingsDefaultsManager.ts:197,src/utils/json-utils.ts:5,src/utils/project-name.ts:21,src/utils/worktree.ts:20.Allowed API changes:
Disallowed API changes:
NormalizedHookInput,HookResult, or platform output schemas unless the host contract currently rejects the output.Phased Fix Sequence
Phase 0 - Reproduce and pin stable gates
plan/stable-working-buildfrom current main.Exit criteria:
Phase 1 - Fix package completeness before runtime behavior
Apply the minimal patch shape from #3108 first. Ensure package/build outputs include the
plugin/sqliteruntime modules required by the worker and that generated package contents are verified in CI.Then apply only the necessary runtime dependency packaging from #2887, #2710, #2531, #3095, #3113, #3006, and #3061.
Verification:
npm run buildplugin/dist/worker.jsplugin/sqlite/**runtime modulesplugin/hooks/**MODULE_NOT_FOUND.Do not proceed to hook/lifecycle fixes until a clean package can load the worker.
Phase 2 - Make hook IO host-valid and fail-open
Patch generated hook command/output contracts with the smallest host-specific changes:
suppressOutputis absent; handle Windows App shell execution (Windows Codex App executes codex-hooks.json POSIX commands with PowerShell, causing ParserError #3101, tracking: Codex PostToolUse hook emits unsupported suppressOutput field — hook rejected on every tool call #2975, 启用了 claude-mem 的 Codex hook,但它的 PostToolUse hook 输出了当前 Codex 不支持的字段 #2871).hookSpecificOutput.additionalContextand fail-open semantics.Patch sources:
where bunspawnSync (findBun) #2944, fix(installer): drop shell:IS_WINDOWS from version-probe spawns to silence DEP0190 on Node 22 (closes #2941) #3046, fix: bypass cmd.exe when spawning .cmd files to prevent console window flash #2997, fix(windows): carry windowsHide through the remaining live Windows spawn paths (closes #2900) #2921, fix(opencode): full OpenCode v1.17.8 plugin compatibility #3014, fix(hooks): restore OpenCode capture on the current plugin hook contract (closes #2832) #2855, fix(opencode-plugin): add platformSource identifier to all observations #2936, fix(mcp): hide server-beta-only tools from worker-runtime tools/list (closes #3064) #3065, fix(bun-runner): bound hook invocations so a wedged worker can't block the prompt #3099, fix(launcher): exit 0 on signal-kill for hook event subcommands (addresses #2823) #2889.Verification:
scripts/build-hooks.jsgenerated-file verification passes.scripts/build-hooks.js.Phase 3 - Unify worker root, singleton, health, and stale-port recovery
Patch existing worker resolution/lifecycle code rather than adding a new process manager:
resolveWorkerScriptPathso marketplace/cache/source launches converge on one deterministic worker identity (Linux: worker path resolves to different on-disk copies across invocation contexts (marketplace checkout vs version cache) → two concurrent daemons, one unsupervised orphan; stale cache versions never GC'd #3134).CLAUDE_MEM_WORKER_SCRIPT_PATHonly as a controlled override/testability hook (feat(worker): add CLAUDE_MEM_WORKER_SCRIPT_PATH to pin the worker bundle #3055).Verification:
Phase 4 - Restore Chroma, search, MCP, and smart-explore under the stable package
After packaging and worker lifecycle are stable, verify current Chroma patches and backport only missing deltas:
uvx --from chroma-mcp==0.2.6 chroma-mcpexecution andStdioClientTransport(fix: use @ instead of == for chroma-mcp version pinning with uvx #2940, fix(chroma): spawn chroma-mcp via--fromso uv < 0.5.31 works #2880).observation_search) advertised in tools/list underworkerruntime — agents call a non-functional tool; under Codex the call hangs the client #3064, fix(mcp): hide server-beta-only tools from worker-runtime tools/list (closes #3064) #3065).Verification:
Phase 5 - Harden observer/provider env without transcript side effects
Patch only stable correctness defects:
Verification:
CLAUDE_CODE_*control vars remain stripped.Phase 6 - Make settings, storage, migrations, and project identity safe
Patch narrowly:
platform_source([upgrade] Direct schema v23 → v35 fails: worker background-init throwsno such column: platform_source#3118, Upgrade to v13.9.1 from an older DB leaves migrations v24-v35 unapplied → worker init fails with "no such column: platform_source" and stays "healthy but not ready" (blocks Claude Code) #3094).busy_timeoutas a low-risk lock mitigation (tracking: SQLite data integrity — unbounded prompt bloat (no cap/retention/VACUUM) and busy_timeout=0 drops writes under contention #2969, fix(sqlite): apply busy_timeout to primary SQLite connections (closes #2821) #2849)..cwd-remap-applied-v1migration; unreachable after the worktree is removed (v13.3.0) #2864, Submodule cwd resolves to empty leaf project — "no memory yet" despite parent repo history #2842, fix(sqlite): make cwd-remap reconciliation idempotent to fix orphaned worktree observations (closes #2864) #2883, fix(context): use repo-relative project keys for monorepo subdirectories (closes #2882) #3047, fix(context): fold submodule cwd sessions into the parent repo memory (closes #2842) #2856).Verification:
Phase 7 - Cross-platform smoke and release gate
Run final matrix before marking the stable branch ready:
Exit criteria:
Verification Matrix
suppressOutputMinimum command/test gate:
npm run buildscripts/build-hooks.jsAnti-pattern Guards
shell: trueplus args for subprocess fixes unless a platform contract requires it and a test proves the exact behavior.cmd.exeworkaround for uvx/Chroma if direct executable resolution works.PR Handling
where bunspawnSync (findBun) #2944, fix(opencode-plugin): add platformSource identifier to all observations #2936, fix(launcher): exit 0 on signal-kill for hook event subcommands (addresses #2823) #2889, fix(build): bundle zod into worker-service.cjs to survive node_modules churn (closes #2831) #2887, fix(context): drop sub-day clock from injected headers to stop busting prefix cache (closes #2872) #2886, fix(observer): strip base64 image blobs from tool payloads before building observer prompt (closes #2866) #2884, fix(context): fold submodule cwd sessions into the parent repo memory (closes #2842) #2856, fix(build): ship & harden plugin/node_modules so hooks resolve zod/v3 (#2379) #2710, fix(codex): emit SessionStart JSON from version check #2692, fix(packaging): bundle plugin/node_modules so marketplace install ships runtime deps (closes #2407) #2531.--fromso uv < 0.5.31 works #2880, fix(observer): accept prose-empty acknowledgements without poison respawn (closes #2817) #2857, fix(hooks): restore OpenCode capture on the current plugin hook contract (closes #2832) #2855, fix(sqlite): apply busy_timeout to primary SQLite connections (closes #2821) #2849.Done
The branch is ready when: