Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
feat: default the Cursor provider to Grok 4.6
José Fernando Gomes Marcial1871f900bbd7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 434bd16b..e80c8ae0 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,8 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Added- Added the `cursor` LLM provider. Consolidation calls the logged-in CursorAgent CLI (`agent --print --mode ask`) so a Cursor subscription can drive- summaries without an API key. The default model is `composer-2.5-fast`;- `AI_MEMORY_CURSOR_AGENT` overrides the binary. The provider never passes+ summaries without an API key. The default model is `cursor-grok-4.6-high`+ ("Grok 4.6"). `AI_MEMORY_CURSOR_AGENT` overrides the binary. The provider never passes`--yolo` or `--force`, because the prompt is captured session text.diff --git a/crates/ai-memory-llm/src/cursor_agent.rs b/crates/ai-memory-llm/src/cursor_agent.rsindex 52841e2d..2e9be51d 100644--- a/crates/ai-memory-llm/src/cursor_agent.rs+++ b/crates/ai-memory-llm/src/cursor_agent.rs@@ -22,8 +22,9 @@ use crate::types::{ChatRequest, ChatResponse, Role};/// Model used when `AI_MEMORY_LLM_MODEL` is unset.///-/// Fast Cursor model. Override with any id `agent --list-models` prints.-pub const CURSOR_DEFAULT_MODEL: &str = "composer-2.5-fast";+/// `agent --list-models` labels this id "Grok 4.6". Override with any other id+/// from that list.+pub const CURSOR_DEFAULT_MODEL: &str = "cursor-grok-4.6-high";const MAX_STDOUT_BYTES: usize = 1024 * 1024;const MAX_STDERR_BYTES: usize = 64 * 1024;diff --git a/docs/install.md b/docs/install.mdindex 240d68f0..cd1f76dd 100644--- a/docs/install.md+++ b/docs/install.md@@ -1908,7 +1908,7 @@ If you set only the provider, ai-memory picks a sensible default:| `AI_MEMORY_LLM_PROVIDER=openai-oauth` | `gpt-5.5` | ChatGPT/Codex backend. Run `ai-memory auth login openai-oauth` once; ai-memory stores the refresh token in `<data_dir>/auth.json` and refreshes access tokens automatically. Optional `AI_MEMORY_LLM_REASONING_EFFORT` (`none`/`minimal`/`low`/`medium`/`high`/`xhigh`/`max`/`ultra`/`persistent`) is mapped to each provider's native reasoning field; omit it to keep the model default. || `AI_MEMORY_LLM_PROVIDER=codex` | `gpt-5.6-luna` | Reuses only `access_token` and `account_id` from Codex's `auth.json`; token renewal is delegated to `codex app-server --stdio`. || `AI_MEMORY_LLM_PROVIDER=copilot` | `gpt-5.5` | GitHub Copilot Chat backend. ai-memory stores a GitHub user token in `<data_dir>/auth.json`, exchanges it for a short-lived Copilot API token, and refreshes before expiry. |-| `AI_MEMORY_LLM_PROVIDER=cursor` | `composer-2.5-fast` | Cursor subscription via `agent --print --mode ask --trust`. No API key and no `--yolo`. Override the binary with `AI_MEMORY_CURSOR_AGENT`. Any id from `agent --list-models` works as `AI_MEMORY_LLM_MODEL`. |+| `AI_MEMORY_LLM_PROVIDER=cursor` | `cursor-grok-4.6-high` | Cursor subscription via `agent --print --mode ask --trust`. No API key and no `--yolo`. This id is "Grok 4.6" in `agent --list-models`. Override the binary with `AI_MEMORY_CURSOR_AGENT`. Any other id from that list works as `AI_MEMORY_LLM_MODEL`. || `AI_MEMORY_LLM_PROVIDER=gemini` | `gemini-3.5-flash` | Google's hosted option with a generous free tier. ai-memory disables Gemini 3.5 Flash's default dynamic thinking so hidden thought tokens do not truncate strict JSON. Set `GEMINI_API_KEY` (or `GOOGLE_API_KEY`). || `AI_MEMORY_LLM_PROVIDER=opencode` | `mimo-v2.6-flash` | [OpenCode](https://opencode.ai) cloud API. Defaults to the **Go** endpoint, `opencode.ai/zen/go/v1` — a cost-optimised model subset. Published Responses models, including GPT-5.6 Luna and GPT-6 Luna, use `/responses`; supported Claude and Qwen Messages models use `/messages`. MiniMax M3/M2.7 and Qwen3.8 Max use Messages on Go and Chat Completions on Zen; Go Muse Contributor models use Responses. Changing the base URL reselects the transport and preserves request settings. See the [Go](https://opencode.ai/docs/go/#endpoints) and [Zen](https://opencode.ai/docs/zen/#endpoints) endpoint tables. For **Zen**'s full catalogue, set `AI_MEMORY_LLM_BASE_URL=https://opencode.ai/zen/v1` plus an `AI_MEMORY_LLM_MODEL` from it, such as `claude-sonnet-5-5`; the default model id is Go's. Requests identify ai-memory by version and reuse one session header across related attempts. Both endpoints take `OPENCODE_API_KEY` (key from `opencode.ai/auth`). Alias: `opencode-zen` — historical, and it selects Go like the others; the endpoint is chosen by the base URL, not the alias, with no automatic billing-product switch. || `AI_MEMORY_EMBEDDING_PROVIDER=openai` | `text-embedding-3-small` (1536-dim) | 5× cheaper than `-3-large` with marginal recall loss. |diff --git a/docs/llm-providers.md b/docs/llm-providers.mdindex b1255932..7f01c3df 100644--- a/docs/llm-providers.md+++ b/docs/llm-providers.md@@ -47,7 +47,7 @@ Recommended defaults:| `openai` | `gpt-5.4-mini` | Cheaper and faster hosted option. || `openai-oauth` | `gpt-5.5` | ChatGPT Pro/Plus/Codex backend via `ai-memory auth login openai-oauth`; no Platform API key. || `codex` | `gpt-5.6-luna` | Reuse the Codex CLI-owned `auth.json`; access-token refresh remains owned by `codex app-server`. |-| `cursor` | `composer-2.5-fast` | Cursor subscription via the logged-in `agent` CLI. Runs `agent --print --mode ask` (read-only). Does not pass `--yolo`. |+| `cursor` | `cursor-grok-4.6-high` | Cursor subscription via the logged-in `agent` CLI. Runs `agent --print --mode ask` (read-only). Does not pass `--yolo`. The default id is the one `agent --list-models` labels "Grok 4.6". || `copilot` | `gpt-5.5` | GitHub Copilot Chat backend via `ai-memory auth login copilot` or `COPILOT_GITHUB_TOKEN`; requires a Copilot subscription. || `gemini` | `gemini-3.5-flash` | Google-hosted option with a generous free tier. || `opencode` | `mimo-v2.6-flash` | OpenCode Go or Zen via `OPENCODE_API_KEY`. Go is the default endpoint; `AI_MEMORY_LLM_BASE_URL` selects Zen. Set `AI_MEMORY_LLM_MODEL` to an id the chosen endpoint serves. |@@ -77,17 +77,17 @@ ai-memory llm-test --provider codex --model gpt-5.6-luna --structured --prompt "````cursor` uses the Cursor Agent already logged in on this machine. Set-`AI_MEMORY_LLM_PROVIDER=cursor`. The default model is `composer-2.5-fast`;-any id from `agent --list-models` works. `AI_MEMORY_CURSOR_AGENT` overrides-the binary. The provider writes the prompt into a temporary workspace and-calls `agent --print --mode ask --trust`. It does not pass `--yolo` or-`--force`: consolidation text is untrusted captured content, and those flags-would allow tool execution.+`AI_MEMORY_LLM_PROVIDER=cursor`. The default model is `cursor-grok-4.6-high`+("Grok 4.6" in `agent --list-models`); any other id from that list works.+`AI_MEMORY_CURSOR_AGENT` overrides the binary. The provider writes the prompt+into a temporary workspace and calls `agent --print --mode ask --trust`. It+does not pass `--yolo` or `--force`: consolidation text is untrusted captured+content, and those flags would allow tool execution.```bashexport AI_MEMORY_LLM_PROVIDER=cursor-export AI_MEMORY_LLM_MODEL=composer-2.5-fast-ai-memory llm-test --provider cursor --model composer-2.5-fast --prompt "Reply with OK"+export AI_MEMORY_LLM_MODEL=cursor-grok-4.6-high+ai-memory llm-test --provider cursor --model cursor-grok-4.6-high --prompt "Reply with OK"```Codex credential storage mode `file` is supported. `auto` works only when its