Skip to content

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

Rust

Merge remote-tracking branch 'upstream/release/2.7' into feat/grok-first-turn-handoff-rule

Victor Alencar5c9666a3e710
diff --cc CHANGELOG.md
index 1cbe1dd7,ebd12125..e65afddd
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -42,21 -42,17 +42,32 @@@ and this project adheres to [Semantic V
`explain=true` reports an `observation` stream with the matched observation
ids. Hits are still pages and nothing is written; sessions without a page
keep the `raw_hits` fallback, and `global=true` search is unchanged.
+ - Added a root-only `GET /admin/metrics` endpoint in Prometheus text format.
+ It exposes the hook admission and delivery counters, MCP tool calls split
+ into reads and writes, and fixed-bucket latency histograms for `POST /hook`
+ and `memory_query`. Every label comes from a fixed set: no query text, page
+ body, prompt, client or project name, scope or token appears in the output.
+ On a multi-user server only root can read it, like every `/admin/*` route.
+ - Added a `timings` object to `memory_query` responses with `explain=true`:
+ each retrieval stream's wall time in milliseconds (`fts_ms`, `entity_ms`,
+ `vector_ms`, `graph_ms`, `observation_ms`, `rerank_ms`), summed over `scopes`.
+ Streams that did not run are left out, and a query without `explain` reads
+ no clock for them.
+- Grok Build CLI first-turn handoff: `install-hooks --agent grok --apply`
+ and `install-skills --scope global --agent grok` write
+ `$GROK_HOME/rules/ai-memory-handoff.md` (default `~/.grok/rules/ai-memory-handoff.md`)
+ so the model calls `memory_handoff_list` on the first turn. Grok discards
+ SessionStart stdout, so that list is the first tool and PostToolUse still
+ claims the baton through GET `/handoff`. The rule names Grok's invocation —
+ `use_tool` with the qualified catalog key `ai-memory__memory_handoff_list` —
+ because Grok reaches MCP tools only through that meta-tool. The rule puts
+ that call ahead of any file read and corrects `workspace`/`project` from
+ `./.ai-memory.toml` only when the list comes back empty, so scope resolution
+ neither consumes the turn nor leaves the current repository.
+ Project-scope Grok skills and `--target-dir` leave the user rule alone.
+ Unmanaged same-name files are refused without `--force`; `install-hooks`
+ warns and keeps the hook file. `uninstall --only skills` and `--only hooks`
+ remove the markered rule. (#1228)
- Added the end reason to session-end observations. When a harness's
`SessionEnd` payload carries a `reason` (Claude Code sends `clear`,
`logout`, `prompt_input_exit` or `other`), its first line is stored,