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 Alencar4ceae2d6be9d
diff --cc CHANGELOG.md
index a118c345,58f5c056..db0aca62
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -8,19 -8,40 +8,53 @@@ and this project adheres to [Semantic V
## [Unreleased]
### Added
+ - Added page history and session replay to the read-only web UI. Each page
+ links to its history (`/web/w/<ws>/<proj>/h/<path>`): every stored version,
+ newest first, superseded ones included, so a version a concurrent write
+ replaced stays visible, with timestamps and the author of attributed writes,
+ plus a server-side unified diff between any two versions (by default the
+ latest against the version it replaced). Expired versions are hidden, and a
+ page whose TTL has passed shows no history. The same data is available as JSON
+ at `GET /api/v1/workspaces/{ws}/projects/{proj}/history/{*path}`. The version
+ list is capped at 200 per request, and the diff refuses inputs over 512 KiB,
+ 10,000 lines or 1,000 changed lines and stops at 2,000 output lines. The
+ project page lists recent sessions, and each opens a timeline
+ (`/web/w/<ws>/<proj>/s/<session-id>`) that pages through its observations in
+ capture order with first/prev/next/last links and a jump field; with
+ JavaScript, a slider and `j`/`k` keys step one observation at a time. It uses
+ the same readers, owner filter and caps as the `/api/v1` session routes, and
+ observations render as escaped text. Both views follow the per-project read
+ rule: a non-grantee of a restricted project gets a 403, and a version id or
+ session id from another project or workspace reads as not found. The
+ `ai-memory-web` crate now has a `clippy.toml` that forbids the `Wiki` write
+ and destructive methods, so a write path in the web UI or `/api/v1` fails
+ `cargo clippy -D warnings`.
+ - Added an opt-in observation stream to `memory_query` ranking:
+ `[retrieval] observation_stream = true` (env
+ `AI_MEMORY_RETRIEVAL__OBSERVATION_STREAM=true`, default off). A zero-LLM
+ session page keeps only a short excerpt of each turn, so the detail a
+ question asks about often lives only in the session's observations. With the
+ flag on, project and `scopes` searches also run full-text search over
+ observations in the same project, and each matching session votes once,
+ through its best-matching observation, for its own latest
+ `sessions/<id>.md` page as one more RRF stream. When page search did not
+ match the page itself, the matching excerpt becomes the hit's snippet, and
+ `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.
+- 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, and keeps scope
- resolution inside the current repository so it cannot consume the turn. 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)
++ resolution inside the current repository so it cannot consume the turn.
++ 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,