From 873b28ca96819e6f24379ecbadce240a2fd3c251 Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Sun, 22 Nov 2026 21:51:43 +0000 Subject: [PATCH 1/2] feat(delivery): add delivery-repo-doc skill Why: the delivery team needs each consuming repo's specific facts (tool skills per path, CI check names, test paths, human allowlist, credential boundary) in one place it can read mechanically (ADR-0031, ADR-0032). Implementation Notes: the skill owns the docs/agents/delivery.md format in references/format.md, the single source the other delivery skills cite. It drafts or updates that file plus a one-line AGENTS.md pointer as one PR, taking repo facts from the repo and human facts only from the human. Impact: first .apm/ content in the delivery package; Read and Propose tiers only, never merges. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012CqgnwEGtmfsjcoG9QwByN --- .../.apm/skills/delivery-repo-doc/SKILL.md | 71 +++++++++ .../delivery-repo-doc/references/format.md | 150 ++++++++++++++++++ .../delivery-repo-doc/references/gathering.md | 51 ++++++ 3 files changed, 272 insertions(+) create mode 100644 plugins/delivery/.apm/skills/delivery-repo-doc/SKILL.md create mode 100644 plugins/delivery/.apm/skills/delivery-repo-doc/references/format.md create mode 100644 plugins/delivery/.apm/skills/delivery-repo-doc/references/gathering.md diff --git a/plugins/delivery/.apm/skills/delivery-repo-doc/SKILL.md b/plugins/delivery/.apm/skills/delivery-repo-doc/SKILL.md new file mode 100644 index 0000000..6b84685 --- /dev/null +++ b/plugins/delivery/.apm/skills/delivery-repo-doc/SKILL.md @@ -0,0 +1,71 @@ +--- +name: delivery-repo-doc +description: > + Use when onboarding a repo to the delivery team or when its `docs/agents/delivery.md` has + drifted, e.g. a renamed CI check. Owns that file's format. Not writing AGENTS.md -> + `agentsmd-author`. +compatibility: Requires git and a forge remote. Gitea needs the Gitea MCP server (through the + gitea-* skills); GitHub needs an authenticated gh CLI. +allowed-tools: Bash Read Write Edit +metadata: + category: delivery + version: "0.1.0" +--- + +## Gotchas + +- A glob with no installed tool skill is left out, never mapped to the closest-sounding skill: a + guess stalls every consumer stage. +- A status-check name derived from a workflow file is a candidate; the forge's reported string is + what consumers match, character for character. +- Commit authors, CODEOWNERS and collaborator lists are not sources for the allowlist or bot user: + they name who *can* act, not who is *allowed* to. +- The kubeconfig is recorded as a path. Opening it, or any credential file, is outside this skill's + Read and Propose tiers. + +## Step 1 — Locate + +Work in the consuming repo's checkout, on its default branch, up to date. Identify the forge from +the `origin` remote (Gitea or GitHub). If `docs/agents/delivery.md` exists, this run is an +**update**; otherwise a **draft**. + +Read `references/format.md` now; it is the only definition of the file's syntax. + +## Step 2 — Gather repo facts + +Read `references/gathering.md` and collect every repo-sourced value: contents → skills, CI check +names with roles, test paths, convention pointers. Done when every section 1–3 and 6 value has a +named source file or forge status. + +## Step 3 — Ask for human facts + +Ask once, in one message, for every human-sourced value `references/gathering.md` lists that is +still missing. On an update, ask only for values the human must re-confirm because the repo changed. +A source the human points at, such as a tracker issue's resolution comment, counts as an answer; +quote the value from it. Wait for the answer. A value the human declines to give stays out, and the PR body names it as open. + +## Step 4 — Write + +- **Draft**: write `docs/agents/delivery.md` from the format's skeleton, with this repo's values. +- **Update**: compare each existing item against the facts from Steps 2–3 and edit only the + drifted items. Leave every confirmed item byte-for-byte. + +Then the pointer line: if the root `AGENTS.md` lacks the exact line from `references/format.md`, +add it. If the repo has no root `AGENTS.md`, invoke `agentsmd-author` to create one carrying that +line, and edit nothing else in it. + +Run the format's validation checklist. Every box ticked is the completion bar. + +## Step 5 — Propose + +Both files go in one PR. Every command here is in the Read or Propose tier. + +1. Branch `docs/delivery-repo-doc` from the default branch via `git-branches`. +2. Commit via `git-commits`: `docs(agents): add delivery repo facts` on a draft, + `docs(agents): update delivery repo facts` on an update. +3. Push via `git-remotes`. +4. Open the PR: Gitea via `gitea-prs`; GitHub via `gh pr create`. The body lists each value's source + (file, forge status, or the human's answer and where it was given) and any open values. + +Report the PR link and stop. A human merges: `docs/agents/**` and `AGENTS.md` sit behind protected +file patterns, and the merge is theirs either way. diff --git a/plugins/delivery/.apm/skills/delivery-repo-doc/references/format.md b/plugins/delivery/.apm/skills/delivery-repo-doc/references/format.md new file mode 100644 index 0000000..64032e2 --- /dev/null +++ b/plugins/delivery/.apm/skills/delivery-repo-doc/references/format.md @@ -0,0 +1,150 @@ +# The `docs/agents/delivery.md` format + +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. + +## File rules + +- Path: `docs/agents/delivery.md` at the consuming repo's root. One file per repo. +- First line: `# Delivery`. +- Exactly six `##` sections, with these headings verbatim and in this order: + 1. `## Contents → skills` + 2. `## CI checks` + 3. `## Test paths` + 4. `## Human allowlist` + 5. `## Credential boundary` + 6. `## Conventions` +- No other `##` headings, and no `###` headings inside sections 1–4. +- Sections 1–4 are **parsed**: they contain only list items in the item syntax below, one per line, + starting `- ` at column 0. Blank lines are allowed; prose, sub-bullets, tables and comments are + not. Every backticked value is taken verbatim, with no escaping. +- An empty parsed section holds the single item `- none`. Section 4 is never empty. +- Sections 5–6 are read by agents, not parsers; their item labels below are a convention. + +## Item syntax + +### 1. Contents → skills + +```text +- ``: ``, `` +``` + +- `` is a repo-relative path glob (`**` crosses directories). +- One or more installed skill names, each backticked, comma-separated. +- A consumer loads exactly the listed skills for a changed path matching the glob, the union across + every matching line. A listed skill that is not installed is a hard stop for the consumer + (`Status/Ready for Human`, handoff "missing skill ``"), so a glob with no installed tool + skill is left out entirely. + +### 2. CI checks + +```text +- ``: +``` + +- `` is the exact string the forge shows on a PR's head commit. +- `` is exactly one of: `dry-run`, `test-path`, `test`, `lint`, `build`, `other`. +- `dry-run` appears on exactly one item. `test-path` appears on at most one item, and on exactly + one when the repo has a test-path check. + +### 3. Test paths + +Either a pointer, as the only item, when the repo's test-path check reads its own globs file: + +```text +- globs file: `` +``` + +or one item per glob: + +```text +- `` +``` + +These are the paths the test author owns; after the commit with trailer +`Delivery-Stage: test-author`, the implementer may not touch them. + +### 4. Human allowlist + +```text +- `` +``` + +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. + +### 5. Credential boundary + +```text +- Bot user: `` +- Kubeconfig: `` | none +- Branch protection: in place | pending () +- Accepted risks: , … | none +``` + +Delivery sessions export the kubeconfig path as `KUBECONFIG`. The value is a path only. Accepted +risks are linked, never restated. + +### 6. Conventions + +Short prose or bullets pointing at the repo's own docs (`AGENTS.md`, ADRs, contributing guides) for +anything else a delivery agent needs. Pointers only; no restating. + +## AGENTS.md pointer line + +The consuming repo's root `AGENTS.md` carries exactly this line, under whatever heading lists its +agent docs (or at the end of the file when it has none): + +```text +- Delivery team facts (checks, test paths, human allowlist, credential boundary): `docs/agents/delivery.md` +``` + +## Full skeleton + +```markdown +# Delivery + +## Contents → skills + +- `clusters/**`: `flux-diagnose`, `k8s-diagnose` +- `roles/**`: `ansible-lint` + +## CI checks + +- `ci / render-diff (pull_request)`: dry-run +- `ci / test-paths (pull_request)`: test-path +- `ci / lint (pull_request)`: lint + +## Test paths + +- globs file: `.gitea/test-paths` + +## Human allowlist + +- `alice` + +## Credential boundary + +- Bot user: `delivery-bot` +- Kubeconfig: `/etc/delivery/kubeconfig-readonly` +- Branch protection: in place +- Accepted risks: [ADR-0032](https://example.org/adr/0032) + +## Conventions + +Repo conventions live in `AGENTS.md`; decisions in `docs/adr/`. +``` + +The values in the skeleton are illustrative only; every real value comes from the repo or the human. + +## Validation checklist + +- [ ] First line `# Delivery`; six `##` headings, verbatim, in order. +- [ ] Sections 1–4 hold only items in the syntax above, or `- none`. +- [ ] Every skill in section 1 is installed. +- [ ] Section 2: exactly one `dry-run`; one `test-path` if the repo has that check. +- [ ] Section 3 is the `globs file:` pointer whenever a test-path check reads a globs file. +- [ ] Section 4 is non-empty and every name came from the human or a source they named. +- [ ] Section 5 holds paths and links, no secret values. +- [ ] Root `AGENTS.md` carries the pointer line exactly once. diff --git a/plugins/delivery/.apm/skills/delivery-repo-doc/references/gathering.md b/plugins/delivery/.apm/skills/delivery-repo-doc/references/gathering.md new file mode 100644 index 0000000..69298e4 --- /dev/null +++ b/plugins/delivery/.apm/skills/delivery-repo-doc/references/gathering.md @@ -0,0 +1,51 @@ +# Gathering the facts + +Every value in `docs/agents/delivery.md` has exactly one source. Facts the repo holds come from the +repo; facts only a human holds come from the human. A value with no source stays out. + +## Repo-sourced + +### Contents → skills + +1. List the repo's top-level layout and the tool each area belongs to: Flux/Kustomize manifests + (`kustomization.yaml`, `HelmRelease`), Kubernetes manifests, Ansible (`playbooks/`, `roles/`, + `inventory/`, `ansible.cfg`), OpenTofu (`*.tf`, `.terraform.lock.hcl`). +2. The installed skills are the session's available-skills listing. Map a glob only to tool skills + in that listing whose description covers the area's tool. + +### CI checks + +1. Read every workflow under `.gitea/workflows/` or `.github/workflows/` that runs on + `pull_request`. +2. Derive each candidate name: + - Gitea Actions: ` / ()`. The workflow name is the file's + top-level `name:` (else the file name); the job name is the job's `name:` (else the job id). + - GitHub Actions: the job's `name:` (else the job id); matrix jobs append their values in + parentheses. +3. Confirm each candidate against the statuses the forge reports on the head commit of a recent PR + (Gitea: commit statuses via `gitea-prs`; GitHub: `gh pr checks `). The forge's string + wins over the derived one. With no PR to read, keep the derived name and say so in the PR body. +4. Assign roles. `test-path` is the check that fails when a commit after the + `Delivery-Stage: test-author` commit touches the test globs. `dry-run` comes from the human. + +### Test paths + +1. Read the test-path check's workflow and find the file it reads its globs from (for example + `.gitea/test-paths`). If one exists, the section is the `globs file:` pointer. +2. Otherwise list the globs where the repo's tests live (Molecule scenarios, `tests/`, policy tests). + Confirm them with the human in the Step 3 question. + +### Conventions + +Point at the root `AGENTS.md`, `docs/adr/`, and any contributing or runbook docs that exist. + +## Human-sourced + +SKILL.md Step 3 asks for these: + +- Human allowlist: forge usernames. +- Bot user the agents act as. +- Read-only kubeconfig path, or "no cluster". +- Branch-protection status: in place, or pending with the tracking link. +- Which CI check is the dry run. +- Accepted risks: the ADR or issue links, or "none". -- 2.43.0 From 3f24daa58a3f06058af4268c51cd4eb127cc41cd Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Sun, 22 Nov 2026 22:07:31 +0000 Subject: [PATCH 2/2] fix(delivery): tighten delivery-repo-doc from first dogfood run Why: the first drafting run against a real Ansible repo surfaced gaps the skill left to guesswork: pointer placement in a sectioned AGENTS.md, path-filtered and push-only workflows, link syntax, and caller-supplied facts. Implementation Notes: format.md pins the AGENTS.md placement rules without changing the exact line, notes that "skipped" checks pass, uses markdown links throughout section 5, and states the hard-stop consequence of an uninstalled skill. gathering.md covers mixed repos, which workflows count, the exact status-read tool calls and caller-supplied convention pointers. SKILL.md adds the fast-forward and dirty-tree rule, caller overrides, hook-failure handling and the remote-casing gotcha. Impact: delivery-repo-doc 0.1.0 -> 0.1.1. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012CqgnwEGtmfsjcoG9QwByN --- .../.apm/skills/delivery-repo-doc/SKILL.md | 25 ++++++++++------- .../delivery-repo-doc/references/format.md | 27 ++++++++++++------- .../delivery-repo-doc/references/gathering.md | 14 +++++++--- 3 files changed, 44 insertions(+), 22 deletions(-) diff --git a/plugins/delivery/.apm/skills/delivery-repo-doc/SKILL.md b/plugins/delivery/.apm/skills/delivery-repo-doc/SKILL.md index 6b84685..125a370 100644 --- a/plugins/delivery/.apm/skills/delivery-repo-doc/SKILL.md +++ b/plugins/delivery/.apm/skills/delivery-repo-doc/SKILL.md @@ -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.0" + version: "0.1.1" --- ## Gotchas @@ -20,12 +20,15 @@ metadata: what consumers match, character for character. - Commit authors, CODEOWNERS and collaborator lists are not sources for the allowlist or bot user: they name who *can* act, not who is *allowed* to. +- The git remote's owner casing can differ from the forge's. Take user and owner names from the + forge or the human, never the remote URL. - The kubeconfig is recorded as a path. Opening it, or any credential file, is outside this skill's Read and Propose tiers. ## Step 1 — Locate -Work in the consuming repo's checkout, on its default branch, up to date. Identify the forge from +Work in the consuming repo's checkout, on its default branch, fast-forward pulled via +`git-branches`. On a dirty working tree, stop and report it. Identify the forge from the `origin` remote (Gitea or GitHub). If `docs/agents/delivery.md` exists, this run is an **update**; otherwise a **draft**. @@ -39,10 +42,12 @@ named source file or forge status. ## Step 3 — Ask for human facts -Ask once, in one message, for every human-sourced value `references/gathering.md` lists that is -still missing. On an update, ask only for values the human must re-confirm because the repo changed. -A source the human points at, such as a tracker issue's resolution comment, counts as an answer; -quote the value from it. Wait for the answer. A value the human declines to give stays out, and the PR body names it as open. +A human fact the caller already supplied, directly or through a source it named, is used as given. +Ask once, in one message, for every other human-sourced value `references/gathering.md` lists. On +an update, ask only for values the human must re-confirm because the repo changed. A source the +human points at, such as a tracker issue's resolution comment, counts as an answer; quote the value +from it. Wait for the answer. A value the human declines to give stays out, and the PR body names it +as open. ## Step 4 — Write @@ -51,18 +56,20 @@ quote the value from it. Wait for the answer. A value the human declines to give drifted items. Leave every confirmed item byte-for-byte. Then the pointer line: if the root `AGENTS.md` lacks the exact line from `references/format.md`, -add it. If the repo has no root `AGENTS.md`, invoke `agentsmd-author` to create one carrying that +add it where that file's placement rule says. If the repo has no root `AGENTS.md`, invoke `agentsmd-author` to create one carrying that line, and edit nothing else in it. Run the format's validation checklist. Every box ticked is the completion bar. ## Step 5 — Propose -Both files go in one PR. Every command here is in the Read or Propose tier. +Both files go in one PR. Every command here is in the Read or Propose tier. A branch name or commit +message the caller gives overrides the defaults below. 1. Branch `docs/delivery-repo-doc` from the default branch via `git-branches`. 2. Commit via `git-commits`: `docs(agents): add delivery repo facts` on a draft, - `docs(agents): update delivery repo facts` on an update. + `docs(agents): update delivery repo facts` on an update. On a hook failure, fix the cause and + re-run only that hook, then commit again; `--no-verify` and `SKIP=` stay off the table. 3. Push via `git-remotes`. 4. Open the PR: Gitea via `gitea-prs`; GitHub via `gh pr create`. The body lists each value's source (file, forge status, or the human's answer and where it was given) and any open values. diff --git a/plugins/delivery/.apm/skills/delivery-repo-doc/references/format.md b/plugins/delivery/.apm/skills/delivery-repo-doc/references/format.md index 64032e2..f36221c 100644 --- a/plugins/delivery/.apm/skills/delivery-repo-doc/references/format.md +++ b/plugins/delivery/.apm/skills/delivery-repo-doc/references/format.md @@ -47,6 +47,8 @@ do not restate it. A format change is an edit here, plus the consumers' parsers. - `` is exactly one of: `dry-run`, `test-path`, `test`, `lint`, `build`, `other`. - `dry-run` appears on exactly one item. `test-path` appears on at most one item, and on exactly one when the repo has a test-path check. +- Whatever its role, a consumer treats a check reported as "skipped" (a path-filtered workflow + whose paths did not match) as passing. ### 3. Test paths @@ -79,12 +81,12 @@ a user on this list set it. ```text - Bot user: `` - Kubeconfig: `` | none -- Branch protection: in place | pending () -- Accepted risks: , … | none +- Branch protection: in place | pending ([](<url>)) +- Accepted risks: [<title>](<url>), … | none ``` -Delivery sessions export the kubeconfig path as `KUBECONFIG`. The value is a path only. Accepted -risks are linked, never restated. +Every link in this section is a markdown link. Delivery sessions export the kubeconfig path as +`KUBECONFIG`. The value is a path only. Accepted risks are linked, never restated. ### 6. Conventions @@ -93,13 +95,19 @@ anything else a delivery agent needs. Pointers only; no restating. ## AGENTS.md pointer line -The consuming repo's root `AGENTS.md` carries exactly this line, under whatever heading lists its -agent docs (or at the end of the file when it has none): +The consuming repo's root `AGENTS.md` carries this line verbatim, exactly once: ```text - Delivery team facts (checks, test paths, human allowlist, credential boundary): `docs/agents/delivery.md` ``` +Placement only decides where the line sits; the line itself never changes: + +- The heading that lists agent docs holds a flat bullet list: add the line to that list. +- That heading uses `###` subsections with prose: add a `### Delivery` subsection under it, holding + only the line. +- No such heading: add the line at the end of the file. + ## Full skeleton ```markdown @@ -128,7 +136,7 @@ agent docs (or at the end of the file when it has none): - Bot user: `delivery-bot` - Kubeconfig: `/etc/delivery/kubeconfig-readonly` -- Branch protection: in place +- Branch protection: pending ([Branch protection setup](https://example.org/issues/12)) - Accepted risks: [ADR-0032](https://example.org/adr/0032) ## Conventions @@ -142,9 +150,10 @@ The values in the skeleton are illustrative only; every real value comes from th - [ ] First line `# Delivery`; six `##` headings, verbatim, in order. - [ ] Sections 1–4 hold only items in the syntax above, or `- none`. -- [ ] Every skill in section 1 is installed. +- [ ] Every skill in section 1 is installed. A listed skill that is not installed makes every + consumer hard-stop on any change matching its glob. - [ ] Section 2: exactly one `dry-run`; one `test-path` if the repo has that check. - [ ] Section 3 is the `globs file:` pointer whenever a test-path check reads a globs file. - [ ] Section 4 is non-empty and every name came from the human or a source they named. -- [ ] Section 5 holds paths and links, no secret values. +- [ ] Section 5 holds paths and markdown links, no secret values. - [ ] Root `AGENTS.md` carries the pointer line exactly once. diff --git a/plugins/delivery/.apm/skills/delivery-repo-doc/references/gathering.md b/plugins/delivery/.apm/skills/delivery-repo-doc/references/gathering.md index 69298e4..651ce4b 100644 --- a/plugins/delivery/.apm/skills/delivery-repo-doc/references/gathering.md +++ b/plugins/delivery/.apm/skills/delivery-repo-doc/references/gathering.md @@ -12,19 +12,24 @@ repo; facts only a human holds come from the human. A value with no source stays `inventory/`, `ansible.cfg`), OpenTofu (`*.tf`, `.terraform.lock.hcl`). 2. The installed skills are the session's available-skills listing. Map a glob only to tool skills in that listing whose description covers the area's tool. +3. In a mixed repo (for example Ansible at the top level, Flux under `clusters/`), map each area + with its own glob, and leave out any area with no installed tool skill. ### CI checks 1. Read every workflow under `.gitea/workflows/` or `.github/workflows/` that runs on - `pull_request`. + `pull_request`. A path-filtered `pull_request` workflow still counts: Gitea reports it as + "skipped" when its paths don't match. List it, usually with role `test`. Workflows that run only + on push, schedule or dispatch are not PR checks; leave them out. 2. Derive each candidate name: - Gitea Actions: `<workflow name> / <job name> (<event>)`. The workflow name is the file's top-level `name:` (else the file name); the job name is the job's `name:` (else the job id). - GitHub Actions: the job's `name:` (else the job id); matrix jobs append their values in parentheses. 3. Confirm each candidate against the statuses the forge reports on the head commit of a recent PR - (Gitea: commit statuses via `gitea-prs`; GitHub: `gh pr checks <number>`). The forge's string - wins over the derived one. With no PR to read, keep the derived name and say so in the PR body. + where that check reported at least once. Gitea: `gitea-prs` → `pull_request_read` method + `get_status`, or `commit_read` status on the head SHA; GitHub: `gh pr checks <number>`. The + forge's string wins over the derived one. With no PR to read, keep the derived name and say so in the PR body. 4. Assign roles. `test-path` is the check that fails when a commit after the `Delivery-Stage: test-author` commit touches the test globs. `dry-run` comes from the human. @@ -37,7 +42,8 @@ repo; facts only a human holds come from the human. A value with no source stays ### Conventions -Point at the root `AGENTS.md`, `docs/adr/`, and any contributing or runbook docs that exist. +Point at the root `AGENTS.md`, `docs/adr/`, and any contributing or runbook docs that exist. A list +of pointers the human or caller supplies replaces these defaults. ## Human-sourced -- 2.43.0