Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
Merge remote-tracking branch 'pr/1005' into resolution/release-2.6
AkitaOnRails9c64199d92a3
diff --cc CHANGELOG.mdindex 7e913dcd,4efa7b4a..eeb1a88d--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -8,47 -8,16 +8,52 @@@ and this project adheres to [Semantic V## [Unreleased]### Added-- `ai-memory doctor` now reports Claude Code's native `memory/` store for- the current checkout (location, file count, and whether the nearest- marker's `ignore_paths` would exclude a read of it), so an operator can- see whether the harness's own auto-memory is being captured without- reading it themselves (harness-issue #1003). Resolved by repository root,- so a worktree or a subdirectory reports the same store as the main- checkout. Shell/PowerShell hook installs (the Docker-wrapper default) do- not enforce this exclusion at all; the report says so.++- Added `ai-memory doctor` reporting for Claude Code's default native++ `memory/` store for the current repository: location, file count, and whether++ the nearest marker's `ignore_paths` would exclude a read. Repository-root++ resolution keeps worktrees and subdirectories on the same report, and the++ output warns that shell/PowerShell compatibility hooks do not enforce the++ exclusion. (#1003)+- Added per-event outcomes to `/hook/batch` acknowledgements and process-lifetime+ ingest counters for stored events, replays, recovery, ignored endings,+ collisions and failures. Legacy acknowledgement fields were preserved. (#1015)+- Added receipt outcomes and delivery counts to the companion relay. Opening a+ schema 1 queue now upgrades it atomically to schema 2; older relay binaries+ refuse schema 2, so downgrade requires a pre-upgrade backup with all queue+ users stopped. Pending order and existing delivery metadata were preserved.+ Receipts now retain their first known outcome. (#1015)+- Added `ai-memory list-projects [--workspace] [--json]`: a plain, scriptable+ listing of every workspace/project pair the server knows about, sorted by+ workspace then project. Previously the only way to see this from outside+ an interactive `show` session was to call `GET /api/v1/projects` directly.+ (#1022)+- Added scope and policy preflight to `ai-memory hook --check-capture`, including+ event eligibility, sanitized routing hints and server-remapping information.+ Partial scope, excluded events, rejected profiles and oversized hints refuse+ capture. Inspection neither ingests events nor claims handoffs. (#1019)+- Added the latest scoped consolidation job's state and attempt count to HTTP+ session summaries and MCP `memory_read_session_observations`. The field is+ `null` when no job exists; provider errors remain private and existing session+ ownership filters are preserved. (#1018)+- Added incremental paging to scoped HTTP `recent` reads with `updated_since`+ and an opaque, scope-bound cursor. Queries preserve equal-time ordering,+ exclude expired and superseded pages and recheck authorization on each+ request. Calls without incremental arguments retain their existing array+ response. Added a generic MCP/HTTP integration guide. (#1017)+- Added machine-authenticated `GET /identity`, available with the web UI+ disabled, and `ai-memory doctor` diagnostics for caller identity, external+ capture ownership and sessions with multiple capture sources (native events+ or distinct extensions, including backfill).+ Mixed-source counts preserve scope, session ownership and time-window filters;+ older servers leave unsupported fields unknown. (#1016)+### Changed+- Documented FutureInfra as an endpoint for the existing `openai-compat`+ provider. (#1026)-### Fixed+- Fixed completed retries and no-op session endings advancing+ `last_persisted_ms` without a durable write. Recovery still advances the+ timestamp when it commits a new page or terminal effect. (#1015)- `ai-memory doctor` now warns when the nearest `.ai-memory.toml`'s`[capture]` section is invalid. This fails closed today — every file andshell tool event is reduced to metadata until the marker is fixed, nothingdiff --cc crates/ai-memory-cli/src/commands/doctor.rsindex 103f289a,627aa13e..cd5e2fe3--- a/crates/ai-memory-cli/src/commands/doctor.rs+++ b/crates/ai-memory-cli/src/commands/doctor.rs@@@ -144,8 -125,11 +147,13 @@@ struct DoctorReport/// with no other signal anywhere that the marker stopped working as/// configured, so `doctor` is the one place that surfaces it.marker_capture_problem: Option<MarkerCaptureProblem>,+ capture_owner_active: bool,+ identity: Option<OperatorIdentity>,+ /// Native "memory" stores found for harnesses that keep one, and whether+ /// the nearest marker would exclude a read of them (harness-issue+ /// #1003). Only Claude Code's location is known today; harnesses with no+ /// established convention are simply absent from this list.+ native_memory: Vec<NativeMemoryReport>,}#[derive(Debug, Clone, Serialize)]@@@ -352,8 -419,7 +452,9 @@@ pub async fn run(config: &Config, argsrows,uncaptured,marker_capture_problem,+ capture_owner_active: config.runtime_env.capture_owner_active(),+ identity,+ native_memory,};if args.json {@@@ -401,6 -451,15 +502,15 @@@ fn render_human(report: &DoctorReport));}+ if !report.native_memory.is_empty() {+ println!(+ "Note: a shell/PowerShell hook install (the Docker-wrapper default) does not \+ enforce capture-policy v1 — \"excluded\" below only holds on a native hook \- install or a generated integration. Run `ai-memory install-hooks` to check which \- one is active.\n"++ install or a generated integration. Check the configured hook command; a dry-run \++ `ai-memory install-hooks` reports the selected install path, not the active one.\n"+ );+ }+if report.rows.is_empty() {println!(" No local harness sessions found for this project and nothing captured yet.");return;@@@ -413,24 -472,21 +523,33 @@@row.agent, row.local_total, row.local_recent, row.captured);if row.uncaptured {+ if report.capture_owner_active {+ println!(+ " No captured session: check the external producer and repository policy."+ );+ } else {+ println!(+ " └ ran here but nothing was captured — install its hook:\n \+ ai-memory install-hooks --agent {} --apply",+ row.agent+ );+ }+ }+ if let Some(count) = row.mixed_capture_sessions.filter(|count| *count > 0) {println!(- " └ ran here but nothing was captured — install its hook:\n \- ai-memory install-hooks --agent {} --apply",- row.agent+ " {count} session(s) contain events from multiple capture sources.\n \+ Backfill can also mix source metadata; this does not prove duplicate capture.");}+ if let Some(memory) = report.native_memory.iter().find(|m| m.agent == row.agent) {+ println!(+ " native memory: {} ({} file{})",+ memory.path,+ memory.file_count,+ if memory.file_count == 1 { "" } else { "s" }+ );+ println!(" capture: {}", memory.status);+ }}if report.uncaptured.is_empty() {diff --cc docs/cookbook.mdindex cf70cce2,69e3b7cc..bb141562--- a/docs/cookbook.md+++ b/docs/cookbook.md@@@ -320,7 -312,7 +320,13 @@@ ai-memory serve #every harness that has local sessions in this project and whether the servercaptured them — so a harness you rotated in without installing its hook (asilent gap: it keeps its own local history while capturing nothing) shows up-- as a warning with the exact `install-hooks` command to fix it.++ as a warning with the exact `install-hooks` command to fix it. For Claude++ Code it also reports the detected default auto-memory directory and whether++ the repository's capture exclusions cover it. A custom++ `autoMemoryDirectory` is not discoverable from Claude's session transcripts++ and is not reported. An `excluded` verdict applies only to native/generated++ hooks; shell and PowerShell compatibility hooks do not enforce capture-policy++ exclusions.- **I just installed hooks in a project I've worked in for a while**: the firsttime you open the project after installing, ai-memory imports your existinglocal session history once (bounded, sanitized on the server, only into an