Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
Merge upstream/main (v2.0.2): keep this branch's entries unreleased
Lucas Oliveirac6c21b404e70
diff --cc CHANGELOG.mdindex 42941be5,ad6f9057..2a0619c6--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -7,38 -7,26 +7,70 @@@ and this project adheres to [Semantic V## [Unreleased]+### Added+- `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.++### 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.+- `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.++### Fixed++- `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.+++ ## [2.0.2] - 2026-09-03### Fixed+ - Web UI: OKF bundle-index links (and any relative in-wiki link) no+ longer 404 (#603). Relative markdown link targets are now rewritten to+ project-scoped URLs — the same convention `[[wikilinks]]` use — instead+ of resolving against the web mount's `<base href>`, and a namespace+ (directory) path such as `.../p/_lint/` now lists the pages under it+ rather than returning 404. External links, anchors, and dangerous+ schemes are untouched by the rewrite.+ - Pages with an empty frontmatter `title` no longer read back titleless+ or trip a bogus duplicate-title lint (#599). Auto-improve could store+ `title: ""` while the page had a proper `# H1`; now `memory_read_page`+ derives the title from the H1 (then the path stem) when the stored one+ is blank, the duplicate-title lint ignores blank titles instead of+ collapsing them into one `Multiple pages share title ""` finding, and+ the consolidator derives a title from the body H1 at write time so new+ pages never store an empty one. The DB `title` column (search) was+ already correct; this aligns the frontmatter-title readers with it+ without rewriting stored pages.- Local-embedding model download (`fetch_model`) now bounds a stalledconnection instead of hanging startup forever (#602): a 30s connecttimeout and a generous 600s overall ceiling (large model files, so