camsemianalsyis commited on
Commit
7dd76bd
·
verified ·
1 Parent(s): f675cd8

filter to CC >=2.1.139 (header-keyed grouping); +2 traces (98 total)

Browse files
README.md CHANGED
@@ -23,166 +23,148 @@ configs:
23
 
24
  # CC Traces — Weka, With Subagents, v5 only (May 18 2026)
25
 
26
- A collection of **96 multi-turn agentic traces** drawn from real production
27
- traffic against the Claude Code CLI ≥ 2.1.139. Each trace captures the full
28
  request/response sequence of a single agent session, including per-request
29
  KV block hashes AND the original sub-agent fan-out structure (Task-tool
30
  spawned sub-agents grouped into `WekaSubagentEntry` blocks).
31
 
32
- **With-subagents, v5-only variant.** Companion to
33
  [cc-traces-weka-no-subagents-051826](https://huggingface.co/datasets/semianalysisai/cc-traces-weka-no-subagents-051826),
34
- which is the same 96 traces with all `WekaSubagentEntry` blocks stripped.
35
 
36
- Use this dataset when you want to:
37
- - Simulate the full agentic-coding workload including parallel Task-tool
38
- sub-agent fan-out
39
- - Study sub-agent dispatch patterns, instance counts, durations
40
- - Replay against an inference engine that should see the same concurrent-
41
- request structure a real Claude Code session generates
42
-
43
- Use the **no-subagents sibling** when you want a single linear main-agent
44
- stream per trace and don't care about the parent / child fan-out.
45
-
46
- Same filters as the sibling:
47
 
48
  1. **v5 only.** Every replayable request in every included session has
49
- `trace_version = 5` (the latest proxy schema, o200k_base tokenizer).
50
- Sessions containing any earlier-format request are excluded entirely.
51
- 2. **≥ 20 main-agent turns.** Per-trace main-agent stream (the would-be
52
- no-subagents stream) must have at least 20 turns. Sub-agent fan-out
53
- is on top of that.
54
-
55
- - **Traces:** 96
56
- - **Top-level entries:** 22,184 (21,566 main turns + 618 subagent groups)
57
- - **Sub-agent inner requests:** 16,200
58
- - **Total individual model requests:** 37,766
 
 
 
59
  - **Models:** `claude-opus-4-7`, `claude-haiku-4-5-20251001`, `claude-opus-4-6`, `claude-sonnet-4-6`
60
  - **KV block size:** 64 tokens
61
- - **Hash scope:** `local` — block hash IDs are only comparable *within*
62
- a single trace; they are not a global content-addressable identity.
63
 
64
- ## Important: tokenizer caveat
65
 
66
- The `in` field on each request and the `hash_ids` array are both
67
- measured in **the proxy's tokenizer** (`o200k_base`, GPT-4o family).
68
- Anthropic typically reports ~60 % of the o200k token count for the same
69
- content. So the ISL numbers below are larger than what the Anthropic
70
- API would have billed for the same prompt — but they're self-consistent
71
- between `in` and `hash_ids`, which is what matters for KV-cache replay
72
- simulation.
73
 
74
- ## What's in each trace
 
 
 
 
 
 
 
 
 
 
75
 
76
- Top-level trace fields:
 
 
77
 
78
- | field | type | description |
79
- |-----------------|------------------|-----------------------------------------------------|
80
- | `id` | str | Trace identifier (the proxy session id) |
81
- | `models` | list[str] | Models used by the trace |
82
- | `block_size` | int | KV block size used to derive `hash_ids` (64) |
83
- | `hash_id_scope` | str | `local` — hash IDs are per-trace, not global |
84
- | `requests` | list[object] | Ordered list of per-request records OR `WekaSubagentEntry` groups |
85
 
86
- Each entry in `requests` is one of two shapes:
 
 
 
 
 
 
 
87
 
88
  ### Main-agent request (`type: "n"` or `"s"`)
89
 
90
- | field | type | description |
91
- |---------------|-----------|--------------------------------------------------------------------------|
92
- | `t` | float | Seconds since start of trace |
93
- | `type` | str | `n` (non-streaming) or `s` (streaming) |
94
- | `model` | str | Target model for this request |
95
- | `in` | int | Effective prompt tokens covered by `hash_ids` (proxy tokenizer) |
96
- | `out` | int | Output tokens (Anthropic-reported) |
97
- | `hash_ids` | list[int] | Per-trace local block-hash IDs for the input, one per 64-token block |
98
- | `api_time` | float | End-to-end server time for this call (seconds) |
99
- | `think_time` | float? | Wall-clock gap from previous request's end (seconds) |
100
- | `ttft` | float? | Time to first token (streaming requests only) |
101
 
102
  ### Sub-agent group (`type: "subagent"`)
103
 
104
- | field | type | description |
105
- |-----------------|----------------|--------------------------------------------------------|
106
- | `t` | float | Start time (seconds since trace start) |
107
- | `type` | str | Always `"subagent"` |
108
- | `agent_id` | str | Stable per-trace sub-agent instance id (slug + suffix) |
109
- | `subagent_type` | str | Sub-agent label (`"Subagent"` for Claude Code ≥ 2.1.139, else the original proxy label) |
110
- | `duration_ms` | int | Wall-clock span first→last inner request |
111
- | `total_tokens` | int | Sum of `in + out` across inner requests |
112
- | `tool_use_count`| null | Not tracked in the proxy DB |
113
- | `status` | str | Always `"completed"` |
114
- | `requests` | list[object] | Inner main-shape entries (type `n` — sub-agents are non-streaming) |
115
- | `models` | list[str] | Distinct models used inside this sub-agent run |
116
-
117
- Sub-agent groups are emitted at the position of the first inner request
118
- in the chronological stream. Their inner requests have absolute `t`
119
- values (not relative to the group start), making sub-agent and main-
120
- agent timelines directly interleavable for replay.
121
-
122
- `hash_ids` make the dataset unusually useful for KV-cache work: the
123
- contiguous common prefix between turn *t* and turn *t − 1* exactly
124
- measures the portion of the input that a local prefix cache would be
125
- able to reuse. The same accounting applies to sub-agent inner requests
126
- within their group, and to the dispatching parent request that
127
- triggered them.
128
 
129
  ## Summary statistics
130
 
131
- Across **all** requests (main + sub-agent inner = 37,766 requests):
132
 
133
  | | p50 | p75 | p90 | p95 | p99 | mean |
134
  |------------------------------|---------:|---------:|---------:|---------:|---------:|---------:|
135
- | ISL (tokens) | 100,902 | 229,982 | 443,856 | 580,438 | 803,019 | 172,848 |
136
- | OSL (tokens) | 224 | 478 | 1,150 | 1,907 | 5,461 | 530 |
137
- | Top entries/trace | 115 | | | 678 | 1,141 | 231 |
138
 
139
  ## Plots
140
 
141
  ### Main-agent stream
142
 
143
- Histograms across all 21,566 main-agent turns (sub-agent groups skipped).
144
- Same view as the [no-subagents sibling](https://huggingface.co/datasets/semianalysisai/cc-traces-weka-no-subagents-051826) — the two datasets share an identical main-agent stream.
145
 
146
  ![Main-stream distributions — log x](plots/distributions_log.png)
147
  ![Main-stream distributions — linear x](plots/distributions_linear.png)
148
 
149
  ### Sub-agent fan-out analysis
150
 
151
- Histograms across all 618 sub-agent groups (and their 16,200 inner requests). Companion to the main-stream plots — answers questions about how often sub-agents are spawned, how deep their tool-loops go, how long they take, and how much intra-group prefix cache reuse exists.
152
 
153
  ![Sub-agent distributions — log x](plots/subagent_distributions_log.png)
154
  ![Sub-agent distributions — linear x](plots/subagent_distributions_linear.png)
155
 
156
- Six panels:
157
-
158
- 1. **Sub-agent groups per trace** — distribution of how many distinct sub-agent invocations each session spawns
159
- 2. **Inner requests per group** — depth of each sub-agent's tool-use loop
160
- 3. **Group wall-clock duration** — first→last inner span (seconds)
161
- 4. **Group total tokens** — `Σ(in + out)` across each group's inner requests
162
- 5. **Inner-request ISL** — per-call input length INSIDE sub-agent loops (smaller than main-agent turns because sub-agents work on focused sub-problems with trimmed context)
163
- 6. **Intra-group cache hit rate** — for each non-first inner request, fraction of `hash_ids` already seen in earlier inners of the SAME group. Captures how much KV-cache reuse a local prefix cache would get out of a sub-agent's tool-use loop (typically high — sub-agents iterate on a stable prompt)
164
 
165
  ## Model composition
166
 
167
  | model | requests (main + subagent inner) |
168
  |-------|---------:|
169
- | `claude-opus-4-7` | 36,637 |
170
  | `claude-haiku-4-5-20251001` | 702 |
171
  | `claude-opus-4-6` | 343 |
172
- | `claude-sonnet-4-6` | 84 |
173
 
174
  ## Source
175
 
176
  Same proxy → weka pipeline as the
177
  [no-subagents sibling](https://huggingface.co/datasets/semianalysisai/cc-traces-weka-no-subagents-051826),
178
- just without the post-step that strips `WekaSubagentEntry` blocks.
179
 
180
- 1. `utils/sample_proxy_traces.py --min-trace-version 5 --min-main-turns 20 --privacy-mode anon`
181
- 2. `utils/proxy_to_weka.py` (subagent grouping per the dashboard's
182
- algorithm)
183
- 3. Concatenate the resulting weka JSONs into `traces.jsonl` — one trace
184
- per line.
185
 
186
- The same-96-trace contract with the no-subagents sibling makes the two
187
- variants safe to A/B compare for any benchmark that cares about
188
- sub-agent fan-out's impact on cache-hit-rate or throughput.
 
23
 
24
  # CC Traces — Weka, With Subagents, v5 only (May 18 2026)
25
 
26
+ A collection of **98 multi-turn agentic traces** drawn from real production
27
+ traffic against Claude Code CLI ≥ 2.1.139. Each trace captures the full
28
  request/response sequence of a single agent session, including per-request
29
  KV block hashes AND the original sub-agent fan-out structure (Task-tool
30
  spawned sub-agents grouped into `WekaSubagentEntry` blocks).
31
 
32
+ **With-subagents, v5-only, CC ≥ 2.1.139 variant.** Companion to
33
  [cc-traces-weka-no-subagents-051826](https://huggingface.co/datasets/semianalysisai/cc-traces-weka-no-subagents-051826),
34
+ which is the same 98 traces with all `WekaSubagentEntry` blocks stripped.
35
 
36
+ Three filters:
 
 
 
 
 
 
 
 
 
 
37
 
38
  1. **v5 only.** Every replayable request in every included session has
39
+ `trace_version = 5` (latest proxy schema, o200k_base tokenizer).
40
+ 2. **Claude Code CLI 2.1.139.** Every successful request in every
41
+ included session is on a CC build that ships the
42
+ `x-claude-code-agent-id` HTTP header the canonical signal sub-agent
43
+ grouping depends on. Sessions without it would have unreliable
44
+ grouping (legacy stretch-based fallback can mis-group concurrent
45
+ same-label sub-agents) and are excluded entirely.
46
+ 3. **≥ 20 main-agent turns** post-strip. Sub-agent fan-out is on top of that.
47
+
48
+ - **Traces:** 98
49
+ - **Top-level entries:** 23,443 (22,822 main turns + 621 subagent groups)
50
+ - **Sub-agent inner requests:** 16,332
51
+ - **Total individual model requests:** 39,154
52
  - **Models:** `claude-opus-4-7`, `claude-haiku-4-5-20251001`, `claude-opus-4-6`, `claude-sonnet-4-6`
53
  - **KV block size:** 64 tokens
54
+ - **Hash scope:** `local`
 
55
 
56
+ ## Sub-agent grouping
57
 
58
+ Identical algorithm to the proxy dashboard's
59
+ [`buildRequestRuns`](https://github.com/SemiAnalysisAI/semianalysis-claude-code-proxy/blob/main/packages/app/src/lib/subagent-runs.ts).
60
+ Two passes over chronologically-sorted DB rows:
 
 
 
 
61
 
62
+ 1. **Pre-collect header-keyed groups:** for every row with
63
+ `x-claude-code-agent-id`, gather ALL rows with the same id into one
64
+ group across the entire session (not just contiguous stretches).
65
+ Background sub-agents that overlap with main-agent turns collapse
66
+ correctly.
67
+
68
+ 2. **Emit chronologically:**
69
+ - `subagent_label IS NULL` → main turn at position
70
+ - has agent-id, first sighting → emit the pre-collected group
71
+ - has agent-id, already emitted → skip
72
+ - has label but no agent-id → fallback contiguous-stretch grouping
73
 
74
+ For CC ≥ 2.1.139 all groups go through the header-keyed path; the
75
+ fallback isn't exercised. That's why we require CC ≥ 2.1.139 — the
76
+ fallback can mis-group concurrent same-label sub-agents.
77
 
78
+ ## Tokenizer caveat
 
 
 
 
 
 
79
 
80
+ `in` and `hash_ids` are in proxy tokenizer (`o200k_base`). Anthropic
81
+ reports ~60 % of the o200k count for the same content. ISL numbers
82
+ are bigger than what Anthropic would bill, but self-consistent between
83
+ `in` and `hash_ids` for cache-hit simulation.
84
+
85
+ ## What's in each trace
86
+
87
+ Top-level: `id`, `models`, `block_size: 64`, `hash_id_scope: "local"`, `requests: list`.
88
 
89
  ### Main-agent request (`type: "n"` or `"s"`)
90
 
91
+ | field | type | description |
92
+ |---|---|---|
93
+ | `t` | float | seconds since trace start |
94
+ | `type` | str | `n` (non-streaming) or `s` (streaming) |
95
+ | `model` | str | target model |
96
+ | `in` | int | input tokens (proxy tokenizer) |
97
+ | `out` | int | output tokens |
98
+ | `hash_ids` | list[int] | per-trace local block IDs |
99
+ | `api_time` | float | end-to-end server seconds |
100
+ | `think_time` | float? | gap from previous request's end |
101
+ | `ttft` | float? | streaming only |
102
 
103
  ### Sub-agent group (`type: "subagent"`)
104
 
105
+ | field | type | description |
106
+ |---|---|---|
107
+ | `t` | float | start of the group |
108
+ | `type` | str | `"subagent"` |
109
+ | `agent_id` | str | stable id (slug + 8-char suffix from `x-claude-code-agent-id`) |
110
+ | `subagent_type` | str | `"Subagent"` for CC ≥ 2.1.139 |
111
+ | `duration_ms` | int | first→last inner wall-clock |
112
+ | `total_tokens` | int | Σ(in+out) across inners |
113
+ | `tool_use_count` | null | not tracked |
114
+ | `status` | str | `"completed"` |
115
+ | `requests` | list | inner Shape-A entries (all `type: "n"`) |
116
+ | `models` | list[str] | distinct models inside |
117
+
118
+ Inner requests carry **absolute `t` values**, so flattening + chronological
119
+ re-sort works directly: `sorted(main + flatten(inner), key=lambda x: x['t'])`.
 
 
 
 
 
 
 
 
 
120
 
121
  ## Summary statistics
122
 
123
+ Across **all** requests (main + sub-agent inner = 39,154):
124
 
125
  | | p50 | p75 | p90 | p95 | p99 | mean |
126
  |------------------------------|---------:|---------:|---------:|---------:|---------:|---------:|
127
+ | ISL (tokens) | 103,026 | 231,708 | 440,033 | 573,767 | 799,819 | 173,073 |
128
+ | OSL (tokens) | 223 | 476 | 1,152 | 1,907 | 5,413 | 527 |
129
+ | Top entries/trace | 126 | 304 | 571 | 733 | 1,120 | 239 |
130
 
131
  ## Plots
132
 
133
  ### Main-agent stream
134
 
135
+ Histograms across all 22,822 main-agent turns (sub-agent groups skipped). Identical to the [no-subagents sibling](https://huggingface.co/datasets/semianalysisai/cc-traces-weka-no-subagents-051826).
 
136
 
137
  ![Main-stream distributions — log x](plots/distributions_log.png)
138
  ![Main-stream distributions — linear x](plots/distributions_linear.png)
139
 
140
  ### Sub-agent fan-out analysis
141
 
142
+ Histograms across all 621 sub-agent groups and their 16,332 inner requests.
143
 
144
  ![Sub-agent distributions — log x](plots/subagent_distributions_log.png)
145
  ![Sub-agent distributions — linear x](plots/subagent_distributions_linear.png)
146
 
147
+ Six panels: groups per trace · inner requests per group · group wall-clock duration · group total tokens · inner-request ISL · intra-group cache hit rate.
 
 
 
 
 
 
 
148
 
149
  ## Model composition
150
 
151
  | model | requests (main + subagent inner) |
152
  |-------|---------:|
153
+ | `claude-opus-4-7` | 38,058 |
154
  | `claude-haiku-4-5-20251001` | 702 |
155
  | `claude-opus-4-6` | 343 |
156
+ | `claude-sonnet-4-6` | 51 |
157
 
158
  ## Source
159
 
160
  Same proxy → weka pipeline as the
161
  [no-subagents sibling](https://huggingface.co/datasets/semianalysisai/cc-traces-weka-no-subagents-051826),
162
+ without the post-step that strips `WekaSubagentEntry` blocks.
163
 
164
+ 1. `utils/sample_proxy_traces.py --min-trace-version 5 --min-main-turns 20 --require-cli-min 2.1.139 --privacy-mode anon`
165
+ 2. `utils/proxy_to_weka.py` (subagent grouping per [proxy `lib/subagent-runs.ts`](https://github.com/SemiAnalysisAI/semianalysis-claude-code-proxy/blob/main/packages/app/src/lib/subagent-runs.ts))
166
+ 3. Concatenate the resulting weka JSONs into `traces.jsonl` — one trace per line.
 
 
167
 
168
+ The same-98-trace contract with the no-subagents sibling makes the two
169
+ variants safe to A/B compare for any benchmark that cares about sub-agent
170
+ fan-out's impact on cache-hit-rate or throughput.
plots/distributions_linear.png CHANGED

Git LFS Details

  • SHA256: 2ab01e4682455729943895ffde2447f1270d829355f4326b5c4aaba02f92a660
  • Pointer size: 131 Bytes
  • Size of remote file: 211 kB

Git LFS Details

  • SHA256: dcc506971e58888585bf5dd91b3b69fb0ccdaea90a5ae42e3fc0f993de94efba
  • Pointer size: 131 Bytes
  • Size of remote file: 209 kB
plots/distributions_log.png CHANGED

Git LFS Details

  • SHA256: 371d70971a549dd004dca92486058c38fa2ab920c02e0f7dd0ef68dc8064faae
  • Pointer size: 131 Bytes
  • Size of remote file: 210 kB

Git LFS Details

  • SHA256: 06cd89588257fc34ace3a3d4af772bd5aad23f5d7612e2d7cfe6f41bc2d96dee
  • Pointer size: 131 Bytes
  • Size of remote file: 211 kB
plots/subagent_distributions_linear.png CHANGED

Git LFS Details

  • SHA256: a55884a213aa85fe55a868541158eeb031ad48cdca9569a4d5fe8914125cc705
  • Pointer size: 131 Bytes
  • Size of remote file: 202 kB

Git LFS Details

  • SHA256: 84ace93db1921595e63dcf8557c01ff8c6a860bf5f05b0aa2085f04de339540c
  • Pointer size: 131 Bytes
  • Size of remote file: 201 kB
plots/subagent_distributions_log.png CHANGED

Git LFS Details

  • SHA256: 7612869f1084a3e57163481707112a1ed53bca7fc03838e198935a4c49aa1e76
  • Pointer size: 131 Bytes
  • Size of remote file: 202 kB

Git LFS Details

  • SHA256: 264598b6e8c5e0aa6dc5364757182dabbec3cde69ec17d001251b64219eb4b66
  • Pointer size: 131 Bytes
  • Size of remote file: 203 kB
traces.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:93f7e9e7d4c888ffb4e73423c88dc2184a54a72c52b8630b8f9fcbe78f11d521
3
- size 650260538
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fea00ec35ac395c830683d1e5b38a4809c77d4eb32c6305a9f28804fa7d3c941
3
+ size 674903956