Skip to content

feat(hooks): /goal SDLC discipline gate (closes #360, refs #359)#369

Merged
BaseInfinity merged 1 commit into
mainfrom
feat/360-goal-confidence-check-hook
Jun 1, 2026
Merged

feat(hooks): /goal SDLC discipline gate (closes #360, refs #359)#369
BaseInfinity merged 1 commit into
mainfrom
feat/360-goal-confidence-check-hook

Conversation

@BaseInfinity
Copy link
Copy Markdown
Owner

Summary

PR #355 (v1.77.0) added skill-text guidance that /goal must state HIGH 95% confidence and bind to a DLC (/sdlc, /gdlc, /ldlc) before firing. The guidance worked at the meta level but had no runtime enforcement — exactly the failure mode the discipline gate documented ("text-only guidance doesn't survive the failure mode it's trying to prevent").

This adds hooks/goal-confidence-check.sh as the runtime enforcement layer.

What ships

File What
hooks/goal-confidence-check.sh (NEW) UserPromptSubmit hook. Matches /goal <condition> (silent on /goal status + /goal clear). Reads transcript_path from hook input (verified available on UserPromptSubmit per code.claude.com/docs/en/hooks), walks the JSONL via jq -rs to find the last assistant text message, scans for HIGH-95% confidence patterns. Greps the goal condition for a DLC binding (/[a-z]+dlc). Emits LOUD warnings on either gap — non-blocking soft nudge (exit 0), same pattern as model-effort-check.sh. Dedupes via _find-sdlc-root.sh so plugin + project copies don't double-fire.
cli/templates/settings.json Added to UserPromptSubmit array (npm/CLI channel).
hooks/hooks.json Added to UserPromptSubmit array (plugin channel via ${CLAUDE_PLUGIN_ROOT}).
cli/init.js Hook added to FILES list, executable flag set.
skills/sdlc/SKILL.md One-line enforcement cross-reference in Long-Running Goals section. Trimmed adjacent prose to stay under the 5K token cap (#236).
tests/test-hooks.sh 4 quality tests: fires-when-no-confidence + silent-when-confidence-present + DLC-binding-warning + silent-on-status-and-clear. Mutation: deleting either warning emit line flips test to FAIL.

Bundled paperwork

ROADMAP.md — Adds the missing ## Research Parking Lot section that the Demand-Signal-First entry gate references but was never created. Includes maintenance rule (prune expired rows during quarterly triage, log removals in commit message).

Companion close: #359 triage

Of the 10 API changelog entries since 2026-04-16:

  • 8 no-op for the wizard: MCP tunnels (private MCP), SEC web search data, cache diagnostics, fast mode for 4.7, AWS hosting, multiagent sessions (managed-agents API), Rate Limits API, managed-agent memory — all orthogonal to SDLC enforcement.
  • 2 deprecations verified zero-usage in this repo:
    • context-1m-2025-08-07 (Sonnet 4.5/4 1M beta retired 2026-04-30) — we use the separate opus[1m] alias, not the deprecated beta header
    • claude-3-haiku-20240307 (Haiku 3 retired 2026-04-20) — never used

Greps confirm zero occurrences of either identifier. #359 will be closed with the triage comment after this PR merges.

Closes

Test plan

  • tests/test-hooks.sh — 160/160 (4 new [feature] /goal should enforce HIGH-95% confidence gate (not just document it) #360 tests + 156 existing)
  • tests/test-audit-session-load.sh — 10/10 (SKILL.md under 5K cap)
  • tests/test-cli.sh — all passing
  • tests/test-plugin.sh — all passing
  • tests/test-doc-consistency.sh — 41/41
  • tests/test-self-update.sh — all passing
  • tests/test-setup-path.sh — all passing
  • CI green on validate
  • Squash-merge

PR #355 (v1.77.0) added skill-text guidance that `/goal` must state HIGH 95%
confidence and bind to a DLC (`/sdlc`, `/gdlc`, `/ldlc`) before firing. The
guidance worked at the meta level but had no runtime enforcement — exactly
the failure mode the discipline gate documented (text-only guidance doesn't
survive the failure mode it's trying to prevent).

This adds `hooks/goal-confidence-check.sh` as a UserPromptSubmit hook that:

1. Matches `/goal <condition>` prompts (silent on `/goal` status + `/goal clear`).
2. Reads `transcript_path` from hook input (verified available on UserPromptSubmit
   per Anthropic hook docs at code.claude.com/docs/en/hooks), walks the JSONL
   to find the last assistant text message, and scans for HIGH-95% confidence
   patterns (`HIGH (95%`, `Confidence: HIGH`, `HIGH 95%`, etc.).
3. Greps the goal condition for a DLC binding (`/[a-z]+dlc`).
4. Emits LOUD warnings on either gap — non-blocking soft nudge (exit 0),
   same pattern as `model-effort-check.sh`.

Registered in both channels: `cli/templates/settings.json` (npm/CLI) and
`hooks/hooks.json` (plugin via ${CLAUDE_PLUGIN_ROOT}). Dedupes via
`_find-sdlc-root.sh` helper so dual installs don't double-fire.

Bundled paperwork:

- `ROADMAP.md` adds the missing `## Research Parking Lot` section that the
  Demand-Signal-First entry gate references but was never created. Includes
  the maintenance rule (prune expired rows during quarterly triage).
- `skills/sdlc/SKILL.md` adds a one-line enforcement cross-reference in the
  Long-Running Goals section. Trimmed adjacent prose to stay under the 5K
  token cap (#236).

#359 triage (companion close):

Of the 10 API changelog entries since 2026-04-16: 8 are clearly no-op for
the wizard (MCP tunnels, SEC web search data, cache diagnostics, fast mode,
AWS hosting, multiagent sessions, rate limits API, managed-agent memory —
all orthogonal to SDLC enforcement). 2 are deprecations — verified zero
usage in this repo: `context-1m-2025-08-07` (Sonnet 4.5/4 1M beta retired
2026-04-30; we use the separate `opus[1m]` alias) and `claude-3-haiku-
20240307` (Haiku 3 retired 2026-04-20; we never used it). #359 will be
closed with the triage comment after merge.

Verified locally: test-hooks 160/160 (4 new #360 tests + 156 existing),
test-audit-session-load 10/10, test-cli 91/91, test-plugin all green,
test-doc-consistency 41/41, test-self-update 153/153, test-setup-path 83/83.
@BaseInfinity BaseInfinity merged commit db30049 into main Jun 1, 2026
4 checks passed
@BaseInfinity BaseInfinity deleted the feat/360-goal-confidence-check-hook branch June 1, 2026 21:15
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.

[feature] /goal should enforce HIGH-95% confidence gate (not just document it) API features to review (10 pending as of 2026-05-19)

1 participant