Add configurable memory versions with isolated storage (#43797)

## What changed

- Add `memories.version` with `v1` as the default and `v2` as an opt-in selection.
- Route memory generation, summaries, and retrieval tools through the selected version. Store `v2` artifacts in `memories_v2` and lazily create a separate SQLite database, keeping jobs and outputs isolated while sharing the thread catalog.
- Preserve the initial memory version across extension config updates so summaries and retrieval tools use the same namespace.
- Clear both versions on memory reset and remove thread memory from both stores on thread deletion. Recognize both artifact roots in shell usage telemetry.

## Testing

Add regression coverage for version defaults and validation, independent job claims and outputs, deletion and reset across versions, and shell usage classification for both memory roots.

GitOrigin-RevId: aa799bf87ab6ec10c8f5668213931e57547d080b
This commit is contained in:
jif
2026-09-08 10:55:48 +00:00
committed by copyberry
parent 35d9e4bc4d
commit 3f76e88a48
27 changed files with 422 additions and 119 deletions
+2
View File
@@ -32,6 +32,8 @@ pub mod mcp;
pub mod mcp_approval_meta;
pub mod mcp_policy;
pub mod memory_citation;
mod memory_version;
pub use memory_version::MemoryVersion;
pub mod models;
pub mod network_policy;
pub mod num_format;
+23
View File
@@ -0,0 +1,23 @@
//! Selects a coherent memory pipeline and its generated-artifact namespace.
use schemars::JsonSchema;
use serde::Deserialize;
use serde::Serialize;
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "lowercase")]
pub enum MemoryVersion {
#[default]
V1,
V2,
}
impl MemoryVersion {
/// Sibling roots keep v1 cleanup and rollback independent of v2 artifacts.
pub fn directory_name(self) -> &'static str {
match self {
Self::V1 => "memories",
Self::V2 => "memories_v2",
}
}
}