agent-templates 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ADOPTING.md +57 -0
- package/CLAUDE.md +125 -0
- package/LICENSE +21 -0
- package/README.md +32 -0
- package/package.json +32 -0
- package/patterns/three-agent-architect-builder-reviewer/README.md +153 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/agents/architect.md +31 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/agents/builder.md +25 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/agents/reviewer.md +33 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/agents/triage.md +31 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/commands/breakdown-prd.md +18 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/commands/build-ticket.md +12 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/commands/nightly-issues.md +14 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/commands/plan-ticket.md +10 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/commands/review-ticket.md +14 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/commands/start-milestone.md +15 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/commands/verify-delivery.md +20 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/hooks/guard-main-session-writes.mjs +53 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/scripts/publish-tickets.mjs +263 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/settings.json +15 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/workflows/nightly-issues.js +139 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/workflows/run-milestone.js +223 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/INSTALL.md +65 -0
- package/patterns/three-agent-architect-builder-reviewer/scaffold/claude-md-snippet.md +37 -0
- package/scripts/adopt.mjs +177 -0
- package/scripts/build-site.mjs +264 -0
- package/scripts/cli.mjs +52 -0
- package/templates/pattern-README.template.md +65 -0
- package/templates/ticket.template.md +104 -0
- package/templates/tracker/github/ISSUE_TEMPLATE/bug-report.md +28 -0
- package/templates/tracker/github/ISSUE_TEMPLATE/decision-record.md +25 -0
- package/templates/tracker/github/ISSUE_TEMPLATE/task.md +36 -0
- package/templates/tracker/github/PULL_REQUEST_TEMPLATE.md +54 -0
- package/templates/tracker/gitlab/issue_templates/bug-report.md +23 -0
- package/templates/tracker/gitlab/issue_templates/decision-record.md +20 -0
- package/templates/tracker/gitlab/issue_templates/task.md +31 -0
- package/templates/tracker/gitlab/merge_request_templates/default.md +55 -0
package/ADOPTING.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Adopting a pattern
|
|
2
|
+
|
|
3
|
+
How to apply a pattern from this catalog to a **new** project (even a folder holding nothing but a `PRD.md`) or an **existing** one.
|
|
4
|
+
|
|
5
|
+
## 0. Pick the pattern
|
|
6
|
+
|
|
7
|
+
Check the index in [README.md](README.md), then the pattern's own §1 **When to use / when not to use** — take the "not" side seriously. Check the pattern's expiry trigger (metadata table); do not copy an expired model/effort table without re-verifying it.
|
|
8
|
+
|
|
9
|
+
## 1. Install — one command
|
|
10
|
+
|
|
11
|
+
From the public npm registry (anonymous, works for anyone):
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
npx agent-templates@latest adopt three-agent-architect-builder-reviewer C:\path\to\your-project
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Pin an exact version for reproducibility (`npx agent-templates@0.1.0 …`) — a published version is a verified snapshot of the catalog's recommendations. Alternatives: `npx github:Ruihang2017/agent-templates …` (tracks the repo, no release needed; npx caches git installs — `--prefer-online` picks up updates), or from a checkout: `node scripts/adopt.mjs three-agent-architect-builder-reviewer <target-dir>`.
|
|
18
|
+
|
|
19
|
+
Idempotent (re-runs skip what exists; `--force` overwrites). It installs the scaffold `.claude/` (agents with pinned model/effort, stage commands, write guard, workflows, publish script), the universal `templates/ticket.template.md`, the platform tracker templates (`--platform gh|glab`, autodetected from the origin remote) into `.github/` or `.gitlab/`, creates `docs/prd|adr|plans/`, copies a root `PRD.md` to `docs/PRD.md`, and seeds or appends `CLAUDE.md` from the pattern snippet (marker-checked, never duplicated).
|
|
20
|
+
|
|
21
|
+
## 2. New project from a bare PRD.md — end to end
|
|
22
|
+
|
|
23
|
+
Preconditions: git repo + remote, authenticated tracker CLI (`gh auth login` / `glab auth login`), Node ≥ 18, Claude Code.
|
|
24
|
+
|
|
25
|
+
1. `git init`, create the remote (e.g. `gh repo create`), commit `PRD.md`.
|
|
26
|
+
2. Run `adopt.mjs` (above) — then commit the scaffolding.
|
|
27
|
+
3. Review `CLAUDE.md`: add your project facts and non-negotiables above the pipeline section; keep **Operating mode: `supervised`** for now. Fill the **Constraint check** section of `.github/PULL_REQUEST_TEMPLATE.md` (or the GitLab MR template) from those non-negotiables.
|
|
28
|
+
4. In Claude Code, in the project: **`/breakdown-prd`** — the Architect decomposes `docs/PRD.md` into `docs/prd/breakdown-plan.md` + sub-PRDs + template-compliant tickets (disjoint file-scopes, dependency DAG), then stops.
|
|
29
|
+
5. **Gate 1 — your product judgment moment.** Review the breakdown: module boundaries, non-goals, the DAG, open questions. Edit/ask until right. Then sign off by running **`/start-milestone docs/prd/00-<module> supervised`** — tickets publish as tracker issues and the pipeline runs the first ticket to a CLEAR verdict, then stops for your merge. Re-run to continue (closed issues are skipped automatically).
|
|
30
|
+
6. **Graduate**: when the supervised runs hold, flip `CLAUDE.md` to `Operating mode: autonomous` — from then on, one `/start-milestone` runs the whole module: plan → build → fresh-context review (bounce-capped) → merge on CLEAR → issue closed → Definition-of-Done verified, with no per-ticket approvals.
|
|
31
|
+
7. **Gate 2**: when the PRD's tasks are done, you smoke-test the result. That is your only test duty — the agents own unit/integration/E2E throughout.
|
|
32
|
+
8. Optional: arm the **nightly sweep** (pattern `INSTALL.md` § Nightly sweep) — overnight issue triage/fix/report while the machine is on.
|
|
33
|
+
|
|
34
|
+
## 3. Existing project
|
|
35
|
+
|
|
36
|
+
Same `adopt.mjs` run — skip-existing protects your files. The differences:
|
|
37
|
+
|
|
38
|
+
- `CLAUDE.md` gets the snippet **appended**: read the merged result once and resolve contradictions with your existing rules (the pipeline rules assume no agent judges its own work).
|
|
39
|
+
- An existing `.claude/settings.json` is kept; merge the scaffold's `hooks.PreToolUse` (write guard) and `permissions.allow` entries by hand.
|
|
40
|
+
- Formalize `docs/PRD.md` for the area you will pipeline first — it can cover a single module; you do not need to spec the whole codebase to start.
|
|
41
|
+
- Retrofit gradually: run one small module through `supervised` mode end to end before trusting `autonomous`. Your existing test suite becomes the Builder/Reviewer suite from day one.
|
|
42
|
+
|
|
43
|
+
## 4. Distributing the catalog
|
|
44
|
+
|
|
45
|
+
The repo is public, so distribution has two tiers:
|
|
46
|
+
|
|
47
|
+
1. **npx from git — works for everyone, today, zero infra.** The `npx github:…` command above needs no credentials and no publishing. Pin `#main` or a tag for reproducibility.
|
|
48
|
+
2. **Public npm — the release tier (LIVE).** Published as [`agent-templates`](https://www.npmjs.com/package/agent-templates) (MIT, maintainer decision 2026-07-17, issue #15). Anonymous installs, semver pinning that pairs with the catalog's expiry discipline (a published version = a verified snapshot of the recommendations), and a natural companion to a future GitHub Pages catalog site.
|
|
49
|
+
|
|
50
|
+
**Why not GitHub Packages:** its npm registry requires an access token **even to install public packages** — "You need an access token to publish, install, and delete private, internal, and public packages" (GitHub docs, *Working with the npm registry*, verified live 2026-07-17) — and it supports scoped names only. That defeats frictionless public sharing; it remains the right choice only for private-org registries, which this catalog no longer needs.
|
|
51
|
+
|
|
52
|
+
## 5. Day-2 operations
|
|
53
|
+
|
|
54
|
+
- `/verify-delivery <ticket>` after every merge (automatic in autonomous mode) — delivery is verified, never assumed.
|
|
55
|
+
- Nightly sweep for open issues; hand-written issues follow the installed templates so triage can convert them.
|
|
56
|
+
- **Pattern-level problems go upstream**: if the pipeline itself misbehaves, file an issue on this catalog (templates provided) — its own nightly sweep triages pattern-tweak requests.
|
|
57
|
+
- Re-verify the pattern's model/effort table when its expiry triggers (successor model or +6 months).
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# agent-templates — Operating Manual
|
|
2
|
+
|
|
3
|
+
> Auto-loaded into every session in this repo. Conversation with the user may be in Chinese; **every file committed to this repo MUST be in English** (docs, scaffolding, comments, identifiers).
|
|
4
|
+
|
|
5
|
+
## What this repo is
|
|
6
|
+
|
|
7
|
+
A library/catalog of the multi-agent development architecture patterns this team reuses across projects. Each pattern is a **self-contained, reusable unit**: a design write-up plus actual working scaffolding (CLAUDE.md snippets, subagent definitions, slash commands) that a new project copies directly instead of redesigning the architecture from scratch.
|
|
8
|
+
|
|
9
|
+
This repo ships documentation, scaffolding, and a testbed. The only application code is the testbed's toy target app.
|
|
10
|
+
|
|
11
|
+
**Target operating model** (what patterns are hardened toward): for a project that fits a pattern, humans decide at exactly two gates — upstream (master PRD → sub-PRDs → generated tickets, signed off before the pipeline starts) and downstream (a smoke test of the delivered work). Between those gates the multi-agent workflow runs autonomously. Consequences for this repo: not every project fits every pattern ("when not to use" is a required section, take it seriously), and role boundaries are enforced mechanically wherever possible — hooks and permission config over prose exhortation, because prose alone has already been observed to fail.
|
|
12
|
+
|
|
13
|
+
**Testing policy** (`[team-policy]`, 2026-07-17, binding on every pattern): the agents own the whole test pyramid — unit, integration, and E2E — run manually or wired into the pipeline as fits the project. The human's only test duty is the final smoke test once the PRD's tasks are all done (Gate 2).
|
|
14
|
+
|
|
15
|
+
## Layout
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
CLAUDE.md # this file — the operating manual
|
|
19
|
+
README.md # human-facing pattern index
|
|
20
|
+
ADOPTING.md # how users apply a pattern to new/existing projects
|
|
21
|
+
LICENSE # MIT (scaffold-output carve-out noted in README § License)
|
|
22
|
+
package.json # published npm package `agent-templates` (bin + files whitelist)
|
|
23
|
+
scripts/
|
|
24
|
+
cli.mjs # npx entry point: list · adopt (dispatches to adopt.mjs)
|
|
25
|
+
adopt.mjs # one-command pattern installer (idempotent; E2E-tested)
|
|
26
|
+
build-site.mjs # generates the GitHub Pages catalog page from pattern data (never hand-edit output)
|
|
27
|
+
templates/ # UNIVERSAL — shared by all patterns and by this repo itself
|
|
28
|
+
pattern-README.template.md # mandatory starting point for every new pattern
|
|
29
|
+
ticket.template.md # the ticket format (field-proven: fx / PIL-15 / FND-9 standard)
|
|
30
|
+
tracker/ # tracker-native templates: github/ + gitlab/ — issues (bug-report,
|
|
31
|
+
# task, decision-record) and the PR/MR template
|
|
32
|
+
patterns/<pattern-name>/ # kebab-case; one directory per pattern
|
|
33
|
+
README.md # the write-up — MUST follow the schema below
|
|
34
|
+
scaffold/ # drop-in files a target repo copies, then adapts
|
|
35
|
+
testbed/ # E2E for the pattern chain (see testbed/README.md)
|
|
36
|
+
e2e/run-e2e.mjs # Level 0: deterministic, zero-token — the merge gate for scaffold changes
|
|
37
|
+
app/ # Level 1: tiny real target project for live pipeline rehearsals
|
|
38
|
+
.claude/ # self-hosted pattern machinery — byte-synced scaffold copies (see "How this repo develops itself")
|
|
39
|
+
.github/ISSUE_TEMPLATE/ # issue templates (from the scaffold) — pattern-tweak requests from other projects land here
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Worked example — `patterns/three-agent-architect-builder-reviewer/` is the canonical entry; **every future pattern must match its format**:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
patterns/three-agent-architect-builder-reviewer/
|
|
46
|
+
├── README.md # schema-compliant write-up (the format reference)
|
|
47
|
+
└── scaffold/
|
|
48
|
+
├── INSTALL.md # how to drop the scaffold into a target repo
|
|
49
|
+
├── claude-md-snippet.md # block to append to the target repo's CLAUDE.md
|
|
50
|
+
└── .claude/
|
|
51
|
+
├── settings.json # PreToolUse write guard wiring
|
|
52
|
+
├── hooks/
|
|
53
|
+
│ └── guard-main-session-writes.mjs
|
|
54
|
+
├── scripts/
|
|
55
|
+
│ └── publish-tickets.mjs
|
|
56
|
+
├── workflows/
|
|
57
|
+
│ ├── run-milestone.js
|
|
58
|
+
│ └── nightly-issues.js
|
|
59
|
+
├── agents/
|
|
60
|
+
│ ├── architect.md
|
|
61
|
+
│ ├── builder.md
|
|
62
|
+
│ ├── reviewer.md
|
|
63
|
+
│ └── triage.md
|
|
64
|
+
└── commands/
|
|
65
|
+
├── breakdown-prd.md
|
|
66
|
+
├── plan-ticket.md
|
|
67
|
+
├── build-ticket.md
|
|
68
|
+
├── review-ticket.md
|
|
69
|
+
├── verify-delivery.md
|
|
70
|
+
├── start-milestone.md
|
|
71
|
+
└── nightly-issues.md
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Pattern README schema (all sections required, in this order)
|
|
75
|
+
|
|
76
|
+
| Section | Must contain |
|
|
77
|
+
|---|---|
|
|
78
|
+
| Metadata table (under the title) | Pattern name · status (`proposed` / `trialed` / `adopted` / `deprecated`) · as-of date · expiry trigger · sign-off |
|
|
79
|
+
| 1. When to use / when not to use | Concrete task shapes, both directions — not adjectives |
|
|
80
|
+
| 2. Agent roles & boundaries | Per agent: what it does / what it must never do; who judges whom |
|
|
81
|
+
| 3. Model + effort assignment | Table: role · model · effort · reasoning · source label per claim. Heading carries the as-of date |
|
|
82
|
+
| 4. Known failure modes / pitfalls | Symptom · the specific context/harness it was observed in · mitigation · date recorded. "None recorded yet" is a valid honest entry; an invented one is not |
|
|
83
|
+
| 5. Upstream / downstream integration | How work enters (master PRD → sub-PRD → ticket, ADRs), what leaves (PR, review verdict, docs), and the **human gates** — where humans decide, and where they must not be needed |
|
|
84
|
+
| 6. Scaffold | What is in `scaffold/` and how to install it |
|
|
85
|
+
| 7. Provenance & change log | Dated entries: what changed, on what basis, by whom |
|
|
86
|
+
|
|
87
|
+
Status glossary: `proposed` = drafted, not signed off · `trialed` = signed off as the team standard, awaiting its first real-ticket run · `adopted` = has run ≥ 1 real ticket in a real project, named in the provenance log · `deprecated` = superseded, kept for history.
|
|
88
|
+
|
|
89
|
+
Upstream docs convention assumed by patterns (exemplar: `fx-eye-tracking`): `docs/PRD.md` (master PRD) → `docs/prd/<module>/README.md` (sub-PRDs) → `docs/prd/<module>/tickets/*.md` (tickets = future issue bodies), plus `docs/adr/` for hard-to-reverse decisions.
|
|
90
|
+
|
|
91
|
+
## Source labels (mandatory on every model/effort claim)
|
|
92
|
+
|
|
93
|
+
| Label | Meaning |
|
|
94
|
+
|---|---|
|
|
95
|
+
| `[official]` | Anthropic docs / system card / model page — verifiable at a URL today |
|
|
96
|
+
| `[vendor-benchmark]` | Anthropic-reported benchmark number |
|
|
97
|
+
| `[third-party]` | External benchmark or report — name the source |
|
|
98
|
+
| `[internal]` | Our own observation — name the harness, project, and date |
|
|
99
|
+
| `[unverified]` | Unverified third-party data / needs testing |
|
|
100
|
+
| `[team-policy]` | A deliberate team decision — a choice, not a capability claim |
|
|
101
|
+
|
|
102
|
+
## Adding a new pattern
|
|
103
|
+
|
|
104
|
+
1. Copy `templates/pattern-README.template.md` → `patterns/<kebab-name>/README.md`. Fill every section; delete none.
|
|
105
|
+
2. Build `scaffold/` with actually-runnable files. Verify every config key (agent/command frontmatter, settings) against current Claude Code docs at write time — not from memory.
|
|
106
|
+
3. `node testbed/e2e/run-e2e.mjs` must be green before merging any scaffold change; when you add scaffold surface (new files, new orchestration logic), extend the E2E suites to cover it.
|
|
107
|
+
4. Open a PR. Status starts at `proposed`.
|
|
108
|
+
5. Sign-off to merge: the repo maintainer (Horace Hou) approves schema compliance and grounding. Promotion to `adopted` additionally requires the pattern having run on ≥1 real ticket in a real project, named in the provenance log.
|
|
109
|
+
6. Any later change to a model/effort recommendation updates the table **and** the as-of date **and** adds a provenance-log entry — in the same commit.
|
|
110
|
+
|
|
111
|
+
## How this repo develops itself
|
|
112
|
+
|
|
113
|
+
1. **Issues are the decision record; commits are only the change record.** Every unit of work starts as a GitHub issue stating what + why (use the universal templates — work items follow `task`/`bug-report`, records follow `decision-record`). The work lands via a PR referencing it (`Closes #N`), written against `.github/PULL_REQUEST_TEMPLATE.md` (byte-synced from `templates/tracker/github/`). **No direct merges to main.** Bootstrap exception: the rounds merged on 2026-07-17 before this rule existed are backfilled as `decision-record` issues #1–#4.
|
|
114
|
+
2. **Self-hosted nightly sweep.** This repo runs the pattern's own `/nightly-issues`: other projects file pattern-tweak requests here (templates in `.github/ISSUE_TEMPLATE/`), and the sweep triages — and where fixable, fixes — them overnight. The machinery at `.claude/` (four agents, two workflows, `nightly-issues` + `verify-delivery` commands) is a **byte-synced copy of the scaffold**, enforced by the E2E integrity suite: change the scaffold first, then re-copy.
|
|
115
|
+
3. **This repo's test suite** is `node testbed/e2e/run-e2e.mjs` — the Builder/Reviewer run it exactly like any project's tests.
|
|
116
|
+
4. The scaffold's main-session write guard is **not installed here** — interactive doc-editing with the maintainer is this repo's norm. Revisit if orchestrator role leakage appears in this repo's own pipeline runs.
|
|
117
|
+
5. Labels in use: `decision-record` · `triage:invalid` · `nightly:escalated` · `needs-human`.
|
|
118
|
+
|
|
119
|
+
## Grounding rules — binding on every agent working in this repo, including Claude
|
|
120
|
+
|
|
121
|
+
1. **No training-data impressions.** Every model/effort recommendation must be grounded in currently verifiable official documentation (link it), or be explicitly labeled `[unverified]` — "unverified third-party data / needs testing". If you cannot verify it right now, label it; never launder a hunch into a recommendation.
|
|
122
|
+
2. **Official conclusions ≠ harness observations.** Keep "conclusion from official docs / system cards" and "phenomenon observed under one specific benchmark harness" visibly distinct (use the source labels). A single-harness observation is never written up as a general conclusion — scope it with harness, conditions, and date.
|
|
123
|
+
3. **As-of dates move with recommendations.** Model capability and effort behavior change across versions; every recommendation is traceable, expirable, and updatable — never a permanent conclusion. Whenever a recommendation changes, its as-of date changes in the same commit.
|
|
124
|
+
4. **Staleness (default policy, maintainer-adjustable):** a model/effort table expires when a successor to any listed model ships, or 6 months after its as-of date, whichever comes first. Expired ≠ wrong — it means "re-verify before citing or copying into a new project".
|
|
125
|
+
5. **English only** in committed files; Chinese is for conversation, never for the repo.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Horace Hou
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# agent-templates
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/agent-templates) · **[Catalog site →](https://ruihang2017.github.io/agent-templates/)**
|
|
4
|
+
|
|
5
|
+
Catalog of reusable multi-agent development architecture patterns. Each entry is a design write-up plus drop-in scaffolding (subagent definitions, slash commands, CLAUDE.md snippets) so a new project reuses a proven pattern instead of redesigning one.
|
|
6
|
+
|
|
7
|
+
## Quickstart — from a bare `PRD.md` to a running pipeline
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
cd path\to\my-project # contains PRD.md; git init + remote done; gh/glab authenticated
|
|
11
|
+
npx agent-templates@latest adopt three-agent-architect-builder-reviewer .
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
(Also works: `npx github:Ruihang2017/agent-templates …` for the unreleased latest, or `node scripts/adopt.mjs …` from a checkout.)
|
|
15
|
+
|
|
16
|
+
1. Review `CLAUDE.md`: add project facts, keep **Operating mode: `supervised`**; fill the PR template's Constraint check from your non-negotiables.
|
|
17
|
+
2. In Claude Code, inside the project: **`/breakdown-prd`** — the Architect turns `docs/PRD.md` into sub-PRDs + tickets, then stops for your review.
|
|
18
|
+
3. **Gate 1** — review the breakdown, then **`/start-milestone docs/prd/00-<module> supervised`**: tickets publish as tracker issues; each ticket runs plan → build → fresh-context review to CLEAR, pausing for your merge.
|
|
19
|
+
4. When it holds, flip to `autonomous` — whole milestones run hands-off. **Gate 2** = your smoke test at the end. Full guide: [ADOPTING.md](ADOPTING.md).
|
|
20
|
+
|
|
21
|
+
| Pattern | Status | As of | Summary |
|
|
22
|
+
|---|---|---|---|
|
|
23
|
+
| [three-agent-architect-builder-reviewer](patterns/three-agent-architect-builder-reviewer/README.md) | trialed | 2026-07-17 | Architect plans → Builder implements → independent Reviewer (fresh context, different model tier) clears or bounces; `/start-milestone` runs a whole module autonomously |
|
|
24
|
+
|
|
25
|
+
- **Applying a pattern to your project** (new — even a bare `PRD.md` — or existing): [ADOPTING.md](ADOPTING.md) — one command: `node scripts/adopt.mjs <pattern> <target-dir>`
|
|
26
|
+
- Operating manual, pattern schema, grounding rules: [CLAUDE.md](CLAUDE.md)
|
|
27
|
+
- Adding a pattern: start from [templates/pattern-README.template.md](templates/pattern-README.template.md), process in [CLAUDE.md](CLAUDE.md) § "Adding a new pattern"
|
|
28
|
+
- E2E testing for the pattern chain: [testbed/README.md](testbed/README.md) — `node testbed/e2e/run-e2e.mjs` is the merge gate for scaffold changes
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
MIT — see [LICENSE](LICENSE). Carve-out: files installed **into your project** by `adopt.mjs` (the scaffold, templates, and anything generated from them) may be used in your projects without attribution.
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agent-templates",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Catalog of multi-agent development architecture patterns - design write-ups plus drop-in scaffolding (agents, slash commands, workflows, templates).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Horace Hou",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"agent-templates": "scripts/cli.mjs"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"scripts/",
|
|
13
|
+
"patterns/",
|
|
14
|
+
"templates/",
|
|
15
|
+
"ADOPTING.md",
|
|
16
|
+
"CLAUDE.md"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/Ruihang2017/agent-templates.git"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/Ruihang2017/agent-templates#readme",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/Ruihang2017/agent-templates/issues"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=18"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"test": "node testbed/e2e/run-e2e.mjs"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Pattern: Three-Agent Architect–Builder–Reviewer
|
|
2
|
+
|
|
3
|
+
| Field | Value |
|
|
4
|
+
|---|---|
|
|
5
|
+
| **Pattern name** | `three-agent-architect-builder-reviewer` |
|
|
6
|
+
| **Status** | `trialed` — signed off as the team standard 2026-07-17; promotes to `adopted` after its first real-ticket run (CLAUDE.md promotion rule) |
|
|
7
|
+
| **As-of date** | 2026-07-17 |
|
|
8
|
+
| **Expiry trigger** | First successor release to any listed model, or 2027-01-17 (+6 months), whichever comes first |
|
|
9
|
+
| **Sign-off** | Horace Hou (repo maintainer), 2026-07-17 |
|
|
10
|
+
|
|
11
|
+
One ticket flows through three agents in sequence: **Architect** plans → **Builder** implements → **Reviewer** (fresh context, different model tier) clears or bounces. No agent judges its own work.
|
|
12
|
+
|
|
13
|
+
## 1. When to use / when not to use
|
|
14
|
+
|
|
15
|
+
**Use when:**
|
|
16
|
+
- Ticket-scoped production changes where a bad merge is expensive: shared services, security-sensitive paths, concurrency-heavy code.
|
|
17
|
+
- The ticket is large enough to amortize three agent runs (rule of thumb: ≥ half a day of human-equivalent work).
|
|
18
|
+
- The team priority is predictable, reviewable delivery over token cost and latency — an explicit policy of this pattern.
|
|
19
|
+
|
|
20
|
+
**Do not use when:**
|
|
21
|
+
- Trivial or mechanical changes (typo fixes, config bumps, codemod output) — pipeline overhead dominates the value.
|
|
22
|
+
- Throwaway spikes and prototypes — a plan plus an independent review of disposable code adds nothing.
|
|
23
|
+
- Live pair-programming where a human already reviews every step in real time.
|
|
24
|
+
|
|
25
|
+
*(Scope guidance is design-derived, not a benchmark claim.)*
|
|
26
|
+
|
|
27
|
+
## 2. Agent roles & boundaries
|
|
28
|
+
|
|
29
|
+
| Agent | Does | Never does |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| **Architect** (Planner) | Reads the ticket and the codebase; produces the implementation plan. Exploration/tool-call heavy. | Writes production code. |
|
|
32
|
+
| **Builder** (Coder) | Implements against the Architect's plan; runs tests; iterates until passing. | Acts as the final judge of its own work; merges without Reviewer clearance. |
|
|
33
|
+
| **Reviewer** | Runs in a **fresh context** (never the Builder's session); reviews the Builder's output against the ticket and the plan, focusing on edge cases, concurrency, and security-sensitive paths. Clears the work or bounces it back to the Builder with findings. | Continues the Builder's session; fixes code itself. |
|
|
34
|
+
|
|
35
|
+
| **Triage** (nightly sweep only) | Classifies open tracker issues — fixable / invalid / needs-human — and synthesizes a cold-startable ticket file from each fixable one. | Fixes code; writes to the tracker (the report step owns all tracker writes). |
|
|
36
|
+
|
|
37
|
+
The Reviewer is **deliberately a different model tier from the Builder** so the two do not share blind spots. This is a hard requirement of the pattern, not a cost knob.
|
|
38
|
+
|
|
39
|
+
**Testing policy `[team-policy]` (2026-07-17):** the agents own the whole test pyramid. The Builder writes and runs unit + integration tests (and E2E tests where the ticket's acceptance calls for them); the Reviewer independently re-runs the full suite; the deliver step re-runs it on the merged default branch. Tests run manually or wired into the pipeline as fits the project. The human tests exactly once — the Gate 2 smoke test after the PRD's tasks are all done.
|
|
40
|
+
|
|
41
|
+
Related in-house variant: fx-eye-tracking's `planner` / `generator` / `evaluator` harness — same independence principle, heavier machinery (spec decomposition, file-scope parallelism, sprint contracts, tracker governance). That harness runs a whole project; this pattern runs one ticket.
|
|
42
|
+
|
|
43
|
+
## 3. Model + effort assignment (as of 2026-07-17)
|
|
44
|
+
|
|
45
|
+
| Role | Model | Effort | Reasoning | Source labels |
|
|
46
|
+
|---|---|---|---|---|
|
|
47
|
+
| Architect | Claude Sonnet 5 | `xhigh` | Planning is terminal/tool-call-heavy work, where Sonnet 5 benchmarks strongest in the lineup: Terminal-Bench 2.1 **80.4** vs Opus 4.8's **74.6**. `xhigh` is Anthropic's documented recommendation for agentic exploration workloads. | Benchmark: `[third-party]` (link not captured — attach at first re-verification). Effort guidance: `[official]` |
|
|
48
|
+
| Builder | Claude Opus 4.8 | `xhigh` | Anthropic's official guidance is to start at `xhigh` for coding and agentic use cases. Opus 4.8 leads Sonnet 5 on the hardest agentic-coding benchmark: SWE-bench Pro **69.2** vs **63.2**. One effort setting for all tickets — no per-ticket downgrades; team priority is predictable delivery over token cost. | Benchmark: `[vendor-benchmark]` (Anthropic-reported). Effort guidance: `[official]`. No-downgrade rule: `[team-policy]` |
|
|
49
|
+
| Reviewer | Claude Fable 5 | `max` | The Reviewer is the last quality gate before merge. Fable 5 has the largest capability margin on the hardest problems (SWE-bench Pro **~80.3**), and catching missed edge cases is where that margin pays off most. `max` because token cost is explicitly not the constraint at this gate. | Benchmark: `[unverified]` — recorded as "reported" without a named source; treat as unverified until linked. `max` choice: `[team-policy]` |
|
|
50
|
+
| Triage (nightly only) | Claude Sonnet 5 | `xhigh` | Classification + ticket synthesis is planning-shaped work; profile inherited from the Architect row rather than separately derived. | `[team-policy]` — no separate benchmark basis |
|
|
51
|
+
|
|
52
|
+
Figures are transcribed from the team-finalized specification dated 2026-07-17 (§7). Do not re-derive or silently alter them; update only via the process in the repo CLAUDE.md (new as-of date + provenance entry in the same commit).
|
|
53
|
+
|
|
54
|
+
## 4. Known failure modes / pitfalls
|
|
55
|
+
|
|
56
|
+
| Pitfall | Context | Mitigation | Recorded |
|
|
57
|
+
|---|---|---|---|
|
|
58
|
+
| **Reviewer contamination** — review run inside the Builder's session inherits the Builder's assumptions and blind spots | Design constraint from the pattern spec (not a measured incident) | Reviewer always starts in a fresh context; `/review-ticket` checks for and refuses a contaminated session | 2026-07-17 |
|
|
59
|
+
| **Tier collapse** — Reviewer switched to the Builder's model/tier "to save cost" | Design constraint | Different tier is a hard requirement; changing it means updating this pattern entry first, not the target repo's config | 2026-07-17 |
|
|
60
|
+
| **Self-clearing** — Builder declares its own "small" diff done and skips review | Process risk | No merge without a Reviewer verdict attached to the PR | 2026-07-17 |
|
|
61
|
+
| **Unbounded bounce loop** — Reviewer ↔ Builder ping-pong without convergence | Process risk | Cap at 2 bounce cycles, then escalate to a human | 2026-07-17 |
|
|
62
|
+
| **Cold-start starvation** — the fresh-context Reviewer (or Builder) lacks context that lived only in the Architect's conversation | Design implication of fresh contexts | Ticket and plan must be self-contained (cold-startable); a plan that needs the planning conversation to be understood is defective | 2026-07-17 |
|
|
63
|
+
| **`max`-effort overthinking / latency at the gate** | Claude Code's own effort-level description: `max` "may use excessive tokens resulting in long response times or overthinking. Use sparingly." — `[official]` product text, observed 2026-07-17 | Accepted at this gate by explicit `[team-policy]`; do not copy `max` to Builder/Architect by default; keep tickets small so review diffs stay bounded | 2026-07-17 |
|
|
64
|
+
| **Orchestrator role leakage** — the main (orchestrator) session absorbs subagent work: plans, implements, or reviews inline instead of dispatching, dissolving the role boundaries the pattern exists for | `[internal]` — observed on fx-eye-tracking's planner/generator/evaluator harness (sibling of this pattern), reported by the maintainer, 2026-07-17. Soft "launch the subagent" prompts alone did not hold. | Mechanically enforced since 2026-07-17: a PreToolUse guard denies main-session Edit/Write while subagent calls pass (`agent_id` is present in hook input only for subagents — see the verification record in `scaffold/INSTALL.md`). Backed by prose rules in the CLAUDE.md snippet and a "never absorb the role" line in every stage command. If leakage still recurs, switch to Mode B (separate human-run sessions — no orchestrator exists to leak). | 2026-07-17 |
|
|
65
|
+
| **Silent delivery drop** — end-of-pipeline bookkeeping relied on side effects that never fired: many MRs merged, **zero** tracker issues closed, and no step verified the transition | `[internal]` — fx-eye-tracking, reported by the maintainer, 2026-07-17. Root cause on that instance not yet diagnosed; typical causes: missing `Closes #N` in the MR description, or merging to a non-default branch (GitLab auto-close fires only on default-branch merges). | Delivery is verified, not assumed: run `/verify-delivery <ticket>` after every merge — it checks the Definition of Done (plan · tests · CLEAR verdict · merged · issue closed · writeback) and repairs gaps only with explicit human OK. Never trust tracker auto-close blindly. | 2026-07-17 |
|
|
66
|
+
| **Guard bypass via Bash** — the write guard blocks the Edit/Write tool family only; the main session can still modify files through Bash (`echo >`, `git apply`, heredocs) | Known boundary of the mechanical guard — design analysis, 2026-07-17, not an incident | Accepted deliberately: blocking Bash would break legitimate orchestrator operations (checkout, merge, tracker CLI). The guard targets the observed failure mode — reflexive "I'll just edit it myself" — not a determined bypass. Prose rule stands: Bash in the main session is for orchestration, never for writing files. If bypass is ever observed in practice, record it here and escalate to Mode B. | 2026-07-17 |
|
|
67
|
+
| **Nightly grinding** — the sweep re-attempts the same unfixable issue night after night, burning tokens | Design risk of the nightly loop (not a measured incident) | Unsolved/failed issues get `nightly:escalated` and are excluded from later sweeps until a human clears the label; `maxIssues` caps each night's spend | 2026-07-17 |
|
|
68
|
+
| **Autonomous misjudgment of "invalid"** — the sweep wrongly declares a real issue invalid and it gets ignored | Design risk | Invalid verdicts only **label** (`triage:invalid`) and comment with evidence — never auto-close; the morning human is the final judge; triage is instructed to prefer `needs-human` when uncertain | 2026-07-17 |
|
|
69
|
+
| **Harness-specific timeouts/failures** for these exact model+effort combinations | **None recorded yet** (as of 2026-07-17) | When observed: record here with harness name, conditions, and date | — |
|
|
70
|
+
|
|
71
|
+
## 5. Upstream / downstream integration
|
|
72
|
+
|
|
73
|
+
**Upstream (work intake)** — assumes the standard docs layout (exemplar: fx-eye-tracking):
|
|
74
|
+
|
|
75
|
+
- `docs/PRD.md` (master PRD) → `docs/prd/<module>/README.md` (sub-PRD) → `docs/prd/<module>/tickets/*.md` (one file per ticket; each ticket is a future issue body).
|
|
76
|
+
- The **ticket file is the Architect's input**; the Architect also reads the linked sub-PRD and any `docs/adr/` entries touching the affected area.
|
|
77
|
+
- The Architect's plan lands at `docs/plans/<ticket-id>.md`. A hard-to-reverse choice made while planning becomes a new ADR, not a paragraph buried in the plan.
|
|
78
|
+
|
|
79
|
+
**Downstream (deliverables):**
|
|
80
|
+
|
|
81
|
+
- Builder → a PR: code + passing tests, referencing the ticket and the plan, plus a deviations note where it departed from the plan.
|
|
82
|
+
- Reviewer → a verdict on the PR: **CLEAR** (short note of what was checked) or **BOUNCE** (numbered findings: `file:line`, failure scenario, severity). Findings go back to the Builder.
|
|
83
|
+
- Net output: merged PR, updated docs/ADRs, closed ticket. Merge requires a CLEAR verdict.
|
|
84
|
+
- **Feedback channel (upstream):** pattern-level problems observed while running the pipeline — a role boundary that misfits, a stale model/effort pin, an orchestration bug — are filed as issues against the pattern catalog (`Ruihang2017/agent-templates`, issue templates provided); the catalog self-hosts the nightly sweep and triages them. Project-level bugs stay in the project's own tracker.
|
|
85
|
+
- Delivery is **verified, not assumed**: after every merge, `/verify-delivery <ticket>` checks the Definition of Done — plan on disk · tests green · CLEAR verdict · MR merged into the default branch · tracker issue closed · writeback done. Added 2026-07-17 after the fx-eye-tracking silent-delivery-drop observation (§4).
|
|
86
|
+
|
|
87
|
+
**Human gates (target operating model):**
|
|
88
|
+
|
|
89
|
+
- **Gate 1 — upstream sign-off = the start signal:** once the module's sub-PRD and all its tickets are generated (from a bare PRD: `/breakdown-prd` generates them for review; format: the catalog's `templates/ticket.template.md`), a human types **`/start-milestone <module>`**. That one action is the sign-off. The session then publishes every ticket as a tracker issue (`.claude/scripts/publish-tickets.mjs` — deterministic and idempotent, `[<id>]` title prefix as the dedupe key; agents never hand-create issues) and launches the milestone runner.
|
|
90
|
+
- **Gate 2 — smoke test:** a human smoke-tests the delivered work at the end of the ticket batch / milestone.
|
|
91
|
+
- **Between the gates the pipeline runs autonomously** via `.claude/workflows/run-milestone.js` (a Workflow script): plan → build → review → merge on CLEAR → deliver (including closing the tracker issue), with no per-ticket human approval. Stage order, reviewer freshness, the bounce cap, and no-merge-without-CLEAR are enforced **in code**, not prose — prose-only orchestration is a recorded failure mode (§4).
|
|
92
|
+
- **Exception path (the only other way a human appears):** 2 bounce cycles without convergence, a failed build, or an unrepairable delivery item escalates to a human; the runner is fail-fast by default because later tickets may depend on earlier ones.
|
|
93
|
+
- **On-ramp:** a project newly adopting the pattern starts in `supervised` mode: the runner takes one ticket to a CLEAR verdict and **stops the run** for the human merge (later tickets may depend on the merged result). Re-run `/start-milestone` to continue — tickets whose issues are already closed are filtered out before the run, which also makes crash recovery mechanical. Switch to `autonomous` once the pattern holds. The mode is declared in the target repo's CLAUDE.md (see `scaffold/claude-md-snippet.md`).
|
|
94
|
+
|
|
95
|
+
**Orchestration mechanics:** a single ticket can still be run by hand with the stage commands; a milestone runs through the deterministic workflow. `ultracode` is not needed in target repos — typing `/start-milestone` is the explicit orchestration request (its instructions call the Workflow tool). Note that `ultracode` is a Claude Code **session setting** (`xhigh` effort + automatic workflow orchestration), not a model effort level — the pattern's pinned per-role efforts are unaffected by it. `[official]` — workflows + model-config docs, verified 2026-07-17 (record in `scaffold/INSTALL.md`).
|
|
96
|
+
|
|
97
|
+
**Nightly issue sweep (unattended variant):** `claude -p "/nightly-issues"` on an OS schedule (Windows Task Scheduler etc.) while the machine is on. Flow: collect open issues → **Triage** (read-only; synthesizes tickets under `docs/prd/99-nightly/` for fixable ones) → **run-milestone** (autonomous, `continueOnFailure` — issues are independent) → one **report** step does all tracker writes: per-issue outcome comments, labels (`triage:invalid` / `nightly:escalated` / `needs-human`), closes delivered issues, and a `Nightly report YYYY-MM-DD` issue. The morning email is the tracker's own notification stream (watch the repo) — no SMTP to configure. Cost cap: `maxIssues` per night (default 5). Hand-written issues follow the catalog's universal tracker templates (`templates/tracker/`, installed to `.github/` / `.gitlab/`) so triage can convert them mechanically. Headless flags, permissions, and scheduling: `scaffold/INSTALL.md` § Nightly sweep.
|
|
98
|
+
|
|
99
|
+
## 6. Scaffold
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
scaffold/
|
|
103
|
+
├── INSTALL.md # install steps + config-key verification record
|
|
104
|
+
├── claude-md-snippet.md # block to append to the target repo's CLAUDE.md
|
|
105
|
+
└── .claude/
|
|
106
|
+
├── settings.json # wires the PreToolUse write guard
|
|
107
|
+
├── hooks/
|
|
108
|
+
│ └── guard-main-session-writes.mjs # denies main-session Edit/Write; subagents pass
|
|
109
|
+
├── scripts/
|
|
110
|
+
│ └── publish-tickets.mjs # tickets → tracker issues; idempotent; dry-run by default
|
|
111
|
+
├── workflows/
|
|
112
|
+
│ ├── run-milestone.js # deterministic milestone runner (Workflow script)
|
|
113
|
+
│ └── nightly-issues.js # nightly sweep: triage → pipeline → report (Workflow script)
|
|
114
|
+
├── agents/ # role definitions with pinned model + effort
|
|
115
|
+
│ ├── architect.md # claude-sonnet-5 @ xhigh; writes the plan, no production code
|
|
116
|
+
│ ├── builder.md # claude-opus-4-8 @ xhigh; inherits all tools
|
|
117
|
+
│ ├── reviewer.md # claude-fable-5 @ max; read/run-only (no Write/Edit)
|
|
118
|
+
│ └── triage.md # claude-sonnet-5 @ xhigh; nightly classification + ticket synthesis
|
|
119
|
+
└── commands/
|
|
120
|
+
├── breakdown-prd.md # /breakdown-prd [notes] → pre-Gate-1: PRD → sub-PRDs + tickets
|
|
121
|
+
├── plan-ticket.md # /plan-ticket <ticket> → Architect stage
|
|
122
|
+
├── build-ticket.md # /build-ticket <ticket> → Builder stage
|
|
123
|
+
├── review-ticket.md # /review-ticket <ticket> → Reviewer stage (fresh context)
|
|
124
|
+
├── verify-delivery.md # /verify-delivery <ticket> → post-merge Definition-of-Done check
|
|
125
|
+
├── start-milestone.md # /start-milestone <module> → Gate 1 signal: publish issues + run milestone
|
|
126
|
+
└── nightly-issues.md # /nightly-issues [max] → unattended sweep (headless claude -p)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Adoption is one command from the catalog — `node scripts/adopt.mjs three-agent-architect-builder-reviewer <target-dir>` — see the catalog's `ADOPTING.md` for the end-to-end walkthrough (bare `PRD.md` → running pipeline).
|
|
130
|
+
|
|
131
|
+
Shared, universal assets live at the **catalog root**, not in this scaffold: `templates/ticket.template.md` (the ticket format — field-proven fx / PIL-15 / FND-9 standard) and `templates/tracker/` (issue + PR/MR templates for GitHub and GitLab). INSTALL steps 1–2 copy them into the target repo alongside `.claude/`.
|
|
132
|
+
|
|
133
|
+
The deterministic chain is covered by the repo's Level-0 E2E (`node testbed/e2e/run-e2e.mjs`, see `testbed/README.md`) — green is the merge gate for scaffold changes. Level 1 (live pipeline rehearsal on `testbed/app/`) is the promotion trigger from `trialed` to `adopted`.
|
|
134
|
+
|
|
135
|
+
Install steps and usage modes: [scaffold/INSTALL.md](scaffold/INSTALL.md). Frontmatter keys (`model`, `effort`, `tools`, command arguments) verified against official Claude Code docs on 2026-07-17 — see the verification record in INSTALL.md.
|
|
136
|
+
|
|
137
|
+
## 7. Provenance & change log
|
|
138
|
+
|
|
139
|
+
| Date | Change | Basis | Author |
|
|
140
|
+
|---|---|---|---|
|
|
141
|
+
| 2026-07-17 | Initial entry. Roles, boundaries, and the model/effort table adopted as the team standard. | Team-finalized specification, 2026-07-17. Benchmark figures transcribed as recorded there; original source links were not captured — attach them at the first re-verification. Scaffold config keys verified against live Claude Code docs same day (record in `scaffold/INSTALL.md`). | Horace Hou (spec) / Claude Fable 5 (write-up) |
|
|
142
|
+
| 2026-07-17 | Added two `[internal]` failure modes observed on the fx-eye-tracking sibling harness: orchestrator role leakage, and silent delivery drop (MRs merged, issues never closed). Hardened the scaffold accordingly: orchestrator-discipline rules in the CLAUDE.md snippet, "never absorb the role" line in every stage command, new `/verify-delivery` Definition-of-Done command. Model/effort table unchanged. | Maintainer report (Horace Hou), 2026-07-17. | Horace Hou (report) / Claude Fable 5 (write-up) |
|
|
143
|
+
| 2026-07-17 | Documented the target operating model — two human gates (upstream PRD/sub-PRD/ticket sign-off; final smoke test), autonomous pipeline in between, `supervised` on-ramp mode. Orchestrator write-denial is now mechanically enforced: PreToolUse guard denies main-session Edit/Write, subagent calls pass. Model/effort table unchanged. | Maintainer direction (Horace Hou), 2026-07-17. Hook mechanism verified against live Claude Code docs the same day (hooks.md, permissions.md — record in `scaffold/INSTALL.md`). | Horace Hou (direction) / Claude Fable 5 (write-up) |
|
|
144
|
+
| 2026-07-17 | Gate 1 made concrete: `/start-milestone` = the human start signal → tickets auto-published as tracker issues (`publish-tickets.mjs`, adapted from fx-eye-tracking `create-issues.mjs`; `[<id>]` title prefix as dedupe key; smoke-tested dry-run/no-CLI/usage paths) → deterministic milestone runner (`run-milestone.js` Workflow script: stage order, reviewer freshness, bounce cap, merge policy in code). Added `templates/ticket.template.md` (adapted from fx ticket discipline). Recorded the Bash guard boundary as a known pitfall. Clarified `ultracode`: a session setting (`xhigh` + automatic workflow orchestration), not a model effort level — role efforts unchanged. | Maintainer direction (Horace Hou), 2026-07-17. fx-eye-tracking conventions read the same day (read-only). Workflow tool, `.claude/workflows/`, and `ultracode` semantics verified against live docs (workflows, claude-directory, model-config — record in `scaffold/INSTALL.md`). | Horace Hou (direction) / Claude Fable 5 (write-up) |
|
|
145
|
+
| 2026-07-17 | **Catalog site**: claymorphic GitHub Pages page generated from pattern data (`scripts/build-site.mjs` — parses pattern README metadata/§1/§3 + package.json; live npm-version fetch with build-time fallback; deployed via `gh-pages` branch). Style spec + generated-not-handwritten rationale in catalog issue #17. | Maintainer direction (Horace Hou) with reference designs, 2026-07-17. | Horace Hou (direction) / Claude Fable 5 (build) |
|
|
146
|
+
| 2026-07-17 | **Released**: catalog published to public npm as `agent-templates` under MIT (maintainer decisions: MIT + personal ownership + publish, 2026-07-17 — catalog issue #15). README carries the scaffold-output attribution carve-out. Adoption command is now `npx agent-templates@latest adopt …`. | Maintainer decision (Horace Hou), 2026-07-17. | Horace Hou (decision) / Claude Fable 5 (release) |
|
|
147
|
+
| 2026-07-17 | **Registry decision — public npm over GitHub Packages** (repo is public; goal is public sharing): GH Packages requires a token even to install public packages (`[official]` GitHub docs, verified live 2026-07-17) and is scope-only; npm allows anonymous installs and the bare name `agent-templates` was unclaimed (registry 404, same day). Publish itself is gated on maintainer decisions — license (repo has none), npm account/name — tracked in catalog issue #13; `package.json` carries the publish-prep (`files`, `repository`) with `private: true` until then. | Maintainer direction (Horace Hou) + live verification, 2026-07-17. | Horace Hou (direction) / Claude Fable 5 (write-up) |
|
|
148
|
+
| 2026-07-17 | **Distribution**: the catalog is npx-runnable (`npx github:Ruihang2017/agent-templates adopt <pattern> <dir>` — root `package.json` bin → `scripts/cli.mjs` dispatcher; `private: true` blocks accidental registry publish, git-specifier installs unaffected). README gained the five-step quickstart; ADOPTING.md gained the team-distribution tiers (npx-from-git → GitHub Packages → public npm) and the org-account question (open, issue #11). | Maintainer direction (Horace Hou), 2026-07-17. | Horace Hou (direction) / Claude Fable 5 (build) |
|
|
149
|
+
| 2026-07-17 | **Adoption path** (maintainer request: "a folder with only a PRD.md"): one-command installer `scripts/adopt.mjs` (idempotent; scaffold + universal templates + docs skeleton + CLAUDE.md seed/append; E2E-tested incl. re-run and platform variants), new `/breakdown-prd` command closing the flow gap between a bare master PRD and ticket'd modules (Architect charter extended to planning artifacts: plans + decomposition outputs, still never production code), and the catalog-level `ADOPTING.md` walkthrough (new + existing projects). Catalog issue #9. | Maintainer direction (Horace Hou), 2026-07-17. | Horace Hou (direction) / Claude Fable 5 (build) |
|
|
150
|
+
| 2026-07-17 | Templates made **universal** (maintainer direction): source of truth relocated from this scaffold to the catalog root — `templates/ticket.template.md` upgraded to the field-proven PIL-15 / FND-9 standard (traceability header with ADR/PR chain + per-ticket agent-assignment basis, `lane`/`blocked_by`/`blocks` frontmatter DAG, per-item Non-goal owners, file-scope does-not-touch + serial-safety analysis, code-level deliverables, project-defined acceptance-tag vocabulary, enumerated feedback-obligation escalation paths). Added `templates/tracker/`: PR/MR templates (pipeline-evidence + constraint-check sections, after MeritAI's) and a `decision-record` issue template formalizing catalog issues #1–#4's genre. The catalog itself uses the same templates (`.github/` byte-synced, E2E-enforced). Catalog issue #7. | Maintainer direction (Horace Hou), 2026-07-17, citing realtime-pilot PIL-15 and MeritAI FND-9 + PULL_REQUEST_TEMPLATE.md (both read-only references). | Horace Hou (direction) / Claude Fable 5 (write-up) |
|
|
151
|
+
| 2026-07-17 | Documented the **upstream feedback channel** (target repos file pattern-level issues against the catalog, which self-hosts the nightly sweep to triage them). The catalog repo also adopted issue/PR decision-record discipline — see catalog issues #1–#5. | Maintainer direction (Horace Hou), 2026-07-17. | Horace Hou (direction) / Claude Fable 5 (write-up) |
|
|
152
|
+
| 2026-07-17 | Added the unattended **nightly issue sweep** (triage agent + `nightly-issues` workflow + `/nightly-issues` headless entry + native tracker issue templates so hand-written issues keep the pipeline format), the **testbed** (Level-0 deterministic E2E — 122 checks over guard/publisher/runner — plus the Level-1 live-rehearsal app; Level-0 green is now the merge gate for scaffold changes), `GH_BIN`/`GLAB_BIN` test-double overrides (fx `GLAB_BIN` precedent), and the **testing policy**: agents own unit/integration/E2E; the human's only test duty is the Gate 2 smoke test after the PRD completes. Headless/permission/scheduling facts verified against live docs (headless.md, permission-modes.md, permissions.md, scheduled-tasks.md, routines.md — record in `scaffold/INSTALL.md`). | Maintainer direction (Horace Hou), 2026-07-17; verified by testbed E2E 122/122 green. | Horace Hou (direction) / Claude Fable 5 (build) |
|
|
153
|
+
| 2026-07-17 | Pre-merge adversarial review (three parallel reviewers; script findings reproduced with fixtures and fake gh/glab CLIs) — all findings fixed. Runner: a reviewer infrastructure failure no longer consumes bounce budget or dispatches phantom fixes (one retry → escalate `reviewer-failed`); `delivered` now requires merged ∧ issueClosed ∧ dodPassed; plan paths computed in code, agent-returned values verified; branch mismatch = builder failure; empty-findings BOUNCE escalates; config strictly validated; `supervised` mode stops the run after each CLEAR for dependency safety, resumable because closed issues are filtered on re-run. Publisher: existence check now fetches the issue list once per run and matches the `[<id>]` prefix exactly (fixes wrong-issue-number matching and per-ticket search rate/consistency risks); create failures keep the machine-readable summary and exit 1; within-run duplicate-id dedupe; BOM and quoted-YAML titles handled; invalid tickets included in the summary. DoD gains an explicit "tests green" item (verify-delivery + deliver prompt). Status corrected `adopted` → `trialed` per the promotion rule — this pattern has not yet run a real ticket (fx-eye-tracking ran the sibling harness, not this pipeline). | Internal adversarial review, 2026-07-17. | Claude Fable 5 (fixes); status correction flagged for maintainer confirmation |
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architect
|
|
3
|
+
description: Architect (Planner) stage of the three-agent pattern. Reads the ticket and the codebase, produces the implementation plan at docs/plans/<ticket-id>.md. Exploration/tool-call heavy. Writes NO production code.
|
|
4
|
+
model: claude-sonnet-5
|
|
5
|
+
effort: xhigh
|
|
6
|
+
tools: Read, Glob, Grep, Bash, Write
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<!-- Model/effort pinned per pattern three-agent-architect-builder-reviewer, as of 2026-07-17.
|
|
10
|
+
Do not change them here first — update the pattern entry in agent-templates, then sync. -->
|
|
11
|
+
|
|
12
|
+
You are the **Architect** in the Architect → Builder → Reviewer pipeline. You plan; you do not build. You write **planning artifacts only**: per-ticket implementation plans (`docs/plans/`), and — when running a PRD decomposition via `/breakdown-prd` — the breakdown plan, sub-PRDs, and tickets under `docs/prd/` (follow that command's output spec and `templates/ticket.template.md` exactly). Never production code, tests, or configs.
|
|
13
|
+
|
|
14
|
+
**Ticket-planning mode** — input: a ticket (ID or file path). Read the ticket, its sub-PRD, and any `docs/adr/` entries touching the affected area.
|
|
15
|
+
|
|
16
|
+
Produce `docs/plans/<ticket-id>.md` containing:
|
|
17
|
+
|
|
18
|
+
1. **Scope** — what this ticket changes, and explicitly what it does not.
|
|
19
|
+
2. **Change list** — the exact files/functions to touch and how, found by exploring the codebase now, not guessed.
|
|
20
|
+
3. **Test plan** — what proves each acceptance criterion.
|
|
21
|
+
4. **Risks & edge cases** — concurrency and security-sensitive paths called out explicitly (the Reviewer will check these).
|
|
22
|
+
5. **Open questions** — anything unresolved, each with who decides it.
|
|
23
|
+
|
|
24
|
+
Rules:
|
|
25
|
+
|
|
26
|
+
- Everything you write must be **cold-startable**: a fresh agent with no access to this conversation must be able to execute it from the file alone. If understanding it requires this conversation, it is defective.
|
|
27
|
+
- In ticket-planning mode you write exactly one file — the plan.
|
|
28
|
+
- Use Bash for read-only exploration only (builds, `git log`, inspection) — never to modify state.
|
|
29
|
+
- A hard-to-reverse architectural choice made while planning is flagged as an ADR candidate in the plan, not buried in it.
|
|
30
|
+
|
|
31
|
+
Output: the plan path plus a one-paragraph summary.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: builder
|
|
3
|
+
description: Builder (Coder) stage of the three-agent pattern. Implements one ticket against the Architect's plan, runs tests, iterates until passing. Never the final judge of its own work.
|
|
4
|
+
model: claude-opus-4-8
|
|
5
|
+
effort: xhigh
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Model/effort pinned per pattern three-agent-architect-builder-reviewer, as of 2026-07-17.
|
|
9
|
+
Do not change them here first — update the pattern entry in agent-templates, then sync. -->
|
|
10
|
+
|
|
11
|
+
You are the **Builder** in the Architect → Builder → Reviewer pipeline.
|
|
12
|
+
|
|
13
|
+
Input: a ticket and its plan at `docs/plans/<ticket-id>.md`. Read both before writing any code.
|
|
14
|
+
|
|
15
|
+
Do:
|
|
16
|
+
|
|
17
|
+
1. Implement exactly the plan's scope. Write and run the tests it calls for — unit and integration always, E2E where the ticket's acceptance requires it — and iterate until green. Testing is your job, not the human's.
|
|
18
|
+
2. Where reality forces a departure from the plan, depart — and record it in a **Deviations** note (what changed, why).
|
|
19
|
+
3. Finish with: a diff summary, the actual test output (never "should pass"), and the Deviations note.
|
|
20
|
+
|
|
21
|
+
Never:
|
|
22
|
+
|
|
23
|
+
- Judge your own work as final — clearance comes only from the Reviewer, in a fresh context.
|
|
24
|
+
- Merge, or mark the ticket done.
|
|
25
|
+
- Expand scope beyond ticket + plan. If the plan is wrong, say so in Deviations rather than silently redesigning.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reviewer
|
|
3
|
+
description: Reviewer stage of the three-agent pattern. Independent judge in a FRESH context — never the Builder's session, deliberately a different model tier from the Builder so the two do not share blind spots. Clears the work or bounces it back with findings.
|
|
4
|
+
model: claude-fable-5
|
|
5
|
+
effort: max
|
|
6
|
+
tools: Read, Glob, Grep, Bash
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<!-- Model/effort pinned per pattern three-agent-architect-builder-reviewer, as of 2026-07-17.
|
|
10
|
+
Do not change them here first — update the pattern entry in agent-templates, then sync. -->
|
|
11
|
+
|
|
12
|
+
You are the **Reviewer** — the last quality gate before merge, independent of the Builder.
|
|
13
|
+
|
|
14
|
+
Context rule: you must be running in a **fresh context**. Your input is only: the ticket, the plan (`docs/plans/<ticket-id>.md`), and the Builder's diff (branch or PR ref). If you have been handed the Builder's conversation or its self-assessment, stop and report the pattern violation instead of reviewing.
|
|
15
|
+
|
|
16
|
+
Review the diff against the ticket and the plan, in priority order:
|
|
17
|
+
|
|
18
|
+
1. **Edge cases** — inputs and states the happy path ignores.
|
|
19
|
+
2. **Concurrency** — races, ordering assumptions, shared-state mutation.
|
|
20
|
+
3. **Security-sensitive paths** — authz checks, input validation, secrets handling, injection.
|
|
21
|
+
4. **Plan conformance** — undeclared deviations from the plan are findings.
|
|
22
|
+
|
|
23
|
+
Method:
|
|
24
|
+
|
|
25
|
+
- Run the FULL suite yourself via Bash — unit, integration, and E2E where present, not only the tests the diff touches. Never trust reported results.
|
|
26
|
+
- Be adversarial: try to refute the claim that the ticket is done. Default to BOUNCE when uncertain.
|
|
27
|
+
|
|
28
|
+
Verdict (exactly one):
|
|
29
|
+
|
|
30
|
+
- **CLEAR** — with a short note of what was checked.
|
|
31
|
+
- **BOUNCE** — with numbered findings: `file:line` · concrete failure scenario · severity. Findings go back to the Builder.
|
|
32
|
+
|
|
33
|
+
Never: fix the code yourself; approve out of politeness; re-clear without new commits to review.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: triage
|
|
3
|
+
description: Nightly triage stage. Classifies an open tracker issue as fixable / invalid / needs-human; for fixable ones synthesizes a cold-startable pipeline ticket file from the issue. Never fixes code, never touches the tracker.
|
|
4
|
+
model: claude-sonnet-5
|
|
5
|
+
effort: xhigh
|
|
6
|
+
tools: Read, Glob, Grep, Bash, Write
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<!-- Model/effort: profile inherited from the Architect row of the pattern README §3 —
|
|
10
|
+
classification + ticket synthesis is planning-shaped work; no separate benchmark
|
|
11
|
+
basis. [team-policy], as of 2026-07-17. Update via the pattern entry, then sync. -->
|
|
12
|
+
|
|
13
|
+
You are the **Triage** stage of the nightly issue sweep.
|
|
14
|
+
|
|
15
|
+
Input: one tracker issue (number, title, body, labels).
|
|
16
|
+
|
|
17
|
+
Classify it as exactly one of:
|
|
18
|
+
|
|
19
|
+
- **fixable** — a real defect or small task the pipeline can complete autonomously: a clear symptom or goal, bounded scope, and you can trace it to specific code by exploring now.
|
|
20
|
+
- **invalid** — not a real issue: works as intended, duplicate, or out of scope. State why, with evidence (file refs, the behavior you verified).
|
|
21
|
+
- **needs-human** — real, but not autonomous-safe: needs product judgment, a hard-to-reverse choice, is too large for one overnight ticket, or you cannot locate the code.
|
|
22
|
+
|
|
23
|
+
For **fixable** only: write a ticket file at `docs/prd/99-nightly/tickets/ISS-<number>-<slug>.md` following `templates/ticket.template.md` (`id: ISS-<number>`, `module: 99-nightly`, honest `size`). Inline everything the pipeline needs — quote the relevant issue text, name the files you traced — per the cold-start rule. The acceptance checklist must be classified, mechanical wherever possible, and MUST turn the reported symptom into a test.
|
|
24
|
+
|
|
25
|
+
Rules:
|
|
26
|
+
|
|
27
|
+
- Read the code to verify claims before classifying — never classify from the issue text alone.
|
|
28
|
+
- Never modify code. Never close, label, or comment on issues — tracker writes belong to the report step.
|
|
29
|
+
- When torn between fixable and needs-human, choose **needs-human**: a wrong autonomous fix at night is worse than a skipped issue.
|
|
30
|
+
|
|
31
|
+
Return: `classification`, `reason` (with evidence), and `ticketPath` (fixable only).
|
package/patterns/three-agent-architect-builder-reviewer/scaffold/.claude/commands/breakdown-prd.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Decompose docs/PRD.md into sub-PRDs + template-compliant tickets (three-agent pattern, pre-Gate-1 planning)
|
|
3
|
+
argument-hint: [focus notes, e.g. module-count hint or what to defer]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Launch the **architect** subagent to decompose the master PRD. Optional focus notes from the human: `$ARGUMENTS`
|
|
7
|
+
|
|
8
|
+
Input: `docs/PRD.md` (hard requirement — STOP with a clear message if absent) plus any existing `docs/adr/` entries.
|
|
9
|
+
|
|
10
|
+
Output (planning artifacts only — the architect writes no production code):
|
|
11
|
+
|
|
12
|
+
1. `docs/prd/breakdown-plan.md` — the module split, cut on **file-ownership boundaries** (disjoint file-scopes are what make parallel lanes safe later; shared contracts/schemas go into a foundation module built first), the global file-scope allocation table, and the ticket dependency DAG (mirrors each ticket's `blocked_by`/`blocks`).
|
|
13
|
+
2. Per module `NN-<name>`: `docs/prd/NN-<name>/README.md` — the sub-PRD: problem, scope/non-goals, decisions (each with a basis), rejected alternatives, open questions (each with an owner), work-breakdown table (ticket · size · lane · file-scope · depends-on), acceptance, changelog.
|
|
14
|
+
3. `docs/prd/NN-<name>/tickets/<ID>-<slug>.md` — every ticket follows `templates/ticket.template.md` **fully**: traceability header, "Why `<agent>`" basis, `lane`/`blocked_by`/`blocks` frontmatter, per-item Non-goal owners, file-scope + does-not-touch + serial-safety, code-level deliverables, classified acceptance (tag vocabulary from this repo's CLAUDE.md), test plan, feedback obligation. Every ticket must be cold-startable.
|
|
15
|
+
|
|
16
|
+
When the architect returns: present the breakdown summary (modules, ticket count, DAG, open questions) and **STOP**. This output is the input to Gate 1 — the human's review plus `/start-milestone` is the sign-off. Never begin implementation from this command.
|
|
17
|
+
|
|
18
|
+
Hard rule: this stage runs in the **architect** subagent, never inline in this session. If the subagent cannot be launched or fails, report that and stop — do not absorb its role.
|