Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(resume): preserve legacy Claude project dirs

cyhe56ebedcf23e
diff --git a/modules/agents/native_sessions/claude.py b/modules/agents/native_sessions/claude.py
index 829c6281b..ff3ca7950 100644
--- a/modules/agents/native_sessions/claude.py
+++ b/modules/agents/native_sessions/claude.py
@@ -28,6 +28,10 @@ def encode_project_path(working_path: str) -> str:
return re.sub(r"[^A-Za-z0-9]", "-", working_path)
+def _legacy_project_path(working_path: str) -> str:
+ return working_path.replace("/", "-")
+
+
class ClaudeNativeSessionProvider(NativeSessionProvider):
agent_name = "claude"
@@ -41,7 +45,10 @@ class ClaudeNativeSessionProvider(NativeSessionProvider):
@staticmethod
def _candidate_project_names(working_path: str) -> set[str]:
collapsed = re.sub(r"[^A-Za-z0-9]+", "-", working_path).strip("-")
+ legacy = _legacy_project_path(working_path)
names: set[str] = {
+ legacy,
+ legacy.replace("_", "-"),
encode_project_path(working_path),
encode_project_path(working_path).replace("_", "-"),
}
diff --git a/tests/test_native_session_providers.py b/tests/test_native_session_providers.py
index 6eacfd8b7..7d6488a14 100644
--- a/tests/test_native_session_providers.py
+++ b/tests/test_native_session_providers.py
@@ -76,6 +76,32 @@ def test_claude_provider_scans_candidate_jsonl_when_history_has_results(tmp_path
assert {item.native_session_id for item in items} == {"sess_history", "sess_sdk"}
+def test_claude_provider_keeps_legacy_slash_only_project_dir(tmp_path: Path) -> None:
+ projects_root = tmp_path / "projects"
+ history_path = tmp_path / "history.jsonl"
+ projects_root.mkdir(parents=True, exist_ok=True)
+ history_path.write_text("", encoding="utf-8")
+
+ working_path = "/Users/cyh/my.repo"
+ legacy_dir = projects_root / working_path.replace("/", "-")
+ legacy_dir.mkdir(parents=True, exist_ok=True)
+ (legacy_dir / "sess_legacy.jsonl").write_text(
+ "\n".join(
+ [
+ '{"type":"user","timestamp":"2026-03-27T09:59:00Z","cwd":"/Users/cyh/my.repo","message":{"content":"legacy prompt"}}',
+ '{"type":"assistant","timestamp":"2026-03-27T10:00:00Z","message":{"content":"legacy reply"}}',
+ ]
+ ),
+ encoding="utf-8",
+ )
+
+ provider = ClaudeNativeSessionProvider(root=str(projects_root), history_path=str(history_path))
+
+ items = provider.list_metadata(working_path)
+
+ assert [item.native_session_id for item in items] == ["sess_legacy"]
+
+
def test_claude_provider_does_not_scan_unrelated_project_jsonl(tmp_path: Path, monkeypatch) -> None:
projects_root = tmp_path / "projects"
history_path = tmp_path / "history.jsonl"