Skip to content

Scripts and entry points reference

An index of every script under lib/ and scripts/, grouped by directory, each row the first paragraph of that script’s own header comment. Generated by scripts/render-scripts-index.sh; edit a script’s own header comment to change its row here, never this file directly.

lib/ carries no index of its own beyond this one: its files are sourced, never executed, so there is no --help to read instead. scripts/doctor.sh and the repository’s own AGENTS.md are still the place to start for what to run and when; this page is for finding a script once you already know roughly what it should do.

Sourced into agent-cycle.sh’s and review-cycle.sh’s own process; never run directly.

Script Purpose
lib/approver-token.sh GitHub App installation-token minting for the Pullwright Approver (D18 WI-4, agent-ops#407; design: docs/reviews/2026-08-14-autonomy-investigation.md §5.3).
lib/approver.sh the Approver stage’s own decision primitives (D18 WI-5, agent-ops#408; design: docs/reviews/2026-08-14-autonomy-investigation.md §5.2/§5.3).
lib/author-token.sh GitHub App installation-token minting for the forge authoring App (D18 decision 1, agent-ops#607 Phase 2).
lib/background-wait-guard.sh the logic behind scripts/background-wait-guard.sh, the managed PreToolUse hook (deploy/docker/claude-managed-settings.json, requirement 4m) that makes the “never end a turn with a backgrounded wait pending” rule every stage prompt already states in prose mechanical rather than advisory (issue #2778). allowManagedHooksOnly (requirement 4k) is what makes this the only PreToolUse hook that can ever fire: a project’s own .claude/settings.json hooks key is loaded but inert once that policy bit is set, so a checkout under review cannot add, remove or shadow this one.
lib/candidate-gather.sh the repo-ordering/candidate-gathering loop and the skip-list (blocked/void) extracts built on top of it, moved out of agent-cycle.sh (#771) as the seam directly ahead of the requirement-4i fit machinery: gather_ordered_repos orders every configured repo by effective staleness (lib/repo-order.sh) and, for each, runs every pre-fetched source’s gather script, folding claims, first-seen state and per-repo entries into ordered_repos_json/source_states_json/ claimed_json/unvoid_requests_json/hand_flagged_refinements_json/ degraded_issues_excluded_json (the repo slugs whose own issues gather degraded this cycle, which requirement 35f’s own open-Blocked-by:-reference exclusion in lib/eligibility.sh reads alongside latest_issues_excluded_json below). compute_skip_lists reconciles the two label-driven human overrides (unvoid and hand-flagged needs_refinement) against that cycle’s own claim, then derives blocked_json/void_json, the skip-lists everything downstream (eligibility, the Enabler’s threshold, the Co-Ordinator’s input) reads.
lib/candidate-select.sh the claim loop and candidate selection: gathering each source’s candidates per repository, excluding what a peer already claimed or what is blocked/void, the refinement-traceability check and repair (#768), and the accounting the Co-Ordinator’s verdict is checked against (requirement 3t/3x).
lib/chain.sh finish-then-continue (requirement 67): whether a cycle that just won a claim should chain another selection cycle immediately, instead of waiting for the next cron firing.
lib/changelog-grammar.sh shared parser for the ## Changelog section grammar (requirement 25c, roadmap decision D27, agent-ops#1807). Walks a pull-request description — or a squashed commit body, the same shape — once, and emits one tab-separated record per event on stdout, so scripts/check-changelog-section.sh (validates a description) and scripts/assemble-changelog.sh (extracts bullets from merged commit bodies) read the same grammar off the same state machine instead of each re-implementing the fence/HTML-comment/heading walk and the None/category/bullet classification underneath it.
lib/changelog-section-gate.sh pipeline-side enforcement of requirement 25c for every target repository, not only the one that carries a workflow file, on lib/closing-keyword-gate.sh’s own pattern (agent-ops#1808).
lib/ci-trigger.sh detects and repairs a push whose CI trigger GitHub never delivered (issue #2560): a head commit left with zero check runs at all — not failing, simply absent — which looks indistinguishable from “CI still queued” to a casual reader, but can conceal a head that actually fails (agent-ops#2506: ~7 hours with no check runs at all, the head genuinely failing scripts/spec.sh check). The same branch had already needed one manual nudge (6c379e10a9, “chore(ci): nudge a missed synchronize event for the previous push”), so this is recurring, not a one-off.
lib/claim-key.sh the one place a claim-registry path component is sanitised.
lib/claim.sh atomic per-item claims, the lock that lets several nodes run cycles at once without doing the same work twice.
lib/closing-keyword-gate.sh pipeline-side enforcement of requirement 25a for every target repository, not only the one that carries a workflow file (TD-PPagop-26080803).
lib/compose-drift.sh whether this node’s compose.yaml still matches the copy its image shipped.
lib/compose-reconcile.sh apply this node’s own merged compose.yaml, the way watchtower applies a merged image.
lib/config-access.sh the small, identical config-reading helpers both cycles build on: expand_home, and cfg/cfg_json over the caller’s own DEFAULTED_CONFIG.
lib/config-schema.sh validate config.json against config.schema.json.
lib/constraint.sh the constraint statement (docs/ROADMAP.md D21’s “state the constraint” bullet, issue #609): one sentence naming what is limiting this installation’s throughput right now, over what share of the window, and what to do about it.
lib/coordinator-brief.sh the Co-Ordinator’s repo/work-sources table, generated from config.json (issue #78, docs/spec/implementation/README.md requirement 4b).
lib/coordinator-input.sh fit the Co-Ordinator’s runtime input inside its model’s context window (docs/spec/implementation/requirements requirement 4i, agent-ops#641).
lib/coordinator-phase.sh issue #1958’s second continuation of #771’s split, after lib/gather-phase.sh. One function, run_coordinator_through_finishing_phase, covering everything from the Co-Ordinator stage itself (one invocation per repository, issue #587) through candidate selection and the claim, the workspace, the Implementer stage, the Reviewer stage, the Approver stage and the landing-arming step — the whole of what used to be the rest of agent-cycle.sh’s own top-level script body, ending on the script’s own final statement.
lib/crash-loop.sh detect a fleet-wide crash loop in the union log, and decide whether it has already been escalated (requirement 2.7).
lib/cycle-state.sh how a cycle reports that an item cannot proceed, and reads back which items a Co-Ordinator must skip and which the Enabler may re-examine.
lib/decision-veto.sh the decision-veto sweep (agent-ops#937): find a pw::decision decision-log issue a human reopened and act on it.
lib/dependabot-bump.sh the Dependabot-PR classification rule shared by scripts/gather-merge-conflicts.sh (which reports it on a merge-conflicts candidate), scripts/nudge-dependabot-rebase.sh (which acts on that same candidate the moment it reads it), and lib/void-guard.sh (which re-derives supersession live to corroborate a pr-<n>-superseded-… void): one definition, per requirement 34a, so none of the three can silently drift on what counts as “the same bump”, “already asked to rebase” (issue #250), or “still superseded”.
lib/dependency-gate.sh the structured Blocked-by: convention (docs/spec/implementation/requirements, requirement 34j).
lib/disk-space.sh free space on a directory’s filesystem, read and judged one way everywhere: scripts/doctor.sh’s advisory warning and agent-cycle.sh’s pre-clone stand-down gate (requirement 2.0c, agent-ops#756) share this rather than each doing its own df arithmetic, so the two can no longer silently disagree about what “low” means.
lib/docs-benchmark-report.sh the documentation benchmark’s dated report (component 24a of docs/spec/implementation/components/components-03.md).
lib/docs-benchmark.sh the documentation benchmark’s fixed protocol, the readers of what its runs leave behind, and the check of its questions (requirement 52a of docs/spec/implementation/requirements/the-script-01.md, component 24a of docs/spec/implementation/components/components-03.md, agent-ops#2086).
lib/drain.sh at-rest detection and reporting for the --drain switch mode (requirement 2.9). lib/toggle.sh owns the switch itself, including the mode field a --drain record carries (requirement 2.3d); this file is everything downstream of “a drain is active”, read only by agent-cycle.sh and the management/status/dashboard/heartbeat readers of its output — never by review-cycle.sh, which has no finishing set of its own and stands down under either mode exactly as it always has (requirement R2a, docs/spec/review/requirements.md).
lib/eligibility.sh what this cycle is allowed to act on, once the gatherers have finished and before anything is offered to a model: which pre-fetched bands survive the blocked/void skip-lists (requirements 3t/3u), which repositories’ issues the Enabler may be judged against (35a/35b), the Refiner’s own two extra pre-fetched sources (3y), and the Refiner’s candidate set (39a).
lib/enabler.sh the Enabler stage (requirements 35–37): the pipeline’s escalation path, a high-tier model engaged rarely to re-examine items recorded as blocked that the pipeline has not managed to unstick by itself, and — for the ones that genuinely need a human — compose the GitHub issue the Script then files, assigned, saying exactly what to do.
lib/escalation-autonomy.sh the escalation_autonomy trust ladder (D18 pattern, agent-ops#627, agent-ops#936): three rungs, each including the one below it. always-escalate sends every Enabler escalate verdict straight to a human. adjudicate-first runs one bounded adjudication pass first, but only over a refinement disagreement (requirement 36b) — the narrowest shape a pass with only two answers (adequate/inadequate) can usefully judge. decide-tactical runs one bounded decide pass first over every escalate verdict, refinement disagreement or not, with three answers (settle/decide/escalate) — see prompts/enabler-decide.md and run_enabler_decide (lib/enabler.sh).
lib/escalation-dedup.sh the duplicate-guard predicate shared by every escalation filer: does an open issue in a repo already represent a given item reference, so a second filing would ask the same human twice (agent-ops#2669).
lib/escalation-lookup.sh the two-step (labelled-first, label-less-fallback) GitHub read behind every escalation-issue lookup in this pipeline (agent-ops#2657, agent-ops#2666, agent-ops#2670).
lib/expensive-gather-cache.sh per-node cache that lets gather_ordered_repos (lib/candidate-gather.sh) run each cycle’s expensive per-repository reads — issue threads with comments, PR review reads, merge-conflict/dequeued walks — for one configured repository only, instead of every one of them (requirement 48, agent-ops#1086).
lib/fleet-pricing.sh “where do the tokens go?” (docs/ROADMAP.md D21/D14 “Price the fleet and the tokens”, issue #612). Two pure folds, both reading only what Phase 1’s own accounts already produce — counts.cost_rows[] (issue #593/#594), lib/rework-panel.sh’s own rework-cycle classification (D23, issue #611) and lib/item-lifecycle.sh’s item_lifecycle_fold (issue #595) — never a second raw-event scan of their own:
lib/fleet-sizing.sh the fleet-sizing figure (docs/ROADMAP.md D21/D14 “Price the fleet and the tokens”, issue #612): per node, the items it landed that no peer would have taken, set against its idle-without-demand hours and its share of contended claim-lost events. A node whose idle time and contention are both elevated while it rarely delivers anything a peer would not have is over-provisioned, and this is the figure that must be willing to say so — lib/constraint.sh’s own fleet-wide sentence can already name “node count” as the constraint, but only as one bucket in a six-way ranking; this is the per-node breakdown behind that bucket, never a replacement for it (issue #612’s own scope bound).
lib/fleet.sh where the fleet’s shared memory lands on disk, and the union read over it. Sourced by both pipelines and scripts/state-sync.sh so the path convention exists in exactly one place.
lib/forge-auth.sh which identity a cycle authors as (D18 decision 1, agent-ops#607 Phase 2), and the name of the seam’s degrade-path variable (D18 decision 1 as amended, agent-ops#1021).
lib/forge-token-broker.sh the forge authoring token a stage may have, and nothing else (requirement 45e of docs/spec/implementation/requirements/every-stage.md).
lib/gather-phase.sh issue #1958’s continuation of #771’s split: the phase between the repo-ordering/candidate-gathering loop (gather_ordered_repos/ compute_skip_lists, already lib/candidate-gather.sh as of #773) and the Co-Ordinator stage itself (lib/coordinator-phase.sh). One function, run_gather_phase, covering — in order — band eligibility and the Enabler/Refiner pre-fetches (lib/eligibility.sh), the decision-veto sweep and pending decision acts (lib/decision-veto.sh), back-pressure’s finishing-sources narrowing (requirement 2.2a), the requirement-4i prompt-fit ladder (lib/coordinator-input.sh), and the no-op short-circuit (requirement 3b, lib/noop-skip.sh).
lib/gh-shim.sh the logic behind scripts/gh-shim.sh, the gh transport seam installed on PATH ahead of the real binary (agent-ops#1084), and, since agent-ops#1021, the front door for the forge authoring App’s on-demand credential seam as well (D18 decision 1 as amended): every gh call reaches gh_shim_resolve_token (below) before this file’s classification and transport logic ever runs, and git’s own credential helper (!gh auth git-credential, deploy/docker/entrypoint.sh) resolves through PATH to this same shim, so both front doors mint through the one resolver. See gh_shim_resolve_token’s own header for the mechanics.
lib/git-identity.sh the identity an unattended commit runs under.
lib/github-app-token.sh GitHub App installation-token minting, generalised over identity (D18 §5.3 WI-4, agent-ops#407; generalised by agent-ops#607 Phase 2). Written first for one caller only — the Pullwright Approver (lib/approver-token.sh) — and generalised once a second identity needed the identical dance against a different App/installation/key: the forge authoring App (lib/author-token.sh, D18 decision 1). The mechanics live here exactly once; each identity’s own file is a thin wrapper supplying its own environment variable names, cache-file prefix and override variables, so a fix or a new capability here reaches both callers at once.
lib/github-limit.sh GitHub’s own rate limits: the budget check that decides whether a cycle is worth starting, and the gh wrapper that waits out a refusal instead of failing on it.
lib/handoff.sh the moment a pull request stops being the pipeline’s and reaches the landing gate, made a fact rather than a claim (requirement 31a).
lib/host-budget.sh whether the sum of every running container’s declared ceiling on this host still fits the host itself (issue #757). D14 (#606) bounds one container’s blast radius with a mem_limit/cpus ceiling; Docker reserves nothing, so the sum of every limit on a host may freely exceed it, and nothing before this file computed that sum or compared it to anything. deploy/docker/compose.yaml’s own “Resource ceilings (D14)” comment already does this arithmetic by hand for the two-nodes-one-host layout (“one tailnet node at 2.4 GiB plus one local node at 2.2 GiB leaves headroom for the VM itself”) — this file is that arithmetic, automated and checked every cycle instead of trusted to stay correct in a comment.
lib/host-facts-compose.sh the compose driver’s own section of the host-facts record (docs/reference/host-facts-schema.md, “containers”). Reads the Docker Engine API directly over curl --unix-socket rather than the docker CLI, which this image does not install (D20: no new base-image package for a control-plane question still open at Phase 2 — see docs/ROADMAP.md). The API’s own JSON is the same shape docker inspect prints — a thin CLI wrapper over exactly this endpoint — which is why test/collect-host-facts-compose.test.sh can drive the pure functions below with fixture files literally captured from docker inspect.
lib/host-facts-kubernetes.sh the Kubernetes driver’s own section of the host-facts record (docs/reference/host-facts-schema.md: “pods”/“rollouts”/ “cronjobs”/“node_conditions”/“pvcs”). Reads the Kubernetes API directly over curl with the pod’s own in-cluster ServiceAccount credentials, never the kubectl binary, which this image does not install (the same “bash-plus-jq container” property lib/host-facts-compose.sh holds for the Docker Engine API). The API’s own List JSON is exactly what kubectl get -o json prints — a thin CLI wrapper over exactly this response — which is why test/collect-host-facts-kubernetes.test.sh can drive the pure functions below with fixture files literally captured from kubectl get -o json.
lib/host-facts.sh the driver-independent half of the host-facts record (docs/reference/host-facts-schema.md): the envelope, host, updater and viewer_probe. lib/host-facts-compose.sh and lib/host-facts-kubernetes.sh each add their own vantage-specific section on top of what this file builds; scripts/collect-host-facts.sh is the only caller of either.
lib/human-visibility-hygiene.sh which of requirement 38c’s sweep warnings are still live, read from the fleet’s log union (requirement 38e).
lib/image-drift.sh is this node running the newest image this repository has published, or one that has fallen behind?
lib/issue-file.sh the two halves every issue filer in this codebase shares, written once: finding the issue an earlier filing already made, by a needle in its body, and creating one with the retry-without-label each filer performs. _pager_create_issue (lib/pager.sh), techdebt_file_issue (lib/tech-debt-file.sh), monitor_create_issue (monitor-cycle.sh) and refile_perform (lib/refile.sh) each carried its own copy of both before this file, and the copies had already diverged — one search capped at 20 and one at 200, one create validating the number it parsed and one not — so a fix to any of them reached only that one (review of PR #2344). What stays with each caller is what genuinely differs between them: which label the search narrows to and which the create applies, which state the search covers, and what to do when the search itself fails.
lib/issue-prefetch.sh the issue-walking engine shared by scripts/gather-issues.sh and scripts/gather-tech-debt.sh (issue #875, D15 as revised by #869): both fetch a repo’s open issues, drop what requirement 16’s issue-exclusion bullet always drops deterministically — a pull request the issues endpoint interleaves, an assigned issue, an issue labelled blocked (any case), or one naming a still-open Blocked-by: reference (requirement 34j) — and fetch each survivor’s whole comment thread to resolve that last check. They differ only in which issues qualify for candidacy at all (every open issue for issues; only those labelled pw::type:tech-debt for tech-debt), so that is the one thing left to each caller’s own jq select, not a second copy of the shared walk.
lib/issue-priority.sh resolves and writes GitHub’s Priority issue field, and enforces the one-way ratchet (D18 WI-11; agent-ops#414).
lib/item-lifecycle.sh the item-lifecycle record (docs/reference/flow-schema.md, requirement 49, issue #595): one durable record per work item, folded from the union log’s own item-scoped events, ending in an explicit terminal fate. A pure derivation, on the same terms lib/rework.sh’s rework_fields and lib/cycle-state.sh’s extracts already are — reads the log, touches no lock, writes no event.
lib/label-marker.sh the pipeline’s own memory of the label actions it has taken, the counterpart to lib/pipeline-marker.sh’s comment marker (#222) for the one write a marker cannot reach: a label carries no hidden text to stamp, so an add or a remove leaves nothing on the object itself distinguishing this system’s own hand from a human’s — even though, exactly as with a comment, both happen under the one GitHub account this system runs as (requirement 9d).
lib/labels.sh the pipeline creates its own labels at the point of use, in every repository it gathers data for, rather than requiring a human to create them first or only reaching a repository once it is selected to work.
lib/landing.sh the deterministic eligibility classifier and the arming step (D18 WI-7, docs/reviews/2026-08-14-autonomy-investigation.md §5.1, §6, §7; agent-ops#410).
lib/lane.sh lane_effective_open: the one open/closed rule D4/D30 define for a credit-mix lane, shared by stage_lane_draw (lib/stage-run.sh, issue #2241) and lib/mix.sh’s own status report (issue #2244), so the launcher’s actual draw and what an operator is told is open can never drift apart from one another (requirement 34a) — two readings of the same lanes object that disagreed would mean --status describing a lane as closed that the next launch draws from, or the reverse.
lib/limit-detect.sh shared usage-limit / spend-cap detection.
lib/log-event.sh the event-envelope logic both cycles’ own log_event wraps.
lib/manage.sh the management commands (--status, --disable, --enable, --clear-limit, --kill-merge-autonomy, …): everything agent-cycle.sh does instead of running a cycle.
lib/markdown-scan.sh the one fence-aware reading of a Markdown file (requirements 52, 52a and 52b, components 24, 24a and 24b).
lib/memory.sh free host memory, and this container’s own memory cgroup, read and judged one way everywhere: scripts/doctor.sh’s advisory warnings and agent-cycle.sh’s pre-cycle stand-down gate (requirement 2.0f) share this rather than each doing its own /proc/meminfo arithmetic, so the two can no longer silently disagree about what “low” means. It is the memory counterpart of lib/disk-space.sh, deliberately the same shape.
lib/merge-autonomy.sh the merge_autonomy trust ladder (D18, docs/reviews/2026-08-14-autonomy-investigation.md §5.1) and its fleet-wide kill switch (§6, WI-2 of umbrella #402).
lib/merge-budget.sh the merge_budget_per_day spend governor (D18, docs/reviews/2026-08-14-autonomy-investigation.md §5.4, WI-6 of umbrella #402).
lib/merge-observed.sh the completion path for a subject pull request that merges out from under a stage before that stage ever hands it off (agent-ops#916, escalation #922).
lib/merge-queue.sh GitHub merge-queue awareness (D17, docs/ROADMAP.md; agent-ops#374).
lib/metering.sh the per-stage metering record (docs/reference/metering-schema.md, requirement 33a of docs/spec/implementation/README.md).
lib/mirror-integrity.sh whether scripts/state-sync.sh’s own mirror checkout is trustworthy before either push or fetch reads or writes it.
lib/mirror-lock.sh who holds $mirror.lock (scripts/state-sync.sh’s mirror_lock) right now, for how long, and a way to bound a step that might wedge while holding it.
lib/mix.sh the credit mix’s live lever (issue #2244, D30): agent-cycle.sh --mix moves a provider’s lane weights and openings while the fleet runs, through fleet/mix.json, outranking config.json’s own providers.<name>.lanes for the keys it names.
lib/model-id.sh provider-qualified model identifiers (D12, docs/spec/implementation/requirements/the-script-01.md requirement 1a, issue #2131).
lib/monitor-digest.sh what the Pipeline Monitor reads instead of the records themselves (issue #1284, docs/spec/monitor.md M6/M7).
lib/node-health.sh the computation behind scripts/node-health.sh’s three verdicts (live/ready/health), and the only place any of them is decided (issue #608, Phase 2). Same contract lib/updater-health.sh and lib/image-drift.sh already hold: every function here reads what its caller hands it (never a file, never the network, never config.json itself), returns one compact JSON object, and never returns non-zero and never asserts a verdict its input cannot support. scripts/node-health.sh is the one place that gathers those inputs — from disk, from a cached probe, from config — and hands them in; this file makes no decision about how anything is served, gathered, or cached.
lib/node-time-state.sh the node time-state record (docs/reference/flow-schema.md, D21 of docs/ROADMAP.md, issue #597, Phase 1’s time account): a node-state transition event every time a node changes what it is doing, carrying the cause, so idleness is recorded with its reason at the moment it happens rather than inferred afterwards from an absence of cycles.
lib/noop-skip.sh the no-op short-circuit (requirement 3b): deciding whether engaging the Co-Ordinator could possibly produce a different answer than the last time it found nothing to do.
lib/notify.sh the installation’s one push-notification channel (issue #1279, acceptance check 2m as rewritten): every escalation issue filed or auto-closed, every pager-fired/pager-cleared (#1278), and every fleet-wide stand-down beginning or ending, POSTed as one compact JSON body to notify_webhook_url. Promoted from escalation_webhook_notify’s own narrower job — a filing-failure fallback only — which is now the escalation-unfiled event class alongside the others.
lib/pager-invariants.sh the built-in invariants lib/pager.sh’s framework ships with. Issue #1278 shipped the first two, chosen to exercise every branch of the framework itself:
lib/pager.sh fleet-level invariant evaluation, filing and auto-close (issue #1278, D21 follow-on to #608’s Phase 2 health item).
lib/pipeline-marker.sh the whole envelope every pull-request or issue comment this system posts wraps its own prose in: a visible header naming which Actor wrote it and from which node (component 3f), and an invisible marker proving to gather-abandoned-drafts.sh that the write was the pipeline’s own (requirement 3e; TD26072605).
lib/preflight.sh the done-check the Script runs on the item a cycle just claimed, before it pays for an Implementer engagement (issue #245).
lib/preview-config.sh resolves a repository’s preview config block (D19 Phase 1, agent-ops#586, requirement 24a).
lib/prompt-overrides.sh per-installation prompt overrides (issue #79, docs/spec/implementation/requirements requirement 4a).
lib/reason-codes.sh extract reason codes from the codebase for docs/reference/reasons.md’s own coverage check (issue #2098’s first acceptance criterion).
lib/reason-url.sh generate URLs for reason code documentation
lib/rebase-only.sh the diff-identity primitive requirement 31e/46a build on (agent-ops#1806): whether a push changed anything about a pull request’s own net content, regardless of whether it authored a new commit.
lib/reconciliation-gate.sh script-side confirmation that every standing human comment on a pull request has actually been answered before that pull request is taken out of draft (requirement 31c, agent-ops#533).
lib/redact.sh the token/home-path patterns scripts/publish-dashboard.sh and scripts/state-sync.sh both need before they hand content to a less-trusted destination: the dashboard’s own published payload (a semi-public, Tailscale-exposed surface) and whatever this node pushes to the private state-mirror repository (agent-ops#966) — the second destination is lower-risk than the first, but carries far more raw content (whole transcripts, never rotated), so it gets the same pass rather than none at all.
lib/refile.sh requirement 36f’s reach (c): re-filing a misfiled item into the pipeline’s own repository (act: {"kind": "refile-to-pipeline-repo", "paths": [...]}), and the corroboration the Script performs itself before it trusts that act. Sourced by agent-cycle.sh. run_enabler_decide (lib/enabler.sh) calls refile_act_check when the decide pass proposes the act; run_pending_decision_acts (lib/decision-veto.sh) calls refile_act once the veto window has passed, which re-checks and then performs it.
lib/refinement.sh under-specification as a class of block: what the Co-Ordinator must produce to report one, what the Script records, which items the labels are projected onto, how a human’s own hand-applied label is read back, and how many refinements one Enabler engagement takes on (requirements 16a, 34e, 34g, 35d, 36b, 38b).
lib/repo-clone.sh how both pipelines take their ephemeral clone.
lib/repo-order.sh effective-age ordering for the Co-Ordinator’s repo walk (docs/spec/implementation/requirements requirement 3, acceptance check 1l).
lib/report-directory.sh resolving a configurable report_directory (issue #761): a GNU date(1) format string naming where the review pipeline writes its report set, and discovering which of its past instances already exist on a repository’s default branch.
lib/required-check-preflight.sh the deterministic pre-flight half of issue #1543: name the owner-act prerequisite the moment a pull request’s own diff deletes, or edits away, the workflow job that produces one of the base branch’s required status checks — before or at pull-request time, not only once a downstream item happens to block on it.
lib/resource-usage.sh this container’s own CPU, memory and network counters, plus a volume’s own disk usage, and the derivation that turns a window of samples into the per-container/per-volume report requirement 55 publishes (D14, issue #606).
lib/review-context.sh per-repository instructions and context for the Reviewer-Agent (issue #589, D7 in docs/ROADMAP.md).
lib/review-gate.sh script-side confirmation, independent of what a Reviewer’s own model says, that a pull request is genuinely safe to hand to a human as ready for review (requirement 31c, agent-ops#249).
lib/review-recommendation.sh reading a project-review recommendation’s own “Tech-debt item(s): …” line back out of its recommendations file (issue #2030, extended by issue #2333).
lib/rework-panel.sh the rework panel (docs/reference/flow-schema.md’s “rework record” and “item lifecycle record”, D23 of docs/ROADMAP.md, issue #611).
lib/rework.sh the rework record (docs/reference/flow-schema.md, D23 of docs/ROADMAP.md, issue #596).
lib/role.sh whether this node runs unattended cycles.
lib/schedule-slots.sh which schedule slots fell inside a cycle’s own run (agent-ops#1287). supercronic will not start a job while the previous run of that job is still running: it logs the drop to the container log and nothing else records it, so a cycle that runs long loses its fleet a whole slot (or several) with no event of any kind in log.jsonl. cleanup() (agent-cycle.sh, requirement 11a) calls schedule_overrun_slots at the end of every cycle, before the lock releases, and logs one cycle-skipped {reason: "overlap", ...} per slot it returns.
lib/scratch.sh one scratch directory per process, and the sweep that reclaims the ones dead processes leave.
lib/stage-attempt.sh one Co-Ordinator stage attempt end to end: launch, parse the final message (with the prose/fence/bare-object salvage models occasionally need), and the shared failure handling — a refused API request, a wedged or timed-out run, an unparseable message — that every stage this pipeline runs eventually hits.
lib/stage-boundary.sh the Script’s side of the boundary between itself and its stages (requirement 45e of docs/spec/implementation/requirements/every-stage.md).
lib/stage-budget.sh how long a stage is allowed (requirement 4f of docs/spec/implementation/README.md).
lib/stage-health.sh per-stage health verdict from a node’s own log.jsonl (issue #662), generalized (agent-ops#996) to read any event stream sharing the stage-end/attempt-failed shape — review-cycle.sh’s review-log.jsonl included, over its own event names and into its own status file.
lib/stage-run.sh the one implementation of “run a headless model stage” (requirement 4d of docs/spec/implementation/README.md).
lib/standdown.sh the stand-down reason ladder (requirement 2): every check a cycle runs, in order, before it commits to doing any work this round — the GitHub API budget and credential check, the fleet-wide usage-limit cooldown and its own probe, the per-cycle claim GC and orphan/ closing-keyword/human-visibility/landing-retry/classifier-escape sweeps, and back-pressure across every configured repository.
lib/substrate-claude-code.sh the claude-code substrate adapter (docs/spec/implementation/README.md requirement 4d, issue #2133).
lib/substrate-grok-build.sh the grok-build substrate adapter (issue #2134, docs/reviews/2026-10-06-grok-build-evaluation.md’s adapter specification), the second sibling of lib/substrate-claude-code.sh behind the seam issue #2133 cut. Supplies the same five operations, plus one more this substrate alone needs:
lib/tech-debt-file.sh file deferred work on the Script’s own behalf (agent-ops#631), for a stage that must never write to GitHub or a branch itself: the Approver (“What you must never do”: never write code, push, amend the branch, or write to GitHub at all) and the Enabler (same rule, and it runs with no clone of any repo at all). Both may set file_debt or file_issue in their final JSON; the Script is what actually files it, under the calling stage’s own identity where one applies.
lib/toggle.sh the pipelines’ enable/disable switch (requirement 2.3), and the fleet flags that lift it and the usage-limit stand-down to every node at once (requirements 2.3a and 2.1 — see the fleet section below).
lib/token-expiry.sh the PAT expiry warning (agent-ops#694).
lib/union-log-scan.sh a one-pass-per-repository reader of the fleet’s union event log, for a fact more than one caller in the same cycle needs about the same repository (#1050).
lib/union-stream.sh reading the fleet event union as a stream rather than slurping it (agent-ops#1649). A jq -s over the union holds every parsed event in one process, about five bytes of resident memory per byte of a log scripts/rotate-logs.sh never rotates; the readers here hold only what a reader’s answer is about.
lib/unvoid-label.sh which of the labelled requests actually reopen a void (requirement 34f).
lib/updater-health.sh has the update mechanism itself gone wrong, ahead of and independent of the drift it eventually causes?
lib/verdict-fate.sh pairing an Approver verdict with the pull request’s eventual fate (D18, agent-ops#573).
lib/version.sh what code this node is actually running.
lib/void-guard.sh what any stage must produce before one of its void verdicts is allowed to be permanent (requirement 34d).
lib/void-liveness.sh the actioned signal for the void shapes requirement 34n’s original two rules (a closed GitHub object, a resolved register row) never covered (TD-PPagop-26081303).
lib/work-gone.sh which blocked items are blocked on work that no longer exists (requirement 34i).
lib/workspace.sh reclaiming workspace_root.

Run directly: by cron, by CI, or by hand.

Script Purpose
scripts/assemble-changelog.sh assemble CHANGELOG.md’s ## [Unreleased] section from merged pull-request descriptions (roadmap decision D27, agent-ops#1807). The write side of requirement 25c: every other pull request now writes its changelog entry into its own description’s ## Changelog section rather than into this file, and this script is the one place that turns those descriptions into the file — run by the release pull request in a repository that cuts releases, or a scheduled roll in one that does not (this repository’s own roll is agent-ops#1809).
scripts/autonomy-stage-report.sh D18 rollout-stage evidence report (issue #571, a WI of umbrella #402).
scripts/background-wait-guard.sh the executable Claude Code’s managed PreToolUse hook (deploy/docker/claude-managed-settings.json) invokes. All of the logic lives in lib/background-wait-guard.sh, which this only sources and calls; see that file’s own header for what it denies and why.
scripts/cgroup-parent-setup.sh create the persistent parent cgroup a scheduler is bounded by, and print the two .env lines that put it to use.
scripts/check-brace-default-trap.sh permanent CI guard against the bash ${var:-word} brace-default trap (issue #1035, TD-PPagop-26082922).
scripts/check-changelog-section.sh deterministic check of the ## Changelog section a pull-request description carries (requirement 25c, roadmap decision D27).
scripts/check-closing-keyword.sh deterministic check that an issue-sourced agent PR actually links its issue (requirement 25a).
scripts/check-docker-toolchain-drift.sh compare the four hand-pinned toolchain ARG defaults in deploy/docker/Dockerfile against their own upstream release feed, and file (or update) an ordinary GitHub issue when one has fallen behind (issue #2708, following the decide-tactical decision on that issue: option 1, drift-report shape, modelled on scripts/check-graphql-drift.sh).
scripts/check-docs.sh five offline checks on the documentation that the generated-region workflows (toc.yml, config-table.yml, labels-table.yml, scripts-index.yml) don’t make (issue #2088): those gate a region’s own freshness against its source and nothing else, so nothing else notices a broken relative link, a dangling anchor, a document missing from docs/README.md’s map, a file past the size budget docs/README.md’s “Size budget” section fixed, or code/prompts/docs quoting a section that moved.
scripts/check-graphql-drift.sh validate every GraphQL document this repository sends against GitHub’s live schema (TD-PPagop-26082930).
scripts/check-node-compose.sh is this node’s compose.yaml, and the containers it created, still what the repository would deploy?
scripts/check-node-image.sh is this node running the newest image this repository has published, or one that has fallen behind (#155)?
scripts/claude-policy-probe.sh does this machine’s claude run what a checkout plants for it (requirement 4k)?
scripts/claude-tool-call-stub.py a canned Messages API endpoint for scripts/claude-policy-probe.sh (issue #2799).
scripts/close-void-github-items.sh act on a corroborated void by closing the GitHub object it names, instead of leaving a tombstone only this pipeline’s own log can see (requirement 34k).
scripts/collect-host-facts.sh the collector (issue #1283): a host- and cluster-vantage record of the facts no container running the pipeline can see for itself, since the runtime deliberately holds neither the Docker socket nor the Kubernetes API (a property since the agent-ops#603 postmortem). This is the CLI over lib/host-facts.sh (the driver-independent envelope, host, updater, viewer_probe) and lib/host-facts-compose.sh / lib/host-facts-kubernetes.sh (the two vantage-specific sections) — docs/reference/host-facts-schema.md is the record’s own field-by-field contract.
scripts/collect-resource-usage.sh one sample of this container’s own CPU, memory and network counters, appended to the node’s local resource-usage log, plus a throttled disk sample of the volumes this container can see (D14, issue #606). Meant to run every few minutes from a container’s own schedule — deploy/docker/crontab.tmpl’s @RESOURCE_SAMPLE_MINUTES@ line for the scheduler service (supercronic), and a small background loop scripts/serve-dashboard.sh starts for dashboard/dashboard-local, which run no cron at all.
scripts/collect-viewer-probe.sh the viewer-probe sidecar (owner decision #1358, agent-ops#2788): the tailnet-only half of the viewer-vantage probe lib/host-facts.sh already runs, moved into its own container because the collector service (every node, every profile) carries no tailnet route of its own. Shares the tailscale sidecar’s network namespace (deploy/docker/compose.yaml’s viewer-probe service, profiles: [tailnet]), the same way dashboard does, so it reaches a peer’s data.js with no credential of its own.
scripts/constraint.sh print the constraint statement (D21 of docs/ROADMAP.md’s “state the constraint” bullet, issue #609): one sentence naming what is limiting this installation’s throughput right now, over what share of the window, and what to do about it — computed from the node time-state account (scripts/node-time-state.sh, issue #597), never asserted. lib/constraint.sh’s constraint_classify is the pure derivation this script only wires to the fleet’s own logs, the same division scripts/node-time-state.sh already keeps against lib/node-time-state.sh.
scripts/detect-classifier-escapes.sh independent post-hoc classifier-escape detector (D18 Stage 2 exit criterion “zero classifier escapes”, agent-ops#572).
scripts/docs-benchmark.sh score the documentation against a fixed set of real questions (requirement 52a of docs/spec/implementation/requirements/the-script-01.md, component 24a of docs/spec/implementation/components/components-03.md).
scripts/doctor.sh check an installation end to end, before it runs a cycle.
scripts/gather-abandoned-drafts.sh pre-fetch a repo’s draft pull requests this system raised and then abandoned (requirement 3e).
scripts/gather-dequeued.sh pre-fetch a repo’s pull requests this system raised that GitHub’s merge queue removed over a merge-group checks failure without merging (TD-PPagop-26081409, issue #374, requirement 38f/D17).
scripts/gather-findings.sh pre-fetch a repo’s open security and code-quality findings for the Co-Ordinator (docs/spec/implementation/requirements, requirement 3a).
scripts/gather-hand-flagged-refinements.sh pre-fetch the issues a human has labelled directly, asking the pipeline to treat them as too under-specified to work on (requirement 34g).
scripts/gather-human-visibility-hygiene.sh pre-fetch a repo’s still-live human-visibility violations that scripts/sweep-human-visibility.sh (requirement 38c) could not self-heal, so a gh read or the review-request POST failing there stops being only a warning log line nobody re-reads (requirement 38e; tech-debt/TD-PPagop-26080801.md).
scripts/gather-implementation-plan.sh deterministically pre-fetch the open (unchecked) tasks in a repo’s implementation-plan document, for the Refiner (docs/spec/implementation/requirements, requirement 3y; TD-PPagop-26081307).
scripts/gather-issues.sh deterministically pre-fetch one repo’s open issues, whole threads included, for the Co-Ordinator’s runtime input (docs/spec/implementation/requirements, requirement 3j).
scripts/gather-landing-refusals.sh pre-fetch a repo’s pull requests that gate 4 of _landing_stage_attempt (lib/landing.sh) keeps refusing to arm over an unreconciled human comment, or a comment-reconciliation read it could not make (requirement 53, issue #979, agent-ops#672/#746/#753).
scripts/gather-merge-conflicts.sh pre-fetch a repo’s pull requests that are otherwise ready for review or ready to merge but blocked by a conflict with their base (requirement 3g), plus Dependabot’s own conflicted bumps (requirement 3s, issue #250).
scripts/gather-plan-status.sh what an implementation-plan document’s own checkbox says about specific task ids (requirement 34i’s implementation-plan half).
scripts/gather-project-review.sh deterministically pre-fetch the most recent repository review’s recommendations, for the Refiner (docs/spec/implementation/requirements, requirement 3y; TD-PPagop-26081307).
scripts/gather-register-status.sh what a repository’s tech-debt register says about specific items, on its default branch (requirement 34i).
scripts/gather-review-feedback.sh pre-fetch a repo’s pull requests that are waiting on the agent to address a human’s review (requirement 3c).
scripts/gather-review-status.sh whether a project-review recommendation’s own ref is named by a merged pull request on the default branch (requirement 34i’s project-review half), or every tracking id its own recommendation text names is itself closed or resolved (issue #2333’s PR-independent half).
scripts/gather-source-state.sh sample the cheap change-detection signals for one repo’s work sources (docs/spec/implementation/README.md, requirement 3b).
scripts/gather-tech-debt.sh deterministically pre-fetch one repo’s open pw::type:tech-debt-labelled issues for the Co-Ordinator’s runtime input (docs/spec/implementation/requirements, requirement 3t).
scripts/gather-unvoid-requests.sh pre-fetch the voids a human has asked, on GitHub, to be reopened (requirement 34f).
scripts/gather-workflow-basenames.sh map a repository’s workflow ids to the basename the Co-Ordinator mints a failed-runs item id from (requirement 19: “item is failed-run- plus the workflow file’s basename without extension”).
scripts/gh-shim.sh the executable installed on PATH ahead of the real gh binary (requirement 2.0e, agent-ops#1084). All of the logic lives in lib/gh-shim.sh, which this only sources and calls; see that file’s own header for what the shim does and why.
scripts/github-budget-report.sh what the fleet’s GitHub API budget did (requirement 2.0d, agent-ops#1087): a read-only operator report over the github-budget events github_budget_record (lib/github-limit.sh) logs at cycle start, after every model stage and at cycle end.
scripts/grok-policy-probe.sh does this machine’s grok run what a checkout plants for it (issue #2134, requirement 4k’s Grok counterpart)?
scripts/is-docs-only.sh is this set of changed paths prose and nothing else?
scripts/item-lifecycle.sh print the item-lifecycle record (requirement 49, issue #595): one durable record per work item, folded from the union event log, ending in an explicit terminal fate. docs/reference/flow-schema.md’s “Item lifecycle record” section is the field-by-field contract this prints; lib/item-lifecycle.sh’s item_lifecycle_fold is the pure derivation this script only wires to the fleet’s own log.
scripts/lint-shell.sh shellcheck every shell script in the repository.
scripts/migrate-tech-debt-register.sh <owner/repo> [–dry-run]
scripts/mine-merge-history.sh repeatable merged-PR history miner and Stage 0 autonomy baseline (issue #404, WI-1 of D18’s rollout umbrella #402).
scripts/node-health-server.py the HTTP surface over scripts/node-health.sh (issue #608, Phase 2).
scripts/node-health.sh the CLI surface over lib/node-health.sh (issue #608, Phase 2): the container-runtime healthcheck runs this directly, and scripts/node-health-server.py shells out to it for the HTTP surface.
scripts/node-time-state.sh print the node time-state record (D21 of docs/ROADMAP.md, issue #597): every node-second in a window classified into exactly one of six states — producing, overhead, externally-blocked, idle-with-demand, idle-without-demand, down — with idle-with-demand split by cause. docs/reference/flow-schema.md’s “Node time-state record” section is the field-by-field contract this prints; lib/node-time-state.sh’s node_time_state_fold is the pure derivation this script only wires to the fleet’s own logs.
scripts/nudge-dependabot-rebase.sh the write half of Dependabot-conflict handling scripts/gather-merge-conflicts.sh’s bot classification sets up (requirement 3s, issue #250): give Dependabot one cycle to rebase its own conflicted PR before this system takes it over.
scripts/open-dashboard.sh regenerate the dashboard and open it in your browser. Pass –no-github to skip the (slower) live GitHub fetch.
scripts/pickup-metrics.sh answer issue #248’s acceptances 4 and 5 from the union event log: median/p90 pickup latency, and no increase in duplicate-work incidents, both relative to before finish-then-continue.
scripts/preview-deploy.sh did this pull request’s preview actually deploy, and does the deployed page answer?
scripts/publish-dashboard-launcher.sh sub-minute dashboard heartbeat.
scripts/publish-dashboard.sh regenerate the local monitoring dashboard.
scripts/publish-revert-rate.sh D18 issue #579 (a WI of umbrella #402): run the merged-PR miner on a cadence and publish the revert-or-follow-up rate against the recorded Stage 0 baseline.
scripts/publish-tech-debt-archive.sh D15-as-revised durable-ledger mitigation (issue #878, following #869/#875/#879): a scheduled export that mirrors every pw::type:tech-debt-labelled issue, per configured repository, into the state repository (state_repo) as one JSON file per issue under tech-debt-archive/<owner>/<repo>/<number>.json.
scripts/reconcile-compose.sh the compose reconciler’s one tick.
scripts/release-pending-reservations.sh retry a tech-debt reservation release a failed cleanup could not make land (TD-PPagop-26082427).
scripts/render-config-table.sh render the configuration-key table rows that docs/reference/configuration.md, docs/spec/implementation/configuration.md and docs/spec/review/README.md carry, from config.schema.json.
scripts/render-labels-table.sh render the labels table docs/reference/labels.md carries (issue #2097) from lib/labels.sh’s own catalogue, between its generated region’s marker pair.
scripts/render-scripts-index.sh render the index of every script under lib/ and scripts/ (issue #2097, delivering #1758’s own scripts-index ask) into docs/reference/scripts.md’s generated region.
scripts/render-toc.sh render the table of contents for each file lib/markdown-scan.sh’s TOC_FILES and TOC_DIR_FILES list, between marker regions.
scripts/resource-budget-report.sh read this node’s own local resource-usage log and print the compact per-container/per-volume report (D14, issue #606): {latest, median, p95} of cpu_cores/memory_bytes/ net_rx_bytes_per_hour/net_tx_bytes_per_hour per container, {latest, growth_bytes_per_day} of disk_bytes per volume. The derivation itself is lib/resource-usage.sh’s resource_budget_report, a pure function over the sample text — this script is the thin I/O wrapper around it (config, state_dir, the window) scripts/publish-revert-rate.sh and its siblings already establish the shape for.
scripts/roll-changelog.sh the scheduled roll requirement 25d’s own text names for a repository that cuts no releases (agent-ops#1809): this repository’s CHANGELOG.md has no release pull request to run scripts/assemble-changelog.sh from, so this script runs it on a cadence instead, renames the assembled ## [Unreleased] heading to a dated one (Keep a Changelog’s version slot; this repository has no version numbers) and opens a fresh, empty ## [Unreleased] above it.
scripts/rotate-logs.sh bound the diagnostic and cron logs beside state_dir’s records (TD26072501).
scripts/run-tests.sh run the test/ suite the way CI runs it: inside a throwaway container built from this repository’s image, with the working tree copied in and nothing of the host or of any running node reaching it.
scripts/serve-dashboard.sh optional loopback-only web server for the dashboard. Use this only if your browser refuses to load data.js over a file:// URL; otherwise scripts/open-dashboard.sh (file://) needs no server at all.
scripts/spec.sh read-only lookup and validation for every anchored requirement, acceptance-check and component label across docs/spec/implementation/, docs/spec/review/ and docs/spec/monitor.md (issue #2095).
scripts/state-sync.sh publish each node’s pipeline memory as its own branch of a private GitHub repository, and mirror every peer’s back for union reads.
scripts/sweep-closed-issues.sh close an issue whose implementing PR already merged but never triggered GitHub’s own auto-close (requirement 17c), for one repository.
scripts/sweep-decision-vetoes.sh find a pw::decision decision-log issue a human reopened (a veto, agent-ops#937) and act on it, for one repository.
scripts/sweep-human-visibility.sh the periodic, deterministic half of agent-ops#242 (requirement 38): for every open, ready pull request this system raised, make sure a human whose turn it is has actually been asked, and nudge one who has been waiting too long without an answer.
scripts/sweep-inline-refinement-specs.sh move a refinement that is stranded as an inline spec into the thread of the issue it describes, and record the pointer that replaces it (agent-ops#1128).
scripts/sweep-legacy-refinement-assignees.sh undo requirement 38b’s old bookkeeping mechanism wherever it is still standing (agent-ops#639).
scripts/sweep-orphan-branches.sh find claim branches whose work became invisible, and put it back in front of the pipeline (requirement 17b).
scripts/tech-debt-close-guard.sh advisory check that a closed pw::type:tech-debt issue carries some evidence of its resolution (issue #877; D15 as revised, #869/#875/#879’s “close-guard”, the resolution-discipline mitigation for a tech-debt issue closed without a pull request).
scripts/verdict-fate-report.sh D18 Approver-verdict/human-action divergence report (agent-ops#573, a WI of umbrella #402).
scripts/wake-poll.sh wake an idle node when a source-relevant event lands (requirement 54, issue #613), instead of waiting for the next schedule.cycle_interval_minutes cron firing. Runs from its own crontab line, every schedule.wake_poll_minutes (deploy/docker/crontab.tmpl).
scripts/watch-node.sh watch a running node’s pipeline output, without needing to know the docker-exec incantation by heart.