Improvement prompts
One prompt per recommendation, in priority order (severity first, then effort). Each prompt is self-contained and can be pasted into a fresh AI agent session with no other context. Run prompts in the order given where a dependency is noted; otherwise they are independent and can run in any order or in parallel.
Prompt for R-01 — Contain the prompt-injection / unrestricted-tool-access exposure
Section titled “Prompt for R-01 — Contain the prompt-injection / unrestricted-tool-access exposure”Bundles: R-01 only (too large and too security-sensitive to bundle with anything else) · Run after: no prerequisites
Context: agent-ops (Poetic-Poems/agent-ops) is a self-hosted, unattendedpipeline that autonomously implements and reviews work across three publicGitHub repositories (Poetic-Poems/poetic, poetic-fiddle, and agent-opsitself), raising pull requests via the `claude` CLI run non-interactively.The pipeline's stage-launch point is lib/stage-run.sh; the six stage promptslive in prompts/*.md; the credential/entrypoint setup isdeploy/docker/entrypoint.sh; the container's network config isdeploy/docker/compose.yaml and the Dockerfile.
The problem: lib/stage-run.sh launches every pipeline stage (Co-Ordinator,Implementer, Reviewer, Enabler, Refiner, Approver) with`claude -p --model "$model" --dangerously-skip-permissions--output-format stream-json --verbose` — unrestricted bash/file/network toolaccess, with no --allowedTools/--disallowedTools/permission-moderestriction anywhere in the codebase. deploy/docker/entrypoint.sh places awrite-scoped GH_TOKEN (contents/pull-requests/issues write access) into thecontainer's process environment for its whole lifetime, readable by every`claude` child process. prompts/coordinator.md embeds untrusted GitHubcontent verbatim into the work order it hands downstream ("the issue body,verbatim", "every comment, verbatim" — see prompts/coordinator.md aroundlines 58 and 343), and no prompt in prompts/*.md frames this content asuntrusted data rather than instructions. All three repositories thepipeline acts on are public (confirm with `gh repo view <repo> --jsonisPrivate`), so any GitHub account can open an issue, PR, or comment whosebody becomes this verbatim input. There is no network egress allowlistanywhere in the deployment.
The goal — reduce this to no technical path from adversarial GitHub contentto credential exfiltration or destructive action:1. Every prompt in prompts/*.md that embeds externally-sourced GitHub content (issue bodies, PR bodies, comments, commit messages) is preceded by an explicit, consistent framing that the content below the marker is untrusted external data, never an instruction to follow, and the executing agent must not treat directives found inside it as commands.2. Stages that primarily read and judge rather than need broad write access (start with Reviewer and Approver) run `claude` with tool access scoped down from --dangerously-skip-permissions to an explicit, narrower allow-list appropriate to what that stage actually needs to do — read the repo, run tests/linters, post a review — not unrestricted bash. Verify against each stage's actual current behaviour (grep agent-cycle.sh and prompts/reviewer.md / prompts/approver.md for what tools each stage invokes) before removing anything it needs.3. The container's network egress is restricted to github.com (and its API subdomains) and the Anthropic API — nothing else — via whatever mechanism fits deploy/docker/compose.yaml (an egress proxy, firewall rules, or the hosting platform's own network policy; investigate what's feasible in this deployment before choosing).
Constraints: do not change the Implementer's tool access in this pass — itgenuinely needs broad write access and any restriction there needs separate,careful scoping against its actual required capabilities; note thisexplicitly as follow-up work rather than attempting it here. Do not breakany existing stage's ability to do its documented job — every change mustbe verified against the existing test suite and, ideally, a real (orcarefully simulated) pipeline cycle. Do not remove --dangerously-skip-permissionsfrom every stage in one change if that risks breaking stages this taskdidn't fully investigate — land the prompt-framing change and the networkegress restriction first (lower-risk, no stage-behaviour change), and treattool-access scoping as a separate, incremental follow-up per stage.
Verification: run the full test suite via scripts/run-tests.sh (inside theproject's own Docker image, per its own header comment — do not run itdirectly against the host, jq version drift makes that misleading). Confirmscripts/lint-shell.sh (shellcheck) stays clean. For the tool-access scopingchange specifically, exercise the affected stage's documented behaviours(check prompts/reviewer.md and prompts/approver.md's own descriptions ofwhat each stage must be able to do) and confirm nothing that stage legitimatelyneeds was cut off.
Cost policy: this is genuinely security-critical, cross-cutting work — dothe analysis and the actual tool-access-scoping and egress-restrictionchanges at a high-capability tier yourself; do not delegate the core designdecisions. You may delegate well-specified, narrow subtasks (e.g. draftingthe prompt-framing text for one prompts/*.md file once the pattern isdecided, or writing a test asserting the egress allowlist) to a lower-costtier, but review everything delegated before integrating it, given thesecurity stakes.
Deliverable: land the prompt-framing change and the network egressrestriction as one or two PRs (whichever the platform-specific egress worknaturally splits into), each following the repository's normal PR/tech-debtconventions (see CLAUDE.md). File the tool-access-scoping work as atracked, scoped tech-debt item (per TECH-DEBT.md's "Filing an item"workflow) rather than attempting it in the same pass, unless you havebudget to do it carefully and completely with full test verification.Prompt for R-02 — Decompose agent-cycle.sh’s undecomposed main flow and largest functions
Section titled “Prompt for R-02 — Decompose agent-cycle.sh’s undecomposed main flow and largest functions”Bundles: R-02 only (a large refactor; do not bundle with unrelated work) · Run after: no strict prerequisites, but coordinate with any in-flight docs/ROADMAP.md D8 repository-split work to avoid duplicated effort
Context: agent-ops's implementation-pipeline entry point, agent-cycle.sh, is9,920 lines: 95 named functions plus roughly 3,400 lines of undecomposedtop-level script (the actual cycle body — claim acquisition, all five stagedispatches, cleanup — concentrated in two contiguous regions, roughly lines6484-9360 and 9372-9920). The sibling entry point, review-cycle.sh (1,043lines, same author, same conventions), fully decomposes into 19 namedfunctions with no comparable undecomposed block — it is the reference stylefor this task. Five named functions inside agent-cycle.sh are alsounusually large: maybe_run_enabler (~645 lines, ~30 locals),coordinator_corroborate_retry_or_fallback (~328 lines), run_approver_stage(~319 lines), maybe_run_refiner (~292 lines), and _landing_stage_attempt(~283 lines) — contrast lib/handoff.sh, which decomposes comparable domaincomplexity (PR readiness, review requests, handoff completion) into 17functions averaging ~65 lines each, several as private `_handoff_*` helpers.
The problem: the undecomposed main flow cannot be unit-tested the waylib/*.sh functions are (nothing can `source` and call a slice of top-levelscript), and it is the highest-stakes, most-frequently-touched code in therepository — a change here is only caught by the full integration testsuite or by production. The five oversized named functions concentratebranching complexity beyond what a reader can hold in working memorylocally, and their flat local-variable scopes raise the risk of an edit toone verdict branch accidentally shadowing state meant for another.
The goal (acceptance criteria):1. The main cycle flow (currently top-level script) is expressed as a sequence of named function calls, mirroring review-cycle.sh's style — at minimum, the label pre-fetch, lock acquisition, the stage-dispatch sequence, and cleanup each become their own named function, called once from a slim top-level driver.2. Logic that duplicates or closely resembles existing lib/ patterns (gather_merge_conflicts, gather_tech_debt, coordinator_eligible_items, exclude_blocked_or_void_items, and similarly-shaped functions — grep agent-cycle.sh for `gather_`/`exclude_`/`coordinator_` prefixes for the full list) moves into lib/, alongside its closest existing sibling file (lib/coordinator-input.sh, lib/repo-order.sh are likely homes — read both first to judge fit).3. Each of the five oversized functions is split along its existing guard- clause/verdict-branch structure into smaller named helpers (a claim helper, an adjudicate helper, one helper per verdict outcome, etc.), reducing each function's own body to an orchestration-only sequence of calls, matching lib/handoff.sh's demonstrated decomposition style.4. No behaviour changes anywhere — this is a pure refactor. Every existing test in test/*.test.sh still passes unmodified (test file changes are only acceptable where a test was pinned to internal structure that necessarily moves, e.g. an awk-based "wiring" test that extracts a specific line range — update its extraction target, not its assertion).
Constraints: do this incrementally, not as one giant diff — land it as asequence of small, independently-reviewable PRs, each behaviour-preservingand each verified green before the next starts. Do not change any stage'sexternal behaviour, CLI flags, config keys, or log event shapes. Preserveevery existing comment that explains *why*, not just *what* — severalfunctions here carry incident-history comments (e.g. references to specificissue/PR numbers) that must move with the code they document. Watch for"wiring" tests (test/*-wiring.test.sh) that extract exact line ranges orfunction bodies via awk/grep from agent-cycle.sh — these will need theirextraction targets updated in lockstep with any function you move orrename, or they will fail (correctly) with "has it moved?"-style errors.
Verification: run scripts/run-tests.sh (inside the project's Docker image —see its own header for why not to run directly against the host) afterevery incremental change, expecting 100% of the existing suite green. Runscripts/lint-shell.sh (shellcheck) after every change. For the highest-riskstep (splitting the five oversized functions, especially maybe_run_enablergiven its ~30 local variables), read the full function first and map everybranch's inputs/outputs before splitting, to avoid silently dropping a codepath.
Cost policy: work cost-consciously. Where your environment supportssubagents, delegate well-specified, self-contained subtasks — e.g.extracting one already-identified gather_* function into lib/, or updatingone wiring test's extraction target — to a mid-cost tier once the overalldecomposition plan is set. Reserve a high-capability tier for planning thedecomposition boundaries themselves (especially inside the five oversizedfunctions, where getting a split wrong risks a subtle behaviour change) andfor reviewing each delegated extraction before it's integrated. This is notmechanical enough for a low-cost tier to do unsupervised, given how easy itis to silently drop a guard clause or misplace a variable's scope.
Deliverable: a sequence of PRs (suggest at least 3-4 separate ones: main-flowextraction; gather_*/exclude_*/coordinator_* promotion to lib/; the fiveoversized functions, likely one PR each or grouped by natural theme), eachfollowing this repo's normal PR conventions (Conventional Commits title,CLAUDE.md's branch/clone rules), each with its own green test run recordedin the PR description.Prompt for R-03 — Give publish-dashboard.sh a --now seam
Section titled “Prompt for R-03 — Give publish-dashboard.sh a --now seam”Bundles: R-03 only · Run after: no prerequisites (already fully scoped as tech debt TD-PPagop-26082316)
Context: agent-ops's dashboard publisher, scripts/publish-dashboard.sh,computes several time-windowed figures (a rolling landing digest, stalenesschecks, etc.) from the real wall clock, read once near the top of thescript into a `now_iso` variable derived from `date -u +%Y-%m-%dT%H:%M:%SZ`with no override. Its sibling scripts, scripts/publish-revert-rate.sh andscripts/autonomy-stage-report.sh, both already accept a `--now <iso8601>`flag for exactly this purpose, and their tests assert against fixedcalendar timestamps rather than the real clock.
The problem: because publish-dashboard.sh cannot be pinned to a fixed time,tests exercising its windowed logic (e.g. test/landing-audit-record.test.shPart B) can only assert against the real clock at test-write time. Thisalready caused a real incident: PR #685's checks were green when written,but more than 24 hours later the merge queue re-ran the same suite againsta later real clock, a fixture fell outside its intended rolling 24-hourwindow, three assertions failed, and the PR was dequeued from the mergequeue after a human had already approved and enqueued it. This is trackedas open tech debt tech-debt/TD-PPagop-26082316.md — read that file firstfor any additional detail it records.
The goal: scripts/publish-dashboard.sh accepts a `--now <iso8601>` flag,following the exact pattern already used in scripts/publish-revert-rate.sh(read that script's argument parsing and its use of the override value asyour reference implementation — match its flag name, help text style, andhow it threads the override value through to every windowed calculation).Every test that currently exercises publish-dashboard.sh's time-windowedlogic against the real clock is updated to pass a fixed `--now` valueinstead, matching the pattern scripts/publish-revert-rate.sh's own testsalready use.
Constraints: when `--now` is not passed, behaviour must be identical totoday (falls back to the real clock) — this is a strictly additive change,not a behaviour change for production use (production never passes`--now`; it exists for tests). Do not change the format or semantics of anyexisting windowed calculation, only how "now" is obtained.
Verification: run the specific tests that exercise time-windowed dashboardlogic (grep test/*.test.sh for references to publish-dashboard.sh and towindow/staleness/digest-related assertions) and confirm they now passdeterministically regardless of when they're run — verify this concretelyby running the suite once, then again after altering your local clockforward by 25+ hours if your environment allows it, or by inspecting thatthe test no longer reads `date`/`$(date ...)` anywhere in its ownassertions. Run the full suite via scripts/run-tests.sh to confirm nothingelse regressed.
Cost policy: this is small, well-specified, pattern-matching work againstan existing sibling implementation — suited to a low-cost tier end to end,including the test updates. No need to reserve a higher tier for any partof this task.
Deliverable: a single PR implementing the `--now` flag and updating theaffected tests, referencing tech-debt/TD-PPagop-26082316.md and flippingits frontmatter to `status: resolved` with today's date and this PR'snumber in `ref:`, per TECH-DEBT.md's resolution convention (frontmatter-onlyedit, body left in place).Prompt for R-04 — Fix the dashboard’s misleadingly-named esc() helper
Section titled “Prompt for R-04 — Fix the dashboard’s misleadingly-named esc() helper”Bundles: R-04 only · Run after: no prerequisites
Context: agent-ops's local dashboard is a single file, dashboard/index.html(inline HTML/CSS/JS, no build step, no framework). It renders fleet state(cycles, PRs, tech-debt items, etc.) client-side from a published JSONpayload.
The problem: dashboard/index.html defines `function esc(s) { returnString(s == null ? "" : s); }` (around line 307) — despite its name, thisperforms no HTML-entity escaping at all. Most of its ~14 call sites aresafe only incidentally, because they flow through the `el()` helper's`children` parameter into `document.createTextNode` (which does notinterpret HTML). Two call sites are not safe by construction: `kv()`(around line 1782) builds `el("span", {class:"kv", html: k + " <b>" +esc(v) + "</b>"})`, and a count-summary string (around line 2063) — bothroute through the `html:` attribute, which `el()` assigns directly to`.innerHTML` (see el()'s implementation, around lines 275-288). Todayneither call site is known to carry attacker-controlled content, but thefunction's name actively invites a future developer to trust it withcontent that could be (an issue/PR title, a model-generated reason string),introducing stored XSS on a page exposed to everyone on the operator'sTailscale network.
The goal: eliminate the risk that a future call to `kv()` or thecount-summary path introduces XSS, without breaking the dashboard's currentrendering. Preferred approach: rewrite `kv()` to build its `<b>` element via`el()` (DOM construction) instead of string-concatenating into `innerHTML`— this removes the unsafe `html:` call site entirely rather than relying oncorrect escaping. Apply the same treatment to the count-summary site if itsimilarly can be expressed as DOM construction. If any remaining sitegenuinely needs to inject markup (not just text) via `html:`, then rename`esc()` to something that doesn't imply escaping (e.g. `str()`) and, onlyfor that one call site, write a real HTML-escaping function and use it.
Constraints: dashboard/index.html has no build step — do not introduce one;keep the fix as plain inline JS matching the file's existing style. Do notchange the dashboard's visible output for any currently-rendered value(verify byte-for-byte or visually identical rendering for existing data).Do not touch unrelated parts of this large file.
Verification: this repo has a Node-based rendering harness for exactly thisfile, test/dashboard-render-harness.js, exercised bytest/dashboard-render.test.sh — run that test and confirm it still passes.Manually trace every one of esc()'s call sites (grep dashboard/index.htmlfor `esc(`) after your change and confirm each is either now safe byconstruction (DOM-built, not string-concatenated into innerHTML) or passesthrough a genuine escaper.
Cost policy: this is small, self-contained, single-file work suited to alow-cost tier — no need for a higher-capability tier on any part of it,though you should still verify your own output against the rendering testbefore declaring it done.
Deliverable: a single PR with the dashboard/index.html change and a note inthe PR description tracing every esc() call site and its safetyjustification post-change.Prompt for R-05 — Redact secrets from the state-repo sync path
Section titled “Prompt for R-05 — Redact secrets from the state-repo sync path”Bundles: R-05 only · Run after: no prerequisites
Context: agent-ops periodically syncs its operational state (logs,transcripts, review folders) to a second, private GitHub repository viascripts/state-sync.sh, for durability/history independent of any singlenode. Separately, scripts/publish-dashboard.sh — which publishes anaggregated JSON payload consumed by the (semi-public, Tailscale-exposed)dashboard — already runs a `redact()` function (around lines 2525-2533)that strips GitHub/Anthropic token-shaped strings and home-directory pathsfrom its output before publishing, as defence-in-depth even though nothingupstream is expected to carry a live secret.
The problem: scripts/state-sync.sh's push path (its `do_push()` function,roughly lines 274-391) commits log.jsonl, review-log.jsonl, the cycles/ andreviews/ directories, and cron logs — full, raw per-stage transcripts — tothe state repository with no equivalent redaction step (confirm this bygrepping scripts/state-sync.sh for any reference to redact-style logic —there is none). log.jsonl is deliberately never rotated(scripts/rotate-logs.sh's own header explains why), so this is a long-lived,growing surface. Unlike the dashboard path, nothing here would catch atoken or secret that leaked into a stage's stdout/stderr (a verbose git/curlerror, an accidental `set -x`, a future bug) before it's committed,unredacted, to a second repository, retained indefinitely.
The goal: apply the same class of redaction scripts/publish-dashboard.shalready performs to whatever scripts/state-sync.sh pushes — at minimumlog.jsonl and any other files that could plausibly carry raw command output(stage .out/.err files if state-sync.sh pushes those too — check whatdo_push() actually stages). Reuse the existing redact() implementation andits pattern set (read scripts/publish-dashboard.sh's redact() first) ratherthan writing a second, possibly-inconsistent implementation — extract it toa small shared location both scripts can source if that's cleaner thanduplicating it, using your judgement on which is less invasive given howeach script currently sources its dependencies.
Constraints: do not change what data state-sync.sh pushes (which files,what they contain otherwise) — only add a redaction pass over content thatalready gets pushed. Do not weaken scripts/publish-dashboard.sh's existingredaction while reusing it. Preserve state-sync.sh's existing pushbehaviour, error handling, and retry logic exactly; this should be anadditive filtering step, not a rewrite.
Verification: locate or write a unit test analogous toscripts/publish-dashboard.sh's own redaction test (grep test/*.test.sh for"redact" to find the existing pattern) that plants a token-shaped stringand a home-directory path into a fixture and asserts state-sync.sh's pushedcontent no longer contains it. Run the full suite via scripts/run-tests.shto confirm no regression to state-sync.sh's existing behaviour.
Cost policy: this is ordinary implementation work against a clear patternalready proven elsewhere in the codebase — suited to a mid-cost tier. Ifyou delegate the test-writing to a lower-cost tier once the redaction callsite is decided, review its fixture content carefully (a redaction test isonly as good as its planted secret actually looking like the real thing).
Deliverable: a PR adding the redaction pass to scripts/state-sync.sh's pushpath, plus the corroborating test, referencing this recommendation (R-05)or filing it as a tech-debt item first if you'd rather track it beforestarting (see TECH-DEBT.md's "Filing alongside other work" workflow).Prompt for R-06 — Share san() and other duplicated utilities from lib/ instead of copy-pasting
Section titled “Prompt for R-06 — Share san() and other duplicated utilities from lib/ instead of copy-pasting”Bundles: F-CODE-02 (san()) and F-ARCH-03 (expand_home/cfg/log_event) — bundled because both are the same class of fix (promote a duplicated function to a shared location) touching a small, easily-reviewed set of files; the san() half has real correctness stakes and should be prioritised within this task if time is constrained · Run after: no prerequisites
Context: agent-ops is a ~26,600-line Bash/Perl codebase (lib/, scripts/,agent-cycle.sh, review-cycle.sh) that generally promotes shared logic intolib/*.sh and, where it deliberately keeps more than one implementation,pins them to agree via a shared test (see test/extract-json-result.test.sh'sown header comment for the precedent this task should follow).
The problem, part 1 (higher priority — real correctness risk): `san()`, apath-sanitizing helper (`san() { local s="$1"; printf '%s'"${s//\//__}"; }`), is defined identically in both lib/claim.sh (aroundline 118) and scripts/sweep-orphan-branches.sh (around line 122).scripts/sweep-orphan-branches.sh already sources lib/github-limit.sh andlib/config-schema.sh but not lib/claim.sh, and reimplements san() insteadof importing it. Both uses build the same claim-registry path shape:lib/claim.sh writes claim records under`claims/$(san "$slug")/$(san "$key").json` in the state repo;sweep_branch() in scripts/sweep-orphan-branches.sh (around line 176) readsthe same path shape and treats only a clean 404 as "no live claim" beforedeleting a branch. If lib/claim.sh's san() ever changes (e.g. to encodemore path-unsafe characters) without a matching change landing inscripts/sweep-orphan-branches.sh, the sweep's claim-registry lookups startsilently missing real claims, and it can delete a branch a peer node stillowns — a correctness bug in the exact safety check san() exists toprovide.
The problem, part 2 (lower priority — cosmetic risk): expand_home(),cfg()/cfg_json(), and log_event() are each duplicated between agent-cycle.shand review-cycle.sh with only trivial differences (a closed-over configvariable name, a log field name/target file). Neither has a shared lib/implementation or a pinning test, unlike comparable cases the codebasealready handles correctly (lib/stage-run.sh's header explicitly frames "thetwo copies this replaces were byte-identical" as the problem it fixed).
The goal:1. scripts/sweep-orphan-branches.sh sources lib/claim.sh and uses its san(), deleting its own local copy. Verify the two files' sourcing order and any variable/function name collisions before wiring this in.2. For expand_home()/cfg()/cfg_json()/log_event(): either promote the shared shape into a lib/*.sh file both agent-cycle.sh and review-cycle.sh source (parameterising the small difference — e.g. log_event()'s field name — as a function argument), or, if you judge the churn not worth it at this size, add a one-line comment in both copies stating the duplication is deliberate and where its sibling copy lives, so a future reader doesn't have to re-derive that it's safe to leave alone. Use your judgement on which is more appropriate per function — they need not all get the same treatment.
Constraints: no behaviour change anywhere. For the san() fix specifically,this touches a live safety check for branch deletion — verify extremelycarefully that the imported san() produces byte-identical output to the onebeing removed, for every input scripts/sweep-orphan-branches.sh actuallypasses it, before deleting the local copy.
Verification: run the full suite via scripts/run-tests.sh. Specificallylocate and run whatever test(s) cover scripts/sweep-orphan-branches.sh'sclaim-registry interaction (grep test/ for sweep-orphan-branches orsweep_branch) and lib/claim.sh's own tests, confirming both still passafter the san() consolidation. Run scripts/lint-shell.sh (shellcheck) afterany lib/ sourcing changes.
Cost policy: the san() fix is small and mechanical but touches a realsafety check — do it yourself or have it reviewed carefully at a mid-costtier or above rather than delegating unsupervised to a low-cost tier, giventhe branch-deletion stakes if the consolidation is subtly wrong. Theexpand_home/cfg/log_event work is genuinely mechanical and suits a low-costtier.
Deliverable: one or two PRs (san() fix can stand alone; the smaller utilityconsolidation can be its own PR or the same one, your judgement) with testruns confirming no regression.Prompt for R-07 — Pin the Docker image’s OS packages and claude CLI version
Section titled “Prompt for R-07 — Pin the Docker image’s OS packages and claude CLI version”Bundles: R-07 only (both are the same “pin what’s currently floating in the Dockerfile” fix, touching one file) · Run after: no prerequisites
Context: agent-ops deploys as a single Docker image (deploy/docker/Dockerfile,Ubuntu 24.04 base) that runs every pipeline role. The Dockerfile alreadypins and checksum-verifies two tools not available from a signed aptrepository — supercronic and shellcheck (find these in the Dockerfile anduse their pinning pattern, including the checksum-verification style, asyour reference for consistency).
The problem: the same Dockerfile installs OS packages (jq, curl, python3,perl, git, and others — search for `apt-get install -y` to find the fulllist) with no version pins, and installs the `claude-code` npm package via`ARG CLAUDE_CODE_VERSION=latest` / `npm install -g"@anthropic-ai/claude-code@${CLAUDE_CODE_VERSION}"` — deliberatelyunpinned per the adjacent comment, unlike supercronic/shellcheck a fewlines away. Because the image is the deployment artefact (nodes pull thebuilt image, never a git branch), rebuilds of the same commit days apartcan silently produce different behaviour if either an OS package receivesan update or claude-code publishes a new release in between — andclaude-code specifically is the dependency with the deepest reach (it's theruntime for every stage's tool/token access).
The goal: pin claude-code to a specific major.minor version (not `latest`),bumped deliberately in its own PR when an upgrade is wanted, matching howsupercronic/shellcheck are already handled. For the OS package layer,either pin the base image to a specific digest (`ubuntu:24.04@sha256:...`)for build reproducibility, or — if you judge that not worth themaintenance cost for this project's current stage — leave OS packagesfloating but add a comment to the Dockerfile explicitly stating that's adeliberate, reasoned trade-off (matching this codebase's convention ofnever leaving a deviation from its own stated discipline unexplained).
Constraints: do not break the image build. If you pin claude-code to aspecific version, verify that version is actually compatible with how thiscodebase invokes it (check lib/stage-run.sh's claude invocation flagsagainst that version's supported flags/behaviour) before committing to apin. Do not change any other part of the Dockerfile.
Verification: build the image locally (`docker build -fdeploy/docker/Dockerfile -t agent-ops .` per the Dockerfile's own headercomment) and confirm it succeeds. Run scripts/doctor.sh inside a containerbuilt from the new image to confirm claude-code and the pinned OS packagesare present and functional. Run the test suite via scripts/run-tests.shagainst the newly-built image.
Cost policy: this is small, well-specified, mechanical work (pin a version,verify the build) suited to a low-cost tier for the pinning itself; if youdelegate the build/verification step, review its output rather than trusta "build succeeded" claim blindly, since a broken pin can fail in ways thatonly surface at runtime, not at build time.
Deliverable: a single PR pinning claude-code's version (and optionally thebase image digest), with the local build/test verification results notedin the PR description.Prompt for R-08 — Harden the CI test-running discipline
Section titled “Prompt for R-08 — Harden the CI test-running discipline”Bundles: three independent pieces (CI timeout; splitting slow tests; landing an already-scoped fixture fix) bundled into one prompt because they’re all “make CI’s test running more robust” and can be split into separate PRs by whoever executes this, but share enough context to specify together · Run after: no strict prerequisites
Context: agent-ops's test suite (test/*.test.sh, 140 files, ~52,000 lines)runs locally via scripts/run-tests.sh (which wraps each test in `timeout600 bash "$t"`) and in CI via .github/workflows/build-image.yml's "Run thetest suite inside the image" step, which is supposed to mirror the localrunner exactly (both run inside the project's own built Docker image, perscripts/run-tests.sh's own header comment on why that matters — jq versiondrift between the host and the image is otherwise a source of misleadingfailures).
Three independent problems to fix:
1. CI has no timeout. scripts/run-tests.sh applies `timeout 600` per test locally, but .github/workflows/build-image.yml's equivalent step runs the identical per-test loop with no timeout at all, and the job itself sets no `timeout-minutes` — so in CI, a hang is bounded only by GitHub Actions' default 6-hour job timeout. The suite includes tests exercising real signal/process-group handling with background `sleep` stand-ins (test/stage-watchdog.test.sh, test/finish-then-continue.test.sh, test/stage-gaps.test.sh) — exactly the kind of test a watchdog-kill regression would turn into a genuine multi-hour CI hang rather than a fast, clear failure.
2. Nine test files are severe runtime outliers relative to the rest of the suite: test/doctor.test.sh (~6m23s), test/toggle.test.sh (~5m41s), test/review-not-before.test.sh (~4m49s), test/publish-dashboard.test.sh (~4m25s), test/review-claim.test.sh (~3m19s), test/config-schema.test.sh (~3m02s), test/role.test.sh (~2m54s), test/state-sync.test.sh (~1m57s), and test/coordinator-input-wiring.test.sh (~1m22s) — together ~34 minutes, against README.md's "Running the tests" section describing "a few minutes" for the *entire* 140-file suite (a full run actually takes roughly 45-50 minutes on comparable hardware). Several work by repeatedly invoking the real, large entry-point scripts (agent-cycle.sh, review-cycle.sh, or doctor.sh) as subprocesses to prove an end-to-end property (e.g. "the startup schema gate refuses a bad config"), rather than calling library functions directly.
3. tech-debt/TD-PPagop-26082302.md (open) documents that TD-PPagop-26082201's fix — clearing ambient PULLWRIGHT_APPROVER_APP_ID / _INSTALLATION_ID / _PRIVATE_KEY_PATH in test/config-schema.test.sh's `_assert_doctor_check` fixture helper before every doctor.sh fixture — correctly stopped one fixture's environment leaking into another, but as a side effect removed the suite's only coverage of doctor.sh's reconciliation between a set PULLWRIGHT_APPROVER_APP_ID and a set approver_app_id config key (see lib/approver-token.sh for that reconciliation logic). Read TD-PPagop-26082302.md for its own proposed fixture design before starting this piece.
The goal (three independent acceptance criteria — treat as separabletasks):1. CI's test-suite step in .github/workflows/build-image.yml has an explicit bound — either a `timeout-minutes:` on the job, or the same `timeout 600` wrapping scripts/run-tests.sh already applies per test, ported into the CI step's invocation.2. README.md's "Running the tests" section is corrected to state the suite's actual approximate runtime rather than "a few minutes." The nine identified slow files have their real-subprocess-invoking assertions (the minority that genuinely need to exercise agent-cycle.sh/review-cycle.sh/doctor.sh end-to-end as a subprocess) separated from assertions that only need the underlying library functions, or their repeated subprocess spawns consolidated into fewer invocations — so that filtering to one of these files via `scripts/run- tests.sh <filter>` for a fast local check no longer costs minutes. Judge file-by-file how much can genuinely move to direct function calls versus how much needs the real subprocess to prove the property under test — do not weaken what's actually being verified for the sake of speed.3. tech-debt/TD-PPagop-26082302.md's proposed fixture (pairing a *mismatched* PULLWRIGHT_APPROVER_APP_ID and approver_app_id, and asserting doctor.sh's reconciliation logic catches the mismatch) is implemented in test/config-schema.test.sh, restoring the coverage that was inadvertently dropped.
Constraints: task 1 must not make CI flakier — 600 seconds (matching thelocal runner) is a reasonable per-test bound unless you find evidence aspecific test legitimately needs longer, in which case say so rather thansilently applying a blanket timeout that breaks it. Task 2 must not reducewhat's actually verified — if a subprocess invocation is the only way toprove a given property (e.g. "the real entry point script, unmodified,refuses a bad config"), keep it; only convert assertions that were usingthe subprocess as an expensive way to test something a library functioncall could test just as validly. Task 3 must follow tech-debt/TD-PPagop-26082302.md's own proposed approach rather than inventing a different one,unless you find its approach doesn't work, in which case explain why.
Verification: for task 1, confirm the workflow YAML is syntactically validand the timeout value is reasonable by checking a full CI run completeswell within it under normal conditions. For task 2, time the affected filesbefore and after your change and confirm a meaningful reduction, whilerunning the full suite via scripts/run-tests.sh to confirm no test thatpreviously passed now fails or is skipped. For task 3, confirm the newfixture actually fails against the pre-TD-PPagop-26082201 doctor.shbehaviour (i.e. it genuinely tests the reconciliation) and passes againstcurrent doctor.sh.
Cost policy: task 1 is small and mechanical (low-cost tier). Task 2 needsjudgement about what each assertion is actually proving — do this at amid-cost tier, and don't delegate the "which assertions can move" analysisto a low-cost tier, since getting it wrong silently weakens test coverage.Task 3 is well-specified by the existing tech-debt item and suits alow-to-mid-cost tier. Verify all delegated work before integrating it.
Deliverable: up to three separate PRs (one per task, since they're fullyindependent), each following this repo's normal conventions. Task 3's PRshould flip tech-debt/TD-PPagop-26082302.md's frontmatter to `status:resolved` per TECH-DEBT.md's resolution convention.Prompt for R-09 — Surface the three swallowed-error/observability gaps already filed as tech debt
Section titled “Prompt for R-09 — Surface the three swallowed-error/observability gaps already filed as tech debt”Bundles: three independent, already-scoped fixes bundled into one prompt for context-sharing efficiency (all are “an error is silently swallowed somewhere the fleet needs to see it”) — land as three separate PRs, one per tech-debt item, since there’s no shared code path between them · Run after: no prerequisites
Context: agent-ops is an autonomous pipeline that runs unattended; when itsilently swallows an error, nobody finds out until a human happens tonotice symptoms and digs through raw logs by hand — this has alreadyhappened three times, each now tracked as its own open tech-debt item witha specific, already-designed fix. Read each tech-debt file in full beforestarting its fix — they contain more detail than this prompt restates.
Fix 1 — tech-debt/TD-PPagop-26082322.md: lib/issue-priority.sh'sissue_priority_apply() sends its GraphQL setIssueFieldValue mutation withits error output discarded, collapsing every possible failure to a bare{"applied": false, "reason": "mutation-failed"} — no detail about *why* itfailed. This already caused a real 3-day-invisible incident: a one-tokenGraphQL schema mismatch made every Priority write fail identically, and onenode logged 14 identical, unhelpful warnings before anyone read the actualerror. Fix: capture the mutation's actual error output and carry at leastits first line into the returned result (e.g. {"reason": "mutation-failed","error": "..."}) so the caller's warning can name the specific problem.
Fix 2 — tech-debt/TD-PPagop-26082306.md: lib/github-limit.sh'sgithub_auth_probe() only classifies a credential fault when it sees anexplicit HTTP 401 / "Bad credentials" match. When GH_TOKEN is unset orempty, `gh api rate_limit` fails locally with a message ("no authenticationtoken" / "gh auth login") that matches neither pattern, so the probereports `unreachable` instead of `unauthorized` — and requirement 2.0b'shandling of `unreachable` lets a full Co-Ordinator engagement run everycycle, every claim inside it then failing, indefinitely. Fix: extend theprobe's stderr classification to recognise the "no authentication token" /"gh auth login" message shape (or check GH_TOKEN/GITHUB_TOKEN foremptiness before making the call at all) and report `unauthorized` with anaccurate detail string in that case.
Fix 3 — tech-debt/TD-PPagop-26082307.md: agent-cycle.sh'srefinement_traceability_fault (requirement 17f) has two independent silentfailure modes. (a) It tests verbatim containment of refinement text;ordinary paste drift or a lightly-edited comment defeats this test with nowarning, counter, or dashboard signal — just a silent skip. (b) Its commentre-fetch swallows its own failure (pattern: `gh api ... 2>/dev/null ||true`), so a degraded token, rate limit, or malformed comment_url disarmsthe entire check while it still reads as passing. Fix (two parts, as thetech-debt item scopes them): tolerate non-substantive paste drift in thecomparison (e.g. collapse whitespace, or match a distinctive contiguousslice rather than requiring the whole text to match verbatim) rather thanrequiring exact containment; and route the comment-fetch's degraded-readpath through the same warning mechanism this file's other degraded readsalready use (look at how default_branch/commit_ts reads handle their owndegradation for the existing pattern to follow) instead of silentlyswallowing the failure.
The goal: implement all three fixes as scoped above and in their respectivetech-debt files. Each is independent — no shared code path, no orderingdependency between them.
Constraints: do not change any of these functions' behaviour beyond what'sdescribed — this is about making existing failures observable, notchanging what counts as success or failure (except Fix 3a, where thecontainment test's tolerance is deliberately being loosened as scoped — donot widen it further than "tolerate non-substantive drift", it must stillcatch genuinely unrelated text).
Verification: for each fix, write or extend a test that reproduces theoriginal silent-failure scenario and confirms the fix surfaces it(Fix 1: a mutation that fails should produce a result whose reason namesthe actual error; Fix 2: an empty GH_TOKEN should classify as unauthorized,not unreachable; Fix 3: a comment with minor whitespace/formatting driftfrom the original refinement text should still be recognised as tracingback to it, and a forced comment-fetch failure should produce a visiblewarning rather than a silent pass-through). Run the full suite viascripts/run-tests.sh to confirm no regression.
Cost policy: each of these three fixes is small, well-specified, andalready fully designed in its tech-debt record — suited to a mid-cost tierend to end, including the test-writing. No need for a high-capability tieron any of them, but verify each one's test actually reproduces theoriginal failure mode before trusting the fix.
Deliverable: three separate PRs, one per fix, each flipping its tech-debtitem's frontmatter to `status: resolved` (today's date, this PR's number in`ref:`) per TECH-DEBT.md's resolution convention — body left in place,file never deleted or renamed.Prompt for R-10 — Bound publish-revert-rate.sh’s cumulative re-mining
Section titled “Prompt for R-10 — Bound publish-revert-rate.sh’s cumulative re-mining”Bundles: R-10 only (already fully scoped as tech debt TD-PPagop-26082204) · Run after: no prerequisites
Context: agent-ops's scripts/publish-revert-rate.sh computes threerevert-rate figures per repository: `rolling` (a 14-day window), `recent`(48 hours), and `cumulative` (since a fixed baseline date recorded inrevert_rate_baseline.generated, currently 2026-08-15). It works by callingscripts/mine-merge-history.sh's mine_window()/mine_repo() functions, whichcost roughly 3 GitHub API calls per merged PR mined.
The problem (tracked as open tech debt tech-debt/TD-PPagop-26082204.md —read it first for full detail): unlike `rolling` and `recent`, which bindtheir window to a constant-size offset from "now" (so their mining coststays roughly constant over time), `cumulative` binds its `--since` to thefixed baseline date — so every day that passes, the population of PRs itre-mines from scratch grows, and its GitHub API cost grows with it,unboundedly, forever. This is exactly the kind of silent, ever-growing costagainst a shared rate-limit budget this codebase has a strong track recordof catching and fixing elsewhere (see the tech-debt register'sTD-PPagop-26072201 through TD-PPagop-26081506 lineage for the establishedpattern this fix should follow in spirit).
The goal: implement one of the two remedies tech-debt/TD-PPagop-26082204.mditself names (read the file for its exact proposed approaches) — mostlikely either (a) memoising each PR's settled outcome (merged, reverted,or not) keyed by repo+PR-number so a previously-mined PR is never re-mined,or (b) rolling the cumulative figure forward incrementally frompublish-revert-rate.sh's own prior output (revert-rate.jsonl) rather thanrecomputing from scratch each run. Follow whichever approach the tech-debtitem itself recommends unless you find a concrete reason it doesn't work,in which case explain why and justify your alternative.
Constraints: the `cumulative` figure's actual reported value must notchange (this is a performance fix, not a metric-definition change) — a PRthat would have been counted under the current from-scratch approach muststill be counted under the new incremental approach. Do not change`rolling` or `recent`'s behaviour at all.
Verification: run scripts/publish-revert-rate.sh against a repository witha non-trivial merge history and confirm the `cumulative` figure matcheswhat the current (pre-fix) implementation produces for the same input.Confirm the GitHub API call count for a `cumulative` run no longer growswith days-since-baseline (e.g. by counting API calls made, or byinspecting that the mining function is now bounded by "new PRs since lastrun" rather than "all PRs since baseline"). Run the relevant test file(s)(grep test/ for publish-revert-rate or mine-merge-history) and the fullsuite via scripts/run-tests.sh.
Cost policy: this is well-specified implementation work against a clear,already-designed remedy — suited to a mid-cost tier.
Deliverable: a PR implementing the fix, flippingtech-debt/TD-PPagop-26082204.md's frontmatter to `status: resolved` perTECH-DEBT.md's convention.Prompt for R-11 — Make the dashboard’s clickable rows/cards keyboard-accessible
Section titled “Prompt for R-11 — Make the dashboard’s clickable rows/cards keyboard-accessible”Bundles: R-11 only · Run after: no prerequisites
Context: agent-ops's local dashboard, dashboard/index.html, is a singleinline HTML/CSS/JS file (no build step). It already has one fullykeyboard-accessible interactive widget — the PR-reference card (linesroughly 391-694) — built on native `<a>` anchors with `role="note"` +`aria-describedby`, documented in docs/DASHBOARD-SPEC.md (around lines1306-1318) as supporting keyboard focus and Enter-activation.
The problem: three other interactive surfaces in the same file areclick-only. Cycle rows that expand per-stage detail (built via `el("tr",{class:"clickable"}, cells)` around line 1749, with its click handleraround line 1751), void-item rows that expand truncated text (around line1919, handler around line 1925), and fleet-node cards that filter thecycle list/log to one node (handler around line 1423) are all plain `<tr>`or `<div>` elements styled only with `cursor:pointer` (see the `.card.clickable` and `tbody tr.clickable` CSS rules around lines 73 and 97) —none has `tabindex`, `role="button"`, or a `keydown` handler (confirm witha search for `tabindex`/`role.*button`/`keydown` across the file — the onlymatch is an unrelated global Escape handler around line 682).docs/DASHBOARD-SPEC.md describes these three widgets only in terms ofclicking, not keyboard interaction.
The goal: all three `.clickable` interaction points become keyboard-reachable and keyboard-activatable, matching the PR-reference card'sexisting pattern: each gets `tabindex="0"` and `role="button"`, plus a`keydown` handler that triggers the same action as the existing clickhandler on Enter or Space (and should call `event.preventDefault()` forSpace to avoid scrolling the page). Update docs/DASHBOARD-SPEC.md'sdescription of each of these three widgets to document the added keyboardsupport, matching how it already documents the PR-reference card's.
Constraints: do not change what each interaction does when triggered, onlyhow it can be triggered. Do not change the visual appearance of theseelements (a focus outline appearing on keyboard focus is expected and fine;don't suppress it). Follow the existing code's style (the `el()` helper'sattribute-object pattern) rather than introducing a different way ofbuilding these elements.
Verification: dashboard/index.html has a Node-based rendering harness,test/dashboard-render-harness.js, exercised viatest/dashboard-render.test.sh — run it and confirm it still passes afteryour change (extend it with an assertion that the three interaction pointsnow carry `tabindex`/`role`/a keydown listener, if the harness's designmakes that practical — use your judgement on whether that fits itsexisting test style). Since no browser is required to verify markupattributes are present, you do not need live browser testing for thischange, but if one is available in your environment, manually tab to eachof the three interaction points and confirm Enter/Space triggers the samebehaviour as a click.
Cost policy: this is small, well-specified, single-file, pattern-matchingwork (copy an existing pattern to three more places) — suited to alow-cost tier end to end.
Deliverable: a single PR with the dashboard/index.html anddocs/DASHBOARD-SPEC.md changes together (per this repo's CLAUDE.md rulethat a behaviour change and its spec update land in the same PR).Prompt for R-12 — Add a table of contents to README.md and the implementation spec
Section titled “Prompt for R-12 — Add a table of contents to README.md and the implementation spec”Bundles: R-12 only · Run after: no prerequisites
Context: agent-ops's root README.md is 2,381 lines with 89 headings, anddocs/IMPLEMENTATION-PIPELINE-SPEC.md is 17,320 lines — both already relyheavily on internal markdown anchor links (e.g. README.md links to`#the-landing-gate`, `#blocked-items-and-the-enabler`, and similar targetsthroughout its own body) but neither document has a table of contents atits top. This repository already has a precedent for a generated,CI-checked documentation region: scripts/render-config-table.sh rendersREADME.md's and each spec's configuration tables from config.schema.json,checked in CI via .github/workflows/config-table.yml and its own`--check` flag — follow this same pattern (a generating script, checked inCI) rather than a one-off hand-written ToC that will drift.
The problem: a reader of either document has no way to see its shapewithout scrolling through it or grepping — despite the documents' ownextensive internal cross-linking being evidence the authors already knowprecisely which sections matter enough to jump to.
The goal: both README.md and docs/IMPLEMENTATION-PIPELINE-SPEC.md open witha table of contents (a nested list of links to each `##`/`###` heading,using GitHub's standard heading-anchor-slug convention) that is generatedfrom the document's actual headings rather than hand-maintained, andchecked for staleness in CI the same way the config tables already are.
Constraints: follow this repo's existing generated-region conventionexactly — CLAUDE.md documents this pattern (see its "Generated regions"section): a clearly marked start/end comment pair(e.g. `<!-- toc:start -->` / `<!-- toc:end -->`) that a script regenerates,with a `--check` mode that fails if the committed content doesn't matchwhat regeneration would produce, wired into the same CI job (or a siblingjob) that already runs config-table.yml's check. Do not hand-edit insidethe generated region once the tooling exists — the whole point, perCLAUDE.md's existing convention for the config tables, is that only thegenerator's output survives a regeneration. Do not touchdocs/REVIEW-PIPELINE-SPEC.md or docs/DASHBOARD-SPEC.md in this task unlessyou judge it trivial to extend the same script to them once written (yourcall — not required for this recommendation's acceptance criteria, but anatural extension if cheap).
Verification: run your new script's `--check` mode against the repositoryimmediately after generating and committing the ToCs, and confirm itpasses. Confirm CI's existing config-table.yml-style check (or a newsibling workflow you add for the ToC) actually catches a deliberatelystale ToC (test this by temporarily adding a heading, confirming `--check`fails, then removing it).
Cost policy: this is well-specified, mechanical scripting work (parseheadings, render a nested list, diff against committed content) closelymodelled on an existing script in the same repo — suited to a low-to-mid-cost tier.
Deliverable: a PR adding the ToC-generation script, the generated ToCregions in both documents, and (if you choose to add one) a CI check —following CLAUDE.md's generated-region convention precisely enough that afuture contributor reading CLAUDE.md would recognise this as the samepattern already established for the config tables.Prompt for R-13 — Lower the barrier to local development without full production infrastructure
Section titled “Prompt for R-13 — Lower the barrier to local development without full production infrastructure”Bundles: R-13 only · Run after: no prerequisites
Context: agent-ops is currently operated by a single person; its roadmap(docs/ROADMAP.md) plans a future where external contributors and eventualcustomers are involved. Today, exercising the pipeline's actual logiclocally requires Docker, a live GitHub token with write access, aconfigured git identity, Tailscale (for the dashboard), and Claudecredentials — there is no mocked or fixture-based path for iterating onpipeline logic without all of that.
The problem: this is proportionate friction for the project's current,single-operator stage, but it will matter more as docs/ROADMAP.md'sproductisation work (its D1/D9 decisions) brings in contributors who arenot the operator and do not have (or should not need) live write-scopedcredentials to iterate on pipeline logic.
The goal: identify and implement a minimal path for exercising corepipeline logic (at least: Co-Ordinator candidate selection and Implementerdispatch, since these are the highest-value paths to iterate on withoutlive credentials) against mocked or fixture-replayed GitHub API responses,rather than requiring a live token and real repository access. Use thisrepo's existing test/fixtures/ directory and its conventions as yourstarting point for what a mock/fixture shape should look like — do notinvent an unrelated pattern.
Constraints: this is explicitly lower priority and lower urgency than everyother recommendation in this review (the project's current single-operatoraudience does not strictly need this yet) — do not let it block or delayhigher-priority work, and treat "not urgent" as license to keep the scopesmall rather than building a comprehensive mocking framework. Do not changehow the pipeline behaves against real GitHub in production — this ispurely an additive local-development affordance.
Verification: demonstrate that a Co-Ordinator (or Implementer) dispatch canrun end-to-end against your mocked/fixture GitHub responses, with no liveGH_TOKEN required, and produces the expected candidate selection (or PRplan) for at least one representative fixture scenario. Document how to useit in README.md's development section.
Cost policy: this is exploratory, judgement-heavy design work (what tomock, how much fidelity is needed, how it should integrate with theexisting test/fixtures/ conventions) — do the design at a high-capabilitytier; once the shape is decided, the mechanical work of writing individualfixture files can be delegated to a lower-cost tier.
Deliverable: a PR adding the mocking/fixture-replay mechanism, at least oneworked example exercising it, and a short README.md section explaining howto use it for local iteration.Prompt for R-14 — Add baseline contributor/security governance docs ahead of productisation
Section titled “Prompt for R-14 — Add baseline contributor/security governance docs ahead of productisation”Bundles: four small, independent documentation additions (SECURITY.md, a licence-decision note, CONTRIBUTING.md, issue/PR templates) bundled because they’re all “governance documentation currently missing” and can reasonably land as one PR, though SECURITY.md is the one with actual urgency and should not wait on the other three if time is short · Run after: no prerequisites
Context: agent-ops is a single-operator internal tool (operator:warwickallen, per CODEOWNERS) currently transitioning toward a broaderproduct (docs/ROADMAP.md). It has no SECURITY.md, no CONTRIBUTING.md, andno .github/ISSUE_TEMPLATE/ or .github/PULL_REQUEST_TEMPLATE.md. Its currentLICENCE is MIT, but docs/ROADMAP.md's decision D5 states the eventualproduct licence is an open question ("Source-available (BSL/FSL-family) …exact licence is an open question with a Phase 1 decide-by gate") — nothingtoday signals to a reader that the licence may change.
The goal (four small, independent additions):1. A SECURITY.md at the repository root naming a private vulnerability- disclosure contact (an email address or a private reporting mechanism — use your judgement on what's appropriate given the repository owner is a single individual; do not invent contact details, ask if none are evident from existing files like CODEOWNERS or README.md's own contact conventions).2. A short note — in README.md's introduction or docs/ROADMAP.md's own summary near D5 — flagging that the current MIT licence is expected to change ahead of the roadmap's productisation, with a pointer to D5 for detail.3. A CONTRIBUTING.md pointing at CLAUDE.md's existing branch-workflow and tech-debt conventions (CLAUDE.md is written for an operating AI agent; CONTRIBUTING.md should restate the same conventions for a human reader, not duplicate CLAUDE.md's content wholesale — summarise and link).4. .github/ISSUE_TEMPLATE/ and .github/PULL_REQUEST_TEMPLATE.md, with the issue template prompting a filer to consider setting the `Priority` field (README.md's issue-priority section explains what this field does and why it matters for queue ordering) and the PR template restating the Conventional Commits title requirement CLAUDE.md already documents.
Constraints: keep every document short — these are pointers and policystatements, not full guides; this repository already has CLAUDE.md andREADME.md carrying the substantive detail, and these new documents shouldlink to them rather than duplicate them. Do not change any existingdocument's content beyond the small addition described in item 2.
Verification: no automated check applies to most of this — read each newdocument once complete and confirm it accurately reflects this repository'sactual current conventions (cross-check CONTRIBUTING.md's claims againstCLAUDE.md, the PR template's claims against .github/workflows/commit-format.yml's actual enforcement). If this repo has any markdown-lint ortrailing-whitespace check (check package.json/CI workflows — CLAUDE.mdmentions a whitespace/format gate), run it against the new files.
Cost policy: this is small, mechanical documentation work suited to alow-cost tier throughout — no part of this needs a higher-capability tier.
Deliverable: one PR (or up to four small ones, your judgement) addingSECURITY.md, the licence note, CONTRIBUTING.md, and the issue/PR templates.Prompt for R-15 — Small developer-experience consistency fixes
Section titled “Prompt for R-15 — Small developer-experience consistency fixes”Bundles: five small, independent, mechanical consistency fixes (a set -e convention, --help on four scripts, an optional Makefile, an optional .editorconfig) bundled into one PR since none has enough substance to warrant its own review round · Run after: no prerequisites
Context: agent-ops is a ~250-script Bash/Perl codebase with generallystrong internal consistency (universal `[[ ]]` over `[ ]`, consistentunderscore-prefixed private-helper naming), but a handful of smallconventions are applied inconsistently.
Four independent fixes:1. `set -e` usage: of 47 scripts/*.sh files that set shell options, 42 use `set -uo pipefail` and 5 use `set -euo pipefail` (find them by grepping for `set -e`), with no documented rule for which a new script should pick. Decide and document one default convention (recommendation: standardise on `set -uo pipefail`, matching the majority, with `-e` as a commented, deliberate opt-in per file where genuinely wanted) — add one sentence stating the rule to scripts/lint-shell.sh's header comment (or wherever this repo's shell conventions are otherwise documented — check CLAUDE.md first). Do not mass-convert the 5 outlier files unless you verify each one's behaviour is unaffected by the change (an `-e` script relying on early-exit-on-error semantics may behave differently without it) — where in doubt, leave outliers as-is and just document the rule going forward.2. `--help`: agent-cycle.sh, review-cycle.sh, scripts/serve-dashboard.sh, and scripts/open-dashboard.sh have no `-h`/`--help` handling, unlike scripts/doctor.sh, scripts/watch-node.sh, scripts/run-tests.sh, and scripts/state-sync.sh, which all have a `usage()` function reachable via `-h`/`--help`. Add the same convention to the four missing scripts, matching the existing scripts' usage-text style and exit-code convention (check scripts/doctor.sh's pattern as your reference).3. (Optional, your judgement on value) A root-level Makefile with targets wrapping the existing lint/test/build entry points (e.g. `make lint` → scripts/lint-shell.sh, `make test` → scripts/run-tests.sh, `make build-image` → the documented docker build command) — purely additive, does not replace any existing script.4. (Optional, your judgement on value) A root-level .editorconfig with shell-appropriate defaults (2-space indent, LF line endings, trim trailing whitespace — check whether a trailing-whitespace CI gate already exists per CLAUDE.md and make sure the .editorconfig doesn't contradict it).
Constraints: no behaviour change to any script's actual functionality —these are purely additive (a new flag, a new file) or documentation-only(the `set -e` convention note). Do not touch the 5 files that already use`set -euo pipefail` unless you've verified doing so is safe, per item 1'sguidance above.
Verification: for item 2, run each of the four scripts with `-h`/`--help`and confirm it prints usage and exits 0 without side effects. Runscripts/lint-shell.sh (shellcheck) after any changes. Run the full suitevia scripts/run-tests.sh to confirm no regression.
Cost policy: this whole task is mechanical, well-specified, low-risk work— suited entirely to a low-cost tier, with no part needing escalation to ahigher tier.
Deliverable: a single PR bundling whichever of these four items youcomplete (item 1's documentation note and item 2's four `--help` additionsare the core of this recommendation; items 3-4 are optional nice-to-haves —include them only if they're low-effort in context).Prompt for R-16 — Dashboard label association and a documented data inventory ahead of multi-tenancy
Section titled “Prompt for R-16 — Dashboard label association and a documented data inventory ahead of multi-tenancy”Bundles: two small, independent fixes (a dashboard accessibility fix, a documentation addition) bundled purely for PR convenience, not because they’re substantively related · Run after: no prerequisites
Context: agent-ops's dashboard (dashboard/index.html) and its overall datahandling were both reviewed. Two small, unrelated gaps were found.
Fix 1 (dashboard/index.html): the cost-window control's `costWindowControl()`function (around lines 834-851) builds a `<label>` as a plain sibling of its`<select class="costwindow">`, with no `for`/`id` pairing or wrapping — sothe label has no programmatic association with the control for assistivetechnology. Contrast the auto-refresh checkbox elsewhere in the same file(around line 258): `<label><input type="checkbox" id="autorefresh"checked> auto-refresh</label>` — correctly nested so the association isimplicit. Fix: either wrap the `<select>` inside the `<label>` (matchingthe auto-refresh checkbox's pattern) or add a matching `for`/`id` pair.
Fix 2 (documentation): no document in this repository catalogues whatpersonal or sensitive data the pipeline touches, stores, or retains(GitHub usernames, PR/issue text, retention periods for cycles_retained /log_retained_bytes in config.json). This is low-risk today (the datatouched is already public GitHub metadata, and the audience is oneoperator) but will matter more once docs/ROADMAP.md's planned multi-tenantgeneralisation proceeds to act on other organisations' repositories. Fix:add a short section (a new heading in README.md, or a small newdocs/DATA-HANDLING.md if that fits this repo's existing docs/ organisationbetter — check how docs/METERING-SCHEMA.md is referenced from README.mdfor the pattern to follow) stating what data is read, what's stored, forhow long (reference the actual config keys that govern retention), andwhere (which repositories/artifacts).
Constraints: Fix 1 must not change the cost-window control's visiblelayout or behaviour, only its accessibility markup. Fix 2 should describewhat the pipeline *actually* does today (verified against config.schema.jsonand the relevant lib/scripts/ code), not aspirational future behaviour —if you're not sure whether something is retained or how long, check thecode/config rather than guessing.
Verification: for Fix 1, run test/dashboard-render.test.sh (the dashboard'sexisting rendering test harness) and confirm it still passes; if practical,confirm in a browser or via markup inspection that the label/selectassociation is now correct (e.g. clicking the label text now focuses theselect). For Fix 2, cross-check every claim in your new documentationagainst the actual config.schema.json keys and code it describes.
Cost policy: both fixes are small and well-specified, suited to a low-costtier.
Deliverable: a single PR with both fixes (or two small PRs, yourjudgement).Prompt for R-17 — Add shell/Perl-aware SAST scanning
Section titled “Prompt for R-17 — Add shell/Perl-aware SAST scanning”Bundles: R-17 only · Run after: no prerequisites, but be aware this is exploratory (a spike) rather than a guaranteed-shape implementation task
Context: agent-ops runs CodeQL (.github/workflows/codeql.yml) as part ofits CI, but that workflow's own comments note it only scans the `actions`language (GitHub Actions workflow YAML) because CodeQL has no Shell or Perlsupport — leaving the ~27,000 lines of lib/, scripts/, and the two cycleentry points (agent-cycle.sh, review-cycle.sh) with no automatedsecurity-pattern scanning beyond shellcheck's style/correctness checks(shellcheck is not a security scanner — it catches quoting bugs andportability issues, not e.g. injection-shaped patterns as a category).
The goal: evaluate and, if it proves viable, add a shell/Perl-aware staticanalysis tool to CI as a genuine additional security-scanning layeralongside the existing shellcheck gate. Semgrep (with its community shellruleset) is a reasonable starting candidate given its existing communityrule coverage for shell, but evaluate what's actually available andmaintained at the time you do this work rather than assuming Semgrep isstill the best choice.
Approach — treat this as a spike first, not a guaranteed CI addition:1. Run your chosen tool's shell ruleset against this repository's current lib/, scripts/, agent-cycle.sh, and review-cycle.sh and record its findings.2. Triage the findings by hand: how many are genuine (even if low-severity) versus false positives against this codebase's actual patterns and conventions? A tool with a high false-positive rate on ~250 scripts of this specific style is worse than no tool, since it trains reviewers to ignore it.3. If the signal-to-noise ratio looks workable, add it to CI as a non-blocking (report-only, e.g. annotate but don't fail the check) workflow initially, following this repo's existing workflow-authoring conventions (compare shellcheck.yml and codeql.yml for style: pinned tool version where relevant, `pull_request` not `pull_request_target`, minimal `permissions:`). Only propose making it a blocking/required check in a follow-up, after it's been observed running non-blocking for a period and its noise level is confirmed acceptable — do not make it blocking in this same task.4. If the signal-to-noise ratio looks unworkable for every tool you evaluate, document that finding (which tools you tried, what you found) rather than forcing a bad tool into CI — a documented "we looked and it wasn't worth it yet" is a valid outcome for this task.
Constraints: do not make any new scanning workflow a required/blockingcheck without the non-blocking observation period described above. Followthis repo's existing workflow security conventions exactly (no`pull_request_target` on anything that runs on PR content, matching everyexisting PR-triggered workflow's stated reasoning for avoiding it).
Verification: if you add a workflow, confirm it runs successfully on thisrepository's actual code (not just a toy example) and produces output ahuman can act on. If you conclude no tool is currently viable, your"verification" is a clear written record of what you tried and why itdidn't meet the bar.
Cost policy: the evaluation/triage work needs judgement (assessingfalse-positive rate against this specific codebase's idioms) — do this ata mid-cost tier. Writing the resulting CI workflow, once the tool ischosen, is mechanical and suits a low-cost tier.
Deliverable: either a PR adding a new non-blocking CI workflow (with theevaluation notes in the PR description), or, if no tool proved viable, ashort write-up (as a PR comment, an issue, or a tech-debt item perTECH-DEBT.md's filing workflow) recording what was evaluated and whynothing was adopted yet.