Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
Merge remote-tracking branch 'refs/remotes/audit-open/1587'
AkitaOnRailse393576b9fb2
diff --cc CHANGELOG.mdindex 6d957f4c,e4201cc1..8d14761d--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -11,192 -11,10 +11,196 @@@ version in [`docs/changelog/`](docs/cha## [Unreleased]+## [3.2.1] - 2026-10-22++### Fixed++- 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 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.++### 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))++### Fixed+- 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 `\\?\`+ 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))++### Fixed++- 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))++### Fixed++- 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))++ ### Fixed++ - Corrected the multi-user migration command to pass the pepper length with `--bytes`. ([#1587](https://github.com/akitaonrails/ai-memory/pull/1587))+## [3.2.0] - 2026-10-21### Added