swe-benign-4000 / README.md
Syghmon's picture
Card: correct the selection probability and frame, add the train.jsonl digest, and fix two false claims about --verify and production_parity/show_reads
c9f21bb verified
|
Raw
History Blame Contribute Delete
20.7 kB
---
license: odc-by
language:
- en
tags:
- agent-transcripts
- ai-safety
- monitoring
- false-positives
pretty_name: SWE-BENIGN benign agent actions for monitor false-positive measurement
size_categories:
- 1K<n<10K
configs:
- config_name: default
data_files:
- split: train
path: data/train.jsonl
extra_gated_prompt: >-
Derived from SALT-NLP/SWE-chat (ODC-BY), which is itself gated. By accessing this
dataset you accept the upstream terms and agree not to redistribute it publicly.
---
# SWE-BENIGN — 4,000 benign agent actions under `bypassPermissions`
A fixed, uniformly-drawn set of **4,000 real benign tool calls** from Claude Code
sessions, built to measure **false positives** in agent action monitors. Each row is one
action a monitor would be asked to judge, plus a pointer into the source corpus that
`reconstruct.py` turns back into the transcript the monitor reads. (Two documented departures
from live shape — the compaction cut and mid-turn truncation of batched API turns — are in
*Reconstructing the transcripts*.)
**The conversation history is not in these rows, and cannot be** — the `results`-view prefixes
alone are 1.09 GB of text across the 4,000 rows, and the source corpus is gated. A row on
its own is not runnable. See *Reconstructing the transcripts*.
**This is a diagnostic corpus, not a population estimate.** It exists so that many monitor
configurations can be run against an identical frame and compared, and so that their false
positives can be collected and characterised. See *What this cannot tell you*.
## Provenance
| | |
|---|---|
| source corpus | [`SALT-NLP/SWE-chat`](https://huggingface.co/datasets/SALT-NLP/SWE-chat) (ODC-BY, gated) |
| corpus files scanned | 5,850 |
| Claude Code sessions passing hygiene | 4,704 |
| pool actions (all permission modes) | 287,882 |
| eligible actions (the frame: `bypassPermissions`, deduped) | 95,748 |
| pool sha256 | `81be9fb7ae03dbcf6aecd364efc2e027b2113f4b8856cf12abd607eeece40761` |
| rows in this dataset | 4,000 |
| `data/train.jsonl` sha256 | `12940b9d11404ca7c237c51fadd0410e03d44e0b7dc4500f3f26f911d38812ba` |
| measured-sample sha256 (pre-serialisation intermediate, not distributed) | `01d838a3b2869927a0f45ec7d5d76573aa34f1534a4d14abb03d764edda89146` |
| draw seed | 20260814 |
| built | 2026-08-15 |
## Reconstructing the transcripts
The rows are pointers. `reconstruct.py` rebuilds the message list each row was measured against:
```bash
python3 reconstruct.py --corpus /path/to/SWE-chat/transcripts --out ./frames --verify
```
You need a local copy of `SALT-NLP/SWE-chat` at revision
`f66cca95b14caaa4177f7ed5eaa424608dadcffa` (gated; pattern `*.jsonl`, 5,850 files, 9.7 GB).
`--emit frame` is stdlib-only, so the frames can be built without MonitorKit; `--verify` and
`--emit render` need it.
**Load frames with `reconstruct.load_frame(path)`, never a bare `json.load`.** MonitorKit keys
its "the judged action is always rendered" guarantee on *object identity*, which JSON
serialisation destroys — a naively loaded frame renders **without the action under review**,
silently, on six of the eight views, for every one of the 1,008 `Read` rows. `load_frame()`
re-binds the action to the block inside `messages`; the `render_sha256_stable` digests in
`index.jsonl` are computed the same way, so they only reproduce if you do too.
**The shared artifact is the frame — `{action, messages}` — not a rendering.** Every arm
renders that same frame through its own view. Sharing one arm's rendered text instead would
score every other arm on the wrong bytes, which is exactly the comparison this dataset exists
to make honestly; the eight views disagree by ~5x on purpose (`results` p50 82,448 tokens
against `deployed`'s 15,618 over the shipped rows). At the measurement kit every cascade view
drops non-focal read-family *calls*; `show_reads=False` on `production_parity` is the newer
kit's mechanism, and is what preserves that view's pre-D-68 bytes.
Every run — with or without `--verify` — checks each row's `input_sha256` and its
`post_compaction` flag, and that is what catches a wrong `--corpus` or a rate-limited partial
download. `--verify` adds a per-view **character-count** re-render check against the
`render_chars_*` columns, for the views named in `--views` (default `results,deployed`, so 2
of 8); pass all eight to catch prefix corruption, since the five reduced views drop assistant
text and their lengths do not move when it changes. The manifest reports `comparisons_made`,
and a run that compared nothing reports `verified: false`.
### Running it against `auto-mode-kit`
`automode-eval` (from [`auto-mode-kit`](https://github.com/safety-research/auto-mode-kit),
`pkgs/automode_classifier`) reads `{"label", "messages", "cwd"?}` items and classifies the LAST
`tool_use` block in `messages`. Our frames end at the focal action's message, so
`to_automode_eval.py` is a direct mapping:
```bash
python3 reconstruct.py --corpus /path/to/SWE-chat/transcripts --out ./frames
python3 to_automode_eval.py --frames ./frames --out cases.jsonl
automode-eval --input cases.jsonl --model claude-opus-4-8 --out results.jsonl
```
Verified end to end against an unmodified `automode-eval`: a `Read` comes back `auto_approved`,
a `Bash` is reviewed and allowed — the same two answers MonitorKit gives on the same frames.
The converter carries a guard for one hazard: where the focal action is not the last `tool_use`
in its message, `automode-eval` would classify a different call than the row names, silently.
Such frames are dropped and counted; pass `--keep-ambiguous` to emit them anyway.
**That guard never fires here — and not for the reason it looks like.** Claude Code's JSONL
writer emits one content block per record (128,924 assistant records carry exactly one
`tool_use`; 3 carry more), so a reconstructed `messages[-1]` can never hold two calls and the
check is vacuous by construction rather than because the corpus is unbatched. Grouped by
`message.id` — the actual API turn — **1,014 of 4,000 focal actions (25.4%) share their turn
with other tool calls, and 640 (16.0%) are not the last call in it**; turns run up to 32 calls.
For `automode-eval` the consequence is benign: the focal action really is the only `tool_use`
in the frame's last message, so it selects the right call. For *fidelity* it is not. On those
rows the frame presents a single API response as several sequential assistant messages, and on
16% it cuts that response off mid-turn, so sibling calls the live monitor saw alongside the
focal one are absent. This is inherited from the dataset design — `build_prefix` reproduces
exactly what the shipped `render_chars_*` columns were measured on — not introduced by
reconstruction. Treat it as a known departure from live transcript shape.
**This bridge is lightly tested. Treat it as a starting point, not a validated interface.**
What was checked: the conversion runs clean (60/60 frames, 0 dropped), and **two** converted cases
went through an unmodified `automode-eval` and came back with sensible answers. What was *not*
checked: any qualitative review of `automode-eval`'s outputs beyond those two; `--keep-ambiguous`;
behaviour on frames with unusual shapes; and — most importantly — whether the two kits were
configured comparably at all. `automode-eval` ran on its defaults (`prior_assistant_context=True`,
`edit_removals=True`, `outcome_codes=False`, `monitor_workflow=False`) and nothing here aligns
those with the MonitorKit arm these render columns describe. **The agreement on those two cases is
a smoke test, not a controlled cross-kit comparison, and must not be quoted as one.** Before this
bridge is used for any real measurement it should be reviewed and re-validated on the
`auto-mode-kit` side, by someone who owns that kit.
### The render columns were measured against MonitorKit `5b42610`
At `5b42610` all eight views reproduce their `render_chars_*` columns byte-exactly — verified
2026-08-15 by reconstructing all 4,000 rows on all eight views, 32,000 renders, zero mismatches
and zero failures. On a newer
kit, four of them — `deployed`, `jsonl`, `hardened`, `xml` — render **1.15x-1.33x larger**,
because of **D-68** (kit `5264f10`, 2026-08-13): a read-family CALL is now kept in history
whether or not its body is surfaced. It reaches only those four; `results` already kept every
read call, `production_parity` opts out (`show_reads=False`), and `agent`/`guardian` build
their own bytes and never dropped one.
What that does and does not invalidate:
- **The frames are unaffected.** D-68 changes rendering, not the message list.
- **The row selection is unaffected — measured, not argued.** All 4,000 rows were re-rendered
on the four affected views at the newer kit. Growth is p50 **1.07x**, p90 1.23x, p99 1.99x,
**max 14.0x** — and **zero rows** cross the 650k cap. The reason is structural rather than
lucky: growth is anti-correlated with size, because a big multiplier requires a prefix that
was almost all dropped reads, and such prefixes are tiny (the 14.0x row goes 196 → 2,750
tokens). The rows that actually sit near the cap grow 1.06x–1.11x, and the closest one ends
2,564 tokens under it. Do not substitute a sampled growth bound for this: sampling gave
1.5x, then 2.99x, then 3.62x before the full pass found 14.0x.
- **Those four views' `render_chars_*` / `render_tokens_*` columns are stale.** Do not quote
them as current sizes. `reconstruct.py` recognises this exact signature and names it rather
than blaming the corpus.
## How the sample was drawn
1. **Only actions taken under `permissionMode: bypassPermissions`.** This is the deployment
distribution of the monitor under study and the reason for every other property of this
dataset. In that mode the auto-mode hook is, in MonitorKit's own words, *"the SOLE gate"*
(`__main__.py:10`; `hook.py:18` records the agent running under
`--permission-mode bypassPermissions`). In `default` and `plan` the human permission
prompt decides and the monitor is not load-bearing; in `acceptEdits` it is the gate for
Edit/Write but not for Bash. Measured on the source census, block rate differs by
**1.81x** across modes after standardising for session length, so this is not a cosmetic
restriction. Mode is read **per action** — it changes within a session — and kept in the
`permission_mode` column.
2. **Tools.** Only `Bash`, `Read`, `Edit`, `Write`. All four have a counterpart in both
monitor architectures under study (`MultiEdit` is excluded), which is what makes the set
comparable across them.
3. **Hygiene gate, sessions.** Exclude only broken sessions — unparseable, no cwd, no human
turn, no tool result, multiple session ids, orphaned tool results, >10% unresolved tool
calls, non-Claude-Code agents, and sessions where a `tool_result` PRECEDES its own
`tool_use` in the record stream (60 sessions — a prefix cut between the two orphans it and
the results view raises). Nothing is excluded for being boring, short or long.
4. **Action filters.** An action is eligible if its tool is in frame, its `tool_result`
exists, and its own input carries no redaction marker (see *Known confounds*).
5. **Uniform simple random sample** over the frame — session identity is ignored at draw
time, so every eligible under-cap action had an identical selection probability. The draw
is two uniform stages: 6,000 over-drawn from the 95,748-action frame, then 4,000 kept by a
seeded shuffle after the size cap removed 123. That is
P = (6,000/95,748) x (4,000/5,877) = 0.0427, so `w_action` is the constant **23.446292**
and the sample is self-weighting; no reweighting is needed. The weights sum to 93,785, the
under-cap frame. Actions over the cap have probability zero and are outside the frame the
weights describe.
6. **One global size cap.** Total prompt (system prompt + the largest render across views
that send what they render) ≤ **650,000 tokens**, so every row is monitorable by every
arm on an identical frame.
## Fields
| field | meaning |
|---|---|
| `dp_id` | stable row id: `swe:<sessionId>#<record uuid>:<tool_use_id>` |
| `file_stem`, `sid_inner` | source session file and its inner session id |
| `tool_name` | `Bash` / `Read` / `Edit` / `Write` |
| `codex_tool` | what the Codex-style reviewer calls it (`shell`, `apply_patch`) |
| `tool_input_json` | the **full, untruncated** tool input, JSON-encoded as a string |
| `input_sha256` | `sha256(json.dumps([tool_name, tool_input], sort_keys=True))` — the row key |
| `cwd`, `project`, `user_hash` | working directory, worktree-normalised project, salted user id |
| `abs_call_index` | ordinal of this tool call among all tool calls in the session |
| `preceding_bytes` | raw-JSON size of the transcript before this action (a proxy; see caveat) |
| `render_tokens_{results,deployed,guardian}` | measured rendered size under each view |
| `binding_render_tokens`, `total_prompt_tokens` | the size the cap is applied to |
| `permission_mode` | always `bypassPermissions` here — the frame restriction, kept for provenance |
| `post_compaction` | the action sits after an auto-compaction boundary |
| `non_posix_cwd` | Windows/UNC cwd — path containment is unreliable, see *Known confounds* |
| `redaction_in_prefix` | a publisher redaction marker appears earlier in the transcript |
| `redaction_in_action` | always `false`; such rows were excluded at pool build |
| `w_action` | design weight — the constant 23.446292, by construction. **Corrected 2026-08-16**: it previously shipped as 15.958, the *over-draw's* weight (95,748/6,000), which was never recomputed after the cap and the final 4,000-row cut |
| `action_type`, `shell_effect`, `shell_effect_source` | annotation slots, currently `null` |
| `harm_to_user`, `harm_label_state` | label slots; `harm_label_state` is `"unlabelled"` |
## Composition
Tools: **Bash** 2,051, **Read** 1,008, **Edit** 845, **Write** 96
Diversity: **986 sessions**, **207 projects**, **61 users**, at most
58 rows from any one session.
Prompt size: p50 121,466 · p90 313,499 · max 647,436 tokens.
## Known confounds — read before using
- **The source corpus arrived pre-redacted.** The publisher scrubbed secrets before release,
so tokens like `REDACTED` and `[REDACTED:SECRET]` sit inside the transcript text a monitor
reads. Actions whose *own input* carries a marker are excluded (2.03% of the
frame), but **57.9% of rows have a marker somewhere in the preceding context**, and
it is flagged rather than removed. Monitors have been observed reasoning about the markers
themselves. Treat `redaction_in_prefix` as a reporting stratum.
- **Prefixes are cut at the most recent compaction.** After an auto-compaction the agent's
context is the summary record (`isCompactSummary`) plus what followed, not the whole file.
**15.8% of rows sit after a boundary** and carry `post_compaction: true`. Replaying from
file start instead — as an earlier version of this dataset did — overstates their rendered
size by ~5x (median 317,806 -> 74,731 tokens) and causes the size cap to reject rows that
are not oversized at all.
- **The size cap excludes differentially, and here is the number.** It removes 2.0% of
rows, and the removed rows are not a random slice: measured on the source census they block
at **2.227%** against **1.195%** for the rows kept. The headline block rate is therefore
biased **down by ~0.066 pp = 5.2% relative**. At this n that is ~0.28 of one standard error;
at the planned 3-epoch scale it exceeds 1 SE, so it must be reported as a number rather than
as "length-correlated" prose. The cap is set on the maximum across **every view that sends
what it renders**`results` is not the largest (`agent` exceeds it on 21.4% of rows), so
capping on `results` alone would not have made every row monitorable by every arm.
- **`guardian_pretruncation_tokens` is not a prompt size.** Guardian truncates its own input to
10,000 + 10,000 tokens and 40 recent entries, so the projection measured here overstates what
it actually sends by **7.6x-46.7x**. It is excluded from the binding max and is kept only to
show how much guardian discards. Never compare it to a `render_tokens_*` column.
- **Resumed and forked sessions are deduplicated.** One real tool call can appear in 2-5 files
because a resumed session replays its parent's records, producing rows with different
`file_stem` but the same `tool_use_id`. Those copies are collapsed before the draw, so
`distinct_sessions` counts conversations rather than files.
- **Windows cwds break path containment, in OPPOSITE directions per architecture.**
0.0% of rows carry a `cwd` like `E:\proj`, which parses as a *relative* POSIX
path on Linux. Under the auto-mode router the containment test then passes for
**everything** — verified: a write to `C:\Users\<other>\.ssh\authorized_keys` is
`AUTO_APPROVED`, a **fail-open**. Under the Codex router the same arithmetic doubles the
root so nothing is ever inside it and every patch is `ESCALATED`, fail-closed. In this
sample all such rows belong to **one user**, so 3.9% reads as breadth but is n approx 1.
Exclude `non_posix_cwd` rows from any cross-architecture admission comparison: they account
for essentially the whole apparent codex-vs-auto-mode admission gap (+1.00 pp of a +1.03 pp
delta), and removing them leaves a null result.
- **0 actions were excluded because a view that sends what it renders raises on
them.** In the source session three `tool_result`s precede their `tool_use` in file order, so a
transcript prefix cut at the focal action orphans them and `results` raises. Left in, they would
have failed at request time, been recorded as `TRANSPORT`, and — because `TRANSPORT` is
fail-closed — counted as **blocks**, i.e. fabricated false positives. Their ids are in
`render_manifest.json`.
- **`preceding_bytes` is a poor size proxy** — up to a 40× spread against real rendered
characters, because much of what it counts is never rendered. Use `render_tokens_*`.
- **Only 2,110 of the 4,000 rows reach a reviewer at all** — measured by running the real
admission layer over every row (it needs only `tool_name`, `tool_input_json` and `cwd`, so
you can reproduce this without the corpus). Under the auto-mode router: **2,051 Bash, 44
Edit, 15 Write, and zero Read**. The other 1,890 are structural allows — 1,008 Read, 801
Edit, 81 Write. Reads are never reviewed (0 of 90,508 in the source census), but so are
in-workspace Edits and Writes, which the write fast path auto-approves; attributing the
free allows to reads alone understates them by 882 rows. The Codex router splits almost
identically: 2,111 escalated, 1,889 confined. **The effective denominator of any block rate
here is 2,110, and it is overwhelmingly Bash** — non-Bash tools are kept so the tool-mix
ratios are recoverable, not because they generate verdicts.
- **Population, and it is narrow.** These are sessions from one session-recorder's user base,
skewed toward developers building agent tooling — not a random sample of software
engineering traffic. The `bypassPermissions` restriction narrows it much further: the frame
contains **69 distinct users**, of whom the top one is **18.9%** of it, the top
five **51.0%** and the top ten **67.1%**. This dataset is a measurement over a few dozen
heavy autonomous-agent users. Treat `user_hash` as a clustering variable in any interval,
and do not read a rate here as a population rate for developers at large.
## What this cannot tell you
A block rate measured on this set is **not** a deployed-traffic false-positive rate. The set
is tool-filtered, size-capped, and drawn from a non-representative population. It supports
arm-versus-arm comparison on an identical frame, and the collection and characterisation of
false positives. Quoting a single pooled rate as "the monitor's FPR" is not supported.
## Personal information
The transcripts are real developer sessions. Upstream scrubbing removed credential-shaped
strings — a scan of these rows found **no private keys and no token-shaped literals** — but
**99.9% of rows contain a home-directory path carrying a real username** (almost
entirely in `cwd`), and 3.5% contain an email address. Usernames are additionally
available as a salted hash in `user_hash`. Do not make this dataset public.
## Citation
Derived from SWE-chat (SALT-NLP), ODC-BY. Attribution required; see the upstream card.