Skip to main content

Crate vtcode_session_store

Crate vtcode_session_store 

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::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::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::SessionSummary;
pub use query::query_facts;
pub use query::recent_sessions;
pub use retention::RetentionPolicy;
pub use retention::apply_retention;
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.
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.

Constants§

DERIVED_DIR
Sub-directory inside a session holding regenerated views.
SESSIONS_DIR
Directory (relative to the workspace) holding all per-session stores.
SESSION_STORE_SCHEMA_VERSION
Schema version for the on-disk session store layout.

Functions§

open
Open (creating if necessary) the event log for a session.
session_dir
Resolve the directory for a single session.
sessions_root
Resolve the sessions root directory for a workspace.