sisi 0.1.0: a shared rulebook and verification tool for AI coding agents
ci / tests (macos-latest, python 3.11) (push) Canceled after 0s
ci / tests (macos-latest, python 3.13) (push) Canceled after 0s
ci / tests (macos-latest, python 3.9) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.11) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.13) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.9) (push) Canceled after 0s

Contracts with a ladder of checks, an end-of-turn gate, retrospectives and
shared lessons, time-to-delivery measurement, a library of 140 verification
techniques and 20 recipes, personal data kept outside the clone, and
releases with rollback. Standard library only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-22 22:29:02 -07:00
commit 2fc1fe9c2d
223 files changed
+22163

No files matched your search

+60
View File
@@ -0,0 +1,60 @@
---
id: acceptance-examples
title: Acceptance examples agreed with the human up front and made executable
answers: Does the program give the exact results the human said they wanted for concrete cases?
rung: 3
section: intent
languages: any
kinds: general, money, parsing
cost: low
detect:
ran_here: no
verified: docs
---
Note: there is no tool. The example runner below is plain test code; it was
not run here as a separate artefact. `verified: docs` reflects that the method
is standard specification by example.
## Use when
- The request is a behaviour in words ("round fees to the nearest cent", "a late invoice gets a reminder"). Words are ambiguous; examples are not.
- The human will not review code but will read a table of inputs and outputs.
- You have to choose between readings of the request and want the human's choice fixed before you build.
## Do not use when
- The claim is "this holds for all inputs". Examples show cases only; use a property or proof (rung 1 or 2).
- The behaviour is visual or tasteful; see `pairwise-comparison`.
## Set up
Write `acceptance/examples.json` and show it to the human once (core rule 5: one
round of confirmation, with your default stated). Edge cases first: zero,
empty, the largest, a tie, a negative, an invalid input and what it must do.
## Minimal example
`acceptance/examples.json`:
[
{"name": "tie rounds to even", "in": {"amount": "2.675", "dp": 2}, "out": "2.68"},
{"name": "zero", "in": {"amount": "0", "dp": 2}, "out": "0.00"},
{"name": "negative", "in": {"amount": "-1.005", "dp": 2}, "out": "-1.00"},
{"name": "bad input", "in": {"amount": "abc", "dp": 2}, "error": "invalid amount"}
]
`acceptance/test_examples.py` loops over the file, calls the product through its
public entry point, and fails with the example's `name`.
## Run
python3 -m unittest discover -s acceptance -v
Passing looks like: one `ok` per example, exit 0. Failure names the example,
the expected and the actual. Never edit an expected value to make a run pass;
a changed expectation goes back to the human as a contract amendment.
## As a contract check
{"id": "acceptance-examples", "claim": "Every example the human agreed gives the stated result", "kind": "general", "rung": 3, "cmd": "python3 -m unittest discover -s acceptance", "expect": {"exit": 0}, "tier": "deep", "timeout_s": 120}
## What a pass does not prove
Only the cases listed. Check that the examples can fail: change the code on
purpose (swap round-half-even for round-half-up) and see at least one fails.
Examples you wrote and the human skimmed are weak; flag which the human
confirmed. Add a property test for the rule behind them where one exists.
@@ -0,0 +1,56 @@
---
id: domain-evidence-report
title: Printing the domain's own reports as evidence a behaviour change is right
answers: Do the numbers a domain expert would read (trial balance, P&L, balance sheet) come out right after my change?
rung: 3
section: intent
languages: any
kinds: money, general
cost: low
detect:
ran_here: no
verified: docs
---
Note: modelled on how a reference project (an accounting program)
shows its books after each change. Not run here.
## Use when
- You changed behaviour whose correctness a domain expert judges by a standard report: accounting (trial balance, P&L, balance sheet), inventory (stock on hand), billing (statement), scheduling (calendar).
- The human cannot read the diff but can read the report.
- A bug fix must be shown to correct the figure the user complained about.
## Do not use when
- The report is generated by the same code you changed and you have no independent expectation. Then it shows what the code does, not what it should do.
## Set up
Build a small, fixed scenario (a few entries or orders) whose correct report you
can compute by hand or already know. Keep the inputs in the repository.
## Minimal example
Scenario: a $100 sale and a $40 expense in the same period. Expected, by hand:
revenue 100.00, expense 40.00, net income 60.00, and a trial balance whose debit and
credit totals both equal 140.00.
$ product report trial-balance --period 2026-01 > out/tb.txt
$ grep -E "^(TOTAL|Net income)" out/tb.txt
TOTAL 140.00 140.00
Net income 60.00
## Run
product report trial-balance --period 2026-01 | diff -u expected/tb.txt -
product report profit-and-loss --period 2026-01 | diff -u expected/pl.txt -
Passing looks like: empty diff, exit 0. Failure is a diff showing which line
differs. Print the report in the final answer so the human can read it. The
expected file must come from hand calculation or an independent source, and the
check that the report foots (debits equal credits; assets equal liabilities plus equity) is a built-in test of itself.
## As a contract check
{"id": "tb-expected", "claim": "The trial balance for the fixed scenario matches the hand-computed report", "kind": "money", "rung": 3, "cmd": "product report trial-balance --period 2026-01 | diff -u expected/tb.txt -", "expect": {"exit": 0}, "timeout_s": 60}
## What a pass does not prove
Only the scenario. Include the cases that change the report: a reversal, a
period boundary, a rounding tie. An expected file generated by running the
product proves nothing; say how you derived it. For money cores, pair with a
property or proof that the invariants hold for all inputs.
+58
View File
@@ -0,0 +1,58 @@
---
id: feedback-as-amendment
title: Feedback restated as a one-line contract amendment, with a scope check on the diff
answers: Did I change only what the human's feedback asked for, and nothing else?
rung: 3
section: intent
languages: any
kinds: general
cost: low
detect: git --version
ran_here: yes
verified: ran
---
## Use when
- The human reacts to your work ("the button is too big", "round down not up", "the second paragraph is wrong"). Core rule 4: this is an amendment, not licence to rework.
- A previous change reached further than the request; you want to make that impossible.
- You are fixing a review comment and the diff must show only that fix.
## Do not use when
- The feedback truly spans the work ("start over"). Then write a new contract.
## Set up
Record the amendment in one line in `.sisi/contract.json` (as a new check or a
note) and name the paths it may touch. Note the commit you start from:
`git rev-parse HEAD`. Re-run the invariants from rule 3.
## Minimal example
Amendment: "Round fees down to the cent, only in `src/fees.py`." Scope script
`scope.sh` fails on any changed or new file outside the given paths:
#!/usr/bin/env bash
set -eu
base=$1; shift
changed=$( { git diff --name-only "$base"; git ls-files -o --exclude-standard; } | sort -u)
allowed=$(git ls-files -c -o --exclude-standard -- "$@" | sort -u)
outside=$(comm -23 <(printf '%s\n' "$changed") <(printf '%s\n' "$allowed") | sed '/^$/d')
[ -z "$outside" ] || { echo "outside the amendment:"; echo "$outside"; exit 1; }
echo "ok: all changes inside $*"
For regions inside one file, list the hunks: `git diff -U0 "$base" -- src/fees.py | grep '^@@'`
and check each range lies in the function the amendment names.
## Run
scope.sh "$BASE" src/fees.py tests/test_fees.py
Passing looks like: `ok: all changes inside ...` and exit 0 (run here on a scratch
repository). Failure prints `outside the amendment:` and the files, exit 1.
Formatting churn, renames and lockfile changes show up here; revert them.
## As a contract check
{"id": "amendment-scope", "claim": "Only the files named by the amendment changed since the base commit", "kind": "general", "rung": 3, "cmd": "bash scripts/scope.sh $(cat .sisi/base) src/fees.py tests/test_fees.py", "expect": {"exit": 0, "stdout_contains": "ok: all changes inside"}, "timeout_s": 60}
## What a pass does not prove
That the change inside the allowed file is correct, or that it did not damage
behaviour in a file that depends on it. Run the invariants for that. The
allowed list is a decision: keep it as small as the feedback. Staged and
unstaged changes are both covered by `git diff BASE`; commit history is not.
@@ -0,0 +1,59 @@
---
id: owner-acceptance-runbook
title: A scripted acceptance walked through using only the product's public surface
answers: Can the owner, or an agent acting as the owner, do the real job end to end using only what the product exposes?
rung: 6
section: intent
languages: any
kinds: general, ui
cost: medium
detect:
ran_here: no
verified: docs
---
Note: modelled on a runbook in a reference project (a re-audit done
through the product's tools alone, with a test mirroring it). Not run here.
## Use when
- The product is finished, or a large part is, and the question is "does it do what the owner wanted?" not "do the units pass?".
- Several features must work together, and unit tests passed each on its own.
- The human wants to run a short script and see for themselves.
## Do not use when
- The change is small or internal; a runbook costs more than it finds.
- Nobody, human or agent, can run the product in its real environment.
## Set up
Write `docs/runbooks/acceptance.md`. Each step: what to do, using only the CLI,
the UI, the API or the agent tools the product ships (never the database, a
debugger or a source file); what to expect; what to do on a mismatch. Say who
acts: the owner, or an agent with no access to the source.
## Minimal example
1. Start the product on an empty data directory: `product serve --data /tmp/acc`.
Expect: "listening on 127.0.0.1:8080", exit when stopped with code 0.
2. Create a customer via the public API (curl in the runbook). Expect: 201 and an id.
3. Issue an invoice for $100 and fetch the statement. Expect: balance 100.00.
4. Restart the product on the same directory. Expect: the same balance.
5. If any expectation fails, stop. The runbook or the product is wrong; say which.
## Run
An agent walks the runbook, copying each command and its real output into
`acceptance-report.md`. The owner reads the report, or walks it themselves.
Every step records pass, fail or not run.
Passing looks like: every step passed with real output pasted, nothing skipped,
and the report names who ran it and on what version. A runbook step that needed a
workaround is a failure of the product, even if the workaround worked.
## As a contract check
{"id": "acceptance-runbook", "claim": "The acceptance runbook passes end to end through the public surface", "kind": "general", "rung": 6, "cmd": "python3 tools/walk_runbook.py docs/runbooks/acceptance.md", "expect": {"exit": 0, "stdout_contains": "ALL STEPS PASSED"}, "tier": "deep", "timeout_s": 900}
`tools/walk_runbook.py` is yours to write; where steps are human-only, the contract
check is the owner's recorded verdict, not a command.
## What a pass does not prove
Only the journeys written down. An agent that can read the source may use it, so
state what it may not read. Steps that depend on data from a previous run give
false passes; start clean. The owner's own pass is the only one that counts as rung 6.
+58
View File
@@ -0,0 +1,58 @@
---
id: pairwise-comparison
title: Before and after shown side by side instead of scored in the absolute
answers: Is the new version better than the old one for the thing the human cares about?
rung: 5
section: intent
languages: any
kinds: general, ui
cost: low
detect:
ran_here: no
verified: docs
---
Note: no tool; the procedure is the technique. Not run here.
## Use when
- You changed something that already worked (a layout, a message, a report, a prompt) and the risk is that it got worse.
- "Is this good?" has no stable answer but "which is better?" does.
- You have a before capture from `baseline-before-change`.
## Do not use when
- There is an exact correct output; test it.
- There is no earlier version. Use `rubric-judge` or `acceptance-examples`.
## Set up
Capture the old output before your first edit and the new output after, from
identical inputs. Strip anything that gives away which is new (dates, version
strings, file names). Randomise which is shown as A and B.
## Minimal example
For a judge or the human, a two-column card:
Task: the invoice email, same data.
A: <output 1> B: <output 2>
Question: which is clearer for a customer who owes money? Answer A, B or tie, and quote the line that decided it.
Run each pair twice with the sides swapped. A verdict that changes with the
order is "tie".
## Run
python3 tools/pair.py --before out/before.txt --after out/after.txt --judge other-family --swap
Passing looks like: "after" wins or ties on both orders for every case, and no case
is a loss. Report wins, ties and losses, with the quote for each loss. For a
human, show images or text side by side and record the verdict with
`sisi learn` only if the human states a lasting preference.
## As a contract check
{"id": "pairwise-not-worse", "claim": "The new output is never judged worse than the old", "kind": "general", "rung": 5, "cmd": "python3 tools/pair.py --before out/before.txt --after out/after.txt --swap --fail-on-loss", "expect": {"exit": 0}, "tier": "deep", "timeout_s": 300}
`tools/pair.py` is yours to write; it must exit non-zero on a loss.
## What a pass does not prove
That the new version is good, only that it is not worse on the cases shown.
Small samples hide rare losses; include the cases that were hard. A judge that
shares the author's model family leans toward the author's style. Position bias
is why you swap. For anything the human cares about, they decide.
+58
View File
@@ -0,0 +1,58 @@
---
id: rubric-judge
title: A written rubric scored by an independent model judge
answers: Does the output meet qualities a command cannot measure, such as clarity, tone or fit to the brief?
rung: 5
section: intent
languages: any
kinds: general, ui
cost: medium
detect:
ran_here: no
verified: docs
---
Note: no tool is needed beyond a model CLI or API you already use. The honesty
measures below follow published LLM-as-judge practice; nothing here was run.
## Use when
- The claim is about quality that has no exact answer: a summary, an error message, a design, documentation, a tool description.
- Human review would be the only check otherwise and you want to narrow what the human must read.
- You can write what good looks like as a short list of yes-or-no criteria.
## Do not use when
- A command, test or proof can decide it. A judge is a sample of opinion; it is the weaker rung.
- You are the only model available. A model judging its own work agrees with itself.
## Set up
Write `rubric.md`: 4 to 8 criteria, each a question with a clear pass line and one
example of a pass and a fail. Gather a calibration set from `taste-baseline`.
## Minimal example
`rubric.md` excerpt:
C1 States what happened in the first sentence. Pass: "The import failed: row 12 has no date." Fail: "An error occurred."
C2 Says what to do next. C3 Contains no internal jargon. C4 Under 40 words.
Reply as JSON: {"C1": true|false, "C2": ..., "evidence": {"C1": "<quote>"}}
## Run
Keep the judge honest:
- Blind: give it the output and the rubric only, never the request history, your reasoning or which version is "new".
- A different model family from the one that wrote the work, with temperature 0, and require a quoted line as evidence for every verdict.
- Calibrate first: run the judge on 10 or more outputs the human already judged; require at least 90% agreement. If lower, fix the rubric, not the threshold.
- Run it 3 times and take the majority; a criterion that flips is a vague criterion.
- Treat any false as a failed check, and report the quotes.
Passing looks like: every criterion true in the majority of runs, with quotes
that actually appear in the output, and calibration agreement recorded.
## As a contract check
{"id": "rubric-judge", "claim": "Independent judge passes all rubric criteria", "kind": "general", "rung": 5, "cmd": "python3 tools/judge.py --rubric rubric.md --input out/summary.txt --min-agree 0.9", "expect": {"exit": 0, "stdout_contains": "ALL PASS"}, "tier": "deep", "timeout_s": 300}
`tools/judge.py` is yours to write; it must exit non-zero on any failed criterion.
## What a pass does not prove
That the human would agree. Judges favour long, confident, polished text and
their own style. Quotes can be checked mechanically (is the quote in the
output?); do that. Check the judge can fail: feed it a deliberately bad output.
A pass at rung 5 does not replace a human check for anything the human cares about.
+60
View File
@@ -0,0 +1,60 @@
---
id: taste-baseline
title: Recording the human's past verdicts on before and after pairs
answers: Does this work match what this human has said they prefer, in cases they already judged?
rung: 6
section: intent
languages: any
kinds: general, ui
cost: low
detect:
ran_here: no
verified: docs
---
Note: no tool. The store is plain files; not run here.
## Use when
- The human's judgement is the real test (layout, wording, density, tone) and they have already given verdicts you can reuse.
- You run `rubric-judge` and need cases to calibrate it against.
- The same kind of complaint comes back repeatedly.
## Do not use when
- You have no recorded verdicts. Do not invent them; ask once, or use `pairwise-comparison` with the human.
- A preference was a one-off about a different context.
## Set up
Create `docs/taste/` with one small file per verdict. Record a verdict only when
the human states it (core rule 7: `sisi learn "<their words>"` for lasting
preferences, quoted, never your inference).
## Minimal example
`docs/taste/0007-invoice-email.md`:
date: 2026-11-09
pair: before/invoice-email.txt vs after/invoice-email.txt
verdict: after
their words: "Better. But keep the amount in the subject line."
rule it implies: the amount stays in the subject.
## Run
List the verdicts that apply to the area you changed, then re-run the pairs
through the judge or show the human only the cases that differ from past verdicts:
ls docs/taste/ | head
python3 tools/taste_check.py --judge-config judge.json --taste docs/taste/
Passing looks like: for every recorded pair in scope, the judge's verdict equals
the human's (agreement at or above the threshold), and no implied rule is violated
(for the example, the subject still has the amount: `grep -q '\$' out/subject.txt`).
## As a contract check
{"id": "taste-rules", "claim": "Rules implied by the human's past verdicts still hold", "kind": "general", "rung": 6, "cmd": "python3 tools/taste_check.py --taste docs/taste/", "expect": {"exit": 0}, "tier": "deep", "timeout_s": 300}
`tools/taste_check.py` is yours to write; turn each implied rule into a command
where you can, and list the rest as "needs the human".
## What a pass does not prove
Verdicts are about the pairs shown; a new context may need a new verdict. Old
verdicts can be stale: date them and let the human retire them. Your summary of
their words is not their words; keep the quote.