fix(hooks): stdin-JSON input contract + behavioral CI tests · docs(spec): v2 consent-first draft#5
Merged
Conversation
…I tests Five-persona friction testing found the enforcement layer likely never fired: all three file-guard hooks keyed off $CLAUDE_FILE_PATH, which is not a documented hook variable, and every uncertainty path exited 0 silently. Fixes: - require-worktree.sh, new protect-credential-files.sh and autoformat.sh: parse tool input from stdin JSON (jq, sed fallback, legacy env var last); unresolvable input is reported on stderr, never silent. kit.yaml added to the on-main exemption list. - secret-scan-diff.sh: push/PR detection moved into the script (parse failure scans anyway instead of silently skipping); trunk branch read from kit.yaml trunk_branch -> origin/HEAD -> main/master instead of hardcoded main. - settings.template.json: all inline hook logic replaced with script calls; removes the jq-or-silently-dead inline command and the terminal '; true' kit-doctor itself flags. - kit-ci: new behavioral test job — hooks must BLOCK (exit 2) on main edits, .env edits, and leaked-secret pushes, and must allow worktree edits, exemptions, and non-push commands, including with jq broken. All 11 checks verified locally. - kit-update: version-bump regex could never match (stray ']') and printed success anyway — fixed, and no-op rewrites now error. - pre-pr step 13: dangling 'spec-check' skill reference -> the spec-drift-checker agent, with an explicit N/A condition. - prune-merged-worktrees: default recency guard 30 -> 120 min so live sessions waiting on CI/review don't get pruned by a sibling session. - Remove committed templates/__pycache__; gitignore .claude/scratch/. - docs/followups.md: remaining persona-test findings filed as PT1-PT11. - kit_version 1.3.0 -> 1.3.1 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LxEwyqF1KjEPpQKqM5tSrv
…iew) Canonical spec for the v2 direction: priced skill catalog (cost/protects/ requires metadata), per-gate mode map (off|suggest|enforce), three-act init interview with install-time pruning, two-phase pre-pr, chaining in place of the 1% rule, earned enforcement with a CI-side ratchet backstop, substrate ledger, and explicit stack tiers. Cites the PT1-PT11 persona findings. Draft — review findings will land as follow-up commits. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LxEwyqF1KjEPpQKqM5tSrv
… reviews Blockers fixed: prototype default map keeps deterministic-protective and CI-backed gates enforced at every strictness level (v1 migration claim now true); doctrine reconciliation (README positioning, PROFILE/pre-pr security-review reclassification) scheduled in the same release as the mode map; unattended-session consent defined (run enforce, skip-and-log suggest, pre-consent via kit.yaml); suggestions gain a MUST-surface obligation so the suggest tier can't silently collapse to off. Majors: llm-app preset re-enforces prompt-regression/eval (target-persona overshoot); ratchet-up counts CI-side findings so avoidance can't suppress it; ratchet-down proposes quieter-before-off, never off for CI-backed gates, counters in a git-ignored per-clone ledger with defined record format and windows; mode resolution materialized at init (skills read one key, no per-skill precedence); full gate-key enumeration; hook mode/parse contract; gates.triggers glob map; declined: consumers enumerated (dispatcher, kit-update, /kit-menu); catalog generator + kit-ci drift check; PT10 hash manifest and Tier-0 de-Python pulled into v2.0-alpha/ v2.0a; substrate dialects pinned; PT5/PT9 restored as §11; PT8 explicitly deferred; v2.0 split into a/b to avoid a ~50-file big-bang. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LxEwyqF1KjEPpQKqM5tSrv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two things ride on this branch (single-designated-branch session):
1. Fixes — the P0s from the five-persona friction test. The headline: the enforcement layer likely never fired — all three file-guard hooks keyed off
$CLAUDE_FILE_PATH(not a documented hook variable) and every uncertainty path exited 0 silently.require-worktree.sh+ newprotect-credential-files.shandautoformat.sh(inline settings logic promoted to scripts) parse the tool input from stdin JSON — jq when available, sed fallback, legacy env var last. Unresolvable input is reported on stderr, never silent.kit.yamladded to the on-main exemption list.kit.yaml trunk_branch→origin/HEAD→main/masterinstead of hardcodedmain.; truethat kit-doctor itself flags..envedits, and leaked-secret pushes; must allow worktree edits, exempt files, and non-push commands; and must still block with a broken jq. 11 checks — green in this PR's CI run.]) and printed success anyway — fixed; a no-op rewrite now errors.spec-checkreference → thespec-drift-checkeragent with an explicit N/A condition.templates/__pycache__; gitignored.claude/scratch/; docs/followups.md created with the remaining persona findings as PT1–PT11.kit_version1.3.0 → 1.3.1.2. Draft v2 design spec (
SPEC.md) — under adversarial review. The consent-first direction: priced skill catalog (cost/protects/requiresfrontmatter), per-gate mode map (off|suggest|enforce), three-act init interview with install-time pruning, two-phase pre-pr, chaining in place of the 1% rule, earned enforcement with a CI-side ratchet backstop, substrate ledger, stack tiers. Two reviewer agents (design-coherence/persona-fidelity + implementability) are attacking it now; their findings land as follow-up commits on this PR before merge.Spec citation
SPEC.md§1–§13 (draft). Fixes restore behavior the README already claimed.What was tested
bash -nclean on all six hooks.Risk and rollback
Risk: low-medium — hook behavior changes are the point; the new CI job proves blocking works. Legacy
$CLAUDE_FILE_PATHstill honored as fallback. SPEC.md is documentation only.Rollback: revert the PR.
Docs
Follow-ups
docs/followups.md(created the kit's live log)🤖 Generated with Claude Code
https://claude.ai/code/session_01LxEwyqF1KjEPpQKqM5tSrv