Skip to content
Back to skills

Delivery Tick

ASecurity

One orchestrator tick of the agentic delivery loop - reconcile the board, ask tick-plan.sh for the action plan, and execute it in order (deterministic merges and promotions first, then exactly ONE agent action — or, with "--parallel N", one batch of up to N independent agent actions awaited together). With --auto-merge (opt-in, off by default) the plan may merge fully-approved, clean, green PRs through tick-merge.sh, which gates the merged result first. Designed as the /loop target.

  • 5 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 6, 2026
ai-agentsgobashnodeapibackend

Works with

  • cli
  • api

Security analysis

A100/100

Scanned November 29, 2026

npx -y skills add blakemartz/delivery-loop --skill delivery-tick --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Delivery Tick?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Delivery Tick
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/blakemartz-delivery-tick/badge)](https://www.skillsdirectory.com/skills/blakemartz-delivery-tick)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: delivery-tick
description: One orchestrator tick of the agentic delivery loop - reconcile the board, ask tick-plan.sh for the action plan, and execute it in order (deterministic merges and promotions first, then exactly ONE agent action — or, with "--parallel N", one batch of up to N independent agent actions awaited together). With --auto-merge (opt-in, off by default) the plan may merge fully-approved, clean, green PRs through tick-merge.sh, which gates the merged result first. Designed as the /loop target.
---

# delivery-tick — one tick of the orchestrator loop

You are the **orchestrator** from the delivery spec (`${CLAUDE_PLUGIN_ROOT}/docs/agentic_delivery_spec.md`, §3.1, §6, §8, §9). You dispatch; you never implement, review, or patch yourself, and you **decide nothing**: `tick-plan.sh` chooses every action, and you execute its plan in order. The only merges are `tick-merge.sh`'s, the only promotions are `promote.sh`'s.

Every graph read or write goes through `graph.sh`, every PR read through `forge.sh` (`pr-view <n>`, `pr-list --state open`). Never call the forge's CLI or API directly. The script headers under `${CLAUDE_PLUGIN_ROOT}/scripts/` are the authoritative contract for every flag, output, and exit code below. Below, `S=${CLAUDE_PLUGIN_ROOT}/scripts`.

Dispatch an agent role by spawning an agent (Agent tool) whose prompt names the plugin skill, e.g. *"Run the /delivery-loop:next-task skill on task <id>."* Keep each script's stderr in a scratch file under a private `TMPDIR` (`export TMPDIR=$(mktemp -d)`), never interleaved with the stdout you parse.

**Config.** The tick reads no config key itself: each script resolves its own (`GATE_CMD`, `TASK_MERGE_METHOD`, `PROMOTE_GATE_CMD`, `NOTIFY_ESCALATE_CMD`, …) from the layered config, defaults < `.claude/delivery.conf` < environment. `bash "$S/delivery-config.sh"` prints the same resolved `KEY=value` lines, e.g. to tell the human which `NOTIFY_ESCALATE_CMD` a script ran. Never read the conf file yourself.

**Long-running scripts.** `tick-merge.sh` and `promote.sh` run the gate (`GATE_CMD`; promote: `PROMOTE_GATE_CMD`, empty = `GATE_CMD`), which can take minutes. Run each in the foreground with the longest tool timeout available (longer than the gate takes), never in the background, and wait for it to exit before starting the next action. A signal (a tool timeout's kill) stops either one with exit 128+n and stops a running gate. `tick-merge.sh` holds a signal that arrives once its merge request is out until the merge is settled, so a landed merge is still reconciled and its `merged` line printed. `promote.sh` releases its claim unless the promotion PR already exists, and still prints an opened PR. Both reporting guarantees hold for a signal sent to the script's PID; a process-group signal (Ctrl-C, `kill -- -<pgid>`) can end the script before it reports, and the next tick's reconcile resolves the state (`delivery_runbook.md` §7). Report the exit and any stdout line, and move on.

## Flags

Pass only these through to `tick-plan.sh`, verbatim and in any order; drop anything else:

- `--parallel [N]` (or `--parallel=N`) — parallel mode. `tick-plan.sh` parses N (bare or not a whole number → 3; above 16 → 16; 1 or lower → serial) and reports it as `mode`. Never re-parse it yourself.
- `--auto-merge` — off by default. Only with it does the plan carry `merge` actions. Without it approved PRs are the human's queue: list them, never touch them.

## The tick

1. **Reconcile.** `bash "$S/graph.sh" reconcile --fix`. Stdout is one `fix: <op> <id> <from> -> <to>: <reason>` line per applied record; `warn: …` lines go to stderr. Exit 4 (board changed) or 75 (backend busy): re-run, up to 3 passes in all. A 4 or 75 on the third pass is still safe to plan over: the plan reads fresh state, and every merge is re-checked by `tick-merge.sh`. Any other nonzero exit: report it and **stop the tick** — never plan over a board you could not reconcile. Note every `fix:` line for the report. A `fix: flag <id> … REVIEW-NEEDS-HUMAN: …` line is an escalation (the node is now needs-human, with that comment on it): surface it to the human verbatim.
2. **Plan.** `plan=$(bash "$S/tick-plan.sh" [--parallel N] [--auto-merge])`. Any nonzero exit — 1 (invalid config or a failed read), 2 (usage), or a code passed through from a failing read (3: a list reached `LIST_LIMIT`; others from `graph.sh` / `forge.sh`) — report it with the stderr and **stop the tick**. Stdout is one JSON object:
   - `mode` — `{name: "serial"|"parallel", n}`; `n` is the agent-action cap (serial 1).
   - `actions` — `[{action, pr?, id?, sha?, reason}]` in execution order: every `merge` (with `pr`, `id`, `sha`), then every `promote` (`id`), then the agent actions `patch` / `rebase` / `review` (with `pr`, `id`) and `start` (`id`).
   - `board` — `{<status>: count}` over task and promote nodes.
   - `waiting` — `[string]`: why nothing more is happening (needs-human items, approved PRs awaiting a human, caps, module locks, deferrals).
3. **Execute the plan's actions in order.** The plan already applies every priority, cap, and lock rule; do not add, drop, reorder, or re-derive actions — except as the merge results below direct.
   - **`merge`** — one at a time, in plan order, never concurrently (each merge moves the base the next one is gated against), each awaited to exit (**Long-running scripts**): `out=$(bash "$S/tick-merge.sh" <pr> <sha> 2>"$log")`, with `<sha>` the action's `sha`. It re-reads the PR (re-polling past a still-`unknown` mergeability), re-applies the merge rule (rule 1 of `lib/tick-plan.jq`), runs `GATE_CMD` on the **merged result** in a fresh worktree, refuses if the base moved meanwhile, merges with `TASK_MERGE_METHOD` pinned to `<sha>`, verifies `merged`, then reconciles. Outcomes:
     - exit 0, stdout `{pr, result: "merged", sha}` → merged and confirmed. Only now: `bash "$S/task-worktree.sh" --cleanup <id>`.
     - exit 1, stdout `{action: "rebase", pr, id, reason}` → the merged result conflicts or is red, under the patch budget. Add it to the agent actions at rebase priority (after patches, before reviews and starts).
     - exit 1, stdout `{pr, id, result: "needs-human", reason}` → the merged result conflicts or is red **at the patch budget** (3/3). `tick-merge.sh` has already escalated: flagged the node needs-human, commented `MERGE-NEEDS-HUMAN: …` on it with the gate output, and run `NOTIFY_ESCALATE_CMD`. Report the `reason`; do not flag, comment, or notify again. The flag keeps the plan from emitting it again.
     - exit 1, no stdout → refused (head moved, checks red, base moved, mergeability still `unknown`, no longer eligible): report the reason from the `tick-merge: refusing PR #<pr>: <reason>` stderr line and move on. The next tick re-plans; never retry the merge by hand.
     - exit 1 or 128+n, no stdout, and the refusal reason ends `verify it by hand` (`merged, but the re-read failed`, or `forge.sh pr-merge failed (exit <n>), and the re-read failed`) → the merge request went out and **may have landed**. Surface that line to the human verbatim. Do not retry the merge and do not clean up the worktree: the next tick's reconcile moves the task to `done` if the PR merged.
     - exit 128+n → stopped by a signal (**Long-running scripts**): report it. If stdout still carries `{pr, result: "merged", sha}`, the merge landed: handle it as exit 0. If the stderr carries a `verify it by hand` refusal, handle it as above. Otherwise the signal came before the merge request, and nothing was merged.
   - **`promote`** — `bash "$S/promote.sh" <id>`, awaited to exit (**Long-running scripts**). Exit 0, stdout `{id, result: "nothing-to-promote"|"promoted", pr?, url?}`: report it. Exit 1: report the `promote: …` stderr reason. A red gate has already flagged the node needs-human, commented `PROMOTE-GATE-RED: …`, run `NOTIFY_ESCALATE_CMD`, and released the claim. Any other failure before the promotion PR exists released the claim for the next tick; once the PR exists (`PR opened but <id> could not be set in-review; reconcile repairs it (rule 4)`) the claim is kept and the next reconcile moves the node to `in-review`. Never act on either yourself. A promotion PR is **never** merged by the tick, `--auto-merge` or not: a human merges it with `PROMOTE_MERGE_METHOD`.
   - **Agent actions** — after every merge and promote: take the plan's agent actions plus any rebase actions `tick-merge.sh` printed, truncate to `mode.n` (serial: the first one only), and dispatch them. In parallel mode spawn every agent **in a single message**, then WAIT for the whole batch and report each outcome. Anything truncated is picked up by a later tick, which re-plans it. Prompts:
     - `patch` → *"Run the /delivery-loop:patch-task skill on PR #<pr>."*
     - `rebase` → *"Run the /delivery-loop:patch-task skill on PR #<pr> as a rebase-only patch: it is approved but conflicts with (or is red against) its target branch after a sibling merged. Merge `origin/<target_branch>` into it in its task worktree (never rebase), resolve conflicts, re-run `GATE_CMD`, and push plainly — never force-push. Do NOT transition the node yourself: the next tick's reconcile returns it to review at the new head."*
     - `review` → spawn a **fresh** agent: *"Run the /delivery-loop:review-task skill on PR #<pr>. You have no prior context on this change — that independence is required."*
     - `start` → *"Run the /delivery-loop:next-task skill on task <id>."*
4. **Report.** One line per action taken and its outcome, every `fix:` line, the `board` counts, and every `waiting` line. When nothing ran, say what the board waits on: human merges of approved PRs (without `--auto-merge`), deps to close, needs-human items, or an empty queue (suggest `/delivery-loop:decompose`).

## Rules

- **Serial: one agent action per tick. Parallel: one batch per tick.** Merges and promotes run first and do not count against `mode.n`. Never dispatch a second wave or re-plan after results return — the batch barrier is what makes `/loop` safe (two batches never overlap), and the next tick replans from the graph, which is what picks up human merges, new tasks, and status changes.
- **≤ 1 in-flight task per module** (per target branch). `tick-plan.sh` enforces it — open agent PRs, approved-but-unmerged ones included, hold their module's lock, and so do `claimed` nodes. Never start a task the plan did not emit, and never start one by hand to fill a slot.
- **Patch cap: 3.** At `Patch iteration: 3/3` the plan still emits `patch` once, and `patch-task` itself escalates (needs-human, `NOTIFY_ESCALATE_CMD`, stop). An approved, conflicting PR at the cap is only a `waiting` line; a red or conflicting merged result at the cap is escalated by `tick-merge.sh` itself (its `needs-human` result); the tick only reports it. Never dispatch past the cap.
- **Never clean up a worktree before the merge is confirmed.** `task-worktree.sh --cleanup` force-removes the worktree and its branch, and patchers and rebases reuse it. Clean up only after `tick-merge.sh` exits 0 with `result: "merged"`, or for a task a reconcile `fix:` line moved to `done` because its PR merged. Never on a refusal, a `rebase` result, or a merely approved PR.
- **`unknown` mergeability is not a verdict.** A forge that is still computing mergeability (common right after a push or a sibling's merge) reports `unknown`; the forge adapter and `tick-merge.sh` re-poll past it. If it is still `unknown`, the PR is neither merged nor treated as conflicting: it is a `waiting` line or a refusal, and a later tick re-plans it. Never merge around it, and never dispatch a rebase the plan did not emit.
- `needs-human` items: mention them in every tick report; never act on them.
- If a spawned agent or a script reports failure (lost claim, refused review, refused merge), report it — the next tick's reconcile handles the board. In a parallel batch one agent's failure never aborts the others: wait for all, report all.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.