The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore(memory): remove memory diff subsystem\n\nRemove the memory diff RPC handlers, schemas, agent tool, feature wiring, and end-to-end test. The git-backed memory diff capability is no longer included in the application.\n\nAuto-committed-on: dragonfly\n
Steven Enamakelaba200f67ad7
diff --git a/Cargo.toml b/Cargo.tomlindex ad79384513..eec2289b12 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -91,13 +91,6 @@ path = "tests/observability_smoke.rs"# The `is_*_event` Sentry filters are all `#[cfg(feature = "crash-reporting")]`.required-features = ["crash-reporting"]-[[test]]-name = "memory_artifacts_e2e"-path = "tests/memory_artifacts_e2e.rs"-# Opens the wiki ledger with `tinycortex::git2::Repository::open` and asserts on-# `content::wiki_git` artifacts — both of which exist only behind this gate.-required-features = ["memory-git"]-[[test]]name = "x402_twit_sh_live"path = "tests/x402_twit_sh_live.rs"@@ -788,7 +781,6 @@ default = ["media", "skills", "flows", "mcp", "channels", "medulla", "http-serve# `None`; and the three `ops` entry points always-on code calls return a# build-fact error, so a post-sync snapshot or a subconscious diff is logged and# skipped rather than silently reported as "nothing changed".-memory-git = ["tinycortex/git-diff", "tinycortex/wiki-git", "tinymemory-core/memory-git"]http-server = ["dep:axum", "dep:socketioxide"]# Local audio-device access: the `cpal` capture stack behind voice recording# and the accessibility microphone-permission probe. Default-ON. Slim /diff --git a/src/openhuman/memory/diff/mod.rs b/src/openhuman/memory/diff/mod.rsdeleted file mode 100644index 869ca87d79..0000000000--- a/src/openhuman/memory/diff/mod.rs+++ /dev/null@@ -1,87 +0,0 @@-//! Host layer over [`tinymemory_core::diff`].-//!-//! The domain itself lives in the extracted crate; what stays here is its-//! JSON-RPC surface — handlers and controller schemas name OpenHuman's-//! `RpcOutcome` and `ControllerSchema`, which the engine crate cannot see.-//! The glob re-export keeps every historical `memory::diff::…` path resolving.-//!-//! # What the glob actually carries, and what blocks removing it (#5560)-//!-//! Three things, and only one of them is engine-owned in a way that matters:-//!-//! - the eight serde wire types (`ChangeKind`, `Checkpoint`, `CrossSourceDiff`,-//! `DiffResult`, `DiffSummary`, `ItemChange`, `Snapshot`, `SnapshotTrigger`)-//! — these are `tinycortex::memory::diff::types`, which `rpc.rs` and-//! `tools/diff.rs` already name directly, so they would repoint for free;-//! - `ops` (or its `memory-git`-off stub) — 312 lines of async wrappers over-//! `tinycortex::memory::diff::DiffEngine`, reached from `rpc.rs` as-//! `super::ops` and from the `memory_diff` agent tool;-//! - `source` — the `SnapshotItemSource` seam `ops` hands the engine.-//!-//! `ops` is what pins this. It reads the source registry-//! (`sources::registry::list_sources`, `sources::types::MemorySourceEntry`,-//! `sources::status::source_id_prefix`), so it cannot come home ahead of-//! `memory::sources` — see that module's docs for the two blockers there — and-//! `source` builds its snapshot items through-//! `store::chunks::store::with_connection`, a raw SQLite handle. Moving that-//! pair into the host would relocate the unpoliced door rather than close it.-//!-//! `MemoryDiff` is a real capability family — `capture_snapshot`, `snapshots`,-//! `diff` — and it is the right destination for three of `ops`' entry points.-//! It is not a drop-in for the module, for two reasons worth stating before-//! anyone tries:-//!-//! - **It covers three of `ops`' ten entry points.** `auto_snapshot_after_sync`,-//! `diff_since_last`, `diff_since_read`, `mark_read`, `create_checkpoint`,-//! `diff_since_checkpoint` and `cleanup` are checkpoints, read markers, the-//! post-sync trigger and ledger retention; the family has no member for any-//! of them, and `capture_snapshot` takes no `SnapshotTrigger`.-//! - **The wire shapes are different types.** The family answers `SnapshotRef`-//! and `DiffReport`; `memory_diff.*` publishes `Snapshot`, `DiffResult` and-//! `CrossSourceDiff`, which the Memory tab reads. Swapping the call without-//! translating at the handler would change the RPC payloads, which is a-//! behaviour change, not a migration.--// The eight wire types, named at the crate that defines them. They are-// `tinycortex::memory::diff::types` — `tinymemory_core::diff` re-exports them-// out of its `engine::backend::diff::types`, which is that same module — so-// this is the identical item under a different crate alias, and an explicit-// `use` shadows the glob below with itself. `rpc.rs` and `tools/diff.rs`-// already spell them this way; saying it here too means the flat-// `memory::diff::ChangeKind` paths keep resolving when `tinymemory-core`-// leaves the build, with no edit at any call site.-//-// Ungated on both sides of `memory-git`, mirroring tinycortex's own carve-out:-// these are serde-only values that always-on callers (the subconscious memory-// profile renders `CrossSourceDiff` and `ChangeKind` into prompts) name in a-// slim build too.-pub use tinycortex::memory::diff::types::{- ChangeKind, Checkpoint, CrossSourceDiff, DiffResult, DiffSummary, ItemChange, Snapshot,- SnapshotTrigger,-};--// What is left of the glob, and all that pins it: `ops` (or its `memory-git`-off-// stub) and `source`. Both are `tinymemory-core`'s own — see the header above-// for why neither can come home ahead of `memory::sources`, and why-// `MemoryDiff` covers three of `ops`' ten entry points rather than replacing it.-pub use tinymemory_core::diff::*;--#[cfg(feature = "memory-git")]-pub mod rpc;-#[cfg(feature = "memory-git")]-pub mod schemas;--#[cfg(feature = "memory-git")]-pub use schemas::{- all_controller_schemas as all_memory_diff_controller_schemas,- all_registered_controllers as all_memory_diff_registered_controllers,-};-// The agent tool came back with the rest of them; re-exported here so the-// historical `memory::diff::MemoryDiffTool` path keeps resolving.-#[cfg(feature = "memory-git")]-pub use crate::openhuman::memory::tools::diff::MemoryDiffTool;-#[cfg(not(feature = "memory-git"))]-mod stub;--#[cfg(not(feature = "memory-git"))]-pub use stub::{all_memory_diff_controller_schemas, all_memory_diff_registered_controllers};diff --git a/src/openhuman/memory/diff/rpc.rs b/src/openhuman/memory/diff/rpc.rsdeleted file mode 100644index 3fdf97b27f..0000000000--- a/src/openhuman/memory/diff/rpc.rs+++ /dev/null@@ -1,337 +0,0 @@-//! RPC request/response types and handler implementations.--use log::debug;-use serde::{Deserialize, Serialize};--use crate::openhuman::config::rpc as config_rpc;-use crate::rpc::RpcOutcome;--use tinycortex::memory::diff::Ledger;--use super::ops;-use tinycortex::memory::diff::types::*;--// ── Request / Response types ──────────────────────────────────────────--#[derive(Debug, Deserialize)]-pub struct TakeSnapshotRequest {- pub source_id: String,-}--#[derive(Debug, Serialize)]-pub struct TakeSnapshotResponse {- pub snapshot: Snapshot,-}--#[derive(Debug, Deserialize)]-pub struct ListSnapshotsRequest {- #[serde(default)]- pub source_id: Option<String>,- #[serde(default)]- pub limit: Option<u64>,-}--#[derive(Debug, Serialize)]-pub struct ListSnapshotsResponse {- pub snapshots: Vec<Snapshot>,-}--#[derive(Debug, Deserialize)]-pub struct DiffRequest {- #[serde(default)]- pub from_snapshot_id: Option<String>,- pub to_snapshot_id: String,- #[serde(default)]- pub include_text_diff: Option<bool>,-}--#[derive(Debug, Serialize)]-pub struct DiffResponse {- pub diff: DiffResult,-}--#[derive(Debug, Deserialize)]-pub struct DiffSinceLastRequest {- pub source_id: String,- #[serde(default)]- pub include_text_diff: Option<bool>,-}--#[derive(Debug, Serialize)]-pub struct DiffSinceLastResponse {- pub diff: DiffResult,-}--#[derive(Debug, Deserialize)]-pub struct DiffSinceReadRequest {- pub source_id: String,- #[serde(default)]- pub include_text_diff: Option<bool>,- /// Advance the read marker to the head snapshot after computing the diff.- /// Defaults to true so reading acknowledges the changes as consumed.- #[serde(default)]- pub commit: Option<bool>,-}--#[derive(Debug, Serialize)]-pub struct DiffSinceReadResponse {- pub diff: DiffResult,-}--#[derive(Debug, Deserialize)]-pub struct MarkReadRequest {- /// Sources to mark read. Omit to mark all enabled sources with a snapshot.- #[serde(default)]- pub source_ids: Option<Vec<String>>,-}--#[derive(Debug, Serialize)]-pub struct MarkReadResponse {- pub marked: u64,-}--#[derive(Debug, Deserialize)]-pub struct CreateCheckpointRequest {- pub label: String,-}--#[derive(Debug, Serialize)]-pub struct CreateCheckpointResponse {- pub checkpoint: Checkpoint,-}--#[derive(Debug, Deserialize)]-pub struct ListCheckpointsRequest {- #[serde(default)]- pub limit: Option<u64>,-}--#[derive(Debug, Serialize)]-pub struct ListCheckpointsResponse {- pub checkpoints: Vec<Checkpoint>,-}--#[derive(Debug, Deserialize)]-pub struct DiffSinceCheckpointRequest {- pub checkpoint_id: String,- #[serde(default)]- pub include_text_diff: Option<bool>,-}--#[derive(Debug, Serialize)]-pub struct DiffSinceCheckpointResponse {- pub diff: CrossSourceDiff,-}--#[derive(Debug, Deserialize)]-pub struct CleanupRequest {- pub older_than_days: u64,-}--#[derive(Debug, Serialize)]-pub struct CleanupResponse {- pub deleted_snapshots: u64,-}--// ── Handlers ──────────────────────────────────────────────────────────--pub async fn take_snapshot_rpc(- req: TakeSnapshotRequest,-) -> Result<RpcOutcome<TakeSnapshotResponse>, String> {- debug!(- "[memory_diff][rpc] take_snapshot source_id={}",- req.source_id- );- let config = config_rpc::load_config_with_timeout().await?;- let source = crate::openhuman::memory::sources::get_source(&req.source_id)- .await?- .ok_or_else(|| format!("source not found: {}", req.source_id))?;-- let snapshot = ops::take_snapshot(&source, &config, SnapshotTrigger::Manual).await?;- debug!(- "[memory_diff][rpc] take_snapshot done snapshot_id={} item_count={}",- snapshot.id, snapshot.item_count- );- Ok(RpcOutcome::new(TakeSnapshotResponse { snapshot }, vec![]))-}--pub async fn list_snapshots_rpc(- req: ListSnapshotsRequest,-) -> Result<RpcOutcome<ListSnapshotsResponse>, String> {- debug!(- "[memory_diff][rpc] list_snapshots source_id={:?} limit={:?}",- req.source_id, req.limit- );- let config = config_rpc::load_config_with_timeout().await?;- let limit = req.limit.unwrap_or(50) as u32;-- let snapshots = ops::list_snapshots(&config, req.source_id.as_deref(), limit).await?;-- debug!(- "[memory_diff][rpc] list_snapshots returned {} snapshots",- snapshots.len()- );- Ok(RpcOutcome::new(ListSnapshotsResponse { snapshots }, vec![]))-}--pub async fn diff_rpc(req: DiffRequest) -> Result<RpcOutcome<DiffResponse>, String> {- debug!(- "[memory_diff][rpc] diff from={:?} to={}",- req.from_snapshot_id, req.to_snapshot_id- );- let config = config_rpc::load_config_with_timeout().await?;- let diff = ops::compute_diff(- &config,- req.from_snapshot_id.as_deref(),- &req.to_snapshot_id,- req.include_text_diff.unwrap_or(false),- )- .await?;- debug!(- "[memory_diff][rpc] diff done added={} removed={} modified={}",- diff.summary.added, diff.summary.removed, diff.summary.modified- );- Ok(RpcOutcome::new(DiffResponse { diff }, vec![]))-}--pub async fn diff_since_last_rpc(- req: DiffSinceLastRequest,-) -> Result<RpcOutcome<DiffSinceLastResponse>, String> {- debug!(- "[memory_diff][rpc] diff_since_last source_id={}",- req.source_id- );- let config = config_rpc::load_config_with_timeout().await?;- let source = crate::openhuman::memory::sources::get_source(&req.source_id)- .await?- .ok_or_else(|| format!("source not found: {}", req.source_id))?;-- let diff =- ops::diff_since_last(&source, &config, req.include_text_diff.unwrap_or(false)).await?;- debug!(- "[memory_diff][rpc] diff_since_last done added={} removed={} modified={}",- diff.summary.added, diff.summary.removed, diff.summary.modified- );- Ok(RpcOutcome::new(DiffSinceLastResponse { diff }, vec![]))-}--pub async fn diff_since_read_rpc(- req: DiffSinceReadRequest,-) -> Result<RpcOutcome<DiffSinceReadResponse>, String> {- let commit = req.commit.unwrap_or(true);- debug!(- "[memory_diff][rpc] diff_since_read source_id={} commit={}",- req.source_id, commit- );- let config = config_rpc::load_config_with_timeout().await?;- let source = crate::openhuman::memory::sources::get_source(&req.source_id)- .await?- .ok_or_else(|| format!("source not found: {}", req.source_id))?;-- let diff = ops::diff_since_read(- &source,- &config,- req.include_text_diff.unwrap_or(false),- commit,- )- .await?;- debug!(- "[memory_diff][rpc] diff_since_read done added={} removed={} modified={}",- diff.summary.added, diff.summary.removed, diff.summary.modified- );- Ok(RpcOutcome::new(DiffSinceReadResponse { diff }, vec![]))-}--pub async fn mark_read_rpc(req: MarkReadRequest) -> Result<RpcOutcome<MarkReadResponse>, String> {- debug!(- "[memory_diff][rpc] mark_read source_ids={:?}",- req.source_ids- );- let config = config_rpc::load_config_with_timeout().await?;- let marked = ops::mark_read(&config, req.source_ids).await?;- debug!("[memory_diff][rpc] mark_read done marked={}", marked);- Ok(RpcOutcome::new(MarkReadResponse { marked }, vec![]))-}--pub async fn create_checkpoint_rpc(- req: CreateCheckpointRequest,-) -> Result<RpcOutcome<CreateCheckpointResponse>, String> {- debug!("[memory_diff][rpc] create_checkpoint label={}", req.label);- let config = config_rpc::load_config_with_timeout().await?;- let checkpoint = ops::create_checkpoint(&req.label, &config).await?;- debug!(- "[memory_diff][rpc] create_checkpoint done id={} snapshots={}",- checkpoint.id,- checkpoint.snapshot_ids.len()- );- Ok(RpcOutcome::new(- CreateCheckpointResponse { checkpoint },- vec![],- ))-}--pub async fn list_checkpoints_rpc(- req: ListCheckpointsRequest,-) -> Result<RpcOutcome<ListCheckpointsResponse>, String> {- debug!("[memory_diff][rpc] list_checkpoints limit={:?}", req.limit);- let config = config_rpc::load_config_with_timeout().await?;- let workspace_dir = config.workspace_dir.clone();- let limit = req.limit.unwrap_or(20) as u32;-- let checkpoints = tokio::task::spawn_blocking(move || -> anyhow::Result<Vec<Checkpoint>> {- let ledger = Ledger::open(&workspace_dir)?;- ledger.list_checkpoints(limit)- })- .await- .map_err(|e| format!("list_checkpoints join: {e}"))?- .map_err(|e: anyhow::Error| format!("list_checkpoints: {e:#}"))?;-- debug!(- "[memory_diff][rpc] list_checkpoints returned {} checkpoints",- checkpoints.len()- );- Ok(RpcOutcome::new(- ListCheckpointsResponse { checkpoints },- vec![],- ))-}--pub async fn diff_since_checkpoint_rpc(- req: DiffSinceCheckpointRequest,-) -> Result<RpcOutcome<DiffSinceCheckpointResponse>, String> {- debug!(- "[memory_diff][rpc] diff_since_checkpoint checkpoint_id={}",- req.checkpoint_id- );- let config = config_rpc::load_config_with_timeout().await?;- let diff = ops::diff_since_checkpoint(- &req.checkpoint_id,- &config,- req.include_text_diff.unwrap_or(false),- )- .await?;- debug!(- "[memory_diff][rpc] diff_since_checkpoint done sources={}",- diff.per_source.len()- );- Ok(RpcOutcome::new(- DiffSinceCheckpointResponse { diff },- vec![],- ))-}--pub async fn cleanup_rpc(req: CleanupRequest) -> Result<RpcOutcome<CleanupResponse>, String> {- debug!(- "[memory_diff][rpc] cleanup older_than_days={}",- req.older_than_days- );- let config = config_rpc::load_config_with_timeout().await?;- let deleted = ops::cleanup(&config, req.older_than_days as u32).await?;- debug!("[memory_diff][rpc] cleanup done deleted={}", deleted);- Ok(RpcOutcome::new(- CleanupResponse {- deleted_snapshots: deleted,- },- vec![],- ))-}diff --git a/src/openhuman/memory/diff/schemas.rs b/src/openhuman/memory/diff/schemas.rsdeleted file mode 100644index c5fa4ecede..0000000000--- a/src/openhuman/memory/diff/schemas.rs+++ /dev/null@@ -1,408 +0,0 @@-//! Controller-registry schemas for `openhuman.memory_diff_*`.--use serde::de::DeserializeOwned;-use serde_json::{Map, Value};--use crate::core::all::{ControllerFuture, RegisteredController};-use crate::core::{ControllerSchema, FieldSchema, TypeSchema};-use crate::rpc::RpcOutcome;--use super::rpc;--const NAMESPACE: &str = "memory_diff";--pub fn all_controller_schemas() -> Vec<ControllerSchema> {- vec![- schemas("take_snapshot"),- schemas("list_snapshots"),- schemas("diff"),- schemas("diff_since_last"),- schemas("diff_since_read"),- schemas("mark_read"),- schemas("create_checkpoint"),- schemas("list_checkpoints"),- schemas("diff_since_checkpoint"),- schemas("cleanup"),- ]-}--pub fn all_registered_controllers() -> Vec<RegisteredController> {- vec![- RegisteredController {- schema: schemas("take_snapshot"),- handler: handle_take_snapshot,- },- RegisteredController {- schema: schemas("list_snapshots"),- handler: handle_list_snapshots,- },- RegisteredController {- schema: schemas("diff"),- handler: handle_diff,- },- RegisteredController {- schema: schemas("diff_since_last"),- handler: handle_diff_since_last,- },- RegisteredController {- schema: schemas("diff_since_read"),- handler: handle_diff_since_read,- },- RegisteredController {- schema: schemas("mark_read"),- handler: handle_mark_read,- },- RegisteredController {- schema: schemas("create_checkpoint"),- handler: handle_create_checkpoint,- },- RegisteredController {- schema: schemas("list_checkpoints"),- handler: handle_list_checkpoints,- },- RegisteredController {- schema: schemas("diff_since_checkpoint"),- handler: handle_diff_since_checkpoint,- },- RegisteredController {- schema: schemas("cleanup"),- handler: handle_cleanup,- },- ]-}--fn schemas(function: &str) -> ControllerSchema {- match function {- "take_snapshot" => ControllerSchema {- namespace: NAMESPACE,- function: "take_snapshot",- description: "Manually capture a snapshot of a memory source's current chunk state.",- inputs: vec![FieldSchema {- name: "source_id",- ty: TypeSchema::String,- comment: "Memory source id to snapshot.",- required: true,- }],- outputs: vec![FieldSchema {- name: "snapshot",- ty: TypeSchema::Ref("Snapshot"),- comment: "The captured snapshot.",- required: true,- }],- },- "list_snapshots" => ControllerSchema {- namespace: NAMESPACE,- function: "list_snapshots",- description: "List snapshots, optionally filtered by source, newest first.",- inputs: vec![- FieldSchema {- name: "source_id",- ty: TypeSchema::Option(Box::new(TypeSchema::String)),- comment: "Filter to a specific source.",- required: false,- },- FieldSchema {- name: "limit",- ty: TypeSchema::Option(Box::new(TypeSchema::U64)),- comment: "Max snapshots to return (default 50).",- required: false,- },- ],- outputs: vec![FieldSchema {- name: "snapshots",- ty: TypeSchema::Array(Box::new(TypeSchema::Ref("Snapshot"))),- comment: "Snapshots in reverse chronological order.",- required: true,- }],- },- "diff" => ControllerSchema {- namespace: NAMESPACE,- function: "diff",- description: "Compute the diff between two snapshots of the same source.",- inputs: vec![- FieldSchema {- name: "from_snapshot_id",- ty: TypeSchema::Option(Box::new(TypeSchema::String)),- comment:- "Base snapshot id. Omit to diff against empty (all items show as added).",- required: false,- },- FieldSchema {- name: "to_snapshot_id",- ty: TypeSchema::String,- comment: "Head snapshot id.",- required: true,- },- FieldSchema {- name: "include_text_diff",- ty: TypeSchema::Option(Box::new(TypeSchema::Bool)),- comment: "Include line-level text diffs for modified items.",- required: false,- },- ],- outputs: vec![FieldSchema {- name: "diff",- ty: TypeSchema::Ref("DiffResult"),- comment: "Computed diff with change summary and per-item changes.",- required: true,- }],- },- "diff_since_last" => ControllerSchema {- namespace: NAMESPACE,- function: "diff_since_last",- description: "Diff a source's latest snapshot against its previous one. \- Shows what changed in the most recent sync.",- inputs: vec![- FieldSchema {- name: "source_id",- ty: TypeSchema::String,- comment: "Memory source id.",- required: true,- },- FieldSchema {- name: "include_text_diff",- ty: TypeSchema::Option(Box::new(TypeSchema::Bool)),- comment: "Include line-level text diffs for modified items.",- required: false,- },- ],- outputs: vec![FieldSchema {- name: "diff",- ty: TypeSchema::Ref("DiffResult"),- comment: "Diff between the two most recent snapshots.",- required: true,- }],- },- "diff_since_read" => ControllerSchema {- namespace: NAMESPACE,- function: "diff_since_read",- description: "Diff a source's latest snapshot against the read marker — what \- changed since the agent last read this source's diff. By default \- commits the read marker so the next call returns only newer changes.",- inputs: vec![- FieldSchema {- name: "source_id",- ty: TypeSchema::String,- comment: "Memory source id.",- required: true,- },- FieldSchema {- name: "include_text_diff",- ty: TypeSchema::Option(Box::new(TypeSchema::Bool)),- comment: "Include line-level text diffs for modified items.",- required: false,- },- FieldSchema {- name: "commit",- ty: TypeSchema::Option(Box::new(TypeSchema::Bool)),- comment: "Advance the read marker after diffing (default true). \- Set false to preview without acknowledging.",- required: false,- },- ],- outputs: vec![FieldSchema {- name: "diff",- ty: TypeSchema::Ref("DiffResult"),- comment: "Diff between the read marker and the latest snapshot.",- required: true,- }],- },- "mark_read" => ControllerSchema {- namespace: NAMESPACE,- function: "mark_read",- description: "Commit read markers, advancing each source to its current head \- snapshot so prior changes are acknowledged as consumed.",- inputs: vec![FieldSchema {- name: "source_ids",- ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(TypeSchema::String)))),- comment: "Sources to mark read. Omit to mark all enabled sources with a snapshot.",- required: false,- }],- outputs: vec![FieldSchema {- name: "marked",- ty: TypeSchema::U64,- comment: "Number of read markers committed.",- required: true,- }],- },- "create_checkpoint" => ControllerSchema {- namespace: NAMESPACE,- function: "create_checkpoint",- description:- "Create a named checkpoint grouping the latest snapshot per enabled source. \- Use for cross-source 'what changed since X' queries.",- inputs: vec![FieldSchema {- name: "label",- ty: TypeSchema::String,- comment: "Human-readable checkpoint label.",- required: true,- }],- outputs: vec![FieldSchema {- name: "checkpoint",- ty: TypeSchema::Ref("Checkpoint"),- comment: "The created checkpoint with its snapshot ids.",- required: true,- }],- },- "list_checkpoints" => ControllerSchema {- namespace: NAMESPACE,- function: "list_checkpoints",- description: "List named checkpoints, newest first.",- inputs: vec![FieldSchema {- name: "limit",- ty: TypeSchema::Option(Box::new(TypeSchema::U64)),- comment: "Max checkpoints to return (default 20).",- required: false,- }],- outputs: vec![FieldSchema {- name: "checkpoints",- ty: TypeSchema::Array(Box::new(TypeSchema::Ref("Checkpoint"))),- comment: "Checkpoints in reverse chronological order.",- required: true,- }],- },- "diff_since_checkpoint" => ControllerSchema {- namespace: NAMESPACE,- function: "diff_since_checkpoint",- description:- "Cross-source diff: compute changes across all sources since a checkpoint.",- inputs: vec![- FieldSchema {- name: "checkpoint_id",- ty: TypeSchema::String,- comment: "Checkpoint id to diff against.",- required: true,- },- FieldSchema {- name: "include_text_diff",- ty: TypeSchema::Option(Box::new(TypeSchema::Bool)),- comment: "Include line-level text diffs for modified items.",- required: false,- },- ],- outputs: vec![FieldSchema {- name: "diff",- ty: TypeSchema::Ref("CrossSourceDiff"),- comment: "Aggregated diff across all sources with per-source breakdown.",- required: true,- }],- },- "cleanup" => ControllerSchema {- namespace: NAMESPACE,- function: "cleanup",- description: "Delete snapshots older than N days.",- inputs: vec![FieldSchema {- name: "older_than_days",- ty: TypeSchema::U64,- comment: "Delete snapshots older than this many days.",- required: true,- }],- outputs: vec![FieldSchema {- name: "deleted_snapshots",- ty: TypeSchema::U64,- comment: "Number of snapshots deleted.",- required: true,- }],- },- other => panic!("unknown memory_diff schema function: {other}"),- }-}--// ── Handlers ──────────────────────────────────────────────────────────--fn handle_take_snapshot(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let req = parse_value::<rpc::TakeSnapshotRequest>(Value::Object(params))?;- to_json(rpc::take_snapshot_rpc(req).await?)- })-}--fn handle_list_snapshots(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let req = parse_value::<rpc::ListSnapshotsRequest>(Value::Object(params))?;- to_json(rpc::list_snapshots_rpc(req).await?)- })-}--fn handle_diff(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let req = parse_value::<rpc::DiffRequest>(Value::Object(params))?;- to_json(rpc::diff_rpc(req).await?)- })-}--fn handle_diff_since_last(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let req = parse_value::<rpc::DiffSinceLastRequest>(Value::Object(params))?;- to_json(rpc::diff_since_last_rpc(req).await?)- })-}--fn handle_diff_since_read(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let req = parse_value::<rpc::DiffSinceReadRequest>(Value::Object(params))?;- to_json(rpc::diff_since_read_rpc(req).await?)- })-}--fn handle_mark_read(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let req = parse_value::<rpc::MarkReadRequest>(Value::Object(params))?;- to_json(rpc::mark_read_rpc(req).await?)- })-}--fn handle_create_checkpoint(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let req = parse_value::<rpc::CreateCheckpointRequest>(Value::Object(params))?;- to_json(rpc::create_checkpoint_rpc(req).await?)- })-}--fn handle_list_checkpoints(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let req = parse_value::<rpc::ListCheckpointsRequest>(Value::Object(params))?;- to_json(rpc::list_checkpoints_rpc(req).await?)- })-}--fn handle_diff_since_checkpoint(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let req = parse_value::<rpc::DiffSinceCheckpointRequest>(Value::Object(params))?;- to_json(rpc::diff_since_checkpoint_rpc(req).await?)- })-}--fn handle_cleanup(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let req = parse_value::<rpc::CleanupRequest>(Value::Object(params))?;- to_json(rpc::cleanup_rpc(req).await?)- })-}--fn parse_value<T: DeserializeOwned>(v: Value) -> Result<T, String> {- serde_json::from_value(v).map_err(|e| format!("invalid params: {e}"))-}--fn to_json<T: serde::Serialize>(outcome: RpcOutcome<T>) -> Result<Value, String> {- outcome.into_cli_compatible_json()-}--#[cfg(test)]-mod tests {- use super::*;-- #[test]- fn all_controller_schemas_and_registered_controllers_stay_in_sync() {- let schemas = all_controller_schemas();- let controllers = all_registered_controllers();- assert_eq!(schemas.len(), controllers.len());- assert!(schemas.iter().all(|s| s.namespace == NAMESPACE));- }-- #[test]- #[should_panic(expected = "unknown memory_diff schema function")]- fn schemas_panics_on_unknown_function() {- schemas("nope");- }-}diff --git a/src/openhuman/memory/diff/stub.rs b/src/openhuman/memory/diff/stub.rsdeleted file mode 100644index 6587027691..0000000000--- a/src/openhuman/memory/diff/stub.rs+++ /dev/null@@ -1,23 +0,0 @@-//! The `memory-git`-disabled controller surface of `memory::diff`.-//!-//! The *ops* mirror lives with the domain in `tinymemory_core::diff::stub` —-//! it is the feature-off arm of core code, and always-on core callers-//! (`sources::sync`) reach it without any feature awareness, which is the whole-//! point of a stub.-//!-//! What stays here is the registration half. Registration sites want-//! **absence**: the aggregators return empty vecs so the `memory_diff.*`-//! controllers become unknown-method rather than known-and-always-failing.--/// No controllers: the `memory_diff` namespace answers unknown-method.-///-/// Empty rather than a set of always-erroring handlers, so `/schema` does not-/// advertise a surface this build cannot serve.-pub fn all_memory_diff_controller_schemas() -> Vec<crate::core::ControllerSchema> {- Vec::new()-}--/// No controllers to register. See [`all_memory_diff_controller_schemas`].-pub fn all_memory_diff_registered_controllers() -> Vec<crate::core::all::RegisteredController> {- Vec::new()-}diff --git a/src/openhuman/memory/diff/types.rs b/src/openhuman/memory/diff/types.rsdeleted file mode 100644index 2ae8f7c010..0000000000--- a/src/openhuman/memory/diff/types.rs+++ /dev/null@@ -1,10 +0,0 @@-//! Stable wire types for memory-source diffs.-//!-//! TinyCortex keeps these serde-only values available independently of its-//! git-backed diff engine, so hosts can describe a diff even in a slim build-//! without the `memory-git` feature.--pub use tinycortex::memory::diff::types::{- ChangeKind, Checkpoint, CrossSourceDiff, DiffResult, DiffSummary, ItemChange, Snapshot,- SnapshotTrigger,-};diff --git a/src/openhuman/memory/tools/diff.rs b/src/openhuman/memory/tools/diff.rsdeleted file mode 100644index eb94335dde..0000000000--- a/src/openhuman/memory/tools/diff.rs+++ /dev/null@@ -1,402 +0,0 @@-//! Agent-facing `memory_diff` tool.-//!-//! Lets agents query what changed in memory sources since the last sync-//! or a named checkpoint, formatted as concise markdown.--use async_trait::async_trait;-use log::debug;-use serde_json::{json, Value};--use crate::openhuman::config::rpc as config_rpc;-use crate::openhuman::tools::traits::{PermissionLevel, Tool, ToolResult};--use crate::openhuman::memory::diff::ops;-// The host path, matching the six other call sites that read this-// registry (`memory::diff::rpc`, `memory::sync::composio::bus`,-// `integrations::composio::ops::connections`). This tool was the one-// place that named the engine crate for it; the registry itself is-// still `tinymemory_core::sources` behind `memory::sources` — see that-// module's docs for what has to move before the name goes away (#5560).-use crate::openhuman::memory::sources;-use tinycortex::memory::diff::types::*;--pub struct MemoryDiffTool;--#[async_trait]-impl Tool for MemoryDiffTool {- fn name(&self) -> &str {- "memory_diff"- }-- fn description(&self) -> &str {- "Check what changed in memory sources since you last looked, the last sync, or a named \- checkpoint. Returns a structured summary of added, removed, and modified items. By \- default, reading a single source's diff commits a read marker so the next call only \- surfaces newer changes (set commit=false to preview without acknowledging)."- }-- fn parameters_schema(&self) -> Value {- json!({- "type": "object",- "properties": {- "source_id": {- "type": "string",- "description": "Memory source id. If omitted and checkpoint_id is also omitted, \- lists available sources with snapshot counts."- },- "checkpoint_id": {- "type": "string",- "description": "Checkpoint id to diff against. If provided, computes cross-source \- diff since that checkpoint."- },- "include_text_diff": {- "type": "boolean",- "description": "If true, include line-level text diffs for modified items (truncated).",- "default": false- },- "since_read": {- "type": "boolean",- "description": "When diffing a single source, show changes since you last read \- this source's diff (vs. since the previous sync). Default true.",- "default": true- },- "commit": {- "type": "boolean",- "description": "When using since_read, advance the read marker so the next call \- only surfaces newer changes. Default true; set false to preview.",- "default": true- }- },- "additionalProperties": false- })- }-- fn permission_level(&self) -> PermissionLevel {- // Read-only with respect to the user's data: the only write this tool- // performs is advancing the read marker in the module's own diff.db- // (internal bookkeeping under workspace state, never `action_dir`).- PermissionLevel::ReadOnly- }-- async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {- let source_id = args.get("source_id").and_then(|v| v.as_str());- let checkpoint_id = args.get("checkpoint_id").and_then(|v| v.as_str());- let include_text_diff = args- .get("include_text_diff")- .and_then(|v| v.as_bool())- .unwrap_or(false);- let since_read = args- .get("since_read")- .and_then(|v| v.as_bool())- .unwrap_or(true);- let commit = args.get("commit").and_then(|v| v.as_bool()).unwrap_or(true);-- debug!(- "[memory_diff][tool] execute source_id={:?} checkpoint_id={:?} include_text_diff={} \- since_read={} commit={}",- source_id, checkpoint_id, include_text_diff, since_read, commit- );-- let config = config_rpc::load_config_with_timeout()- .await- .map_err(|e| anyhow::anyhow!(e))?;-- if let Some(ckpt_id) = checkpoint_id {- debug!("[memory_diff][tool] branch=checkpoint_diff checkpoint_id={ckpt_id}");- let diff = ops::diff_since_checkpoint(ckpt_id, &config, include_text_diff)- .await- .map_err(|e| anyhow::anyhow!(e))?;- let md = format_cross_source_diff(&diff);- return Ok(ToolResult::success(md));- }-- if let Some(sid) = source_id {- debug!("[memory_diff][tool] branch=source_diff source_id={sid}");- let source = sources::get_source(sid)- .await- .map_err(|e| anyhow::anyhow!(e))?- .ok_or_else(|| anyhow::anyhow!("source not found: {sid}"))?;-- let diff = if since_read {- ops::diff_since_read(&source, &config, include_text_diff, commit)- .await- .map_err(|e| anyhow::anyhow!(e))?- } else {- ops::diff_since_last(&source, &config, include_text_diff)- .await- .map_err(|e| anyhow::anyhow!(e))?- };- let md = format_diff_result(&diff);- return Ok(ToolResult::success(md));- }-- debug!("[memory_diff][tool] branch=list_sources");- // No source_id or checkpoint_id: list sources with snapshot counts- let sources = sources::list_sources()- .await- .map_err(|e| anyhow::anyhow!(e))?;-- let workspace_dir = config.workspace_dir.clone();- let source_ids: Vec<(String, String, String)> = sources- .iter()- .filter(|s| s.enabled)- .map(|s| (s.id.clone(), s.label.clone(), s.kind.as_str().to_string()))- .collect();-- let counts: Vec<(String, String, String, usize)> =- tokio::task::spawn_blocking(move || -> anyhow::Result<_> {- let ledger = tinycortex::memory::diff::Ledger::open(&workspace_dir)?;- let mut out = Vec::new();- for (sid, label, kind) in &source_ids {- let count = ledger.snapshot_count_for_source(sid)?;- out.push((sid.clone(), label.clone(), kind.clone(), count));- }- Ok(out)- })- .await- .map_err(|e| anyhow::anyhow!("join: {e}"))?- .map_err(|e: anyhow::Error| anyhow::anyhow!("{e:#}"))?;-- let mut md = String::from("## Memory Sources (snapshot status)\n\n");- if counts.is_empty() {- md.push_str("No enabled memory sources configured.\n");- } else {- for (sid, label, kind, count) in &counts {- md.push_str(&format!(- "- **{label}** ({kind}) — {count} snapshot(s) | source_id: `{sid}`\n"- ));- }- md.push_str(- "\nCall with `source_id` to see what changed since the last sync, \- or `checkpoint_id` for cross-source diffs.\n",- );- }-- Ok(ToolResult::success(md))- }-}--fn format_diff_result(diff: &DiffResult) -> String {- let mut md = format!(- "## Memory Changes ({})\n\n**{} added, {} modified, {} removed** ({} unchanged)\n",- diff.source_label,- diff.summary.added,- diff.summary.modified,- diff.summary.removed,- diff.summary.unchanged,- );-- let added: Vec<_> = diff- .changes- .iter()- .filter(|c| c.kind == ChangeKind::Added)- .collect();- let modified: Vec<_> = diff- .changes- .iter()- .filter(|c| c.kind == ChangeKind::Modified)- .collect();- let removed: Vec<_> = diff- .changes- .iter()- .filter(|c| c.kind == ChangeKind::Removed)- .collect();-- if !added.is_empty() {- md.push_str("\n### Added\n");- for c in &added {- let label = if c.title.is_empty() {- &c.item_id- } else {- &c.title- };- md.push_str(&format!("- {label}\n"));- }- }-- if !modified.is_empty() {- md.push_str("\n### Modified\n");- for c in &modified {- let label = if c.title.is_empty() {- &c.item_id- } else {- &c.title- };- md.push_str(&format!("- {label}\n"));- if let Some(diff_text) = &c.text_diff {- md.push_str(" ```diff\n");- for line in diff_text.lines() {- md.push_str(&format!(" {line}\n"));- }- md.push_str(" ```\n");- }- }- }-- if !removed.is_empty() {- md.push_str("\n### Removed\n");- for c in &removed {- let label = if c.title.is_empty() {- &c.item_id- } else {- &c.title- };- md.push_str(&format!("- {label}\n"));- }- }-- if diff.changes.is_empty() {- md.push_str("\nNo changes detected.\n");- }-- md-}--fn format_cross_source_diff(diff: &CrossSourceDiff) -> String {- let mut md = format!(- "## Cross-Source Memory Changes\n\n\- **Total: {} added, {} modified, {} removed** ({} unchanged)\n",- diff.summary.added, diff.summary.modified, diff.summary.removed, diff.summary.unchanged,- );-- if diff.per_source.is_empty() {- md.push_str("\nNo changes across any source since the checkpoint.\n");- return md;- }-- for source_diff in &diff.per_source {- md.push_str(&format!(- "\n### {} ({})\n",- source_diff.source_label, source_diff.source_kind- ));- md.push_str(&format!(- "{} added, {} modified, {} removed\n",- source_diff.summary.added, source_diff.summary.modified, source_diff.summary.removed,- ));- for c in &source_diff.changes {- let label = if c.title.is_empty() {- &c.item_id- } else {- &c.title- };- let prefix = match c.kind {- ChangeKind::Added => "+",- ChangeKind::Modified => "~",- ChangeKind::Removed => "-",- };- md.push_str(&format!(" {prefix} {label}\n"));- }- }-- md-}--#[cfg(test)]-mod tests {- use super::*;-- fn change(item_id: &str, title: &str, kind: ChangeKind, text_diff: Option<&str>) -> ItemChange {- ItemChange {- item_id: item_id.to_string(),- title: title.to_string(),- kind,- old_content_hash: None,- new_content_hash: None,- text_diff: text_diff.map(str::to_string),- }- }-- #[test]- fn format_diff_result_groups_changes_and_renders_text_diff() {- let diff = DiffResult {- source_id: "src_a".into(),- source_kind: "folder".into(),- source_label: "Docs".into(),- from_snapshot_id: Some("s1".into()),- to_snapshot_id: "s2".into(),- summary: DiffSummary {- added: 1,- removed: 1,- modified: 1,- unchanged: 2,- },- changes: vec![- change("new.md", "New Doc", ChangeKind::Added, None),- change(- "edit.md",- "Edited Doc",- ChangeKind::Modified,- Some("@@ -1 +1 @@\n-old\n+new"),- ),- // Empty title falls back to the item id.- change("gone.md", "", ChangeKind::Removed, None),- ],- };-- let md = format_diff_result(&diff);- assert!(md.contains("1 added, 1 modified, 1 removed"));- assert!(md.contains("### Added\n- New Doc"));- assert!(md.contains("### Modified\n- Edited Doc"));- assert!(md.contains("```diff"), "text diff should be fenced: {md}");- assert!(md.contains("+new"));- assert!(- md.contains("### Removed\n- gone.md"),- "title falls back to id"- );- }-- #[test]- fn format_diff_result_reports_no_changes() {- let diff = DiffResult {- source_id: "src_a".into(),- source_kind: "folder".into(),- source_label: "Docs".into(),- from_snapshot_id: Some("s1".into()),- to_snapshot_id: "s2".into(),- summary: DiffSummary::default(),- changes: vec![],- };- assert!(format_diff_result(&diff).contains("No changes detected."));- }-- #[test]- fn format_cross_source_diff_breaks_down_per_source() {- let cross = CrossSourceDiff {- checkpoint_id: Some("ckpt_1".into()),- computed_at_ms: 0,- summary: DiffSummary {- added: 1,- modified: 0,- removed: 0,- unchanged: 0,- },- per_source: vec![DiffResult {- source_id: "src_a".into(),- source_kind: "folder".into(),- source_label: "Docs".into(),- from_snapshot_id: Some("s1".into()),- to_snapshot_id: "s2".into(),- summary: DiffSummary {- added: 1,- ..Default::default()- },- changes: vec![change("new.md", "New Doc", ChangeKind::Added, None)],- }],- };- let md = format_cross_source_diff(&cross);- assert!(md.contains("Total: 1 added"));- assert!(md.contains("### Docs (folder)"));- assert!(md.contains("+ New Doc"));- }-- #[test]- fn format_cross_source_diff_empty_is_explicit() {- let cross = CrossSourceDiff {- checkpoint_id: Some("ckpt_1".into()),- computed_at_ms: 0,- summary: DiffSummary::default(),- per_source: vec![],- };- assert!(format_cross_source_diff(&cross).contains("No changes across any source"));- }-}diff --git a/tests/memory_artifacts_e2e.rs b/tests/memory_artifacts_e2e.rsdeleted file mode 100644index 6202ed9b01..0000000000--- a/tests/memory_artifacts_e2e.rs+++ /dev/null@@ -1,245 +0,0 @@-//! Integration coverage for on-disk memory artifacts.-//!-//! Uses a real Slack ingest to create raw/source artifacts, then stages a-//! mocked summary record to verify the Obsidian-compatible vault layout and-//! frontmatter contract without requiring a live summarizer model.--use std::sync::{Arc, OnceLock};-use tempfile::tempdir;--use chrono::{TimeZone, Utc};--use openhuman_core::openhuman::config::Config;-use openhuman_core::openhuman::memory::tree::ingest::{ingest_summary, SummaryIngestInput};-use tinycortex::memory::ingest::canonicalize::chat::{ChatBatch, ChatMessage};-use tinymemory_core::ingest_pipeline::ingest_chat;-use tinymemory_core::queue::drain_until_idle;-use tinymemory_core::store::content::atomic::stage_summary;-use tinymemory_core::store::content::obsidian::ensure_obsidian_defaults;-use tinymemory_core::store::content::raw::{write_raw_items, RawItem, RawKind};-use tinymemory_core::store::content::wiki_git::{get_read_pointer_tag, set_read_pointer_tag};-use tinymemory_core::store::content::{SummaryComposeInput, SummaryTreeKind};-use tinymemory_core::tree_source::registry::get_or_create_source_tree;--static MEMORY_SEAMS_INIT: OnceLock<()> = OnceLock::new();--fn ensure_memory_seams() {- MEMORY_SEAMS_INIT.get_or_init(|| {- std::thread::Builder::new()- .name("memory-artifacts-e2e-seams".to_string())- .stack_size(8 * 1024 * 1024)- .spawn(|| {- openhuman_core::openhuman::memory::host_impls::install_memory_host_seams(Arc::new(- Config::default(),- ));- })- .expect("spawn memory artifact seam installer")- .join()- .expect("memory artifact seam installer panicked");- });-}--fn make_config(workspace_dir: &std::path::Path) -> Config {- ensure_memory_seams();- let mut config = Config::default();- config.workspace_dir = workspace_dir.to_path_buf();- config.config_path = workspace_dir.join("config.toml");- config.embeddings_provider = Some("none".to_string());- config-}--#[tokio::test]-async fn sync_raw_artifacts_and_mocked_summary_match_obsidian_contract() {- let tmp = tempdir().expect("tempdir");- let workspace_dir = tmp.path().join("workspace");- std::fs::create_dir_all(&workspace_dir).expect("workspace dir");- let config = make_config(&workspace_dir);-- let ts = Utc.timestamp_opt(1_700_000_000, 0).single().unwrap();- write_raw_items(- &config.memory_tree_content_root(),- "slack:conn-slack-1",- &[RawItem {- uid: "1700000000.000100",- created_at_ms: ts.timestamp_millis(),- markdown: "**Channel:** #engineering\n**Author:** alice\n\nPhoenix migration launch window is Friday at 22:00 UTC.",- kind: RawKind::Chat,- }],- )- .expect("seed raw Slack artifact");- let batch = ChatBatch {- platform: "slack".into(),- channel_label: "#engineering".into(),- messages: vec![ChatMessage {- author: "alice".into(),- timestamp: ts,- text: "Phoenix migration launch window is Friday at 22:00 UTC.".into(),- source_ref: Some("https://slack.example.test/archives/C123/p1700000000000100".into()),- }],- };- ingest_chat(- &config,- "slack:conn-slack-1",- "alice",- vec!["slack".into(), "ingested".into()],- batch,- )- .await- .expect("seed slack sync");- drain_until_idle(&config).await.expect("drain sync jobs");-- let content_root = config.memory_tree_content_root();- let raw_file = content_root- .join("raw")- .join("slack-conn-slack-1")- .join("chats")- .join("1700000000000_1700000000.000100.md");- let source_file = content_root- .join("raw")- .join("slack-conn-slack-1")- .join("_source.md");- assert!(raw_file.exists(), "expected raw markdown artifact");- assert!(source_file.exists(), "expected source registry mirror");-- let raw_body = std::fs::read_to_string(&raw_file).expect("read raw artifact");- assert!(raw_body.contains("**Channel:** #engineering"));- assert!(raw_body.contains("**Author:** alice"));- assert!(raw_body.contains("Phoenix migration launch window"));-- ensure_obsidian_defaults(&content_root).expect("stage obsidian defaults");-- let sealed_at = Utc.with_ymd_and_hms(2026, 5, 24, 22, 0, 0).unwrap();- let child_ids = vec!["chunk-1".to_string()];- let child_basenames = vec![Some("1700000000000_1700000000.000100".to_string())];- let staged = stage_summary(- &content_root,- &SummaryComposeInput {- summary_id: "summary:1760000000000:L1-phoenix-window",- tree_kind: SummaryTreeKind::Source,- tree_id: "source:slack",- tree_scope: "slack:conn-slack-1",- level: 1,- child_ids: &child_ids,- child_basenames: Some(&child_basenames),- child_count: 1,- time_range_start: ts,- time_range_end: ts,- sealed_at,- body: "Phoenix migration launch window confirmed for Friday 22:00 UTC.",- },- "slack-conn-slack-1",- )- .expect("stage mocked summary");-- let summary_path = content_root.join(&staged.content_path);- assert!(summary_path.exists(), "summary markdown should be written");- let summary_body = std::fs::read_to_string(&summary_path).expect("read summary markdown");- assert!(summary_body.contains("tree_kind: source"));- assert!(summary_body.contains("tree_scope: \"slack:conn-slack-1\""));- assert!(summary_body.contains("time_range_start: 2023-11-14T22:13:20+00:00"));- assert!(summary_body.contains("time_range_end: 2023-11-14T22:13:20+00:00"));- assert!(summary_body.contains("sealed_at: 2026-05-24T22:00:00+00:00"));- assert!(summary_body.contains("[[1700000000000_1700000000.000100]]"));-- let graph_json = content_root.join(".obsidian").join("graph.json");- let types_json = content_root.join(".obsidian").join("types.json");- assert!(graph_json.exists(), "graph defaults should exist");- assert!(types_json.exists(), "type hints should exist");- let types_body = std::fs::read_to_string(types_json).expect("read types.json");- assert!(types_body.contains("\"time_range_start\": \"date\""));- assert!(types_body.contains("\"sealed_at\": \"datetime\""));-}--#[tokio::test]-async fn summary_ingest_records_summary_only_git_history_and_timestamped_read_tags() {- let tmp = tempdir().expect("tempdir");- let workspace_dir = tmp.path().join("workspace");- std::fs::create_dir_all(&workspace_dir).expect("workspace dir");- let config = make_config(&workspace_dir);- let content_root = config.memory_tree_content_root();- let raw_path = content_root.join("wiki/raw/not-tracked.md");- std::fs::create_dir_all(raw_path.parent().unwrap()).expect("raw dir");- std::fs::write(&raw_path, "should stay out of git history").expect("seed raw file");-- let tree = get_or_create_source_tree(&config, "github:tinyhumansai/openhuman")- .expect("create source tree");- let start = Utc.with_ymd_and_hms(2026, 6, 26, 9, 0, 0).unwrap();- let end = Utc.with_ymd_and_hms(2026, 6, 26, 9, 30, 0).unwrap();- let outcome = ingest_summary(- &config,- &tree,- SummaryIngestInput {- content: "Memory wiki git history now records summary-node seals.".to_string(),- token_count: 64,- entities: Vec::new(),- topics: vec!["memory".to_string()],- time_range_start: start,- time_range_end: end,- score: 0.8,- child_labels: vec!["commit:abc123".to_string(), "issue:4142".to_string()],- child_basenames: Vec::new(),- },- )- .await- .expect("ingest summary");-- let wiki_root = content_root.join("wiki");- // Through tinycortex's re-export, not a `git2` dependency of this crate:- // tinycortex writes this ledger and owns the only libgit2 link in the- // graph, so the assertion reads it back with the very same binding.- let repo = tinycortex::git2::Repository::open(&wiki_root)- .expect("wiki git repo should be initialized");- let head = repo.head().expect("wiki head").peel_to_commit().unwrap();- let tree_obj = head.tree().expect("wiki commit tree");-- let repo_summary_path = outcome- .content_path- .strip_prefix("wiki/")- .expect("summary path should live under wiki/");- tree_obj- .get_path(std::path::Path::new(repo_summary_path))- .expect("summary markdown should be tracked");- assert!(- tree_obj- .get_path(std::path::Path::new("raw/not-tracked.md"))- .is_err(),- "git history should remain scoped to summaries"- );-- let message = head.message().expect("commit message");- assert!(message.contains("Seal memory tree github:tinyhumansai/openhuman L1 summaries"));- assert!(message.contains("Reason: summary_ingest"));- assert!(message.contains("Summary-Count: 1"));- assert!(message.contains("Child-Count: 2"));- assert!(message.contains("Token-Count: 64"));- assert!(message.contains(&outcome.summary_id));- assert!(message.contains(repo_summary_path));-- let head_id = head.id().to_string();- let tagged = set_read_pointer_tag(&content_root, "agent:e2e", None)- .expect("set timestamped read pointer tag");- assert_eq!(tagged, head_id);- assert_eq!(- get_read_pointer_tag(&content_root, "agent:e2e")- .expect("read latest pointer")- .as_deref(),- Some(head_id.as_str())- );-- let tag_prefix = format!("refs/tags/read/{}/", hex::encode("agent:e2e".as_bytes()));- let tags = repo.references().unwrap().fold(Vec::new(), |mut acc, r| {- let r = r.unwrap();- let name = r.name().unwrap();- if name.starts_with(&tag_prefix) {- acc.push(name.to_string());- }- acc- });- assert!(tags.iter().any(|name| name.ends_with("/latest")));- assert!(tags.iter().any(|name| {- let suffix = name.strip_prefix(&tag_prefix).unwrap_or_default();- suffix.len() == "20260626T090000.000000000Z".len()- && suffix.ends_with('Z')- && suffix.contains('T')- }));-}