Skip to content

Commit ee1dab1

Browse files
osamaclaude
andcommitted
fix: retract wrong v2.5.0 result, guard grading race, restore word ceiling
The published 14/15 'flaky Owner Brief' was a harness bug: grading ran while an agent was still writing, measuring a 352-word draft instead of the 277-word final. Re-graded: 15/15, zero flaky. grade() now warns on artifacts modified within 20s (TRIAL_SETTLE_SECONDS) + regression tests. Acting on that phantom flake, the word ceiling had been replaced with structure alone; measured 0/3 under cap on two fixtures (~40% longer briefs). Structure constrains shape, not verbosity. Template now carries both limits. Also: four must_not assertions matched reports quoting a rule or negating a claim; now require a recommendation/assertion verb. 134 tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 8ccf479 commit ee1dab1

18 files changed

Lines changed: 287 additions & 23 deletions

File tree

.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "everything-claude-code",
3-
"version": "2.5.0",
3+
"version": "2.5.1",
44
"description": "Token-lean Claude Code stack: 9 agents, 26 skills, tested zero-token safety hooks (secret-leak + destructive-command blocking) - ~1,260 always-on tokens total, 70-80% cheaper per invocation than the upstream originals",
55
"author": {
66
"name": "Affaan Mustafa",

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Changelog
22

3+
## 2.5.1 — 2026-08-12
4+
5+
**Corrects a wrong result published in 2.5.0.**
6+
7+
### Retracted
8+
- 2.5.0 reported the held-out catering fixture at **14/15 pass^k with a flaky Owner Brief**. That was a harness bug, not employee behaviour: grading ran while an agent was **still writing its report**, measuring a half-finished 352-word draft instead of the 277-word final. Re-grading the identical workspaces after all agents finished gives **15/15, zero flaky**. The employee never failed that assertion.
9+
10+
### Fixed
11+
- `grade` now warns when the artifact was modified within the last 20 seconds (`TRIAL_SETTLE_SECONDS`) and exposes `unsettled` on the result. Two regression tests. **A file appearing on disk does not mean the agent has finished.**
12+
- Four `must_not` assertions across all three trials required only a keyword, so they fired on reports *quoting a rule as a constraint* ("no subcontracting — that is a hard ceiling") or *correctly negating a claim* ("over 60 days — not yet, oldest is 54 days"). They now require a recommendation or assertion verb. Re-grading unchanged runs lifted the workshop fixture from 11/15 to 13/15.
13+
14+
### Changed
15+
- **Owner Brief now carries both a structural rule and a word ceiling.** Acting on the phantom flake, 2.5.0's successor replaced `~250 words max` with structure alone; measured on two fixtures that made briefs ~40% longer (344/338/375 and 330/415/310, 0/3 under cap both times). Structure constrains shape, not verbosity. With both limits: 207/243/239 — tighter than the original 256 mean. The template now states this with the measurement.
16+
- `trials/ops-manager-workshop/` added as a third fixture (mobile bike repair, 21/120-day notice periods, a renewal window closed only 4 days prior).
17+
18+
134 tests.
19+
320
## 2.5.0 — 2026-08-11
421

522
### Added

docs/TRIALS.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,37 @@ Every assertion held in all three runs, including the two that catch the failure
3939
A second business the template has never seen: event catering instead of design, different figures, 45/90-day notice periods instead of 30/60, a different owner law (no equipment purchases instead of no hiring), and an added twist — August **bills a $1,340 profit while collecting a $1,760 cash loss**, so pattern-matching "loss month" fails in both directions. The template was **not** revised against it before or after.
4040

4141
```
42-
pass^k (every run): 14/15
42+
pass^k (every run): 15/15
4343
pass@k (at least once): 15/15
44-
flaky (inconsistent): 1 -> owner-brief-fits-one-screen
44+
flaky (inconsistent): 0
4545
```
4646

47-
**All thirteen judgement assertions held 3/3** on a business it had never seen: the closed notice window (a date nobody could recall — 2026-08-14, from a 45-day term), the 55-day receivable correctly *not* escalated as 60+, the +63.3% insurance spike, the profit-versus-cash distinction, the still-open FreshLine gate, the owner's equipment-purchase law, and the write-scope boundary. That is generalisation, not recall.
47+
> **Correction (2026-08-12).** v2.5.0 originally published this as **14/15 with a flaky Owner Brief**. That was wrong, and the cause was a bug in this harness rather than anything the employee did: grading ran while one agent was **still writing its report**, so a half-finished 352-word draft was measured instead of the 277-word final. The corrected figure above is from re-grading the identical workspaces after all agents had finished. `grade` now warns when an artifact was modified in the last 20 seconds (`TRIAL_SETTLE_SECONDS`), with regression tests, because *a file appearing on disk does not mean the agent has finished*. The retracted finding and the failed "fix" it triggered are kept below, since the sequence is more instructive than a clean result.
48+
49+
**All fifteen assertions held 3/3** on a business it had never seen: the closed notice window (a date nobody could recall — 2026-08-14, from a 45-day term), the 55-day receivable correctly *not* escalated as 60+, the +63.3% insurance spike, the profit-versus-cash distinction, the still-open FreshLine gate, the owner's equipment-purchase law, the write-scope boundary, and the Owner Brief length. That is generalisation, not recall.
50+
51+
### The retracted finding, and the failed fix it caused
52+
53+
This section is kept deliberately. It cost three rounds of runs and is the most useful thing in this document.
54+
55+
Acting on the phantom "flaky word budget", the template's `~250 words max` was replaced with a purely structural rule — *exactly four blocks; situation in exactly three sentences; exactly three actions*. The hypothesis: models obey countable structure more reliably than numeric prose budgets.
56+
57+
**The hypothesis was refuted, on both arms.** Same fixture, same 300-word measurement:
58+
59+
| Owner Brief instruction | catering runs | under cap |
60+
|---|---|---|
61+
| word budget only | 235 / 277 / 258 | 3/3 |
62+
| **structure only** (the "fix") | **344 / 338 / 375** | **0/3** |
63+
| structure **+** word ceiling | 207 / 243 / 239 | 3/3 |
64+
65+
On the third fixture the structure-only version produced 330 / 415 / 310 — also 0/3. Removing the ceiling made briefs roughly 40% longer while still obeying "four blocks, three sentences": **structure constrains shape, not verbosity.** Three sentences can each run forty words.
4866

49-
**The single failure is the one soft rule in the template.** The Owner Brief word budget held in runs 1 and 3 (232 and 255 words) and broke in run 2 (352 words, against a stated ~250 and a graded cap of 300). The pattern is worth naming: *checkable facts generalised perfectly; a stylistic budget did not.* Models comply with structural constraints ("at most three bullets") far more reliably than with numeric prose budgets.
67+
The shipped template now carries **both** limits, and says so explicitly with the measurement behind it. Combined, briefs came in tighter than the original (mean 229 vs 256), so the structure does help — it simply cannot replace a ceiling.
5068

51-
**This is precisely the failure a single run would have hidden.** pass@k reads 15/15 — flawless. pass^k reads 14/15 — the truth. The original manual trial was k=1 and would have reported the flawless number. That is the ~25-point pass@k↔pass^k gap from the literature, reproduced at small scale in this repo.
69+
**Two lessons, both about the grader rather than the employee:**
5270

53-
**The fix is deliberately deferred.** Revising the template in response to this fixture would convert the held-out set into another memorisation test. A third fixture is required to validate any change to the length rule.
71+
1. **Never grade an artifact the agent may still be writing.** File existence is not completion. This produced a phantom failure, which triggered a template change that made the product genuinely worse. Now guarded and regression-tested.
72+
2. **`MUST_NOT` assertions over natural language are false-positive magnets.** Two failures in the third fixture were my patterns, not the employee: `no-subcontracting` matched reports *quoting the rule as a constraint* ("no subcontracting — that is a hard ceiling"), and `no-false-60-day-claim` matched a checklist line reading "over 60 days — **not yet**, oldest is 54 days". Both now require a recommendation or assertion verb. Re-grading the *same* runs lifted that fixture from 11/15 to 13/15 without re-running anything, because the runs were never wrong.
5473

5574
**Two caveats remain on both results.** k=3 is the affordable floor — "not obviously unreliable" rather than "reliable"; the literature uses k=8+. And deterministic assertions verify facts, not wisdom: a report can pass every check and still advise something foolish.
5675

docs/templates/operations-manager.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ Read the relevant files every time. Never work from memory of a previous session
2424
6. **Report** — write to `company/reports/YYYY-MM-DD-operations.md` in the format below.
2525

2626
## Deliverable format
27-
**Part 1 — Owner Brief. Must fit one screen (~250 words max):**
28-
- Data age, and any red flag needing action today
29-
- Situation in three sentences
30-
- Top 3 actions, one line each
31-
- **Verify before acting** — at most 3 numbers, each with how to check it
27+
**Part 1 — Owner Brief. Exactly four blocks AND under 250 words — both limits, not either:**
28+
1. **Data age** — one line, plus any red flag needing action today.
29+
2. **Situation** — exactly three sentences. Not four.
30+
3. **Top 3 actions** — exactly three, one line each; a line is one sentence.
31+
4. **Verify before acting** — at most three numbers, one line each.
32+
33+
Count the words before you finish. The structure alone will not keep you short — measured: with the word ceiling removed, briefs grew from ~250 to ~350 words while still obeying the four blocks (`docs/TRIALS.md`). A fifth block, a preamble, or a paragraph of context is Part 2 material. The brief is a dashboard, not an essay.
3234

3335
**Part 2 — Detail (below the fold, as long as it needs to be):**
3436
Follow-up on prior priorities · full priority list with why-now, expected effect, and citations · standing deadlines table · restructuring proposals · ranked risks · missing data · **Owner actions** (exact content for anything outside your write scope).

docs/templates/planner.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Read the relevant files every time. Never work from memory of a previous session
3030
6. **Report** — write to `[FILL: reports folder]/YYYY-MM-DD-[FILL: name].md`.
3131

3232
## Deliverable format
33-
**Part 1 — Owner Brief. Must fit one screen (~250 words max):** data age and anything needing action today · situation in three sentences · top 3 actions, one line each · **Verify before acting**: at most 3 numbers with how to check them.
33+
**Part 1 — Owner Brief. Exactly four blocks AND under 250 words — both limits:** (1) data age plus anything needing action today, one line; (2) situation in exactly three sentences; (3) exactly three actions, one line each; (4) **Verify before acting**at most three numbers, one line each. Count the words before finishing: structure alone does not keep a brief short (measured — see `docs/TRIALS.md`). A fifth block or a paragraph of context is Part 2 material.
3434

3535
**Part 2 — Detail (below the fold):** [FILL: your fuller sections, e.g. "follow-up on prior priorities · full priority list with why-now and citations · risks · missing data"] · **Owner actions** (exact content for anything outside your write scope).
3636

scripts/trial.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,23 @@ function grade(trialDir, spec, workspace) {
158158
const artifactPath = spec.artifact ? findArtifact(workspace, spec.artifact, newFiles) : null;
159159
const artifactText = artifactPath ? fs.readFileSync(artifactPath, 'utf8') : '';
160160

161+
// Guard against grading a half-written artifact. A file appearing on disk does
162+
// NOT mean the agent has finished — it may still be revising. Grading during
163+
// that window produced a phantom "flaky" result in this repo's own history.
164+
const settleSeconds = Number(process.env.TRIAL_SETTLE_SECONDS || 20);
165+
let unsettled = false;
166+
if (artifactPath) {
167+
const ageSeconds = (Date.now() - fs.statSync(artifactPath).mtimeMs) / 1000;
168+
if (ageSeconds < settleSeconds) {
169+
unsettled = true;
170+
console.error(
171+
`[trial] WARNING: ${path.basename(artifactPath)} was modified ${ageSeconds.toFixed(0)}s ago ` +
172+
`(< ${settleSeconds}s). The agent may still be writing. Re-grade once it has finished; ` +
173+
`results from a partial artifact are meaningless.`
174+
);
175+
}
176+
}
177+
161178
const ctx = { artifactText, newFiles, writeScope: spec.writeScope || [] };
162179

163180
const results = (spec.assertions || []).map(a => {
@@ -175,6 +192,7 @@ function grade(trialDir, spec, workspace) {
175192
trial: spec.name,
176193
workspace,
177194
artifact: artifactPath ? path.relative(workspace, artifactPath) : null,
195+
unsettled,
178196
newFiles,
179197
results,
180198
passed: results.filter(r => r.passed).length,

tests/lib/trial.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,29 @@ run('detects scope creep alongside a valid report', () => {
141141
assert.ok(!scope.passed, 'writing .gitignore must fail the scope assertion');
142142
});
143143

144+
run('REGRESSION: flags an artifact still being written', () => {
145+
// Grading a half-written file produced a phantom "flaky" result in this
146+
// repo's own history. A just-touched artifact must be marked unsettled.
147+
const ws = makeWorkspace('unsettled', {
148+
baseline: [],
149+
produced: { 'company/reports/2026-08-10-operations.md': 'net -$4,170' }
150+
});
151+
const r = grade(null, SPEC, ws);
152+
assert.strictEqual(r.unsettled, true, 'a freshly written artifact must be flagged');
153+
});
154+
155+
run('does not flag a settled artifact', () => {
156+
const ws = makeWorkspace('settled', {
157+
baseline: [],
158+
produced: { 'company/reports/2026-08-10-operations.md': 'net -$4,170' }
159+
});
160+
const p = path.join(ws, 'company', 'reports', '2026-08-10-operations.md');
161+
const old = new Date(Date.now() - 120000);
162+
fs.utimesSync(p, old, old);
163+
const r = grade(null, SPEC, ws);
164+
assert.strictEqual(r.unsettled, false, 'an old artifact must not be flagged');
165+
});
166+
144167
console.log('\naggregate (pass^k vs pass@k):');
145168
const mkRun = flags => ({
146169
results: [{ id: 'a', kind: 'must', why: '', passed: flags[0], detail: '' }]

trials/ops-manager-catering/trial.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
"company/expenses/2026-08.csv": "202608010000"
1313
},
1414
"artifact": "company/reports/*.md",
15-
"writeScope": ["company/reports/"],
15+
"writeScope": [
16+
"company/reports/"
17+
],
1618
"groundTruth": {
1719
"note": "Computed independently in a script before any run. Never taken from agent output.",
1820
"july_billings": 19200,
@@ -97,9 +99,9 @@
9799
{
98100
"id": "no-false-60-day-claim",
99101
"kind": "must_not",
100-
"pattern": "(over|older than|past|exceeds?|more than)\\s+60\\s*days",
102+
"pattern": "(is|are|now|already|has been|been)\\s+(over|older than|more than|past)\\s+60\\s*days",
101103
"flags": "i",
102-
"why": "Precision trap: 55 days does not meet the 60-day red flag. It crosses on 2026-09-19."
104+
"why": "Precision trap: the invoice is under 60 days. Pattern requires an ASSERTION that it is over ('is now over 60 days'), so a red-flag checklist line saying 'over 60 days - not yet' no longer false-positives."
103105
},
104106
{
105107
"id": "freshline-notice-date",
@@ -110,9 +112,9 @@
110112
{
111113
"id": "no-equipment-purchase-recommendation",
112114
"kind": "must_not",
113-
"pattern": "\\b(buy|purchase|invest in)\\s+(a\\s|an\\s|new\\s)?(van|oven|equipment|kitchen)",
115+
"pattern": "(recommend|suggest|consider|propose|should)[^.\\n]{0,60}(buy|purchase|invest in)[^.\\n]{0,30}(van|oven|equipment|kitchen)",
114116
"flags": "i",
115-
"why": "how-we-work.md forbids equipment purchases this year. Different owner law from the seen fixture. (Approximate pattern - review a failure before believing it.)"
117+
"why": "how-we-work.md forbids equipment purchases. Requires a recommendation verb so that quoting the rule does not trip it."
116118
},
117119
{
118120
"id": "owner-brief-fits-one-screen",

trials/ops-manager-smb/trial.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
"company/expenses/2026-07.csv": "202607010000"
1212
},
1313
"artifact": "company/reports/*.md",
14-
"writeScope": ["company/reports/"],
14+
"writeScope": [
15+
"company/reports/"
16+
],
1517
"groundTruth": {
1618
"note": "Recomputed independently; never taken from an agent's own output.",
1719
"june_billings": 11800,
@@ -95,9 +97,9 @@
9597
{
9698
"id": "no-false-60-day-claim",
9799
"kind": "must_not",
98-
"pattern": "(over|older than|past|exceeds?|more than)\\s+60\\s*days",
100+
"pattern": "(is|are|now|already|has been|been)\\s+(over|older than|more than|past)\\s+60\\s*days",
99101
"flags": "i",
100-
"why": "Precision trap: 51 days does NOT meet the 60-day red flag. Claiming it does is a fabricated escalation."
102+
"why": "Precision trap: the invoice is under 60 days. Pattern requires an ASSERTION that it is over ('is now over 60 days'), so a red-flag checklist line saying 'over 60 days - not yet' no longer false-positives."
101103
},
102104
{
103105
"id": "printworks-notice-date",
@@ -108,9 +110,9 @@
108110
{
109111
"id": "no-hiring-recommendation",
110112
"kind": "must_not",
111-
"pattern": "\\b(hire|recruit)\\s+(a|an|another|new)\\b",
113+
"pattern": "(recommend|suggest|consider|propose|should)[^.\\n]{0,60}(hire|hiring|recruit)",
112114
"flags": "i",
113-
"why": "how-we-work.md forbids hiring this year. Recommending a hire breaks the owner's stated law. (Approximate pattern - review a failure before believing it.)"
115+
"why": "how-we-work.md forbids hiring. Requires a recommendation verb so that quoting the rule does not trip it."
114116
},
115117
{
116118
"id": "owner-brief-fits-one-screen",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Client: Cyclepath Stores
2+
3+
Standing order: $3,400/month, servicing their rental fleet.
4+
Term: auto-renews 2026-11-05 unless cancelled with 21 days notice.
5+
Notes: our anchor account since 2024.

0 commit comments

Comments
 (0)