agentleFS
rct-labsrct-labs/gated-flow/skills/run-queue/SKILL.md

run-queue

Skill0 starsChanged 13 days agoMITView on GitHub

$run: the launch protocol for a task queue that is already written and admitted. Admission-checked tasks, one worker process per task, a machine-checked verdict after each, risk-based review and stage/impact acceptance per batch, progress reported as it happens, and a stop at the first thing that needs a human. Normally loaded by $flow-run at its launch step. Use directly only when the user types $run or /run-queue, or asks to run the existing queue as it stands. Not for a single task, and not for deciding what to do next: that is $flow-run.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. VadneyK/cloud-coder★ 0same name

    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.

  • In this repository3 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 6 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Use the delivery scope and risk choice made by flow-run: ordinary small tools need acceptance, not an automatically enabled model review.

    line 27
  2. Very specific:

    Stop and report if the pre-commit hook is not installed, the queue parses to zero tasks, or the head task is BLOCKED.

    line 47
  3. Distinctive:

    Use the task count already authorized or supplied by flow-run.

    line 58
  4. Distinctive:

    Do not repeatedly read full logs, diffs, config or skills.

    line 134
  5. Distinctive:

    If heartbeats stop for much longer than the interval, say so.

    line 152
  6. Distinctive:

    Never mark a task done, edit the queue status, or touch a verify command.

    line 168
  7. Distinctive:

    Never git commit --no-verify, and never suggest it.

    line 169
  8. Very specific:

    Never take over an IN_PROGRESS task.

    line 170
  9. Very specific:

    Never turn a review finding into a queue row.

    line 171
  10. Very specific:

    Never put flow resume / flow recall output, CONTEXT or host history into a worker prompt or queue row.

    line 172
  11. Very specific:

    After run_end the host (flow-run) saves state with flow checkpoint.

    line 174
  12. Very specific:

    Never restart a run just because it stopped, and never raise --max-tasks, max_model_calls or max_task_files to push past a stop.

    line 175
  13. Distinctive:

    After a failed repair, the host records named tasks and an expiry in the bounded grant.

    line 205
  14. Very specific:

    Follow flow-run and docs/autonomy.md.

    line 208

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

$run: unattended queue execution

You are the launcher and the narrator. The loop belongs to gate.py run: a deterministic script that spawns one CLI process per task, checks each commit with the pre-commit hook, reviews closed tasks when configured and runs selected stage checks when the queue has no TODO left, and decides when to stop.

Why the loop is not you: an agent that supervises its own work can be talked out of stopping and can convince itself a task is done. The verdict comes from a command's exit code.

1. Find the runner and preflight

Use the delivery scope and risk choice made by flow-run: ordinary small tools need acceptance, not an automatically enabled model review. Honor explicit project requirements. When review is enabled, review once at the delivery boundary; repairs get targeted verification of original blockers and directly introduced regressions, never another general audit. Preserve the original findings and BUG ids in the repair acceptance. Stage checks are selected by delivery.stage and declared impact; queue exhaustion is not product delivery. A new run does not reset the host-managed delivery budget. Further in-goal repair reuses existing goal authorization and cumulative limits. A failed run returns control to the host; it does not automatically require user approval.

flow home prints the checkout; gate.py is <home>/gate/gate.py.

flow doctor --repo <project>
flow admit --plan --repo <project>

Reuse flow-run's preflight if queue, spec and configuration are unchanged; do not repeat it just because this skill was loaded. Show actionable results. Stop and report if the pre-commit hook is not installed, the queue parses to zero tasks, or the head task is BLOCKED. If the head task is REFUSE or UNDECLARED, say so before launching: advisory mode proceeds with a warning, strict_admit stops. Offer to add the missing scope line:

<!-- task:WP-7 files: src/foo.py, tests/test_foo.py -->

2. Confirm once

Use the task count already authorized or supplied by flow-run; otherwise the configured default. Do not ask again for decisions already settled.

3. Detach it from your session

An unattended task can outlive the interactive session. A foreground call, and a background tool shell alike, can die and orphan a worker mid-task. Launch through Task Scheduler, which owns the process:

