Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(agent evolution): snapshot complete experience directory on session commit (#3646)

agentbed5a0231aee
diff --git a/crates/ragfs/src/git/service.rs b/crates/ragfs/src/git/service.rs
index 3b583f745..6d4d6a9e1 100644
--- a/crates/ragfs/src/git/service.rs
+++ b/crates/ragfs/src/git/service.rs
@@ -106,16 +106,16 @@ impl GitService {
/// account's VFS subtree.
///
/// - If `paths` is `Some`, only those account-relative paths are
- /// considered (each is still pruned via `enumerate::prune_path`).
+ /// considered. Directories are expanded recursively.
/// - If `paths` is `None`, the full `/local/{account}` subtree is
/// enumerated via `enumerate::collect_all`.
///
/// On no-op (no editor change) the branch ref is untouched and
/// `CommitResponse::Noop` is returned.
///
- /// When `paths` is `Some(...)`, every listed path must refer to a file in
- /// the VFS. To commit a subtree, list each file explicitly or omit `paths`
- /// for full enumeration.
+ /// Entries in `paths` may identify files, directories, or paths deleted
+ /// since the previous snapshot. Directories are expanded recursively;
+ /// missing entries remove matching files/subtrees from the snapshot.
///
/// On a CAS conflict, returns `GitError::ConcurrentCommit` so the
/// caller can decide whether to retry. There is intentionally no
diff --git a/openviking/session/compressor_v3.py b/openviking/session/compressor_v3.py
index 7838d16eb..abb24b2ee 100644
--- a/openviking/session/compressor_v3.py
+++ b/openviking/session/compressor_v3.py
@@ -104,13 +104,13 @@ async def _commit_experience_snapshot(
commit = getattr(viking_fs, "commit", None)
if not callable(commit):
return
- paths = [
- uri
+ has_experience_changes = any(
+ "/memories/experiences/" in uri and uri.endswith(".md")
for uri in dict.fromkeys(str(uri or "") for uri in experience_uris)
- if "/memories/experiences/" in uri and uri.endswith(".md")
- ]
- if not paths:
+ )
+ if not has_experience_changes:
return
+ paths = [_experience_root_uri(ctx)]
archive_ref = archive_uri.rstrip("/") if archive_uri else "unknown"
try:
await commit(
diff --git a/tests/session/test_compressor_v3.py b/tests/session/test_compressor_v3.py
index fff4ffbe6..7aac39720 100644
--- a/tests/session/test_compressor_v3.py
+++ b/tests/session/test_compressor_v3.py
@@ -1499,7 +1499,7 @@ async def test_v3_training_links_case_to_trajectory_and_experience_via_trajector
"Update experience memories from session commit "
"viking://user/u/sessions/session-1/history/archive_001"
),
- "paths": [exp_uri, deleted_exp_uri],
+ "paths": ["viking://user/u/memories/experiences"],
"ctx": _ctx(),
}
]