Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
Merge PR #1307: feat(mcp): add memory_restore_page to list a page's checkpoints and restore one
AkitaOnRails27154fad5c4e
diff --cc CHANGELOG.mdindex 3aa4bb3a,aca28bd7..a888fa69--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -12,114 -12,11 +12,120 @@@ version in [`docs/changelog/`](docs/cha## [Unreleased]### Added+- Added opt-in session inspection and owned-session purging for signed-in+ browser users, enabled at runtime with `serve --enable-session-management`+ (`AI_MEMORY_ENABLE_SESSION_MANAGEMENT`). A user can purge only a session they+ own in a project they may write; an Admin can purge any. Requested in #1231.+ (#1267)+- Added opt-in self-service `aim_` API keys for signed-in browser users,+ enabled at runtime with `serve --enable-self-service-keys`+ (`AI_MEMORY_ENABLE_SELF_SERVICE_KEYS`). Labels must be 1 to 128 characters+ and a user may hold at most 20 active keys. A self-issued key survives a+ password reset or account disable and must be revoked separately. Requested+ in #1231. (#1268)+- Added `ai-memory search --global`, which searches the wiki pages of every+ project from the terminal instead of only the current one. Each hit shows+ its `workspace/project` in the text output and carries `workspace` and+ `project` fields in `--json`. The flag cannot be combined with+ `--workspace` or `--project`, and a search without it still resolves its+ scope from the current directory. The server side is `GET /admin/search`+ with no `workspace`/`project`: its hits now include `workspace` and+ `project` next to the fields they already had, and the route stays+ root-only on a multi-user server. Global search covers wiki pages only;+ raw observations and a search limited to one workspace are not part of+ this change. (#1253)+- Added kind and tier filters to the web search. The search page in `/web`+ has "Kind" and "Tier" selects, and `/web/search` accepts `kind` and `tier`+ for both a project search and a cross-project one. Every retrieval stream+ applies the filter in its own query, so other kinds cannot crowd out a rare+ one, a filtered search asks the streams for no more candidates than an+ unfiltered one, and the reranker scores only pages the filter keeps. Kind+ and tier both ignore case, a nonstandard kind is flagged on an empty+ result, and "Search all projects" keeps the filters. An unknown `tier` is+ a 400. (#1248)+- Added `ai-memory setup --plan`, which prints the plan and changes nothing,+ and `--plan --json`, which prints it as a JSON document with a `format`+ version for a script or front end to render. The plan now says what each+ detected agent was found by (its session store, its MCP config, or Muse's+ directory), numbers the agents, and lists the other agents `--agent`+ accepts. At the prompt you can type the numbers of the agents to wire+ instead of `y`; a number outside the plan changes nothing. (#1270)+- Added a native Windows path to the two-command install. `install.ps1`,+ published with each release next to its own `.sha256`, checks the release+ zip against that checksum, refuses archive entries that are absolute or+ hold `..`, unpacks it under `%LOCALAPPDATA%\Programs\ai-memory` and adds+ that directory to the user `PATH` (`AI_MEMORY_NO_MODIFY_PATH=1` skips it),+ with no administrator rights. `ai-memory setup` now has a service step on+ Windows: it writes an `ai-memory` value under the per-user `Run` key that+ starts a hidden `ai-memory service-host` at logon, and starts it right away.+ The value is written and read through the registry API, not by running+ `reg.exe`: an unsigned binary running `reg.exe add` on the `Run` key is a+ common persistence signal, and Bitdefender's behavioral engine quarantined+ `ai-memory.exe` for it (#1280). Its paths are written plainly, without the+ `\\?\` prefix a canonical path carries.+ The host runs the server with no console window and restarts it after a+ failure, giving up after five failures within ten seconds of starting.+ `ai-memory uninstall --apply` stops the host and removes the value when it+ still has the shape `setup` writes and names this install's data dir, so an+ uninstall against another data dir (a second install, a test's temporary+ one) leaves the entry alone. (#1271, #1280)+- Added `ai-memory setup --web`, which shows the setup plan as a page in+ your browser and applies the agents you tick there by running `ai-memory+ setup --yes --agent ...` and streaming its output to the page. The page is+ served on `127.0.0.1` behind a one-time address printed in the terminal+ (opened in the browser unless `--no-open` or there is no desktop), refuses+ requests with another `Host`, without the address's secret, or, for a+ change, without the page's own `Origin` and CSRF token, and holds no token.+ It stops on Finish, after 15 minutes without a request, or on Ctrl-C. (#1272)+- Added a desktop installer preview, `companions/ai-memory-desktop`: a Tauri+ app that uses an existing `ai-memory` install or copies its bundled one into+ the same per-user location as `install.sh` and `install.ps1`, then shows the+ `ai-memory setup --web` page in its own window. CI builds unsigned Linux,+ macOS and Windows installers on manual dispatch; they are not attached to+ releases until the project signs them. `setup --web` gained a hidden+ `--stop-on-stdin-eof` flag so the page stops when the app does. (#1273)+- A prompt that starts with `reload context` (for example `reload context+ after last compaction, then …`) now puts the stretch of the session that+ its last compaction dropped back in front of the agent: the prompts typed+ between the latest two compactions, verbatim; the last captured reply (with+ the assistant-capture opt-in); and the project's open handoffs, listed+ without claiming them. The new read-only `GET /recap` route builds it from+ captured observations. Claude Code and Codex receive it with that prompt+ through `UserPromptSubmit` `additionalContext`, OpenCode V1/V2 through the+ plugin's system/context hook, and Grok Build on the next `PostToolUse`.+ Serving the recap writes nothing, so a reload never consumes a baton (#1230).+ - Added the `memory_restore_page` MCP tool: without `rev` it lists the git+ checkpoints that changed a page, and with `rev` it writes that version back- through `memory_write_page` (sanitizer, admission, slots and supersession- apply), so an agent can undo a change or bring back a deleted page without- root access to `/admin/restore-page`. The MCP surface is now 24 tools.++ through the wiki write path (sanitizer, admission, slots and supersession++ apply), keeping the checkpoint's frontmatter. Restoring can bring back text++ a root deleted or purged, so both listing and restoring need the same admin++ authority as `/admin/restore-page`. The MCP surface is now 24 tools. (#1307)++### Changed+- `ai-memory setup` now ends by naming the agents to restart and the question+ to ask one of them, "What do you remember about this project?", instead of+ a generic restart line. `install.sh` names the link's full path in its+ `next:` line when `~/.local/bin` is not on `PATH`, so the suggested command+ no longer fails with "command not found". The AUR install and upgrade+ messages, and the README Fedora, Arch and macOS app steps, point to+ `ai-memory setup` instead of the manual `init`, `systemctl` and+ `install-*` commands. (#1270)+- Changed how the opt-in session-start brief (`[briefing]+ inject_on_session_start`) spends `max_chars`. Every pinned, `_rules/` and+ `_slots/` page now gets a short excerpt first, taken from its frontmatter+ `abstract:` or `summary:`, or else from the prose it opens with (read on+ into its first list items). The budget left deepens pages to a longer+ excerpt and then the whole body: pinned and `_slots/` pages first, then+ pages a few bytes short of whole, then the cheapest bodies. Before, the+ brief printed whole bodies in order, so one long `_rules/` page was cut with+ a `[truncated by ...]` note and every page after it became an "omitted"+ path. Bodies are no longer cut: a body that does not fit whole shows its+ excerpt. Four or more unpinned excerpts from one folder share a heading,+ and the omitted list and the closing note point at `memory_read_page`.+ Small wikis whose pages fit still get every body whole. A project with many+ standing pages now sees all of them, fewer in full: pin a page, or give it+ an `abstract:`, to control what it shows. The change adds no marker key+ and no migration. (#1264)### Fixed- Fixed the thin-client commands ignoring a custom `bind`, which could write