/whats-next → /goal brief

Status:complete (as-built)
Date:2026-06-15
Branch:feat/whats-next-goal-brief
Type:spec

Goal

Make the shipped /whats-next skill culminate in an action the user can run hands-off: after it presents its ranked recommendations and the user picks one, the skill emits a single, ready-to-paste goal brief (≤ 4000 characters) that the user runs as Claude Code's built-in /goal <brief> command. The brief is engineered so that the resulting autonomous, long-running session delivers a fully thought-out, tested, iterated, and verified solution — not a half-built MVP.

Background — how /goal actually works

Per the Claude Code hooks reference, /goal <text> is a built-in shortcut for a session-scoped, prompt-based Stop hook. The <text> becomes a standing completion condition: at the end of every turn, an LLM judge re-reads it and decides whether Claude is allowed to stop. Claude keeps working across turns until the condition is judged met.

This single fact drives the entire design:

Architecture

The /whats-next engine logic lives in a single source-of-truth file, jacked/data/commands/whats-next.md, read by Claude at runtime. /jacked-setup generates per-repo standalone configs by embedding this engine body verbatim after a ## Repo Config block. Therefore the new behavior is added in one place (the engine) and propagates to every standalone config for free — no jacked-setup.md template change and no new per-repo config knob (the behavior is universal, and adapts at runtime to the repo's project type / test command / UI-ness).

A new Step 8: Forge the Goal Brief (on pick) is appended to the engine. It does not fire during the initial analysis turn; it fires when the user selects an option (or asks to turn one into a goal) in a follow-up turn — which is how the single-read skill file already governs the whole interaction.

