Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
docs(llm): correct the session-header description after reconciling
Lucas Oliveira00151a4e39a6
diff --git a/crates/ai-memory-llm/src/lib.rs b/crates/ai-memory-llm/src/lib.rsindex e7337a23..030a3b48 100644--- a/crates/ai-memory-llm/src/lib.rs+++ b/crates/ai-memory-llm/src/lib.rs@@ -113,7 +113,9 @@ pub use openai_oauth::{};#[allow(deprecated)]pub use opencode::OPENCODE_ZEN_BASE_URL;-pub use opencode::{OPENCODE_DEFAULT_MODEL, OPENCODE_GO_BASE_URL, OpenCodeProvider};+pub use opencode::{+ OPENCODE_DEFAULT_MODEL, OPENCODE_GO_BASE_URL, OPENCODE_SESSION_HEADER, OpenCodeProvider,+};pub use provider::{LlmProvider, complete_structured, complete_structured_with_operation_id};pub use reranker::{LlmReranker, RerankCandidate, RerankScore, Reranker};pub use stored_token::StoredOAuthToken;diff --git a/docker/.env.production.example b/docker/.env.production.exampleindex c18ffee5..e61c75dc 100644--- a/docker/.env.production.example+++ b/docker/.env.production.example@@ -59,9 +59,9 @@ LLM_API_KEY=sk-or-v1-REPLACE_ME# one must. Headers ai-memory sets itself (authorization, content-type,# x-api-key, ...) are refused at startup. Values are never logged.#-# The `opencode` provider needs nothing here: it generates an-# `x-opencode-session` per process. Set one explicitly to keep it stable-# across restarts, or to tell several instances apart.+# The `opencode` provider needs nothing here: it already sends one+# `x-opencode-session` per logical operation, stable across retries. Set one+# explicitly only to override that — e.g. to tell several instances apart.# AI_MEMORY_LLM_HEADERS=x-opencode-session=homelab-01,x-opencode-client=ai-memory# -- Embeddings (hybrid retrieval) -------------------------------------diff --git a/docs/install.md b/docs/install.mdindex 5d84215c..015d7ad7 100644--- a/docs/install.md+++ b/docs/install.md@@ -1782,10 +1782,11 @@ startup rather than duplicated onto the request. An entry for `user-agent`overrides the default. Values are never logged.The `opencode` provider needs no configuration for this: OpenCode asks-callers for `x-opencode-session`, so that provider generates one per process-unless `AI_MEMORY_LLM_HEADERS` supplies it. Set it explicitly when several-ai-memory instances should be distinguishable, or should stay stable across-restarts.+callers for `x-opencode-session`, and that provider already sends one id per+logical operation — stable across retries and the structured-output+fallback, so one consolidation pass reads as one operation in OpenCode's+metrics. Supply the header through `AI_MEMORY_LLM_HEADERS` to override that,+for instance to tell several ai-memory instances apart under one account.#### Match the consolidation budget to a local model's context window