Skip to content

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

Rust

Merge main (#403) into move-session branch

AkitaOnRails1c6a8ad11721
diff --cc CHANGELOG.md
index 1d205bd0,b1a984e2..14b8c9b1
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -8,33 -8,19 +8,46 @@@ and this project adheres to [Semantic V
## [Unreleased]
### Added
+- Added `ai-memory move-session <session-id> --to <project> [--to-workspace]
+ [--pages move|regenerate] [--confirm] [--force] [--create]`, its batch form
+ `--from-project <project> [--from-workspace]`, and `POST /admin/move-session`
+ to move one session (or every session touching a project) to another
+ project, in the same or another workspace. One transaction per session
+ re-stamps the `sessions` row, its `observations` (wherever they landed), the
+ `handoffs` it produced, its consolidation jobs, auto-improve runs and
+ scheduler claim, and its `sessions/<id>.md` page: `--pages move` (default)
+ carries every version and
+ the file along (409 when the destination already has that page), `--pages
+ regenerate` retires the source page (clearing the session's
+ `summary_page_id`) and removes its file so the next consolidation rewrites
+ it in the destination. Without `--confirm` the server
+ runs the same transaction and rolls it back, so the summary is an exact dry
+ run and the CLI prints the command to apply (with `--create` the dry run
+ reports `would_create_project` and creates nothing). An open session, a pending or
+ running consolidation job, or (batch) the active source project refuse with
+ 409 unless `--force`. `sessions.cwd` stays as recorded (the response warns
+ when its basename is not the destination), and `auto_improve_proposals`,
+ `entities` and `page_feedback` are not re-stamped. A session already rooted
+ in the destination is re-homed instead of refused: its row stays
+ (`session_moved: false`, open-session guard not applied) and only its rows
+ still lying in other scopes are gathered (`page: already in destination`
+ when its page needs nothing), and the batch form enumerates sessions with a `sessions` row in
+ the source OR observations stamped into it, so a phantom project holding
+ only observations of sessions rooted elsewhere can be emptied. New
+ admission op `move_session`. (#402)
+ - Added a read path for one session's raw hook observations, before any
+ consolidation: the MCP tool `memory_read_session_observations` and the
+ `/api/v1` routes `GET .../projects/{project}/sessions` and
+ `GET .../sessions/{session_id}/observations`. Both return only the rows that
+ landed in the resolved `(workspace, project)`, report `elided_other_scope`
+ for a session that crossed repositories, and apply the same owner filter as
+ handoffs; a session id from another project or operator reads as not found.
+ Pagination is `limit`/`offset` with `total` (default 50, max 200; the
+ session list defaults to 20, max 100), `order` is `asc` or `desc`, `kinds`
+ and a full-text query narrow the rows, and `body_max_chars` (default 4000,
+ `200..=16384`) caps each body with a visible truncation marker. The MCP tool
+ reads the latest completed visible session when `session_id` is omitted
+ (#401).
## [1.27.0] - 2026-08-16
diff --cc crates/ai-memory-store/src/lib.rs
index e3c3e68d,7b8d0169..dd941855
--- a/crates/ai-memory-store/src/lib.rs
+++ b/crates/ai-memory-store/src/lib.rs
@@@ -53,10 -52,11 +53,12 @@@ pub use reader::
ActivityWindow, AgentSessionCount, AutoImproveCandidateSession, BriefPageBody, BriefingPage,
BriefingSnapshot, ClientActivity, ContaminationFinding, ContaminationReport,
ContaminationSummary, DecayCandidate, DecayTombstone, DerivedIndexStatus, EmbeddingTripleCount,
- FeedbackFinding, GraphVia, HealthDetail, HealthPage, ObservationHit, OpenSession, PageAuthor,
- PageHit, PageHitWithMeta, PageLinks, PageMeta, PageSummary, ProjectSummary, ReaderPool,
+ FeedbackFinding, GraphVia, HealthDetail, HealthPage, ObservationHit, ObservationOrder,
+ ObservationPage, ObservationPageResult, ObservationRecord, OpenSession, PageAuthor, PageHit,
+ PageHitWithMeta, PageLinks, PageMeta, PageSummary, ProjectSummary, ReaderPool,
ReindexTargetStatus, RelatedPage, RrfContributions, ScopeRow, SearchExplain,
- SessionDependentRows, SessionEndDisposition, StatusCounts, StoredEmbedding, StoredPageBody,
- SessionEndDisposition, SessionSummary, StatusCounts, StoredEmbedding, StoredPageBody,
++ SessionDependentRows, SessionEndDisposition, SessionSummary, StatusCounts, StoredEmbedding,
++ StoredPageBody,
WorkspaceScopeRow, WorkspaceSummary, f32_vec_to_bytes,
};
pub use scope::{