feat(hooks): add end-of-turn reminder Stop hook - #70
Merged
Conversation
Stop hook detects substantive REPORT (long+structured) or question-end in the last assistant turn and injects a plain-language reminder via systemMessage to keep responses accessible. Marked with @cc-only-rationale per .claude/rules/dual-implementation-discipline.md §6 (internal dev tooling, not shipped via install.sh).
Previously the Stop hook exited early when AskUserQuestion was present, assuming the structured UI made a reminder unnecessary. Maintainer feedback: AskUserQuestion IS a question and should still get the plain-language explanation reminder. Now AskUserQuestion forces trigger_question=true regardless of text content, so question-only turns (tool_use without text) also produce a reminder.
This was referenced May 17, 2026
6 tasks
artyhoo
added a commit
that referenced
this pull request
May 24, 2026
…p-3 (#202) * docs(ssot): add row #71 — delegation-vs-decision discipline (round-1 BUILD evidence trail) ATTN-1 follow-up from round-2 audit (PR #201, commit d212dae Sub-wave B Invariant 1). Documents the external-prior-art check that justified round-1's BUILD verdict over ADOPT for the problem class «delegation-vs-decision discipline in skill priority-tie resolution». Row #71 records: - Candidate: Superpowers `using-superpowers` Red Flags table (13-entry skill-invocation rationalisation tracker) - Verdict: REJECT (T16 problem-class non-match — match score ~5%) - T16 evidence: upstream addresses *whether* to invoke a skill; ours addresses *who decides* among ranked priority candidates - ADAPT credit (internal, no SSOT row per §1 scope): reviewer-discipline §2 «Surface-as-decision-needed» 4-step protocol Format follows the §3 entry template + existing row precedent (#67-#70). Last reviewed 2026-05-24. Trigger to revisit: Superpowers ships a delegation-vs-decision skill; OR /meta-orchestrator §2 scope expands to autonomous-pick-without-confirmation. Not a capability commit (docs-only — §4 entry table append; no new dep, no ≥80 LOC under packages/, no ≥50 LOC under packages/core/<new-dir>/). Prior-art: skipped — append to existing SSOT register (one row, no new upstream-tool adoption); the row itself IS the prior-art evidence trail for an already-shipped BUILD decision. §1.7: forward-check applied — row format complies with prior-art-evaluations.md §3 entry template (next-ID 71, all 8 columns populated, rationale cites round-2 commit d212dae + reviewer-discipline §2 with file:line); T16 problem-class check explicit per ai-laziness-traps.md §2 T16 (upstream-class vs our-class enumerated with match-score). Backward-check sweep — extends existing append-only register; does not edit prior rows; reviewer-discipline.md §2 path verified (.claude/rules/reviewer-discipline.md exists, §2 «Surface-as- decision-needed pattern» at line 17 of that file). * feat(meta-orchestrator): add globs+inject markers per round-2 Invariant 4 ATTN-2 follow-up from round-2 audit (PR #201, commit d212dae Sub-wave B Invariant 4 «recommend path-scoped injection via inject-matching-rule.sh + globs marker. Follow-up annotation»). Adds <!-- globs: --> and <!-- inject: --> markers to both SKILL.md copies (.claude/skills/ runtime + skills/ shipped), targeting: - .claude/orchestrator-prompts/** (kickoff authoring) - docs/meta-factory/wave-sequencing-plan.md (wave plan edits) When extended to scan .claude/skills/*/SKILL.md, the existing inject-matching-rule.sh hook (today scans .claude/rules/*.md per rule-enforcement-channel-selection.md §4) will JIT-inject the meta-orchestrator one-liner reminder on the matched edits — narrowing discoverability from manual recall to per-edit deterministic injection. Forward-going annotation: the hook does NOT yet scan skills/ — that is a separate scope expansion (out of round-2 follow-up scope). Markers are honest annotation pending that extension; the inject summary itself carries this status note. Marker format follows the dogfood precedent in .claude/rules/rule-enforcement-channel-selection.md (the first repo file to carry <!-- globs: --> / <!-- inject: --> markers). 500-line gate respected: markers placed without surrounding blank lines (2-line net addition) so .claude/skills/meta-orchestrator/SKILL.md stays at 500 lines (the gate limit). Dual-file annotation per dual-implementation-discipline §7: both copies get markers so consumer installations (via install.sh) inherit them unchanged when the consumer-side hook supports skills/ scanning. Not a capability commit (annotations + comments only — no new dep, no ≥80 LOC under packages/, no ≥50 LOC under packages/core/<new-dir>/). Prior-art: skipped — annotation-only addition implementing an already- shipped round-2 audit recommendation (Invariant 4); no new upstream-tool adoption (the hook itself is the existing ADAPT of OhMyOpencode `rulesInjector` per SSOT #61). §1.7: forward-check applied — markers conform to rule-enforcement-channel-selection.md §4 grammar (globs subset: prefix/**, exact path; inject summary self-documenting) verified by re-reading .claude/hooks/inject-matching-rule.sh:53,69 parsing regex; dual-file addition complies with dual-implementation-discipline.md §3 (consumer-facing artefact, both copies updated atomically); forward- going annotation discipline follows rule-enforcement-channel-selection.md §6 «Existing rules — forward-going, not retroactive». Backward-check sweep — inline note in inject summary prevents future readers from assuming markers are active (they activate only on hook extension); does not modify existing § content, See also entries, or section ordering; extends but does not supersede prior round-2 Sub-wave B Invariant 4 finding. * fix(meta-orchestrator): plan-currency-check fetches + cross-checks origin/staging Gap-2 follow-up from round-2 audit (PR #201, §1.5 «plan-currency-check.sh не cross-check'ит git log origin/<branch> против локального — пропускает свежие PR'ы»). Before this fix the helper relied on whatever local copy of origin/staging the user happened to have — days stale in long sessions or after a fresh worktree, making fresh merges since last sync invisible to the §1 plan-currency check that consumes this output. Adds a fail-soft `git fetch --quiet origin staging` before the JSON PR-list queries, then surfaces the count of remote-only commits via `git rev-list HEAD..origin/staging`. If non-zero, the oneline log of those commits is printed (capped to 10) as «likely merged PRs since last local sync» — the explicit fresh-PR detector. Fail-soft contract: offline / auth-failure / no-network → echoed warning, helper continues to exit 0 (matches existing graceful- unavailability pattern for `gh` and `git status` blocks at lines 18 / 30 / 38). Dual-file: both `skills/meta-orchestrator/helpers/plan-currency-check.sh` (authoring) and `.claude/skills/meta-orchestrator/helpers/plan-currency-check.sh` (runtime) updated atomically per dual-implementation-discipline §3. Smoke test verified: helper runs clean (exit 0), new section integrates between branch + PR-list blocks, current-branch behaviour confirmed (0 remote-only when synced, lists oneline when stale). Not a capability commit (helper enhancement — no new dep, no ≥80 LOC under packages/, no ≥50 LOC under packages/core/<new-dir>/). Prior-art: skipped — fix to existing helper (shipped #186, audited #192/#201) addressing a specific stale-data gap; no new upstream-tool adoption (git rev-list + git fetch are existing capabilities). §1.7: forward-check applied — fail-soft fetch complies with no-paid-llm-in-ci.md §1 (deterministic git ops, no API-billed calls), dual-implementation-discipline.md §3 (both copies updated atomically; diff -q reports identical post-patch), ai-laziness-traps.md §2 T3 (no-prose-only findings — smoke test verifies exit 0 + correct output on current branch state above). Backward-check sweep — addition is between existing sections (not modifying them); the existing left-right ahead/behind block at lines 22-23 stays unchanged (it benefits from the fetch immediately above when re-run); does not modify §1 SKILL.md consumer logic (helper output remains a superset of prior output — purely additive section), so SKILL.md §1 read of this helper output is backward-compatible. * feat(meta-orchestrator): meta-kickoff template ships worktree setup boilerplate Gap-3 follow-up from round-2 audit (PR #201, §1.5 «worktree symlink slot в template — каждый worker re-discovers packages/core/node_modules symlink discipline»). Adds §4a «Worker worktree setup» between §4 (dispatch instructions) and §5 (AI-traps). The slot ships the boilerplate every worker dispatched into a `git worktree add`-created directory needs as the first session step, otherwise the worker rediscovers (burning Opus) the workspaces / remark requirement that `git worktree add` does NOT copy from the primary workdir. Detection contract uses `git rev-parse --git-dir != --git-common-dir` (absolute path vs relative `.git`) — the same probe Superpowers `using-git-worktrees` uses for its nested-worktree skip, per `parallel-subwave-isolation.md §4`. Idempotent: the `if` body is a no-op in the primary workdir; symlinks are created only when missing. Plumbing reconstituted: - `node_modules` → symlink to primary's `node_modules` (saves an `npm install` cycle inside the worktree) - `packages/core/node_modules` → symlink to `../../node_modules` (workspaces hoisting marker — empirically the load-bearing one) Dual-file: both `skills/meta-orchestrator/templates/meta-kickoff.template.md` (authoring) and `.claude/skills/meta-orchestrator/templates/meta-kickoff.template.md` (runtime) updated atomically per dual-implementation-discipline §3; diff -q reports identical post-patch. The slot lives in the template (not the helper), so it travels with every meta-kickoff generated by `/meta-orchestrator` automatically — the dispatch instructions {{DISPATCH_INSTRUCTIONS}} are sub-wave- specific, this is universal worker boilerplate that precedes them. Not a capability commit (template enhancement — no new dep, no ≥80 LOC under packages/, no ≥50 LOC under packages/core/<new-dir>/). Prior-art: skipped — template enhancement closing a §1.5-surfaced gap in an already-shipped artefact (#186 + #192 + #201); no new upstream- tool adoption (the worktree-detection probe is ADAPT from upstream Superpowers `using-git-worktrees`, SSOT #65, already in the register). §1.7: forward-check applied — slot complies with no-paid-llm-in-ci.md §1 (pure-git deterministic ops, no API-billed calls), parallel-subwave-isolation.md §4 (REFERENCE — uses the same GIT_DIR/GIT_COMMON_DIR worktree-detection pattern Superpowers ships), dual-implementation-discipline.md §3 (both copies updated atomically), ai-laziness-traps.md §2 T15 (the slot itself self-applies — it codifies the boilerplate workers were re-discovering; recursive). Backward-check sweep — addition is purely additive (new §4a section between existing §4 and §5; no edits to existing sections); meta-kickoff.template.md consumers (the launch-table-generator + downstream workers reading the generated kickoff) see the slot as static text post-template-substitution — no placeholder logic depends on the slot's absence.
8 tasks
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
Add Claude Code Stop hook injecting a
systemMessagereminder at end-of-turn that nudges the active session toward a concise summary (Layer 1 professional) plus a Feynman-check (Layer 2 plain-language retell). Forces self-checks during high-stakes codification work in the 13-day window before Commit 6 deadline (2026-05-30). Internal-only, CC-native, no portable fallback per dual-implementation-discipline.md §3.Changes
.claude/hooks/end-of-turn-reminder.sh— new 72-LOC Bash hook reading Stop-hook stdin, parsing transcript tail, gating reminder injection on substantive REPORT / question turns. Triggers onAskUserQuestiontool_use unconditionally (per [[askuserquestion-triggers-reminder]])..claude/settings.json— register Stop hook entry; no other settings touched.Prior-art consult
.claude/hooks/subdir, no new explicit deps inpackage.json.Prior-art:trailer skipped — quality-of-life hook, not a new capability area.Test plan
make self-auditgreen (16/0 + 58/58, run pre-push)bash -n .claude/hooks/end-of-turn-reminder.sh— syntax-OK§1.7 Skipped: mechanical hook addition + settings registration — not a discipline rule introduction; scoped per
feedback_s17_scope_vs_path_filter(mechanical maintenance default)