guild-agents 0.3.0 → 0.3.1

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
@@ -5,37 +5,25 @@
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
6
  [![Node.js >= 20](https://img.shields.io/badge/node-%3E%3D20-brightgreen)](https://nodejs.org)
7
7
 
8
- Claude Code is powerful but chaotic. Guild gives it structure.
8
+ **Guild makes Claude Code think before it builds.**
9
9
 
10
- Guild is an npm CLI that sets up 9 specialized agents and 10 skill-based workflows as `.claude/` files in any project. Agents define **who** does the work. Skills define **how** it gets done. Everything is markdown, tracked by git, works offline.
10
+ Guild is a spec-driven development CLI for Claude Code. It installs structured design and development workflows as `.claude/` markdown files in any project. Before code is written, features are evaluated, debated by independent AI perspectives, and specified in a design doc. Everything is markdown, tracked by git, works offline, zero infrastructure.
11
11
 
12
- ## Why Guild?
12
+ ## The Problem
13
13
 
14
- - **Structure over chaos.** Claude Code without guidance produces inconsistent results. Guild gives every task a clear owner and a repeatable process.
15
- - **Agents = WHO, Skills = HOW.** Agents are flat `.md` files with identity and expertise. Skills are workflow definitions invoked as slash commands. Clean separation, no magic.
16
- - **State that persists.** Context lives in `CLAUDE.md`, `PROJECT.md`, and `SESSION.md` -- tracked by git, readable by humans, never lost between sessions.
17
- - **Zero infrastructure.** No servers, no APIs, no config files. Just markdown files that Claude Code reads natively.
14
+ Without structure, Claude Code:
18
15
 
19
- ## How It Works
16
+ - Writes code before understanding the problem
17
+ - Has no design phase and no review gate
18
+ - Loses decisions between sessions
19
+ - Produces results that vary with every conversation
20
20
 
21
- ```
22
- You ──> /build-feature "Add JWT auth"
23
-
24
-
25
- ┌─────────┐ ┌───────────────┐ ┌───────────────┐
26
- │ Advisor │────>│ Tech Lead │────>│ Developer │
27
- │ evaluate │ │ plan │ │ implement │
28
- └─────────┘ └───────────────┘ └───────┬───────┘
29
-
30
- ┌─────────────┼─────────────┐
31
- ▼ ▼ ▼
32
- ┌──────────┐ ┌──────────┐ ┌──────────┐
33
- │ Reviewer │ │ QA │ │ Bugfix │
34
- │ review │ │ test │ │ fix │
35
- └──────────┘ └──────────┘ └──────────┘
36
- ```
21
+ ## How Guild Solves It
37
22
 
38
- Skills orchestrate agents through structured pipelines. You invoke a skill as a slash command, and it coordinates the right agents in the right order.
23
+ - **Spec before code**: every feature starts with a design doc
24
+ - **Structured deliberation**: `/council` runs parallel independent analysis -- multiple perspectives evaluate independently, then synthesize
25
+ - **Decisions that persist**: design docs, session state, and project context live in git-tracked markdown
26
+ - **Zero infrastructure**: no servers, no APIs, just markdown files and Claude Code
39
27
 
40
28
  ## Quick Start
41
29
 
@@ -44,28 +32,68 @@ npm install -g guild-agents
44
32
  guild init
45
33
  ```
46
34
 
47
- The interactive onboarding asks for project name, type, stack, and repo details, then generates the full structure: 9 agents, 10 skills, and 3 state files.
48
-
49
- Next, let Guild learn your codebase:
35
+ Then use skills as slash commands in Claude Code:
50
36
 
37
+ ```text
38
+ /guild-specialize # Learn your codebase, enrich CLAUDE.md
39
+ /council "Add JWT auth" # Spec a feature through structured deliberation
40
+ /build-feature # Implement from spec through the full pipeline
51
41
  ```
52
- /guild-specialize
42
+
43
+ ## The Pipeline
44
+
45
+ ```text
46
+ You ──> /council "Add JWT auth"
47
+
48
+
49
+ ┌──────────┐ ┌──────────────┐ ┌──────────┐
50
+ │ Evaluate │────>│ Design Doc │────>│ Build │
51
+ │ debate │ │ spec │ │ implement│
52
+ └──────────┘ └──────────────┘ └────┬─────┘
53
+
54
+ ┌─────┴─────┐
55
+ ▼ ▼
56
+ ┌──────────┐┌──────────┐
57
+ │ Review ││ QA │
58
+ └──────────┘└──────────┘
53
59
  ```
54
60
 
55
- This explores your actual code and enriches `CLAUDE.md` with real conventions, patterns, and stack details. Every agent now understands your project.
61
+ Six phases: **evaluate**, **specify**, **plan**, **implement**, **review**, **validate**. Phases 1-3 happen before any code is written.
56
62
 
57
- Then build something:
63
+ ## Skills Reference
58
64
 
59
- ```
60
- /build-feature Add user authentication with JWT
65
+ All 11 skills, grouped by function:
66
+
67
+ | Skill | Group | Description |
68
+ | --- | --- | --- |
69
+ | `/build-feature` | Pipeline | Full pipeline: evaluate, spec, implement, review, QA |
70
+ | `/new-feature` | Pipeline | Create branch and scaffold for a new feature |
71
+ | `/create-pr` | Pipeline | Create a structured pull request from current branch |
72
+ | `/council` | Decision | Multi-perspective deliberation on a decision or feature |
73
+ | `/review` | Quality | Code review on the current diff |
74
+ | `/qa-cycle` | Quality | QA and bugfix loop until clean |
75
+ | `/guild-specialize` | Context | Explore codebase, enrich CLAUDE.md with real conventions |
76
+ | `/session-start` | Context | Load context and resume work |
77
+ | `/session-end` | Context | Save state to SESSION.md |
78
+ | `/status` | Context | Project and session state overview |
79
+ | `/dev-flow` | Context | Show current pipeline phase and next step |
80
+
81
+ ## CLI Commands
82
+
83
+ ```bash
84
+ guild init # Interactive project onboarding
85
+ guild new-agent <name> # Create a custom agent
86
+ guild status # Show project status
87
+ guild doctor # Diagnose setup
88
+ guild list # List agents and skills
61
89
  ```
62
90
 
63
- This runs the full pipeline -- advisor evaluation, tech lead planning, developer implementation, code review, and QA -- all coordinated automatically.
91
+ ## Under the Hood
64
92
 
65
- ## Agents
93
+ Guild coordinates 9 specialized agents through the pipeline. Each agent handles one phase.
66
94
 
67
95
  | Agent | Role |
68
- |---|---|
96
+ | --- | --- |
69
97
  | advisor | Evaluates ideas and provides strategic direction |
70
98
  | product-owner | Turns approved ideas into concrete tasks |
71
99
  | tech-lead | Defines technical approach and architecture |
@@ -74,70 +102,13 @@ This runs the full pipeline -- advisor evaluation, tech lead planning, developer
74
102
  | qa | Testing, edge cases, regression validation |
75
103
  | bugfix | Bug diagnosis and resolution |
76
104
  | db-migration | Schema changes and safe migrations |
77
- | platform-expert | Diagnoses and resolves Claude Code integration issues |
78
-
79
- ## Skills
80
-
81
- | Skill | Description |
82
- |---|---|
83
- | `/guild-specialize` | Explores codebase, enriches CLAUDE.md with real stack and conventions |
84
- | `/build-feature` | Full pipeline: evaluation, spec, implementation, review, QA |
85
- | `/new-feature` | Creates branch and scaffold for a new feature |
86
- | `/council` | Convenes multiple agents to debate a decision |
87
- | `/qa-cycle` | QA and bugfix loop until clean |
88
- | `/review` | Code review on the current diff |
89
- | `/dev-flow` | Shows current pipeline phase and next step |
90
- | `/status` | Project and session state overview |
91
- | `/session-start` | Loads context and resumes work |
92
- | `/session-end` | Saves state to SESSION.md |
93
-
94
- ## CLI Commands
95
-
96
- ```bash
97
- guild init # Interactive project onboarding
98
- guild new-agent <name> # Create a custom agent
99
- guild status # Show project status
100
- guild doctor # Diagnose installation state
101
- guild list # List installed agents and skills
102
- ```
103
-
104
- ## Generated Structure
105
+ | platform-expert | Diagnoses Claude Code integration issues |
105
106
 
106
- Running `guild init` creates the following in your project root:
107
-
108
- ```
109
- CLAUDE.md
110
- PROJECT.md
111
- SESSION.md
112
- .claude/
113
- agents/
114
- advisor.md
115
- product-owner.md
116
- tech-lead.md
117
- developer.md
118
- code-reviewer.md
119
- qa.md
120
- bugfix.md
121
- db-migration.md
122
- platform-expert.md
123
- skills/
124
- guild-specialize/SKILL.md
125
- build-feature/SKILL.md
126
- new-feature/SKILL.md
127
- council/SKILL.md
128
- qa-cycle/SKILL.md
129
- review/SKILL.md
130
- dev-flow/SKILL.md
131
- status/SKILL.md
132
- session-start/SKILL.md
133
- session-end/SKILL.md
134
- ```
135
-
136
- All files are markdown, tracked by git, and work fully offline.
107
+ Agents are flat `.md` files with identity and expertise. Skills orchestrate agents through structured pipelines. Everything lives in `.claude/`, readable by humans, tracked by git.
137
108
 
138
109
  ## Guild Builds Itself
139
110
 
140
- This project uses its own agents and skills to develop itself. Every feature, review, and bugfix goes through the same pipelines that Guild installs in your project.
111
+ Every feature in Guild goes through the same spec-first pipeline that Guild installs in your project. Guild's own design decisions live in `docs/specs/`.
141
112
 
142
113
  ## Requirements
143
114
 
@@ -147,12 +118,7 @@ This project uses its own agents and skills to develop itself. Every feature, re
147
118
 
148
119
  ## Contributing
149
120
 
150
- Two types of contributions:
151
-
152
- - **Agent and skill templates** (`src/templates/`) -- improve agent definitions or skill workflows.
153
- - **CLI code** (`src/`, `bin/`) -- bug fixes, new commands, onboarding improvements.
154
-
155
- See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for details.
121
+ See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for setup, branching, and contribution guidelines.
156
122
 
157
123
  ## License
158
124
 
package/bin/guild.js CHANGED
@@ -20,7 +20,7 @@ const pkg = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf8'))
20
20
 
21
21
  program
22
22
  .name('guild')
23
- .description('Multi-agent framework for Claude Code')
23
+ .description('Specification-driven development CLI for Claude Code')
24
24
  .version(pkg.version);
25
25
 
26
26
  // guild init
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "guild-agents",
3
- "version": "0.3.0",
4
- "description": "A multi-agent framework for Claude Code — specialized AI teams for every project",
3
+ "version": "0.3.1",
4
+ "description": "Specification-driven development CLI for Claude Code — think before you build",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "bin/",
@@ -26,15 +26,16 @@
26
26
  "keywords": [
27
27
  "claude",
28
28
  "claude-code",
29
+ "anthropic",
30
+ "specification-driven",
31
+ "spec-driven",
32
+ "spec-first",
33
+ "design-docs",
34
+ "developer-tools",
35
+ "cli",
29
36
  "agents",
30
37
  "ai",
31
38
  "workflow",
32
- "multi-agent",
33
- "developer-tools",
34
- "cli",
35
- "framework",
36
- "anthropic",
37
- "ai-agents",
38
39
  "automation",
39
40
  "code-review",
40
41
  "nodejs"
@@ -52,7 +53,8 @@
52
53
  "dependencies": {
53
54
  "@clack/prompts": "^1.0.1",
54
55
  "chalk": "^5.3.0",
55
- "commander": "^14.0.3"
56
+ "commander": "^14.0.3",
57
+ "guild-agents": "^0.3.0"
56
58
  },
57
59
  "engines": {
58
60
  "node": ">=20.0.0"
@@ -6,8 +6,14 @@ import * as p from '@clack/prompts';
6
6
  import chalk from 'chalk';
7
7
  import { existsSync, readdirSync } from 'fs';
8
8
  import { join } from 'path';
9
+ import { resolveProjectRoot } from '../utils/files.js';
9
10
 
10
11
  export async function runDoctor() {
12
+ const root = resolveProjectRoot();
13
+ if (root) {
14
+ process.chdir(root);
15
+ }
16
+
11
17
  p.intro(chalk.bold.cyan('Guild — Doctor'));
12
18
 
13
19
  const checks = [];
@@ -127,19 +127,19 @@ export async function runInit() {
127
127
  p.log.success(`Created: CLAUDE.md, PROJECT.md, SESSION.md, ${agentCount} agents, ${skillCount} skills`);
128
128
 
129
129
  const relevantSkills = projectData.hasExistingCode
130
- ? ['/guild-specialize', '/build-feature', '/review']
131
- : ['/build-feature', '/new-feature', '/council'];
130
+ ? ['/guild-specialize', '/council', '/build-feature']
131
+ : ['/council', '/build-feature', '/new-feature'];
132
132
  p.log.info(`Start with: ${relevantSkills.join(' ')}`);
133
133
 
134
134
  const quickStart = projectData.hasExistingCode
135
- ? '1. Open Claude Code in this directory\n' +
136
- '2. Run /guild-specialize to analyze your codebase\n' +
137
- '3. Start building with /build-feature'
138
- : '1. Open Claude Code in this directory\n' +
139
- '2. Start building with /build-feature\n' +
135
+ ? '1. Run /guild-specialize to analyze your codebase\n' +
136
+ '2. Run /council to spec your first feature\n' +
137
+ '3. Build it with /build-feature'
138
+ : '1. Run /council to spec your first feature\n' +
139
+ '2. Build it with /build-feature\n' +
140
140
  '3. Run /guild-specialize once you have code';
141
141
 
142
142
  p.note(quickStart, 'Quick start');
143
143
 
144
- p.outro(chalk.bold.cyan('Guild v1 ready.'));
144
+ p.outro(chalk.bold.cyan('Guild ready — spec before you build.'));
145
145
  }
@@ -6,9 +6,11 @@ import * as p from '@clack/prompts';
6
6
  import chalk from 'chalk';
7
7
  import { existsSync, readdirSync, readFileSync } from 'fs';
8
8
  import { join } from 'path';
9
- import { parseFrontmatter } from '../utils/files.js';
9
+ import { ensureProjectRoot, parseFrontmatter } from '../utils/files.js';
10
10
 
11
11
  export async function runList() {
12
+ ensureProjectRoot();
13
+
12
14
  p.intro(chalk.bold.cyan('Guild — Agents & Skills'));
13
15
 
14
16
  // List agents
@@ -13,10 +13,13 @@ import * as p from '@clack/prompts';
13
13
  import chalk from 'chalk';
14
14
  import { existsSync, writeFileSync } from 'fs';
15
15
  import { join } from 'path';
16
+ import { ensureProjectRoot } from '../utils/files.js';
16
17
 
17
18
  const AGENTS_DIR = join('.claude', 'agents');
18
19
 
19
20
  export async function runNewAgent(agentName) {
21
+ ensureProjectRoot();
22
+
20
23
  p.intro(chalk.bold.cyan('Guild — New agent'));
21
24
 
22
25
  // Validate name
@@ -6,11 +6,10 @@ import * as p from '@clack/prompts';
6
6
  import chalk from 'chalk';
7
7
  import { existsSync, readdirSync, readFileSync } from 'fs';
8
8
  import { join } from 'path';
9
+ import { ensureProjectRoot } from '../utils/files.js';
9
10
 
10
11
  export async function runStatus() {
11
- if (!existsSync('PROJECT.md')) {
12
- throw new Error('Guild is not installed. Run: guild init');
13
- }
12
+ ensureProjectRoot();
14
13
 
15
14
  const projectMd = readFileSync('PROJECT.md', 'utf8');
16
15
  const nameMatch = projectMd.match(/\*\*Name:\*\*\s*(.+)/);
@@ -69,6 +69,7 @@ This indicator MUST be displayed before spawning the agent for that phase.
69
69
  3. Issues evaluation: Approved / Rejected / Requires adjustments
70
70
 
71
71
  **Output:** Evaluation with reasoning and identified risks
72
+ **Trace data:** Verdict (Approved/Rejected/Approved with conditions), risks identified, conditions if any
72
73
  **Exit condition:** If the Advisor rejects the feature, the pipeline stops here. Inform the user of the reason and suggest adjustments if any.
73
74
 
74
75
  ### Phase 2 — Specification (Product Owner)
@@ -83,6 +84,7 @@ This indicator MUST be displayed before spawning the agent for that phase.
83
84
  3. Estimates effort and suggests implementation order
84
85
 
85
86
  **Output:** Task list with acceptance criteria, estimation, and order
87
+ **Trace data:** Tasks defined count, acceptance criteria count, estimated effort
86
88
 
87
89
  ### Phase 3 — Technical Approach (Tech Lead)
88
90
 
@@ -96,6 +98,7 @@ This indicator MUST be displayed before spawning the agent for that phase.
96
98
  3. Anticipates technical risks and proposes mitigations
97
99
 
98
100
  **Output:** Technical plan with files, patterns, interfaces, and risks
101
+ **Trace data:** Key patterns identified, files to modify, technical risks
99
102
 
100
103
  ### Phase 4 — Implementation (Developer)
101
104
 
@@ -110,6 +113,7 @@ This indicator MUST be displayed before spawning the agent for that phase.
110
113
  4. Verifies that tests pass
111
114
 
112
115
  **Output:** Implemented code + tests + commits made
116
+ **Trace data:** Files created/modified, tests added, commits made
113
117
 
114
118
  ### Pre-Review Gate (mandatory)
115
119
 
@@ -121,6 +125,8 @@ Before advancing to Phase 5, run automated verification:
121
125
 
122
126
  This gate CANNOT be skipped, even if the user requested phase skipping. The specific commands are in the "CLI commands" section of CLAUDE.md.
123
127
 
128
+ **Trace data:** Tests pass/fail, lint pass/fail
129
+
124
130
  ### Phase 5 — Review (Code Reviewer)
125
131
 
126
132
  **Progress:** `[5/6] Code Reviewer — Reviewing changes...`
@@ -132,6 +138,7 @@ This gate CANNOT be skipped, even if the user requested phase skipping. The spec
132
138
  2. Classifies findings as Blocker, Warning, or Suggestion
133
139
 
134
140
  **Output:** Review report with classified findings
141
+ **Trace data:** Blockers count, warnings count, suggestions count, review-fix loops
135
142
  **Loop condition:** If there are Blocker findings, return to **Phase 4** for the Developer to fix them. Maximum 2 review-fix iterations.
136
143
 
137
144
  ### Phase 6 — QA (delegates to /qa-cycle)
@@ -145,6 +152,7 @@ Runs the `/qa-cycle` skill passing the PO acceptance criteria as context. The qa
145
152
  3. Testing edge cases and error scenarios
146
153
  4. Bugfix cycle if issues arise (maximum 3 cycles)
147
154
 
155
+ **Trace data:** Acceptance criteria verified count, bugs found, QA cycles
148
156
  **Additional loop condition:** If the qa-cycle bugfix introduces significant changes, return to **Phase 5** (Review) for verification. Maximum 2 review-QA cycles.
149
157
 
150
158
  ## Checkpoint Commits
@@ -161,7 +169,7 @@ Pattern for each phase:
161
169
  - After Phase 1: `wip: [feature] phase 1 — advisor approved`
162
170
  - After Phase 2: `wip: [feature] phase 2 — PO spec ready`
163
171
  - After Phase 3: `wip: [feature] phase 3 — tech approach defined`
164
- - After Phase 4: `wip: [feature] phase 4 — implementation done`
172
+ - After Phase 4: `wip: [feature] phase 4 — implementation done` -- also write partial trace (phases 1-4) to spec and update status to `implementing`
165
173
  - After Phase 5: `wip: [feature] phase 5 — review passed`
166
174
  - After Phase 6: `wip: [feature] phase 6 — QA passed`
167
175
 
@@ -171,6 +179,110 @@ Also update SESSION.md at each phase transition:
171
179
  - [timestamp] | build-feature | Phase N ([phase-name]) complete for [feature]
172
180
  ```
173
181
 
182
+ ## Pipeline Trace
183
+
184
+ After pipeline completion, append a `## Pipeline Trace` section to the feature's spec file in `docs/specs/`. This provides a structured record of what happened in each phase.
185
+
186
+ ### Spec file discovery
187
+
188
+ 1. Search `docs/specs/` for a file whose `spec-id` frontmatter matches the feature name (kebab-case)
189
+ 2. If no matching spec exists, auto-create a minimal spec file at `docs/specs/[feature-name].md`
190
+
191
+ ### Auto-created spec format
192
+
193
+ When no prior council spec exists, create a minimal spec:
194
+
195
+ ````markdown
196
+ ---
197
+ spec-id: [feature-name]
198
+ status: implementing
199
+ date: [YYYY-MM-DD]
200
+ council-type: none (pipeline-generated)
201
+ ---
202
+
203
+ # Spec: [Feature Name]
204
+
205
+ ## Context
206
+
207
+ Spec auto-generated by /build-feature pipeline. No prior council session.
208
+
209
+ ## Pipeline Trace
210
+
211
+ [trace content appended here]
212
+ ````
213
+
214
+ ### Status field updates
215
+
216
+ - At Phase 4 checkpoint: set `status: implementing`
217
+ - At pipeline completion: set `status: implemented`
218
+
219
+ ### Trace section format
220
+
221
+ Append this section to the spec file:
222
+
223
+ ````markdown
224
+ ## Pipeline Trace
225
+
226
+ pipeline-start: [YYYY-MM-DD]
227
+ pipeline-end: [YYYY-MM-DD]
228
+ phases-completed: [N]/6
229
+ review-fix-loops: [N]
230
+ qa-cycles: [N]
231
+ final-gate: pass | fail
232
+
233
+ ### Phase 1 — Evaluation
234
+
235
+ - **Verdict**: [Approved/Rejected/Approved with conditions]
236
+ - **Risks identified**: [list or "None"]
237
+
238
+ ### Phase 2 — Specification
239
+
240
+ - **Tasks defined**: [N]
241
+ - **Acceptance criteria**: [N]
242
+ - **Estimated effort**: [summary]
243
+
244
+ ### Phase 3 — Technical Approach
245
+
246
+ - **Key patterns**: [list]
247
+ - **Files to modify**: [list]
248
+ - **Technical risks**: [list or "None"]
249
+
250
+ ### Phase 4 — Implementation
251
+
252
+ - **Files created/modified**: [list]
253
+ - **Tests added**: [N]
254
+ - **Commits**: [list of commit summaries]
255
+
256
+ ### Pre-Review Gate
257
+
258
+ - **Tests**: pass | fail
259
+ - **Lint**: pass | fail
260
+
261
+ ### Phase 5 — Review
262
+
263
+ - **Blockers**: [N]
264
+ - **Warnings**: [N]
265
+ - **Suggestions**: [N]
266
+ - **Review-fix loops**: [N]
267
+
268
+ ### Phase 6 — QA
269
+
270
+ - **Acceptance criteria verified**: [N]/[total]
271
+ - **Bugs found**: [N]
272
+ - **QA cycles**: [N]
273
+
274
+ ### Final Gate
275
+
276
+ - **Tests**: pass | fail
277
+ - **Lint**: pass | fail
278
+ - **Result**: pass | fail
279
+ ````
280
+
281
+ ### When to write the trace
282
+
283
+ - **Phase 4 checkpoint:** Write a partial trace covering phases 1-4 to the spec file. Set status to `implementing`. Include the spec file in the checkpoint commit.
284
+ - **Pipeline completion:** Write the complete trace (all phases) to the spec file. Set status to `implemented`. Include the spec file in the final checkpoint commit.
285
+
174
286
  ## Final Gate (mandatory before Completion)
175
287
 
176
288
  Before declaring the pipeline as complete, run final verification:
@@ -181,23 +293,27 @@ Before declaring the pipeline as complete, run final verification:
181
293
 
182
294
  This gate is the last safety net. It CANNOT be skipped under any circumstances.
183
295
 
296
+ **Trace data:** Tests pass/fail, lint pass/fail, result (pass/fail)
297
+
184
298
  ## Completion
185
299
 
186
300
  Upon successfully completing all phases and the final gate:
187
301
 
188
- 1. Present pipeline summary:
302
+ 1. Write the complete Pipeline Trace to the spec file (see "Pipeline Trace" section above). Update the spec status to `implemented`. Include the spec file in the final checkpoint commit.
303
+
304
+ 2. Present pipeline summary:
189
305
  - Feature implemented
190
306
  - Files modified/created
191
307
  - Tests run and result
192
308
  - Review issues resolved
193
309
  - Final QA result
194
310
 
195
- 2. Update `SESSION.md` with:
311
+ 3. Update `SESSION.md` with:
196
312
  - Feature completed
197
313
  - Decisions made during the pipeline
198
314
  - Next steps if any
199
315
 
200
- 3. Close the GitHub Issue (if applicable):
316
+ 4. Close the GitHub Issue (if applicable):
201
317
  - Do NOT use `Closes #N` in PR description (only works when merging to default branch)
202
318
  - After the PR is merged, run: `gh issue close N --comment "Resolved in PR #X"`
203
319
 
@@ -111,6 +111,33 @@ Present clear options to the user based on the debate:
111
111
 
112
112
  Ask the user to decide. If the user decides, document the decision in SESSION.md.
113
113
 
114
+ ### Step 5 — Write Spec Document
115
+
116
+ After the user makes their decision in Step 4, offer to write a spec document to `docs/specs/`.
117
+
118
+ 1. **Suggest filename**: Derive a kebab-case filename (3-5 words) from the council question. Present the suggested filename to the user for confirmation. Example: `docs/specs/graphql-migration-strategy.md`
119
+ 2. **Create directory**: Create `docs/specs/` if it does not already exist.
120
+ 3. **Read the spec template**: Read `src/templates/specs/SPEC_TEMPLATE.md` (or the project's local copy) to use as the structural guide.
121
+ 4. **Assemble spec content**: Map the council debate to the template format:
122
+ - **Title**: From the council question
123
+ - **spec-id**: Matches the filename (without `.md`)
124
+ - **status**: Always `draft`
125
+ - **date**: Current date in `YYYY-MM-DD` format
126
+ - **council-type**: From Step 1 (architecture, feature-scope, or tech-debt)
127
+ - **Context**: From the council question and background provided by the user
128
+ - **Decision**: The user's chosen option from Step 4
129
+ - **Constraints**: Extracted from agent arguments during the debate
130
+ - **Acceptance Criteria**: Derived from the decision, as checkboxes (`- [ ]`)
131
+ - **Technical Approach**: Synthesis of implementation details from agents
132
+ - **Trade-offs Considered**: Options A/B/C from Step 4 with their pros and cons
133
+ - **Unresolved Questions**: Open risks and unknowns identified during debate
134
+ - **Test Strategy**: How to verify the implementation meets the acceptance criteria
135
+ - **Council Perspectives**: Summary of each agent's independent position
136
+ - **Points of Dissent**: Where agents disagreed and how it was resolved, or "None — consensus reached"
137
+ 5. **Write the file**: Use the Write tool to create the spec at `docs/specs/<filename>.md`.
138
+ 6. **Report**: Tell the user the file path of the written spec.
139
+ 7. **Trivial decisions**: For trivial or low-impact decisions, offer SESSION.md-only logging instead of a full spec document.
140
+
114
141
  ## Subagent Configuration
115
142
 
116
143
  When spawning council agents via the Task tool, always use `subagent_type: "general-purpose"`. Guild agent role names (advisor, developer, tech-lead, etc.) are NOT valid Claude Code subagent_types.
@@ -143,3 +170,6 @@ Consensus: Incremental adoption. New endpoints in GraphQL, existing stay REST.
143
170
  - Each perspective must be independent — not "responding" to another agent
144
171
  - The synthesis is done by you (the skill), not by the agents
145
172
  - If all 3 agents agree, indicate consensus and suggest taking action
173
+ - After the user decides, always offer to write the spec to `docs/specs/`
174
+ - The spec document is the primary output of `/council` — it captures the debate, decision, and rationale
175
+ - If the user declines the spec, log the decision to SESSION.md as before
@@ -0,0 +1,46 @@
1
+ # Spec: [Feature Name]
2
+
3
+ spec-id: [kebab-case-identifier]
4
+ status: draft
5
+ date: [YYYY-MM-DD]
6
+ council-type: [architecture | feature-scope | tech-debt]
7
+
8
+ ## Context
9
+
10
+ [Why this spec exists. What problem or opportunity triggered it. Include relevant background, current state, and what happens if we do nothing.]
11
+
12
+ ## Decision
13
+
14
+ [What we decided to do. The core design choice and key sub-decisions. Written in present tense: "Create X that does Y."]
15
+
16
+ ## Constraints
17
+
18
+ [Hard boundaries: compatibility, performance, dependencies, timeline, and non-negotiable requirements.]
19
+
20
+ ## Acceptance Criteria
21
+
22
+ [Checkboxes. Each criterion is independently verifiable. These are the contract between spec and implementation.]
23
+
24
+ ## Technical Approach
25
+
26
+ [How to implement the decision. Files involved, patterns to follow, integration points. Enough detail for a developer to start working without ambiguity about direction.]
27
+
28
+ ## Trade-offs Considered
29
+
30
+ [Options evaluated and rejected, with reasoning. Table format preferred: Option | Pros | Cons | Decision.]
31
+
32
+ ## Unresolved Questions
33
+
34
+ [Open items that need answers before or during implementation. Include recommendations where possible.]
35
+
36
+ ## Test Strategy
37
+
38
+ [How to verify the implementation meets acceptance criteria. Automated tests, manual checks, linting, integration tests.]
39
+
40
+ ## Council Perspectives
41
+
42
+ [Summary of each agent's independent analysis. One subsection per agent with their key arguments and position.]
43
+
44
+ ## Points of Dissent
45
+
46
+ [Where agents disagreed and how the disagreement was resolved. If consensus was unanimous, state that explicitly.]
@@ -2,7 +2,7 @@
2
2
  * files.js — File system utilities for Guild v1
3
3
  */
4
4
 
5
- import { mkdirSync, copyFileSync, existsSync, readdirSync, readFileSync } from 'fs';
5
+ import { mkdirSync, copyFileSync, existsSync, readdirSync, readFileSync, writeFileSync } from 'fs';
6
6
  import { join, dirname, resolve } from 'path';
7
7
  import { fileURLToPath } from 'url';
8
8
 
@@ -80,6 +80,14 @@ export async function copyTemplates() {
80
80
  }
81
81
  }
82
82
 
83
+ // Create docs/specs/ directory with .gitkeep
84
+ const specsDir = join('docs', 'specs');
85
+ mkdirSync(specsDir, { recursive: true });
86
+ const gitkeep = join(specsDir, '.gitkeep');
87
+ if (!existsSync(gitkeep)) {
88
+ writeFileSync(gitkeep, '', 'utf8');
89
+ }
90
+
83
91
  // Copy skill directories with SKILL.md
84
92
  const skillsTemplate = join(TEMPLATES_DIR, 'skills');
85
93
  if (existsSync(skillsTemplate)) {
@@ -137,3 +145,17 @@ export function resolveProjectRoot(startDir = process.cwd()) {
137
145
  dir = parent;
138
146
  }
139
147
  }
148
+
149
+ /**
150
+ * Resolves the Guild project root and changes the working directory to it.
151
+ * Throws if no Guild project is found.
152
+ * Returns the absolute path to the project root.
153
+ */
154
+ export function ensureProjectRoot() {
155
+ const root = resolveProjectRoot();
156
+ if (!root) {
157
+ throw new Error('Guild project not found. Run `guild init` to initialize.');
158
+ }
159
+ process.chdir(root);
160
+ return root;
161
+ }
@@ -107,6 +107,9 @@ ${data.stack}
107
107
  ## Project structure
108
108
  [PENDING: guild-specialize]
109
109
 
110
+ docs/
111
+ specs/ # Design documents (SDD specs)
112
+
110
113
  ## Code conventions
111
114
  ${inferCodeConventions(data.type, data.stack)}
112
115
 
@@ -165,8 +168,9 @@ export async function generateSessionMd() {
165
168
  - CLAUDE.md has placeholders — run /guild-specialize to enrich.
166
169
 
167
170
  ## Next steps
168
- 1. Open Claude Code and run /guild-specialize
169
- 2. Define the first feature with /build-feature
171
+ 1. Run /guild-specialize to analyze your codebase
172
+ 2. Spec your first feature with /council
173
+ 3. Build it with /build-feature
170
174
  `;
171
175
 
172
176
  writeFileSync('SESSION.md', content, 'utf8');