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

Every delivery Stage lead needs the same entry and exit discipline: read
the repo's delivery doc, read the inbound Handoff comment, check the
stage's gate, and end with one fixed-shape Handoff comment that tells the
human the exact launch line for the next stage.

- delivery-handoff: entry checks, per-stage gate table (implement label,
  review non-WIP PR, verify merged PR with a non-stale, non-dismissed
  allowlisted approval), the Status/Ready for Human stop path, and the
  Handoff template with Claude Code and Copilot CLI Next commands
- ADR-0032 amended: stage leads check gate state only in step mode; the
  who-set-the-label check moves to the run-mode launcher (gitea-mcp has
  no timeline method and the human already launches each stage)
- delivery-repo-doc format.md aligned with the amendment (0.1.2)
- delivery package 0.2.0 -> 0.3.0, with the executables.allow key and
  marketplace entry kept in step

Refs #191

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012CqgnwEGtmfsjcoG9QwByN
This commit is contained in:
Defame1297andClaude Opus 5.5 committed 2026-11-23 16:49:36 +00:00
1 parent d439bbeb05
commit 2c0120cda6
9 files changed
+210 -8

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"
},
+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 gate label 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,63 @@
---
name: delivery-handoff
description: >
Use when a delivery Stage lead starts or finishes its stage. Checks the stage's gate and writes the
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
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;
the who-set-it check belongs to the run-mode launcher. Do not read the issue timeline.
## 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 or empty → 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). The inbound Handoff comment is the latest comment carrying the six Handoff headings; read
it before anything else on the item. Only the implement stage may start without one, on a
human-written ticket. Any other stage without one → **Stop**.
## Step 3 — Check the gate
Read `references/gates.md` now and run every check in your stage's row. 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. Post it where the next stage starts: on the PR once one
exists, otherwise on the issue, via `gitea-issues` (a Gitea PR's conversation comments are issue
comments). 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 a Handoff comment there from `references/handoff-comment.md`. Open questions states the
reason; for a missing skill use the format's wording, "missing skill `<name>`". Next command is
`none`.
@@ -0,0 +1,32 @@
# 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: the implement stage's | No human gate. The PR title does not start with `WIP:` |
| verify | `delivery-operator` | PR | Required: the review stage's | The PR is merged (`merged` is true) **and** has at least one review meeting every review condition below |
| spec, tickets | `delivery-planner` | — | — | Not defined yet: the planner is out of v1 scope |
## 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. Typical wordings:
- implement: "gate not set: `Status/Ready for Agent` missing"
- review: "no inbound Handoff comment from the implement stage"; "PR title still starts `WIP:`"
- verify: "PR not merged"; "no approval from an allowlisted human that is neither stale nor
dismissed"
- spec, tickets: "no gate defined for the `<stage>` stage in v1"
- a stage lead not in the table: "no stage defined for agent `<name>`"
@@ -0,0 +1,99 @@
# The Handoff comment
One comment ends every stage, on success or on a 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.
- **Open questions** carries the stop reason on a stop.
## 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 | — | — | The section is `none`; the human decides what runs next |
When the section is `none`, drop the fenced block and the Copilot line.
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.
````
@@ -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
@@ -73,8 +73,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
+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