Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,28 @@ instead of describing product behavior. Use `SHOULD` for polish and edge cases,
`[manual]` for UI-only behaviors, and notes or acceptance-checklist bullets for
implementation details rather than making every detail an enforced `MUST`.

**When implementing**, every MUST/SHALL requirement needs at least one test
**Requirement substance**: distinguish three kinds of text. Behavioral
requirements state what the product does — the normal home for normative
`MUST`s. Delivered-text contracts (agent-facing or interface text the product
delivers) are normative through the surface that delivers them: pin the
instruction or outcome that must survive, not a whole paragraph or heading
order. Verification notes — test strategy, CI commands, review procedure,
migration bookkeeping, tool versions — belong in notes or acceptance-checklist
bullets, not enforced `MUST`s.

**When implementing**, every MUST/SHALL requirement needs covering evidence
annotated with a comment containing its ID, e.g. `// 2119: REQ-001.2.3` (the
marker line must start with a comment leader). Write tests that would genuinely
fail if the requirement were violated — including its negative space: what the
requirement forbids needs a rejection test, not just what it allows. A
fresh-context reviewer judges each test's honesty; tautological or over-mocked
tests will be rejected.
marker line must start with a comment leader). One test MAY carry several
requirement IDs (`// 2119: REQ-001.2.3, REQ-001.2.4`): annotate existing
evidence that already covers a requirement instead of adding a near-duplicate
test for traceability. Write tests that would genuinely fail if the requirement
were violated — including its negative space: what the requirement forbids needs
a rejection test, not just what it allows — and that stay green under legitimate
non-violating changes (paraphrase, rename, reformat, reorganization); a test
whose only value is pinning spec wording, file layout, or digests the
requirement does not govern is a tripwire, not evidence. A fresh-context
reviewer judges each test's honesty; tautological or over-mocked tests will be
rejected.