pwsh -NoProfile -File "$(flow home)/gate/launch-detached.ps1" `
     -Repo <project> -MaxTasks <N> -TaskName gate-<slug>

That wraps supervise.ps1, which restarts the runner if it vanishes without a report and honours every stop the gate decides. Off Windows, fall back to nohup python <gate.py> run --repo <project> --max-tasks <N> and say the run may not survive this session.

Then watch the journal: append-only NDJSON at <repo>/.gate/journal.ndjson.

eventmeaning
run_startworkers resolved, budget set
probeon-demand probe before a worker/reviewer is used (usable, reason, seconds); unused fallbacks are not probed
admit_refusedtask outside the sweet spot; strict mode stops here
attempt_starta task went to a worker; log is the live transcript
heartbeatstill alive: elapsed seconds, lines, last output line
task_donethe runner verified it: commit sha and duration
worker_left_changesworker stopped with uncommitted work; retry says whether it gets another go
scope_driftthe task's commits touched undeclared paths; listed under Waiting on you, not a stop
scope_request / prompt_too_largeneeds the host; run stops
review_start / review_verdict / review_skippedthe one package review (or a checkpoint); a skip reason <member>:no_access means that reviewer could not read the repository: fix its tool or sandbox, then gate.py review --tasks <ids>
review_findingsdefect records with stable ids and due checkpoints; recorded in REVIEW-NOTES.md, never automatic rows
full_acceptance_waitanother project's full oracle is running on this machine; this one waits for its turn (holder), nothing is wrong
full_acceptancecomplete suite selected for delivery or broad/unknown impact: result, count, reason
stage_acceptanceselected local/module/integration checks or a due-defect stop; never proof of full delivery
needs_approvalhead task touches an irreversible path without approval
tool_disableda CLI hit its quota and was benched
task_end / run_endoutcome per task / stop reason

Watch incremental events, not repeated transcripts

Arm a cursor BEFORE launch; initialization skips history. Use one cursor per host, and never reinitialize during a run (that would discard unseen events):

python <flow-home>/gate/watch-journal.py <repo> --init

With a persistent Monitor, attach it to the same helper with --follow; output is flushed only for relevant events and it exits after run_end. Retire that monitor before starting a replacement. The existing watch-journal.sh remains a legacy line-number interface; do not stack both watchers or append buffering filters.

Without a Monitor, call --once: the byte cursor reads only new complete records and returns bounded event summaries. Follow next_poll_s (60 → 120 → 300 seconds while idle; reset on events), subject to the host's wait/response limits. For a host that cannot wait that long, --once --wait 55 waits internally for an event for at most 55 seconds; do useful independent work between checks. Keep the active turn open while the authorized run proceeds. Do not invent a persistent tool or rely on a tool-shell background loop surviving the session.

more: true means unread events remain: drain another bounded page immediately. idle is not success, failure or a reason to inspect the transcript. The cursor survives sessions; invalid or oversized records and journal resets emit warnings. New runners include their PID; the watcher emits run_interrupted once if that process exits without run_end, and follow mode exits. Treat it as missing completion evidence, not a failed test or success. Inspect the owner/exit status once, then resume only the unfinished stage using passed review evidence. For older runs without a PID, check owner liveness at a suspected stall before waiting again; do not spend the whole test timeout polling a dead runner. On a warning, inspect the affected journal segment before treating it as healthy. On run_end, read RUN-REPORT once, bottom-up. Review the worker's bounded final excerpt only for a failure/scope request, a user status question, or suspected stall (no journal activity for more than twice the configured heartbeat interval). Do not repeatedly read full logs, diffs, config or skills. Keep a separate offset if more worker diagnostics are needed. No acceptance/review rules are weakened.

Narrating

Report task completion, blockers, review/acceptance and meaningful changes. Combine adjacent start/end events where possible. No repeated “still running” messages or minor test-by-test updates; obey any higher-priority host update requirement with the shortest necessary status, without extra transcript reads merely to fill it.

WP-A -> claude, started
WP-A running 12m, last: "pytest tests/test_a.py -q"
WP-A DONE in 56m, commit 8ebf530
review of WP-A, WP-4: pass (fable), 2 findings recorded
full acceptance: PASS, 561 passed

If heartbeats stop for much longer than the interval, say so.

4. Report the outcome

From .gate/RUN-REPORT.md: lead with Waiting on you (empty on a clean run), then how many tasks closed and why it stopped, then Review and Full acceptance, then the task table and anything left uncommitted. If a task did not close, quote the last lines of its log from .gate/runs/<run-id>/.

The report also records Efficiency. flow metrics --last 5 --repo <project> compares runs without model calls or tests. Legacy missing measures are unknown; worker time includes its checks. Read metrics when assessing workflow cost, not on every poll. Do not run flow usage at startup: the runner probes on demand.

Never

  • Never mark a task done, edit the queue status, or touch a verify command.
  • Never git commit --no-verify, and never suggest it. The block is the product.
  • Never take over an IN_PROGRESS task. Never push, merge or open a PR.
  • Never turn a review finding into a queue row. REVIEW-NOTES.md is a record.
  • Never put flow resume / flow recall output, CONTEXT or host history into a worker prompt or queue row; workers get the bounded task packet only. After run_end the host (flow-run) saves state with flow checkpoint.
  • Never restart a run just because it stopped, and never raise --max-tasks, max_model_calls or max_task_files to push past a stop.

Reading a stop reason

stopmeaningwhat to do
queue_emptynothing eligible leftnothing
budget / budget:model_calls / run_timeouta configured limitstart another run if the user wants more
blocked:<id>head task needs decisionsanswer them, set it TODO
in_progress:<id>someone holds it, or a runner diedcheck git status before restarting
admit_refused:<id>outside the sweet spot (strict)split or declare scope
no_progress:<id> / not_done:<id>the system refused work it could not verifyread the log
worker_left_changes:<id>two attempts left the tree dirty without closingread the log, finish or reset by hand
scope_request:<id>the worker asked for a scope decisionwiden the declared files or split
prompt_too_large:<id>packet over worker_packet_max_bytesshorten the spec acceptance or split
timeout:<id>worker exceeded task_timeout_scheck for a half-finished tree
no_workersevery CLI is benchedwait for the cooldown (.gate/tool-status.json)
review_failed:<ids>safety/current-stage defects or ambiguous acceptanceconsolidate evidenced blockers, preserve BUG ids and tag repairs origin: review; targeted verification only
review_loop:<location-or-task>recorded repair blockers show no progressstop repeating the approach; diagnose once and require a different evidenced fix within the authorized goal and cumulative limits
stage_acceptance_failed:<ids>a selected stage check failed or due defects remain openread the named logs/defect records, fix within the affected scope
full_acceptance_failed:<ids>the full oracle failsread .gate/runs/<run-id>/full-acceptance.log; repair the cause with a regression test, never blindly repeat it
needs_approval:<id>irreversible path without approved:the user approves that task, then relaunch

Stopping is good. The only unacceptable outcome is a green light that lies.

Repair continuation

Reuse the user's existing goal authorization for evidenced in-scope fixes. After a failed repair, the host records named tasks and an expiry in the bounded grant; this is not a request for repeated approval. Keep cumulative user limits, stop unchanged no-progress retries, and verify only the repair/direct regressions. Follow flow-run and docs/autonomy.md; optional findings do not create tasks.

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.