From 6f04edb7bfba419e1d32526005753e855984eceb Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Mon, 23 Nov 2026 12:13:56 -0700 Subject: [PATCH] gate rebuild 7: docs for the gate flow, changelog --- CHANGELOG.md | 16 ++++++++++++++++ docs/design.md | 8 +++++--- docs/records.md | 40 ++++++++++++++++++++++++++++++++++++++++ docs/target.md | 17 +++++++++++++---- 4 files changed, 74 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef82f1a..758dd64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,9 +17,25 @@ All notable changes to this project are recorded here. The format follows - Telemetry with a class on every value, the eight-dimension scorecard, and `sisi status` as the one report (recent units, then trends by project, risk profile, model and policy version). - Scratch pruning of old session state, on a counter at session start. +- The end-of-turn gate is rebuilt on risk profiles (docs/records.md, "The end-of-turn gate"): it + enforces exactly the `requirements` row of `canon/risk.json` for the profile (a contract, checks + with `covers`, invariants, a requirement list, a risk note, an `approach`, independent evidence), + in one send-back that lists everything missing; a retro is asked only when the checks are green and + a unit is open, and a recorded retro closes the unit. A contract may declare a profile below its + floor only with `risk.why`; `sisi status` shows such a unit as lowered and lists open and paused + units with their age. `independent` checks name who or what produced them (`by`). A unit the gate + released after its send-backs is `unverified` and says why. The gate notes, once, when a + logic-or-higher change has no check stronger than example tests. A commit or merge with no passing + `sisi verify` result for the tree prints a one-line notice. This repository's own `.sisi/risk.json` + is tracked. ### Removed +- The gate's line-count thresholds (`gate.growth_lines`, `gate.growth_files`) and + `canon/floors.json` (minimum rungs by self-declared check kind); `C.floors()` and + `C.floor_failures()`; the `[floor ok]` marks of `sisi verifiers for --kind`; the gate's retro demand + on every stop that edited anything and on subagents; its "someone else broke it" notice (a session + is no longer sent back for another session's edits, so there is nothing to explain). - `sisi note` and `sisi propose`: use `sisi retro` or `sisi learn`. Existing notes and proposal files in a personal store are no longer read. - `sisi audit` and the audit module. diff --git a/docs/design.md b/docs/design.md index ae6112e..1ef3c6d 100644 --- a/docs/design.md +++ b/docs/design.md @@ -136,8 +136,10 @@ Claude Code supports a blocking stop hook. The equivalent in OpenCode, Codex and does not exist, verification is meant to run at the next session start and failures to be reported then (that fallback is a design intention, not built). -**Floors.** Some kinds of claim have a minimum rung. Concurrency, parsing, money, state machines and data -migration may not rest on example tests alone. The floors are in `canon/floors.json`. +**What a risk profile requires.** The strength of the evidence follows the risk of the change, not the kind a +check declares for itself: logic and above need every check to say what it covers, integration and above need +invariants, a requirement list, a risk note and an approach, and data, critical and release need independent +evidence. The table is `requirements` in `canon/risk.json`; the gate enforces it and nothing else. **Formal tooling is provisioned.** sisi keeps a verifier library: for each language and kind of claim, the tool, a working template and a worked example (Kani and Verus for Rust, TLA+ or Quint and Alloy for designs, @@ -311,7 +313,7 @@ Built and covered by tests: - The end-of-turn gate (`sisi gate`) and session-start hook (`sisi tick`), wired into Claude Code with a blocking hook; wiring (`sisi install`, `uninstall`, `doctor`) also points Codex and OpenCode at the rulebook, where nothing blocks. -- The rulebook (`canon/core.md`), the minimum-rung floors, the verifier library and the recipes. +- The rulebook (`canon/core.md`), the risk table, the verifier library and the recipes. - Retrospectives and lessons (`sisi retro`, `sisi lessons`), `sisi learn` live at once, time to delivery (`sisi time`). - Choosing the approach as a checked step: the contract design section, `sisi design`, the gate's diff --git a/docs/records.md b/docs/records.md index 3a38183..f182260 100644 --- a/docs/records.md +++ b/docs/records.md @@ -31,6 +31,46 @@ plainly `delivered`. `sisi contract waive` records a deviation; it turns nothing A pause records what the unit waits for. While nothing in the tree changes the gate asks nothing; a change ends the wait. Waiting time is telemetry. +## The end-of-turn gate + +At each stop the gate asks, in order: did **this session** change anything since its last settled +stop (its own edits only, read from its transcript and the before/after shell measurement, never another +session's work in the same tree)? If not, the turn ends silently, as it does for a paused unit with no +new change and for a closed unit. Otherwise it works out the profile and enforces what that profile's +row of `canon/risk.json` requires, and nothing else: + +| Profile | Required | +|---|---| +| trivial | nothing (the retro is asked once only if the unit shows two send-backs or a human correction) | +| isolated | a contract with at least one check that can fail | +| logic | as isolated; every check has `covers` | +| integration | as logic; `invariants`, a `requirements` list (kind, text, decision), `risk.blast_radius` and `risk.rollback`, and an `approach` (chosen, why, an alternative) | +| data, critical | as integration, plus independent evidence | +| release | as data, plus every deep check passing on the tree | + +Independent evidence is an accepted `review` delegation in the ledger for this project inside the unit's +window with a check stronger than `none`, or a passing check with `"independent": true` and a `"by"` +naming who or what produced it. Text such as `TODO`, `n/a` or `none` fills no field. + +The profile is the floor (from the paths changed, see `sisi risk`) unless the contract declares a higher +one. A contract may declare a lower one only with `risk.why`; the unit then runs at the declared profile and +the record keeps floor, declared profile and reason, and `sisi status` shows it as lowered. Without a +reason the floor applies. With no unit open the floor covers the paths this session changed since its last +settled stop. + +One send-back lists everything missing, each with the command or field that supplies it, within 25 lines. +When the checks pass and everything required is present, a unit with recorded retro findings is closed and +the turn ends; otherwise the gate says once, for that state of the tree, the two ways on: `sisi retro` +(which records the findings and so closes the unit) or `sisi unit pause ""`. A pause +ends when the tree changes; `sisi contract init` refuses while a unit is open or paused; `sisi status` +lists open and paused units with their age. Send-backs are bounded (`gate.max_blocks`); when they run out +the gate lets the turn end, the unit's delivery status is `unverified`, the record says why, and the +agent is told to say so in its report. A subagent's stop never blocks and never asks for a retro; what it +observed (that it edited, and which files) is recorded for its parent's gate. When a logic-or-higher unit +has no check stronger than examples (rung 2 or better) the gate says so once, without blocking, and the +record stores whether the unit had one. A `git commit` or `git merge` whose unit has no passing result for the +current tree prints a one-line notice (`sisi verify`) and is never blocked. + ## Verification Five statuses: `passed`, `failed`, `skipped`, `not-applicable`, `not-run`; the last three always diff --git a/docs/target.md b/docs/target.md index add0d22..2041cea 100644 --- a/docs/target.md +++ b/docs/target.md @@ -64,13 +64,17 @@ What a profile requires. The gate enforces exactly this table and nothing else: | trivial | no | the diff; a targeted check when one exists | no | no | no | only on an anomaly (two send-backs, or a human correction) | | isolated | yes | at least one that is not vacuous | no | no | no | yes | | logic | yes | as isolated, each with `covers` | no | no | no | yes | -| integration | yes | as logic, plus invariants | yes | yes | no | yes | +| integration | yes | as logic, plus invariants and an `approach` | yes | yes | no | yes | | data, critical | yes | as integration | yes | yes | yes | yes | | release | yes | every check (`--all`) | yes | yes | yes | yes | -"Requirement model" is the contract's `requirements` list (section 4). "Risk note" is -`risk.blast_radius` and `risk.rollback`. "Independent evidence" is a judged review delegation -in the ledger for this unit, or a passing check marked `"independent": true`. +"Requirement model" is the contract's `requirements` list (section 4); an `approach` is the +contract's `approach` object with `chosen`, `why` and at least one alternative. Text such as `TODO`, +`n/a` or `none` fills no field. The table is held as data in `canon/risk.json` (`requirements`, with +machine keys beside the prose ones) and read by the gate. "Risk note" is +`risk.blast_radius` and `risk.rollback`. "Independent evidence" is an accepted review delegation +in the ledger for this project inside the unit's window with a check stronger than `none`, or a passing check +marked `"independent": true` that names who or what produced it in `"by"`. ## 4. The work unit [10] @@ -175,6 +179,11 @@ At the end of a turn in which the session changed something: (`sisi retro`), which closes the unit; or `sisi unit pause ""`. 5. A paused or closed unit with no new change passes silently. +In this build the retro is offered once for each state of the tree and a trivial change is asked +nothing (unless the unit shows an anomaly); a recorded retro closes the unit. A session is judged only on +its own edits, so another session's work in the same tree never sends it back. The detail is in +docs/records.md, "The end-of-turn gate". + Send-backs stay bounded; when they run out the unit is released as `unverified` and recorded as such. Subagents are never sent back for a retro: a subagent's last message is its report to its parent and must stay that. The question-dialog gate stays as it is.