selfcheck-gate
A Claude Code plugin that enforces the operator's constitutional contract at the
Stop boundary of every turn. It bundles two cooperating, independently-built Stop hooks.
It also ships two SessionStart injectors, both currently unwired — see Footer modes.
- self-assessment — observes each closing turn and fires deterministic dodge-detectors.
The one that blocks — a strong success-claim on a zero-tool turn — is footer-independent and
always on. The two annotate-only ones (
cited-file-unread, quote-unmatched) read the footer,
so they are dark under the current footer mode A (v1.4.0): inject-footer-spec.sh is unwired,
no footer spec is injected, no footer is emitted. (The companion 4-Anchors injector,
inject-contract-anchors.sh, has been disabled since v1.2.0.) Re-wiring the footer-spec injector
restores the full detector set in one commit.
- anti-confirmation — a regex floor with two block classes: it nudges the agent off
trivial "Want me to…?" permission-asks (self-authorize & continue), and forces a genuine
prose decision — a real fork or a high-stakes (destructive / outbound / credential)
confirmation — to be re-emitted as an
AskUserQuestion tool call, never prose (open WH
info-questions still stop as prose). Plus a native Haiku type:prompt ceiling that
judges declarative in-scope deferral and self-evident closing-reframe.
Together they cover the contract's honesty anchors at the close of a turn:
Verified over Asserted (no faked verification), Honest over Agreeable and
Literal-completion (no dodge-by-deferral, no permission theater, no reframing the ask).
Every detector is fail-open (any error → allow the stop), one-shot (stop_hook_active
guard, no loops), and stdlib-only (no dependencies, microsecond runtime for the floor).
Why a hook and not a rule
Rules live in context and the model drifts past them. A Stop hook is deterministic — it
runs on every Stop event regardless of how the model is doing that turn. These hooks are
the deterministic floor under prose rules like the user's anti-pattern catalog
("ask when you already know", "fictional-constraint laundering", "ship unverified claims").
Architecture
| Event | Hook | What it does |
|---|
| SessionStart | inject-contract-anchors.sh | Disabled as of v1.2.0 — unwired from hooks.json; the script is retained, not removed. When wired, injects the 4 Anchors (read from the canonical contract; see Runtime dependencies). |
| SessionStart | inject-footer-spec.sh | Unwired as of v1.4.0 (footer mode A) — the script is retained, not removed. When wired, injects the active self-assessment footer spec. The footer is a switch, not a fixture — see Footer modes. |
| Stop | stop-self-assessment.sh | Observer + deterministic A3 detectors. Imports lib/footer_claims.py (footer A3-claim parser) and lib/quote_match.py (fuzzy quote/source overlap). Logs one JSONL row per turn to the obs sink. |
| Stop | anti_confirm_stop.py | The anti-confirmation floor — regex detection. Trivial yes/no offers → block + self-authorize nudge; a genuine fork or high-stakes (destructive/outbound/credential) prose decision → block + nudge to re-emit as an AskUserQuestion; open WH info-questions stop as prose. |
| Stop | type:prompt Haiku-tier judge | The anti-confirmation ceiling — judges MODE A (declarative deferral) + MODE B (self-evident closing-reframe). Conservative, hard ok:true bias. No model field — resolves via ANTHROPIC_DEFAULT_HAIKU_MODEL (see below). |
What blocks vs. what annotates