usagebench 0.2.0 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +45 -5
  2. package/dist/anon.js +3 -2
  3. package/dist/audit.js +132 -73
  4. package/dist/cli.js +24 -4
  5. package/dist/compare.d.ts +2 -2
  6. package/dist/compare.js +19 -8
  7. package/dist/diff.js +9 -3
  8. package/dist/doctor.js +54 -4
  9. package/dist/index.d.ts +2 -0
  10. package/dist/index.js +17 -7
  11. package/dist/logs.js +20 -3
  12. package/dist/repro.js +6 -1
  13. package/dist/secrets.js +2 -2
  14. package/fixtures/claude/2.1.321_compaction-zeroed-usage.continued.expected.json +21 -0
  15. package/fixtures/claude/2.1.321_compaction-zeroed-usage.continued.jsonl +3 -0
  16. package/fixtures/claude/2.1.321_compaction-zeroed-usage.original.expected.json +21 -0
  17. package/fixtures/claude/2.1.321_compaction-zeroed-usage.original.jsonl +2 -0
  18. package/fixtures/claude/2.1.334_main.expected.json +21 -21
  19. package/fixtures/claude/2.1.334_main.jsonl +162 -162
  20. package/fixtures/claude/2.1.335_sidechain.expected.json +21 -21
  21. package/fixtures/claude/2.1.335_sidechain.jsonl +60 -60
  22. package/fixtures/claude/2.1.335_stream-abort-tool-error.expected.json +21 -21
  23. package/fixtures/claude/2.1.335_stream-abort-tool-error.jsonl +200 -200
  24. package/fixtures/claude/synthetic_duplicate-id-partial-usage.expected.json +22 -22
  25. package/fixtures/codex/0.160.0_compacted.expected.json +38 -38
  26. package/fixtures/codex/0.160.0_compacted.jsonl +200 -200
  27. package/fixtures/codex/0.171.0-alpha.13.2_subagent-forked.expected.json +38 -38
  28. package/fixtures/codex/0.171.0-alpha.13.2_subagent-forked.jsonl +154 -154
  29. package/fixtures/codex/0.173.0-alpha.4.1_basic.expected.json +38 -38
  30. package/fixtures/codex/0.173.0-alpha.4.1_basic.jsonl +200 -200
  31. package/fixtures/codex/synthetic_total-reset.expected.json +39 -39
  32. package/package.json +16 -2
package/dist/doctor.js CHANGED
@@ -1,8 +1,10 @@
1
1
  // `usagebench doctor`: how much would a naive tracker overcount on this machine's own logs?
2
2
  // Read-only, offline. Prints counts and ratios only: no log content, no paths below the log root.
3
+ import { existsSync, readFileSync } from "node:fs";
3
4
  import { homedir } from "node:os";
5
+ import { join } from "node:path";
4
6
  import { logFiles, logRoots, parseLenient, progress, readText } from "./logs.js";
5
- import { usage } from "./index.js";
7
+ import { usage, zeroedTop } from "./index.js";
6
8
  const F = ["input", "output", "cache_write", "cache_read", "reasoning"];
7
9
  const zero = () => ({ input: 0, output: 0, cache_write: 0, cache_read: 0, reasoning: 0 });
