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

+57
View File
@@ -0,0 +1,57 @@
---
id: check-tiering
title: Fast checks on every change, deep checks before release or on a schedule, with the freshness recorded
answers: Which checks must run now, which run later, and how old is the evidence from the deep ones?
rung: 3
section: completeness
languages: any
kinds: general
cost: medium
detect: just --version
ran_here: no
verified: docs
---
Note: modelled on a reference project, which keeps a table of each
technique, its command, its cost, how often it runs and the date and result of the
last run, and has CI run the heavy ones weekly. Not run here.
## Use when
- Some checks (mutation testing, long proofs, fuzzing, full end to end) take minutes or hours and cannot run on every edit.
- You want "done" for a small change to be fast and "release" to be thorough, with no confusion over which is which.
- Deep evidence goes stale after code changes and you need to see that.
## Do not use when
- All checks finish in under a minute. Put them in one gate (`single-gate-command`).
## Set up
Two commands: `check` (fast, every change) and `deep` (slow, release or schedule).
Keep a table `docs/verification-status.md`: technique, command, cost, cadence,
last run date, commit, result.
## Minimal example
`docs/verification-status.md`:
| technique | command | cost | cadence | last run | commit | result |
| clippy, tests | just check | 2 min | every change | CI | HEAD | pass |
| cargo-mutants | just mutants | 2 h | weekly | 2026-11-14 | a1b2c3d | 312 caught, 4 equivalent (see findings-log) |
| kani proofs | just prove | 20 min | before release | 2026-11-20 | e4f5a6b | pass |
A scheduled workflow (`on: schedule: - cron: "0 3 * * 1"`) runs `just deep`.
## Run
git rev-list --count a1b2c3d..HEAD -- src/ # commits since the deep evidence
Passing looks like: the fast set passes on this change, and for each deep
technique the recorded commit is the current one for the code it covers, or the count
of commits since touching that code is zero. If not zero, the deep result is stale:
say "last run at <commit>, N commits behind", never "passes".
## As a contract check
{"id": "deep-evidence-fresh", "claim": "Deep verification was run on the current code, or its age is reported", "kind": "general", "rung": 3, "cmd": "python3 tools/evidence_age.py docs/verification-status.md --max-commits 0", "expect": {"exit": 0}, "timeout_s": 60}
## What a pass does not prove
That the deep run itself was strong. A date with no commit hash is
unusable, and one hand-edited without running is false evidence: have CI write
the table. Splitting into tiers is only safe if release runs the deep tier; see
`release-gate`.
+57
View File
@@ -0,0 +1,57 @@
---
id: findings-log
title: A log of every defect found, rejected mutant and false alarm
answers: What has already been found, tried and ruled out, so I do not repeat or reopen it?
rung: 3
section: completeness
languages: any
kinds: general
cost: low
detect:
ran_here: no
verified: docs
---
Note: no tool. Modelled on a reference project, which records what
each proof and mutation run found, and which survivors were equivalent. Not run here.
## Use when
- A verification effort spans more than one session, and the next agent must know what the last one covered.
- A tool reports things that are not bugs (an equivalent mutant, a lint you decided to accept, a flaky test cause). Say so once, with the reason.
- You found a real defect: record its id, what caught it, and the regression test.
## Do not use when
- A single quick check with nothing to carry forward.
## Set up
Create `docs/findings.md` with a table or dated list. One line per finding.
Fields: date, what, how found (technique id), verdict, evidence, follow-up.
## Minimal example
| 2026-11-09 | Negative amounts accepted by the engine | kani | defect, fixed | test `rejects_negative_line` | none |
| 2026-11-09 | Mutant `a < b` to `a <= b` in `fees.rs:42` survived | cargo-mutants | equivalent: both branches return the same value when equal | read of lines 40-44 | none |
| 2026-11-10 | `test_sync` fails 1 in 50 | stress-repeat | defect: shared temp dir; fixed | passes 500 runs | none |
Every "equivalent" or "false alarm" verdict needs the reason, or it is just a
dismissal. Every defect names its regression test.
## Run
python3 - <<'PY'
import re,sys
rows=[l for l in open("docs/findings.md") if l.startswith("|") and "---" not in l]
bad=[l for l in rows if re.search(r"equivalent|false alarm",l) and len(l.split("|"))<7]
print("rows:",len(rows)); sys.exit(1 if bad else 0)
PY
Passing looks like: every row is complete and each defect row names a test that
exists (`grep -rn "rejects_negative_line" tests/`). Before starting, read the log for
the area; do not re-triage a recorded equivalent mutant.
## As a contract check
{"id": "findings-recorded", "claim": "Every defect found has a regression test and every dismissal has a reason", "kind": "general", "rung": 3, "cmd": "python3 tools/findings_lint.py docs/findings.md", "expect": {"exit": 0}, "timeout_s": 30}
## What a pass does not prove
That the log is complete: only what someone wrote. Keep the real record in the
repository, not the chat. A dismissal can be wrong; give it a date and re-open on a code
change to the area. The log is for the next agent, so write for someone who
saw none of this session.
+54
View File
@@ -0,0 +1,54 @@
---
id: no-stubs-scan
title: Scanning for stubs, skipped tests, commented-out assertions and placeholder data
answers: Is anything still a placeholder, skipped, or switched off in what I am calling finished?
rung: 3
section: completeness
languages: any
kinds: general
cost: low
detect: git --version
ran_here: yes
verified: ran
---
## Use when
- Always before saying "done". An unfinished function that compiles is the most common false finish.
- Tests were added or changed: skipped and `#[ignore]`d tests count as missing.
- You edited tests to get a green run (deleting or commenting an assertion is how a failing test gets quieted).
## Do not use when
- It is the only check. It finds markers, not missing work with no marker.
## Set up
Commit `scripts/stubscan.sh`. Tune the pattern to the languages in use. Where a
marker is legitimate (a documented known gap), list the file in the script's
exclusions with a reason, not a blanket `|| true`.
## Minimal example
`scripts/stubscan.sh`:
#!/usr/bin/env bash
pat='todo!\(|unimplemented!\(|NotImplementedError|^\s*sorry\b|#\[ignore|@pytest\.mark\.(skip|xfail)|\.skip\(|\bxit\(|t\.Skip\(|^\s*//\s*(assert|expect)|^\s*#\s*assert|lorem ipsum'
if git grep -n -I -E -i -e "$pat" -- . ':!scripts/stubscan.sh' ':!docs'; then exit 1; fi
`git grep` exits 0 when it finds a match, so a match fails the script. Also look in the diff:
`git diff BASE | grep -E '^-.*(assert|expect)'` lists assertions you removed.
For `unwrap()`/`panic!("not yet")` and `pass`-only bodies, add patterns to taste.
## Run
bash scripts/stubscan.sh
Passing looks like: no output, exit 0. Failure (run here) prints file:line for each
`todo!()`, `#[ignore]` and commented assertion, and exits 1. Then also ask: is
there placeholder data (names like `foo`, `test@example.com`, `12345`) in
shipped files, not tests? Grep for it by hand.
## As a contract check
{"id": "no-stubs", "claim": "No stub markers, skipped tests or commented-out assertions in the tree", "kind": "general", "rung": 3, "cmd": "bash scripts/stubscan.sh", "expect": {"exit": 0}, "timeout_s": 60}
## What a pass does not prove
A stub written without a marker (`return 0`, an empty `else`) passes. A test that
asserts nothing passes (see `vacuity-check`, `assertion-strength-review`). The
scan checks tracked and untracked files but not ignored ones. Do not weaken the
pattern to get a pass; add a justified exclusion instead.
+58
View File
@@ -0,0 +1,58 @@
---
id: release-gate
title: One command or workflow that must pass before release
answers: Is this exact build safe to publish, with the right version, notices, full tests and package contents?
rung: 3
section: completeness
languages: any
kinds: general
cost: medium
detect: just --version
ran_here: no
verified: docs
---
Note: modelled on a release workflow in a reference project (tag must
equal the program's version; notices current; packages built on the oldest supported
system; each package inspected for its contents; the release left as a draft).
Not run here.
## Use when
- You are about to tag, publish a package, push an image or hand over a build.
- A release process has more than two manual steps and one has been missed before.
## Do not use when
- Nothing is being released. For everyday work use `single-gate-command`.
## Set up
A script `scripts/release-gate.sh` that the release workflow calls first and fails
fast. Keep publishing a separate step that runs only after the gate. Leave the
release a draft until the owner has tried the package.
## Minimal example
#!/usr/bin/env bash
set -euo pipefail
ver=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)
[ "${GITHUB_REF_NAME:-v$ver}" = "v$ver" ] || { echo "tag != version $ver" >&2; exit 1; }
scripts/notices.sh --check
just check
cargo package --list | grep -q '^LICENSE' || { echo "LICENSE missing from package" >&2; exit 1; }
cargo package --locked --allow-dirty >/dev/null
git diff --exit-code # nothing the gate regenerated is uncommitted
## Run
scripts/release-gate.sh
Passing looks like: exit 0 and each step's own success line. Failure names the step
(`tag != version`, `notices out of date`). Then install the built package on a clean
machine and run it (`packaging-install-upgrade`, `clean-clone-build`); the gate
alone does not do that. Include the changelog entry and the deep tier (`check-tiering`).
## As a contract check
{"id": "release-gate", "claim": "The release gate passes for the version being released", "kind": "general", "rung": 3, "cmd": "scripts/release-gate.sh", "expect": {"exit": 0}, "tier": "deep", "timeout_s": 3600}
## What a pass does not prove
That the release works for users. A gate on a developer machine proves little
about a clean one; run it in CI from a fresh clone. A gate someone can skip by
tagging by hand is not a gate: have the workflow trigger on the tag and refuse
to publish unless the gate job passed.
@@ -0,0 +1,62 @@
---
id: requirement-to-check-map
title: Mapping each sentence of the request to a contract check, and listing what has none
answers: Does every thing the human asked for have a check, and which asks have none?
rung: 3
section: completeness
languages: any
kinds: general
cost: low
detect: python3 --version
ran_here: no
verified: docs
---
Note: no tool; the map is a small file and a script. The script was not run
here as written, only the traceability idea behind it (`spec-traceability`).
## Use when
- You start non-trivial work from a request in prose and are drafting `.sisi/contract.json` (core rule 1).
- The request is long, or has "and also" clauses that are easy to drop.
- You are about to say "done" and need to show nothing asked for was left out.
## Do not use when
- The request is a one-line change; just run its check.
- A numbered spec already exists; use `spec-traceability`.
## Set up
Copy the request into `.sisi/request.md`, one sentence or clause per line, each
tagged `Q1`, `Q2`, and so on. Number them in the order the human wrote them.
## Minimal example
`.sisi/request.md`:
Q1 Import the bank CSV into the books.
Q2 Skip rows that are already there.
Q3 Show me what was skipped.
Q4 Keep the old import working.
In the contract, add `"asks": ["Q1"]` to the check that proves each, or list a
sentence under `"unchecked": {"Q3": "needs the human; screen output"}` with the reason.
## Run
python3 - <<'PY'
import json,re,sys
q=set(re.findall(r"^(Q\d+)",open(".sisi/request.md").read(),re.M))
c=json.load(open(".sisi/contract.json"))
have={a for k in c["checks"] for a in k.get("asks",[])}|set(c.get("unchecked",{}))
miss=sorted(q-have); print("no check:",miss or "none"); sys.exit(1 if miss else 0)
PY
Passing looks like: `no check: none`, exit 0. Failure prints the sentences with no
check, exit 1. Report every `unchecked` entry in the final answer as not verified.
## As a contract check
{"id": "request-mapped", "claim": "Every sentence of the request maps to a check or a stated reason it has none", "kind": "general", "rung": 3, "cmd": "python3 tools/request_map.py", "expect": {"exit": 0, "stdout_contains": "no check: none"}, "timeout_s": 30}
## What a pass does not prove
That the check is strong; a Q mapped to a weak check passes. Read the map for
the sentences where the check is only "the command runs". Implicit asks (the
human did not write "do not break the old import") are missing: Q4 above must
be added by you, from the invariants in core rule 3. An `unchecked` list is
honest only if it is reported.
@@ -0,0 +1,59 @@
---
id: single-gate-command
title: One project command that runs everything required, so done has one definition
answers: Is there exactly one command whose success means the project's required checks all pass?
rung: 3
section: completeness
languages: any
kinds: general
cost: low
detect: just --version
ran_here: yes
verified: ran
---
Ran here: a two-step `justfile` recipe, failing and then passing. Make works the
same way with a `verify` target.
## Use when
- A project has several checks (format, lint, tests, dependency audit, notices) and people or agents run a different subset each time.
- You want the contract's required checks, CI and a developer's "am I done" to be the same thing.
- Starting a project: create the gate on day one, while it is small.
## Do not use when
- Some checks take hours. Put those in the deep tier (`check-tiering`); the gate is the fast set.
## Set up
# justfile
set shell := ["bash", "-euo", "pipefail", "-c"]
check:
cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
scripts/stubscan.sh
cargo deny check
CI must run `just check` and nothing else for the pull-request job, or the two definitions diverge.
## Minimal example
check:
test "$(cat flag.txt)" = ok
echo "gate passed"
`just check` with `flag.txt` containing `bad` stops at the first failing line, prints
the line `error: recipe check failed on line 3 with exit code 1` and exits 1; with `ok` it prints `gate passed`, exit 0.
## Run
just check
Passing looks like: exit 0, with each step's output visible. just stops at the first failing line. In Make, each line is its own shell and
also stops the recipe, but a multi-line `if` or loop needs `&&` chaining or `.ONESHELL` with `set -e`. Never write `command || true` in the gate.
## As a contract check
{"id": "gate", "claim": "The project gate command passes", "kind": "general", "rung": 3, "cmd": "just check", "expect": {"exit": 0}, "tier": "deep", "timeout_s": 1800}
## What a pass does not prove
Only what the gate contains. The usual rot is a check removed from the recipe, or a
step that exits 0 on failure. Review diffs to the gate file as closely as code, and
ensure a deliberately broken input fails it (check the check). A gate
that is too slow gets skipped; keep the fast set fast.
@@ -0,0 +1,65 @@
---
id: spec-traceability
title: Requirement ids cited by code and tests, with a test that fails on an unknown, uncited or untested id
answers: Is every requirement implemented and tested, and does every cited id exist?
rung: 3
section: completeness
languages: any
kinds: general, state-machine, money
cost: medium
detect: python3 --version
ran_here: yes
verified: ran
---
Modelled on a reference project, where each rule has an id, tests live
under a `spec/` folder keyed by those ids, and a loader test fails when a
claim has no test. The script below was run here on a scratch repository.
## Use when
- There is a written specification (rules, requirements, invariants) and "all of it is done" must be checkable.
- The request has many separate rules and one is easy to forget.
- A reviewer asks "where is rule R-17 implemented, and what tests it?"
## Do not use when
- The task is small or has no written requirements. Use `requirement-to-check-map` for the request's sentences.
- Ids would be cited without being exercised. The citation proves a link, not that the test is strong; see `assertion-strength-review`.
## Set up
Give every requirement a stable id in one file (`spec/requirements.md`, lines
`- R-001: text`). Code cites `implements: R-001` in a comment; each test cites
`covers: R-001`. Never renumber; retire an id with a note.
## Minimal example
`scripts/spec_trace.py` (standard library, run from the repository root):
import re, subprocess, sys
ids = set(re.findall(r"^- (R-\d+):", open("spec/requirements.md").read(), re.M))
files = subprocess.run(["git","ls-files","-co","--exclude-standard","src","tests"],
capture_output=True, text=True, check=True).stdout.split()
impl, cov = set(), set()
for f in files:
t = open(f, errors="ignore").read()
impl |= set(re.findall(r"implements:\s*(R-\d+)", t))
cov |= set(re.findall(r"covers:\s*(R-\d+)", t))
bad = [f"unknown id cited: {i}" for i in sorted((impl|cov)-ids)]
bad += [f"{i}: no code cites it" for i in sorted(ids-impl)]
bad += [f"{i}: no test covers it" for i in sorted(ids-cov)]
print("\n".join(bad) or f"ok: {len(ids)} requirements traced")
sys.exit(1 if bad else 0)
## Run
python3 scripts/spec_trace.py
Passing looks like: `ok: N requirements traced`, exit 0. Failure lists each problem
(`R-002: no test covers it`, `unknown id cited: R-009`) and exits 1 (run here).
## As a contract check
{"id": "spec-traced", "claim": "Every requirement id is cited by code and by a test, and every cited id exists", "kind": "general", "rung": 3, "cmd": "python3 scripts/spec_trace.py", "expect": {"exit": 0, "stdout_contains": "requirements traced"}, "timeout_s": 60}
## What a pass does not prove
That a test citing `covers: R-001` actually checks R-001, or even passes. A
comment is cheap. Strengthen it: the test run must also pass, and the cited test
should fail when the requirement's code is broken (`mutation-on-diff`). Also
count the ids: a spec that was quietly shortened passes, so compare the id count to the
agreed spec in review.