autometta-requeue
Skill0 starsChanged 6 months agoMITView on GitHub
Safely re-queue an Autometta stage for a fresh worker dispatch after a verifier FAIL, a killed/dead agent, a card re-brief, or a stale run worktree/branch left standing by a prior attempt. Use whenever a stage must run again and the previous attempt left anything behind: a run worktree/branch, envelopes under state/envelopes/ (or the legacy state/handoffs/) or state/verifiers/, a live agent, or a sticky halt in state/budget.json. Symptoms this fixes: "worker envelope status=pass, proceeding to verifier dispatch" immediately after a re-queue (verifier sent at unfixed code), and `git worktree add` refusing because a run worktree/branch from a prior attempt is still standing.
In this repository11 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- agent-orchestratorSkill
- autometta-card-reviewSkill
- autometta-escalationsSkill
- autometta-learning-logSkill
- autometta-oracleSkill
- autometta-run-designSkill
- autometta-setupSkill
- autometta-weekly-reviewSkill
- phat-controllerSkill
- yoloSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 52
If the failure, death or halt behind this requeue was the harness's doing, or the verifier artefact carries a HARNESS: line, record it with …
- Distinctive: line 59
Run the mechanical script.
- Distinctive: line 93
If the card was re-briefed, append the re-brief under the existing card (keep the canonical template headings intact) and reference the …
- Very specific: line 96
Do not hand-edit state/state.yaml or state/budget.json for this.
- Distinctive: line 105
Count what passed: If every criterion passed except a narrow defect (one behaviour, one surface), and the fix has a small blast radius (a …
- Very specific: line 139
If nothing needs re-queuing and repos are merely halted (e.g.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Autometta stage re-queue
A tick trusts per-stage state on disk. Re-queuing by hand goes wrong in two specific ways:
- Stale worker envelope.
state/envelopes/<stage>.json(or, for a subscriber still vendoring a pre-card-104 worker prompt, the legacystate/handoffs/<stage>.json) from the previous round still saysstatus=pass, so the next tick skips dispatching a worker and sends the verifier straight at the old code. The verifier fails again and the stage lands inverifier_failed, terminal until a human intervenes. The envelope must be purged along with the verifier artefact, both per-stage logs, and anystate/active-agents/registration. - A run worktree/branch left standing. Under worktree-per-run dispatch
(backported 2026-08-14; see
memory/adopters/emergence-viewer/ feedback-worktree-dispatch-thinned-preflight.md), a FAILed or stalled stage leaves its../<repo>-run-<stage>worktree andautometta/<stage>branch standing for inspection.git worktree addrefuses to cut a fresh one over it, so it must be removed (the WIP inside is discarded, it was already FAILed or stalled) before re-dispatch. (Before that backport, trap 2 was uncommitted worker WIP dirtyingrepo_rootitself, which the tick's dirty-tree halt refused to dispatch over; that no longer applies since dispatch never touchesrepo_root.)
Recovery allowance and evidence
The standard orchestration policy allows three total worker attempts per stage,
including the initial one; a recorded operator limit wins. Follow
autometta-escalations to diagnose and record the actual attempt number before
requeue. This script resets per-attempt counters, not the recovery allowance.
Archive the failed envelope, verifier artefact and logs under a numbered
state/uat/<stage>/attempt-<n>/ directory first, and preserve useful work with
the existing preserve verb. Use --keep-budget for standing-policy retries,
so halt/failure/spend gates are not cleared. Never blindly retry worker FAIL.
If the failure, death or halt behind this requeue was the harness's doing,
or the verifier artefact carries a HARNESS: line, record it with
autometta-learning-log after archiving and before running the script: the
purge removes the live artefact the proposal should cite.
Procedure
Run the mechanical script; it enforces both rules:
autometta/scripts/requeue-stage.sh <repo-root> <stage-id>It removes any run worktree/branch left by a prior attempt at this stage,
kills any live agent registered against it, purges every per-stage
artefact the tick could misread as progress, resets the stage record to
pending (zero attempts, null pids/timestamps/token counters), clears
current_stage if it pointed at the stage, and clears the repo's halt.
The next tick then cuts a fresh worktree and dispatches a fresh worker.
It refuses (exit 5, naming the files) when the worktree holds unpreserved
ignored work. If no wip_commit is recorded for the attempt and the run
worktree has an ignored file (a deliverable outside .gitignore's reach,
per card 110) with an mtime after the stage's started_at, the script stops
before touching anything and lists the paths, because removing the worktree would
discard that attempt's work for good. Preserve it first (tick.sh's
preserve_failed_work, or phat-controller.sh preserve <repo> <stage-id>)
and re-run the plain command, or pass --discard to proceed and drop the
files on purpose:
autometta/scripts/requeue-stage.sh --discard <repo-root> <stage-id>The check is skipped when started_at is missing or unparsable (nothing to
call "newer" than) and when a wip_commit is already recorded, because a preserved
attempt's ignored files are expected to still be sitting in the worktree and
are not a reason to refuse.
After running it:
- If the card was re-briefed, append the re-brief under the existing card (keep the canonical template headings intact) and reference the committed WIP SHA.
- Do not hand-edit
state/state.yamlorstate/budget.jsonfor this. The script is the sanctioned path and preserves fields it does not manage. The one exception is a repair's pairing, below.
Before re-queuing a verifier FAIL: repair, do not rerun
A FAIL does not mean the next attempt repeats the whole card. Triage first, from the verifier JSON:
- Count what passed. If every criterion passed except a narrow defect (one behaviour, one surface), and the fix has a small blast radius (a handful of files, no layout, engine or schema change), the next attempt is a repair. Otherwise it is a normal re-brief.
- Repair re-brief. Restore the preserved
wip_commitdeliverables, name the defect with the verifier's reproduction steps, and scope the fix to the files it needs. The worker reproduces the defect before and after the fix, runs the cheap criteria (types, lint, unit, build, contract) once, and runs only the regression specs near the changed path. Do not recapture visual evidence the previous verifier passed. - Downgrade the pairing. The repair worker is a mid tier at medium
effort (Sonnet 5.5, or GPT-6.1 Sol), never the frontier tier the card
needed for the build. The verifier is a mid tier at medium effort,
scoped to the defect plus the cheap criteria: earlier PASS verdicts
stand unless the diff against the
wip_commitleaves the named files, in which case the full criterion runs. A same-family pairing is acceptable for a repair when the previous cross-family verifier already passed the judgement-heavy criteria; say so in the Pairing rationale. - Change the stage record's pairing too. The tick dispatches the
workerandverifierrecorded instate/state.yaml, not the card's Metadata. Understate/.tick.lock, set both withyqbefore runningrequeue-stage.sh(the one sanctioned hand edit of that file). - Apply the recorded recovery policy. Shared-code repair within the agreed outcome is allowed while attempts and headroom remain, with verification widened to its blast radius. Ask for changed requirements, weaker acceptance, extra spend/attempts or provider changes. A previous cost overrun changes the estimate, never replenishes the allowance or lifts a gate.
Card 28 (promo-flow, 2026-10-21) is the precedent: attempt 1 cost about 60M (Fable 45M, Astra 15M) and failed only a same-route cmd-K navigation case; the repair was Sonnet plus Opus at medium, about 10M.
Related unhalt-only case
If nothing needs re-queuing and repos are merely halted (e.g. a stale halt
from a prior run window that budget_ensure_window hasn't yet cleared),
clear all subscribers at once with:
autometta/scripts/tick.sh --reset-haltThis is safe: a tick re-halts any repo whose halt condition genuinely still
exists. Before a scheduled window, ai-schedules/bin/preflight_autometta.sh (an
external scheduling repo, not shipped with Autometta) reports halted subscribers, stale run worktrees/branches, and
stale-envelope hazards so these are caught before the window opens rather
than 20 minutes into 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.

