Skip to content

armgit / Wake

Public Imported from GitHub
0

All your AI agent sessions in one place — browse, search, resume. Rust + GPUI.

Rust

fix(claude): know the bookkeeping records Claude Code 2.1 writes

Corey Chiu29d0d24e8020
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6c8738d..a8d03dc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@
- Fix: Codex sessions that Codex has compressed show up again, with their titles and archived status (#72, thanks @suiyun08)
- Fix: Sessions recorded by older Codex versions show their messages and titles instead of appearing empty
-- Fix: Clean Up no longer refuses Codex sessions written by recent versions
+- Fix: Clean Up no longer refuses Codex and Claude Code sessions written by recent versions
- Fix: Open In → iTerm resumes the session in a new iTerm window instead of failing with an AppleScript error (#73, thanks @quintus-lab)
- Fix: Conversations from the Antigravity CLI show their full messages, not just a summary (#71, thanks @dingtwo)
diff --git a/crates/wake-core/src/adapters/claude.rs b/crates/wake-core/src/adapters/claude.rs
index 87ccf19..ea9b80a 100644
--- a/crates/wake-core/src/adapters/claude.rs
+++ b/crates/wake-core/src/adapters/claude.rs
@@ -26,6 +26,17 @@ const KNOWN_SKIP_TYPES: &[&str] = &[
"atis-latch",
// Bridge connection bookkeeping, not transcript content.
"bridge-session",
+ // 2.1 起的记账记录:会话名(改名或自动起名时与 custom-title / ai-title 一起写、同值,
+ // 不另当标题)、累计费用、请求元数据与按哈希去重存放的请求内容
+ "agent-name",
+ "cost-state",
+ "api-request",
+ "api-request-blob",
+ "api-request-shape",
+ // EnterWorktree 进出 worktree 时记下的工作目录。项目仍按会话起始的目录归:worktree
+ // 用完就删,恢复时 Claude Code 自己按 worktree-state 回到 worktree
+ "relocated",
+ "worktree-state",
];
pub struct ClaudeAdapter {
diff --git a/crates/wake-core/tests/adapter_contracts.rs b/crates/wake-core/tests/adapter_contracts.rs
index f441ad7..2746f05 100644
--- a/crates/wake-core/tests/adapter_contracts.rs
+++ b/crates/wake-core/tests/adapter_contracts.rs
@@ -506,7 +506,7 @@ fn claude_parse_contract() {
.parse_transcript(&r)
.expect("claude parse_transcript");
- // 标题=最后一条 custom-title,压过首条用户消息推导
+ // 标题=最后一条 custom-title,压过首条用户消息推导(agent-name 的会话名不当标题)
assert_eq!(s.meta.title, "QR login revamp");
assert_eq!(s.meta.project_path, "/Users/tester/Github/wakefx");
assert_eq!(s.meta.project_name, "wakefx");
@@ -516,7 +516,8 @@ fn claude_parse_contract() {
assert_eq!(s.meta.message_count, 3);
assert_eq!(s.meta.created_at, ms("2026-08-01T09:59:00Z"));
assert_eq!(s.meta.updated_at, ms("2026-08-01T10:02:00Z"));
- // "wibble-experimental" 计 unknown;summary / atis-latch / bridge-session 不计
+ // "wibble-experimental" 计 unknown;summary / atis-latch / bridge-session 与 2.1 起的 agent-name /
+ // cost-state / api-request* / relocated / worktree-state 不计——项目也不随 relocated 去 worktree
assert_eq!(s.unknown_line_count, 1);
assert_eq!(t.unknown_line_count, 1);
diff --git a/crates/wake-core/tests/fixtures/claude/projects/-Users-tester-Github-wakefx/11111111-aaaa-bbbb-cccc-000000000001.jsonl b/crates/wake-core/tests/fixtures/claude/projects/-Users-tester-Github-wakefx/11111111-aaaa-bbbb-cccc-000000000001.jsonl
index e4124ed..a0d1fa1 100644
--- a/crates/wake-core/tests/fixtures/claude/projects/-Users-tester-Github-wakefx/11111111-aaaa-bbbb-cccc-000000000001.jsonl
+++ b/crates/wake-core/tests/fixtures/claude/projects/-Users-tester-Github-wakefx/11111111-aaaa-bbbb-cccc-000000000001.jsonl
@@ -10,3 +10,10 @@
{"type":"wibble-experimental","payload":{"note":"unknown line type, must be counted"}}
{"type":"atis-latch","sessionId":"11111111-aaaa-bbbb-cccc-000000000001","atis":true}
{"type":"bridge-session","sessionId":"11111111-aaaa-bbbb-cccc-000000000001","bridgeSessionId":"bridge-fixture","lastSequenceNum":42,"ownerAccountUuid":"account-fixture","ownerOrganizationUuid":"organization-fixture"}
+{"type":"agent-name","agentName":"Desktop agent name is not a title","sessionId":"11111111-aaaa-bbbb-cccc-000000000001"}
+{"type":"cost-state","totalCostUSD":0.42,"modelUsage":{},"totalAPIDuration":1200,"sessionId":"11111111-aaaa-bbbb-cccc-000000000001"}
+{"type":"api-request","id":"req-fixture","params":{"model":"claude-fixture"},"shapeHash":"shape-fixture","sessionId":"11111111-aaaa-bbbb-cccc-000000000001"}
+{"type":"api-request-blob","hash":"blob-fixture","message":{"role":"user","content":[{"type":"text","text":"request blob, not a turn"}]},"sessionId":"11111111-aaaa-bbbb-cccc-000000000001"}
+{"type":"api-request-shape","shapeHash":"shape-fixture","shape":{"system":[],"tools":[]},"sessionId":"11111111-aaaa-bbbb-cccc-000000000001"}
+{"type":"relocated","relocatedCwd":"/Users/tester/Github/wakefx/.claude/worktrees/fixture","sessionId":"11111111-aaaa-bbbb-cccc-000000000001"}
+{"type":"worktree-state","worktreeSession":{"originalCwd":"/Users/tester/Github/wakefx","worktreePath":"/Users/tester/Github/wakefx/.claude/worktrees/fixture","worktreeBranch":"claude/fixture"},"sessionId":"11111111-aaaa-bbbb-cccc-000000000001"}