feat(delivery): add the delivery-handoff stage protocol skill #213

Merged
Defame1297 merged 5 commits from feat/delivery-handoff into main 2026-11-23 18:07:48 +00:00
10 changed files with 280 additions and 10 deletions

No files matched your search

+1 -1
View File
@@ -59,7 +59,7 @@
{
"name": "delivery",
"description": "Agents and skills for taking a change from spec to a verified merge through tracker-gated stages.",
"version": "0.2.0",
"version": "0.3.0",
"category": "Developer Tools",
"source": "./plugins/delivery"
},
+14 -1
View File
@@ -136,9 +136,22 @@ _Avoid_: specialist agent (implies a tool specialist), worker, persona
**Handoff comment**:
The fixed-shape tracker comment that ends every **Stage** — decisions, rejected options, evidence,
the pointer the next stage starts from, and open questions. The next stage reads it first.
the pointer the next stage starts from, open questions, and the command that launches the next
session (the next stage, a relaunch of a stopped one, or none after the last). The next stage reads
it first.
_Avoid_: summary, status update
**Step mode**:
How v1 runs the delivery flow: a human launches each **Stage** session by hand, from the previous
**Handoff comment**'s Next command. The launch itself is the human's approval.
_Avoid_: manual mode, interactive mode
**Run mode**:
The later way the delivery flow runs: Gitea Actions workflows launch the next **Stage** on **Gate**
events, and the launcher checks the event's sender against the repo's human allowlist before
starting an agent.
_Avoid_: auto mode, autopilot
**Acceptance check**:
What the test author writes before any implementation, from a ticket's acceptance criteria: a
failing test where a test can express the criterion, otherwise a post-merge assertion about the
+1 -1
View File
@@ -73,7 +73,7 @@ executables:
bin: true
# delivery ships the guard hook (ADR-0032 enforcement layer 2). Same
# version-in-key convention as above, kept by the same sync check.
delivery#0.2.0:
delivery#0.3.0:
hooks: true
marketplace:
@@ -54,8 +54,12 @@ running it in CI on a bot PR hands the bot those credentials. Decided in
`flux diff` needs write RBAC, because Kubernetes authorises dry-run requests like real ones, so
it is not used. Ansible's pre-merge `--check --diff` is reopened (see Secrets); later
`tofu plan`;
- stage leads start only when a user on the human allowlist in `docs/agents/delivery.md` set the
gate label, checked against the issue timeline;
- in step mode (v1) the human launching a stage is the approval, and stage leads check gate
state only: the stage's gate label, if it has one, is present, and for verify the PR is
merged with a non-stale, non-dismissed approval by a user on the human allowlist in
`docs/agents/delivery.md`. The who-set-the-label check moves to the run-mode launcher, which
checks the triggering event's sender against the allowlist before starting an agent; it is
deterministic, so it belongs in the workflow, not an agent;
- a CI test-path check, run from `main`'s copy, fails if a commit after the test author's
(trailer `Delivery-Stage: test-author`) touches the globs in `.gitea/test-paths`; this check,
not file protection, guards tests. The implementer hands disputed tests back instead of editing
@@ -101,6 +105,10 @@ running it in CI on a bot PR hands the bot those credentials. Decided in
cluster or state and print no secret: anything not on the list is denied, so an unlisted mutating
subcommand fails safe. Codex cannot ask, so odd jobs are
denied there; an unrecognised runtime is treated the same way.
- *Amended 2026-11-23 ([delivery-handoff skill](https://git.rkdr.net/Mortis/Holocron/issues/191)): stage
leads check gate state only and the who-set-the-label check moved to the run-mode launcher,
because gitea-mcp v1.13.0 has no timeline method, the timeline needs a token on private repos,
and in step mode the human already launches each stage.*
- *Amended 2026-11-23 ([delivery guard hook](https://git.rkdr.net/Mortis/Holocron/issues/190)): Copilot ask kept
as an accepted risk; the guard covers file tools and uses read-verb allowlists.*
- *Amended 2026-11-22 ([Credential boundary setup in ansible-homelab-mono](https://git.rkdr.net/Mortis/Holocron/issues/184)): test paths left
@@ -0,0 +1,66 @@
---
name: delivery-handoff
description: >
Use when a delivery Stage lead starts or finishes its stage. Owns the stage's entry gate and exit
Handoff comment. Not a plain issue comment -> `gitea-issues`. Not writing the repo's delivery doc
-> `delivery-repo-doc`.
compatibility: Requires a Gitea forge reached through the Gitea MCP server (via the gitea-issues and
gitea-prs skills), and a consuming repo carrying docs/agents/delivery.md.
allowed-tools: Read mcp__gitea__issue_read mcp__gitea__issue_write mcp__gitea__pull_request_read
metadata:
category: delivery
version: "0.1.0"
---
## Gotchas
- `Status/Ready for Human` is a stop signal, not a Gate, so you may set it. Every real gate —
`Status/Ready for Agent`, a PR approval — is human-only: never set, add or remove a gate label,
and never approve a PR.
- Check gate *state*, not who set it: in step mode the human launching your stage is the approval.
Do not read the issue timeline.
- `Status/Ready for Agent` and `Status/Ready for Human` must not share an exclusive label scope:
Gitea would then drop the gate label when you add Ready for Human. Never re-add it yourself.
## Step 1 — Read the repo's delivery doc
Before any other work, read `docs/agents/delivery.md` at the consuming repo's root. Its format is
owned by `delivery-repo-doc`'s `references/format.md`; you need only the Human allowlist: section
`## Human allowlist`, one `` - `<user>` `` item per line, never empty.
File missing, first line not `# Delivery`, or the allowlist section missing, empty or `- none` →
go to **Stop** with the reason, e.g. "`docs/agents/delivery.md` missing".
## Step 2 — Read the inbound Handoff comment
Read the issue or PR you were pointed at via `gitea-issues` (or `gitea-prs` for the PR's own
fields). Find the latest Handoff comment and apply `references/gates.md` §Inbound Handoff comment;
if it says stop → **Stop**.
## Step 3 — Check the gate
Run every check in your stage's row of `references/gates.md`. Any check fails → **Stop**, quoting
the failed check as the reason.
## Step 4 — Do the stage's work
Run your stage's own flow. A blocker mid-stage — a skill named in `docs/agents/delivery.md` that is
not installed, a question only the human can answer — → **Stop**.
## Step 5 — Exit
Read `references/handoff-comment.md` now and write exactly one Handoff comment from its template,
with the Next command filled for your stage, and post it where its Rules say. Then end the session.
## Stop
Used by every step. Do both, then end the session without further work:
1. Add the `Status/Ready for Human` label to the issue or PR you were pointed at, via `gitea-issues`.
2. Post one comment where `references/handoff-comment.md` §Rules says a stop posts:
- **Before the inbound check passed** (Step 1 or Step 2) → a plain comment stating the reason,
not a Handoff comment, so the inbound rule is never bypassed. A relaunch comes from the latest
real Handoff comment, or from scratch where your row's inbound is Optional.
- **After it passed** (Steps 3–4) → a Handoff comment from `references/handoff-comment.md`,
filled per its stop row. Open questions states the reason; for a missing skill use the
format's wording, "missing skill `<name>`".
@@ -0,0 +1,56 @@
# Stage gates
Each stage lead runs the checks in its own row, in order. Read issue fields through `gitea-issues`
and PR fields and reviews through `gitea-prs`. Every check reads tracker state only; none sets it.
| Stage | Stage lead | Pointed at | Inbound Handoff comment | Gate checks |
|---|---|---|---|---|
| implement | `delivery-implement-lead` | issue | Optional: a human-written ticket has none | The issue carries the label `Status/Ready for Agent` |
| review | `delivery-reviewer` | PR | Required | No human gate. The PR title does not start with `WIP:` |
| verify | `delivery-operator` | PR | Required | The PR is merged (`merged` is true) **and** has at least one review meeting every review condition below |
| spec, tickets | `delivery-planner` | — | — | None in v1: the planner stops at the inbound check (below); gates come in slice 4 |
## Inbound Handoff comment
A Handoff comment is a comment whose `##` headings are exactly the six listed in
`references/handoff-comment.md` §Rules, in that order. Ignore every other comment: a quote of one,
a plain stop comment, a partial one. Run these in order, stopping at the first that applies:
- Your agent has no row in the table above → stop with "no stage defined for agent `<name>`".
- You are `delivery-planner` → stop with "no gate defined for the spec or tickets stage in v1":
there is no stage to relaunch into in v1.
- The item you were pointed at is not the kind your row's "Pointed at" column names → stop
with "pointed at an `<issue|PR>`, expected an `<issue|PR>`".
Then find the latest Handoff comment, newest by creation time, on that item:
- Its `## Next command` launches your stage's agent → it is your inbound comment. A stop after this
check passed posts a Handoff comment relaunching the stopped stage, so its relaunch lands here and
runs every gate check in your row again.
- There is none → proceed only if your row says Optional; otherwise stop with "no inbound Handoff
comment".
- It launches a different agent, or its Next command is `none` (the final stage) → stop with
"latest Handoff comment does not launch `<your agent>`".
Every stop in this section posts a plain comment, not a Handoff comment (`SKILL.md` §Stop). The
human removes `Status/Ready for Human` before relaunching; the agent does not check it.
## Verify: review conditions
Read the PR's reviews (`pull_request_read`, method `get_reviews`). A review counts only when all of
these hold:
- `state` is `APPROVED`;
- its author's login is on the Human allowlist, compared against the forge's casing;
- `stale` is `false` — no push landed after it was submitted;
- `dismissed` is `false`.
## Stop reasons
Quote the failed check as the Open questions reason. Inbound-check wordings are in §Inbound Handoff
comment above. Typical gate-check wordings:
- implement: "gate not set: `Status/Ready for Agent` missing"
- review: "PR title still starts `WIP:`"
- verify: "PR not merged"; "no approval from an allowlisted human that is neither stale nor
dismissed"
@@ -0,0 +1,123 @@
# The Handoff comment
One comment ends every stage, on success or on a stop after the inbound check passed; a stop before
it posts a plain comment instead (`SKILL.md` §Stop). The next stage reads it first, and run mode
will later parse it, so the shape is fixed even though nothing validates it yet.
## Rules
- Six `##` headings, verbatim and in this order: `## Decisions`, `## Rejected`, `## Evidence`,
`## Next pointer`, `## Open questions`, `## Next command`. No other `##` headings.
- Every section is present. An empty one holds the single word `none`.
- **Evidence** is links — CI runs, commits, the PR — never pasted logs.
- **Next pointer** is the URL the next stage starts from: the PR once one exists, otherwise the
issue. On a stop, it is the item you were pointed at.
- **Open questions** carries the stop reason on a stop.
- Post the comment on the Next pointer's item via `gitea-issues` — a Gitea PR's conversation
comments are issue comments. On a stop, post it — or the plain stop comment — on the item you
were pointed at.
## Template
````markdown
## Decisions
- <decision taken in this stage, and why>
## Rejected
- <option considered>: <why it was rejected>
## Evidence
- [<CI run / commit / PR>](<url>)
## Next pointer
<url>
## Open questions
none
## Next command
```text
claude --agent <agent> "Start the <stage> stage from <url>"
copilot --agent=<agent> --prompt "Start the <stage> stage from <url>"
```
The Copilot CLI line follows GitHub's documentation and is untested.
````
## Filling the Next command
Fill `<agent>`, `<stage>` and `<url>` with real values; `<url>` is the Next pointer.
| Your stage | `<agent>` | `<stage>` | Note |
|---|---|---|---|
| implement | `delivery-reviewer` | review | — |
| review | `delivery-operator` | verify | Put "Run after a human approves and merges the PR:" on the line above the fenced block |
| verify | — | — | Last stage: the section is `none` |
| any stage, on a stop after the inbound check | your own | your own | Put "After resolving the Open questions above:" on the line above the fenced block |
`none` means only "final stage, nothing follows": a stop never uses it. When the section is
`none`, drop the fenced block and the "untested" note below it.
The Copilot CLI line uses `--prompt`, not an interactive session, because an open bug
(github/copilot-cli#5124) drops an `--agent` selection about a second after interactive startup.
## Example
An implement stage ending on PR 42 (illustrative values):
````markdown
## Decisions
- Pinned the chart to 1.4.2: 1.5 drops the values key the role sets.
## Rejected
- Upgrading to 1.5 and migrating the key: out of the ticket's scope.
## Evidence
- [PR 42](https://git.example.org/acme/infra/pulls/42)
- [CI run 311](https://git.example.org/acme/infra/actions/runs/311)
## Next pointer
https://git.example.org/acme/infra/pulls/42
## Open questions
none
## Next command
```text
claude --agent delivery-reviewer "Start the review stage from https://git.example.org/acme/infra/pulls/42"
copilot --agent=delivery-reviewer --prompt "Start the review stage from https://git.example.org/acme/infra/pulls/42"
```
The Copilot CLI line follows GitHub's documentation and is untested.
````
A review stage stopping on that PR ends its comment with:
````markdown
## Open questions
- missing skill `delivery-review`
## Next command
After resolving the Open questions above:
```text
claude --agent delivery-reviewer "Start the review stage from https://git.example.org/acme/infra/pulls/42"
copilot --agent=delivery-reviewer --prompt "Start the review stage from https://git.example.org/acme/infra/pulls/42"
```
The Copilot CLI line follows GitHub's documentation and is untested.
````
@@ -9,7 +9,7 @@ compatibility: Requires git and a forge remote. Gitea needs the Gitea MCP server
allowed-tools: Bash Read Write Edit
metadata:
category: delivery
version: "0.1.1"
version: "0.1.2"
---
## Gotchas
@@ -2,7 +2,8 @@
This file is the single source of truth for the format. `delivery-handoff`, `delivery-ci-checks`,
`delivery-qa` and `delivery-operator` cite it as "`delivery-repo-doc`'s `references/format.md`" and
do not restate it. A format change is an edit here, plus the consumers' parsers.
restate only the minimum they parse — `delivery-handoff`, for example, restates the first line and
section 4's syntax. A format change is an edit here, plus every consumer's restatement.
## File rules
@@ -73,8 +74,8 @@ These are the paths the test author owns; after the commit with trailer
- `<forge username>`
```
Humans only. Stage leads accept a gate label or an approval only when the issue or PR timeline shows
a user on this list set it.
Humans only. Stage leads accept a PR approval only from a user on this list. Who set a gate label
is checked by whatever launches the stage: in step mode the human launching it is the approval.
### 5. Credential boundary
@@ -157,3 +158,6 @@ The values in the skeleton are illustrative only; every real value comes from th
- [ ] Section 4 is non-empty and every name came from the human or a source they named.
- [ ] Section 5 holds paths and markdown links, no secret values.
- [ ] Root `AGENTS.md` carries the pointer line exactly once.
- [ ] On Gitea, the repo's `Status/Ready for Agent` and `Status/Ready for Human` labels are not in an
exclusive scope (read via `gitea-labels-milestones`); otherwise adding Ready for Human silently
removes the gate label. If they are, name it as open in the PR body.
+1 -1
View File
@@ -1,5 +1,5 @@
name: delivery
version: 0.2.0
version: 0.3.0
description: Agents and skills for taking a change from spec to a verified merge through tracker-gated stages.
author:
name: Mortis