Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
Merge branch 'main' into release/2.7
AkitaOnRailsa8a406fd74fc
diff --cc AGENTS.mdindex ff94ecfd,1bc6bc5c..0a771c82--- a/AGENTS.md+++ b/AGENTS.md@@@ -141,9 -141,10 +141,10 @@@ Core designoptional vector RRF when an embedding provider is configured, plus boundedraw-observation fallback.- **LLM is opt-in.** Zero-LLM mode still captures, searches (FTS5), and- writes rule-based summaries. Providers (Anthropic, OpenAI, OpenAI/Codex- OAuth, GitHub Copilot, Gemini, OpenAI-compatible endpoints, Cursor Agent- CLI) enable consolidation, lint, and the auto-improvement loop.+ writes rule-based summaries. Providers (Anthropic, Anthropic OAuth,+ OpenAI, OpenAI/Codex OAuth, GitHub Copilot, Gemini, OpenCode,- OpenAI-compatible endpoints) enable- consolidation, lint, and the auto-improvement loop.++ OpenAI-compatible endpoints, Cursor Agent CLI) enable consolidation, lint,++ and the auto-improvement loop.- **Per-project isolation by construction**: every row and page is keyedby `(workspace_id, project_id, path)`, resolved from the caller's cwd,a `.ai-memory.toml` marker file, or explicit scope arguments.diff --cc CHANGELOG.mdindex 6828c67e,a8a8f6c9..7544fe20--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -7,147 -7,30 +7,170 @@@ and this project adheres to [Semantic V## [Unreleased]+### Added+- `install-mcp --client prime-agent` registers ai-memory with Prime Agent+ (PrimeIntellect-ai/prime-agent), merging an HTTP entry into the `mcpServers`+ map of `$PRIME_AGENT_CODING_AGENT_DIR/settings.json` (default+ `~/.prime/agent/settings.json`) and preserving other settings and servers.+ With a token the entry names `"bearerTokenEnvVar": "AI_MEMORY_AUTH_TOKEN"`+ and the token is not written; Prime Agent 0.10 counts a user HTTP server as+ connected, and lists it to the model, only with that variable set (or an+ OAuth grant), so export it where you launch `prime-agent`. Without a token+ the server is still callable through `mcp.call_tool("ai-memory", ...)` but is+ not listed. MCP-only: Prime Agent 0.10 has no lifecycle hooks. (#1163)+- `memory_write_page` accepts `expected_page_id` (write only if that is still+ the page's latest version) or `create_only` (write only if the page does not+ exist), and `memory_delete_page` accepts `expected_page_id`. A precondition+ that no longer holds fails with `reason: "precondition_failed"` and the+ current version, and changes nothing. `memory_read_page` returns the version+ as `page_id` and `/api/v1` pages as `id`. This is the compare-and-write the+ team-wiki sync needed (#986).+- The `ai-memory-wikisync` companion gained CI and post-merge integration+ (#986, slice 5): `sync --check` writes nothing and exits 0 in sync, 3 on+ drift and 4 on conflicts or refusals (a clone without sync state compares+ the repository with the server directly), and `install-hook` /+ `uninstall-hook` manage a marked git `post-merge` block that runs `sync`+ after each merge — a dry-run report unless `--on-merge apply`, never with+ `--prefer`, and never with a stored token. The cookbook has a GitHub+ Actions recipe. (#986)+- The `ai-memory-wikisync` companion now propagates deletes with+ `sync --propagate-deletes` (#986, slice 4): a file deleted in the repository+ deletes its server page through `memory_delete_page`, and a page deleted on+ the server deletes its file, when the other side is unchanged since the last+ sync. A delete against an edit is a conflict that `--prefer` resolves, more+ than `--max-deletes` (default 10) refuses the run, and a pinned page is+ deleted only with `--prefer repo`. Every sync write and delete now carries+ the page version it was planned against, so a page changed during the run is+ reported and left alone while the rest apply, and `sync --apply` refuses a+ server older than 2.7. Without the flag deletes are still only reported.+ (#986)+- `ai-memory doctor` now reports three silent capture failures: an unreachable+ server (reported instead of aborting the check), a hook spool that is full and+ evicting undelivered events, and installed ai-memory Codex hooks that Codex+ skips because they are untrusted or changed since they were trusted (asked+ of Codex itself through `codex app-server`). `ai-memory status` no longer says+ queued events will be delivered once the spool has started evicting them.+- Added two-way sync to the `ai-memory-wikisync` companion (#986, slice 3):+ `sync` imports repository edits and new pages through the public+ `memory_write_page` MCP tool and exports server edits, comparing each+ page with the last sync. A page changed on both sides is a conflict until+ `--prefer repo` or `--prefer server`; deletes are reported, not synced.+ It is a dry-run without `--apply`, refuses files without frontmatter,+ refuses to overwrite server pages whose metadata a write would clear, and+ re-reads each page right before writing it. (#1164)+- `finalize-session --agent antigravity-cli` now replays the session's typed+ prompts from `agy`'s `history.jsonl` before its synthetic session-end, so+ live Antigravity sessions — whose hooks carry no prompt event — get a summary+ page titled by the first prompt, a handoff with "Started/Last", and prompts+ that `memory_query` and `memory_recent` can find. Only lines whose+ conversation and workspace match the session are read; each prompt carries+ the key `backfill` mints for it, so a repeated `--reopen` stores it once and a+ prompt typed after the first finalize arrives with the next one. A checkout+ the capture allowlist does not admit and `--all-owners` runs replay nothing,+ and a missing `history.jsonl` only warns. (#1160)+- `ai-memory run` accepts `copilot` (alias `copilot-cli`) and manages GitHub+ Copilot CLI as a workstream harness: a fresh session gets a generated+ `--session-id`, a returning one is resumed with `--resume=<id>`, user+ selectors (`--resume`, `--continue`, `--session-id`, `--connect`) win,+ utility subcommands pass through, and `--yolo` maps to Copilot's native+ `--yolo`. Visible messages, tool calls and results, and compaction summaries+ are imported read-only from `$COPILOT_HOME/session-state/<uuid>/events.jsonl`+ (system prompts, hidden reasoning, hook output, and telemetry are excluded),+ and the existing SessionStart hook delivers the workstream context. The+ first managed launch auto-wires Copilot's hooks and MCP, and `doctor` now+ counts its local sessions. Verified against Copilot CLI 1.0.92. (#1040)+- GitHub Copilot CLI is now a first-class routing target:+ `install-skills --agent copilot-cli` (and `install-instructions+ --skills-agent copilot-cli`) writes the managed Agent Skills to the+ repository's `.github/skills` or, globally, to `$COPILOT_HOME/skills`+ (default `~/.copilot/skills`); `memory_install_self_routing` returns+ `copilot_cli` filename and skill-root hints; the routing snippet, the+ routing-install skill, and the MCP instructions name Copilot CLI with+ `AGENTS.md`; and `uninstall` sweeps both Copilot roots, removing only+ marker-bearing ai-memory skills. (#1040)+- Added `ai-memory recover` and a bounded local recovery journal for server+ outages. Offline managed launches now record only uniquely correlated native+ session locators; recovery quarantines overlapping spool entries before exact+ `/hook/batch` transcript replay, journals harnesses without transcript export+ as spool-only without calling their exporter, retains bounded recovery dedup+ keys with their sessions,+ fails closed on terminal drops, and lets only the original owner finish an+ expired unsuperseded managed run through exact idempotent replay. Backfill+ and recovery replay now use reserved `recovery_*` idempotency keys, so+ re-running `backfill --force` over sessions imported by ai-memory ≤2.6.0 (or+ plain-backfilling a recovery-replayed session) can duplicate those older+ observations. (#1125)+- Added `AI_MEMORY_LLM_COMPAT_DISABLE_THINKING` for the `openai-compat`+ provider (opt-in, off by default, ignored by every other provider): when+ set, every chat request carries+ `chat_template_kwargs: {"enable_thinking": false}`, so thinking-capable+ local engines (vLLM / SGLang serving Qwen3-class models) spend the output+ budget on the structured payload instead of a reasoning pass. (#1130)+- Added the `cursor` LLM provider. Consolidation calls the logged-in Cursor+ Agent CLI (`agent --print --mode ask`) so a Cursor subscription can drive+ summaries without an API key. The default model is `cursor-grok-4.6-high`+ ("Grok 4.6"). `AI_MEMORY_CURSOR_AGENT` overrides the binary. The provider never passes+ `--yolo` or `--force`, because the prompt is captured session text. (#1127)+- Added `applies_to` and `enforced_by` arguments to `memory_write_page`, and+ `--applies-to` / `--enforced-by` to `ai-memory write-page`, for profile+ entries. Both fields were documented as profile-entry frontmatter, but no+ tool could set them, so scoping an entry to a stack or keeping it out of the+ digest meant editing the wiki file by hand, and the next tool rewrite of the+ entry dropped the value. A tag the profile cannot detect in any project+ (`typscript`) is refused instead of silently hiding the entry, and both+ arguments are refused on any page the digest does not read: one outside+ `profile/`, or a `profile/` path in an ordinary project. (#1178)++- Added the server version to the footer of every signed-in `/web` page (the+ public login and change-password pages leave it out), on the right+ side opposite "ai-memory · read-only", so you can tell which build a browser+ tab is talking to without running `ai-memory status`. (#1171)++- Added `install-mcp --client dsh` for the DeepSeek Harness (aliases+ `deepseek-harness` and `deepseek_harness`). DSH keeps its MCP client in+ a Cordis profile patch rather than a fixed config file, so the command prints a+ ready-to-merge `- insert:` fragment for `@deepseek-ai/dsh-mcp-client` and+ refuses `--apply`. (#1193)++### Changed+- Changed `ai-memory-wikisync` files to carry a small frontmatter (`title`,+ plus `tags`, `pinned` and a non-default `tier` when set) above the body,+ so metadata survives a round trip. The first run after upgrading rewrites+ unedited files of an earlier export in place. (#1164)+### Fixed+- Fixed SessionEnd consolidation repeating the same expensive prompt on the+ durable queue when the structured LLM response fails deterministically: a+ truncated or empty response, malformed JSON, or an unexpected response+ shape now ends the queue on the first attempt, keeping the heuristic page+ the hook already wrote; pre-send connection and capacity (`503`) failures+ retain the bounded backoff. (#1131)+- Fixed structured LLM responses stopped at the output budget+ (`finish_reason = "length"`) or returned without usable content: they now+ fail with redacted terminal errors, without copying the response. (#1130)+ - Fixed the Jev choice reranker adapter silently fabricating scores from a+ malformed judge response: `docs/examples/jev-reranker-adapter/jev_rerank_shim_choice.py`+ defaulted missing or misnamed `probabilities` entries to `0.0`, so an HTTP+ 200 with a broken payload produced a well-formed but meaningless ranking+ the server could not tell apart from a real judgement. The shim now+ validates the response (key set matches the candidate list, no duplicate+ JSON keys, numeric non-boolean values in `[0, 1]`, NaN/Inf rejected,+ distribution sum near 1) and answers HTTP 500 on any violation, which is+ the failure mode ai-memory already degrades safely on. Includes stdlib+ `unittest` coverage in `test_jev_rerank_shim_choice.py`. (#1198)+ - Fixed Hermes Agent tool events being dropped under `capture_mode =+ allowlist`. Hermes reports its own process directory (usually `~`) as the+ payload `cwd` and points each tool at a repository with an absolute+ `workdir` or `path`, so the marker lookup never found the repository's+ `.ai-memory.toml`. The native `ai-memory hook` now also routes a shell+ command by its absolute `workdir` and a search/list tool by its absolute+ `path`, alongside the file-tool targets it already followed, when that+ location proves one other repository or marker; relative locations still+ keep the payload `cwd`. A reroute is now refused when the payload `cwd`'s own+ `[capture] ignore_paths` would drop the event, so an exclusion that names a+ path outside its checkout, or a source file read by a command whose+ `workdir` points at another project, is no longer judged only by the+ destination's policy. (#1199)## [2.6.3] - 2026-10-09diff --cc companions/ai-memory-wikisync/README.mdindex 49dc48cc,0eae6a9d..4551d7f4--- a/companions/ai-memory-wikisync/README.md+++ b/companions/ai-memory-wikisync/README.md@@@ -61,30 -43,16 +61,30 @@@ ai-memory-wikisync sync ... --apply --p## What it writes-It writes exactly the server's canonical page projection: `path`, `title`, `body`.-The page body (which carries its own `# H1` title) is transported-verbatim. The tool never forges attribution, generated, or sync-frontmatter into page files.+Each file is a small frontmatter, then the server body verbatim:++```markdown+---+title: "Commit rules"+tags: ["git"]+pinned: true+---+# Commit rules+...+```++Only the fields `memory_write_page` accepts and this tool round-trips appear:+`title`, `tags` (when there are any), `pinned` (when true), and `tier` (when+it is not the default `semantic`). The values are JSON strings and lists,+which are also valid YAML. A sync sends these fields back with every import,+because the tool clears whatever a write omits. Server-generated keys+(`type`, `generated`, `last_modified_by`) never reach the repository.- All local bookkeeping lives in **one** state file,+ All local bookkeeping lives in one state file,`.ai-memory-wikisync/state.json` (mode 0600, atomically replaced aftereach successful write batch): per page, the SHA-256 of the bytes last-written plus the server `ETag` observed at that write. Nothing else is-stored: no tokens and no server credentials.+written plus the server `ETag` and version id observed at that write.+Nothing else is stored — no tokens, no server credentials.The state is per clone. The state directory carries a `.gitignore` of `*`,so committing the destination never commits the state: two clones that@@@ -110,130 -75,24 +110,130 @@@ This section describes `plan` and `expo`--dest`; case-fold collisions are refused; symlinked destinations,symlinked components and symlinked state directories are refused; filesare replaced atomically (tmp + rename + fsync).- - **Local edits win until forced.** Each page is classified three ways —+ - **Local edits win until forced.** Each page is compared three ways:destination file, last exported state, server body. A file that- diverged from both is reported with a diff summary and **refused**; the- whole batch is refused, nothing is written. `--force` overwrites the+ diverged from both is reported with a diff summary and refused; the+ whole batch is then refused and nothing is written. `--force` overwrites thedivergent files with server content.-- **Never deletes.** Local files are never deleted, including brand-new- local files inside an allowlisted family. Deletes are slice 4.+- **Never deletes.** `plan` and `export` never delete local files or server+ pages, including brand-new local files inside an allowlisted family.+ Only `sync --propagate-deletes` deletes (see below).- - **Untrusted content.** Page bodies are data: transported verbatim,- never executed, never rendered, never interpreted. Paths that would+ - **Untrusted content.** Page bodies are data. They are transported+ verbatim and never executed, rendered, or interpreted. Paths that wouldescape `--dest` are refused.-## Roadmap (#986)+## Two-way sync++`sync` classifies every page in the allowlisted families from three+versions: the repository file, the state entry (what the last sync wrote),+and the server page rendered into file bytes.++| Repository | Server | Action |+|---|---|---|+| unchanged | changed | export the server page |+| changed | unchanged | import the file with `memory_write_page` |+| new file | no page | import (create) |+| changed | changed | conflict: nothing is written until `--prefer repo` or `--prefer server` |+| deleted | unchanged | reported; with `--propagate-deletes`, the server page is deleted |+| unchanged | deleted | reported; with `--propagate-deletes`, the file is deleted |+| deleted | changed | with `--propagate-deletes`, a conflict: `--prefer repo` deletes the page, `--prefer server` re-exports the file |+| changed | deleted | with `--propagate-deletes`, a conflict: `--prefer repo` re-creates the page, `--prefer server` deletes the file |++Safety rules:++- **Writes only through MCP.** No wiki file or SQLite access; the server's+ sanitizer, admission and attribution apply to every import.+- **Dry-run by default.** `--apply` is required, and any refused page+ (a conflict, an invalid file) blocks the whole batch.+- **Frontmatter is required to import.** A file without it would clear the+ page's title, tags and pin on the server, so it is refused.+- **Metadata the write cannot carry is protected.** A server page with any+ frontmatter key other than `title`, `tier`, `pinned`, `tags`, `type`,+ `generated` and `last_modified_by` (a consolidated page's `summary` or+ `sources`, an MCP write's `kind` or `abstract`) is never overwritten by an+ import; the refusal names the keys. Such pages still export.+- **Every write is conditional.** Each import carries the page version the+ plan classified (`expected_page_id`), or `create_only` for a new page, and+ each delete carries the version too. A page that changes on the server+ after it was classified is refused by the server, reported as "changed+ during this run", and left with its old state for the next run; the other+ pages still sync, and the run exits non-zero. A server without these+ preconditions (before ai-memory 2.7) is detected before anything is+ written and refused.+- **The server's version wins after an import.** If the server stores+ something other than the file (the sanitizer redacting a secret), the file+ is rewritten with the server's rendering.+- **Deletes are opt-in.** Without `--propagate-deletes` a delete is only+ reported, and the page keeps its state entry so the next run reports it+ again. With it, a side is deleted only if it is unchanged since the last+ sync; a delete against an edit is a conflict like any other. Pages gone+ from both sides drop out of the state.+- **Delete safety.** More than `--max-deletes` deletes (default 10) refuses+ the whole run. A pinned server page is never deleted unless `--prefer repo`+ is given. A file is deleted only through the same path checks as a write+ (no symlinked file or directory, nothing outside `--dest`) and only if it+ still holds the bytes the plan classified. The tool never runs git: it+ prints the `git rm` to stage the deletes. Apply order is imports, exports,+ server deletes, file deletes.++## CI and post-merge++`sync --check` writes nothing — no files, no state — and reports through its+exit code:++| Exit | Meaning |+|---|---|+| 0 | in sync |+| 1 | error (server unreachable or refusing the request, invalid destination, …) |+| 2 | usage error (clap) |+| 3 | drift: imports, exports or deletes are pending (unpropagated deletes count) |+| 4 | conflicts or refusals need a person; wins over 3 |++A clone without a state file (every CI checkout: the state is never+committed) compares the repository with the server directly, so a page that+differs is drift (3), not a conflict. `--check` cannot be combined with+`--apply`. See [the cookbook](../../docs/cookbook.md) for a GitHub Actions job.++`install-hook` writes a git `post-merge` hook so a pull or merge reports+(or, opt-in, applies) a sync:-This is slice 1 of the accepted team-wiki sync plan:+```bash+ai-memory-wikisync install-hook --workspace demo --project app \+ --dest docs/wiki --include _rules --include decisions \+ [--on-merge report|apply] [--propagate-deletes] \+ [--hooks-dir DIR] [--append] [--print]+ai-memory-wikisync uninstall-hook --dest docs/wiki [--hooks-dir DIR]+```++- The hook runs `( command -v ai-memory-wikisync >/dev/null &&+ ai-memory-wikisync sync … ) || true`: a missing binary or a failed sync+ never fails the merge. It reports by default; `--on-merge apply` adds+ `--apply`. It never passes `--prefer`, and passes `--propagate-deletes`+ only if it was given at install.+- It lives between `# >>> ai-memory-wikisync >>>` and+ `# <<< ai-memory-wikisync <<<`. Re-running `install-hook` replaces that+ block; `uninstall-hook` removes only the block (and the file, if nothing+ but a shebang is left).+- The hooks directory is found by walking up from `--dest` to `.git`,+ following a worktree's `gitdir:` file and `commondir`, so one hook serves+ every worktree; `--dest` is written relative to the repository root. If+ `core.hooksPath` is set in the repository's config, the install is refused:+ pass `--hooks-dir` with that directory, or `--print` the block for your hook+ manager.+- No token is ever written (`--token` is refused; the hook reads+ `AI_MEMORY_AUTH_TOKEN` when it runs), every argument is single-quoted, and+ newlines or NUL are refused. The file is replaced atomically with mode+ 0755; a symlinked hook is refused, and an existing hook without the block+ is refused unless `--append` is given and its shebang is a POSIX shell.+ The companion never runs git.++## Roadmap (#986)-1. This release: read-only export into a project repository.-2. Conditional mutation seam (compare-and-write) in core, if independently- justified.-3. Bidirectional apply (repo edits flow back through public write tools).-4. Deletes and conflict reporting.-5. Post-merge hook / CI integration.+1. Read-only export into a project repository (`export`).+2. Conditional mutation seam (compare-and-write) in core (ai-memory 2.7).+3. Two-way sync (`sync`): repository edits flow back through the public MCP+ write tool.+4. Deletes and conflict reporting (`--propagate-deletes`, conditional+ writes).+5. **This release — post-merge hook and CI integration** (`install-hook`,+ `sync --check`).diff --cc docs/deploy.mdindex d6ad5b7a,d5a1253b..63d97413--- a/docs/deploy.md+++ b/docs/deploy.md@@@ -185,15 -185,10 +185,15 @@@ options| openai-compat (Ollama) | `qwen3:32b` | $0 | Self-hosted. Set `AI_MEMORY_LLM_BASE_URL=http://host.docker.internal:11434/v1`. Quality depends on the model. |> **What we don't recommend:** reasoning-mode models (Kimi-K2.6 in reasoning mode,- > Claude with extended thinking, GPT-o3, Gemini "thinking" variants) — they burn+ > Claude with extended thinking, GPT-o3, Gemini "thinking" variants). They burn> token budget on internal reasoning before emitting output and hang or emit empty> responses with the strict-JSON consolidation prompt. If you must use one, turn-> reasoning off.+> reasoning off. For a vLLM / SGLang-hosted Qwen3-class model the local equivalent+> is `AI_MEMORY_LLM_COMPAT_DISABLE_THINKING=true` (it sends+> `chat_template_kwargs: {"enable_thinking": false}` on every openai-compat+> request); if the engine still truncates the structured payload or returns empty+> content, the job now fails fast with a terminal `truncated-response` /+> `empty-content` error instead of retrying.ai-memory's hosted OpenAI-family providers use `json_schema` strict mode forstructured output. The OpenAI provider normalizes schemars output intodiff --cc docs/install.mdindex d97e6334,16670884..e15ce35c--- a/docs/install.md+++ b/docs/install.md@@@ -1933,9 -1918,8 +1940,9 @@@ If you set only the provider, ai-memor| `AI_MEMORY_LLM_PROVIDER=openai-oauth` | `gpt-5.5` | ChatGPT/Codex backend. Run `ai-memory auth login openai-oauth` once; ai-memory stores the refresh token in `<data_dir>/auth.json` and refreshes access tokens automatically. Optional `AI_MEMORY_LLM_REASONING_EFFORT` (`none`/`minimal`/`low`/`medium`/`high`/`xhigh`/`max`/`ultra`/`persistent`) is mapped to each provider's native reasoning field; omit it to keep the model default. || `AI_MEMORY_LLM_PROVIDER=codex` | `gpt-5.6-luna` | Reuses only `access_token` and `account_id` from Codex's `auth.json`; token renewal is delegated to `codex app-server --stdio`. || `AI_MEMORY_LLM_PROVIDER=copilot` | `gpt-5.5` | GitHub Copilot Chat backend. ai-memory stores a GitHub user token in `<data_dir>/auth.json`, exchanges it for a short-lived Copilot API token, and refreshes before expiry. |+| `AI_MEMORY_LLM_PROVIDER=cursor` | `cursor-grok-4.6-high` | Cursor subscription via `agent --print --mode ask --trust`. No API key and no `--yolo`. This id is "Grok 4.6" in `agent --list-models`. Override the binary with `AI_MEMORY_CURSOR_AGENT`. Any other id from that list works as `AI_MEMORY_LLM_MODEL`. || `AI_MEMORY_LLM_PROVIDER=gemini` | `gemini-3.5-flash` | Google's hosted option with a generous free tier. ai-memory disables Gemini 3.5 Flash's default dynamic thinking so hidden thought tokens do not truncate strict JSON. Set `GEMINI_API_KEY` (or `GOOGLE_API_KEY`). |- | `AI_MEMORY_LLM_PROVIDER=opencode` | `mimo-v2.6-flash` | [OpenCode](https://opencode.ai) cloud API. Defaults to the **Go** endpoint, `opencode.ai/zen/go/v1` — a cost-optimised model subset. Published Responses models, including GPT-5.6 Luna and GPT-6 Luna, use `/responses`; supported Claude and Qwen Messages models use `/messages`. MiniMax M3/M2.7 and Qwen3.8 Max use Messages on Go and Chat Completions on Zen; Go Muse Contributor models use Responses. Changing the base URL reselects the transport and preserves request settings. See the [Go](https://opencode.ai/docs/go/#endpoints) and [Zen](https://opencode.ai/docs/zen/#endpoints) endpoint tables. For **Zen**'s full catalogue, set `AI_MEMORY_LLM_BASE_URL=https://opencode.ai/zen/v1` plus an `AI_MEMORY_LLM_MODEL` from it, such as `claude-sonnet-5-5`; the default model id is Go's. Requests identify ai-memory by version and reuse one session header across related attempts. Both endpoints take `OPENCODE_API_KEY` (key from `opencode.ai/auth`). Alias: `opencode-zen` — historical, and it selects Go like the others; the endpoint is chosen by the base URL, not the alias, with no automatic billing-product switch. |+ | `AI_MEMORY_LLM_PROVIDER=opencode` | `mimo-v2.6-flash` | [OpenCode](https://opencode.ai) cloud API. Defaults to the **Go** endpoint, `opencode.ai/zen/go/v1`, a cost-optimised model subset. Published Responses models, including GPT-5.6 Luna and GPT-6 Luna, use `/responses`; supported Claude and Qwen Messages models use `/messages`. MiniMax M3/M2.7 and Qwen3.8 Max use Messages on Go and Chat Completions on Zen; Go Muse Contributor models use Responses. Changing the base URL reselects the transport and preserves request settings. See the [Go](https://opencode.ai/docs/go/#endpoints) and [Zen](https://opencode.ai/docs/zen/#endpoints) endpoint tables. For **Zen**'s full catalogue, set `AI_MEMORY_LLM_BASE_URL=https://opencode.ai/zen/v1` plus an `AI_MEMORY_LLM_MODEL` from it, such as `claude-sonnet-5-5`; the default model id is Go's. Requests identify ai-memory by version and reuse one session header across related attempts. Both endpoints take `OPENCODE_API_KEY` (key from `opencode.ai/auth`). Alias: `opencode-zen` (historical); it selects Go like the others, and the endpoint is chosen by the base URL, not the alias, with no automatic billing-product switch. || `AI_MEMORY_EMBEDDING_PROVIDER=openai` | `text-embedding-3-small` (1536-dim) | 5× cheaper than `-3-large` with marginal recall loss. || `AI_MEMORY_EMBEDDING_PROVIDER=openai` + `AI_MEMORY_EMBEDDING_BASE_URL=https://openrouter.ai/api/v1` | `openai/text-embedding-3-small` via [OpenRouter](https://openrouter.ai) | Uses `EMBEDDING_API_KEY`, else reuses `LLM_API_KEY` or `OPENAI_API_KEY`, with the OpenAI-compatible embedding client. || `AI_MEMORY_EMBEDDING_PROVIDER=openai` + `AI_MEMORY_EMBEDDING_BASE_URL=https://api.orcarouter.ai/v1` | `openai/text-embedding-3-small` via [OrcaRouter](https://www.orcarouter.ai) | Uses `EMBEDDING_API_KEY`, else reuses `LLM_API_KEY`, with the OpenAI-compatible embedding client. |diff --cc docs/managed-workstreams.mdindex 648429bc,7ec4620c..571128e6--- a/docs/managed-workstreams.md+++ b/docs/managed-workstreams.md@@@ -568,39 -545,17 +567,39 @@@ URL and what the degraded run means, annot an error.When the child exits, the launcher prints that the run was not recorded on the-server and how many hook events remain spooled locally (oldest first by age).-Spooled events are bounded: they are dropped after the configured number of-failed drain passes (8 by default), 7 days of age, or the 10,000-file spool-cap. For a planned outage set `AI_MEMORY_HOOK_SPOOL_MAX_ATTEMPTS=0` to disable-only the attempt-count drops (see `docs/install.md`).+server, how many hook events remain spooled locally, and that the run was+journaled for `ai-memory recover`. The journal is capped at 256 entries;+once full it refuses new entries with an actionable warning instead of evicting+unrecovered work. It is written atomically as owner-only local state; Unix lock opens use+`O_NOFOLLOW` and the atomic replacement rechecks the destination immediately+before rename. Windows applies an owner-only ACL and rejects observed symlinks,+but reparse-point race hardening still requires the PR `windows` CI lane before+merge. Spooled events remain separately+bounded: they are dropped after the configured number of failed drain passes+(8 by default), 7 days of age, or the 10,000-file spool cap. For a planned+outage set `AI_MEMORY_HOOK_SPOOL_MAX_ATTEMPTS=0` to disable only the+attempt-count drops (see `docs/install.md`).- If the server dies *during* a run — after the lease was acquired — the exit+ If the server dies *during* a run, after the lease was acquired, the exit-code is still preserved: the unimported transcript is reported as a warning-with the exact `ai-memory finalize-session` command that repairs the record-once the server is back, and the orphaned lease expires on its own within 90-seconds.+code is still preserved. The journal records the original run id, native+session locator, absolute store path, and exit code; repository branch and path+state are not persisted. Recovery retries validate the exact ordered semantic+transcript interval and native identity, and omit a regenerated checkpoint, so+repository changes during downtime are not claimed as the failed run's state and+a successful finish cannot create a second checkpoint event.+`ai-memory recover` uses the owner-authorized `/recover/finish` route to resume+an expired original run only when no newer run superseded it; ordering is the+explicit `(started_at, SQLite insertion order)` tuple, so timestamp ties cannot+revive an older run. Another operator, a superseded run, and any finished-run+payload that is not an exact replay of already indexed events/cursor/exit state+remain refused.+Successful entries are removed, while failed entries remain with a bounded+sanitized reason. Each journal request and the whole journal pass have time+budgets. A spool pass that drops anything is reported incomplete and keeps all+journal entries; correlated entries are quarantined before that pass and can+only be deleted after a later clean pass and exact transcript replay. If the+server is still unreachable, `recover` exits successfully+and prints the remaining spool/journal counts and startup guidance.To restore the strict behavior (fail with the usual "could not reach …"diagnosis and never start the agent), pass `--require-server`, setdiff --cc docs/security-boundaries.mdindex a7ac0d2f,4cf48719..0df75944--- a/docs/security-boundaries.md+++ b/docs/security-boundaries.md@@@ -71,9 -70,8 +71,9 @@@ means the boundary is not built yet| 11d | Hook server-profile routing: a marker-selected server gets only its own capture and its own token (#992) | `ai-memory-cli/src/server_profiles.rs` `resolve` (validated `ProfileName`, strict `servers.toml` parse, `roots` required once two profiles exist, component-wise root match) and `marker.rs` `find_server_selection` (inherited down the tree, any value shape counts); `commands/hook.rs` `resolve_hook_route` drops a `Rejected` route before spool, handoff and backfill, and hands the drainer no live token for a profile route; `commands/hook_spool.rs` `static_retry_token` (a profile entry retries only with its own stored token), the loopback reroot skip, and chunk splitting on `profile`; generated TS `captureServerRouted` drops a routed repository and gates `fetchHandoff`; `hooks/_lib.sh` `ai_memory_server_routed` (flag refused by `ai_memory_post_hook`/`ai_memory_get_handoff`) and `hooks/lib/ai-memory-hook.ps1` `Test-AiMemoryServerRouted` drop it in the script hooks; `--check-capture` refuses a rejected server-profile selection without printing its token or URL | `hook.rs` `each_repository_spools_to_its_own_profile_with_its_own_token`, `a_selection_that_does_not_resolve_emits_nothing` (unknown / tokenless / outside roots / roots required / invalid name, plus a resolving control), `session_start_handoff_comes_from_the_profile_server_only`, `a_repository_without_a_server_key_keeps_the_install_default`; `hook_spool.rs` `a_profile_entry_is_never_retried_with_the_install_live_token` (server B accepts exactly the install's live token and must still not get it), `a_profile_entry_recovers_with_its_own_rotated_token` (control), `a_profile_entry_on_a_dead_loopback_port_is_not_rerouted_to_the_default`, `profile_and_default_entries_at_one_address_ride_separate_batches`; `server_profiles.rs` roots/registry/name tests; `marker.rs` `nested_markers_without_server_inherit_the_ancestor_selection`; `install_hooks.rs` `generated_integrations_fail_closed_on_a_server_profile_marker`, `openclaw_plugin.rs` `openclaw_plugin_fails_closed_on_a_server_profile_marker`, and the `server-routed-*` checks in `generated_capture_policy_v1_node_runtime_evidence`; `hook.rs` `an_event_without_a_payload_cwd_routes_by_the_process_cwd`, `a_refused_route_prints_nothing_for_kimi_user_prompts`; `hook_spool.rs` `a_profile_entry_is_not_retried_with_a_token_issued_for_a_new_url`; `server_profiles.rs` `changing_the_url_without_a_token_discards_the_old_token`, `omitted_roots_keep_the_registered_ones`; `marker.rs` `outside_home_the_walk_reaches_a_marker_above_the_checkout_root`, `encoding_noise_cannot_hide_a_server_key`, `an_unreadable_marker_is_a_refused_selection`; `backfill.rs` `a_spawned_backfill_authenticates_like_the_hook_that_spawned_it`; `tests/hooks/test_lib.sh` "server profiles (#992)" section; `hook.rs` `a_mixed_spool_drains_each_event_only_to_its_own_server` (two token-gated servers, one spool, one drain: each server receives exactly its own event with exactly its own bearer); `tests/suite/server_profiles.rs` (the built binary: `server add` → `hook` spools to the profile with its token, unknown profile spools nothing, `uninstall` removes the tokens; `two_real_servers_each_receive_only_their_own_repository` runs two real `ai-memory serve` children with different root tokens and checks on each server which repository landed there); `ai-memory-hooks` `powershell_server_routed.rs` `server_routed_guard_mirrors_the_native_walk` (runs `Test-AiMemoryServerRouted` under real PowerShell: inherited, BOM, look-alike keys, the `$HOME` boundary with its control, past a checkout root outside home, current directory); `hook.rs` `a_selection_that_does_not_resolve_emits_nothing` (rejected routes refuse preflight; resolved profile control passes); `tests/hooks/test_lib.sh` and `powershell_home.rs` `a_trailing_separator_on_home_keeps_the_walk_boundary` (a `$HOME` ending in `/` or `\` keeps both script walks at home: a `server` marker above it routes nothing, with a root-home control that does) | STRONG for native hooks, generated TS, `.sh` and `.ps1` hooks. Known gap: an older binary draining a shared spool ignores `profile` || 11e | Native self-upgrade archive confinement (#1025) | `ai-memory-cli/src/commands/upgrade.rs` normalizes every tar/zip path, rejects links and special entries, extracts only the binary and `hooks/`, accepts only the exact non-runtime support layout emitted by `release.yml`, and caps both entry count and declared expanded bytes before writing | `upgrade.rs` `release_workflow_support_assets_are_exact_and_ignored` (shipped support paths admitted, near-miss docs/packaging/template paths refused), `extracts_archive_built_like_release_yml` and `extracts_zip_happy_path_with_hooks` (real workflow-shaped archives succeed but support assets are not written), `validate_rejects_path_traversal`, `zip_extract_rejects_path_traversal`, `tar_extract_rejects_declared_expansion_past_limit`, with binary/hooks extraction as the legitimate control | STRONG || 11f | Native hook executable-path integrity after self-replacement (#1027) | `ai-memory-cli/src/commands/render_shared.rs` `hook_embedded_exe_path` is the single executable resolver for every persisted native hook form (POSIX/Windows command, Windows exec, Zero, ZCode, OpenCode 2 assistant capture): it prefers an existing literal path, strips Linux's trailing ` (deleted)` procfs marker only when the stripped installed binary exists, and otherwise falls back to the platform command name. Upgrade keeps the already-loaded config and refreshes in-process | `render_shared.rs` `embedded_exe_strips_the_marker_when_the_stripped_path_exists`, `embedded_exe_preserves_a_real_file_whose_name_has_the_marker_suffix`, `embedded_exe_falls_back_when_the_resolved_path_is_missing`, `hook_embedded_exe_path_names_an_existing_file_without_marker`; `upgrade_e2e.rs` `native_upgrade_refreshes_hooks_without_a_deleted_path_or_losing_cli_data_dir` reproduces the replacement window through the shipped binary, plants the corrupt suffix, and proves refresh removes it while preserving a CLI-only data dir | STRONG on Linux reproduction plus platform-neutral resolver/render coverage; Windows path rendering remains covered by its existing command/exec tests and full Windows CI |- | 11g | Cross-project file attribution cannot bypass destination capture or server routing (#932) | `ai-memory-hooks/src/capture_policy.rs` `absolute_file_tool_paths` accepts only bounded, recognized, absolute file-tool candidates; `ai-memory-cli/src/commands/hook.rs` `file_tool_routing_cwd` requires every path to prove the same repository/marker boundary and resolves that destination before capture policy, server profile, scope hints, or spool credentials. Relative, mixed-project, unsupported, and arbitrary non-project paths keep the payload cwd | `hook.rs` `absolute_file_target_uses_destination_scope_and_capture_policy` (hostile content under the destination exclusion is never spooled; a public control is routed there), `absolute_file_target_cannot_escape_a_destination_server_profile` (unregistered destination profile drops instead of falling back to source/install default), `file_target_routing_refuses_relative_external_and_mixed_project_paths` | STRONG for native `ai-memory hook`; generated and compatibility hooks retain cwd-only routing |+ | 11g | Cross-project tool attribution cannot bypass source or destination capture, or destination server routing (#932, #1199) | `ai-memory-hooks/src/capture_policy.rs` `absolute_tool_location_paths` accepts only bounded, recognized, absolute locations: file-tool targets, a search/list tool's explicit `path`, or a shell command's structured `workdir` (command text is never parsed for a location); `ai-memory-cli/src/commands/hook.rs` `tool_location_routing_cwd` requires every path to prove the same repository/marker boundary, refuses the reroute when the payload cwd's own capture policy would not keep the event (source `ignore_paths` may name paths outside the source checkout, and a command may name source files while its `workdir` points elsewhere), and resolves that destination before capture policy, allowlist marker, server profile, scope hints, or spool credentials. Relative, mixed-project, unsupported, and arbitrary non-project paths keep the payload cwd | `hook.rs` `absolute_file_target_uses_destination_scope_and_capture_policy` (hostile content under the destination exclusion is never spooled; a public control is routed there), `absolute_file_target_cannot_escape_a_destination_server_profile` (unregistered destination profile drops instead of falling back to source/install default), `file_target_routing_refuses_relative_external_and_mixed_project_paths`, `workdir_reroute_applies_the_destination_capture_policy` (a `workdir`-rerouted command reading a destination-excluded path is dropped, public control kept), **`a_reroute_cannot_escape_the_source_capture_exclusions`** (adversarial: a file read under a source pattern that names another project's directory, and a shell command naming an excluded source file with `workdir` in another project, are both refused; public file and shell controls still reroute; fails with the source-policy check removed), `hermes_tool_location_finds_the_marker_the_process_cwd_lacks` (Hermes `terminal` `workdir`, `read_file` `path` and `search_files` `path` reach the repository marker under allowlist; no-workdir, relative-workdir and relative-search controls stay with the unmarked process cwd); `capture_policy.rs` `absolute_tool_location_paths_cover_search_dirs_and_shell_workdirs` (relative workdir, command-text paths, workdir without a command, and Hermes `process` yield no location) | STRONG for native `ai-memory hook`; generated and compatibility hooks retain cwd-only routing || 11h | Docker-wrapper capture-policy capability (#1002) | `bin/ai-memory` routes ordinary Linux/macOS `install-hooks` and upgrade refreshes through the stable checksum-verified native host client, so the hook process executes the capture-policy boundary in 11b before spool/network. Only an explicit `AI_MEMORY_HOOK_PLATFORM=posix|windows` retains the documented script compatibility path and its warning; `AI_MEMORY_NATIVE_BIN` may not point back to the wrapper | `scripts/check-native-packaging.sh` `Checking host-launch wrapper routing`: a default allowlist install reaches the fake native client while a Docker executable that always fails proves no container fallback occurred; the explicit `posix` control reaches fake Docker and adds no native invocation; the self-referential native override is refused | STRONG on the shipped Linux/macOS wrapper. Windows and remote/manual script installers remain explicitly outside capture-policy v1 |+| 11j | Offline recovery journal and transcript replay | `ai-memory-cli/src/commands/recovery.rs` keeps bounded locators, ordered semantic transcript digests, pre-launch cursors and persistent correlated-delivery/loss evidence in an atomic journal, refuses a symlinked data dir and any symlinked component inside it (ancestors above the data dir are trusted, so macOS `/var` → `/private/var` works), sanitizes/caps failure reasons, and bounds each replay plus the whole pass; `hook_spool` coordinates enqueue and quarantine with short filesystem locks, canonically resolves partial scope from the recorded cwd, bounds per-file reads and current global occupancy across the main spool and recovery directories, sweeps completed tombstones, and holds correlated events outside drain until replay succeeds or restores them on failure; degraded resumes use `ai-memory-workstream`'s adapter-validated delta export, whose blocking parse and baseline scans are capped by record, event-count, source-byte and serialized-byte totals; `backfill::import_exact_session` chunks by item and byte limits and requires per-item durable acknowledgements; `run.rs` journals every session launch, including explicit spool-only evidence for unsupported exporters, and journals a resumed export only after capturing its exact pre-launch cursor; `workstream.rs` `/recover/finish` retains owner/project authorization, rejects superseded runs, and validates a finished retry by durable transcript/native/cursor/exit identity without regenerating its checkpoint; validated recovery ingest keys bind session, agent, event kind and sanitized event identity until session purge | `transcript.rs` `persisted_baseline_exports_only_offline_append_and_rejects_rewrite`, parser/baseline cap and ordered-semantic digest tests; CLI `run_offline.rs` real degraded spool-only and overlap/idempotency tests; `recovery.rs` `spool_only_without_correlated_evidence_never_auto_clears`, `a_dropped_spool_event_stays_lost_on_the_next_empty_pass`, loss/time-budget tests, `symlinked_journal_and_ancestor_are_refused`, `a_symlinked_ancestor_of_the_data_dir_is_trusted`, `a_symlink_inside_a_data_dir_under_a_symlinked_ancestor_is_refused`; `hook_spool.rs` partial-scope late enqueue, completion-race, occupancy churn/active-cap, bounded-read and tombstone-sweep tests, plus interval isolation (`completed_tombstone_keeps_a_later_resume_of_the_same_session` proves a post-interval resume hook is delivered, `completing_one_recovery_interval_leaves_the_other_intervals_entries_intact` proves one interval's completion never consumes another's evidence and ambiguous entries fail closed into the main spool); `backfill.rs` `two_sequential_recovery_intervals_on_one_resumed_session_replay_exactly_once` proves the second interval's content and session-end are stored with end-of-session effects while reruns stay pure replays; `transcript.rs` `an_oversized_first_record_is_skipped_by_session_listing_caps` proves the first-record byte caps bite before allocation; store `insert_observation_ingest_dedups_on_key` rejects cross-session and changed-event preclaims; hooks `expired_run_recovery_is_owner_only_and_refuses_superseded_runs` proves changed transcript refusal and changed-checkpoint no-op | STRONG on Unix integration coverage; Unix lock opens use no-follow and atomic replacement rechecks the destination. Windows owner-only ACL/reparse and lock semantics require the PR `windows` lane || 11i | OpenCode executable probing and generated-config cleanup (#1097) | `ai-memory-cli/src/config.rs` captures the full process environment once in typed `RuntimeEnv`; `run.rs` overlays explicit `run --env` values with platform key semantics and uses that same effective environment for executable resolution, probing, and launch without rereading process environment; `opencode_dialect.rs` invokes only direct argv `--version`, caps output and time, and rejects malformed/future majors. Automatic launch skips only OpenCode on probe failure; explicit OpenCode fails. `install_hooks.rs` quarantines the incompatible sibling before reading its exact ownership markers, restores unowned content with an atomic no-replace link, and never deletes or overwrites a concurrent replacement; `install_mcp.rs` owns the shared dual-schema endpoint/token inference used by both installers, rejects conflicting generated V1/V2 entries before mutation, and migrates an alternate-major entry only when endpoint, generated shape, and absent-or-Authorization-only headers match, preserving custom headers and ambiguous entries; auto-wire migrates MCP before hooks infer from that exact config path and skips hook mutation when transition preflight fails | `run.rs` `automatic_opencode_probe_failure_keeps_another_harness_available`, `opencode_executable_probe_selects_v2_for_launch_and_autowire`, effective-child-environment PATH casing controls, fake V1/V2/env-derived-major/malformed/future/timeout executable tests, `setup-agent` V1/V2 no-probe integration controls; `install_hooks.rs` `opencode_plugin_cleanup_removes_only_exact_owned_incompatible_sibling`, `opencode_plugin_cleanup_preserves_a_concurrent_user_replacement`, `opencode_plugin_restore_moves_quarantine_when_destination_is_free`, `opencode_plugin_restore_preserves_an_existing_replacement`, `opencode_plugin_restore_does_not_replace_a_file_created_at_restore_window`, `opencode_plugin_cleanup_does_not_escape_custom_target_directory`; `install_mcp.rs` `opencode_install_reuses_owned_endpoint_and_token_across_major_transitions`, `opencode_install_refuses_conflicting_owned_transition_entries`, `opencode_install_does_not_infer_from_a_user_owned_transition_entry`, `opencode_mcp_migration_moves_only_owned_alternate_shape`, `opencode_mcp_migration_preserves_ambiguous_user_entry`, `opencode_mcp_migration_preserves_custom_headers`, `opencode_mcp_migration_accepts_only_historical_generated_headers` | STRONG for Unix process probes and platform-neutral ownership gates; exact Windows executable resolution remains covered by `run.rs` resolver tests and requires the PR `windows` label || 12 | Network/auth posture | `config.rs` loopback `DEFAULT_BIND`; `serve.rs` `validate_http_exposure`, `require_allowed_host`; `auth.rs` `require_bearer`; `serve.rs` mounts `/identity` inside the host and machine-auth gates even with web disabled; `nix/nixos-module.nix` treats only literal `127.0.0.1`/`::1` as loopback, requires exactly one secret environment source for other binds, keeps secret auth and `llm_headers` values out of the Nix store, and brackets IPv6 in `ExecStart` | `serve.rs` host-guard (missing→400 / forged→403), non-loopback-requires-token; `auth.rs` wrong-token 401; `serve.rs` `machine_identity_remains_authenticated_with_web_disabled_and_expired_keys` (wrong and expired keys refused, valid machine key accepted, web remains disabled); `flake.nix` `nixos-module-eval` refuses `localhost` and `0.0.0.0` without a secret source, refuses two secret sources, `settings.auth` secrets, and `settings.llm_headers`, with literal IPv4/IPv6 loopback and one-source controls | STRONG || 12b | Managed-workstream provenance privacy, stable replay identity and server event namespace | `ai-memory-core/src/workstream.rs` `scrub_workstream_provenance`; `ai-memory-hooks/src/workstream.rs` `finish_run` reserved client-id check and `sanitize_events` before immutable segments, with `sanitize_events` and `append_boundary_events` scrubbing event/checkpoint/losses content *before* the 64 KiB cap so a cap-straddling secret is never cut into an unmatchable prefix (#1113); `ai-memory-store/src/workstream.rs` `finish_run` stable identity check and `stored_event`, scrubbing content with the explicitly supplied configured sanitizer before its 16 KiB store-boundary bound; no changes to the typed observation boundary | `store/tests/suite/workstream_provenance.rs` `workstream_provenance_is_bounded_scrubbed_and_idempotent_before_storage` (hostile and oversized source ids, unknown metadata, legitimate correlation, retry and distinct event ids), `workstream_provenance_legacy_reads_strip_secrets_and_unknown_metadata` (search and tail, malformed/oversized legacy JSON), `workstream_provenance_reused_event_id_retains_data_and_refuses_identity_change` (first indexed version retained, identity refusal and batch rollback), `workstream_provenance_replay_survives_sanitizer_changes` (new extra patterns and removal of a built-in-pattern allowlist exemption, with identity-refusal control), `workstream_provenance_replay_preserves_legacy_rows_above_bounds`, `workstream_provenance_finished_run_ignores_late_events`, `workstream_provenance_retry_with_marker_matching_pattern_is_idempotent`, `workstream_content_is_scrubbed_before_the_store_cap` (a credential straddling the 16 KiB store cap is redacted, not persisted as an unmatchable prefix; benign control verbatim; #1113); `hooks` `workstream_provenance_finish_scrubs_before_raw_segment_and_search` (custom sanitizer, immutable segment, SQL recovery and finished-run no-op), `workstream_provenance_client_cannot_use_server_event_ids` (reserved ids refused before raw writes, normal client event and server-generated checkpoint/loss controls), `finish_run_scrubs_event_content_before_the_byte_cap` and `finish_run_scrubs_boundary_events_before_the_byte_cap` (a credential straddling the 64 KiB event cap is redacted in the raw segment and never reaches the index; checkpoint/losses and benign controls; #1113); `cli/tests/suite/workstream_provenance.rs` (text/JSON and old server DTOs) | STRONG: privacy, stable-identity and reserved-namespace regressions fail with their guards bypassed; an isolated allowlist bypass fails on the unknown key, and bypassing the raw-id search authorization returns 200 where its test requires 403. No provenance is emitted in startup packets, and old raw segments are not rewritten |diff --cc docs/support-matrix.mdindex 5d4af43a,93837f12..41e44800--- a/docs/support-matrix.md+++ b/docs/support-matrix.md@@@ -39,9 -39,7 +39,9 @@@| VS Code Copilot | MCP-only | `.vscode/mcp.json` for Copilot agent mode; no lifecycle hooks (Copilot does not expose them yet). || Zed | MCP-only | Native remote MCP under `context_servers` in Zed's user `settings.json`; no lifecycle hooks or managed-workstream support. || Muse Code | MCP-only | `install-mcp --client muse` merges a native streamable-HTTP entry with bearer `headers` into the snake_case `mcp_servers` map of `~/.config/muse/settings.json`, preserving sibling servers. The writer adds the mandatory `"schema_version": 1` when absent (without it every `muse` command fails at startup) and never rewrites an existing value, and it sets `"mode": "optional"` because Muse's default `required` aborts the whole run when the server is unreachable. Skills need no extra step: Muse reads `~/.agents/skills`, which `install-skills` already writes. Lifecycle capture and managed workstreams are not claimed — Muse documents a hook surface, but the output contract of its `SessionStart` event is not specified. |+| DeepSeek Harness (DSH) | MCP-only | `install-mcp --client dsh` prints a Cordis patch fragment (a `- insert:` item for `@deepseek-ai/dsh-mcp-client`) to merge into `$DSH_HOME/profiles/<profile>/cordis.patch.yml`; DSH has no fixed MCP config file, so `--apply` is refused. Lifecycle capture is not claimed: DSH's `@deepseek-ai/dsh-hooks-claude-code` bridge can run a Claude Code hook config, but ai-memory's Claude Code hooks would report DSH sessions as `agent=claude-code`, and the bridge delivers only seven Claude Code events (`PreCompact` and `SessionEnd` are not), with a detached `SessionStart`. No managed workstream. |+| Prime Agent | MCP-only | `install-mcp --client prime-agent` merges an HTTP entry (`type: "http"` + `url`) into the `mcpServers` map of `$PRIME_AGENT_CODING_AGENT_DIR/settings.json` (default `~/.prime/agent/settings.json`), preserving other settings and servers; a project's `.prime/agent/settings.json` works through `--config-file`. A token is referenced as `"bearerTokenEnvVar": "AI_MEMORY_AUTH_TOKEN"`, never written: Prime Agent 0.10 counts a user HTTP server as connected and names it in the model's prompt only with that variable set or an OAuth grant. A credential-less entry is still callable through `mcp.call_tool("ai-memory", ...)` but is not listed. The model reaches MCP tools from its Python REPL (`await mcp.call_tool("ai-memory", "memory_query", {...})`), and Prime Agent sends no session id or cwd, so pass `workspace` and `project` on project-scoped calls. Lifecycle capture and managed workstreams are not claimed: Prime Agent 0.10 removed the TypeScript extensions its 0.9 releases had and has no hook surface. Verified against Prime Agent 0.10.0. |- | Hermes Agent | Supported | `install-hooks --agent hermes` (alias `hermes-agent`) prints a ready-to-paste `hooks:` block for `~/.hermes/config.yaml`. Hermes splits each configured `command` with `shlex.split` and runs it with no shell, passing the event JSON on stdin, so the entries invoke the native `ai-memory hook` command (exec form, like Zero and ZCode — no script bundle is staged); ai-memory never writes that YAML file, which is yours to edit and which Hermes itself gates behind its hook-acceptance prompt (`hooks_auto_accept`). Two tool events are wired, `pre_tool_call` → `pre-tool-use` and `post_tool_call` → `post-tool-use`; their `tool_name` / `tool_input` payload drives concrete session attribution, tool-family titles, and capture exclusions. Session lifecycle (recall, prompt capture, session-end, automatic handoff) is owned by the community-maintained [`ai-memory-hermes-plugin`](https://github.com/MrLuciano/ai-memory-hermes-plugin) memory provider, so no hook-driven `session-end` is installed and nothing is duplicated; review that plugin's compatibility matrix, install/uninstall scripts, and secret handling before enabling it. No first-party `install-mcp` client and no managed workstream are claimed yet, and because Hermes ignores session-start hook stdout a pending handoff is recovered through MCP (`memory_handoff_list` then `memory_handoff_accept`). |+ | Hermes Agent | Supported | `install-hooks --agent hermes` (alias `hermes-agent`) prints a ready-to-paste `hooks:` block for `~/.hermes/config.yaml`. Hermes splits each configured `command` with `shlex.split` and runs it with no shell, passing the event JSON on stdin, so the entries invoke the native `ai-memory hook` command (exec form, like Zero and ZCode — no script bundle is staged); ai-memory never writes that YAML file, which is yours to edit and which Hermes itself gates behind its hook-acceptance prompt (`hooks_auto_accept`). Two tool events are wired, `pre_tool_call` → `pre-tool-use` and `post_tool_call` → `post-tool-use`; their `tool_name` / `tool_input` payload drives concrete session attribution, tool-family titles, and capture exclusions. Hermes reports its own process directory as `cwd`, so the native hook locates each event's `.ai-memory.toml` from the tool's absolute `workdir` (`terminal`) or `path` (file tools, `search_files`); a call with no absolute location stays with the process directory. Session lifecycle (recall, prompt capture, session-end, automatic handoff) is owned by the community-maintained [`ai-memory-hermes-plugin`](https://github.com/MrLuciano/ai-memory-hermes-plugin) memory provider, so no hook-driven `session-end` is installed and nothing is duplicated; review that plugin's compatibility matrix, install/uninstall scripts, and secret handling before enabling it. No first-party `install-mcp` client and no managed workstream are claimed yet, and because Hermes ignores session-start hook stdout a pending handoff is recovered through MCP (`memory_handoff_list` then `memory_handoff_accept`). || GrizzyBot | Supported | [GrizzyBot](https://github.com/Foscoe63/GrizzyBot), a native macOS agent app, ships its own ai-memory bridge: it posts lifecycle events to `/hook` with `agent=grizzybot` (alias `grizzy-bot`) and talks to `/mcp` directly, so there is nothing for `install-hooks` or `install-mcp` to write. Sessions are attributed to `grizzybot`, and its Claude Code-shaped tool payloads (`tool_name`/`tool_input`/`tool_use_id`) are stored as closed-schema tool families, never tool names or arguments. The bridge is maintained in the GrizzyBot repository; review it before pointing it at a shared server. No managed workstream. || LLM/auth providers | Supported | Anthropic, OpenAI, OpenAI OAuth/Codex, GitHub Copilot, Gemini, OpenCode (Go and Zen), OpenAI-compatible endpoints, and generic OIDC device auth for native hooks. || Embedding providers | Supported | OpenAI, Voyage, Google Gemini, and keyless OpenAI-compatible endpoints such as Ollama, LM Studio, and vLLM. |