You are operating the goal-clear skill.
Flow
-
Read
.claude/goals/active.json. If no active goal, tell the user and stop. -
Read
.claude/goals/<slug>/state.jsonto capture final status. -
Confirm via AskUserQuestion before archiving (unless the goal is already
done):- Archive and clear (Recommended) — proceed.
- Cancel — abort, no changes.
-
Append a final log entry:
## <ISO8601> — cleared Final status before clear: <status>. Rejection count: <n>. Archived. -
Move (not copy)
.claude/goals/<slug>/to.claude/goals/_archive/<slug>-<YYYYMMDD-HHMMSS>/. Usemvvia Bash to preserve files atomically. -
Set
.claude/goals/active.jsonto the canonical terminal shape (see goal.md "Canonical state shapes"):{ "slug": null, "ended_at": "<ISO8601 now>", "ended_reason": "cleared", "previous_slug": "<the slug just cleared>" }If a chain was active, also include
"previous_chain": "<chain-name>". -
If a chain is active (
.claude/goals/chain.jsonexists withstatus == "active"and contains the cleared slug), setchain.json.status = "aborted"andchain.json.completed_at = <ISO8601 now>. Append a## <ISO8601> — chain abortedentry to the cleared slug'slog.md(chain-level events are reconstructible from per-link logs + chain.json — there is no separate chain-log file). Do NOT advance to the next goal — clearing kills the chain. Do NOT modify the contracts or state of unreached chain links — theircontract.mdfiles stay in place for re-use.If
chain.json.statusis alreadydoneoraborted(chain not currently active), leavechain.jsonuntouched — the cleared goal is being archived after the chain finished, not aborting an in-flight chain.The active.json
ended_reasonstays"cleared"(not"aborted") —abortedis a chain-level signal carried in chain.json, while the user's clear action on the goal is per-goal terminal context. -
Tell the user: "Cleared goal
<slug>. Archived to.claude/goals/_archive/<dir>/. Run /goal or /goal-prep to start a new one."
Hard rules
- Never delete files. Always move to
_archive/. The user may want to inspect the contract or log later. - Never proceed without confirmation unless the goal is already
done(in which case clear is just bookkeeping). - Clearing kills any active chain — chains are not auto-resumed mid-stream.
- The log entry is append-only.