**Reviewer diversity**: use reviewer models from different providers, routinely
or as periodic `npx rfc2119 review --audit` sweeps — adversarial audits of
Expand Down
31 changes: 31 additions & 0 deletions docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,37 @@ type. This is presented as a **reference architecture** — the recipe in [`scal
describes the shape; an executable example has not shipped yet, and we say so rather than
overclaim "supported."

## Verdict invalidation is scoped, and its breadth is a tradeoff

A verdict vouches for exact content — but deliberately not all content. A test-quality hash
covers the requirement statement, the annotated evidence blocks, and files matched by
`shared_evidence`; it excludes unrelated tests in the same file, other specs, and docs. Two
goals must not be conflated:

1. **Tests should tolerate legitimate product-preserving changes.** Paraphrasing a requirement,
renaming a symbol, reformatting, or reorganizing files must not invalidate evidence. The
reviewer template's survival probe enforces this at review time: evidence that fails only
because wording or organization changed is a tripwire, and the reviewer rejects it.
2. **Review fingerprints should track everything that could neutralize the evidence.** A passing
suite alone does not keep an old review valid; the hash must include the requirement text and
any shared helper capable of neutering the tests (`shared_evidence`).

Breadth is therefore a tradeoff, not a dial to maximize. Declaring every helper shared means one
helper edit invalidates every dependent verdict — helper integrity at the cost of unrelated hash
churn. Declaring too little means a neutering helper escapes the hash and verdicts stay green
while the evidence dies. Declare the narrowest boundary that includes the helpers that can
neutralize the evidence, and read a stale-verdict reduction as meaningful only alongside that
integrity check. (Direction, not shipped: explicitly declared shared-evidence groups keep exact
content hashes within a group and preserve universal helpers, without invalidating unrelated
groups; no semantic-equivalence detection, no blanket safe-listing of formatting changes.)

Rollout is observational, never destructive. Guidance and probe changes land first; 2119 never
deletes or auto-invalidates a repository's tests. Worth watching as trends — never as gates,
because a hard limit (executions per requirement, prose-test ratios) is just another number to
optimize: verdict invalidations after changes that did not alter requirement meaning; time for
documentation-only changes to reach green; tests added versus existing tests cross-referenced
when specs change; requirements covered only by tests skipped in default CI.

## Specs are agent context; ritual text is banned

Every line in a spec file is read by agents on every relevant task, so every line must change
Expand Down
32 changes: 32 additions & 0 deletions eval/calibration/015-prose-tripwire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
expected_verdict: fail
prompt: test-quality
source: accretion study (2119#38), 2026-10 (synthetic)
failure_mode: false rigor — exact-prose pin standing in for behavioral evidence
---

## Requirement

> The CLI MUST print a top-level `--help` flag listing its subcommands.

## Evidence

```ts
// 2119: REQ-007.1.1
it("help output matches the README word for word", () => {
const help = runCli(["--help"]);
const readme = readFileSync("README.md", "utf8");
for (const line of readme.split("\n").filter((l) => l.startsWith("`2119 "))) {
expect(help).toContain(line.replace(/`/g, ""));
}
});
```

## Why the correct verdict is FAIL

The assertion pins documentation wording, not behavior. Rephrase the README — a legitimate,
non-violating change — and the test breaks even though the CLI still lists every subcommand;
that is exactly the survival probe the reviewer runs alongside the counterexample probe. The
behavioral evidence is an assertion against the CLI's observable output (each subcommand
present with a description), not against prose or a digest of files the requirement does not
govern. Evidence whose only value is pinning wording, layout, or hashes must be rejected.
35 changes: 35 additions & 0 deletions eval/calibration/016-redundant-matrix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
expected_verdict: fail
prompt: test-quality
source: accretion study (2119#38), 2026-10 (synthetic)
failure_mode: false rigor — Cartesian matrix over dimensions that do not interact
---

## Requirement

> Uploaded files larger than the configured limit MUST be rejected with a 413 response.

## Evidence

```ts
// 2119: REQ-004.2.1
it.each(
[1, 4, 16, 64].flatMap((mb) =>
["csv", "json", "png", "pdf", "zip"].map((ext) => [`${mb}mb.${ext}`, mb, ext]),
),
)("rejects oversized %s", (_name, mb, ext) => {
const res = upload(bigFile(mb, ext), LIMIT_MB);
expect(res.statusCode).toBe(413);
});
```

A previous test already covers the rejection with two cases straddling the limit.

## Why the correct verdict is FAIL

Twenty parameter cases re-spell one branch: nothing in production makes the file extension
interact with the size limit, so the matrix adds no discriminating evidence over the existing
boundary test — it is bulk added for traceability. Parameter sets are judged by the meaningfully
distinct behavior they exercise, not by size, and universal wording never obligates exhaustive
cases. The requirement's real negative space (a file exactly at the limit; a changed limit
honored without restart) is never probed.
35 changes: 35 additions & 0 deletions eval/calibration/017-derived-security-inventory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
expected_verdict: pass
prompt: test-quality
source: accretion study (2119#38), 2026-10 (synthetic)
failure_mode: legitimate exception — derived security inventory whose subjects fail loudly
---

## Requirement

> Every admin route MUST reject unauthenticated requests with 401 before touching handlers.

## Evidence

```ts
// 2119: REQ-009.1.1
it("rejects unauthenticated access to every admin route", async () => {
const app = await buildRealApp(); // the production server factory, not a mock
const routes = await enumerateRoutes(app); // derived from the running product
Comment thread
luce-unsup marked this conversation as resolved.
Resolved
const adminRoutes = routes.filter((r) => r.startsWith("/admin"));
expect(adminRoutes.length).toBeGreaterThan(0); // an empty admin match fails the test
for (const route of adminRoutes) {
const res = await app.inject({ method: "GET", url: route });
expect(res.statusCode).toBe(401);
}
});
```

## Why the correct verdict is PASS

This resembles an inventory pin, but it is behavioral: the route list is derived from the
running product (not a frozen literal), zero subjects fail loudly (any future admin route
without an auth guard fails this test), and each assertion observes a real status code. A
derived inventory whose enumerated subjects fail loudly is legitimate security evidence. The
reviewer confirms the inventory comes from the real product and that an empty match fails the
test — not that the enumeration be smaller or the loop replaced with a hand-written list.
32 changes: 32 additions & 0 deletions eval/calibration/018-delivered-agent-instruction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
expected_verdict: pass
prompt: test-quality
source: accretion study (2119#38), 2026-10 (synthetic)
failure_mode: legitimate exception — delivered agent-facing text is behavior
---

## Requirement

> The review dispatch surface MUST instruct each reviewer agent not to edit files and to record
> its verdict with the pass/fail command named in its instruction file.

## Evidence

```ts
// 2119: REQ-003.6.2
it("dispatch prompt carries the verdict-recording and no-edit instructions", () => {
const prompt = renderDispatchPrompt([fakeTask()]);
expect(prompt).toMatch(/record its own verdict/);
expect(prompt).toContain("pass/fail command");
expect(prompt).toMatch(/do not edit files/i);
});
```

## Why the correct verdict is PASS

Agent-facing text is behavior when it is delivered through the product's real surface, and this
requirement is about delivered text — asserting its load-bearing content is asserting the
contract. The evidence survives legitimate editing (rewording the prompt keeps it green) because
it pins the outcome that must survive: the no-edit instruction and the recording command — not a
whole paragraph, heading order, or unrelated prose. A byte-for-byte snapshot of the entire
rendered prompt would deserve FAIL as a prose tripwire instead.
34 changes: 34 additions & 0 deletions eval/calibration/019-distinct-malformed-shapes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
expected_verdict: pass
prompt: test-quality
source: accretion study (2119#38), 2026-10 (synthetic)
failure_mode: legitimate exception — negative-space table over genuinely distinct shapes
---

## Requirement

> The parser MUST reject malformed transcripts with a diagnostic naming the offending line.

## Evidence

```ts
// 2119: REQ-002.3.1
it.each([
["truncated header", "TRANSCT\n"],
["missing separator", "HEADER body\nBODY without break"],
["bad ordinal", "#5 Event without preceding #4"],
["unclosed quote", 'SAY "never finished'],
["negative span", "SPAN -1..3"],
])("rejects %s and names the line", (_shape, text) => {
expect(() => parseTranscript(text)).toThrow(/line \d+/);
});
```

## Why the correct verdict is PASS

Unlike the redundant-matrix case, these parameter values exercise meaningfully different
behavior: each shape reaches a different rejection path in the parser (header validation,
structure, ordering, tokenization, bounds), so this is negative-space enumeration over a defined
input language, not bulk. Universal wording ("malformed") cannot imply these cases, which is
precisely why an explicit table of distinct malformed shapes is justified. The reviewer confirms
each row reaches a distinct path rather than collapsing the table with the Cartesian anti-pattern.
6 changes: 6 additions & 0 deletions eval/calibration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ for field-sourced cases, sanitized to neutral code — the pattern is the payloa
Cases from the first field deployment (2026-07-10) and the first external audits are seeded
below. Mode A = positive-space bias (accepting behavior tested, forbidden behavior never
probed). Mode B = requirement states mechanism, not outcome.

The 2026-10 accretion round ([2119#38](https://github.com/Unsupervisedcom/2119/issues/38)) adds
a paired set: false-rigor escapes (prose tripwire, redundant matrix) and legitimate exceptions
that resemble anti-patterns (derived security inventory, delivered agent instruction, distinct
malformed shapes). The template's probes are symmetric — evidence must fail when behavior is
removed and stay green when meaning is preserved — and cases 015–019 pin that symmetry.
3 changes: 3 additions & 0 deletions specs/REQ-003-judgment-reviews.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ their findings (not empty markers), and they live in version control.
9. A `[review: <globs>]` tag whose globs match no files MUST produce a check violation naming the requirement and the unmatched globs, rather than silently degrading to a text-only hash.
10. Instruction files MUST direct the reviewer to enumerate the requirement's conjuncts and boundary terms (words like `comment`, `exactly`, `only`, `begins with`) and, for each, construct the nearest violating input and confirm a test rejects it — a review that cannot name a rejected counterexample for a boundary term is not a pass.
11. Instruction files MUST direct the reviewer to fail with a finding when the requirement itself is ambiguous, untestable, or states an implementation mechanism rather than an observable outcome, since a bad requirement honestly tested is still a bad requirement.
12. Instruction files MUST direct the reviewer to run a legitimate-change survival probe alongside the violating-change counterexample: name one change that does not violate the requirement — paraphrasing it, renaming a symbol, reformatting, adding a sibling requirement, or reorganizing files — and confirm the evidence stays green under it, rejecting evidence that fails only because wording or organization changed as a tripwire rather than behavioral evidence.
13. Instruction files MUST direct that one evidence body may cover several requirement IDs, that reviewers do not demand a new test where existing evidence already rejects the relevant counterexample — an additional annotation or explicit cross-reference satisfies traceability — and that no requirement earns credit merely from a uniquely named test.
14. Instruction files MUST direct the reviewer to reject evidence whose only value is pinning wording, layout, or file digests the requirement does not govern — unless the pinned text is itself the delivered product surface or a derived inventory whose enumerated subjects fail loudly — and to judge large parameter sets by the meaningfully distinct behavior they exercise rather than by their size or by exhaustive cases implied by universal wording alone.

### REQ-003.2: Verdict recording

Expand Down
2 changes: 1 addition & 1 deletion specs/REQ-004-agent-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ plugins and are planned as thin native packages.
### REQ-004.3: Universal fallback layer

1. `2119 init` MUST create a commented `.2119.yml` and a template spec when none exist.
2. `2119 init` MUST append a marker-delimited workflow section to `AGENTS.md` describing spec-first planning, draft-time spec critique (dispatch a fresh reviewer to critique new requirements — outcome-stated, individually testable, one obligation each — before writing tests), test annotations, judgment reviews, reviewer-model diversity (use models from different providers routinely or as periodic `review --audit` sweeps, especially for challenging or high-consequence requirements), and the `2119 check` gate, exactly once.
2. `2119 init` MUST append a marker-delimited workflow section to `AGENTS.md` describing spec-first planning, draft-time spec critique (dispatch a fresh reviewer to critique new requirements — outcome-stated, individually testable, one obligation each — before writing tests), requirement substance (behavioral requirements, delivered-text contracts, and non-normative verification notes distinguished), shared-evidence annotation (one test may carry several requirement IDs), test annotations, judgment reviews, reviewer-model diversity (use models from different providers routinely or as periodic `review --audit` sweeps, especially for challenging or high-consequence requirements), and the `2119 check` gate, exactly once.
3. `2119 init --git-hook` MUST install a git pre-commit hook that runs `2119 check`, refusing to overwrite an existing pre-commit hook it did not create.
4. `2119 init --ci` MUST write a GitHub Actions workflow that runs `2119 check` on pull requests.
5. The AGENTS.md section MUST state that CI runs the same check, so agents on hookless platforms know the gate cannot be skipped.
Expand Down
27 changes: 21 additions & 6 deletions src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,28 @@ instead of describing product behavior. Use \`SHOULD\` for polish and edge cases
\`[manual]\` for UI-only behaviors, and notes or acceptance-checklist bullets for
implementation details rather than making every detail an enforced \`MUST\`.

**When implementing**, every MUST/SHALL requirement needs at least one test
**Requirement substance**: distinguish three kinds of text. Behavioral
requirements state what the product does — the normal home for normative
\`MUST\`s. Delivered-text contracts (agent-facing or interface text the product
delivers) are normative through the surface that delivers them: pin the
instruction or outcome that must survive, not a whole paragraph or heading
order. Verification notes — test strategy, CI commands, review procedure,
migration bookkeeping, tool versions — belong in notes or acceptance-checklist
bullets, not enforced \`MUST\`s.

**When implementing**, every MUST/SHALL requirement needs covering evidence
annotated with a comment containing its ID, e.g. \`// 2119: REQ-001.2.3\` (the
marker line must start with a comment leader). Write tests that would genuinely
fail if the requirement were violated — including its negative space: what the
requirement forbids needs a rejection test, not just what it allows. A
fresh-context reviewer judges each test's honesty; tautological or over-mocked
tests will be rejected.
marker line must start with a comment leader). One test MAY carry several
requirement IDs (\`// 2119: REQ-001.2.3, REQ-001.2.4\`): annotate existing
evidence that already covers a requirement instead of adding a near-duplicate
test for traceability. Write tests that would genuinely fail if the requirement
were violated — including its negative space: what the requirement forbids needs
a rejection test, not just what it allows — and that stay green under legitimate
non-violating changes (paraphrase, rename, reformat, reorganization); a test
whose only value is pinning spec wording, file layout, or digests the
requirement does not govern is a tripwire, not evidence. A fresh-context
reviewer judges each test's honesty; tautological or over-mocked tests will be
rejected.

**Reviewer diversity**: use reviewer models from different providers, routinely
or as periodic \`npx rfc2119 review --audit\` sweeps — adversarial audits of
Expand Down
Loading
Loading