Gate judges a session by its own edits, measured, not guessed
ci / tests (macos-latest, python 3.10) (push) Canceled after 0s
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.10) (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 (macos-latest, python 3.10) (push) Canceled after 0s
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.10) (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
The end-of-turn gate attributes changed files to the session that changed them: edit tool calls by path, and shell commands by a snapshot of the tree before and after. A session answers for failing checks, and is asked for a retrospective, only over its own files. Another agent's work in progress is allowed once, marked unverified, with a note that the work is not done. Single-session behaviour is unchanged, shown by a property test. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
e5b603486b
commit
5744f3149c
15 files changed
+1387
-41
No files matched your search
+23
-2
@@ -303,7 +303,8 @@ Designed, not built:
|
||||
- Replay experiments on the task set before a learned change ships, brief templates, playbooks. (Shipping and
|
||||
removal of learned changes exist in the simpler ship-first-measure-after form described in Part 3.)
|
||||
- The taste judge and rung 5 judging by a model.
|
||||
- Blocking gates for tools other than Claude Code.
|
||||
- A blocked turn proven end to end in each tool. Gates are built for the tools whose hooks allow one
|
||||
(see [harnesses.md](harnesses.md)); most are tested against the documented hook format only.
|
||||
- Harvest sources other than Claude Code.
|
||||
|
||||
## Build order
|
||||
@@ -340,5 +341,25 @@ resumes without redoing closed nodes (to be model-checked, then tested).
|
||||
- Experiments at this volume detect large effects only.
|
||||
- The taste judge is worthless until the human has given enough verdicts, and it is trusted per kind of work,
|
||||
not globally.
|
||||
- Blocking gates outside Claude Code, Muse's instruction path and Codex's hook format are unverified.
|
||||
- Outside Claude Code and Copilot CLI, a blocked turn has not been run end to end; Muse has no confirmed
|
||||
instruction path or end-of-turn hook, and OpenCode's plugin events are unproven.
|
||||
- The end-of-turn gate attributes edits per session. Edit-tool calls are read from the session's own
|
||||
transcript (incrementally, from a per-session offset), including the transcripts of subagents it
|
||||
started natively. Shell commands are not judged from their text where the tool has before/after tool
|
||||
hooks (Claude Code, Codex, Gemini, Copilot and Cursor have them wired): `sisi watch` takes a stat-only
|
||||
tree snapshot (file sizes and modification times, `.gitignore` honoured, `.git` never included) before
|
||||
and after the command and attributes exactly the paths that changed to that session, and the session
|
||||
answers for a failing check only when a path changed since the last passing state is attributed to
|
||||
it. That measurement has honest limits: another agent changing the tree inside this session's command
|
||||
window is attributed to this session (it errs strict, the safe side); a change that keeps a file's
|
||||
size and mtime, a write to a git-ignored file, and a write between the last complete transcript line
|
||||
and a crash are invisible; `git commit` changes only `.git` and so is never an edit; sisi's own
|
||||
commands write only personal data and state (except `sisi contract init/waive/trust`) and never count,
|
||||
so `sisi retro` cannot create the need for another retro. Where a tool has no before/after tool events
|
||||
(Qwen, Pi, OpenCode), shell commands are still judged by the older command-text classifier, which
|
||||
over-attributes interpreters and test runners. A missing or unreadable transcript, a corrupt line, an
|
||||
unparseable shell command, a shell command whose after-record never arrives, and an unread transcript
|
||||
tail over 64 MB are all treated as "this session edited" — strict — never as "someone else did it".
|
||||
Attribution decides who is sent back and who owes a retrospective; it never turns a failing check into
|
||||
a pass — a stop allowed over another session's failing tree is recorded unverified, once per tree state.
|
||||
- This is several months of building. Each phase is useful on its own.
|
||||
+16
-9
@@ -27,17 +27,19 @@ uninstalling makes hooks exit silently instead of erroring on every turn. The pe
|
||||
between each tool's hook JSON and the gate lives in `sisi/hookio.py`; the adapters live in
|
||||
`sisi/adapters.py`; the textual JSON editing lives in `sisi/hookjson.py`. Install also links any
|
||||
skills shipped under `canon/skills` into `~/.agents/skills`; `sisi doctor` reports the linked
|
||||
state. Hooks fail open: any error lets the agent finish.
|
||||
state. Hooks fail open: any error lets the agent finish. Where a tool's hook input has no transcript path, the gate falls back to its pre-attribution behaviour (tree-change based, with no per-session edit attribution). Shell commands are attributed by measurement, not by their text, wherever the tool has confirmed before/after tool events (`sisi watch` takes a stat-only tree snapshot before and after the command and attributes the paths that changed to the session; provably read-only commands skip the pair); tools without confirmed before/after tool events keep the command-text classifier described in docs/design.md.
|
||||
|
||||
## Claude Code
|
||||
|
||||
Fully wired, as before: an `@import` line in `~/.claude/CLAUDE.md`, `SessionStart` → `sisi tick`,
|
||||
`Stop`/`SubagentStop` → `sisi gate` (blocking) in `~/.claude/settings.json`. Nothing for you to do.
|
||||
`Stop`/`SubagentStop` → `sisi gate` (blocking), and `PreToolUse`/`PostToolUse` with matcher `Bash` →
|
||||
`sisi watch` (before/after tree measurement) in `~/.claude/settings.json`. Nothing for you to do.
|
||||
|
||||
## Codex CLI
|
||||
|
||||
Rulebook symlink at `~/.codex/AGENTS.md` (or `$CODEX_HOME/AGENTS.md`), plus hooks in
|
||||
`~/.codex/hooks.json`: `SessionStart` → tick, `Stop`/`SubagentStop` → gate, blocking with
|
||||
`~/.codex/hooks.json`: `SessionStart` → tick, `Stop`/`SubagentStop` → gate,
|
||||
`PreToolUse`/`PostToolUse` (matcher `Bash`) → `sisi watch`, blocking with
|
||||
`{"decision":"block","reason":...}`. One step is yours: Codex only runs hooks you have trusted, by exact
|
||||
definition hash. After `sisi install`, open Codex, run `/hooks`, and trust the sisi hooks; repeat after
|
||||
any change to the hook commands (for example after moving the sisi clone). `sisi doctor` cannot verify
|
||||
@@ -50,7 +52,8 @@ file path.
|
||||
## Gemini CLI
|
||||
|
||||
Rulebook symlink at `~/.gemini/GEMINI.md`, hooks merged into `~/.gemini/settings.json`: `SessionStart`
|
||||
→ tick (lessons injected as `additionalContext`), `AfterAgent` → gate (`{"decision":"deny","reason":...}`
|
||||
→ tick (lessons injected as `additionalContext`), `AfterAgent` → gate, `BeforeTool`/`AfterTool` →
|
||||
`sisi watch` (`{"decision":"deny","reason":...}`
|
||||
rejects the response and forces a retry). Built from the hooks reference; Gemini is not installed on the
|
||||
development machine, so this has not run live. Gemini has no subagent-stop event in its hook list, so
|
||||
only the main turn is gated.
|
||||
@@ -59,7 +62,7 @@ only the main turn is gated.
|
||||
|
||||
Rulebook symlink at `~/.copilot/copilot-instructions.md` (or under `$COPILOT_HOME`), hooks in
|
||||
`~/.copilot/hooks/sisi.json`: `sessionStart` → tick (`additionalContext`), `agentStop`/`subagentStop` →
|
||||
gate (`{"decision":"block","reason":...}` forces another turn). Verified end to end in a throwaway home:
|
||||
gate (`{"decision":"block","reason":...}` forces another turn), `preToolUse`/`postToolUse` → `sisi watch`. Verified end to end in a throwaway home:
|
||||
a secret planted in session-start context was answered by the model, and a blocking `agentStop` visibly
|
||||
forced a second turn. The cloud coding agent only runs hooks committed in the repository
|
||||
(`.github/hooks/*.json`); sisi does not write repository files, so cloud enforcement needs such a file
|
||||
@@ -72,7 +75,8 @@ Rulebook symlink at `~/.qwen/QWEN.md`, hooks merged into `~/.qwen/settings.json`
|
||||
first run, so run Qwen once before `sisi install`. Verified: the session-start hook was observed firing
|
||||
with its documented payload (a full turn needs an auth type configured). Qwen's question tool is named
|
||||
`ask_user_question` (the rulebook still names Claude Code's dialog; generalising that wording is future
|
||||
work).
|
||||
work). Qwen's before/after tool event names are not confirmed, so sisi registers no watch hooks there:
|
||||
shell edits in Qwen are still judged from the command text.
|
||||
|
||||
## Pi
|
||||
|
||||
@@ -81,12 +85,14 @@ have your own file there) plus a generated extension at `~/.pi/agent/extensions/
|
||||
runs `sisi tick` on `session_start` and injects the lessons at `before_agent_start`, and runs the gate on
|
||||
`agent_before_settle`, forcing one continuation with the failure report when checks fail (capped by the
|
||||
gate's own three send-backs). Verified: the extension loads in real Pi and tick runs; the blocking
|
||||
continuation could not be exercised end to end without a model login in the throwaway home.
|
||||
continuation could not be exercised end to end without a model login in the throwaway home. Pi gets no
|
||||
watch hooks (its extension has no confirmed before/after shell payload for this), so shell edits there are
|
||||
still judged from the command text.
|
||||
|
||||
## Cursor
|
||||
|
||||
Hooks merged into `~/.cursor/hooks.json`: `sessionStart` → tick (lessons as `additional_context`),
|
||||
`stop`/`subagentStop` → gate. Cursor cannot veto a stop; instead a non-empty `followup_message` is
|
||||
`stop`/`subagentStop` → gate, `preToolUse`/`postToolUse` → `sisi watch`. Cursor cannot veto a stop; instead a non-empty `followup_message` is
|
||||
auto-submitted as the next user message, which is how the gate sends the agent back (Cursor caps this at
|
||||
5 per script by default; sisi's own cap is 3). Only completed (not aborted/error) stops are gated.
|
||||
There is no confirmed user-global instruction *file* for Cursor, so sisi wires no global rulebook there;
|
||||
@@ -102,7 +108,8 @@ client prompt API where one exists. Be clear about the limits: `session.idle` fi
|
||||
finished and cannot veto anything, and on OpenCode v2.3.2 no plugin event delivery or lesson injection
|
||||
could be confirmed in headless runs (the plugin itself is loaded — verified — and the v1-style hooks and
|
||||
v2 `setup()` registration are both attempted, all fail-open). Treat OpenCode enforcement as unproven
|
||||
until it is observed on your version; `sisi doctor` says `unknown` on purpose.
|
||||
until it is observed on your version; `sisi doctor` says `unknown` on purpose. OpenCode gets no watch
|
||||
hooks either, so shell edits there are still judged from the command text.
|
||||
|
||||
## Muse Code
|
||||
|
||||
|
||||
Reference in new issue
Block a user