Skip to main content

Crate vtcode_memory

Crate vtcode_memory 

Source
Expand description

Unified per-session state store for VT Code.

This crate is the single source of truth for an agent session’s state, context, and history. Each session is persisted under .vtcode/sessions/<session_id>/ as:

  • events.jsonl — the canonical append-only ThreadEvent log (schema-versioned). Everything else is derived from this.
  • manifest.json — session metadata and counters.
  • index/turns.json — byte-offset index enabling O(1) turn reconstruction.
  • derived/ — regenerated views (trajectory.jsonl, memory.json, …).

The store is intentionally append-only and off the agent’s hot path: the live conversation stays in memory and is never reloaded from disk into context. Reads happen only for revert, compaction, analytics, and long-term-learning queries.

Re-exports§

pub use error::SessionStoreError;
pub use event_log::DEFAULT_MAX_EVENTS;
pub use event_log::SessionEventLog;
pub use event_log::SessionManifest;
pub use event_log::TurnIndex;
pub use event_log::TurnIndexEntry;
pub use migration::MigrationReport;
pub use migration::migrate_legacy;
pub use progress::GoalClassifierVerdict;
pub use progress::GoalEvent;
pub use progress::GoalHistoryEntry;
pub use progress::GoalOrchestration;
pub use progress::GoalPauseReason;
pub use progress::GoalPhase;
pub use progress::GoalStatus;
pub use progress::GoalTracker;
pub use progress::Milestone;
pub use progress::MilestoneStatus;
pub use progress::ProgressLedger;
pub use progress::load_progress;
pub use progress::progress_path;
pub use progress::save_progress;
pub use query::FactRecord;
pub use query::MemorySearchResult;
pub use query::SessionSummary;
pub use query::query_facts;
pub use query::recent_sessions;
pub use query::search_memory;
pub use retention::RetentionPolicy;
pub use retention::apply_retention;
pub use retention::apply_retention_preserving;
pub use retention::gc_legacy;

Modules§

error
Error type for the session store.
event_log
Append-only per-session ThreadEvent log plus index and manifest.
manifest
Manifest and turn-index persistence helpers.
migration
One-off migration of the legacy, overlapping history stores into the unified per-session store.
progress
Durable, compaction-safe progress ledger.
query
Read-only queries across sessions for analytics and long-term learning.
retention
Retention and garbage-collection for the unified session store.

Functions§

open
Open (creating if necessary) the event log for a session.
session_directory
Return the canonical directory for a session.