Skip to content

feat(hooks): factual-claim scan in end-of-turn Stop hook (autonomous-self-audit §11.1 interim) - #96

Merged
artyhoo merged 1 commit into
mainfrom
feat/eot-hook-claim-scan
May 21, 2026
Merged

feat(hooks): factual-claim scan in end-of-turn Stop hook (autonomous-self-audit §11.1 interim)#96
artyhoo merged 1 commit into
mainfrom
feat/eot-hook-claim-scan

Conversation

@artyhoo

@artyhoo artyhoo commented May 21, 2026

Copy link
Copy Markdown
Owner

What

Builds Option (ii) from the merged autonomous-self-audit R-phase (#95, §10.5/§11.1): the E-checklist Stop-gate interim. Extends the live end-of-turn-reminder.sh Stop hook with a deterministic factual-claim scan.

Why

The research (#95 §3.3, §4.2) showed the live Stop hook prompts a recap but does not force re-verification of the at-write-time factual class — and it skips short turns entirely, which is exactly where incident #1 ("4+ files") lived. This adds item-specific salience at turn-end for that class.

How

  • Scans the last assistant turn for three shapes: numeric counts (4 files, 10 tests), file:line citations (foo.ts:42), negative-existence (no production tool exists).
  • Enumerates the exact hits and appends an item-specific re-verify instruction to whatever reminder fires (Branch A/B/C) — or fires a focused Branch D on a short, question-less turn that carries a claim.
  • Deterministic, no LLM, no external call (no-paid-llm-in-ci.md).
  • Honest limit: raises salience, does not structurally force compliance (the H10-pair under Wave-10 is the structural target; this is the cheap interim).

Recursive backstop (Q-D from #95)

tests/hooks/eot-claim-scan.test.sh — 6 sub-tests (3 positive enumeration, 1 silence, 1 valid-JSON, 1 mutation that breaks the numeric regex and asserts enumeration stops). Registered in audit-self.yml. The drift-catcher hook is now itself caught by a test if it silently breaks.

Side fix

Portable last-assistant-line extraction (grep | tail instead of BSD-only tail -r) so the companion test runs on Linux/CI. Equivalent on macOS where the hook actually fires.

Notes for review (live hook — merge is yours)

  • Regression-checked locally: Branch A (recap) and Branch B (question) still fire unchanged.
  • Not a capability commit by the CLAUDE.md definition (.claude/hooks/ + tests/, not under packages/); Prior-art: trailer included anyway (SSOT Wave 0.5: revise §13.21 L3 closure plan + self-review #20 ADOPT + Agent Verifier REFERENCE/ADAPT).
  • §1.7 CI gate: N/A (path filter excludes .claude/hooks/, tests/, .github/).
  • Self-tests green locally: hook-stub-completeness ✅, audit-ai-docs 9/0 ✅, eot-claim-scan 6/0 ✅.

§1.7 Forward-check applied

  • no-paid-llm-in-ci: scan is pure bash grep, no API — compliant (end-of-turn-reminder.sh:45 scan block).
  • dual-implementation-discipline §6: hook retains @cc-only-rationale (internal CC dev-tooling); spec: pointer added to the research patch.
  • recursive self-application: companion mutation test at tests/hooks/eot-claim-scan.test.sh enforces substance.

§1.7 Backward-check applied

…self-audit §11.1 interim)

Implements Option (ii) — the E-checklist Stop-gate interim from the merged
autonomous-self-audit R-phase (#95 §10.5/§11.1). Extends the live Stop hook
with a deterministic scan that enumerates factual-claim shapes (numeric
counts, file:line citations, negative-existence) in the last assistant turn
and appends an item-specific re-verify instruction — targeting the
at-write-time factual class (incidents #1 "4+ files", #5 ":30", #2
negative-existence) that the generic recap nudge does not force. Fires on
claim-PRESENCE regardless of turn length (covers short turns the long_text
gate skips). No LLM, no external call (no-paid-llm-in-ci). Honest limit:
raises salience, does not structurally force compliance.

Also: portable last-assistant-line extraction (grep|tail, was BSD-only
tail -r) so the companion test can run on Linux/CI. New behaviour test
tests/hooks/eot-claim-scan.test.sh (6 sub-tests incl. mutation) registered
in audit-self.yml — the Q-D recursive backstop: the drift-catcher hook is
itself caught by a test if it silently breaks.

Prior-art: prior-art-evaluations.md#20 (Claude Code hooks API, ADOPT) — extends existing Stop-hook substrate, no new surface. Agent Verifier (REFERENCE/ADAPT per #95 research-patch §5.1) — session-executed verifier pattern; this auto-fires it at the AI's own claims. No new dependency.
@artyhoo
artyhoo merged commit db39264 into main May 21, 2026
20 checks passed
artyhoo added a commit that referenced this pull request May 21, 2026
…empirical research (#97)

Empirical-validation arm for Q1 of the autonomous-self-audit line (#95 §10 Q-C,
round-3 §3.5): does the live claim-scan (#96) change behaviour, or is compliance
voluntary-and-equal? Ran a deterministic no-LLM scorer over 337 real eval-unaware
transcripts (266 sessions / 1537 claim-turns) + a controlled planted-error probe
on 5 naive sub-agents. H0 NOT rejected (treatment arm N~0, eval-aware, cross-model).

Substantive re-frame of Q1: baseline groundedness already ~0.74-0.81 (small
headroom); the binding weakness is the DETECTOR — recall ~0.43 on natural numeric
phrasings (misses "6 discipline rules", "266 sessions"; missed the one organic
failure case), precision ~0.20-0.25 (cry-wolf). Compliance-when-delivered CAN be
positive (probe1 corrected 6->8). Pre-registered decision-gate (a/b/c/d) + 4
maintainer decision-needed items. Sibling scorer committed as a reproducibility
artefact (NOT CI-wired; promotion to tests/ is Q-E2-gated). principle-10 green;
self-application (§7) caught this patch's own headline numbers in the recall blind spot.

No mechanism implemented; no rule codified; no hook/settings edit; no PR on a
mechanism. The 5 sub-agents were measurement subjects, not implementers.

Prior-art: skipped — research patch only, no new capability; eval methodology + pilot, no mechanism adopted
artyhoo added a commit that referenced this pull request May 21, 2026
Lands the maintainer's settings.json safety-hardening that was stranded
uncommitted on the superseded chore/ssot-karpathy-skills-ref branch (the only
non-superseded residue there — every other file already on main via #89/#92/#93/
#94/#96/#97/#98). Committed verbatim.

On-thesis: this is edit-time (earliest-channel) enforcement of project safety
rules that previously lived only as memory/prose — "no git reset hard ever",
no force-push, no skip-verify. The harness now blocks them before they run:
  - destructive git: force/mirror push, push to main/master, skip-verify commit,
    hard reset, checkout discard, branch force-delete, filter-branch, update-ref
  - destructive fs: recursive delete, shred, dd, mkfs, sudo
  - pipe-to-shell: curl-to-shell, wget-to-shell; raw netcat/socat
  - secret exfil: gh secret set/delete, gh auth logout, reads of credential dirs
    (ssh / aws / gnupg / gh config) and dotenv files
  - self-protection: .git/hooks, .husky, settings.json (Edit/Write deny)
Also: portable $CLAUDE_PROJECT_DIR hook paths + ask-question-reminder.sh permission.

Prior-art: skipped — harness config hardening (permission deny-list), no new capability code or dependency
artyhoo added a commit that referenced this pull request May 21, 2026
…#106)

Append + in-place refinement of the living history book (v1 technical
+86 lines, v2 literary +78). Narrates post-#93 events: the end-of-turn
hook saga (#81 broken via systemMessage → #89 reason-channel fix),
#94 AskUserQuestion hook, principles 11/12/13 landing, the #96/#97
claim-scan experiment (H0 not rejected), #90 recommendation-gate, and
the niche-among-companions chapter. Colophon extended (chapters III–XII,
patches to 2026-05-21, PR #85#99). Preserves continuation work that was
stranded uncommitted on the superseded chore/ssot-karpathy branch.

Prior-art: skipped — narrative doc continuation, no new capability or dependency.
@artyhoo
artyhoo deleted the feat/eot-hook-claim-scan branch May 22, 2026 18:10
artyhoo added a commit that referenced this pull request May 31, 2026
…rdicts for tracing-knowledge-lineages / when-stuck / preserving-productive-tensions + 5 SSOT rows (#92-#96) (#321)

Single-session R-phase per .claude/orchestrator-prompts/companion-capability-survey/
kickoff.md + companion-capability-survey-meta-launch/kickoff.md. Surveys 11
Superpowers/Superset/aif-handoff capabilities not previously in SSOT against the
/meta-orchestrator pipeline stages.

Net additions:
- docs/meta-factory/research-patches/2026-06-01-companion-capability-survey.md
- prior-art-evaluations.md rows #92-#96 (4 ADOPT VOCABULARY + 1 REJECT)
- #55 Last reviewed bumped to 2026-06-01 (writing-skills TDD-for-docs; verdict
  unchanged at ADAPT)
- #86 Trigger to revisit sharpened (Superset Automations + MCP start_agent_session
  are a separate surface from the worktree-substrate #86 originally rejected)

T-CCS-B fired: kickoff §2 claimed 'Superset cron — DeepWiki found NONE'; this
survey verified Automations + RRule DO exist per docs.superset.sh/automations.
Slack-agent precedent for Superset was the other §2 seed claim — NOT confirmed
against source; dropped INCONCLUSIVE.

No code changes. No new deps. Verdicts are recommendations per
reviewer-discipline.md §2 — maintainer decides per-row adoption.

Prior-art: skipped — research-patch + SSOT additive rows + Last-reviewed/Trigger
sharpening on #55/#86. Not a capability commit per CLAUDE.md definition (no new
explicit package.json dep; no ≥50 LOC under new packages/core/<dir>/; no ≥80 LOC
under packages/). All edits are append-only or §3-step-1 in-place updates to
prior-art-evaluations.md.

Co-authored-by: Mastra Code (anthropic/claude-opus-4-7) <noreply@mastra.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant