Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
Merge main into release/3.3
AkitaOnRailsec0d6e052619
diff --cc CHANGELOG.mdindex 69d347d8,48cb1bac..9757a8b2--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -11,68 -11,563 +11,625 @@@ version in [`docs/changelog/`](docs/cha## [Unreleased]+### Added++- Added `[handoff] deliver_on_session_start = false` to `.ai-memory.toml`. A+ project that sets it no longer gets its handoff, or the continuity notice, at+ session start; the handoff is still created when the session ends and stays+ open for `memory_handoff_accept`. The native hook, the shell and PowerShell+ scripts and the generated TypeScript integrations send `handoff=0` only when+ the value is explicitly falsy (#1621).++- Added first-party Qoder CLI/IDE lifecycle and MCP support. Both installers+ merge into `~/.qoder/settings.json`: `install-mcp --client qoder` writes a+ sessionless stdio bridge, while `install-hooks --agent qoder` registers the+ eight documented memory-bearing events as native commands. Session start+ delivers a pending handoff through `hookSpecificOutput.additionalContext`,+ prompt/tool capture uses Qoder's Claude-shaped payloads, and a missing hook+ `cwd` falls back only to `QODER_PROJECT_DIR`. Setup detects `~/.qoder`,+ uninstall removes both entries, and agent backups include its settings and+ shared AGENTS-compatible skills/instructions (#1611).++- Profile writes now return `digest_warning` when the selected summary,+ abstract, or prose statement exceeds the 240-byte session-start digest+ limit. The write still succeeds, but its author can shorten the summary+ instead of discovering the truncation only in a later session (#1609).++- Added project routing for the named profiles of a multiplexing Hermes+ gateway. The gateway exports only the default profile's `terminal.cwd`, so+ every other profile's events used to fall back to the gateway's own working+ directory and all its bots landed in one project. A gateway event of a named+ profile now routes by an `.ai-memory.toml` placed in that profile's Hermes+ home (`~/.hermes/profiles/<name>`, or under the gateway's `HERMES_HOME`), and+ that marker's capture exclusions and server profile apply. A profile without+ such a marker keeps the old behavior. The profile name is checked against+ Hermes' profile-id pattern before it is used as a path (#1597).++- Added Hermes Agent hook consent to `ai-memory doctor`. Hermes runs a shell+ hook only when that exact command is approved in the home's+ `shell-hooks-allowlist.json`, and each profile under+ `~/.hermes/profiles/<name>` keeps its own allowlist. A profile with the+ ai-memory hooks in `config.yaml` but no approvals captured nothing, and its+ gateway only logged `not allowlisted — skipped` for each event. `doctor` now+ reads the root home and every profile, reports which ai-memory hook events+ each one wires, and warns about every profile whose events are not+ allowlisted (unless `hooks_auto_accept` is on), with the `hermes -p <name>+ --accept-hooks` command that approves them. The JSON output gains a `hermes`+ array. It never writes either file and never prints the hook commands,+ which can embed a bearer token (#1598).++- Added `AI_MEMORY_RERANK_TIMEOUT_SECS` (`rerank_timeout_secs` in+ `config.toml`) to set the `memory_query` reranker budget, which was fixed at+ 20 seconds. The default stays 20 and zero is rejected at startup. A hosted+ provider behind an LLM fallback chain can spend the whole fixed budget on one+ slow 503 before the next candidate answers, and every such query then keeps+ its pre-rerank order. ([#1614](https://github.com/akitaonrails/ai-memory/issues/1614))++### Changed++- Managed-workstream startup packets now render completed tool calls and+ results as compact provenance stubs instead of spending the 30,000-character+ resume budget on raw command output or generated file content. Conversation,+ checkpoints, compactions, and annotations remain inline; the complete+ sanitized tool evidence stays searchable in the ledger (#1607).++ ## [3.2.2] - 2026-10-22++ ### Fixed++ - Fallback-provider circuits now honor bounded retry hints instead of retrying+ a quota-exhausted candidate every 30 seconds. HTTP `Retry-After` takes+ precedence; Gemini's `google.rpc.RetryInfo.retryDelay` is read from the full+ scrubbed error body before its diagnostic text is cut to 1 KiB. Hints are+ clamped to 30 seconds through one hour, remain scoped to one chain entry, and+ never enlarge the logged provider body (#1619).+ - Fixed the PowerShell Docker wrapper leaving native managed commands without+ the root bearer stored in a named volume. Native `install-hooks` now refreshes+ a host copy under the user's local app-data directory once, and `run`,+ `show`, `continue`, `resume`,+ `workstreams`, and `rename-workstream` reuse it without starting a container;+ explicit token and bind-mounted data-dir settings still take precedence+ (#1603).+ - Fixed Antigravity print-mode managed runs recording no user prompt because+ `agy --prompt` does not append to shared `history.jsonl`. When that history+ yields no prompt, export now reads only explicit `USER_INPUT` records from+ the conversation's bounded, containment-checked brain transcript (#1605).+ - Kept Claude Code's combined SessionStart context below its fixed 10,000+ character inline limit. Profile and handoff sections are independently+ bounded, must-see handoff/continuity/inbox notices take priority, and an+ omitted managed ledger leaves a `workstream-search` pointer instead of+ pushing the entire response into an unread file (#1606).++ - Corrected the startup error for a gap in SQLite migration history. A+ skipped earlier migration is now reported as missing from the history,+ instead of claiming the store is newer than the binary. The store still+ refuses to open until its migration history can be reviewed (#1612).++ - Fixed the POSIX Docker wrapper routing host commands into the helper+ container when `--config` or `--data-dir` preceded the command. Managed+ launches, MCP bridges and lifecycle hooks now retain their native host+ route and complete argument list with either global-option syntax (#1602).++ - Fixed native transcript imports dropping a whole session when one JSONL+ record exceeded the 1 MiB per-record cap, as a Claude Code screenshot in a+ tool result does: `ai-memory backfill` imported nothing from the session,+ and an `ai-memory run` recorded its transcript import as failed. The record+ is now skipped as an extraction loss, its tail read in bounded chunks that+ still count toward the 64 MiB source cap, and the rest of the session is+ imported; a record still being written is left for the next read, not+ skipped half-way. The transcript baseline steps over it the same way, so a+ degraded run's recovery cursor and its exact replay agree. An annotation+ marks the gap, and shows in a managed run's ledger as an import note, so the+ capture policy fails closed: a tool result without a call id (Kimi, Grok)+ later in the same turn is treated as an orphan, since the skipped record may+ have been its call under an ignored path. `backfill` and `recover` print how+ many records they skipped on stderr, `backfill` also under `--quiet`+ (#1613).++ - The `user grants` and `project grants` tables now measure terminal display+ cells, so accented and double-width CJK workspace, project and user names+ keep the `USERNAME` and `LEVEL` columns aligned.+ ([#1564](https://github.com/akitaonrails/ai-memory/pull/1564))+ - The LLM dream pass no longer writes a cross-scope wikilink that does not+ resolve. Every other consolidation write runs its proposed bodies through the+ cross-scope link guard, but the dream pass never did, so a `[[project:path]]`+ carried in from a cluster member's body — or invented by the model — reached+ the merged survivor and minted a dangling cross-project edge that the lint+ pass reported on every later run and nothing could clear.+ ([#1566](https://github.com/akitaonrails/ai-memory/pull/1566))+ - The desktop installer no longer hangs on "Starting the setup page" when+ `ai-memory setup --web` logs heavily. It read the child's stdout for the+ whole run and its stderr only afterwards, so once that unread pipe filled+ (64 KiB) the child blocked on its next log line and never printed the page's+ address, leaving the window on the status line with no error. Both streams+ are now read at the same time.+ ([#1567](https://github.com/akitaonrails/ai-memory/pull/1567))+ - The importer no longer carries a UTF-8 BOM into an imported text or Markdown+ document. `document --file notes.md` on a file saved with a BOM — what+ Notepad, VS Code's `utf8bom` encoding and Excel's "CSV UTF-8" export all+ write — stored a body beginning `\u{feff}# Overview`, so the first heading+ stopped being a heading. Nothing downstream removed it, since U+FEFF is+ neither whitespace nor a control character, and the transcript extractor in+ the same file already stripped it.+ ([#1568](https://github.com/akitaonrails/ai-memory/pull/1568))+ - A workbook that contains a chartsheet now imports its worksheets instead of+ failing outright. OOXML lists chartsheets and dialogsheets as `<sheet>`+ elements alongside worksheets and only the relationship type tells them+ apart, so a chart tab created by Excel's "Move Chart -> New sheet" had no+ worksheet relationship and aborted the whole extraction; a workbook of only+ chartsheets still reports that it contains no worksheets.+ ([#1569](https://github.com/akitaonrails/ai-memory/pull/1569))+ - Skip an oversized session-header record instead of failing the read when the size cap's boundary cuts a multi-byte character, so one unreadable transcript no longer aborts discovery or lookup for the other sessions beside it ([#1570](https://github.com/akitaonrails/ai-memory/pull/1570))+ - `/api/v1/search` no longer tells the browser it may reuse a search response+ for 30 seconds. The handler takes an owner filter that reaches the hybrid+ ranker, so both the ranking and each hit's observation snippet depend on who+ asked, and a credential switch at the same URL inside that window could be+ answered from the browser cache without the filtering path running. The+ endpoint now sends `private, no-store`, as every other owner-scoped route in+ the same module already does.+ ([#1571](https://github.com/akitaonrails/ai-memory/pull/1571))+ - `ai-memory recover` now recovers a GitHub Copilot CLI session. The recovery+ journal records `copilot` for a degraded or finish-failed `ai-memory run+ copilot`, but the reader had no entry for that name, so recovery reported+ `journal names unsupported harness 'copilot'` and retained the entry on every+ rerun, leaving the transcript unrecovered. The same gap keyed the quarantined+ hook events with `copilot` instead of `copilot-cli` and sent an exportable+ Copilot transcript down the spool-only path.+ ([#1572](https://github.com/akitaonrails/ai-memory/pull/1572))+ - `ai-memory status` now reports an unreadable recovery journal while the+ server is down. The offline recovery hint read the journal error, used it to+ decide whether to print anything, then printed neither branch's copy of it:+ a truncated `recovery-journal.json` left the human line saying `repair+ unrecorded runs (0 journaled)` and the `--json` line saying+ `{"journal_pending": 0, "spool_pending": 0}`, a machine-readable all-clear+ for a journal that cannot be parsed.+ ([#1573](https://github.com/akitaonrails/ai-memory/pull/1573))+ - `purge-project` now keeps `--force` and `--compact` in the re-run command its+ refusal prints. The dry-run preview above it is computed with the operator's+ own flags, but the printed command dropped them, so pasting it after a+ `--force` run came back as a 409 `managed run lease is active` — the exact+ condition `--force` overrides — and a `--compact` run quietly reverted to a+ logical delete ([#1574](https://github.com/akitaonrails/ai-memory/pull/1574))+ - `move-project` now keeps `--force` and `--on-conflict` in the re-run command+ its refusal prints. Both flags are honoured in the request the command+ builds, but the printed command dropped them, so pasting it after an+ `--on-conflict overwrite` run fell back to the `block` default and came back+ as a 409 listing the conflicting paths instead of merging them, while a+ dropped `--force` put the active-project guard back in place+ ([#1575](https://github.com/akitaonrails/ai-memory/pull/1575))+ - The compaction recap now reaches Claude Code, Codex and Qwen Code while an+ external producer owns capture. A `reload context` prompt is answered+ through the `UserPromptSubmit` context envelope, but that delivery path was+ missing from the set exempt from `AI_MEMORY_CAPTURE_OWNER` suppression, so+ the hook returned an empty response before it could fetch the recap. Every+ enqueue and drain on the path stays gated on the external owner, so the+ exemption delivers context without capturing anything.+ ([#1576](https://github.com/akitaonrails/ai-memory/pull/1576))+ - Fixed the SessionEnd consolidation queue retrying a provider failure that a+ later attempt cannot clear. The queue's terminality check hand-enumerated+ only the deterministic structured-response shapes, so a rejected or expired+ credential, an unconfigured provider, a schema failure and a+ malformed-request `4xx` were all retried: one expired API key burned the+ full five-attempt cap — five complete consolidation prompts over 7.5+ minutes — for every ended session, logging "queued for retry" four times.+ The check now defers to `LlmError::is_transient`, the predicate the+ in-process consolidation and bootstrap retry loops already use, so only a+ `429`, a `5xx` or a transport timeout/connect failure keeps the bounded+ backoff and every deterministic failure settles the job terminal with the+ heuristic session page left in place+ ([#1581](https://github.com/akitaonrails/ai-memory/pull/1581))+ - Fixed the document importer's subtitle reader dropping WebVTT cues whose+ identifiers begin with `NOTE` and rejecting CR-only WebVTT files as empty.+ It now distinguishes comment tokens from cue identifiers and normalizes+ CR, LF, and CRLF before splitting VTT/SRT cues. (#1601)++ - Fixed the profile digest cutting an entry's line at 240 bytes with no+ sign of the cut: a `summary`, `abstract` or first prose line over the limit+ was clipped mid-word, so the agent read part of a rule as the whole rule.+ The line now ends in `…` inside the same 240 bytes, and+ `docs/cross-project-profile.md` states the limit next to `summary`.+ (#1608)+ - `install-mcp --client freebuff --apply --auth-token` now stores the key in+ `<data_dir>/auth-token`, where the hooks keep theirs, and writes the FreeBuff+ entry with `--data-dir` and no token, as it already did for the Claude Code+ (`--session-aware`) and Muse bridge entries. FreeBuff's entry is always the+ session-less `mcp-bridge` and already carried that `--data-dir`, but the key+ was written into `~/.agents/mcp.json` as `env.AI_MEMORY_AUTH_TOKEN`, outside+ the data dir's file permissions and outliving a rotation. The key still stays+ in the entry whenever the bridge would not reach it: a configured bearer that+ would win, a different key already stored for the hooks, hooks that sign in+ with OIDC, a failed store, a different endpoint, the Docker helper, or a+ snippet that is only printed.+ ([#1593](https://github.com/akitaonrails/ai-memory/pull/1593))+ - `install-mcp --client codex` now prints the same table name `--apply` writes.+ The printed snippet hand-interpolated `[mcp_servers.<name>]`, so `--name+ ai.memory` printed a header a TOML reader resolves as three nested tables+ rather than one server, and `--name "my memory"` printed an invalid header+ that breaks the whole `config.toml` it is pasted into — while `--apply`+ quoted the key correctly all along. The printed table is now built with the+ apply path's own `toml_edit` writer; output for an ordinary name is+ unchanged.+ ([#1594](https://github.com/akitaonrails/ai-memory/pull/1594))+ - Every command except `hook` and `mcp-bridge` now warns, naming the variable+ but not its value, when `HTTPS_PROXY`, `HTTP_PROXY` or `ALL_PROXY` (or a+ lower-case spelling) is set to something the HTTP client cannot use: bytes+ that are not UTF-8, such as a Latin-1 password, a URI with an unencoded+ space or non-ASCII character, or an unsupported scheme. The client skips+ such a value and connects directly, so provider and login requests used to+ time out on a network that blocks direct egress, or bypass a required proxy+ where it does not, with nothing pointing at the proxy setting.+ ([#1565](https://github.com/akitaonrails/ai-memory/pull/1565))+ - `init`, `auth` and `auth enable` print paths on Windows without the `\?# Changelog++ All notable changes to this project will be documented in this file.++ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).++ This file holds the current major line. Earlier lines are archived per major+ version in [`docs/changelog/`](docs/changelog/):+ [2.x](docs/changelog/2.x.md), [1.x](docs/changelog/1.x.md) and [0.x](docs/changelog/0.x.md).++ verbatim prefix of the canonical data dir, in their output and their errors,+ as the hook and service commands already did, and so does the+ `ai-memory starting` line every command logs. A path copied from those+ messages now works in `cmd` and in scripts that look for it.+ ([#1565](https://github.com/akitaonrails/ai-memory/pull/1565))++ - Corrected the Docker rollback instructions to retag the prior digest and recreate the service without pulling the newer tag. ([#1585](https://github.com/akitaonrails/ai-memory/pull/1585))++ - Corrected Docker backup instructions to use an online server snapshot or stop the container before copying its data. ([#1586](https://github.com/akitaonrails/ai-memory/pull/1586))++ - Corrected the multi-user migration command to pass the pepper length with `--bytes`. ([#1587](https://github.com/akitaonrails/ai-memory/pull/1587))++ - Corrected the API smoke test to use the running server’s configured bearer instead of a newly generated token. ([#1588](https://github.com/akitaonrails/ai-memory/pull/1588))+ - Fixed restoring a page from a checkpoint leaving a pre-OKF file on disk.+ `restore-page` wrote the checkpointed bytes verbatim while the three+ sibling write paths conform theirs, and the row it indexes is conformed at+ the store's write choke point either way — so only the file was left+ behind. Restoring the pre-OKF checkpoint every migrated install carries+ then broke `export-okf` for the whole project with "run the server once to+ migrate", which the one-shot wiki migration never does again, and made+ every `serve` boot re-archive the data dir once the migration archive was+ deleted. The restore now conforms the file like the siblings do;+ conformance is idempotent modulo `generated.at`, which it inherits from the+ file on disk, so an already-conformant page still restores byte-exact.+ ([#1595](https://github.com/akitaonrails/ai-memory/pull/1595))+ - Fixed `memory_query` skipping its raw-observation fallback (`raw_hits`)+ whenever an embedder was configured, which the default local embeddings+ are. The vector stream has no similarity floor, so an unrelated page+ kept `hits` non-empty, and an observation from a session with no page+ yet (still open, or ended without SessionEnd) could not be found, while+ the same store with `embedding_provider = "none"` returned it. The+ fallback now runs unless a page matched the query's own terms through+ page FTS, the entity stream or the observation stream; page ranking is+ unchanged (#1600).++ - An empty structured answer from a Responses-API model is now reported as+ empty content rather than a JSON parse error. The `opencode`, `openai-oauth`+ and `codex` paths defaulted a missing `output_text` to an empty string and+ handed it to the parser, so the operator saw `serde: EOF while parsing a+ value at line 1 column 0`, naming neither the model nor the cause.+ ([#1529](https://github.com/akitaonrails/ai-memory/pull/1529))+ - Detected `core.hooksPath` when a git config set it on the same physical+ line as the `[core]` section header, so `ai-memory-wikisync install-hook`+ no longer writes a `.git/hooks/post-merge` that git would never run.+ ([#1530](https://github.com/akitaonrails/ai-memory/pull/1530))+ - Counted a file's final line in `ai-memory-wikisync` diff summaries when it+ does not end in a newline, so the `bytes/lines` figures no longer contradict+ the `first difference at line N` printed beside them.+ ([#1531](https://github.com/akitaonrails/ai-memory/pull/1531))+ - `ai-memory run` now refuses an `--env`/`--env-file` entry whose key carries+ whitespace. `--env-file` lines are trimmed as a whole, not per half, so the+ common dotenv spelling `KEY = value` produced a key with a trailing space —+ an entry no shell or harness can read, so the override silently did nothing.+ ([#1532](https://github.com/akitaonrails/ai-memory/pull/1532))+ - Discovered a repository page whose `--include` family names a bare top-level+ page (`README.md`), which `ai-memory-wikisync sync` previously left out of the+ repository side entirely, so a newly created one was never imported.+ ([#1533](https://github.com/akitaonrails/ai-memory/pull/1533))+ - A Copilot `/responses` answer stopped by `max_output_tokens` is now reported+ as a truncated response naming the model and its output-token count, instead+ of an unexpected response shape reading "no error detail" — `error` is null+ on an incomplete answer, so nothing explained the stop and the class implied+ an unparseable reply rather than a `max_tokens` to raise.+ ([#1534](https://github.com/akitaonrails/ai-memory/pull/1534))+ - Omitted TTL-expired pages from the page count in `memory_briefing` and+ `memory_explore`. Every page list in a briefing already hid them, and the+ project cards have since 3.1.x, so a project with an expired page reported+ more latest pages than any list in the same response could show. The+ all-versions total is unchanged, as is `ai-memory status`.+ ([#1535](https://github.com/akitaonrails/ai-memory/pull/1535))++ - `memory_read_page` now reads a blank `path` or `query` as omitted, as its+ sibling arguments already do. An empty or whitespace-only `query` searched+ for an empty FTS expression and reported the inevitable miss as an internal+ error (-32603), which a looping client reads as "retry"; an empty `path`+ failed as "invalid path: empty path" and never tried the `query` passed+ beside it. Both now reach the instructive "exactly one of `path` or `query`"+ refusal, and a blank `path` beside a real `query` runs the search.+ ([#1536](https://github.com/akitaonrails/ai-memory/pull/1536))+ - Reported a wiki page renamed away with an external tool, which arrives as a+ rename event rather than a removal, so the next auto-commit drops it from the+ tree instead of leaving a checkpoint naming a page that no longer exists.+ ([#1537](https://github.com/akitaonrails/ai-memory/pull/1537))+ - Omitted TTL-expired pages from the 7- and 30-day activity counters in+ `memory_briefing`. A page written with a short TTL made a project look+ active while the brief's own recent-page list was empty, which is the+ signal an agent uses to decide how much context to pull. Session and+ observation counters have no TTL and are unchanged.+ ([#1539](https://github.com/akitaonrails/ai-memory/pull/1539))++ - Kept literal `<mark>` tags from a page's own text out of search-result+ markup, including balanced pairs that previously looked identical to SQLite+ highlights. FTS now uses internal delimiters that sanitized page content+ cannot forge, and only presentation boundaries turn them into HTML.+ ([#1540](https://github.com/akitaonrails/ai-memory/pull/1540))+ - `install.ps1` now refuses a plain-http GitHub release base. The scheme check+ sat inside a condition whose arms already implied https, so it could never+ fire, and an `http://github.com/...` base matched neither arm and skipped it+ entirely — while the archive and its checksum are fetched from that same+ origin, so the checksum proved nothing against an on-path rewrite.+ ([#1541](https://github.com/akitaonrails/ai-memory/pull/1541))+ - An unspaced-CJK search carrying `AND`, `NOT` or `NEAR` no longer returns the+ pages the operator excluded. The auxiliary CJK stream discarded every boolean+ operator and `OR`-joined the CJK runs it found, and because that stream is+ unioned into the primary one, `東京 NOT 大阪` fused the 大阪-only pages back in+ and ranked them as if they had been asked for. The stream now declines such a+ query, so unspaced-CJK recall narrows to the pre-feature answer for it instead+ of inverting; `OR` queries are unaffected.+ ([#1542](https://github.com/akitaonrails/ai-memory/pull/1542))+ - An `openai-oauth` answer the Codex backend stopped at its output-token+ budget is now a terminal truncation instead of a retryable `502`. The+ streaming parser read `response.incomplete` as a provider fault, so the+ fallback chain advanced to the next candidate and opened a circuit, and the+ SessionEnd consolidation job kept re-sending the same prompt on its backoff+ schedule, each attempt truncating again at the same budget.+ ([#1543](https://github.com/akitaonrails/ai-memory/pull/1543))++ - `memory_read_page` now answers a missing read target with `invalid params`+ (-32602) instead of an internal error (-32603). A page absent under the+ resolved scope, and a query that matched nothing, are caller-fixable: the+ store answered, there is simply nothing there, and a client reads -32603 as+ "retry". `memory_status` and `memory_read_session_observations` already+ answer -32602 for an unknown project or session. The messages and the+ auto-resolved-scope hint are unchanged, and a genuine disk or store failure+ on the same path still answers -32603.+ ([#1544](https://github.com/akitaonrails/ai-memory/pull/1544))+ - An OpenCode subagent session's end no longer hands the next session a+ sub-task baton. The generated plugin forwarded the session's `parentID` as+ the `agent_id` subagent marker on `session.created` but not on+ `session.deleted`, so the `session-end` request carried no marker, the+ router did not recognize a child session, and it published a summary page+ and an open handoff that the next root session in that checkout consumed.+ ([#1546](https://github.com/akitaonrails/ai-memory/pull/1546))+ - `install-mcp --client opencode --flavor <dialect>` now writes the flavored+ URL into the OpenCode entry. Both OpenCode entry builders read the server+ URL directly instead of the flavored one, so the flag was silently dropped+ for a client its own documentation names: a Vertex-routed install got a bare+ URL and 400'd every `tools/list`. OpenCode installs that do not pass+ `--flavor` are unchanged.+ ([#1547](https://github.com/akitaonrails/ai-memory/pull/1547))++ - A `title:` or `body:` filter on an unspaced-CJK search now narrows the+ auxiliary CJK stream too. The stream read `:` as a plain run separator and+ dropped the qualifier, so its MATCH searched every indexed column including+ the path, and because that stream is unioned into the primary one,+ `title:支付服务` returned pages holding the term only in their body or path.+ ([#1548](https://github.com/akitaonrails/ai-memory/pull/1548))+ - An Anthropic structured answer the model stopped at `max_tokens` is now a+ terminal truncation instead of a successful result. The provider did not read+ `stop_reason`, so a `tool_use` block holding only the JSON produced before the+ budget ran out was returned as a complete answer: a consolidation or bootstrap+ chunk could write a fraction of its pages and report success. On models that+ reject a forced `tool_choice` the same stop reported "no tool_use block"+ instead. Non-structured completions are unchanged — prose cut at the budget is+ still returned.+ ([#1549](https://github.com/akitaonrails/ai-memory/pull/1549))+ - Counted a page needing only an L0 abstract embedding in `ai-memory embed+ --dry-run` and `/admin/embed`. A page whose body vector was already current+ appeared in neither the would-embed nor the up-to-date total, so the dry run+ reported no work for a scope where a live run writes abstract embeddings.+ ([#1550](https://github.com/akitaonrails/ai-memory/pull/1550))++ - The PowerShell `session-start` hooks for Claude Code, Command Code and Devin+ now wrap the handoff in the same `hookSpecificOutput` envelope their POSIX+ peers emit. On Windows the baton was written as bare text, so the harness+ logged "Hook output does not start with {, treating as plain text" on every+ start and the handoff arrived unstructured instead of as `additionalContext`.+ ([#1551](https://github.com/akitaonrails/ai-memory/pull/1551))+ - The Japanese iteration mark 々 (and the other letters of CJK Symbols and+ Punctuation) now stay inside a CJK run. They terminated one, so a word like+ 日々 was indexed as two single characters and searching it emitted a bare+ `"日"` that matched every page containing 日 while 日々 itself was unfindable+ as a unit. Indexing changes with this, so existing rows keep their old terms+ until they are rewritten or the index is rebuilt by a compaction.+ ([#1552](https://github.com/akitaonrails/ai-memory/pull/1552))+ - `memory_write_page` now refuses a relation target whose `project:` or+ `workspace/project:` scope holds a character the link reader cannot parse,+ such as a space in `my project:notes/x`. The write boundary used a looser+ character class than the reader, so the colon stayed inside the page path on+ read and the write created an edge to a path no page write can ever produce —+ a `links` row that could never be resolved.+ ([#1553](https://github.com/akitaonrails/ai-memory/pull/1553))++ - `memory_handoff_cancel` now answers a well-formed `handoff_id` that resolves+ to nothing in scope with `invalid params` (-32602) instead of an internal+ error (-32603). The lookup succeeded and found no row, so the id is the+ caller's to fix, and a client reads -32603 as "retry". The same function+ already answered a malformed id with -32602, and `memory_handoff_accept`+ reports an unknown id as `{"handoff": null}`. The message is unchanged and+ still identical for an absent id and for another operator's, so cancelling+ reveals no more than before.+ ([#1554](https://github.com/akitaonrails/ai-memory/pull/1554))+ - `ai-memory run` no longer loses a native session selector that sits behind a+ non-UTF-8 argument. The scan over the forwarded arguments ended at the first+ argument that was not valid UTF-8 instead of skipping it, so a run pinned with+ an explicit `--session`/`--resume` kept no expected session id and fell back+ to post-exit transcript discovery.+ ([#1555](https://github.com/akitaonrails/ai-memory/pull/1555))+ - Dropped the merged-away page's `summary:` and `abstract:` from the merge+ stub left behind by cold-cluster dedup and the dream pass. Retrieval+ prefers a frontmatter summary over the body, so the brief and the+ non-keyword hit lists described the stub as if it still held content that+ had moved to the survivor. The pre-merge frontmatter stays reachable+ through the supersession chain; compaction is unchanged.+ ([#1556](https://github.com/akitaonrails/ai-memory/pull/1556))++ - The OKF migration now conforms a page nested under a project bundle whose+ file is named `index.md`. Only the bundle root's own `index.md` is reserved,+ but the skip matched on the basename at any depth, so the database row was+ conformed while its file kept pre-OKF frontmatter — and markdown being the+ source of truth, the next reindex de-conformed the page again.+ ([#1557](https://github.com/akitaonrails/ai-memory/pull/1557))+ - A root Grok session no longer loses its handoff because a tool used one of+ the subagent marker key names. The shell `post-tool-use` hook matched+ `agent_id` and its siblings as substrings of the whole raw payload, so a key+ of that name nested in `tool_input` or in a structured tool result, or a+ blank top-level value, suppressed the fetch. The gate now reads top-level+ keys with a non-empty string value, like the native router and the+ PowerShell bundle already did.+ ([#1558](https://github.com/akitaonrails/ai-memory/pull/1558))+ - `ai-memory list-projects` now sizes its columns by terminal display width+ rather than bytes. Accented names no longer add phantom padding, and+ double-width CJK project or workspace names no longer shift later columns.+ ([#1559](https://github.com/akitaonrails/ai-memory/pull/1559))++ - A byte size just under a unit boundary now carries to the next unit instead+ of printing a magnitude that unit cannot hold. The scaling loop stopped at+ `value < 1024.0` while the result is rendered with one decimal, so a+ database of 1 MiB minus six bytes made `ai-memory status` report+ `1024.0 KiB on disk` rather than `1.0 MiB`; `reclaim-ledger-versions` could+ likewise print `1024.0 KiB -> 1.0 MiB` for a six-byte difference.+ ([#1562](https://github.com/akitaonrails/ai-memory/pull/1562))++ - A popped message can no longer pass its own text off as `ai-memory`'s. The+ human rendering of `message pop` printed the sender's subject above the+ security notice and the body between two literal fence lines, neither+ escaped, so a newline in the subject forged lines in the provenance block+ and an `---- end of body ----` line in the body closed the fence early. The+ subject now renders on one line, body fence markers are neutralized, and+ terminal control sequences are stripped; both JSON paths remain structural.+ ([#1563](https://github.com/akitaonrails/ai-memory/pull/1563))++ - Hardened the privacy strip. It now matches credentials across invisible+ formatting characters while storing text that matches nothing byte for+ byte, so emoji sequences and scripts that need joiners are untouched. It+ also redacts PGP private keys and private-key blocks that have no end line,+ as long as a key-body line follows the header, so prose that only names a+ header is kept. Tag characters outside an emoji flag, a byte-order mark+ after the start of the text and the invisible math operators are stripped.+ The allowlist no longer exempts private keys, and blank `[sanitize]+ allowlist` entries are ignored with a warning at startup. The client scrub+ shared by the relay and importer companions follows the same rules.+ Reported by @FabioLeitao.+ ([GHSA-jpcg-w5c5-wcv6](https://github.com/akitaonrails/ai-memory/security/advisories/GHSA-jpcg-w5c5-wcv6))++ - Tightened how client commands decide that a server URL is on this machine+ before using the install's root token. The check now reads the host the+ HTTP client would connect to and refuses any URL that carries user+ information. `ai-memory upgrade` uses the same check for its remote-server+ note. Reported by @FabioLeitao.+ ([GHSA-jpcg-w5c5-wcv6](https://github.com/akitaonrails/ai-memory/security/advisories/GHSA-jpcg-w5c5-wcv6))++ - `ai-memory restore` no longer replaces an existing live `config.toml` with+ the backup's by default, because a config can run commands and redirect+ data. The backup's copy is saved beside it as `config.toml.from-backup`+ (owner-only) with a notice; pass the new `--with-config` flag to restore it+ in place as before. A data dir with no config still gets the backup's. When+ the live config is kept and the restored database holds API keys, its pepper+ must match them, or the restore stops before changing anything and names+ `--with-config`. Reported by @FabioLeitao.+ ([GHSA-jpcg-w5c5-wcv6](https://github.com/akitaonrails/ai-memory/security/advisories/GHSA-jpcg-w5c5-wcv6))++ - `install-mcp --client codex` now makes Codex ask before running ai-memory's+ destructive tools. The read tools still run without a prompt; every tool+ annotated destructive (deleting or restoring a page, the forget sweep,+ accepting or cancelling a handoff, popping or cancelling messages, recall+ feedback) gets a per-tool `approval_mode = "prompt"`, and a re-install keeps+ per-tool settings you already chose. Re-run `install-mcp --client codex+ --apply` to update an existing entry. Reported by @FabioLeitao.+ ([GHSA-jpcg-w5c5-wcv6](https://github.com/akitaonrails/ai-memory/security/advisories/GHSA-jpcg-w5c5-wcv6))++ - A server profile's `roots` now admit a checkout whose Windows cwd differs+ from the registered root only in case. `Path::starts_with` compares+ components byte-exactly, so a root added as `C:\Work\team-b` refused+ `C:\work\team-b\repo` and every event captured there was dropped as+ `rejected-outside-roots`, even though the home marker's own path routes+ already fold case under a drive-letter or UNC root. POSIX roots stay+ case-sensitive.+ ([#1538](https://github.com/akitaonrails/ai-memory/pull/1538))++ ### Security++ - A malformed OAuth entry in `auth.json` no longer prints the stored value in+ its error. When a field held a value of the wrong type, such as a token+ written into `expires` by a hand edit or a provisioning script, the parse+ error quoted the token, and from there it reached terminals, CI logs and+ captured hook output. The error now names the type it found with the value+ replaced by `<redacted>`.+ ([#1565](https://github.com/akitaonrails/ai-memory/pull/1565))++ ## [3.2.1] - 2026-10-22++ ### Fixed++ - Fixed a 3.2.0 regression that serialized local document embedding and+ dropped the vector stream from queries that raced a document embed: the+ local embedder's capacity was hardcoded to two slots (one document, one+ query), and a query finding both busy degraded instantly to lexical+ search. The scheduler is now sized from the CPU (half the available+ parallelism, clamped to between 2 and 6 slots, documents capped at+ capacity minus one so a slot stays query-reserved), and a query waits up+ to 250 ms for a slot before degrading. On the affected LongMemEval-S+ question set this restores query latency (p50/p95 66/87 ms vs 3.2.0's+ 118/295) and ingest throughput; the reported hit@5 delta (0.947 → 0.938)+ traces to rank-boundary questions that flip between identical runs, not+ a deterministic ranking change (#1580).++ - Fixed `ai-memory run` (and `show`, `continue`, `resume`, `workstreams`,+ `rename-workstream`) failing on Windows Docker installs with "managed+ claude executable `claude` was not found in the host PATH": the PowerShell+ wrapper sent every subcommand into the Linux helper container, which has no+ host CLIs. It now intercepts the same six commands `bin/ai-memory` does and+ runs them through the native Windows client, resolved from+ `AI_MEMORY_NATIVE_BIN` or the documented+ `%LOCALAPPDATA%\Programs\ai-memory` install location, inheriting+ `AI_MEMORY_SERVER_URL` (an explicit value wins) and exiting with the+ child's code. A missing client fails with the documented installer command+ instead of entering the container; the POSIX wrapper's Git Bash refusal+ points at the same installer; and the missing-harness error's Docker+ advice is now OS-aware: on Windows it names the native-client installer+ rather than `ai-memory upgrade`, which in the `.ps1` wrapper only pulls+ the image. Managed launches keep the hook/MCP wiring rendered through the+ container (the wrapper sets `AI_MEMORY_RUN_AUTOWIRE=false` for the+ intercepted commands unless the operator set it). (#1545)++ - Corrected four statements in `SECURITY.md` that no longer matched the+ code, plus two clarifications in the same sections (#1561). The+ `AI_MEMORY_ALLOWED_HOSTS` default is `localhost`, `127.0.0.1`, and `::1`;+ request bodies are capped at 10 MB on `/mcp`, `/hook` and `/workstream/*`,+ 32 MB on `/admin/*`, and 2 MB elsewhere; the auth ladder is anonymous,+ root bearer, proxy-asserted user, and `aim_` database-user tokens (the+ server itself never validates OIDC tokens, and the doc no longer says it+ does); and the "no per-user or per-project ACLs" claim became the current+ truth about per-project access modes and grants, including that+ proxy-asserted identities are not subject to them. The bearer-check note+ now lists the routes that are public by design (`/healthz`, `/auth/login`,+ `/auth/recovery`, `/favicon.ico`, custom `/web` static assets).+ - Completed the egress inventory in `DATA_HANDLING.md` and documented the+ default first-start behavior it omitted (#1560). A default install now+ says plainly that the local embedder downloads its three model files+ (~87 MB, sha256-pinned) from `huggingface.co` in the background on first+ start, that nothing stored is sent, and how to avoid it+ (`embedding_provider = "none"` or offline pre-seeding). The export table+ gained the rows it was missing: the `llm_provider` pipeline (including+ the `codex`, `copilot` and `cursor` CLI-backed providers), the `copilot`+ embedding provider, and `[[admission_webhooks]]`, plus notes on+ `ai-memory upgrade`'s GitHub release query, the OAuth/OIDC login flows,+ and remote `server_url` topologies. `docs/airgapped-install.md`'s+ runtime summary was corrected to match.+## [3.2.0] - 2026-10-21### Addeddiff --cc crates/ai-memory-cli/src/commands/install_mcp.rsindex d5f811ed,e80b34f2..cd9e95b5--- a/crates/ai-memory-cli/src/commands/install_mcp.rs+++ b/crates/ai-memory-cli/src/commands/install_mcp.rs@@@ -164,7 -163,11 +164,14 @@@ pub(crate) fn run_with_opencode_dialect// different key already stored belongs to the hooks, the store failed, or// this is the Docker helper, whose data dir the host-side bridge cannot// open.- let bridge_carries_token = matches!(args.client, McpClient::Muse | McpClient::Qoder)+ // FreeBuff belongs here for the same reason Muse does: its entry is always+ // the session-less bridge (`build_json_mcp_entry` routes the client to+ // `stdio_bridge_entry` unconditionally), and it already gets the+ // `--data-dir` above, so the bridge reads the file the key goes into.- let bridge_carries_token = matches!(args.client, McpClient::Muse | McpClient::Freebuff)++ let bridge_carries_token = matches!(++ args.client,++ McpClient::Muse | McpClient::Freebuff | McpClient::Qoder++ )|| (args.client == McpClient::ClaudeCode && args.session_aware);let may_store_bridge_key = args.apply&& token_givendiff --cc crates/ai-memory-core/src/profile.rsindex 4c2b29aa,9ee81ff4..0b5ff755--- a/crates/ai-memory-core/src/profile.rs+++ b/crates/ai-memory-core/src/profile.rs@@@ -472,8 -474,19 +474,8 @@@ impl ProfileEntrybody: &str,frontmatter: &serde_json::Value,) -> Option<Self> {- let from_frontmatter = ["summary", "abstract"].iter().find_map(|key| {- frontmatter- .get(key)- .and_then(serde_json::Value::as_str)- .map(str::trim)- .filter(|value| !value.is_empty())- .map(str::to_owned)- });- let statement = from_frontmatter- .or_else(|| first_prose_line(body))- .or_else(|| Some(title.trim().to_owned()).filter(|t| !t.is_empty()))?;- let statement = collapse_whitespace(&statement);+ let statement = profile_statement(title, body, frontmatter)?;- let statement = truncate_bytes(&statement, ENTRY_STATEMENT_MAX_BYTES).to_owned();+ let statement = truncate_utf8_bytes(&statement, ENTRY_STATEMENT_MAX_BYTES);let applies_to = match frontmatter.get("applies_to") {Some(serde_json::Value::String(one)) => vec![one.trim().to_ascii_lowercase()],Some(serde_json::Value::Array(many)) => manydiff --cc crates/ai-memory-hooks/src/router.rsindex 238fb4c0,90da81e5..3d28be3e--- a/crates/ai-memory-hooks/src/router.rs+++ b/crates/ai-memory-hooks/src/router.rs@@@ -1774,25 -1782,20 +1788,28 @@@ async fn fetch_and_accept_handoff_atlet busy_since = now.saturating_sub(LIVE_BATON_QUIET_PERIOD).unwrap_or(jiff::Timestamp::MIN);- let handoff = state- .reader- .startup_handoff(- ws,- proj,- query.cwd.clone(),- owner_filter.clone(),- busy_since,- )- .await?;+ // `[handoff] deliver_on_session_start = false` never reads the baton, so+ // there is nothing to claim, announce or render; it stays open for a+ // project that has not opted out (or for `memory_handoff_accept`).+ let deliver_handoff = !crate::payload::query_flag_falsy(query.handoff.as_deref());+ let handoff = if deliver_handoff {+ state+ .reader+ .startup_handoff(+ ws,+ proj,+ query.cwd.clone(),+ owner_filter.clone(),+ busy_since,+ )+ .await?+ } else {+ None+ };- let handoff_md = handoff.as_ref().map(render_handoff_markdown);+ let claude_capped = agent == AgentKind::ClaudeCode;+ let handoff_md = handoff.as_ref().map(|handoff| {+ render_handoff_markdown_with_budget(handoff, claude_capped.then_some(CLAUDE_HANDOFF_CHARS))+ });// The brief is additive and non-destructive: unlike the handoff (a// single-use slot claimed below), it is recomposed on every opted-in// session start — exactly what a Claude Code `/clear` needs (#176).diff --cc docs/security-boundaries.mdindex 726c447c,c94c98df..608dfa23--- a/docs/security-boundaries.md+++ b/docs/security-boundaries.md@@@ -96,9 -97,9 +98,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; once `[auth].bearer_token_file` names `auth-tokens/default` (this install's root bearer), `commands/server.rs` `refuse_the_root_token_name` refuses `server add default` and `server remove default` so no profile can be handed, overwrite or delete the root bearer | `hook.rs` `each_repository_spools_to_its_own_profile_with_its_own_token`, `muse_hooks_honour_marker_scope_profiles_exclusions_and_allowlist` (the Meta Muse Code settings-hook front door: marker workspace/project, the profile's server and token never the install's, the payload's session id, an ignored relative `read_file` dropped with a kept control, allowlist silence from an unmarked checkout with a denylist control), `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); `server.rs` `the_root_bearer_file_name_cannot_be_registered_or_removed` (refused at the root bearer path; another name and an install without a root bearer file are the controls); `server_profiles.rs` `a_default_profile_shares_the_root_bearer_only_at_its_path`, `clear_tokens_keeps_the_root_bearer_and_removes_profile_tokens` | 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. A binary running from `/nix/store` always renders the bare command (#1275): the store path names one package version that garbage collection deletes, while the profile's `bin/` on `PATH` follows upgrades. 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` (asserts the bare command only when the test binary itself runs from the Nix store), `hook_rendered_from_a_nix_store_exe_names_the_bare_command` (the existence probe reports the store binary present, so only the store-path guard yields the bare command in the rendered exec hook) with its control `hook_rendered_from_a_normal_exe_keeps_the_absolute_path` (`/usr/bin`, `~/.nix-profile/bin`, and a non-root `.../nix/store/...` keep the absolute path); `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 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. For Hermes, `hook.rs` `hermes_terminal_cwd` replaces the reported process cwd with `TERMINAL_CWD` (read from the captured `RuntimeEnv`) only when it names an existing absolute directory and, inside a gateway (`_HERMES_GATEWAY=1`), only for an event whose `profile` is `default`, the profile whose `terminal.cwd` a multiplexing gateway exports, before the location lookup above, so that checkout's capture policy, allowlist marker and server profile govern the event | `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), **`hermes_terminal_cwd_applies_the_selected_checkout_policy`** (adversarial: with `TERMINAL_CWD` selecting a checkout, a relative read of a path it excludes is never spooled and a marker naming an unregistered server profile drops the event; public control kept; fails with the `TERMINAL_CWD` routing removed), `hermes_terminal_cwd_routes_lifecycle_events` (allowlist: a prompt is captured only through an existing absolute `TERMINAL_CWD`; unset, relative and missing values stay with the unmarked process cwd), `hermes_gateway_terminal_cwd_routes_only_the_default_profile` (a multiplexed gateway's variable does not route another profile's event), `hermes_tool_events_prefer_their_locations_then_terminal_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 |+| 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. For Hermes, `hook.rs` `hermes_terminal_cwd` replaces the reported process cwd with `TERMINAL_CWD` (read from the captured `RuntimeEnv`) only when it names an existing absolute directory and, inside a gateway (`_HERMES_GATEWAY=1`), only for an event whose `profile` is `default`, the profile whose `terminal.cwd` a multiplexing gateway exports, before the location lookup above, so that checkout's capture policy, allowlist marker and server profile govern the event. A gateway event of another profile instead goes through `hermes_profile_marker_cwd`, which accepts only a name matching Hermes' profile-id pattern (`^[a-z0-9][a-z0-9_-]{0,63}$`, so no separator or `..` reaches the path), and only when `<HERMES_HOME or ~/.hermes>/profiles/<name>` holds its own `.ai-memory.toml`; that marker's policy then governs the event the same way | `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), **`hermes_terminal_cwd_applies_the_selected_checkout_policy`** (adversarial: with `TERMINAL_CWD` selecting a checkout, a relative read of a path it excludes is never spooled and a marker naming an unregistered server profile drops the event; public control kept; fails with the `TERMINAL_CWD` routing removed), `hermes_terminal_cwd_routes_lifecycle_events` (allowlist: a prompt is captured only through an existing absolute `TERMINAL_CWD`; unset, relative and missing values stay with the unmarked process cwd), `hermes_gateway_terminal_cwd_routes_only_the_default_profile` (a multiplexed gateway's variable does not route another profile's event), **`hermes_profile_marker_cwd_refuses_a_name_that_is_not_a_profile_id`** (adversarial: `../escape`, `sc-seo/..`, `a/b`, uppercase and over-long names never become a path although a marker waits where they lead; a valid id is the control; fails with the id check removed), **`hermes_gateway_profile_marker_applies_its_capture_policy`** (adversarial: under a profile marker an excluded relative read is never spooled and an unregistered server profile drops the event; public control kept), `hermes_gateway_profile_routes_by_its_own_marker` (allowlist: a marked profile is captured into its project, an unmarked one stays with the gateway cwd and is dropped), `hermes_profile_marker_cwd_takes_only_a_marked_named_profile_in_a_gateway` (default profile, no gateway, unmarked and missing profiles do not route; a standalone gateway's own `HERMES_HOME` does), `hermes_tool_events_prefer_their_locations_then_terminal_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`, upgrade refreshes, and every `hook`/`hook-drain` invocation through the stable checksum-verified native host client, so the hook process executes the capture-policy boundary in 11b before spool/network; a hook config that calls the wrapper never runs in the helper container, and an unavailable client drops the event with exit 0 instead of falling back to it. 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. For a server initialized on the named volume, `bin/ai-memory` `refresh_volume_token` (run only by `install-hooks`) copies `/data/auth-tokens/default` (only when `/data/config.toml` names it) to an owner-only `native-runner/server-token` through the helper's stdout, and `use_volume_token` points the native client at that copy (the managed host commands and `mcp-bridge` only read it and never enter the container engine) with `AI_MEMORY_AUTH__BEARER_TOKEN_FILE`, so it is a file-sourced token (never rendered into a harness config) and never an argv; a refresh that reads no token from a reachable volume deletes the copy, and a successful full `uninstall --apply` deletes it after the container returns; a bind-mounted `AI_MEMORY_DATA_DIR` is read directly and an explicit `AI_MEMORY_AUTH_TOKEN` wins | `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. `tests/wrapper_upgrade.sh` `lifecycle hook native host routing`: `hook --event session-start` and `hook-drain` reach the fake native client with the stdin payload while `docker`/`podman` stubs on PATH and in `AI_MEMORY_DOCKER` stay unused, and a non-executable `AI_MEMORY_NATIVE_BIN` exits 0 without reaching the engine; `Checking the wrapper hands host commands the volume's root bearer`: for `mcp-bridge`, `install-hooks` and `run` the fake native client receives the token file (mode 600, right content) and the token is absent from its argv; controls: a bind-mounted data dir and an explicit `AI_MEMORY_AUTH_TOKEN` make no copy and ask no container (bite: dropping the export fails the check); `Checking the host token copy goes with the volume's token and with uninstall`: a volume answering with no token removes the copy and hands none over, while an unreachable engine keeps it; a dry-run, `--only hooks` or failing `uninstall` keeps it and a successful `uninstall --apply` removes it (bite: without either removal the check fails); `auth_default_e2e.rs` `a_host_client_given_the_token_file_by_env_authenticates` (the native side of the handoff, with a no-variable control) | 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 |+ | 11h | Docker-wrapper capture-policy capability (#1002) | `bin/ai-memory` routes ordinary Linux/macOS `install-hooks`, upgrade refreshes, and every `hook`/`hook-drain` invocation through the stable checksum-verified native host client, so the hook process executes the capture-policy boundary in 11b before spool/network; a hook config that calls the wrapper never runs in the helper container, and an unavailable client drops the event with exit 0 instead of falling back to it. 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. For a server initialized on the named volume, `bin/ai-memory` `refresh_volume_token` (run only by `install-hooks`) copies `/data/auth-tokens/default` (only when `/data/config.toml` names it) to an owner-only `native-runner/server-token` through the helper's stdout, and `use_volume_token` points the native client at that copy (the managed host commands and `mcp-bridge` only read it and never enter the container engine) with `AI_MEMORY_AUTH__BEARER_TOKEN_FILE`, so it is a file-sourced token (never rendered into a harness config) and never an argv; a refresh that reads no token from a reachable volume deletes the copy, and a successful full `uninstall --apply` deletes it after the container returns; a bind-mounted `AI_MEMORY_DATA_DIR` is read directly and an explicit `AI_MEMORY_AUTH_TOKEN` wins | `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. `tests/wrapper_upgrade.sh` global-option routing matrix: both separated and `=` forms of `--config`/`--data-dir` preserve native argv, stdin and exit status for all host commands, including hooks; a missing prefixed hook client drops the event without container fallback, while search and explicit script-compatibility controls still use the helper (bite: dispatching on `$1` fails these checks). `tests/wrapper_upgrade.sh` `lifecycle hook native host routing`: `hook --event session-start` and `hook-drain` reach the fake native client with the stdin payload while `docker`/`podman` stubs on PATH and in `AI_MEMORY_DOCKER` stay unused, and a non-executable `AI_MEMORY_NATIVE_BIN` exits 0 without reaching the engine; `Checking the wrapper hands host commands the volume's root bearer`: for `mcp-bridge`, `install-hooks` and `run` the fake native client receives the token file (mode 600, right content) and the token is absent from its argv; controls: a bind-mounted data dir and an explicit `AI_MEMORY_AUTH_TOKEN` make no copy and ask no container (bite: dropping the export fails the check); `Checking the host token copy goes with the volume's token and with uninstall`: a volume answering with no token removes the copy and hands none over, while an unreachable engine keeps it; a dry-run, `--only hooks` or failing `uninstall` keeps it and a successful `uninstall --apply` removes it (bite: without either removal the check fails); `auth_default_e2e.rs` `a_host_client_given_the_token_file_by_env_authenticates` (the native side of the handoff, with a no-variable control) | 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 (a record over the per-record cap is discarded through its newline in 64 KiB chunks that count toward the source-byte total, and moves the cursor and prefix hash only once complete, identically in both scans, #1613); `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, `an_oversized_record_is_skipped_only_once_it_is_complete`, `kimi_baseline_and_export_agree_on_the_prefix_across_a_skipped_record`, `discarding_an_oversized_record_counts_toward_the_source_byte_cap`; 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 || 11k | Server-side ingest drop list: tool id/name lists (#1241) and whole event kinds (`[ingest] drop_events`) | `ai-memory-hooks/src/drop_list.rs` `IngestDropList`: `matches` for the tool lists (a tool-call id by prefix, a tool name exactly) and `matches_event_kind` for the whole kinds (every `[ingest] drop_events` value parsed with the typed `HookEvent::parse`; `session-start`/`session-end` and the `other` bucket rejected), both validated once in `Config::load` (tool lists: at most 64 entries of 128 printable characters each). Checked in `router.rs` `admit_hook` and the `handle_hook_batch` loop after the subagent exclusion (`should_drop_subagent`) and before the rate limiter, ingest semaphore, sanitizer, and storage, so a marked subagent event seeds the tracking set its unmarked tail is dropped against even when its tool id, tool name, or event kind is listed. The tool lists match only tool events and are read through the per-agent mapping `capture_policy::tool_payload_fields` that tool metadata uses. A drop answers 202 and counts as `dropped_by_policy`; the matched value is never logged | tool lists: `router.rs` `the_ingest_drop_list_drops_before_any_capacity_is_spent`, `the_ingest_drop_list_applies_to_hook_batches`, `marked_tool_policy_drops_seed_subagent_tracking_before_single_ingress_matching`, and `marked_tool_policy_drops_seed_subagent_tracking_before_batch_matching` cover capacity, batch acknowledgements, id-prefix and exact-name seeding order, unmarked tails, and stored controls; `drop_list.rs` unit tests cover bounds, exact matching, and each agent's native fields. Whole kinds: `router.rs` `the_ingest_drop_events_drops_the_named_kind_and_keeps_the_rest`, `the_ingest_drop_events_drops_before_any_capacity_is_spent`, `the_ingest_drop_events_consumes_no_rate_budget`, `the_ingest_drop_events_batch_reports_per_index_outcomes_and_only_stores_the_kept`, `the_ingest_drop_events_keeps_dropping_the_unmarked_subagent_tail`, `the_ingest_drop_events_keeps_dropping_the_unmarked_subagent_tail_in_batches`, and `a_marked_event_of_a_dropped_kind_still_seeds_subagent_tracking`; `drop_list.rs` `drop_events_*` tests cover typed matching and rejected state/unknown kinds. Moving any matcher before subagent exclusion fails its single/batch tail tests; removing either batch matcher fails its batch contract | STRONG. The list applies to every project on the server; it narrows what is stored and never widens access || 11l | Marketplace plugin front door: a plugin-launched event gets exactly the native hook's capture policy, scope and server routing, is captured once beside settings-file hooks, and sends nothing without the binary (#1166) | `plugins/*/scripts/ai-memory-hook` (rendered from `crates/ai-memory-cli/templates/plugin/ai-memory-hook.sh` by `render_plugins.rs`) has no capture logic: it only finds the binary (an `ai_memory_bin` option is honoured only as an absolute path, so a checkout cannot plant a relative one) and runs `ai-memory hook` with `AI_MEMORY_HOOK_ORIGIN=<agent>-plugin`, `hook` first so the Docker wrapper routes it, omitting `--server-url` when the option is empty (a pre-3.0 binary's usage error, exit 2 before it reads stdin, is retried once against the default local server with a stderr hint), and without a binary drains stdin, prints `{}` (guidance on `session-start` only) and exits 0; `hook.rs` `is_dropped_plugin_copy` + `plugin_origin.rs` `drops_plugin_event` drop a plugin copy when the user `settings.json` (honouring `CLAUDE_CONFIG_DIR`) or the checkout's `.claude/settings.local.json` carries an ai-memory hook for the same event (`install_hooks::hooks_file_delivers_ai_memory_event`); a Droid-launched copy (`droid-plugin`) is checked against the one file Droid reads hooks from (`~/.factory/hooks.json`, else the `hooks` key of `~/.factory/settings.json`); a Muse-launched copy (`muse-plugin`, recognized by `MUSE_PLUGIN_ID` with `MUSE_SESSION_ID`) is checked against the `hooks` key of `${XDG_CONFIG_HOME:-~/.config}/muse/settings.json`, and its subagent events are dropped; both drop a folderless session (no `cwd`, or a Claude desktop `scratch-workspaces` cwd); Codex plugin events are never de-duplicated (an untrusted settings hook is skipped silently, so dropping could lose the event); the drift test keeps every plugin hook on the native path (no `hooks/<agent>/*.sh`, no credential in any plugin file) | CLI `tests/suite/plugins.rs` through the committed launcher and the real binary: `ignore_paths_hold_through_the_plugin` (ignored path never spooled; public-file control kept), `allowlist_mode_holds_through_the_plugin` (unmarked checkout emits nothing, prompts included; marked control captured), `marker_scope_routes_plugin_events`, `server_profiles_route_plugin_events` (profile URL and token, never the plugin's URL), `a_settings_hook_for_the_same_event_drops_the_plugin_copy` (user and project settings; unwired-event and no-settings controls), `a_droid_hook_for_the_same_event_drops_the_droid_plugin_copy` (Droid `hooks.json`; no-Droid-hook, Claude-settings-only, unwired-event and folderless controls), `a_muse_hook_for_the_same_event_drops_the_muse_plugin_copy` (Muse `settings.json`; no-Muse-hook, Claude-settings-only and unwired-event controls; subagent and folderless events dropped), `plugin_origin.rs` `muse_plugin_copy_is_dropped_when_muse_settings_hooks_deliver_the_event` (a matcher-narrowed hook does not count) and `test_plugin_launcher.sh` (an inherited `MUSE_SESSION_ID` without `MUSE_PLUGIN_ID` stays `claude-code`), `folderless_sessions_are_not_captured_through_the_plugin`, `without_a_binary_nothing_is_sent_and_the_agent_is_not_blocked`, `foreign_hosts_are_attributed_or_ignored`, `committed_plugins_match_the_renderer`, `plugin_tree_carries_no_credentials`; `plugin_origin.rs` unit tests (`codex_plugin_events_are_never_deduplicated_against_settings`, `droid_settings_hooks_count_only_while_hooks_json_is_absent`, `only_a_catch_all_matcher_suppresses_the_plugin_copy`: a settings hook narrowed by a matcher never drops the plugin copy); `hook.rs` `plugin_copy_is_dropped_only_with_the_plugin_origin`; `tests/hooks/test_plugin_launcher.sh` (a relative `ai_memory_bin` planted in the checkout is never run; PATH control); `tests/e2e/claude_plugin_smoke.py` (real `claude -p`: settings hook plus plugin give one `user-prompt`) | STRONG. Verified 2026-10-13: removing the `is_dropped_plugin_copy` guard fails the de-duplication and folderless tests (and the smoke reports `user-prompt x2`); disabling the native `Drop` disposition or the allowlist gate fails the `ignore_paths` and allowlist tests through the launcher. Not covered: tool events from a live model turn (no credential in CI), Windows Git Bash, Cowork and the desktop Code tab (see `docs/design-marketplace-plugins.md`) |