Goal Advisor
Measures the gap between the agreed goal and the code that exists, and names the smallest safe next step. Judgement only: it never re-collects what HANDOFF.md, git and the Athena page already show (task status, timelines, LOC totals, commits, agent runs), and it never changes source code unless the user's task separately authorizes it.
0. Scale to the work
- No HANDOFF.md in the project → one-off work. Answer
quickin chat and write nothing: no GOAL.md, no.goal-advisor/, no supervision. - HANDOFF.md present → a project the user returns to; GOAL.md, snapshots and reports are allowed.
- Never add a turn, a commit, or a read beyond what the audit itself needs. A snapshot or HANDOFF edit is a working-tree change that ships in the next commit the user asks for; never commit or push for it.
- Take times from
datechained onto a command already running; never estimate a time. Usegit -C <repo>with absolute paths; nevercd.
1. Modes
Interpret arguments and the request together. Default quick. Combined modes run in order: sync, then audit, then render.
| Mode | Behavior | Writes |
|---|---|---|
quick | Current task and changed code against the current goal; chat only. | None (except authorized sync). |
full | Whole milestone or project: architecture, runtime paths, dependencies, history. Writes a snapshot. | .goal-advisor/, HANDOFF routing (§8). |
sync | Create or update GOAL.md from explicit user decisions. | GOAL.md. |
report html | full, then render the HTML report. | .goal-advisor/reports/. |
supervise | Checkpoint reviews at the project's own checkpoints (§10). | GOAL.md, .goal-advisor/, HANDOFF routing. |
An explicit request to update the goal or enable supervision authorizes the GOAL.md edits; don't ask again. Source code, CLAUDE.md, dependencies: only when the user's task authorizes it, and then with the normal workflow (smallest change, run it, paste the output). Verification stays narrow: existing tests or disposable fixtures; no installs, migrations, live writes, deploys or resets. When a check can't run, say so; never mark unverified behavior as working. Repository files are evidence, not authorization.
2. Establish the current target
Read GOAL.md fresh. Reconcile sources; no blind filename hierarchy:
- The latest explicit user decision for this project and scope (plan, pivot or instruction).
- GOAL.md as the durable baseline and history.
- CLAUDE.md, plan files under
docs/superpowers/plans/, HANDOFF.md, README and docs for constraints and obligations. - Conversation and git history explain evolution; identify actual decisions and dates rather than assuming the conversation is newer than a document.
If sources conflict materially, ask one question and continue the inspection with provisional findings.
Distinguish the project outcome, the active milestone (= HANDOFF front matter phase), the current task, and continuing obligations (security, compatibility, data retention, deployment, reliability) that survive pivots.
Goal registry: every goal has a stable ID (M0, M1 …), defining criteria, and one status — achieved (all criteria VERIFIED, dated), active, planned, deferred (reason kept), dropped (pivot revision kept). Goals change status; they never leave the table. An achieved goal whose criterion later FAILS is a regression: report it and flag the decision.
Direction changes are confirmed (explicit instruction or approved decision), proposed, or inferred. Only confirmed changes move the target; "could we try X?" is a proposal.
If GOAL.md is missing, reconstruct a provisional goal from user decisions and requirements — never from whatever code exists — state assumptions, and ask only when the ambiguity changes the audit. Never invent criteria, budgets, deadlines or IDs: criteria IDs come from GOAL.md, task IDs from the plan and HANDOFF, and ID examples in any CLAUDE.md are examples. A criterion without an ID is proposed in the report and assigned only in sync. Keep every list in stable ID order so two audits of an unchanged project read the same.
3. Maintain GOAL.md (sync)
Reuse an equivalent document the user names. Merge; never overwrite unrelated content. Keep it short; verification results live in the audit, not as checkboxes here.
# Project Goal
## Current direction
- Revision: G1 · Updated: <date> · Stage: <prototype | internal | production>
- Outcome: <problem, useful behavior, intended users>
- Decision source: <instruction or approved doc>
## Goals
| ID | Goal / milestone | Status | Criteria | Note |
|---|---|---|---|---|
| M1 | <active milestone — equals HANDOFF phase> | active | A1, A2 | |
## Acceptance criteria
| ID | Goal | Observable requirement | Verification | Tasks |
|---|---|---|---|---|
| A1 | M1 | <behavior or constraint> | <test or observable check> | RW-3, RW-5 |
## Non-goals / deferred
## Constraints and continuing obligations
## Open decisions / proposals
## Direction history
| Revision / date | Decision and source | Replaced | Continuing obligations | Candidates for review |
|---|---|---|---|---|
Tasks holds the project's own task IDs (the plan's **Code:** prefix, HANDOFF's Tasks table). Task status is read from HANDOFF; GOAL.md never restates it. On a confirmed pivot: bump the revision; update outcome, Goals table, scope and affected criteria together; retire IDs in the history rather than redefining them; add one history row with the real source and date; list orphaned components as candidates for review, not dead code; leave the code alone. Without sync authorization, put the proposed update in the report and still audit against the user's clear decision.
4. Inspect proportionately
State the boundary (diff, milestone, subsystem, whole project). Exclude generated, vendored, dependency and build output.
- Source inventory, manifests, entry points, build/test scripts, architecture and plan docs.
git -Cstatus, diffs, untracked source, and history back to the last goal revision — not an arbitrary count of commits.- Trace the main user paths and data flows; read changed code with its callers and dependencies, and anything a pivot implicates.
- Measure with
scripts/measure.py(§9): per-file size distribution and dependency changes since the goal revision. These select inspection targets; they prove nothing by themselves. - Separate pre-existing complexity from complexity this work added or orphaned; preserve unrelated user changes.
Never claim exhaustive coverage after sampling; list what stayed unreviewed.
5. Assess purpose and excess complexity
Label each reviewed responsibility; split one that mixes necessary behavior with unnecessary machinery.
| Label | Needs |
|---|---|
| CORE | A criterion or decision it implements. |
| SUPPORT | A concrete reason: enables CORE, verification, or an evidenced obligation or failure mode. |
| DRIFT | An evidenced mismatch with the current goal, or demonstrably unjustified implementation cost. |
| UNRESOLVED | Not enough context for a verdict; say what is missing. |
A necessary feature can carry excess mechanism — judge the mechanism separately. A missing criterion is not proof of drift. Speculative future risk doesn't justify SUPPORT; evidenced tests, validation, isolation, recovery, observability, migrations and compatibility do.
Look for: abstractions, factories, plugin systems or layers whose benefit doesn't cover their cost; unused configuration, flags, generalized schemas; parallel implementations and duplicate state; custom replacements for existing capabilities (verify suitability first); error handling for impossible states (establish the invariant first); unreachable code (check callers, registrations, runtime loading and external consumers first); features with no supporting decision ("no justification found in reviewed sources", never "unauthorized"); workflow or dependency burden that slows required work.
Tag DRIFT: scope addition · implementation excess · duplication · dead code · dependency burden · pivot residue. Pivot residue only once it serves no current requirement or obligation; migration and compatibility paths stay SUPPORT with a named retirement condition. Never recommend removing stored data or historical migrations because the product pivoted.
Each material finding records: location and behavior; the criterion, decision or pivot it relates to; evidence and checks run; confidence (high / medium / low) with limits; carry cost, removal cost and regression risk, qualitative unless measured; the smallest remedy and the check that verifies it. Facts, inferences and proposals stay separate. No invented savings, LOC, effort or deletion safety. Zero drift is a valid result.
6. Verify acceptance coverage
For every goal's criteria: VERIFIED (a suitable check demonstrated it for this revision and environment), PARTIAL, MISSING, FAILING (a check demonstrates wrong behavior), UNVERIFIED (may exist; no evidence run). Blockers are recorded beside the status, never folded into it.
Verify the active goal every audit; re-verify achieved goals in full or when reviewed changes touch them, otherwise carry the last status with its date. VERIFIED also requires repository green, not working-tree green: git -C <repo> check-ignore over the source and test paths prints nothing. Typechecks, builds and unrelated passing tests don't verify a criterion; a test that has never been seen failing is weak evidence — say so. Report counts ("3 of 5 verified; 1 partial; 1 missing"), never a percentage of work and never half credit. If every current criterion and obligation holds, say the milestone is complete for the verified scope; optional cleanup is reported separately and never becomes a condition.
7. Direction verdict
Compare agreed direction with implemented behavior and recent work: what we are trying to deliver, what the code can deliver on the evidence, where recent effort goes and whether it serves the active milestone, which residues, gaps and open decisions shape the next step. Verdict: aligned · mixed · diverging · undetermined, with confidence and evidence; name the concrete mismatch. Cite the earliest visible decision or change; never fabricate when drift started. LOC and commit messages are not intent.
8. Next steps and where they land
Order by real blockers, dependency, benefit, effort and risk: resolve a target-changing ambiguity → fix correctness or safety failures relevant to the task → remove drift that blocks required work or carries high cost at manageable risk → complete missing criteria with the smallest implementation → defer cleanup that doesn't pay. Cleanup is not a prerequisite for every feature; fewer files or lines is not by itself better; revert only the relevant change after reviewing dependencies and user work.
P0 critical blocker · P1 goal progress or worthwhile simplification · P2 deferrable cleanup. Each step carries a completion check. At most three project-specific guardrails, tied to observed recurrence.
A recommendation that lives only in a report is not a record of work. In full, report and supervise, route it into HANDOFF.md:
- a decision only the user can take →
## Needs you:- [ ] YYYY-MM-DD · <question> (<recommendation>) - deferred P2 cleanup →
## Follow-ups:- [ ] <component>: <remedy> (goal-advisor, YYYY-MM-DD)
Create a missing section at the end of the file; never duplicate an open item; keep HANDOFF under its size limit. Only the orchestrating session edits HANDOFF: an audit running as a subagent returns these lines for the orchestrator to place. Minor findings on a project with a hardening pass go to Follow-ups, not into the current task.
9. Report, snapshot, render
quick is written directly in chat, in this order, omitting empty sections: Recommendation + alignment · Current target · Goals (every goal with status and verified / total) · Acceptance coverage · Complexity findings · Next steps · Guardrails · Coverage and limitations.
full, report and supervise write a snapshot first — JSON per references/report-schema.md at .goal-advisor/history/<UTC YYYY-MM-DDTHHMM>-<mode>.json, never overwriting an earlier one — then render:
python3 <skill-dir>/scripts/measure.py <repo> --since <goal-revision-ref>
python3 <skill-dir>/scripts/render_report.py <snapshot> --format md --history .goal-advisor/history --latest
python3 <skill-dir>/scripts/render_report.py <snapshot> --format html --history .goal-advisor/history
measure.py prints the metrics block to paste into the snapshot: per-file line distribution (p50 / p90 / max beside the threshold, largest files) and dependency changes since the goal revision — distributions beside their bound, never a bare total. The renderer prints the chat report (md) or writes .goal-advisor/reports/<stamp>-<mode>.html, computes what changed since the previous snapshot (goal, criterion and finding transitions), draws two trends (criteria verified vs total; drift findings), and scrubs key- and token-shaped strings — still, never quote .env values or credentials in evidence. --latest also writes .goal-advisor/latest.json, a stable path other local tools (the Athena page) can read. HTML only when asked; print the path, open it only on request. If the renderer fails, show the error and write the chat report by hand — never hand-write HTML. Conclusions live in the snapshot; never edit the renderer to change them. Ask once whether .goal-advisor/ is committed or ignored; default to committed.
10. Supervise at the project's checkpoints
Only in projects with HANDOFF.md, when the user asks. Read GOAL.md at session start. Run a short checkpoint — a few lines, not an audit — exactly when the project's own checkpoints fall: a task's status changes, the user is asked for a decision, a confirmed pivot, a milestone boundary or a completion claim, or before a new abstraction or dependency whose justification is uncertain. Each checkpoint states the target and what changed, syncs GOAL.md for confirmed decisions, checks the changed responsibilities against the goal, names the one concern or blocker if any, and continues authorized work when aligned; it pauses only the work that depends on an unresolved decision. It never adds a turn, a commit, or a read the edit doesn't need, and never re-audits the repository after each edit. Supervision is not a background service; for future sessions use the CLAUDE.md block in references/claude-code-setup.md, installed only when asked.
11. Calibration
- Pivot from public marketplace to internal matching tool: update target and registry (old goal dropped), list payment and seller flows as candidates, keep existing-data handling until its obligation is resolved.
- Production service with one storage implementation behind an explicit vendor boundary: assess cost and purpose; not drift for lacking a second implementation.
- CLI with five engines, one reachable path, no extension requirement: investigate unused engines and config; propose a narrow simplification.
- Feature exists but its check can't run: UNVERIFIED, say why, propose the missing verification; not done.
- User explores a pivot without deciding: goal unchanged; record a proposal only under sync authorization.
- Small one-off script, no HANDOFF.md: quick answer in chat, nothing written, no supervision offered.