Skip to content

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

Rust

Merge PR #1264: feat(hooks): tiered L0/L1/L2 SessionStart brief (R7)

AkitaOnRails96f043e8db8a
diff --cc CHANGELOG.md
index 91e7f059,fb6ae93a..97cb6af6
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -11,103 -11,24 +11,119 @@@ version in [`docs/changelog/`](docs/cha
## [Unreleased]
+### Added
+- 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).
+ 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)
+
### 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 Windows capture dropping the body of file and shell tool events
+ the client had kept. With `[capture] ignore_paths` active, server
+ re-inspection compiled a POSIX never-match sentinel and treated the
+ policy as invalid, so a kept Read or Bash became metadata-only. The
+ sentinel now follows the event cwd's path flavor. (#1250)
+- Fixed `GET /admin/sessions/by-agent`, and so `ai-memory doctor` and
+ `ai-memory backfill`, taking minutes on a large project (178 s for 780
+ sessions over 185k observations). Without planner statistics SQLite
+ answered each session's capture probe from the project-wide index and
+ rescanned the whole project once per session; the probe now always uses the
+ session index (0.3 s on the same store). The session list and session
+ detail reads behind `/web`, `/api/v1` and `memory_read_session_observations`
+ ran the same per-session probes and are pinned the same way. (#1257)
+- Fixed pages written by an auto-improvement approval, a batch write or a
+ checkpoint restore getting no embedding. An approval (through
+ `pending-writes approve`, the `memory_auto_improve` tool,
+ `POST /admin/auto-improve` or the scheduler), the batch writes behind
+ consolidation, the forget sweep, dream and bootstrap, and
+ `ai-memory restore-page` wrote and indexed the page but never embedded
+ it, so it stayed out of the vector stream of hybrid search until an
+ embedding backfill ran, which by default is only at the next server
+ start. These paths now embed each written page the same way
+ `memory_write_page` does. (#1258)
+
## [3.0.0] - 2026-10-13
### Added
diff --cc crates/ai-memory-hooks/src/router.rs
index 5f024f40,4bc1d8f9..9dd47f9d
--- a/crates/ai-memory-hooks/src/router.rs
+++ b/crates/ai-memory-hooks/src/router.rs
@@@ -34,10 -34,11 +34,11 @@@ use jiff::Timestamp
use serde::{Deserialize, Serialize};
use tracing::{debug, info, warn};
+ use crate::brief_tiers;
use crate::capture_policy::{
CaptureConfig, CaptureDisposition, CapturePolicy, CaptureProtocol, CaptureSource,
- ExtractionState, PolicyState, ToolFamily, metadata_only_body, tool_observation_outcome,
- valid_call_id,
+ ExtractionState, PolicyState, ToolFamily, inspection_sentinel, metadata_only_body,
+ tool_observation_outcome, valid_call_id,
};
use crate::log;
use crate::payload::{