@apogeelabs/the-agency 0.8.0 → 0.10.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/README.md CHANGED
@@ -1,82 +1,91 @@
1
1
  # @apogeelabs/the-agency
2
2
 
3
- Centralized Claude Code agents, commands, and workflows. Install once, sync to any project.
3
+ A multi-agent development toolkit for [Claude Code](https://docs.anthropic.com/en/docs/claude-code). It gives your project a team of specialized AI agents — architect, developer, reviewer, test hardener, and more that collaborate through the filesystem to take features from idea to implementation.
4
4
 
5
- ## Install
5
+ Install the package, sync the files, and your Claude Code sessions gain access to structured workflows that turn vague requirements into build plans and build plans into tested, review-ready code.
6
+
7
+ ## Quick Start
6
8
 
7
9
  ```bash
10
+ # Install
8
11
  npm install -D @apogeelabs/the-agency
9
- ```
10
-
11
- ## Usage
12
12
 
13
- ```bash
14
- # Sync all agents, commands, and AI context files to your project
13
+ # Sync agents, commands, and AI context files into your project
15
14
  npx the-agency sync
16
15
 
17
- # Choose which files to sync
16
+ # Or pick specific files to sync
18
17
  npx the-agency sync --pick
18
+ ```
19
19
 
20
- # Install optional review check plugins
21
- npx the-agency install-review-plugins
20
+ This copies files into `.claude/agents/`, `.claude/commands/`, and `.ai/` in your project. You'll be prompted before overwriting existing files.
21
+
22
+ ## The Workflow
23
+
24
+ The core workflow is a pipeline that moves from requirements to shipped code:
25
+
26
+ ```
27
+ /pm --> product brief --> /architect --> build plan --> /build or /auto-build
22
28
  ```
23
29
 
24
- Files are copied to `.claude/agents/`, `.claude/commands/`, and `.ai/` in the target project. If destination files already exist, you'll be prompted before overwriting.
30
+ - **`/pm`** Interactive session that produces a product brief (`docs/briefs/[feature].md`)
31
+ - **`/architect`** — Interactive session that produces a build plan (`docs/build-plans/[feature].md`)
32
+ - **`/build`** — Orchestrates dev, review, and test agents with manual gates between stages
33
+ - **`/auto-build`** — Fully autonomous pipeline: build, commit, and draft PR with no human intervention
34
+
35
+ After a build completes, use **`/retrospective`** to consolidate lessons from pipeline reports into reusable patterns.
36
+
37
+ Agents communicate only through the filesystem. No shared context windows. This is intentional — it forces each agent to write down its reasoning, which makes the whole pipeline auditable.
38
+
39
+ See `.ai/workflow.md` after syncing for the full workflow guide.
25
40
 
26
41
  ## What's Included
27
42
 
28
43
  ### Agents (`.claude/agents/`)
29
44
 
30
- Autonomous subagents that run in isolated context windows and communicate through files.
45
+ Autonomous subagents that run in isolated context windows.
31
46
 
32
47
  | Agent | Purpose |
33
48
  | ----------------- | ---------------------------------------------------------- |
34
49
  | **architect** | Designs technical approach, produces build plans |
50
+ | **auto-prep-pr** | Non-interactive PR preparation and draft creation |
35
51
  | **dev** | Implements features from build plans, task by task |
36
52
  | **explorer** | Maps and documents unfamiliar codebases (read-only) |
37
53
  | **pm** | Produces product briefs from requirements |
54
+ | **retrospective** | Extracts patterns from pipeline reports into retro files |
38
55
  | **reviewer** | Adversarial code review with pass/fail verdict (read-only) |
39
- | **test-hardener** | Writes edge case tests, tries to break things |
56
+ | **test-hardener** | Writes edge-case tests, tries to break things |
40
57
 
41
58
  ### Commands (`.claude/commands/`)
42
59
 
43
60
  Slash commands invoked in Claude Code sessions.
44
61
 
45
- | Command | Purpose |
46
- | ----------------- | -------------------------------------------------- |
47
- | `/architect` | Interactive architecture design session |
48
- | `/build` | Orchestrates the full dev review test pipeline |
49
- | `/pm` | Interactive product requirements discovery |
50
- | `/prep-pr` | Pre-submission PR prep and draft creation |
51
- | `/review-pr` | Structured PR review briefing |
52
- | `/weekly-summary` | Weekly synthesis of merged PRs |
53
- | `/dnd-alignment` | D&D alignment chart from commit history |
62
+ | Command | Purpose |
63
+ | ----------------- | -------------------------------------------------------------- |
64
+ | `/architect` | Interactive architecture design session |
65
+ | `/auto-build` | Fully autonomous build + commit + draft PR pipeline |
66
+ | `/auto-prep-pr` | Non-interactive PR prep via auto-prep-pr agent |
67
+ | `/build` | Orchestrates the dev review → test pipeline (manually-gated) |
68
+ | `/pm` | Interactive product requirements discovery |
69
+ | `/prep-pr` | Pre-submission PR prep and draft creation |
70
+ | `/retrospective` | Interactive consolidation of retro files into lessons-learned |
71
+ | `/review-pr` | Structured PR review briefing |
72
+ | `/weekly-summary` | Weekly synthesis of merged PRs |
73
+ | `/dnd-alignment` | D&D alignment chart from commit history |
54
74
 
55
75
  ### AI Context (`.ai/`)
56
76
 
57
77
  Reference material automatically available to Claude Code.
58
78
 
59
- | File | Purpose |
60
- | ------------------------- | ----------------------------------------- |
61
- | **UnitTestGeneration.md** | TypeScript/Jest unit testing style guide |
62
- | **UnitTestExamples.md** | Working examples for the test style guide |
63
- | **workflow.md** | Multi-agent development workflow guide |
64
-
65
- ## The Workflow
66
-
67
- ```
68
- /pm → docs/briefs/[feature].md → /architect → docs/build-plans/[feature].md → /build
69
- ```
70
-
71
- - **`/pm`** and **`/architect`** are interactive — back-and-forth conversations that produce documents
72
- - **`/build`** is autonomous — orchestrates dev, review, and test agents with automatic fix loops
73
- - Agents communicate only through the filesystem. No shared context. This is intentional.
74
-
75
- See `.ai/workflow.md` after syncing for the full workflow guide.
79
+ | File | Purpose |
80
+ | ------------------------- | ----------------------------------------------- |
81
+ | **UnitTestGeneration.md** | TypeScript/Jest unit testing style guide |
82
+ | **UnitTestExamples.md** | Working examples for the test style guide |
83
+ | **workflow.md** | Multi-agent development workflow guide |
84
+ | **lessons-learned.md** | Accumulated lessons from retrospective analysis |
76
85
 
77
86
  ## Review Checks (`.ai/review-checks/`)
78
87
 
79
- The `/review-pr` command supports pluggable tribal knowledge checks. Place markdown files in `.ai/review-checks/` in your repo, and the review command discovers and evaluates them automatically.
88
+ The `/review-pr` command supports pluggable tribal-knowledge checks. Place markdown files in `.ai/review-checks/` in your repo, and the review command discovers and evaluates them automatically.
80
89
 
81
90
  ### Check File Format
82
91
 
@@ -102,8 +111,6 @@ Install review plugins interactively:
102
111
  npx the-agency install-review-plugins
103
112
  ```
104
113
 
105
- This presents a multi-select of available plugins and copies your selections to `.ai/review-checks/`.
106
-
107
114
  | Plugin | Targets | Checks |
108
115
  | --------------------- | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
109
116
  | **react-frontend.md** | `.tsx`, `.jsx`, `.css`, `.scss`, `.styled.ts` files | Hard-coded colors, missing `data-cy` attributes, accessibility gaps |
@@ -119,8 +126,8 @@ The sync does **not** copy `settings.local.json` or `settings.json` — those ar
119
126
 
120
127
  - Node.js >= 22
121
128
  - Claude Code
122
- - GitHub CLI (`gh`) — required for `/review-pr` and PR-related operations
129
+ - GitHub CLI (`gh`) — required for `/review-pr`, `/prep-pr`, and PR-related operations
123
130
 
124
131
  ## Development
125
132
 
126
- See the [DEVELOP readme](./DEVELOP.md) for information on how to develop within this repo.
133
+ See [DEVELOP.md](./DEVELOP.md) for setup, build, test, and publishing workflows.
package/dist/manifest.js CHANGED
@@ -4,22 +4,43 @@ const manifest = {
4
4
  { file: "dev.md", description: "Implements features from build plans" },
5
5
  { file: "explorer.md", description: "Explores and maps unfamiliar codebases" },
6
6
  { file: "pm.md", description: "Produces product briefs from requirements" },
7
+ {
8
+ file: "auto-prep-pr.md",
9
+ description: "Non-interactive PR preparation and draft creation"
10
+ },
7
11
  { file: "reviewer.md", description: "Adversarial code review with pass/fail verdict" },
8
- { file: "test-hardener.md", description: "Hardens test coverage, finds edge cases" }
12
+ { file: "test-hardener.md", description: "Hardens test coverage, finds edge cases" },
13
+ {
14
+ file: "retrospective.md",
15
+ description: "Extracts patterns from pipeline reports into per-feature retro files"
16
+ }
9
17
  ],
10
18
  commands: [
11
19
  { file: "architect.md", description: "Interactive architecture design sessions" },
12
- { file: "build.md", description: "Build orchestrator pipeline" },
20
+ {
21
+ file: "auto-build.md",
22
+ description: "Fully autonomous build + commit + draft PR pipeline"
23
+ },
24
+ { file: "auto-prep-pr.md", description: "Non-interactive PR prep via auto-prep-pr agent" },
25
+ { file: "build.md", description: "Build orchestrator pipeline (manually-gated)" },
13
26
  { file: "pm.md", description: "Interactive product requirements discovery" },
14
27
  { file: "prep-pr.md", description: "Pre-submission PR prep and draft creation" },
15
28
  { file: "review-pr.md", description: "Structured PR review briefing" },
16
29
  { file: "weekly-summary.md", description: "Weekly synthesis of merged PRs" },
17
- { file: "dnd-alignment.md", description: "D&D alignment chart from commit history" }
30
+ { file: "dnd-alignment.md", description: "D&D alignment chart from commit history" },
31
+ {
32
+ file: "retrospective.md",
33
+ description: "Interactive consolidation of retro files into lessons-learned"
34
+ }
18
35
  ],
19
36
  ai: [
20
37
  { file: "UnitTestGeneration.md", description: "TypeScript/Jest unit testing style guide" },
21
38
  { file: "UnitTestExamples.md", description: "Reference examples for the test style guide" },
22
- { file: "workflow.md", description: "Multi-agent development workflow guide" }
39
+ { file: "workflow.md", description: "Multi-agent development workflow guide" },
40
+ {
41
+ file: "lessons-learned.md",
42
+ description: "Accumulated lessons from retrospective analysis"
43
+ }
23
44
  ],
24
45
  reviewPlugins: [
25
46
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apogeelabs/the-agency",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "Centralized Claude Code agents, commands, and workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,9 +10,9 @@ Before generating any tests, complete these steps in order:
10
10
 
11
11
  1. **Branch analysis** (Coverage-Driven Test Planning): Read the source, enumerate every branch, map each to a test scenario.
12
12
  2. **Superfluous test check** (Superfluous Test Prevention): Verify each planned scenario covers a distinct branch, not the same branch with different values.
13
- 3. **Execution location check** (CRITICAL RULE #1): Execute methods under test in `beforeEach()`, not in `it()` blocks.
14
- 4. **Mock configuration check** (CRITICAL RULE #2): Configure mock behavior in `beforeEach`, not at module level.
15
- 5. **Callback invocation check** (CRITICAL RULE #3): Use `mockImplementation` for callbacks, not `mock.calls[N][M]()`.
13
+ 3. **Execution location check** (CRITICAL RULE 1): Execute methods under test in `beforeEach()`, not in `it()` blocks.
14
+ 4. **Mock configuration check** (CRITICAL RULE 2): Configure mock behavior in `beforeEach`, not at module level.
15
+ 5. **Callback invocation check** (CRITICAL RULE 3): Use `mockImplementation` for callbacks, not `mock.calls[N][M]()`.
16
16
 
17
17
  Once tests are generated:
18
18
 
@@ -21,7 +21,7 @@ Once tests are generated:
21
21
 
22
22
  ---
23
23
 
24
- ## CRITICAL RULE #1: Test Execution Location
24
+ ## CRITICAL RULE 1: Test Execution Location
25
25
 
26
26
  ⚠️ **NON-NEGOTIABLE RULE** ⚠️
27
27
 
@@ -97,7 +97,7 @@ Before writing any test suite, verify:
97
97
 
98
98
  ---
99
99
 
100
- ## CRITICAL RULE #2: Mock Configuration Location
100
+ ## CRITICAL RULE 2: Mock Configuration Location
101
101
 
102
102
  ⚠️ **NON-NEGOTIABLE RULE** ⚠️
103
103
 
@@ -152,7 +152,7 @@ const mockLuxon = {
152
152
 
153
153
  ---
154
154
 
155
- ## CRITICAL RULE #3: Callback Invocation via mockImplementation
155
+ ## CRITICAL RULE 3: Callback Invocation via mockImplementation
156
156
 
157
157
  ⚠️ **NON-NEGOTIABLE RULE** ⚠️
158
158
 
@@ -329,7 +329,7 @@ describe("when status is inactive", () => {
329
329
  - Inner `describe` blocks handle specific scenarios ("when X condition")
330
330
  - **Test descriptions**:
331
331
  - `describe` blocks handle the "when" conditions/scenarios
332
- - `it` blocks focus purely on "should" assertions (no conditions). See **CRITICAL RULE #1** above.
332
+ - `it` blocks focus purely on "should" assertions (no conditions). See **CRITICAL RULE 1** above.
333
333
  - Avoid redundancy - don't repeat conditions in both `describe` and `it`
334
334
  - **Grouping logic**:
335
335
  - Group related test cases under shared setup scenarios
@@ -366,7 +366,7 @@ describe("when status is inactive", () => {
366
366
  - **State initialization**: Variables initialized in `beforeEach`
367
367
  - **Fresh state guarantee**:
368
368
  - Call `jest.clearAllMocks()` and `jest.resetModules()` in outer `beforeEach`
369
- - **Do NOT use `jest.resetAllMocks()`** in the outer `beforeEach` — it wipes implementations, which breaks module-level `mockReturnThis()` chains (see CRITICAL RULE #2 exception)
369
+ - **Do NOT use `jest.resetAllMocks()`** in the outer `beforeEach` — it wipes implementations, which breaks module-level `mockReturnThis()` chains (see CRITICAL RULE 2 exception)
370
370
  - Use `mockReset()` on **individual mocks** when a nested `beforeEach` needs to replace behavior already configured by an outer `beforeEach`
371
371
  - **Never use `mockRestore()`** — it only applies to `jest.spyOn`, which this codebase does not use
372
372
 
@@ -385,14 +385,14 @@ Am I in the **outer** `beforeEach`?
385
385
 
386
386
  ## Mocking Strategy
387
387
 
388
- - **Module-level mock declarations**: Dependencies mocked above test suites with bare `jest.fn()` — see **CRITICAL RULE #2** for configuration rules
388
+ - **Module-level mock declarations**: Dependencies mocked above test suites with bare `jest.fn()` — see **CRITICAL RULE 2** for configuration rules
389
389
  - **Mock behavior configuration**: Configured per scenario in `beforeEach` blocks
390
390
  - **Mock naming**: Consistent mock prefix (e.g., `mockLogger`, `mockGetMessageBroker`)
391
391
  - **Selective mocking**: Mock only the methods being used unless it significantly raises complexity
392
392
  - **Mock verification**: Always verify mock calls when behavior depends on them
393
393
  - **Mock realism**: Ensure mocks behave like real implementations (same async patterns, error types)
394
394
  - **Mock methods**:
395
- - Use `mockImplementation` when invoking callbacks passed to the mocked function — see **CRITICAL RULE #3**
395
+ - Use `mockImplementation` when invoking callbacks passed to the mocked function — see **CRITICAL RULE 3**
396
396
  - Use `mockResolvedValue` for async returns
397
397
  - Use `mockReturnValue` for sync returns
398
398
  - Prefer "Once" versions when appropriate (`mockResolvedValueOnce`, etc.)
@@ -0,0 +1,9 @@
1
+ # Lessons Learned
2
+
3
+ ## Review Patterns
4
+
5
+ ## Common Fix Loop Triggers
6
+
7
+ ## Test Coverage Priorities
8
+
9
+ ## Code Patterns
@@ -34,30 +34,46 @@ mkdir -p docs/{briefs,build-plans,reports}
34
34
  (handoff via files)
35
35
 
36
36
  ┌─────────────────────────────────────────────────────────────────┐
37
- AUTONOMOUS AGENTS (isolated context, file-based communication)
37
+ BUILD PIPELINE (choose your level of autonomy)
38
38
  │ │
39
- These are the SAME PERSONAS as above, but autonomous.
40
- Use when you trust the output pattern.
39
+ /build ──→ manual gates between phases
40
+ /auto-build ──→ fully autonomous: build + commit + draft PR
41
41
  │ │
42
- pm agent ──→ docs/briefs/feature.md
43
- │ architect agent ──→ docs/build-plans/feature.md │
42
+ Both orchestrate the same agent pipeline:
44
43
  │ │
45
- │ ┌──────────┐ ┌──────────┐ ┌──────────┐
46
- │ │ dev │──→│ reviewer │──→│ test- │
47
- │ │ agent │ │ agent │ │ hardener │
48
- │ │ │ │ │ │ agent │
49
- │ │ Writes │ │ Read-only │ │ Writes │
50
- │ │ code + │ │ review │ │ tests │
51
- │ │ tests │ │ │ │ only │
52
- │ └────┬─────┘ └────┬─────┘ └────┬─────┘
44
+ │ ┌──────────┐ ┌───────────┐ ┌──────────┐
45
+ │ │ dev │──→│ reviewer │──→│ test- │
46
+ │ │ agent │ │ agent │ │ hardener │
47
+ │ │ │ │ │ │ agent │
48
+ │ │ Writes │ │ Read-only │ │ Writes │
49
+ │ │ code + │ │ review │ │ tests │
50
+ │ │ tests │ │ │ │ only │
51
+ │ └────┬─────┘ └────┬──────┘ └────┬─────┘
53
52
  │ ▼ ▼ ▼ │
54
53
  │ dev-report review-report test-report │
55
54
  │ │
56
- │ ◄── fix loops if review/test fail ──►
55
+ │ ◄── fix loops if review/test fail ──►
56
+ │ │
57
+ │ /auto-build also runs: │
58
+ │ auto-prep-pr agent ──→ pushes branch + creates draft PR │
59
+ └─────────────────────────────────────────────────────────────────┘
60
+
61
+ (reports land in docs/reports/)
62
+
63
+ ┌─────────────────────────────────────────────────────────────────┐
64
+ │ STANDALONE AGENTS & COMMANDS │
57
65
  │ │
66
+ │ pm agent ──→ docs/briefs/feature.md │
67
+ │ architect agent ──→ docs/build-plans/feature.md │
58
68
  │ explorer agent ──→ docs/codebase-map.md │
69
+ │ auto-prep-pr agent ──→ pushes branch + creates draft PR │
70
+ │ retrospective agent ──→ .ai/retro/retro-[feature].md │
59
71
  │ │
60
- │ /build ──→ orchestrates: dev review → test
72
+ │ /retrospective ──→ consolidates retros into lessons-learned
73
+ │ /prep-pr ──→ interactive PR prep and draft creation │
74
+ │ /auto-prep-pr ──→ non-interactive PR prep via agent │
75
+ │ /review-pr ──→ structured PR review briefing │
76
+ │ /weekly-summary ──→ weekly synthesis of merged PRs │
61
77
  └─────────────────────────────────────────────────────────────────┘
62
78
  ```
63
79
 
@@ -65,24 +81,33 @@ mkdir -p docs/{briefs,build-plans,reports}
65
81
 
66
82
  ### Interactive Commands (`.claude/commands/`)
67
83
 
68
- | Command | What it does | Entry point for |
69
- | ------------ | ----------------------------------------- | --------------------------- |
70
- | `/pm` | Collaborative requirements discovery | Defining what to build |
71
- | `/architect` | Collaborative technical design | Designing how to build it |
72
- | `/build` | Orchestrates the agent execution pipeline | Running dev review test |
84
+ | Command | What it does | Entry point for |
85
+ | ----------------- | -------------------------------------------------- | --------------------------------- |
86
+ | `/pm` | Collaborative requirements discovery | Defining what to build |
87
+ | `/architect` | Collaborative technical design | Designing how to build it |
88
+ | `/build` | Orchestrates dev review test with manual gates | Controlled pipeline execution |
89
+ | `/auto-build` | Fully autonomous build + commit + draft PR | Hands-off pipeline execution |
90
+ | `/prep-pr` | Interactive PR prep and draft creation | Getting a branch ready for review |
91
+ | `/auto-prep-pr` | Non-interactive PR prep via auto-prep-pr agent | Automated PR creation |
92
+ | `/review-pr` | Structured PR review briefing | Reviewing an open PR |
93
+ | `/retrospective` | Consolidates retro files into lessons-learned | Learning from pipeline runs |
94
+ | `/weekly-summary` | Weekly synthesis of merged PRs | Team status updates |
95
+ | `/dnd-alignment` | D&D alignment chart from commit history | Fun |
73
96
 
74
97
  ### Autonomous Agents (`.claude/agents/`)
75
98
 
76
- | Agent | Tools | Context | What it does |
77
- | --------------- | ----------------------------------- | -------- | ---------------------------------------------- |
78
- | `pm` | Read, Write, Edit, Glob, Grep | Isolated | Drafts a product brief from notes |
79
- | `architect` | Read, Write, Edit, Glob, Grep, Bash | Isolated | Drafts a build plan from a brief or notes |
80
- | `dev` | Read, Write, Edit, Glob, Grep, Bash | Isolated | Implements build plan, writes happy-path tests |
81
- | `reviewer` | Read, Glob, Grep, Bash | Isolated | Read-only code review, produces verdict |
82
- | `test-hardener` | Read, Write, Edit, Glob, Grep, Bash | Isolated | Writes edge case & failure mode tests |
83
- | `explorer` | Read, Glob, Grep, Bash | Isolated | Maps and documents the codebase (read-only) |
99
+ | Agent | Tools | Context | What it does |
100
+ | --------------- | ----------------------------------- | -------- | ------------------------------------------------- |
101
+ | `pm` | Read, Write, Edit, Glob, Grep | Isolated | Drafts a product brief from notes |
102
+ | `architect` | Read, Write, Edit, Glob, Grep, Bash | Isolated | Drafts a build plan from a brief or notes |
103
+ | `dev` | Read, Write, Edit, Glob, Grep, Bash | Isolated | Implements build plan, writes happy-path tests |
104
+ | `reviewer` | Read, Glob, Grep, Bash | Isolated | Read-only code review, produces verdict |
105
+ | `test-hardener` | Read, Write, Edit, Glob, Grep, Bash | Isolated | Writes edge case & failure mode tests |
106
+ | `explorer` | Read, Glob, Grep, Bash | Isolated | Maps and documents the codebase (read-only) |
107
+ | `auto-prep-pr` | Read, Glob, Grep, Bash | Isolated | Pushes branch, creates draft PR (non-interactive) |
108
+ | `retrospective` | Read, Write, Glob, Bash | Isolated | Extracts patterns from reports into retro files |
84
109
 
85
- Note: `reviewer` and `explorer` are deliberately read-only — they can't modify project code.
110
+ Note: `reviewer`, `explorer`, and `auto-prep-pr` are deliberately read-only — they can't modify project code.
86
111
 
87
112
  ## Workflows
88
113
 
@@ -101,7 +126,7 @@ claude> /architect
101
126
  # ... back-and-forth until plan is right
102
127
  # Output: docs/build-plans/feature.md
103
128
 
104
- # Session 3: Execute the pipeline
129
+ # Session 3: Execute the pipeline with manual gates
105
130
  claude> /build
106
131
  # ... confirms once, then runs dev → review → test automatically
107
132
  # ... only stops if fix loops are exhausted
@@ -126,15 +151,16 @@ claude> /build
126
151
 
127
152
  ### Full Autonomous (Trust the Pipeline)
128
153
 
129
- When you've done this enough to trust the drafts:
154
+ When you've done this enough to trust the whole thing:
130
155
 
131
156
  ```bash
132
157
  # Autonomous brief and plan
133
158
  claude> Use the pm agent to draft a brief, then the architect agent to create a build plan
134
159
  # Review both docs, edit if needed
135
160
 
136
- # Execute
137
- claude> /build
161
+ # Fully autonomous: build, commit, and draft PR
162
+ claude> /auto-build
163
+ # You get a draft PR at the end, or a failure report
138
164
  ```
139
165
 
140
166
  ### CTO-Hands-You-a-Napkin
@@ -165,15 +191,32 @@ claude> /build
165
191
  claude> Use the reviewer agent to review the auth module changes
166
192
  ```
167
193
 
194
+ ### Post-Build: Learn From What Happened
195
+
196
+ After one or more builds complete, extract patterns and build institutional memory:
197
+
198
+ ```bash
199
+ # Step 1: Extract patterns from pipeline reports (per feature)
200
+ claude> Use the retrospective agent for the user-auth feature
201
+ # Output: .ai/retro/retro-user-auth.md
202
+
203
+ # Step 2: Consolidate retros into shared lessons (interactive)
204
+ claude> /retrospective
205
+ # ... walk through findings, decide what to keep
206
+ # Output: .ai/lessons-learned.md
207
+ ```
208
+
168
209
  ## How Fix Loops Work
169
210
 
170
- The `/build` orchestrator handles failures:
211
+ The `/build` and `/auto-build` orchestrators handle failures:
171
212
 
172
213
  1. **Review fails** (🔴) → extracts must-fix items → fresh dev agent reads only the fixes file → commits fixes → re-runs review → max 2 loops
173
214
  2. **Test hardening fails** (🐛) → same pattern for bugs
174
215
 
175
216
  The user approves once at the start of the pipeline. After that, fix loops run automatically, capped at 2 per phase. The only mid-pipeline interruption is escalation when a fix loop is exhausted.
176
217
 
218
+ With `/auto-build`, there is no mid-pipeline interruption at all — if fix loops are exhausted, it stops and writes a failure report.
219
+
177
220
  ## Git Workflow
178
221
 
179
222
  The pipeline manages git automatically:
@@ -183,6 +226,7 @@ The pipeline manages git automatically:
183
226
  3. **Test hardener** commits its new test files (`test:` prefix)
184
227
  4. **Fix loop commits** use `fix:` prefix and reference what was fixed
185
228
  5. **Orchestrator** commits reports at the end (`docs:` prefix)
229
+ 6. **`/auto-build` only**: auto-prep-pr agent pushes the branch and creates a draft PR
186
230
 
187
231
  The result is a branch with clean, atomic, per-task commits:
188
232
 
@@ -197,7 +241,7 @@ b4c5d6e DEV-2315 Add login endpoint with validation
197
241
  7f8e9d0 DEV-2315 Add user model and migration
198
242
  ```
199
243
 
200
- At completion, the orchestrator gives you the branch name and commit history. You choose how to land it merge, squash, open a PR, whatever fits your workflow.
244
+ At completion, the orchestrator gives you the branch name and commit history. With `/build`, you choose how to land it. With `/auto-build`, a draft PR is already waiting.
201
245
 
202
246
  ⚠️ **Protected branches**: The dev agent verifies it's on a feature branch before every commit. If it somehow finds itself on `main`/`master`/`develop`, it stops and reports the error rather than committing.
203
247
 
@@ -212,28 +256,43 @@ docs/reports/
212
256
  ├── review-report-[feature].md ← Review agent output
213
257
  ├── review-fixes-[feature].md ← Fix loop items (if triggered)
214
258
  └── test-report-[feature].md ← Test agent output
259
+
260
+ .ai/retro/retro-[feature].md ← Retrospective agent output
261
+ .ai/lessons-learned.md ← /retrospective consolidation output
215
262
  ```
216
263
 
217
264
  ## Directory Structure
218
265
 
219
266
  ```
220
267
  .claude/
221
- ├── commands/ # Interactive slash commands
268
+ ├── commands/ # Slash commands
222
269
  │ ├── pm.md # /pm → conversational requirements
223
270
  │ ├── architect.md # /architect → conversational design
224
- └── build.md # /build → pipeline orchestrator
271
+ ├── build.md # /build → pipeline orchestrator (manual gates)
272
+ │ ├── auto-build.md # /auto-build → fully autonomous pipeline
273
+ │ ├── prep-pr.md # /prep-pr → interactive PR prep
274
+ │ ├── auto-prep-pr.md # /auto-prep-pr → non-interactive PR prep
275
+ │ ├── review-pr.md # /review-pr → PR review briefing
276
+ │ ├── retrospective.md # /retrospective → consolidate retros
277
+ │ ├── weekly-summary.md # /weekly-summary → merged PR synthesis
278
+ │ └── dnd-alignment.md # /dnd-alignment → commit alignment chart
225
279
  └── agents/ # Autonomous subagents (isolated context)
226
280
  ├── pm.md # Brief drafting
227
281
  ├── architect.md # Build plan drafting
228
282
  ├── dev.md # Implementation
229
283
  ├── reviewer.md # Code review (read-only)
230
284
  ├── test-hardener.md # Test hardening
231
- └── explorer.md # Codebase mapping (read-only)
285
+ ├── explorer.md # Codebase mapping (read-only)
286
+ ├── auto-prep-pr.md # PR creation (read-only)
287
+ └── retrospective.md # Pattern extraction from reports
232
288
 
233
289
  .ai/
234
290
  ├── UnitTestGeneration.md # Testing style guide
235
291
  ├── UnitTestExamples.md # Testing examples
236
- └── workflow.md # This file
292
+ ├── workflow.md # This file
293
+ ├── lessons-learned.md # Accumulated lessons from retrospectives
294
+ └── retro/ # Per-feature retrospective files
295
+ └── retro-[feature].md # Output of retrospective agent
237
296
 
238
297
  docs/
239
298
  ├── briefs/ # PM outputs
@@ -257,6 +316,8 @@ Use **autonomous agents** when:
257
316
  - You want a first draft to react to rather than building from scratch
258
317
  - You've used the interactive versions enough to know what good output looks like
259
318
 
319
+ Use **`/build`** when you want manual gates between phases. Use **`/auto-build`** when you trust the pipeline end-to-end and want a draft PR at the finish line.
320
+
260
321
  ## Customization
261
322
 
262
323
  ### Things Worth Tuning
@@ -265,13 +326,14 @@ Use **autonomous agents** when:
265
326
  - **Review criteria** in `agents/reviewer.md` — tune must-fix vs. consider thresholds
266
327
  - **Test priorities** in `agents/test-hardener.md` — focus on your domain's risk areas
267
328
  - **Build plan template** in architect files — swap in your team's RFC/ADR format
268
- - **Fix loop cap** in `commands/build.md` — default is 2, adjust to taste
329
+ - **Fix loop cap** in `commands/build.md` and `commands/auto-build.md` — default is 2, adjust to taste
269
330
  - **Model selection** in agent frontmatter — default is `sonnet`, bump to `opus` for critical phases
270
331
 
271
332
  ### Agent Tool Access
272
333
 
273
334
  Tools are intentionally restricted per agent:
274
335
 
275
- - `reviewer` and `explorer` are **read-only** (no Write/Edit) — they observe and report
336
+ - `reviewer`, `explorer`, and `auto-prep-pr` are **read-only** (no Write/Edit) — they observe and report
276
337
  - `dev` and `test-hardener` have full access — they need to create and modify files
338
+ - `retrospective` can write to `.ai/retro/` only
277
339
  - Adjust in the YAML frontmatter `tools:` field
@@ -61,6 +61,12 @@ High-level description of the approach. 2-3 paragraphs max.
61
61
  - **Trade-off**: [What we're giving up]
62
62
  - **Assumption**: [If this decision rests on an assumption, flag it]
63
63
 
64
+ ## Scope Contract
65
+
66
+ - **In scope**: [packages/dirs/layers that are fair game for this feature]
67
+ - **Out of scope**: [packages/dirs/layers that must NOT be touched — e.g., core packages, unrelated modules]
68
+ - **New dependencies**: [allowed / must be approved / none]
69
+
64
70
  ## Existing Patterns to Follow
65
71
 
66
72
  Patterns, conventions, or utilities already in the codebase that this feature should use.