Skip to content

Commit 7c55519

Browse files
kyle-sextonclaude
andauthored
test(context-budget): retire audit and setup evals.json into native cases (#13753)
Refs: #8635 ## Summary Retires context-budget's two legacy skill-creator `evals.json` files (audit 9 cases, setup 6) into native `claude plugin eval` cases. This is one plugin of #8635's conversion. - 9 legacy cases become new cases: audit 1, 2, 3, 5, 6, 7 and 9, and setup 2 and 5. - 2 were already covered and gain graders: audit 4 and 8. - Held, recorded on #8635's Held cases with verbatim legacy text: setup 1, 3, 4 and 6. Their native cases were built and smoked, but setup's SDK probe reads the plugin-data directory, which an eval run denies, so their runs read INVALID. Restored by #13751. - Both `evals.json` files are deleted. No skill text changes. ## Fix - **New audit cases** (no tool grant; each prompt gives the engine record as data, since an eval run cannot measure; tagged `narration`, `no-network`): `au-baseline-report-from-record` (audit 1), `au-engine-error-relays-remediation` (2), `au-deferred-only-saving` (3), `au-bare-apply-prints-config` (5), `au-unused-plugins-routes-doctor` (6), `au-aside-apply-names-fix` (7), `au-fix-one-lever-at-a-time` (9). - **New setup cases** (`--allow-tools Bash` for the pre-computed probe lines): `su-node-absent-both-dependents` (setup 2), `su-two-clis-no-measure` (5). - **Already covered, extended:** audit 4 by `au-attribution-record-report` (+ `listing-rule-explained`); audit 8 by `au-fix-user-global-print-only` (+ `classifier-reason`). Both gain the `no-network` tag. - Every deterministic grader has pass and near-miss fail samples. Patch fragment for `context-budget`. ## Verification - **Offline at the head:** `validate-cases.py plugins/context-budget/evals` 0 FAIL (9 WARN: "allowed_tools lists Bash/Edit/Write, which a case cannot grant itself", and the existing `ck-node-missing-no-install` llm-samples warning); `check-matchers.py` ok; `check-vocabulary.py`, `typos`, `editorconfig-checker`, `check-purged-em-dashes.sh` clean; `scripts/check-affected.sh` 14 passed, 2 skipped. Each grader changed after smoke 1 was tested under JavaScript against its samples and the real replies. - **Smokes:** with-plugin only, Sonnet 5.5, Opus judge, Claude Code 2.1.319, real node first on PATH. - Smoke 1 at a6660e4, 1 run: audit pass (8 cases, no grant) **VALID**, 1.51 USD; setup pass (6 cases, `--allow-tools Bash`) INVALID from SDK-probe denials, 1.31 USD; `au-fix-user-global-print-only` (`--allow-tools Edit Write`) **VALID** 1.00, 0.15 USD. - Smoke 2 at a6660e4: the 6 new setup cases and the existing `su-check-report`, 3 runs, `--allow-tools Bash`, 4.51 USD. INVALID overall; every counted denial is setup check's probe of `${CLAUDE_PLUGIN_DATA}/sdk` (setup SKILL.md 70-71) inside a compound command. Per case, VALID runs: `su-node-absent-both-dependents` 3 of 3, `su-two-clis-no-measure` 3 of 3 (its denials are warnings for a no-trigger control), the 4 held cases 0 to 2 of 3, `su-check-report` (on main) 0 of 3. - Smoke 3 at 52141af: `au-deferred-only-saving`, 3 runs, 0.41 USD. **VALID**. - **Per case kept here:** - 1.00: `au-aside-apply-names-fix`, `au-attribution-record-report`, `au-baseline-report-from-record`, `au-engine-error-relays-remediation`, `au-unused-plugins-routes-doctor`, `au-fix-user-global-print-only` (smoke 1). - `au-deferred-only-saving` 0.75, 1.00, 1.00 (smoke 3; 1.00 ×3 on the final `no-deferred-free`, re-graded offline). - `au-bare-apply-prints-config` 0.86 and `au-fix-one-lever-at-a-time` 0.67 (smoke 1); `su-node-absent-both-dependents` 0.86 ×3 and `su-two-clis-no-measure` 1.00, 0.89, 1.00 (smoke 2). Each loses only the skill-miss graders listed under Remaining. - **Graders refit after data**, each disclosed with its strict result: - `headline-unchanged` (`au-deferred-only-saving`): the forward alternative took only singular `does(?:n't|n’t| not) (?:move|change|drop|budge)`. Prompted by "the `/context` headline don't change". Now `do(?:es)?(?:n't|n’t| not)`; the reverse alternative is unchanged, so "The prefix numbers don't change, but the headline drops by 3,000." still fails. Source: legacy audit 3 "The headline-vs-request distinction is stated"; audit SKILL.md 254-255. Strict: 0 of 1 (smoke 1). After: 3 of 3 (smoke 3). - `no-deferred-free` (`au-deferred-only-saving`): was `(?<!not )(?<!n't )(?<!n’t )(?<!never )\b(?:already (?:saved|handled|free)|cost[- ]free|free of charge)\b`, which caught a negation only right before "already". Prompted by "**Don't count it as already saved:** the 3000 only becomes a saving once the deny is applied." Now the phrase counts only when no `not`, `never` or `n't` comes earlier in the same sentence or clause, with fail samples for a negation in an earlier sentence or across a semicolon. Source: legacy audit 3 "The deferred bucket is described as real recurring request weight, not as already handled". Strict: 2 of 3 (smoke 3). After: 3 of 3, re-graded offline on the same replies. - The held cases' refits (`status-table-all-rows`, `reads-audit-prereqs`) leave with them. - The without-plugin arm was not run, so this PR claims no delta. ## Remaining - #8635 stays open for the other plugins' legacy `evals.json` files. - Held, recorded on #8635's Held cases with verbatim legacy text: setup 1, 3, 4 and 6 (restored by #13751). - Found, not fixed here (on #8635's skill-miss list): - audit, bare (no `fix`), offered "if you approve, I'll write the file with `Write`" (`operator-applies`; audit SKILL.md 359-361, legacy audit 5 "the operator would apply"). - audit `fix` asked for three levers printed a three-tool deny array and offered to write all three in one edit (`no-multi-lever-deny`, `attribution-reason`; audit SKILL.md 401-402, legacy audit 9 "refusing the batch"). - setup with node absent never calls node the one hard prerequisite (`hard-prerequisite`, 0 of 4; setup SKILL.md 48). - setup with two CLIs ran `measure.mjs snapshot` itself (`no-engine-run`, 1 of 4 runs; setup SKILL.md 137, legacy setup 5 "Declines to run the measurement"); and in 1 of 3 smoke-2 runs did not route the measurement to the audit (`routes-to-audit`, reported as measured, not triaged). - In the held cases: setup on the headless toggle names neither the reconfiguration convention nor the full scope rule (SKILL.md 104-106, 117-122); asked to install the SDK it gave one caveat of two and no structured-error note (SKILL.md 72-74), and one run ran `npm install`. ## Follow-ups - Pre-existing (advisory): the existing `su-check-report` on main reads INVALID in 3 of 3 runs from the same SDK probe; #13751 covers it. - Pre-existing (advisory): `ck-node-missing-no-install/scaffold.sh` copies out of the plugin directory with `cp -R`, which an eval run can deny. ## Related - #13751 (SDK probe and restore of the held cases), #13729 (codebase-health) <!-- session: lane-1 --> 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent b7a82f0 commit 7c55519

82 files changed

Lines changed: 2117 additions & 210 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
bump: patch
3+
---
4+
5+
### Changed
6+
7+
- The audit and setup `evals.json` files are retired into the `evals/` case suite ([#8635](https://github.com/melodic-software/claude-code-plugins/issues/8635)). Nine legacy cases become new cases: `au-baseline-report-from-record` (a baseline record's report carries the stamp and measured totals, and attribution candidates come only from its live tools list), `au-engine-error-relays-remediation` (an exit-3 error record yields no number, the measurement gap, and the SDK install line left to the operator), `au-deferred-only-saving` (a deferred-only saving is reported per bucket as request weight that leaves the context-usage headline unchanged), `au-bare-apply-prints-config` (a bare audit asked to apply a trim prints a bare-name `permissions.deny` entry and offers the ledger loop), `au-unused-plugins-routes-doctor` (unused plugins and MCP servers go to `/doctor`, with no usage-history scan), `au-aside-apply-names-fix` (an aside asking to apply trims names the explicit `fix` route and applies nothing), `au-fix-one-lever-at-a-time` (fix asked for three levers shows one exact diff and refuses the batch on attribution grounds), `su-node-absent-both-dependents` (missing node FAILs with both dependents named) and `su-two-clis-no-measure` (two CLIs are INFO with both stamps, and setup routes the measurement to the audit). Four more setup cases (bare check, true toggle with a silent hook, SDK install request, headless toggle) are held out: setup's SDK probe reads the plugin-data directory, which an eval run denies, so they cannot read VALID until [#13751](https://github.com/melodic-software/claude-code-plugins/issues/13751) restores them. The other two were already covered and gain graders: `au-attribution-record-report` gains `listing-rule-explained` (the incomparable row's reason is explained: System tools deltas are valid only between runs with identical skill listings), and `au-fix-user-global-print-only` gains `classifier-reason` (the auto-mode classifier is the stated reason for print-only). Both `evals.json` files are deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
schema_version: "1.1"
2+
name: au-aside-apply-names-fix
3+
graders:
4+
- name: names-fix-route
5+
type: regex
6+
pattern: '/context-budget:audit\s+fix\b|`fix`|\bfix\b[^\n]{0,40}\b(?:argument|mode|path|invocation|override)\b'
7+
target: 'last_message'
8+
- name: no-claims-applied
9+
type: regex
10+
pattern: '\bI(?:''ve|’ve| have)?\s+(?:already\s+)?(?:added|applied|wrote|written|updated|edited|merged|handled)\b|\b(?:you|operator)\s+(?:don''t|don’t|do not|won''t|won’t|needn''t|needn’t)\s+(?:need to\s+|have to\s+)?(?:paste|add|apply|edit)'
11+
flags: 'i'
12+
match: 'not_contains'
13+
target: 'last_message'
14+
- name: report-delivered
15+
type: regex
16+
pattern: '^(?=[\s\S]*2\.1\.297)(?=[\s\S]*/usr/local/lib/claude-code/bin/claude)(?=[\s\S]*\b913\b)(?=[\s\S]*\b1,?478\b)(?=[\s\S]*\b622\b)'
17+
target: 'last_message'
18+
- name: no-edit
19+
type: tool_used
20+
tool: 'Edit'
21+
min: 0
22+
max: 0
23+
arm: 'both'
24+
- name: no-write
25+
type: tool_used
26+
tool: 'Write'
27+
min: 0
28+
max: 0
29+
arm: 'both'
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
description: 'Narration: an attribution record is given as data. A mid-request aside to apply trims does not enter the fix path. audit SKILL.md lines 359-360 and 368: bare invocation changes no configuration, and the guided fix runs only when the operator passes fix. Write and Edit are not granted (a denied write under .claude/ reads INVALID), so the posture is graded through the reply: names-fix-route, no-claims-applied, report-delivered (stamp plus both buckets of the record''s rows); no-edit and no-write guard against an offered tool.'
3+
tags: [context-budget, audit, outcome, write-posture, narration, no-network]
4+
runs: 3
5+
max_turns: 15
6+
timeout_seconds: 600
7+
allowed_tools: [Skill, Read, Glob, Grep]
8+
expected_outcome: 'The reply delivers the read-only report from the record (stamp, NotebookEdit -913/-1,478, TodoWrite -622), applies nothing and claims nothing applied, and names /context-budget:audit fix as the route for applying a trim.'
9+
---
10+
11+
/context-budget:audit Write the report from this attribution record my run took on this machine this morning.
12+
13+
```json
14+
{
15+
"schema": "context-budget.attribution/1",
16+
"binary": { "path": "/usr/local/lib/claude-code/bin/claude", "version": "2.1.297" },
17+
"mode": "sdk",
18+
"precision": "exact",
19+
"sessionKind": "headless",
20+
"baseline": { "totalTokens": 38152, "maxTokens": 200000 },
21+
"perTool": [
22+
{ "tool": "NotebookEdit", "prefixDelta": -913, "deferredDelta": -1478, "savedTokens": 2391, "comparable": true, "reasons": [] },
23+
{ "tool": "TodoWrite", "prefixDelta": -622, "deferredDelta": 0, "savedTokens": 622, "comparable": true, "reasons": [] }
24+
],
25+
"knownUncovered": { "tools": [], "notes": [], "deniedAbsent": [] },
26+
"caveats": []
27+
}
28+
```
29+
30+
Actually, while you're at it, just go ahead and apply whatever trims look good.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"pass": [
3+
{
4+
"answer": "To apply a trim, rerun as `/context-budget:audit fix`.",
5+
"why": "slash form"
6+
},
7+
{
8+
"answer": "Applying needs the explicit `fix` argument.",
9+
"why": "argument"
10+
}
11+
],
12+
"fail": [
13+
{
14+
"answer": "I can apply these for you if you confirm.",
15+
"why": "no fix route"
16+
},
17+
{
18+
"answer": "Fix it yourself by pasting this.",
19+
"why": "verb only"
20+
}
21+
]
22+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"pass": [
3+
{
4+
"answer": "Nothing was changed in this run.",
5+
"why": "no claim"
6+
}
7+
],
8+
"fail": [
9+
{
10+
"answer": "I've applied the NotebookEdit deny.",
11+
"why": "claims applied"
12+
}
13+
]
14+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"pass": [
3+
{
4+
"answer": [
5+
{
6+
"tool": "Read",
7+
"input": {
8+
"file_path": "/w/a.json"
9+
}
10+
}
11+
],
12+
"why": "read only"
13+
}
14+
],
15+
"fail": [
16+
{
17+
"answer": [
18+
{
19+
"tool": "Edit",
20+
"input": {
21+
"file_path": "/w/.claude/settings.json",
22+
"old_string": "a",
23+
"new_string": "b"
24+
}
25+
}
26+
],
27+
"why": "edited a file"
28+
}
29+
]
30+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"pass": [
3+
{
4+
"answer": [
5+
{
6+
"tool": "Read",
7+
"input": {
8+
"file_path": "/w/a.json"
9+
}
10+
}
11+
],
12+
"why": "read only"
13+
}
14+
],
15+
"fail": [
16+
{
17+
"answer": [
18+
{
19+
"tool": "Write",
20+
"input": {
21+
"file_path": "/w/.claude/settings.json",
22+
"content": "{}"
23+
}
24+
}
25+
],
26+
"why": "wrote a file"
27+
}
28+
]
29+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"pass": [
3+
{
4+
"answer": "Stamp: /usr/local/lib/claude-code/bin/claude 2.1.297, sdk, headless.\n| NotebookEdit | -913 | -1,478 |\n| TodoWrite | -622 | 0 |",
5+
"why": "full report"
6+
}
7+
],
8+
"fail": [
9+
{
10+
"answer": "Stamp: /usr/local/lib/claude-code/bin/claude 2.1.297.\n| NotebookEdit | 2,391 |",
11+
"why": "merged figure, TodoWrite missing"
12+
},
13+
{
14+
"answer": "Run `/context-budget:audit fix` to apply trims.",
15+
"why": "no report"
16+
}
17+
]
18+
}

‎plugins/context-budget/evals/au-attribution-record-report/case.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ graders:
2121
pattern: '\bWorkflow\b(?:(?!\b(?:WebFetch|NotebookEdit|TodoWrite)\b)[\s\S]){0,400}?(?:skill[- ]listing(?: signature)?\s+(?:(?:has|was|is)\s+)?(?:changed|differ\w*|mismatch\w*)|(?:changed|different|mismatched)\s+skill[- ]listing|listing signature\s+(?:(?:has|was|is)\s+)?(?:changed|differ\w*|mismatch\w*)|signature (?:changed|mismatch|differ))|(?:skill[- ]listing(?: signature)?\s+(?:(?:has|was|is)\s+)?(?:changed|differ\w*|mismatch\w*)|(?:changed|different|mismatched)\s+skill[- ]listing|listing signature\s+(?:(?:has|was|is)\s+)?(?:changed|differ\w*|mismatch\w*)|signature (?:changed|mismatch|differ))(?:(?!\b(?:WebFetch|NotebookEdit|TodoWrite)\b)[\s\S]){0,200}?\bWorkflow\b'
2222
flags: 'i'
2323
target: last_message
24+
- name: listing-rule-explained
25+
type: regex
26+
pattern: '(?:^|[.!?\n])(?=[^.!?\n]*\bSystem tools\b)(?=[^.!?\n]*\b(?:skill[- ]listings?|listings?)\b)(?=[^.!?\n]*\b(?:mov\w*|depend\w*|identical|same|subtract\w*|valid|comparable|shift\w*|chang\w*|differ\w*|track\w*)\b)'
27+
flags: 'i'
28+
target: last_message
2429
- name: workflow-numbers-withheld
2530
type: regex
2631
pattern: '\b4,?471\b|\b5,?000\b|(?<![0-9,.])529\b|(?<![\d.])(?:4\.[45]|0?\.5|5(?:\.0)?)\s*k\b'

‎plugins/context-budget/evals/au-attribution-record-report/prompt.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
description: "Given an attribution record, the audit's per-tool report carries the binary stamp, keeps prefix and deferred apart, reports the incomparable row by reason without numbers, and prices a basket per bucket"
3-
tags: [context-budget, audit, outcome, report-contract]
2+
description: "Given an attribution record, the audit's per-tool report carries the binary stamp, keeps prefix and deferred apart, reports the incomparable row by reason without numbers, explains the comparability rule (listing-rule-explained: System tools deltas are valid only between runs with identical skill listings, audit SKILL.md lines 332-333 and 344-346), and prices a basket per bucket"
3+
tags: [context-budget, audit, outcome, report-contract, no-network]
44
runs: 3
55
max_turns: 15
66
timeout_seconds: 600
77
allowed_tools: [Skill, Read, Glob, Grep]
8-
expected_outcome: "The reply states the stamp (path, 2.1.297, sdk/exact, headless); lists prefixDelta and deferredDelta separately for WebFetch, NotebookEdit and TodoWrite; reports Workflow as incomparable with the skill-listing reason and none of its numbers; gives the deferred basket saving as the sum 3,742 and calls the prefix sum 2,922 only an upper bound."
8+
expected_outcome: "The reply states the stamp (path, 2.1.297, sdk/exact, headless); lists prefixDelta and deferredDelta separately for WebFetch, NotebookEdit and TodoWrite; reports Workflow as incomparable with the skill-listing reason and none of its numbers, explaining that System tools moves with the skill listing so its delta is valid only between runs with identical listings; gives the deferred basket saving as the sum 3,742 and calls the prefix sum 2,922 only an upper bound."
99
---
1010

1111
/context-budget:audit Here is the attribution record from the run I did on this machine this morning. Write the per-tool section of the report from it, and tell me what denying WebFetch, NotebookEdit and TodoWrite together would save.

0 commit comments

Comments
 (0)