goal
Skill0 starsChanged 3 months agoMITView on GitHub
Use when the user wants an unattended, self-driving session that keeps working toward a stated objective across many turns without being re-prompted each time — triggers on "/goal", "goal mode", "keep going until done", "self-driving session", "drive this to completion autonomously", or a request to port omp's (oh-my-pi's) Goal mode to Claude Code.
- Reads credentials
- Commits and pushes
54 other projects use a version of this.
Adopted by
Most recently taken up by
- Masih-0x3/agent-skillstheir own version, first seen Nov 29, 2026
- ntholm86/principles-of-earned-autonomy-skills-suitetheir own version, first seen Nov 29, 2026
- softkleenex/open-primeagenttheir own version, first seen Nov 29, 2026
- ntholm86/agent-cognition-skillstheir own version, first seen Nov 29, 2026
- NVIDIA/AutoFAtheir own version, first seen Nov 29, 2026
- anthony-chaudhary/faktheir own version, first seen Nov 28, 2026
Used with
Projects with it also use origin, update-cli-config and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
0mlkrizzz655335vSkillorigin
origin CLI 管理。安装、登录、更新、修复 origin.cursor.com 的 CLI。"disabled-environments:
Also in 3 projects that use this
PandelisZSkillupdate-cli-config
View and modify Cursor CLI configuration settings in ~/.cursor/cli-config.json. Use when the user wants to change CLI settings, configure permissions, switch approval mode, enable vim mode, toggle display options, configure sandbox, or manage any CLI preferences.
Also in 4 projects that use this
0mlkrizzz655335vSkillreview-bugbot
缺陷导向代码审查。用 Bugbot 子代理找 bug。
Also in 3 projects that use this
32103210Skillmigrate-to-skills
Convert 'Applied intelligently' Cursor rules (.cursor/rules/*.mdc) and slash commands (.cursor/commands/*.md) to Agent Skills format (.cursor/skills/). Use when you want to migrate rules or commands to skills, convert .mdc rules to SKILL.md format, or consolidate commands into the skills directory.
Also in 4 projects that use this
32103210Skillupdate-cursor-settings
Modify Cursor/VSCode user settings in settings.json. Use when you want to change editor settings, preferences, configuration, themes, font size, tab size, format on save, auto save, keybindings, or any settings.json values.
Also in 4 projects that use this
MicrosoftSkillautomate
Propose an automation from a completed task or a new idea, then create it after approval. Use when the user asks to create an automation or wants scheduled local or cloud agent work.
Also in 4 projects that use this
- +3 more from 0mlkrizzz655335v
- +1 more from 32103210
Other versions54 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 54
- PrimeIntellect-ai/prime-agent★ 23ksame name
- cwinvestments/memstack★ 433same name
- coco-research/coco★ 324same name
- jthack/claude-goal★ 113same name
- svy04/ballast★ 73same name
- lennoxsaint/Skills★ 59same name
- anthony-chaudhary/fak★ 51same name
- Infinite-Labs-AI/infinite-skills★ 43same name
- manusco/resonance★ 38same name
- Sanexxxx777/curated-claude-code★ 16same name
44 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. 0 are common, 10 are distinctive, and 10 are very specific to this project.
0
Common
Most of the 50 edited versions we read keep these.
10
Distinctive
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
cycles: instead (one ScheduleWakeup firing = one cycle).
- Distinctive: line 43
When no falsifiable command exists, you have two honest options, and inventing a green command is not one of them: (a) make one first (add …
- Distinctive: line 60
Before editing, surface which tests are likely affected by the change (see Test-impact surfacing below) — not as a TDD mandate, as context.
- Distinctive: line 64
Every deliverable resolves to exactly one of two end states, never a vague middle: checked (its named command was actually run this …
- Distinctive: line 81
Every cycle ends in exactly one outcome: reschedule (more work to do, or work looks finished but hasn't been independently verified yet), …
- Very specific: line 137
Create .claude/state/ the first time a goal starts and add it to .gitignore if not already ignored — it's a working artifact, not something …
- Very specific: line 154
Liveness: every cycle writes the current UTC timestamp to .claude/state/goal-heartbeat (plain text, timestamp only) as its first action.
- Distinctive: line 184
Before asking "what's the objective," gather what's actually available — skip any signal that isn't present rather than requiring all of …
- Very specific: line 210
Read .claude/state/goal.md.
- Distinctive: line 213
Check for a stuck loop before committing to an action: compare the action you're about to take against the last 2-3 evidence-log entries.
- Very specific: line 234
Update the state file: mark [x] any deliverable whose command was actually run this cycle with passing output, append one evidence-log line …
- Very specific: line 281
Before editing, take the files about to change and find tests likely to cover them: grep for test files that import or reference those …
- Very specific: line 293
Check for a second, independent-vendor CLI: command -v codex or command -v gemini.
- Very specific: line 331
Use workspace-write, not read-only — confirmed by real testing, not assumed: --sandbox read-only (the naive choice, copied from …
- Distinctive: line 404
If a deliverable genuinely can't be checked by a subagent (it needs interactive host access a subagent won't have, for instance), do the …
- Distinctive: line 490
Only then may auto-merge be armed, and only if the bar below is met.
- Very specific: line 523
When the bar is met → enable auto-merge on that PR (glab mr merge --auto-merge, or the host-appropriate equivalent) so it lands the moment …
- Distinctive: line 687
Never claim model-independent verification without checking which case actually happened this run.
- Very specific: line 706
The token breaker measured the session, not the goal: No baseline, so a goal started mid-session was charged for everything spent before it …
- Distinctive: line 722
The lesson this repeats, at the repo's own expense: every one of those five lived under a suite that was green, and three of them lived in …
“Common” is measured: kept by at least 6 in 10 of the 50 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Goal Mode
Ported from oh-my-pi's (omp) Goal mode. Read the caveat before using it: Claude Code does not
expose per-turn token metering to the main session the way omp's harness does — omp's
/goal budget counts real input/output/cache-write tokens against the goal; this skill counts
cycles instead (one ScheduleWakeup firing = one cycle). That is an honest proxy, not the same
metric. Say "cycle budget" to the user, never "token budget."
The actual self-resubmission engine is ScheduleWakeup — the same real Claude Code tool that
backs /loop's dynamic self-pacing mode. This skill drives that tool with omp-style
objective/deliverable/status ergonomics on top; it does not reimplement resubmission.
Persistence, stated plainly: ScheduleWakeup and CronCreate (including CronCreate's
durable flag, which is currently a documented no-op — "durable persistence is not available. All
jobs are session-only... gone when this Claude session ends") both require this Claude Code process
to stay open and idle to fire. There is no local mechanism that survives the process closing. Tell
the user "/goal keeps running as long as this session stays open" — never "this will run
unattended overnight" or "this survives a restart." A genuinely process-independent option exists
(the schedule skill's cloud RemoteTrigger routines — real remote agents via claude.ai's API,
not local resumption) but it isn't offered here: a remote agent can't reach a project's local
host/SSH resources, which many real goals need. If the user needs true offline-survival, point them
at /schedule directly and say why /goal itself doesn't use it.
Contract
- One objective per goal. Restate it as concrete deliverables before starting, each paired with a
named command or check that proves it — not a prose sentence. "Add input validation" is not a
deliverable; "
pytest tests/test_validation.pyexits 0" is. - A deliverable's command must be able to fail. At goal creation, for each deliverable, establish
that its command would actually go red if the work were wrong or absent — cheapest honest method
first: does any test import or exercise the code path (
grepthe test dir for the symbol/module), and if the answer is no, the command is not evidence about that code. Where it's cheap, prove it by breaking the thing on purpose for one run and watching the command fail, then revert. This is not pedantry — it is the single most expensive lesson this skill has learned. On the 2026-08-23 wireIpc run, all five deliverables' commands passed at every step and a verifier's mutation test later showed the suite still reported55 pass, 0 failwithwireIpc()emptied to register zero channels: nothing imported that file. Five honestly-satisfied commands, near-zero evidence. When no falsifiable command exists, you have two honest options, and inventing a green command is not one of them: (a) make one first (add the missing test as its own deliverable, so later deliverables have a real gate), or (b) keep the weak command but write the ceiling into the deliverable line itself — e.g. "npm testexits 0 — ceiling: no test imports this module, so this proves the repo still builds, not that this change is correct; behavior evidence is the diff review + typecheck." Then every later report inherits the caveat instead of quietly implying coverage that does not exist. - State lives in
.claude/state/goal.mdin the project root, human-readable, git-ignored. Read it fresh every cycle; never trust memory of an earlier cycle's status. - One bounded, reversible unit of work per cycle — and only one deliverable advances per cycle,
even if a second one looks tractable too. Anthropic's own research on long-running agent harnesses
found the agent "tended to try to do too much at once — essentially to attempt to one-shot"
the work, leaving things half-finished and undocumented; restricting each cycle to one deliverable
is their own validated fix, not a guess. Scope-creeping into a second deliverable mid-cycle is
exactly what this rule exists to prevent. If a cycle's work later turns out wrong (a later cycle or
the verification pass finds it broken), the recovery path is
git revert, not manual undo — the history is there specifically so a bad cycle can be cleanly rolled back. - Before editing, surface which tests are likely affected by the change (see Test-impact surfacing below) — not as a TDD mandate, as context.
cycle_budgetdefaults tonone(unbounded). That's deliberate — "work until done" is the point — paired with the heartbeat below so an unbounded run stays visible instead of silently grinding.- Every deliverable resolves to exactly one of two end states, never a vague middle: checked
(its named command was actually run this verification pass, with real output attached — a
judgment call with no pasted output is not a valid check) or deferred (a named ceiling — what
isn't done and why — plus a concrete revisit trigger, not "later").
status: completerequires every deliverable to be checked or deferred; an open, unresolved deliverable blocks completion. There is no floating 1-10 score anywhere in this skill — a self-graded number is exactly as gameable as the completion claim it's supposed to guard against, and "keep improving until it's a 9" has no stopping condition the loop itself can be trusted to pick. - The deliverable criteria are visible from the start (they're written into
goal.mdat creation), but the specific cycle-by-cycle plan for satisfying them is not pre-committed — each cycle picks its own next bounded step rather than executing a fixed script toward a known check. Real coding agents have been caught gaming a visible, fixed test oracle while the actual deliverable stayed broken; not pre-committing the path is a small, cheap hedge against that, not a full fix. - Completion requires re-reading current repo state and mapping every deliverable to command evidence, right now — not "should be true by now." A narrow check does not prove a broad claim. It also requires an independent verification pass (see below) — the cycle that just finished the work does not get to grade its own completion.
- Every cycle ends in exactly one outcome: reschedule (more work to do, or work looks finished but hasn't been independently verified yet), complete (an independent verification pass just confirmed every deliverable is checked or deferred, this cycle), budget-limited (cycle cap hit — wrap up and stop rescheduling, leave the goal active, never fake completion to escape the cap), or a hard stop the user asked for (pause/drop).
- Goal mode does not waive normal boundaries: this repo's AGENTS.md/CLAUDE.md, human-gated actions,
and no destructive or credentialed operations without confirmation still apply exactly as in a
normal turn. Goal mode does not itself decide when a human-gated action (e.g. this repo's
detonation approval) is satisfied — a blocked-on-human deliverable stays unticked and the goal
stays
active, cycle after cycle, until a human actually clears it. - Whenever a cycle actually pauses and flags something for a human (a real merge conflict, a found
secret, any other case this file names as blocked-on-human), call
PushNotification(status:"proactive", under 200 characters, leading with what needs a decision) in addition to the chat message. A passive chat message is documented as unreliable for long-running agents — nobody's necessarily watching. This always reaches the desktop, and additionally the phone only if Remote Control happens to be connected; say that honestly rather than promising guaranteed mobile delivery. Never call it for routine progress or a noop cycle — only a real pause.
State file — .claude/state/goal.md
# goal
status: active # active | paused | budget-limited | complete | dropped
cycle_budget: none # integer or "none"
cycles_used: 0
started: <UTC ISO-8601>
started_sha: <git rev-parse HEAD at goal creation, or omit if not a git repo>
last_slop_check_sha: <written by the anti-slop hook itself after each check; absent until the first check runs>
last_summary_cycle: <the boundary cycle whose 50-cycle summary was last emitted; written by the cycle itself when the summary gate fires; absent until the first boundary>
token_budget: <integer, optional; absent = unbounded. Opt-in real token cap, metered by the cost-breaker hook>
tokens_baseline: <written by the cost-breaker hook the first time it meters this goal; the session-transcript total at that moment, subtracted from every later reading so the budget measures THIS GOAL and not the whole session>
tokens_used: <written by the cost-breaker hook each stop; tokens spent since tokens_baseline>
ship: auto | ask # asked once at creation; auto = ship each checked deliverable as a stacked PR without re-asking, ask = verify and stop each time for a manual ship decision
updated: <UTC ISO-8601>
## Objective
<verbatim objective text>
## Deliverables
- [ ] <deliverable 1> — command: `<exact command/check that proves it>`
- [x] <deliverable 2> — command: `<exact command>` — checked: see evidence log cycle N
- [deferred] <deliverable 3> — command: `<exact command>` — ceiling: <what's not done, and why> — revisit: <the concrete trigger to come back to this>
## Evidence log
- cycle 1 (<timestamp>): <what happened, receipt>
## Notes
<blockers, residuals, anything the next cycle needs to know>Three states, not a spectrum: [ ] open (not yet attempted or not yet verified), [x] checked (its
command was actually run and the output is in the evidence log — a checkbox ticked without a
matching evidence-log line is not a valid check), [deferred] (explicitly punted, with a ceiling and
a revisit trigger named inline, not left as a vague TODO). status: complete requires zero [ ]
items remaining — everything is either checked or honestly deferred.
Create .claude/state/ the first time a goal starts and add it to .gitignore if not already
ignored — it's a working artifact, not something to ship in a diff. If the project is a git repo,
record started_sha (git rev-parse HEAD) at creation — the anti-slop/drift gate below depends on
it to know what's actually new. If there's no git repo, omit the field; the gate then has no
baseline to diff against and skips itself. Say so in the same response that creates the goal — "no
git repo detected, the anti-slop/drift gate won't run for this goal" — once, not every cycle; a
missing gate should never be a surprise the user only discovers by noticing slop later.
Containment: also at creation, check whether the project has its own containment/sandboxing
convention — a containment.env-style file, a sandbox script named in that project's AGENTS.md/
CLAUDE.md, a devcontainer config. If one exists, note it in goal.md and respect it before risky
operations. If none exists, say so plainly in the same response — "no project-level containment
detected" — rather than letting instruction-level boundaries ("don't touch X") imply a safety
guarantee they can't actually back. Manual gates get rubber-stamped over time and instructed-not-to
has a real, documented failure history (a production database deleted despite an explicit
instruction not to touch it); don't imply this skill closes that gap when it doesn't.
Liveness: every cycle writes the current UTC timestamp to .claude/state/goal-heartbeat (plain
text, timestamp only) as its first action. This lets anyone check whether a run is actually still
alive from outside the session — "has this file's content moved in the last N minutes" — without
needing to interact with the running session at all. Unlike goal.md, this file has exactly one
writer — the cycle itself; the anti-slop hook never touches it — so it doesn't need the same
Concurrency treatment below; there's no second actor to race against.
Concurrency: /goal assumes one active loop per project — already enforced by refusing a second
/goal <objective> while one is active — and does not guard against a human hand-editing goal.md
while a cycle is mid-write. That's a rare, recoverable risk (the Evidence log re-derives most of what
a hand-edit could clobber), not a lock file's worth of complexity.
Subcommands
| Invocation | Effect |
/goal <objective> | No active goal: create one, derive deliverables, start the cycle chain. An active goal already exists: refuse, tell the user to /goal set or /goal drop first. |
/goal set <objective> | Replace the objective on the current goal; re-derive deliverables. Refuses while paused — resume or drop first. |
/goal show | Read-only: objective, status, cycles_used/cycle_budget, deliverables, elapsed time. Never reschedules. |
/goal pause | status: paused, ScheduleWakeup({stop: true}). No further cycles fire until resumed. |
/goal resume | status: active (from paused, or from budget-limited after a raised budget), ScheduleWakeup to fire the next cycle almost immediately (delaySeconds: 60). |
/goal drop | Confirm with the user first. Then status: dropped, ScheduleWakeup({stop: true}). Leave the state file as a record — don't delete it. |
/goal budget <N|off> | Set cycle_budget to N or clear it (off). If this raises the cap above cycles_used on a budget-limited goal, flip back to active and resume the chain. |
/goal continue | Internal — what the scheduled wakeup resubmits. Not meant for the user to type, though nothing breaks if they do. |
/goal with no arguments: active goal → same as /goal show. No active goal → propose candidate
objectives (see below) as part of asking what the objective is; this is not a separate subcommand.
Proposing an objective
Before asking "what's the objective," gather what's actually available — skip any signal that isn't present rather than requiring all of them:
- Recent commit messages (
git log --oneline -20or similar) — what's actually been in motion. - TODO/FIXME comments in files touched by those recent commits.
- Currently-failing tests, if a conventional test command is discoverable (a script in
package.json, aMakefiletarget,pyproject.toml, etc.) — don't assume one exists or guess at a command that isn't actually configured. - Any project status or decision doc —
STATUS.md, gaps implied bydocs/adr/, a "known gaps" section inAGENTS.md/CLAUDE.md.
From what's found, propose 2-3 concrete candidate objectives, each with a one-line reason drawn from
a real signal above — not a generic suggestion. Present them via AskUserQuestion with the
candidates as options plus the tool's own "Other" for the user's own objective — never a written
report nobody's forced to read. If no signals were found at all, skip straight to asking plainly;
don't force a candidate out of nothing.
This is proposing, never deciding: the loop does not pick its own objective and start working without a human choosing one. No shipped autonomous coding agent (Copilot's coding agent, Devin, Cursor's background agents) actually lets the agent select its own task from repo signals — every one still has a human name the goal, they just execute it unattended. The risk literature on agents drifting off a human-given goal doesn't even cover the case of an agent starting with none — that's an unstudied risk profile, not a solved one, which is why this stays propose-only.
The cycle (/goal continue, and the first cycle right after creation)
- Read
.claude/state/goal.md. Ifstatusis notactive, do nothing and do not reschedule — the loop already ended or was paused/dropped by another turn. Write the current UTC timestamp to.claude/state/goal-heartbeat(see Liveness above). - Check for a stuck loop before committing to an action: compare the action you're about to take
against the last 2-3 evidence-log entries. This is now also backed by a Stop hook
(
hooks/goal-stuck-check.sh): three consecutive evidence-log entries with byte-identical payloads block the stop and hand back the three options below. The hook is the mechanical floor, not the whole rule -- it only catches exact repetition, and the judgment described here catches the cases where the wording drifts but the work doesn't. Undercycle_budget: nonenothing else will ever halt a loop going nowhere, which is why the floor exists at all. The signal is the same command producing the same result — e.g. cycle N and N+1 both run the identical test command and it fails with the identical error, with no code change attempted in between that could plausibly have changed the outcome. That's duplicate work, not progress. It is not duplicate work for two consecutive cycles to re-run the same test command after two genuinely different fix attempts, even though the command itself repeats — the command being identical isn't the signal, the outcome not moving despite an attempted change is. When it's a real duplicate-work signal, note the repetition in## Notesand either pick a genuinely different next step, or, if nothing new is actually possible, treat the deliverable like any other that needs deferring (a named ceiling and revisit trigger), rather than repeating the same action again. - Before editing, surface which tests are likely affected by the change (see Test-impact surfacing below). Then do one bounded, reversible unit of work toward the least-complete deliverable — one deliverable only, per the Contract above. Same discipline as any normal turn: read real files before editing, run the actual check instead of assuming its result, keep the diff surgical.
- Update the state file: mark
[x]any deliverable whose command was actually run this cycle with passing output, append one evidence-log line naming the command and what it showed, bumpcycles_used, bumpupdated. - Decide the outcome:
- Every deliverable looks resolved, right now, against current repo state — either genuinely
done, or a clear case for deferring it → do not jump straight to
complete. Run the independent verification pass below first. Only the verification pass, not this cycle, is allowed to setstatus: complete. This must include the deferred case: a deliverable that can't be done is still resolved once there's a real ceiling and revisit trigger to name for it — don't wait for it to "look met" first, or a permanently-blocked deliverable never triggers verification at all and the goal reschedules forever under the default unbounded budget. cycle_budgetset andcycles_used >= cycle_budget→status: budget-limited. Do not start new substantive work this cycle; summarize progress and name what's left and any blocker.ScheduleWakeup({stop: true}). Tell the user the cap was hit and how to raise it (/goal budget <N>). This is explicitly not completion.- Otherwise →
ScheduleWakeup({prompt: "/goal continue", delaySeconds: <picked per ScheduleWakeup's own pacing guidance>, noop: <false if this cycle changed anything, true if it was a genuine no-op>, reason: "<one line on what's next, even a no-op — this is the loop's heartbeat>"}). Only send a chat-visible status message to the user whennoop: false(real progress, a blocker, or the loop ending) — a cycle that found nothing new stays out of the chat, though the reschedule reason still records it. Every 50th cycle (cycles_used % 50 == 0), send a chat-visible progress summary regardless ofnoop— how many deliverables are checked, deferred, and still open, and cycles used so far — so an unbounded run stays visible on its own schedule instead of only when something happens to change. The 50-cycle summary is an enforced Stop hook, not an instruction —~/.claude/skills/goal/hooks/goal-summary-gate.sh, run by thegoal-stop.shcoordinator (see "How the hooks are wired" below). History, stated plainly because it's this skill's own thesis proven on itself: the prompted version of this rule was dropped at two consecutive real staged boundaries (cycle 50, then cycle 100 in a retest run specifically to check the fix) — even with the rule freshly amended and restated inside the state file's own evidence log, the cycle turn ended on theScheduleWakeupcall and the closing text never got written. Prompted discipline decays; enforced gates hold (the same SlopCodeBench premise behind the anti-slop hook). What the gate does: at a boundary (cycles_used % 50 == 0) with no matchinglast_summary_cyclemarker ingoal.md, it blocks the stop once and hands back instructions — emit the summary as final text, then writelast_summary_cycle: <N>intogoal.md; that marker is what clears the gate, so a summary claim without the marker doesn't pass. It fails open everywhere it can't decide (no state file, non-numeric cycles, goal not active, or the stop already survived one block — that last case logs a visible fail-open note to## Notesrather than wedging the loop). All eight branches pipe-tested for real before wiring.
- Every deliverable looks resolved, right now, against current repo state — either genuinely
done, or a clear case for deferring it → do not jump straight to
Test-impact surfacing
This is not a TDD mandate — a controlled study (TDAD, arXiv:2603.17973) found that a blanket "do TDD" instruction actually increased regressions in autonomous coding agents (to 9.94%, worse than giving no instruction at all), while giving the agent targeted context about which tests are affected by its change cut regressions 70%. So the discipline is surfacing, not procedure.
Before editing, take the files about to change and find tests likely to cover them: grep for test
files that import or reference those paths, or that match an obvious naming convention (foo.py →
test_foo.py, Foo.ts → Foo.test.ts, a matching describe/it block, etc.). This is a
best-effort pattern match, not real static analysis or a dependency graph — no universal test-impact
tool exists across arbitrary language stacks, and this skill doesn't pretend otherwise. Run the
tests it finds after the change; if nothing matches, say so rather than silently skipping.
Verification before completion
The cycle that just finished the last piece of work is the worst-positioned judge of whether it's
really done — it wants to be done. Before status can become complete:
- Check for a second, independent-vendor CLI:
command -v codexorcommand -v gemini. This decides whether verification can be cross-model — a real pattern independently converged on by several Claude-Code skills (see~/.claude/commands/santa-loop.mdfor the reference invocation pattern this reuses) — or falls back to same-model-only. - Dispatch a fresh Claude subagent (general-purpose, no shared context) with the objective, the
deliverable list, and the evidence log. Instruct it to actually run each deliverable's named
command against current repo state — not judge whether it looks done, run it — and report the
real output plus a per-deliverable
checkedordeferred(with a ceiling and revisit trigger) verdict. A verdict with no pasted command output behind it is not a valid verification result; research on false-completion claims found plain LLM-judgment alone barely beats chance (AUROC ≤0.65) at catching them — this is exactly why the requirement is "ran it," not "looked at it." - If step 1 found a second CLI, before spending a full verification pass, run a cheap sandbox
capability probe once:
(one small call, not the real verification). This is a known, confirmed failure mode, not a hypothetical: codex'scodex exec --sandbox workspace-write -C "$(pwd)" - <<< 'Run: node -e "require(\"child_process\").execFileSync(process.execPath,[\"-e\",\"1\"])" then print exactly SANDBOX_SPAWN_OK on success or SANDBOX_SPAWN_BLOCKED: <error> on failure.'workspace-writesandbox on Linux runs commands through a bundled Landlock/seccomp helper plus anexecvewrapper (visible incodex doctor's own sandbox diagnostics) that blocks a nested subprocess spawn — e.g. a test runner spawning a fresh node process viaexecFileSync— withspawnSync ... EPERM, even though the top-level command codex itself ran executes fine. Confirmed by real testing, not assumed — a full stack trace with a version-matched node binary on both sides ruled out a version mismatch as the cause. If the probe reportsSANDBOX_SPAWN_BLOCKED, note it in the evidence log now — "codex sandbox cannot spawn nested subprocesses in this environment (confirmed via probe)" — so that if the real verification later disagrees on a deliverable whose command happens to spawn a subprocess, the cause is already known and doesn't need rediscovering through multiple investigative round-trips (the historical pattern before this probe existed). A probe result ofSANDBOX_SPAWN_OK, or a deliverable command that never spawns a subprocess at all, means this specific gap simply doesn't apply this run — don't treat the probe as a reason to skip verification. Build the real prompt (same objective, deliverables, evidence log, same "actually run each command" instruction) and write it to
.claude/state/goal-verify-prompt.txtbefore invoking anything — not a bare/tmppath; this directory is already/goal's own working area, so writing there stays inside a place the skill already manages, cleaned up after the verification pass rather than left behind. Then run:codex exec --sandbox workspace-write -m <model> -C "$(pwd)" - < .claude/state/goal-verify-prompt.txt, orgemini -p "$(cat .claude/state/goal-verify-prompt.txt)" -m <model>if codex isn't installed. Useworkspace-write, notread-only— confirmed by real testing, not assumed:--sandbox read-only(the naive choice, copied fromsanta-loop's reference pattern, which is designed for reviewing a diff, not executing a verification command) fails on any deliverable command that needs to write anything at all, which is most of them.workspace-writeis not a full fix either — see the nested-subprocess-spawn limitation named in step 3. When that happens, it is not evidence the deliverable is broken — get the raw underlying error (not just the CLI's own summarized verdict) before concluding anything, the same way this cycle's own reconciliation did. Both reviewers must reach the same per-deliverable verdict for it to finalize — a disagreement is not resolved by picking one, or by automatically escalating sandbox permissions until it passes (that's the same goalpost-moving this design exists to prevent, just aimed at the verifier instead of the deliverable) — the deliverable stays unresolved and the next cycle does more work to reconcile it, same as any other unconfirmed result; if the disagreement traces to the verifier's own sandbox rather than the code, defer the deliverable with that traced cause as the ceiling, don't force a checked verdict.There is a safe, deliberately non-automatic way to close this specific gap for a deliverable stuck
[deferred]on a confirmed sandbox-EPERM ceiling, when a human wants the stronger guarantee badly enough to accept the real risk: re-run only that deliverable's verification withcodex exec --dangerously-bypass-approvals-and-sandbox -m <model> -C "$(pwd)" - < .claude/state/goal-verify-prompt.txt. That flag is documented by codex itself as "EXTREMELY DANGEROUS... intended solely for running in environments that are externally sandboxed" — it removes codex's own sandbox entirely for that run, not just the nested-spawn restriction, so it is a real increase in blast radius (arbitrary command execution with no inner sandbox), not a scoped fix./goalnever does this itself and never suggests it as a default — a human decides to invoke it explicitly, outside the autonomous cycle, and the resulting verdict (and the fact that a human explicitly authorized the escalation) gets logged in the evidence log same as any other verification result. This is the one documented exception to the rule two paragraphs up — but only to its letter, not its spirit: that rule bars the loop from automatically escalating sandbox permissions to force a pass, and this path is deliberately outside that scope, since a human, not the loop, is the one moving the goalpost. The other real lever, out of/goal's scope but worth naming to the repo owner: a test that spawns a subprocess only to re-invoke logic already in-process (e.g. this pattern'sexecFileSync(node, [script.mjs])wherescript.mjs's logic could instead be imported and called directly) hits this sandbox limitation for no real reason — fixing the test, not the verifier, removes the gap entirely for that repo.If no second CLI was found, verification proceeds on the Claude subagent's verdict alone, but log this explicitly — "cross-model verification unavailable: codex/gemini not found, using same-model verification only" — in the evidence log, so the weaker guarantee is visible, not silent. Same-model verification has a measured self-preference bias (documented -21% to +90% depending on setup) that context isolation alone doesn't remove; this is a real gap to name, not a formality. 4b. When a deliverable's command is weak evidence, escalate to property-based testing. The Contract above requires each command to be able to fail, and the wireIpc run is what happens when that is assumed rather than established. The
property-based-testingskill shipped inskills/property-based-testing/is the systematic version of that check: derive the oracle from an authoritative contract rather than from the candidate implementation, generate inputs by partition, and mutation-test the properties themselves so a suite that cannot kill a behaviour-changing mutant is identified as weak rather than counted as coverage. Reach for it when a deliverable is "refactor X without breaking it", when the only oracle available is the code under test, or when a verifier's mutation probe comes back showing the suite green against broken code. It is not required for every deliverable -- most have a real command already -- and it is not a substitute for the independent verification pass, which still has to actually run the command.- In the same pass, have the Claude subagent also run
ponytail-auditandponytail-debt(both one-shot, read-only skills) scoped to the files this goal actually touched, not the whole repo — a whole-repo scan would flag pre-existing bloat/debt this goal didn't create. These catch what the per-cycle anti-slop hook's diff-scoped view structurally can't: repo-wide duplication and orphanedponytail:debt markers with no upgrade trigger. - Every deliverable resolves to
checkedordeferred(cross-model-agreed where available), andponytail-audit/ponytail-debtcome back clean →status: complete, append a final evidence-log line citing the independent verification and its findings,ScheduleWakeup({stop: true}), report completion to the user with the receipts — including which deliverables aredeferredand why, not just the ones that passed. - Anything still
[ ]open, unresolved from a reviewer disagreement, or a realponytail-audit/ponytail-debtfinding → do not mark complete. A bloat/debt finding blocks the same way an unresolved deliverable does — this design's whole premise is that enforced gates hold up over many cycles and prompted/advisory ones don't (SlopCodeBench, arXiv:2603.24755), so treating this one as optional would contradict the reason it's here. Note exactly what was found in## Notes, and fall through to the normal reschedule/budget-limited branch — the goal staysactive(orbudget-limited) and the gap becomes the next cycle's work.
If a deliverable genuinely can't be checked by a subagent (it needs interactive host access a subagent won't have, for instance), do the re-check yourself in a dedicated next cycle instead — the requirement is independence from the cycle that did the work, not the specific mechanism.
Shipping: stacked branches
/goal has no git workflow of its own by design — it reuses dev-loop's existing Ship mechanism
(worktree isolation, conventional commits, gh pr create) rather than reinventing it. The one
difference: each new stack level branches from the tip of the previous stack level, not from
main. Do this explicitly, not by reusing dev-loop's worktree one-liner unmodified — that command
branches from whatever HEAD happens to be at invocation time, not necessarily the previous level:
git worktree add -b <type>/<topic>-level<N> ../wt-<topic>-level<N> <previous-level-branch>The <previous-level-branch> start-point argument is what makes this a stack instead of N
independent branches off main.
Authorization: dev-loop's own Ship section is conservative by default — it stops with a
verified diff and asks before committing unless the user's request explicitly authorized the full
ship path. /goal doesn't inherit that ambiguity silently. Ask once, at goal creation, whether the
user wants each resolved deliverable (checked or deferred) auto-shipped as a stacked PR, or wants
/goal to verify and
stop each time for a manual ship decision. Record the answer in goal.md (a ship: auto or
ship: ask field) so it doesn't need re-asking every stack level — re-asking per level would
silently reintroduce the exact blocking this design exists to remove, and assuming standing
authorization without ever asking would silently violate the ask-before-pushing norm this repo (and
dev-loop) otherwise holds to. ship only ever decided whether opening each PR needs a fresh ask
— whether merging one does is a separate question, answered next.
A new stack level triggers when a deliverable resolves — [x] checked or [deferred], either one.
A deferred item ships too, not just a checked one: the underlying work can be real and correct even
when full automated sign-off wasn't reached (a verifier's own environment limitation is a common
real cause, not the only one). What changes is the PR body, not whether it ships — state the
deferral plainly there: what's confirmed, what isn't, and why, the same honesty the deliverable's
own ceiling and revisit trigger already require. A human reviewing the PR sees exactly what's solid
and what's still open, same as if /goal had said so in chat — shipping a deferred item is not
license to describe it as done.
Before opening each stack level's PR, run
~/.claude/skills/goal/scripts/secret-scan.sh <parent-branch> against it — it scans the actual
content of every file changed relative to the parent level for recognizable secret patterns (AWS
keys, private key headers, common vendor token prefixes; deliberately narrow, not a generic
high-entropy scanner). A real match blocks the ship the same way any other human-gated case does —
pause and flag, name what was found and where, never silently ship it. This catches an accidental,
unintentional inclusion (a .env value that rode along into a diff or commit), not deliberate
exfiltration — a distinct risk from the anti-slop hook's own residual prompt-injection caveat.
AI review gate, then auto-merge — no human click required. Immediately after opening each stack
level's PR, dispatch a fresh code-reviewer subagent (no shared context) against that PR's own diff
(git diff <parent-branch>...HEAD in that level's worktree, not the cumulative stack diff).
Give the reviewer the remote-tracking ref as the base — origin/<branch>, never the bare local
branch name. Confirmed by a real false positive, not a hypothetical: in this workflow the loop
ships from throwaway worktrees, so the main worktree's local branch pointer routinely lags behind
what the PR actually targets (a git merge --ff-only that aborts on a dirty tree leaves it stale,
which happened twice in one run). A review prompt saying git diff feat/my-branch...HEAD then diffs
against a stale base, and the reviewer correctly reports extra changes that are not in the real PR
at all — burning a review cycle and, worse, producing a plausible-looking finding about a defect
that does not exist. Verify the base before dispatching: git rev-parse --short <local> versus
git rev-parse --short origin/<local> should match; if they don't, use the remote one and know the
local ref is behind. The cheap cross-check on any "the diff also contains X" finding is
git diff origin/<target>...<source> | grep -E "^[+-].*X" — if X appears only in a @@ hunk-header
context line, it is not part of the change. This
applies to every PR /goal opens — a [deferred] deliverable's PR gets reviewed exactly like a
[x] checked one, not skipped: a deferred verdict is frequently about a verifier's environment
limitation (see the sandbox-EPERM case earlier in this file), not a code defect, so an independent
review can still clear code that a verification pass couldn't fully confirm.
Auto-merge requires the independent verification pass to have already run and agreed on
that deliverable — the review alone is not enough. This ordering is a correction, and it
was earned: the previous version armed auto-merge on the code-reviewer verdict alone, and
the entry two rows down in the scorecard records what that cost. On MR !127 the reviewer
returned Ready to merge, "no new issues found", auto-merge fired, and the cross-model
verification pass then found three real overclaims it had missed, including a test whose
name claimed every handler was covered while deleting a handler's guard still left the
suite green. The review had merge authority and the verification did not, so the review's
blind spots shipped. Review and verification catch different classes; running the one with
merge authority first is backwards. So, per deliverable, in this order:
- The deliverable's own verification pass completes (independent subagent actually runs
the command; cross-model agreement where a second CLI exists) and resolves it
checkedordeferred. secret-scan.shpasses against the parent branch.- The PR opens and the
code-reviewersubagent reviews that level's own diff. - Only then may auto-merge be armed, and only if the bar below is met.
A deliverable that has not been through step 1 does not get an armed auto-merge, no matter
how clean its review reads. Under ship: ask this is moot — a human is the gate — but
under ship: auto it is the whole difference between "an AI reviewed it" and "an AI
reviewed it and a second, independent pass re-ran its commands."
CI is a required gate, and a missing or skipped pipeline is not a pass. Arm auto-merge so the platform lands the change when CI goes green; never merge immediately to route around a pipeline that has not finished. If the project has no CI at all, say so in the PR body and in the evidence log — "no CI configured, so nothing mechanical gates this beyond the review and verification passes" — rather than letting the absence read as a green check. See the 405 note below, which is exactly this failure mode wearing a different hat.
Scope. A goal cycle may only push to its own stack branches. It never pushes to main,
never force-pushes, never rewrites a branch it did not create, and never changes CI
configuration, workflow permissions, deploy credentials, or branch-protection settings — any
of those pause blocked-on-human with a PushNotification, the same as a merge conflict or a
found secret. This is a boundary the loop cannot enforce on itself, so protect main at the
platform level too; a rule the loop is asked to keep about its own blast radius is exactly
the kind this file's own thesis says will decay.
The bar is Ready to merge with zero CRITICAL and zero HIGH/Important findings — nothing
less auto-merges. This wording is deliberately strict because the previous wording was
self-contradictory and a deliberate test proved it dangerous: it said "zero CRITICAL and a verdict of
Ready to merge or Ready with fixes → enable auto-merge" in one sentence and "any CRITICAL
or HIGH → do not" in the next. On 2026-08-24 a real bug was injected into a realistic diff
(randomUUID() hoisted out of a handler, making a per-call subscription ID a per-process constant —
passing both the test suite and tsc). The reviewer caught it correctly and returned Ready with
fixes, 0 CRITICAL, 1 Important. Under the first clause that auto-merges; under the second it does
not. A gate whose rule contradicts itself on the exact output a successful review produces is not
a gate. Ready with fixes means a human should look at the fixes — it is not an auto-merge verdict,
and treating it as one silently converts "the reviewer found a real problem" into "shipped."
When the bar is met → enable auto-merge on that PR (glab mr merge --auto-merge, or the
host-appropriate equivalent) so it lands the moment CI goes green, with no human click anywhere in
the path. Any CRITICAL or HIGH/Important finding, or any verdict short of Ready to merge
→ do not enable auto-merge; leave the PR open, record
the specific finding in ## Notes, and either fix it in a following cycle (if it's something this
goal itself introduced and can correct) or fall through to the blocked-on-human pattern (chat message
plus PushNotification) if it needs a judgment call beyond a mechanical fix. Log the review verdict
in the evidence log either way — same "ran it, not looked at it" evidentiary bar as every other
verdict in this file, so a code-reviewer subagent that reports Ready to merge needs the actual
findings summary behind it, not a bare assertion.
Say what this does and does not guarantee, plainly, because it's a real change from every other project this skill might run in: this is a deliberate choice for this project specifically — code merges here without a human ever looking at the diff, gated only by an AI review. That is not this skill's universal default; it's what was explicitly asked for here ("that's how we do agentic development"), and it carries the same self-preference-bias caveat already named for same-model verification elsewhere in this file — an AI reviewer with no memory of writing the code is still not a human, and "reviewed by AI" is a different, weaker guarantee than "reviewed by a person," stated here so nobody mistakes one for the other later.
A 405 Method Not Allowed on the merge endpoint usually means "pipeline not finished yet," not
"blocked." Observed twice, and the second observation corrected the first — recorded here
with the correction visible, because the wrong version of this note was briefly in this file:
- MR with
pipeline: successbuthead_pipeline: null(right after a same-stack retarget):glab mr merge --auto-merge405s, butglab api -X PUT ".../merge" -f squash=falsesucceeds. - MR with
pipeline: runningandhead_pipeline: null: bothglab mr merge --auto-mergeand the raw API 405 — including-f merge_when_pipeline_succeeds=true. So this is not merely aglabclient-side quirk (the first observation's conclusion, which was wrong as a general claim); GitLab's own API refuses the endpoint while the pipeline is still in flight.
The determinant is pipeline completion, not head_pipeline nullness. So: on a 405, first read
merge_status / detailed_merge_status / has_conflicts / merge_error to confirm there's no
real blocker, then check the pipeline. If the pipeline is still running, wait and retry later —
do not reach for the raw API to get past it. The raw API's merge is an immediate merge; using it
to escape a 405 caused by an in-flight pipeline doesn't work around a CLI bug, it bypasses the CI
gate entirely, which is exactly the goalpost-moving this file forbids everywhere else. The raw-API
fallback is only appropriate once the pipeline has actually succeeded and the CLI is the only thing
still objecting. A cycle that can't arm auto-merge because CI is mid-flight should just record that
and let a later cycle arm it — an unmerged-but-green PR is a normal intermediate state, not a
failure needing a workaround.
When an already-stacked branch's parent gets amended (a human requested changes on an earlier
level and it was updated), rebase the current level onto the new parent tip using
~/.claude/skills/goal/scripts/stack-rebase.sh <parent-branch>:
- Exit 0 (clean) — the loop just continues, no pause. Most review feedback is small, non-conflicting edits; a mechanical rebase applying cleanly needs no judgment call.
- Exit 1 (real conflict) — the script has already aborted the rebase and restored the working tree; pause and flag blocked-on-human, the same pattern used elsewhere for anything a human needs to resolve. Never attempt automated conflict resolution — deciding how to merge conflicting code is exactly the kind of judgment call this design keeps out of unattended cycles.
- Exit 2 (couldn't attempt it) — a setup problem (dirty working tree, detached HEAD, bad ref), not a conflict; read the script's stderr and fix the actual cause rather than treating it as a conflict.
Tooling: plain git branches by default — no new dependency, works in any project. If a project
already has a real stacking tool configured (e.g. a .graphite config alongside gt actually being
used in that project's history, not just gt existing somewhere on PATH), prefer that tool's
commands for creating and restacking branches instead of raw git.
The anti-slop/drift gate is a real hook, not a reminder
Research on long-running autonomous coding loops (SlopCodeBench, arXiv:2603.24755) found that an
upfront "write clean code" instruction improves the starting point but does not slow the rate of
quality degradation per cycle — prompted discipline doesn't hold up over many cycles. So this isn't
handled by an instruction in this file; it's a real Claude Code Stop hook, backed by
~/.claude/skills/goal/hooks/anti-slop-check.sh and run by the coordinator below.
How the hooks are wired
One Stop handler is registered in ~/.claude/settings.json: hooks/goal-stop.sh. It runs
the five checks sequentially, under one lock, and returns the first blocking decision.
This replaced four sibling Stop handlers, and the reason is worth keeping. Claude Code's hook
reference states that all matching hooks run in parallel. Four handlers each mutating
.claude/state/goal.md with uncoordinated sed -i and >> is a real lost-update race -- the
cost breaker's status flip, the integrity hook's heartbeat marker, and two hooks' note appends
could interleave or tear the file. Every suite in hooks/tests/ passed while that was true,
because none of them ran the four-hook configuration the README told people to install. An
external review found it; hooks/tests/test-coordinator.sh now tests the configuration users
actually install.
The coordinator also exports GOAL_HOOKS_DISABLED=1 to everything it spawns. That is what
stops the anti-slop hook's nested claude -p from firing this whole sequence again against the
live parent goal. The old guard (GOAL_ANTISLOP_CHECK_RUNNING) only protected the anti-slop
hook from itself; the other three hooks had no guard and did run inside the nested reviewer,
mutating the parent's state mid-review.
Order, cheapest and most decisive first: cost breaker, cycle integrity, stuck check, summary gate, anti-slop. The anti-slop review is the only check that spends tokens, so it runs last and is skipped entirely when something earlier already decided the stop.
Platform. These hooks are bash and target Linux and macOS. State writes go through
hooks/lib/goal-state.sh, which writes to a temp file and mvs it into place (atomic on POSIX)
and passes values through awk variables rather than interpolating them into a sed script. The
first public version used GNU-only sed -i and tac directly, which made it silently
Linux-only; CI now runs the suites on macOS too. Native Windows is not supported.
What it actually does, every cycle, outside model judgment: no-ops instantly if there's no active
goal in the current project. Otherwise it diffs the working tree against last_slop_check_sha
(falling back to started_sha on the first check) — incremental, not cumulative, so cycle 10 of a
long goal only reviews what's new since cycle 9's check, not the whole goal's history again. Tracked
changes come from git diff; brand-new untracked files (which git diff alone can't see) are
listed separately and their full content is appended each time — untracked files aren't diffed
incrementally, so one that stays untracked costs the same to review every single cycle it exists.
That's a known, accepted cost, not a bug: keep this in mind before leaving a large file untracked
for many cycles.
The combined content is capped at ~150KB before it's sent, truncated with a note if it's larger (a
truncation is logged to ## Notes, not silent). If there's anything to check, the checkpoint
(last_slop_check_sha) advances immediately, before the check itself even runs — regardless of
whether that check passes, blocks, or fails outright, so the loop's understanding of "what's already
been reviewed" always matches "what's already happened," at the cost of a failed check's content not
being guaranteed a second look unless it's touched again later.
The check itself is an independent claude -p call instructed to flag AI-slop patterns (redundant
comments, unnecessary defensive checks, gratuitous casts, over-abstraction, placeholder stubs,
redundant error-wrapping, hand-rolled stdlib reimplementations) and conflicts with docs/adr/ or
CONTEXT.md if the project has them. A real finding returns {"decision": "block", "reason": "..."},
which stops this cycle from ending and feeds the reason back — so if a cycle appears to be wrapping
up and instead gets handed a list of specific slop/drift findings to fix, that's this gate, not an
error. Address what it names, then let the cycle end normally; don't ignore the reason and just try
to stop again.
This runs alongside, not instead of, the independent-verification pass above: the gate is
diff-scoped and fires every cycle (cheap, catches things early); verification is
deliverable-scoped and fires once before completion (thorough, catches things the gate's
narrower diff-check can't, including whole-repo ponytail-audit/ponytail-debt findings). Neither
replaces the other.
The gate is a silent no-op only where there's nothing to check at all — no active goal, no git repo,
no started_sha recorded, or an empty diff. Anywhere it has something to check but can't finish the
job — claude/jq missing, the claude -p call itself erroring or timing out, an unparseable
verdict — it fails open (the cycle is never wedged) but logs why to ## Notes, so a gap in coverage
is something you can see, not something that silently never happened.
Differences from omp's Goal mode worth saying out loud
- omp's continuation steer resubmits immediately after the turn ends, hidden from the transcript.
ScheduleWakeupclamps to a minimum 60-second delay — this is a paced loop, not an instantaneous one. - omp tracks real token usage against the budget; this skill counts cycles.
- Persistence is narrower than omp's: this only runs while the Claude Code session stays open (see the callout near the top) — omp's harness may have different guarantees there.
Honesty
Lead every status report and completion claim with what's actually verified this cycle, not what should be true by now. Name the command, its output, the file. A deliverable ticked from an earlier cycle's memory and not re-checked is not done — say so and re-check before claiming it. A completion claim with no independent verification behind it is not done either — say so, run the verification pass, and only then report it as complete.
"Independent," for the anti-slop hook, always means context-independent only — no shared conversation history, no memory bias from having just done the work, but the same underlying Claude model family as the main loop, so a systematic blind spot or bias this model has can evade both the loop's own work and the hook meant to catch it, the same way. Don't imply a stronger guarantee than that for the hook.
Completion verification is different only when a second CLI was actually found and used (see Verification before completion, step 1) — that case is genuinely model-independent, not just context-independent. When no second CLI is available, verification falls back to the same context-independent-only guarantee as the anti-slop hook, and the evidence log says so explicitly. Never claim model-independent verification without checking which case actually happened this run.
Known limitations — the honest scorecard
Last audited 2026-08-26, after an external review of the first public commit. This section exists so a future cycle (or a human deciding whether to trust a run) reads the actual confidence level instead of rediscovering it. Update it when evidence changes it; don't let it rot into flattery.
External review, 2026-08-26. The first public commit was reviewed by an independent reviewer who read the source and ran the suites. It found five material defects that every green suite in this repo had missed, and all five are now fixed:
- Four Stop hooks ran in parallel and raced on
goal.md. Uncoordinatedsed -iand>>from four handlers, no lock. Fixed byhooks/goal-stop.sh, a single sequential coordinator holding one lock. See "How the hooks are wired". - The nested
claude -previewer fired the other three hooks against the parent goal. The guard was per-hook and only covered anti-slop. Fixed withGOAL_HOOKS_DISABLED, exported by the coordinator to every child. - The token breaker measured the session, not the goal. No baseline, so a goal started
mid-session was charged for everything spent before it existed and could trip on cycle
one. Fixed with
tokens_baseline:. The mutation test for this is worth running once (test-cost-breaker.sh --break A) — it reproduces the original bug exactly. goal-cycle-integrity.shused process substitution, which needs/dev/fd. Where that is unavailable the loop body never ran and the check silently PASSED, permitting the invalid evidence it exists to catch. The suite was green on the reviewer's machine for 13 of 14 cases and this was the fourteenth. Fixed with a here-doc, plus an explicit problem report when the read itself fails.- Auto-merge fired before verification. Corrected ordering is now written into the
Shipping section, and it is the change most relevant to anyone running
ship: auto.
The reviewer also under-called one: sed -i "s/..." is GNU-only, so the whole hook set was
silently Linux-only despite a README claiming macOS. Fixed in hooks/lib/goal-state.sh;
CI now runs on macOS.
The lesson this repeats, at the repo's own expense: every one of those five lived under a suite that was green, and three of them lived in code this file described as tested. A suite proves the cases it enumerates and nothing else. The four-hook race in particular was invisible because no test ever ran the configuration the README told users to install — test the thing you ship, not the thing you find convenient to harness.
The structural law this skill has observed on itself: reliability tracks enforcement, not wording. The 50-cycle summary rule was dropped at two consecutive real boundaries while being tested for exactly that — with the rule freshly amended and restated in the state file. Every mechanical part (hooks, scripts, git plumbing) held every time. Any rule in this file that is prose rather than a hook carries the same decay risk as the one that demonstrably failed: the heartbeat write, the stuck-loop check, the one-deliverable-per-cycle rule, and the evidence-log discipline are all currently prompted, none enforced.
Per-mechanism confidence, from strongest to weakest evidence:
| Mechanism | Evidence level | |
Stacked-branch shipping, secret-scan gate, stack-rebase.sh (all 3 exits) | Proven end-to-end on real PRs / real crafted conflicts | |
| Cross-model verification incl. sandbox probe + traced-disagreement path | Proven end-to-end (one real disagreement, root-caused, honestly deferred) | |
| Anti-slop Stop hook | Efficacy proven 2026-08-24. After ~15 cycles of never blocking, it fired on a real extraction diff and produced 5 findings, all 5 true positives, zero false: ten dead imports the extraction orphaned (invisible to tsc, which has no noUnusedLocals here — precisely the gap a separate gate fills), a dead duplicated function, speculative generality in a two-test file, and — the two worth dwelling on — two comments overclaiming benefits that did not exist ("what lets a test observe the teardown paths" with no such test; a "see this file" pointer to a test that was not there). Catching prose overclaim, not just code smell, is the capability this gate turns out to have. Prompt-injection residual still documented and unmitigated. But its availability was far worse than its efficacy: on the 2026-08-24 behavioural-coverage run it FAILED OPEN on 8 consecutive cycles — claude -p narrated before its JSON ("Heartbeat written… Review result: {…}") and the jq -e . parse rejected the whole reply. Fixed 2026-08-24 — but the first fix was one bug short, and that is the more useful half of the story. Retrying "the span from the first { to the last }" still fails the moment prose contains a brace before the JSON ("the {} placeholder"); I saw that case fail open in my own test table and waved it through as acceptably conservative. It isn't. Now a bounded (≤20) walk of candidate { starts, taking the first span that parses as an object, with candidate 1 byte-identical to the old behaviour so valid input is unchanged. Generalize this: a fix validated only against the failure that motivated it inherits the next variant of that failure — the prose-brace case was invisible until a test enumerated wrapper shapes instead of replaying the one observed reply. Both hooks now have real harnesses (hooks/tests/, 14 cases each) that run the hook end-to-end and are proven load-bearing by deliberate break modes. Two things worth carrying: (a) a gate that logs its own fail-open honestly still leaves you unguarded — count the notes, don't just trust the mechanism exists; (b) jq -e exits 0 on EMPTY input (measured, jq-1.6), so the ubiquitous ` | jq -e .` validity idiom silently accepts an empty string. The fix's own extraction could produce one, which would have made the gate pass silently rather than fail open — caught only by testing the fix against no-JSON and truncated-JSON replies, never by reading it |
ponytail-audit/ponytail-debt completion gate | Proven. Produced its first real blocking finding on the 2026-08-23 wireIpc run (stale blank lines), held completion until fixed, then confirmed clean on re-verify — and correctly separated goal-attributable from pre-existing findings so unrelated cleanup wasn't swept in. Two sharper lessons from 2026-08-24. (a) It misses siblings: a round cleared "dead default X in helper H", and the next round found four more dead defaults in the same two helpers. When a finding names a dead default, sweep every default in that helper, not the one named. (b) The audit measures "dead" against the CLEAN tree only, which is the wrong tree. Three of those four were load-bearing under mutation: deleting them kept the sender-guard mutations failing 15/1, but degraded three of seven kills from a sender_rejected assertion to a TypeError: handles.gateway.request is not a function. Detection survives; the diagnostic signal does not, and the error then points at a broken stub rather than the removed guard. So a ponytail finding is a hypothesis to test under mutation, not an instruction — refute it with measurement where it's wrong, and record the refusal as a ponytail: marker with a real upgrade trigger so the next audit inherits the reasoning instead of re-raising it cold | |
| AI-review auto-merge gate — the reviewer | Validated 2026-08-24 by deliberate bug injection, 2/2 caught with correct severity. Bug A (transport?.stop() → transport.stop()) → CRITICAL / Not ready, and the reviewer traced the reachable path (a profile passing loose IPC validation but throwing in buildSshArgv, so transport is still null in the catch) rather than just citing the compiler. Bug B (randomUUID() hoisted out of a handler, making a per-call ID a per-process constant) → Important / Ready with fixes, correctly explaining why both the suite and tsc miss it. Both bugs passed npm test; only A was caught by tsc. | |
| AI review vs. cross-model verification — not redundant | Demonstrated 2026-08-24, and it cost a merge. On MR !127 the code-reviewer gate re-reviewed and returned Ready to merge, "no new issues found" — it had independently reproduced mutations, checked every binding rewrite, even fact-checked a self-reported correction. Auto-merge fired. The cross-model verification pass then found three real overclaims the reviewer missed, including a genuine false positive: a test named "every handler rejects a foreign sender" asserted only ok === false, so deleting one handler's sender guard still left the suite 16/0 green (reproduced independently). Two conclusions worth keeping: (a) never treat a clean review as making verification a formality — they catch different classes, and the review is the one with merge authority, so its blind spots ship; (b) an assertion on a generic failure flag rather than the specific error code is a false-positive generator — the handler can fail for an unrelated reason and the test still passes. Prefer asserting the exact code. | |
| AI-review auto-merge gate — the rule | Was broken until 2026-08-24, found by that same test. The bar contradicted itself: one clause auto-merged on Ready with fixes + 0 CRITICAL, the next blocked on any HIGH. Bug B's verdict (Ready with fixes, 0 CRITICAL, 1 Important) satisfied one and violated the other — so a correctly-caught real bug would have auto-merged under the first reading. Now: Ready to merge + zero CRITICAL + zero HIGH, nothing less. Lesson worth generalizing: test a gate against the output a successful catch produces, not just against clean input. The corrected rule then fired for real on MR !133 the same day and withheld a merge on a MEDIUM-only finding — the first time it has actually blocked rather than waved something through. Under the old wording that MR would have auto-merged carrying a false claim in a comment. A rule proven by injection and then by a live block is the strongest evidence any mechanism in this table has | |
| Budget-limit, stuck-loop, boundary summary gate | Real mechanisms, but reached via staged state; summary gate has never fired in a live boundary stop. All three now have committed, re-runnable suites with mutation modes (test-summary-gate.sh, test-stuck-check.sh, test-cost-breaker.sh) — the summary gate's eight branches were previously described here as "pipe-tested for real before wiring" while no test was actually in the repo for anyone to re-run | |
Stop coordinator (goal-stop.sh) | Added 2026-08-26 in response to the external review. 14 cases green, both mutations (short-circuit removed, nested guard removed) confirmed red. Tests ordering, short-circuit, lock acquire/release, stale-lock breaking, held-lock fail-open, and that every child receives GOAL_HOOKS_DISABLED. Never fired in a live long run — it is the newest and least field-proven mechanism in this table, and it now sits in front of every other gate, so a defect here disables all of them at once. That concentration of risk is the deliberate trade for removing the race; it is not free | |
Stuck-loop hook (goal-stuck-check.sh) | Added 2026-08-26. 10 cases green, both mutations red. Catches only byte-identical repetition — a loop that varies its wording while making no progress walks straight past it. It is a floor under the prompted rule, not a replacement for it | |
| Cycle-integrity hook (heartbeat + evidence-log matching) | Added 2026-08-24. Fired live within the hour and was wrong — its heartbeat rule demanded "heartbeat newer than goal.md", but the skill mandates heartbeat-first / goal.md-last, so a correct cycle always trips it. It would have false-positived forever. Fixed to compare the heartbeat's value against a last_seen_heartbeat: marker the hook itself records, which detects a genuinely skipped write; re-tested including that regression case. The evidence-log check was unaffected. Lesson bigger than the bug: the original 7 pipe-tests passed because one of them asserted the backwards expectation as correct — a test that encodes the same misunderstanding as the code confirms nothing. Pipe-testing proves a script runs, not that its rule is right. It then false-positived on turns that resumed from a task notification rather than starting a cycle (step 1 never re-ran) — 4× on 2026-08-24. Fixed the same day, and the signal turned out to exist where the obvious place said it didn't: the Stop hook's own stdin has no field for it, but transcript_path does one level down — the turn-initiating record carries origin: {kind: "task-notification"}, present on all 241 such records across 305 local transcripts, while ScheduleWakeup cycles carry no origin at all. It is a positive test for the resume case, so every other answer means "not a resume" — the safe direction. Proven by replaying the six real stop points where the hook fired that day: 4 false positives silent, both legitimate blocks preserved. Where the origin can't be read it still blocks, but says outright it cannot tell a skipped write from a resume rather than asserting the wrong one — wrong-and-confident being the failure actually removed | |
| Token cost breaker | Added 2026-08-24. Corrects a standing false assumption in this file: Claude Code does not expose usage to the model, but it writes real per-turn usage into the session transcript JSONL, which a hook can read — so cost is now measured, not proxied by cycle count. Opt-in via token_budget: in goal.md; absent = unbounded, as before. Counts output + cache-creation + fresh input, excludes cache reads (which would trip on context size rather than work done). 5 branches pipe-tested against a synthetic transcript; not yet fired on a real budget | |
| A genuine long unattended run (50+ organic cycles, compactions, hours) | Still never happened, and this is the single biggest gap in the table. The 2026-08-23 wireIpc run was 7 organic cycles over ~1 hour with no compaction — real end-to-end, but an order of magnitude short of the regime this skill is built for |
The overclaim tally, because the shape is stable and worth recognising on sight. The 2026-08-23→24 console run produced eight test-name/comment overclaims, every one written by the loop, every one found by mutation or by reading the source and never by re-reading the prose. They come in four shapes: a generic failure flag (ok === false) standing in for the specific error code the name implies; a count standing in for an identity or effect assertion; a subset asserted under a name claiming the whole; and — the eighth, the most embarrassing — a comment asserting a mechanism the source does not have ("handleOpenGuacamole reads .ok off it", when the handler returns the value verbatim and the test's own assertion is what dereferences it). The last one is the general case: prose that explains why is an unverified claim about code, and it should quote a measurement rather than describe a mechanism. But a measurement in a comment is itself a defect source, and this run proved it the hard way: defects nine and ten were both introduced by the rewrite that fixed the previous one, in the same three-line comment, across three review rounds. Ten was the sharpest — "three of the seven kills degrade" when the isolated cause degrades two; the original measurement had deleted three stubs at once and the count was then attributed to a subset of them. Attributing a combined measurement to an isolated cause is the failure mode to watch for, and the cheap guard is to re-run the mutation the comment itself describes, in isolation, before writing the number. The structural lesson is stronger than the fix: a number in a comment has to be re-measured every time the code moves, so prefer stating the invariant and citing the MR that measured it over restating figures that silently drift. Two structural findings from the same run: a first verifier cleared an overclaim that a second one then caught, so one clean adversarial pass is not proof; and the cheapest guard found so far is a behaviour-preserving control mutation — every battery until then only tested that broken code fails, and nothing tested that correct code still passes, which is the only way to catch a suite over-fitted to its own mutations.
A verification lesson worth carrying, from the 2026-08-23 run: a deliverable's named command can pass while proving almost nothing. That run's suite was green at every step, and a verifier's mutation test — emptying wireIpc() to register zero channels — still produced 55 pass / 0 fail, because nothing in the suite imports that file. The command was satisfied honestly and was near-worthless as behavior evidence. Two implications: (1) when a deliverable is "refactor X without breaking it," prefer a command that would actually fail if X broke, and if none exists, say so in the deliverable rather than letting a green suite imply coverage it doesn't have; (2) instruct verifiers to confirm-or-refute a stated ceiling rather than accept it — that mutation test was the verifier's own idea and it both proved and corrected the claim it was handed.
Known unbuilt items, deliberately listed rather than silently absent: a second verification vendor
(gemini) actually installed — codex is the only cross-model reviewer available, and it structurally
cannot run ponytail-audit/ponytail-debt (they are Skill-tool skills, not shell binaries), so that
gate is single-model by construction; behavioral test coverage for the one repo this has run
against, which has none; and a live firing of the three newest hooks, all of which are pipe-tested
logic rather than field-proven. The cost breaker and the heartbeat/evidence-log enforcement were on
this list until 2026-08-24 and are now built (see the table above).
And one self-referential risk: this file is ~600 lines of instructions, and its own thesis says
long prompted rule-sets decay — every added rule buys its value at a small compliance cost to all
the others. Prefer converting a rule to a hook over adding a new rule beside it.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