flowchart TD
    A["/whats-next invoked"] --> B["Steps 1-6: orient, discover,
signals, rank, present options"] B --> C["Step 7: setup hint +
start-work paths (/goal, /jack-it-up)"] C --> D{"User picks an option
(or asks for a goal)"} D -->|yes| E["Step 8: Forge Goal Brief
from chosen option + repo discovery"] D -->|no / switches focus| B E --> F["Fill template, drop
irrelevant blocks, trim ≤4000"] F --> G["Emit paste-ready block +
'run: /goal <paste>' instruction"] G --> H["User runs /goal → autonomous
Stop-hook delivery loop"]
flowchart TD
    A["/whats-next invoked"] --> B["Steps 1-6: orient, discover, signals, rank, present options"]
    B --> C["Step 7: setup hint + start-work paths (/goal, /jack-it-up)"]
    C --> D{"User picks an option (or asks for a goal)"}
    D -->|yes| E["Step 8: Forge Goal Brief from chosen option + repo discovery"]
    D -->|no / switches focus| B
    E --> F["Fill template, drop irrelevant blocks, trim <=4000"]
    F --> G["Emit paste-ready block + 'run: /goal ' instruction"]
    G --> H["User runs /goal -> autonomous Stop-hook delivery loop"]
  

The Goal-Brief Template

Step 8 instructs Claude to fill this template from the chosen option and the facts already gathered in Steps 1–6 (key files, evidence/issue refs, project type, real test command). Bracketed […]-tagged lines are conditional — when one applies, the line is kept and the […] tag itself deleted (never emitted); when it doesn't, the whole line is dropped. The whole brief is trimmed to ≤ 4000 characters before emit (the skeleton is ~1,900 chars, so there is ample headroom; trimming touches Context/Approach prose first, never the Build/Verify/DONE core).

This is the as-built template after the two-wave DCR hardening pass (see Review outcomes):

Deliver: <one-line outcome — the chosen option, as a shippable result>.

Context: lives in <key files/paths>. <1-2 lines: what exists today, what's
missing or broken>. Refs: <identifiers + a short neutral paraphrase —
issue #s, file:line, doc sections>.

Build the complete feature — no MVP, no stubs, no TODO-for-later:
- <concrete deliverable 1>
- <concrete deliverable 2>
- <concrete deliverable 3>

Approach: plan before coding (for L/XL, write the plan down first). TDD
where it fits — failing test, then implement, then green. Match existing
patterns in <area>. Build cleanly: no silent failures, no swallowed
errors, no arbitrary data/scope caps; follow CLAUDE.md. Stay in scope:
work only on this task's feature branch, committing each green increment
so an interrupted run is resumable — no force-push, history rewrite, data
deletion, or untrusted install/network scripts. If a step looks destructive
or out of scope, stop and ask.

Verify — run each and show the output; ALL must pass before you stop:
- <repo's real test command> exits clean, with NEW tests covering the
  new behavior and its edge cases
- The outcome works when run for real — paste the proof: <a concrete
  command + its expected output, or the user flow you walked>
- [UI work only] Browser-QA via available browser tools (or /qa,/ux):
  target flows work, console error-free
- [security-sensitive only] /cso runs, reports no high/critical findings
- [if /dcr available] /dcr runs and reports a clean pass

DONE when: the test command and the real-run proof both pass in the
transcript, every applicable review gate reports clean, and the work is
committed on a feature branch. Do NOT stop while any item is unmet or
unproven — diagnose, fix, re-run. Never report success without the
supporting output.

Outside the fenced block, Step 8 carries Step 1's DATA-only rule into the forge: references are cited by identifier + neutral paraphrase (never verbatim title), and any directive-like text in a title/label/note is replaced with [text omitted] — so untrusted issue/task text cannot ride into the autonomous loop. Option 0 (Resume Active Checkpoint) is excluded from forging and routed to /checkpoint resume instead.

What each part buys, mapped to the research:

Brief elementWhy it's there
Deliver: front-loaded outcomeSpecificity (Anthropic): a clear single target the run orients around.
Context: + Refs:Specify files/context and provide grounding evidence so the autonomous run starts informed, not from a cold search.
Build: concrete deliverablesScopes the work; the "no MVP/stub/defer" line encodes Jack's delivery philosophy directly into the autonomous run.
Approach:Plan-before-execute + TDD + pattern-matching + scope guardrail (don't sprawl).
Verify: pass/fail listThe stop-judge's rubric — concrete pass/fail signals, conditional UX/security gates (hybrid answer), the data-integrity guardrail.
DONE when:The objectively-evaluable completion condition that prevents spin; "evidence not claims" closes it out.

Design Decisions

DecisionChoice & rationale
When to emit the briefOn pick. Present options as today; emit one brief for the option the user selects (default to the top recommendation if they just say "go"). Keeps output clean, avoids generating briefs that go unused, matches "analyze → decide → goal".
Verification disciplineHybrid. Generic backbone (tests green, verify-by-running, self-review, no silent caps) + jacked gates as "if available" (/dcr, /cso, /qa, /ux). Portable to non-jacked repos yet leverages the ecosystem where present.
UX / browser testingConditional [UI work] Verify line instructs browser-QA via available browser tools (Playwright/Chrome MCP) or /qa,/ux — included only when the chosen work is UI-facing.
Where the logic livesOne new step in the engine file only. Standalone configs embed the engine verbatim, so it propagates without touching jacked-setup.md.
Output formA short label line precedes the fenced block; the single authoritative copy/paste recipe ("copy the block above, not this line — type /goal , paste, send") follows it. Claude cannot self-invoke a slash command. If /goal is unavailable, the same brief works pasted as an ordinary message.
Char budget≤ 4000 (user target; hook hard cap is 10k). Skeleton measures ~1,900 chars. Step 8 includes an explicit trim instruction prioritizing Build + Verify + DONE if trimming is ever needed.
Security of inputsStep-1 DATA-only rule, extended: when content is echoed into options/Evidence/brief, directive-like text is paraphrased or fenced. In the brief's Refs: specifically, references are cited by identifier + neutral paraphrase and instruction-like text becomes [text omitted] — closing the one channel (verbatim-quoted evidence) that could otherwise carry a payload into the autonomous loop.
Stop-judge checkabilityThe /goal Stop-judge has no tools — it only re-reads the transcript. So Verify items are phrased "run each and show the output"; unfalsifiable negatives ("no silent failures") moved into Approach build-constraints rather than stop-gates; /dcr//cso reframed as "runs and reports clean." This prevents the documented spin-forever / stop-early failure modes.
Autonomous safety & resumabilityThe brief bounds the loop: feature-branch only; no force-push, history rewrite, data deletion, or untrusted install/network scripts; commit each green increment so an interrupted run leaves a resumable state; stop-and-ask on destructive/out-of-scope steps.
Option 0 (Resume Checkpoint)Excluded from forging — routed to /checkpoint resume, which restores the full prior context a cold brief would discard. A brief is forged for it only on explicit request.

File Structure

FileResponsibilityAction
jacked/data/commands/whats-next.mdEngine read by Claude at runtime; embedded verbatim into standalone configs.Modify — add Step 8; tweak intro + Step 7 to position /goal alongside /jack-it-up.
tests/unit/test_command_whats_next_goal.pyContent-presence regression tests on the engine file.Create.
README.mdUser-facing docs.Modify — one-paragraph mention under /whats-next.
jacked/data/skills/whats-next/SKILL.mdThin redirect to the engine.Unchanged.
jacked/data/commands/jacked-setup.mdStandalone-config generator.Unchanged (engine body copied verbatim).

Tasks (outline)

Detailed, TDD-ordered steps are produced by the writing-plans skill next. High-level shape:

Testing Strategy

These are LLM instruction documents, not executable code — so tests are content-presence checks that guard the critical contract from accidental deletion, not assertions about runtime behavior (which only Claude enforces at runtime). As built, tests/unit/test_command_whats_next_goal.py has 17 tests (anchored on once-only strings, mutation-verified to redden on deletion) covering, among others:

Plus a manual smoke check: build the wheel, jacked install, run /whats-next in a real repo, pick an option, and confirm the emitted brief is ≤ 4000 chars with a crisp DONE-condition and correctly-included/excluded conditional blocks.

Review outcomes

Two design forks were resolved with the user up front: emit on pick, and a hybrid verification gate that includes browser UX/QA when the work is UI-facing.

A two-wave recursive review (/dcr: Guardrails, Security, Logic & Edge Cases, UX & Flow, Testing, Simplicity/Maintainability + a pre-mortem analyst) then hardened the implementation. All findings were fixed and re-verified clean in Wave 2 (mutation-checked):

No open questions remain blocking.


Generated with the jacked HTML artifact template.