8
10
  const add = (a, b) => { for (const k of F)
@@ -14,7 +16,9 @@ const fmt = (n) => n.toLocaleString("en-US");
14
16
  function scanAgent(agent, files, tick) {
15
17
  const s = { files: 0, skipped: 0, bad: 0, naive: zero(), dedup: zero(), extra: {} };
16
18
  const claudeLast = new Map();
17
- let usageLines = 0, repeated = 0, compactedSessions = 0, tcEvents = 0, tcReemit = 0, sessions = 0;
19
+ let usageLines = 0, repeated = 0, zeroedCopies = 0, compactedSessions = 0, tcEvents = 0, tcReemit = 0, sessions = 0;
20
+ let sideRows = 0, sideFiles = 0;
21
+ const serverToolMsgs = new Set();
18
22
  const tc = { naive: zero(), dedup: zero() };
19
23
  for (const f of files) {
20
24
  tick();
@@ -27,12 +31,31 @@ function scanAgent(agent, files, tick) {
27
31
  const { records, bad } = parseLenient(agent, text);
28
32
  s.bad += bad;
29
33
  if (agent === "claude") {
34
+ // compact JSON as Claude Code writes it; inside a string these would be escaped (\"), so text never matches
35
+ const side = text.split('"isSidechain":true').length - 1;
36
+ sideRows += side;
37
+ if (side || f.rel.includes("/subagents/"))
38
+ sideFiles++;
39
+ if (text.includes('"type":"server_tool_use"') || text.includes('"type":"web_search_tool_result"'))
40
+ for (const l of text.split("\n")) {
41
+ if (!/"type":"(?:server_tool_use|web_search_tool_result)"/.test(l))
42
+ continue;
43
+ try {
44
+ const o = JSON.parse(l), c = o?.message?.content;
45
+ if (o?.type === "assistant" && Array.isArray(c) && c.some((b) => b?.type === "server_tool_use" || b?.type === "web_search_tool_result"))
46
+ serverToolMsgs.add(String(o.message.id ?? o.uuid));
47
+ }
48
+ catch { /* counted as invalid elsewhere */ }
49
+ }
30
50
  for (const r of records) {
31
51
  const k = JSON.stringify([r.session_id, r.message_id]);
32
52
  usageLines++;
33
53
  if (claudeLast.has(k))
34
54
  repeated++;
35
- claudeLast.set(k, r);
55
+ if (r.zeroed_copy)
56
+ zeroedCopies++;
57
+ if (!zeroedTop(r.tokens))
58
+ claudeLast.set(k, r);
36
59
  for (const x of F)
37
60
  s.naive[x] += r.tokens[x] ?? 0;
38
61
  }
@@ -55,7 +78,7 @@ function scanAgent(agent, files, tick) {
55
78
  for (const r of claudeLast.values())
56
79
  for (const x of F)
57
80
  s.dedup[x] += r.tokens[x] ?? 0;
58
- s.extra = { usageLines, repeated };
81
+ s.extra = { usageLines, repeated, zeroedCopies, sideRows, sideFiles, serverToolMsgs: serverToolMsgs.size };
59
82
  }
60
83
  else {
61
84
  s.extra = { sessions, compactedSessions, tcEvents, tcReemit };
@@ -63,6 +86,27 @@ function scanAgent(agent, files, tick) {
63
86
  }
64
87
  return s;
65
88
  }
89
+ // Claude Code deletes transcripts older than cleanupPeriodDays (default 30, by file mtime, silently) and rejects 0
90
+ // (code.claude.com/docs/en/settings-reference#cleanupperioddays). settings.json is only read.
91
+ function retention(files) {
92
+ const dirs = process.env.CLAUDE_CONFIG_DIR?.split(",").map((d) => d.trim()).filter(Boolean);
93
+ const vals = (dirs?.length ? dirs : [join(homedir(), ".claude")]).map((d) => join(d, "settings.json")).filter((p) => existsSync(p))
94
+ .map((p) => { try {
95
+ return JSON.parse(readFileSync(p, "utf8"))?.cleanupPeriodDays;
96
+ }
97
+ catch {
98
+ return undefined;
99
+ } });
100
+ if (vals.includes(0))
101
+ return [" WARNING: settings.json sets cleanupPeriodDays to 0. Current Claude Code rejects 0 (minimum 1); "
102
+ + "older versions stopped writing transcripts at all with it (anthropics/claude-code#23710)."];
103
+ if (vals.some((v) => v !== undefined))
104
+ return [];
105
+ const old = files.filter((f) => Date.now() - f.mtimeMs >= 25 * 86400_000).length;
106
+ return old ? [` NOTE: cleanupPeriodDays is not set (default 30): ${fmt(old)} transcript file(s) last modified 25+ days ago; `
107
+ + "Claude Code deletes them without a message once they pass 30 days (anthropics/claude-code#62250). "
108
+ + "Set a larger cleanupPeriodDays in settings.json to keep them."] : [];
109
+ }
66
110
  export function doctor() {
67
111
  const out = ["usagebench doctor: read-only, offline; counts and ratios only"];
68
112
  const all = { claude: logFiles("claude"), codex: logFiles("codex") };
@@ -86,6 +130,12 @@ export function doctor() {
86
130
  out.push(` usage lines: ${fmt(usageLines)}; repeating an earlier (sessionId, message.id): ${fmt(repeated)} (${pct(repeated, usageLines)})`);
87
131
  out.push(` naive vs dedup: output ${fmt(s.naive.output)} vs ${fmt(s.dedup.output)} (${ratio(s.naive.output, s.dedup.output)}), `
88
132
  + `cache_read ${fmt(s.naive.cache_read)} vs ${fmt(s.dedup.cache_read)} (${ratio(s.naive.cache_read, s.dedup.cache_read)})`);
133
+ out.push(` rows with all 4 top-level usage counters 0 but usage.cache_creation or usage.iterations[0] non-zero: `
134
+ + `${fmt(s.extra.zeroedCopies)} (see anthropics/claude-code#95555)`);
135
+ out.push(` sidechain (subagent) rows: ${fmt(s.extra.sideRows)}; files with isSidechain rows or under subagents/: ${fmt(s.extra.sideFiles)}`);
136
+ out.push(` assistant messages with server tool blocks (server_tool_use / web_search_tool_result): ${fmt(s.extra.serverToolMsgs)}`
137
+ + (s.extra.serverToolMsgs ? "; on the Claude API web searches are billed per search, outside the token fields (usage.server_tool_use.web_search_requests)" : ""));
138
+ out.push(...retention(all.claude));
89
139
  if (s.dedup.output)
90
140
  verdict.push(`Claude Code output by ${ratio(s.naive.output, s.dedup.output)}`);
91
141
  }
package/dist/index.d.ts CHANGED
@@ -23,6 +23,7 @@ export interface UsageRecord {
23
23
  source_line: number;
24
24
  raw_type: string;
25
25
  total_changed?: boolean;
26
+ zeroed_copy?: boolean;
26
27
  }
27
28
  export interface Totals {
28
29
  input: number;
@@ -39,6 +40,7 @@ export interface UsageOptions {
39
40
  dedup?: boolean;
40
41
  source?: "record" | "token_count";
41
42
  }
43
+ export declare const zeroedTop: (t: Tokens) => boolean;
42
44
  export declare function agentName(name: string): Agent;
43
45
  export declare function parse(agentIn: string, jsonlText: string, opts?: ParseOptions): UsageRecord[];
44
46
  export declare function usage(agentIn: string, records: UsageRecord[], opts?: UsageOptions): Totals;
package/dist/index.js CHANGED
@@ -5,6 +5,10 @@ const AGENT_NAMES = {
5
5
  claude: "claude", claude_code: "claude", codex: "codex", agy: "agy", gemini_antigravity: "agy",
6
6
  };
7
7
  const NORMALIZED = { claude: "claude_code", codex: "codex", agy: "gemini_antigravity" };
8
+ // A Claude usage row whose four top-level counters are all 0 bills nothing: a real response always has input or
9
+ // cache tokens. Such rows are copies (anthropics/claude-code#95555); dedup ignores them so they cannot replace
10
+ // the original row of the same message.
11
+ export const zeroedTop = (t) => !t.input && !t.output && !t.cache_write && !t.cache_read;
8
12
  export function agentName(name) {
9
13
  const a = AGENT_NAMES[name];
10
14
  if (!a)
@@ -55,15 +59,20 @@ export function parse(agentIn, jsonlText, opts = {}) {
55
59
  const u = m ? obj(m.usage) : null;
56
60
  if (!m || !u)
57
61
  continue;
58
- out.push({
59
- ...base(line, "assistant", {
60
- input: num(u.input_tokens), output: num(u.output_tokens), cache_write: num(u.cache_creation_input_tokens),
61
- cache_read: num(u.cache_read_input_tokens), reasoning: num(obj(u.output_tokens_details)?.thinking_tokens),
62
- }),
62
+ const tokens = {
63
+ input: num(u.input_tokens), output: num(u.output_tokens), cache_write: num(u.cache_creation_input_tokens),
64
+ cache_read: num(u.cache_read_input_tokens), reasoning: num(obj(u.output_tokens_details)?.thinking_tokens),
65
+ };
66
+ const nonzero = (v) => Object.values(obj(v) ?? {}).some((x) => typeof x === "number" && x > 0);
67
+ const rec = {
68
+ ...base(line, "assistant", tokens),
63
69
  agent_version: str(o.version), session_id: str(o.sessionId), message_id: str(m.id),
64
70
  parent_id: str(o.parentUuid), is_sidechain: o.isSidechain === true, timestamp: str(o.timestamp),
65
71
  model: str(m.model),
66
- });
72
+ };
73
+ if (zeroedTop(tokens) && (nonzero(u.cache_creation) || nonzero(Array.isArray(u.iterations) ? u.iterations[0] : null)))
74
+ rec.zeroed_copy = true;
75
+ out.push(rec);
67
76
  }
68
77
  else if (agent === "codex") {
69
78
  const p = obj(o.payload) ?? {};
@@ -151,7 +160,8 @@ export function usage(agentIn, records, opts = {}) {
151
160
  return sum(records);
152
161
  const last = new Map();
153
162
  for (const r of records)
154
- last.set(JSON.stringify([r.session_id, r.message_id]), r);
163
+ if (!zeroedTop(r.tokens))
164
+ last.set(JSON.stringify([r.session_id, r.message_id]), r);
155
165
  return sum([...last.values()]);
156
166
  }
157
167
  // agy: PLANNER_RESPONSE tokens are per call; other records with token fields (CHECKPOINT) are summaries.
package/dist/logs.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Defaults (same on Windows, macOS and Linux, under the user's home):
3
3
  // Claude Code: ~/.claude/projects and ~/.config/claude/projects; CLAUDE_CONFIG_DIR (comma-separated) overrides.
4
4
  // Codex: ~/.codex/sessions (and archived_sessions); CODEX_HOME overrides ~/.codex.
5
- import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
5
+ import { existsSync, readdirSync, readFileSync, realpathSync, statSync } from "node:fs";
6
6
  import { homedir } from "node:os";
7
7
  import { join, relative } from "node:path";
8
8
  import { parse } from "./index.js";
@@ -24,12 +24,18 @@ export function logRoots(agent, env = process.env) {
24
24
  return dirs.filter((d) => existsSync(d));
25
25
  }
26
26
  // Every *.jsonl under the roots; unreadable directories and files are skipped silently.
27
+ // Symlinked directories and files are followed; a directory reached twice (symlink cycle) is walked once.
27
28
  export function logFiles(agent, env = process.env) {
28
29
  const out = [];
30
+ const seen = new Set();
29
31
  for (const root of logRoots(agent, env)) {
30
32
  const walk = (d) => {
31
33
  let ents;
32
34
  try {
35
+ const real = realpathSync(d);
36
+ if (seen.has(real))
37
+ return;
38
+ seen.add(real);
33
39
  ents = readdirSync(d, { withFileTypes: true });
34
40
  }
35
41
  catch {
@@ -37,9 +43,20 @@ export function logFiles(agent, env = process.env) {
37
43
  }
38
44
  for (const e of ents) {
39
45
  const p = join(d, e.name);
40
- if (e.isDirectory())
46
+ let isDir = e.isDirectory(), isFile = e.isFile();
47
+ if (e.isSymbolicLink()) {
48
+ try {
49
+ const s = statSync(p);
50
+ isDir = s.isDirectory();
51
+ isFile = s.isFile();
52
+ }
53
+ catch {
54
+ continue;
55
+ } // dangling link
56
+ }
57
+ if (isDir)
41
58
  walk(p);
42
- else if (e.isFile() && e.name.endsWith(".jsonl")) {
59
+ else if (isFile && e.name.endsWith(".jsonl")) {
43
60
  try {
44
61
  const s = statSync(p);
45
62
  out.push({ root, path: p, rel: relative(root, p).replaceAll("\\", "/"), size: s.size, mtimeMs: s.mtimeMs });
package/dist/repro.js CHANGED
@@ -45,7 +45,12 @@ function trim(agent, lines, objs, maxBytes) {
45
45
  export function repro(args) {
46
46
  const opt = (k) => (args.includes(k) ? args[args.indexOf(k) + 1] : undefined);
47
47
  const want = opt("--agent"), sid = opt("--session"), tracker = opt("--tracker");
48
- const maxBytes = Number(opt("--max-kb") ?? 50) * 1024;
48
+ const maxKb = Number(opt("--max-kb") ?? 50);
49
+ if (!Number.isFinite(maxKb) || maxKb <= 0) {
50
+ console.error("--max-kb must be a number > 0");
51
+ return 2;
52
+ }
53
+ const maxBytes = maxKb * 1024;
49
54
  if (want && !LOG_AGENTS.includes(want)) {
50
55
  console.error("--agent must be claude or codex");
51
56
  return 2;
package/dist/secrets.js CHANGED
@@ -32,8 +32,8 @@ const AUDIT = {
32
32
  slack_token: /\bxox[abposr]-[A-Za-z0-9-]{10,}/g,
33
33
  // PEM block; in a JSONL line its newlines are the two characters \n.
34
34
  private_key: /-----BEGIN [A-Z ]*PRIVATE KEY-----(?:[A-Za-z0-9+\/=: \t-]|\\[nr])*?(?:-----END [A-Z ]*PRIVATE KEY-----|(?=\\[^nr]|[^A-Za-z0-9+\/=: \t\\-]|$))/g,
35
- // scheme://user:password@host — the match is the password only.
36
- db_url_password: /(?<=\b(?:postgres(?:ql)?|mysql|mariadb|mongodb(?:\+srv)?|rediss?|amqps?|mssql|sqlserver):\/\/[^\s:\/@"'\\]*:)[^\s@\/"'\\]+(?=@)/gi,
35
+ // scheme://user:password@host — the match is the password only; JSON escapes (\" \\) inside it belong to it.
36
+ db_url_password: /(?<=\b(?:postgres(?:ql)?|mysql|mariadb|mongodb(?:\+srv)?|rediss?|amqps?|mssql|sqlserver):\/\/[^\s:\/@"'\\]*:)(?:[^\s@\/"'\\]|\\.)+(?=@)/gi,
37
37
  };
38
38
  // Values that are documentation examples or templates, not secrets.
39
39
  const PLACEHOLDER = /EXAMPLE|\[REDACTED:|x{4,}|X{4,}|\*{3,}|\.{3}|your[_-]?|<|>|\$\{|\{\{|(.)\1{7,}|^(?:pass(?:word)?|secret|changeme|admin|root|test|user|pwd)$/i;
@@ -0,0 +1,21 @@
1
+ {
2
+ "agent": "claude",
3
+ "usage_lines": 2,
4
+ "unique_messages": 0,
5
+ "rule": "claude_last_per_message_id",
6
+ "is_sidechain": false,
7
+ "naive": {
8
+ "input": 0,
9
+ "output": 0,
10
+ "cache_write": 0,
11
+ "cache_read": 0,
12
+ "reasoning": 1590
13
+ },
14
+ "dedup": {
15
+ "input": 0,
16
+ "output": 0,
17
+ "cache_write": 0,
18
+ "cache_read": 0,
19
+ "reasoning": 0
20
+ }
21
+ }
@@ -0,0 +1,3 @@
1
+ {"parentUuid": null, "logicalParentUuid": "id_fake000011", "isSidechain": false, "type": "system", "subtype": "compact_boundary", "content": "<redacted>", "level": "info", "compactMetadata": {"trigger": "<redacted>", "preTokens": 248906, "postTokens": 26744, "cumulativeDroppedTokens": 957500, "durationMs": 10, "precomputed": true, "preCompactDiscoveredTools": ["<redacted>", "<redacted>", "<redacted>", "<redacted>"], "preservedSegment": {"headUuid": "id_fake000008", "anchorUuid": "id_fake000012", "tailUuid": "id_fake000011"}, "preservedMessages": {"anchorUuid": "id_fake000012", "uuids": ["id_fake000008", "id_fake000010", "id_fake000013", "id_fake000014", "id_fake000015", "id_fake000016", "id_fake000011"], "allUuids": ["id_fake000008", "id_fake000010", "id_fake000017", "id_fake000018", "id_fake000019", "id_fake000013", "id_fake000014", "id_fake000015", "id_fake000016", "id_fake000011"]}, "runningTurnSends": {"uuids": [], "openerUuid": "id_fake000015", "summarisedOnly": ["id_fake000015"]}}, "uuid": "id_fake000020", "timestamp": "2026-01-01T07:32:56.801Z", "userType": "external", "entrypoint": "<redacted>", "cwd": "<redacted>", "sessionId": "id_fake000021", "version": "2.1.321", "gitBranch": "<redacted>"}
2
+ {"parentUuid": "id_fake000012", "isSidechain": false, "message": {"model": "claude-sonnet-5-5", "id": "msg_fake000002", "type": "message", "role": "assistant", "content": [{"type": "thinking", "thinking": "", "signature": "<redacted>"}], "container": null, "stop_reason": "end_turn", "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 0, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0, "output_tokens": 0, "output_tokens_details": {"thinking_tokens": 795}, "server_tool_use": {"web_search_requests": 0, "web_fetch_requests": 0}, "service_tier": "standard", "cache_creation": {"ephemeral_1h_input_tokens": 7765, "ephemeral_5m_input_tokens": 0}, "inference_geo": "global", "iterations": [{"input_tokens": 2, "output_tokens": 1637, "cache_read_input_tokens": 239131, "cache_creation_input_tokens": 7765, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 7765}, "type": "message"}], "speed": "standard", "fallback_credit": null}, "input_fake000003": [], "diagnostics": null, "context_fake000004": null}, "thinkingDurationMs": 12031, "thinkingDisplay": "<redacted>", "serverClassifierRequest": "id_fake000005", "apiBlockIndex": 0, "requestId": "req_fake000006", "requestRef": "id_fake000007", "requestedModel": "claude-sonnet-5-5", "promptCacheRequested": "<redacted>", "type": "assistant", "uuid": "id_fake000008", "timestamp": "2026-01-01T00:00:00.000Z", "advisorModel": "claude-opus-5-5", "effort": "medium", "perTurnEffort": "<redacted>", "userType": "external", "entrypoint": "<redacted>", "cwd": "<redacted>", "sessionId": "id_fake000021", "version": "2.1.321", "gitBranch": "<redacted>"}
3
+ {"parentUuid": "id_fake000008", "isSidechain": false, "message": {"model": "claude-sonnet-5-5", "id": "msg_fake000002", "type": "message", "role": "assistant", "content": [{"type": "text", "text": "<redacted>"}], "container": null, "stop_reason": "end_turn", "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 0, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0, "output_tokens": 0, "output_tokens_details": {"thinking_tokens": 795}, "server_tool_use": {"web_search_requests": 0, "web_fetch_requests": 0}, "service_tier": "standard", "cache_creation": {"ephemeral_1h_input_tokens": 7765, "ephemeral_5m_input_tokens": 0}, "inference_geo": "global", "iterations": [{"input_tokens": 2, "output_tokens": 1637, "cache_read_input_tokens": 239131, "cache_creation_input_tokens": 7765, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 7765}, "type": "message"}], "speed": "standard", "fallback_credit": null}, "input_fake000003": [], "diagnostics": null, "context_fake000004": null}, "serverClassifierRequest": "id_fake000005", "apiBlockIndex": 1, "requestId": "req_fake000006", "requestRef": "id_fake000007", "requestedModel": "claude-sonnet-5-5", "promptCacheRequested": "<redacted>", "type": "assistant", "uuid": "id_fake000010", "timestamp": "2026-01-01T00:00:00.012Z", "advisorModel": "claude-opus-5-5", "effort": "medium", "perTurnEffort": "<redacted>", "userType": "external", "entrypoint": "<redacted>", "cwd": "<redacted>", "sessionId": "id_fake000021", "version": "2.1.321", "gitBranch": "<redacted>"}
@@ -0,0 +1,21 @@
1
+ {
2
+ "agent": "claude",
3
+ "usage_lines": 2,
4
+ "unique_messages": 1,
5
+ "rule": "claude_last_per_message_id",
6
+ "is_sidechain": false,
7
+ "naive": {
8
+ "input": 4,
9
+ "output": 3274,
10
+ "cache_write": 15530,
11
+ "cache_read": 478262,
12
+ "reasoning": 1590
13
+ },
14
+ "dedup": {
15
+ "input": 2,
16
+ "output": 1637,
17
+ "cache_write": 7765,
18
+ "cache_read": 239131,
19
+ "reasoning": 795
20
+ }
21
+ }
@@ -0,0 +1,2 @@
1
+ {"parentUuid": "id_fake000001", "isSidechain": false, "message": {"model": "claude-sonnet-5-5", "id": "msg_fake000002", "type": "message", "role": "assistant", "content": [{"type": "thinking", "thinking": "", "signature": "<redacted>"}], "container": null, "stop_reason": "end_turn", "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 7765, "cache_read_input_tokens": 239131, "output_tokens": 1637, "output_tokens_details": {"thinking_tokens": 795}, "server_tool_use": {"web_search_requests": 0, "web_fetch_requests": 0}, "service_tier": "standard", "cache_creation": {"ephemeral_1h_input_tokens": 7765, "ephemeral_5m_input_tokens": 0}, "inference_geo": "global", "iterations": [{"input_tokens": 2, "output_tokens": 1637, "cache_read_input_tokens": 239131, "cache_creation_input_tokens": 7765, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 7765}, "type": "message"}], "speed": "standard", "fallback_credit": null}, "input_fake000003": [], "diagnostics": null, "context_fake000004": null}, "thinkingDurationMs": 12031, "thinkingDisplay": "<redacted>", "serverClassifierRequest": "id_fake000005", "apiBlockIndex": 0, "requestId": "req_fake000006", "requestRef": "id_fake000007", "requestedModel": "claude-sonnet-5-5", "promptCacheRequested": "<redacted>", "type": "assistant", "uuid": "id_fake000008", "timestamp": "2026-01-01T00:00:00.000Z", "advisorModel": "claude-opus-5-5", "effort": "medium", "perTurnEffort": "<redacted>", "userType": "external", "entrypoint": "<redacted>", "cwd": "<redacted>", "sessionId": "id_fake000009", "version": "2.1.321", "gitBranch": "<redacted>", "slug": "<redacted>"}
2
+ {"parentUuid": "id_fake000008", "isSidechain": false, "message": {"model": "claude-sonnet-5-5", "id": "msg_fake000002", "type": "message", "role": "assistant", "content": [{"type": "text", "text": "<redacted>"}], "container": null, "stop_reason": "end_turn", "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 7765, "cache_read_input_tokens": 239131, "output_tokens": 1637, "output_tokens_details": {"thinking_tokens": 795}, "server_tool_use": {"web_search_requests": 0, "web_fetch_requests": 0}, "service_tier": "standard", "cache_creation": {"ephemeral_1h_input_tokens": 7765, "ephemeral_5m_input_tokens": 0}, "inference_geo": "global", "iterations": [{"input_tokens": 2, "output_tokens": 1637, "cache_read_input_tokens": 239131, "cache_creation_input_tokens": 7765, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 7765}, "type": "message"}], "speed": "standard", "fallback_credit": null}, "input_fake000003": [], "diagnostics": null, "context_fake000004": null}, "serverClassifierRequest": "id_fake000005", "apiBlockIndex": 1, "requestId": "req_fake000006", "requestRef": "id_fake000007", "requestedModel": "claude-sonnet-5-5", "promptCacheRequested": "<redacted>", "type": "assistant", "uuid": "id_fake000010", "timestamp": "2026-01-01T00:00:00.012Z", "advisorModel": "claude-opus-5-5", "effort": "medium", "perTurnEffort": "<redacted>", "userType": "external", "entrypoint": "<redacted>", "cwd": "<redacted>", "sessionId": "id_fake000009", "version": "2.1.321", "gitBranch": "<redacted>", "slug": "<redacted>"}
@@ -1,21 +1,21 @@
1
- {
2
- "agent": "claude",
3
- "usage_lines": 13,
4
- "unique_messages": 7,
5
- "rule": "claude_last_per_message_id",
6
- "is_sidechain": false,
7
- "naive": {
8
- "input": 26,
9
- "output": 7650,
10
- "cache_write": 369996,
11
- "cache_read": 1308765,
12
- "reasoning": 830
13
- },
14
- "dedup": {
15
- "input": 14,
16
- "output": 4039,
17
- "cache_write": 186687,
18
- "cache_read": 730509,
19
- "reasoning": 415
20
- }
21
- }
1
+ {
2
+ "agent": "claude",
3
+ "usage_lines": 13,
4
+ "unique_messages": 7,
5
+ "rule": "claude_last_per_message_id",
6
+ "is_sidechain": false,
7
+ "naive": {
8
+ "input": 26,
9
+ "output": 7650,
10
+ "cache_write": 369996,
11
+ "cache_read": 1308765,
12
+ "reasoning": 830
13
+ },
14
+ "dedup": {
15
+ "input": 14,
16
+ "output": 4039,
17
+ "cache_write": 186687,
18
+ "cache_read": 730509,
19
+ "reasoning": 415
20
+ }
21
+ }