Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

Merge main into release/2.1: 2.0.3 fixes (#611,#612,#613,#614) + proxy docs

AkitaOnRailsfa9f958eac62
diff --cc CHANGELOG.md
index 4a6d8b31,c6418a9a..8dc82984
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -7,48 -7,16 +7,57 @@@ and this project adheres to [Semantic V
## [Unreleased]
+### Added
+- `install-hooks --agent codex` now wires Codex's `SessionEnd` hook, so a
+ finished Codex session gets the same automatic end-of-session summary
+ and cross-agent handoff Claude Code already gets. Codex shipped a
+ first-class `SessionEnd` event in Codex CLI 0.145.0 (openai/codex#33895);
+ the `hooks/codex/session-end.{sh,ps1}` scripts already existed and only
+ needed adding to the Codex hook profile. On older Codex the event key is
+ inert; `ai-memory finalize-session --agent codex` remains the fallback.
+ `merge_codex_payload` no longer strips a `SessionEnd` key on every apply
+ — a third-party `SessionEnd` hook is preserved alongside ours. ([#604])
+- `AI_MEMORY_LLM_HEADERS` (`llm_headers` in `config.toml`) attaches extra
+ HTTP headers to every LLM chat request, for gateways that require a
+ caller-identifying header. Entries are `Name=Value` or `Name: Value`,
+ comma separated in the env var. Parsed and validated once at the
+ configuration boundary, so a malformed entry fails at startup rather than
+ on the first consolidation pass, and providers consume typed header
+ material instead of operator strings. Headers ai-memory sets itself
+ (`authorization`, `content-type`, `x-api-key`, `x-goog-api-key`,
+ `anthropic-version`, `anthropic-beta`, `openai-beta`, `host`,
+ `content-length`) are refused: `reqwest` appends rather than replaces, so a
+ duplicate would break the request instead of overriding it. Values are
+ marked sensitive on the wire and never logged — the `Debug` output carries
+ header names only. ([#606])
+
+### Changed
+- Every LLM chat request now sends `User-Agent: ai-memory/<version>`.
+ `reqwest` sends no user agent unless one is configured, so provider
+ requests previously arrived anonymous, and gateways that require callers to
+ identify themselves reported ai-memory as an unknown client. An
+ `AI_MEMORY_LLM_HEADERS` entry for `user-agent` overrides it. The Copilot
+ provider is unchanged: it keeps `GitHubCopilotChat/<version>`, the
+ editor-plugin agent GitHub's Copilot API expects. ([#606])
+- `x-opencode-session` and the `opencode` user agent, both shipped in 2.0.2,
+ are now operator-overridable like any other header: an
+ `AI_MEMORY_LLM_HEADERS` entry for either name takes precedence over the
+ provider's default. The default remains 2.0.2's — one `LlmOperationId` per
+ logical operation, stable across retries and the strict/tolerant fallback —
+ so nothing changes unless an operator asks for it. Override the session
+ header to tell several ai-memory instances apart in OpenCode's metrics.
+ ([#606])
+
### Fixed
+ - `bootstrap` no longer aborts the whole multi-chunk run when one chunk
+ returns no `pages` key (#614). Later chunks are told which paths
+ earlier ones wrote, so a model that judges the material already
+ covered legitimately answers with a rationale and no pages; because
+ Anthropic's `tool_use` schema does not enforce required fields the way
+ OpenAI's `strict: true` does, that answer reached serde and failed
+ deserialisation with `missing field 'pages'`. Since pages are only
+ written after every chunk completes, the error discarded the work of
+ all preceding chunks. `pages` now defaults to empty.
- `install-hooks --agent antigravity-cli` on native Windows now emits
an unquoted hook `command` (#611). The native-binary rendering wrapped
the executable, `--data-dir`, and `--server-url` in double quotes, but
@@@ -57,18 -25,20 +66,32 @@@
recognized", every hook failed, and the cp850 (non-UTF-8) error text
aborted the whole `agy` session. Antigravity's command is now rendered
bare; other Windows agents keep their quotes.
+- `AI_MEMORY_LLM_BASE_URL` now works with `AI_MEMORY_LLM_PROVIDER=opencode`.
+ The provider hardcoded OpenCode's **Go** endpoint and the factory dropped
+ the configured base URL without a word, so Zen's general catalogue at
+ `https://opencode.ai/zen/v1` was unreachable through it — Zen and Go are
+ separate products, not two spellings of one. Go remains the default, so
+ existing setups are unaffected; an override keeps the `x-opencode-session`
+ default and the user agent, since both endpoints correlate requests the
+ same way. Model ids are per catalogue, so set `AI_MEMORY_LLM_MODEL`
+ explicitly when overriding. `OPENCODE_ZEN_BASE_URL` is deprecated in
+ favour of `OPENCODE_GO_BASE_URL`: the constant named Zen but has always
+ held Go's URL. It keeps its value, so code compiled against it is
+ unaffected. ([#606])
+ - The wiki watcher no longer logs a scope-resolution failure for every page
+ in a project directory the store has no row for, on every pass, forever
+ (#613). The OKF v0.2 migration seeded an `index.md` into orphan directories
+ (dirs with a valid-UUID name but no `projects` row — near-empty shells left
+ by older history), and the watcher then warned once per file per 30s
+ reconciliation pass indefinitely — hundreds of identical lines that buried
+ real warnings, including, on one host, a 22-hour `sqlite: disk I/O error`.
+ Reconcile now checks the project scope once per directory and skips an
+ unresolvable one wholesale at `debug`, rather than retrying its pages; if
+ the row later appears the directory indexes normally on the next pass.
+ - The store error for an unknown project id now says "does not exist" instead
+ of "does not belong to workspace X" (#612). A dangling id names no
+ workspace mismatch to hunt for; the disambiguating lookup runs only on the
+ failure path, so the common case still pays a single query.
## [2.0.2] - 2026-09-03