agentleFS
aw-praw-pr/autometta-public/skills/autometta-requeue/SKILL.md

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.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run the mechanical script.

    line 43
  2. Distinctive:

    If the card was re-briefed, append the re-brief under the existing card (keep the canonical template headings intact) and reference the …

    line 77
  3. Very specific:

    Do not hand-edit state/state.yaml or state/budget.json for this.

    line 80
  4. Very specific:

    If nothing needs re-queuing and repos are merely halted (e.g.

    line 85

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Autometta stage re-queue

A tick trusts per-stage state on disk. Re-queuing by hand goes wrong in two specific ways:

  1. Stale worker envelope. state/envelopes/<stage>.json (or, for a subscriber still vendoring a pre-card-104 worker prompt, the legacy state/handoffs/<stage>.json) from the previous round still says status=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 in verifier_failed, terminal until a human intervenes. The envelope must be purged along with the verifier artefact, both per-stage logs, and any state/active-agents/ registration.
  2. 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 and autometta/<stage> branch standing for inspection. git worktree add refuses 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 dirtying repo_root itself, which the tick's dirty-tree halt refused to dispatch over; that no longer applies since dispatch never touches repo_root.)

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.yaml or state/budget.json for this. The script is the sanctioned path and preserves fields it does not manage.

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-halt

This 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.