Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
Merge branch 'pr-859' into release/2.5
AkitaOnRails7552d4fd390c
diff --cc CHANGELOG.mdindex 7d5a24d6,e212099c..2cb16039--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -8,84 -8,33 +8,109 @@@ and this project adheres to [Semantic V## [Unreleased]### Added+- Fedora users can install prebuilt x86_64 and aarch64 RPMs from GitHub+ Releases, with the existing native systemd service assets. (#858)+ - `embedding_query_prefix` / `embedding_document_prefix` config keys (env:+ `AI_MEMORY_EMBEDDING_QUERY_PREFIX` / `AI_MEMORY_EMBEDDING_DOCUMENT_PREFIX`)+ for the `openai` and `openai-compat` embedders: an optional string+ prepended to query / document text before the existing truncation, so+ truncation still bounds the whole input. Asymmetric embedding models need+ a query-side instruction their publisher specifies; the OpenAI-compatible+ `/v1/embeddings` wire format has no field for it.+ `nvidia/Nemotron-3-Embed-1B-BF16` and base E5 models use a simple+ `"query: "` / `"passage: "` pair; instruction-tuned E5 variants and+ Qwen3-Embedding instead need a task-instruction string on the query side+ only (documents stay plain). Empty by default — no behaviour change when+ unset, and not trimmed (nor is a present-but-empty env-var override, which+ now clears a `config.toml` value), so a publisher's trailing space is+ preserved. A non-empty `embedding_document_prefix` is folded into the+ stored embedding identity (`Embedder::model_identity`), so a document+ prefix change makes retrieval, backfill, and cleanup treat existing pages+ as stale and re-embed them automatically — an empty prefix keeps the+ pre-existing identity, so upgrading installs need no migration, and a+ query-only prefix change never needs a rebuild. See- `docs/llm-providers.md`.++ `docs/llm-providers.md`. (#859)+- `auto_improve.patchable_page_prefixes` makes the folders whose page bodies the+ reviewer reads configurable, defaulting to the historical `_rules/` and+ `procedures/`. Only those two folders' contents were ever sent; every other+ page reached the model as a single title line, so a project keeping its+ durable knowledge in `decisions/` or `gotchas/` — with no `_rules/` pages at+ all — sent no page bodies, and the reviewer re-proposed invariants that were+ already written down, at high confidence, indefinitely. Existing configs are+ unchanged. (#834)+- `ai-memory finalize-session --reopen --session-id <uuid>` re-finalizes a+ session that already ended, for agents without a true session-end event+ (Antigravity CLI, Kiro, ZCode, Pool) whose conversation continued after a+ first manual finalize: the discovery step now accepts `include_ended=true`+ on `GET /admin/open-sessions` for an exact session id (rejected without+ one, so reopening stays exact-id-only and never a bulk operation), and the+ server's normal session-end path re-runs over the new observations+ (updated summary page via supersession, new handoff, opt-in+ consolidation). Re-running with nothing new since the first end remains a+ harmless no-op. The default finalize behavior is unchanged: ended sessions+ stay invisible unless `--reopen` is passed. (#836)+- Added per-execution `AI_MEMORY_CAPTURE_OWNER` context for external lifecycle+ producers. Updated native hooks, script bundles and generated integrations+ suppress capture while preserving supported handoff delivery and MCP recall.+ Documented producer provenance and stable retries through the existing hook+ ingestion API, without changing its schema or standalone defaults. (#821)+- Builtin `/web` login and change-password pages for human password sessions:+ unauthenticated browser GETs to the wiki redirect to `{web_slug}/login`+ (not bare JSON 401), forms call existing `POST /auth/login` /+ `/auth/password` / `/auth/logout`, and `--web-ui-dir` custom SPAs stay+ unchanged. (#811)++### Changed+- Grok Build CLI shows a pending handoff, and an opted-in `[briefing]`, as+ `PostToolUse` `additionalContext` on the first tool of a session.+ `SessionStart` and `UserPromptSubmit` still do not accept the handoff (Grok+ discards that stdout); a session that never calls a tool leaves the handoff+ open for `memory_handoff_accept`. The note is clipped to 10,000 characters+ (Grok's own cap). Because Grok reuses one session id across a+ SessionEnd→restart, `memory_handoff_accept` now reopens an already-ended+ receiver session (clears `ended_at`) instead of rejecting it — but only for+ agents that reuse their session id across a restart (Grok); for every other+ agent an ended session stays final, so a lifecycle-only receiver still cannot+ reclaim after it released and ended. The reopen also only happens after the+ exactly-once claim guard, so a session that already took a baton still cannot+ take another (the multi-session claim-once invariant is preserved).+ Delivery of this PostToolUse handoff is exempt from `AI_MEMORY_CAPTURE_OWNER`+ capture suppression, like the other context-delivery events. (#840)### Fixed+ - `memory_query`'s vector stream called the generic `Embedder::embed`+ instead of `embed_query` on the configured embedder, so a+ query/document-asymmetric embedder (Google's task-typed embeddings, or+ the new query/document prefixes above) embedded the search query on the- document side instead of the query side.++ document side instead of the query side. (#859)+- Auto-improve review no longer stages a proposal whose LLM-produced page+ path contains a Windows-illegal character (e.g. a `:` copied from a+ conventional-commit subject). That path passed the deliberately tolerant+ `PagePath::new` and only failed later at `ensure_portable` when the+ proposal was approved, so the learning loop queued work that could not+ be applied. Paths are now sanitized the same way bootstrap (#847) and+ per-session consolidation (#848) already sanitize theirs, before+ validation; a path that is still unportable after sanitizing is rejected+ instead of staged. (#850)+- Omitted `temperature` for `gpt-6-*` models in the `codex`,+ `openai-oauth`, `copilot` and `openai` providers. Codex answered GPT-6+ requests that carried `temperature` with `400 Unsupported parameter:+ temperature`, which broke consolidation, lint and bootstrap on a+ provider or fallback configured with `gpt-6-luna`, `gpt-6-sol` or+ `gpt-6-astra`. The `openai` provider now also sends+ `max_completion_tokens` for GPT-6 and no longer applies its local+ 16,384-token cap to it, matching `gpt-5*`. (#851)+- `memory_message_pop` and `memory_message_list` no longer return a silent+ empty result when the inbox scope was *inferred* rather than named. A caller+ with no explicit `workspace`/`project` and no forwarded hook-session id+ resolves the shared active-project slot (whichever project published last),+ so two same-operator agents can have a no-scope pop land on a different inbox+ than the on-start notice / `memory_briefing` counted — "you have mail"+ followed by an empty fetch, with no way to tell it was the wrong inbox. An+ empty read from an inferred scope now reports the `resolved_scope`+ (workspace + project), the `scope_source`, and a hint to re-run with explicit+ scope; an explicitly-scoped or session-bound empty read is unchanged. No+ message is lost — the mis-scoped pop consumes nothing. (#854)- `companions/ai-memory-macos/build.sh` no longer fails on machines whoseactive developer directory is Command Line Tools only: SwiftUI `@State`needs the `SwiftUIMacros` plugin shipped with full Xcode, so the script