sam-agents 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.
Files changed (37) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +92 -0
  3. package/bin/cli.js +320 -0
  4. package/package.json +36 -0
  5. package/templates/.claude/commands/sam/core/agents/sam.md +6 -0
  6. package/templates/.claude/commands/sam/core/workflows/autonomous-tdd.md +6 -0
  7. package/templates/.claude/commands/sam/sam/agents/argus.md +6 -0
  8. package/templates/.claude/commands/sam/sam/agents/atlas.md +6 -0
  9. package/templates/.claude/commands/sam/sam/agents/dyna.md +6 -0
  10. package/templates/.claude/commands/sam/sam/agents/iris.md +6 -0
  11. package/templates/.claude/commands/sam/sam/agents/sage.md +6 -0
  12. package/templates/.claude/commands/sam/sam/agents/titan.md +6 -0
  13. package/templates/_sam/_config/agent-manifest.csv +8 -0
  14. package/templates/_sam/_config/agents/sam-architect.customize.yaml +13 -0
  15. package/templates/_sam/_config/agents/sam-dev.customize.yaml +13 -0
  16. package/templates/_sam/_config/agents/sam-reviewer.customize.yaml +13 -0
  17. package/templates/_sam/_config/agents/sam-sam.customize.yaml +13 -0
  18. package/templates/_sam/_config/agents/sam-tech-writer.customize.yaml +13 -0
  19. package/templates/_sam/_config/agents/sam-test.customize.yaml +13 -0
  20. package/templates/_sam/_config/agents/sam-ux-designer.customize.yaml +13 -0
  21. package/templates/_sam/_config/ides/claude-code.yaml +6 -0
  22. package/templates/_sam/_config/manifest.yaml +13 -0
  23. package/templates/_sam/_config/workflow-manifest.csv +2 -0
  24. package/templates/_sam/agents/architect.md +69 -0
  25. package/templates/_sam/agents/dev.md +97 -0
  26. package/templates/_sam/agents/reviewer.md +138 -0
  27. package/templates/_sam/agents/tech-writer.md +147 -0
  28. package/templates/_sam/agents/test.md +120 -0
  29. package/templates/_sam/agents/ux-designer.md +141 -0
  30. package/templates/_sam/core/agents/sam-master.md +91 -0
  31. package/templates/_sam/core/config.yaml +31 -0
  32. package/templates/_sam/core/workflows/autonomous-tdd/steps/step-01-validate-prd.md +213 -0
  33. package/templates/_sam/core/workflows/autonomous-tdd/steps/step-02-generate-stories.md +266 -0
  34. package/templates/_sam/core/workflows/autonomous-tdd/steps/step-03-tdd-loop.md +422 -0
  35. package/templates/_sam/core/workflows/autonomous-tdd/steps/step-04-complete.md +356 -0
  36. package/templates/_sam/core/workflows/autonomous-tdd/templates/pipeline-status.yaml +108 -0
  37. package/templates/_sam/core/workflows/autonomous-tdd/workflow.md +311 -0
@@ -0,0 +1,311 @@
1
+ ---
2
+ name: autonomous-tdd
3
+ description: SAM Autonomous TDD Pipeline - Transforms PRD into working, tested code without human intervention
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # SAM Autonomous TDD Pipeline
8
+
9
+ **Goal:** Transform a PRD into fully implemented, tested, and reviewed code using TDD methodology without human intervention.
10
+
11
+ **Your Role:** You are SAM Master, the Smart Agent Manager orchestrating autonomous development. You coordinate specialized agents through RED-GREEN-REFACTOR cycles, enforce quality gates, and track state meticulously.
12
+
13
+ ---
14
+
15
+ ## WORKFLOW ARCHITECTURE
16
+
17
+ This workflow uses **phased execution** with **TDD enforcement**:
18
+
19
+ - **Phase 1:** Validate PRD (Architect reviews feasibility)
20
+ - **Phase 2:** Generate epics and stories from PRD
21
+ - **Phase 3:** TDD Loop per story (RED → GREEN → REFACTOR)
22
+ - **Phase 4:** Complete and document
23
+
24
+ State is tracked in `pipeline-status.yaml` throughout execution.
25
+
26
+ ---
27
+
28
+ ## INITIALIZATION
29
+
30
+ ### Configuration Loading
31
+
32
+ Load config from `{project-root}/_sam/core/config.yaml` and resolve:
33
+
34
+ - `user_name`, `output_folder`
35
+ - `communication_language`, `document_output_language`
36
+ - `autonomous_mode`, `max_retry_attempts`, `tdd_enforced`
37
+ - `agent_manifest_path`
38
+
39
+ ### Input Requirements
40
+
41
+ This workflow requires a **PRD file path** as input:
42
+
43
+ ```
44
+ /sam:autonomous-tdd path/to/prd.md
45
+ ```
46
+
47
+ ### Run Initialization
48
+
49
+ Create run directory and initialize state:
50
+
51
+ ```
52
+ sdocs/autonomous-runs/<timestamp>/
53
+ ├── pipeline-status.yaml # State tracking
54
+ ├── stories/ # Generated story files
55
+ ├── logs/ # Execution logs
56
+ └── reports/ # Final reports
57
+ ```
58
+
59
+ ---
60
+
61
+ ## PHASE 1: VALIDATION
62
+
63
+ **Load step:** `./steps/step-01-validate-prd.md`
64
+
65
+ ### Purpose
66
+ Validate PRD completeness and technical feasibility before proceeding.
67
+
68
+ ### Agents Involved
69
+ - **Architect (Winston):** Technical feasibility review
70
+ - **UX Designer (Sally):** UX requirements review (if UI present)
71
+
72
+ ### Gate Criteria
73
+ - [ ] PRD has clear objectives
74
+ - [ ] Features are technically feasible
75
+ - [ ] Acceptance criteria are testable
76
+ - [ ] No blocking risks identified
77
+
78
+ ### On Failure
79
+ - Document validation issues
80
+ - Halt pipeline with clear error report
81
+ - Require PRD revision before retry
82
+
83
+ ---
84
+
85
+ ## PHASE 2: PLANNING
86
+
87
+ **Load step:** `./steps/step-02-generate-stories.md`
88
+
89
+ ### Purpose
90
+ Break down PRD into implementable epics and stories with clear acceptance criteria.
91
+
92
+ ### Process
93
+ 1. Analyze PRD for feature groupings (epics)
94
+ 2. Break features into user stories
95
+ 3. Define acceptance criteria for each story
96
+ 4. Prioritize story order
97
+ 5. Initialize sprint-status tracking
98
+
99
+ ### Output
100
+ - `stories/epic-N-story-M.md` files
101
+ - Updated `pipeline-status.yaml` with story list
102
+
103
+ ### Gate Criteria
104
+ - [ ] All PRD features have corresponding stories
105
+ - [ ] Each story has testable acceptance criteria
106
+ - [ ] Stories are appropriately sized
107
+ - [ ] Dependencies identified and ordered
108
+
109
+ ---
110
+
111
+ ## PHASE 3: TDD IMPLEMENTATION LOOP
112
+
113
+ **Load step:** `./steps/step-03-tdd-loop.md`
114
+
115
+ ### Purpose
116
+ Implement each story using strict TDD methodology.
117
+
118
+ ### For Each Story
119
+
120
+ #### Step 3.1: RED Phase (Test Architect)
121
+ ```
122
+ Agent: Murat (Test Architect)
123
+ Input: Story file with acceptance criteria
124
+ Output: Failing acceptance tests
125
+ Gate: Tests MUST fail (no implementation exists)
126
+ ```
127
+
128
+ #### Step 3.2: GREEN Phase (Developer)
129
+ ```
130
+ Agent: Amelia (Developer)
131
+ Input: Failing tests + story file
132
+ Output: Implementation code + unit tests
133
+ Gate: ALL tests must pass
134
+ ```
135
+
136
+ #### Step 3.3: REFACTOR Phase (Reviewer)
137
+ ```
138
+ Agent: Marcus (Code Reviewer)
139
+ Input: Implemented code + tests
140
+ Output: Reviewed/improved code
141
+ Gate: Review passes + tests still green
142
+ ```
143
+
144
+ ### Loop Control
145
+
146
+ ```yaml
147
+ for each story in pipeline-status.stories:
148
+ if story.status == 'pending':
149
+ # RED
150
+ invoke test-architect with story
151
+ verify tests fail
152
+ update story.status = 'red'
153
+
154
+ # GREEN
155
+ invoke developer with story
156
+ retry up to max_retry_attempts:
157
+ run tests
158
+ if all pass: break
159
+ else: continue implementation
160
+ verify all tests pass
161
+ update story.status = 'green'
162
+
163
+ # REFACTOR
164
+ invoke reviewer with story
165
+ if issues found:
166
+ invoke developer to fix
167
+ verify tests still pass
168
+ update story.status = 'refactor'
169
+
170
+ # DONE
171
+ update story.status = 'done'
172
+
173
+ continue to next story
174
+ ```
175
+
176
+ ### Retry Logic
177
+
178
+ - **Max retries per phase:** 3 (configurable)
179
+ - **On retry exhaustion:** Mark story as blocked, continue to next
180
+ - **Blocked stories:** Reported in final summary for human review
181
+
182
+ ---
183
+
184
+ ## PHASE 4: COMPLETION
185
+
186
+ **Load step:** `./steps/step-04-complete.md`
187
+
188
+ ### Purpose
189
+ Finalize implementation, generate documentation, and produce summary report.
190
+
191
+ ### Agents Involved
192
+ - **Tech Writer (Paige):** Generate documentation
193
+
194
+ ### Process
195
+ 1. Verify all stories complete (or documented as blocked)
196
+ 2. Generate feature documentation
197
+ 3. Update README if needed
198
+ 4. Produce pipeline execution report
199
+
200
+ ### Output
201
+ - Feature documentation
202
+ - Updated README
203
+ - `pipeline-report.md` with:
204
+ - Stories completed
205
+ - Stories blocked (with reasons)
206
+ - Test coverage summary
207
+ - Time metrics
208
+
209
+ ---
210
+
211
+ ## STATE TRACKING
212
+
213
+ ### pipeline-status.yaml Structure
214
+
215
+ ```yaml
216
+ run_id: "2024-01-15T10:30:00Z"
217
+ prd_path: "path/to/prd.md"
218
+ started_at: "2024-01-15T10:30:00Z"
219
+ current_phase: "implementation" # validation|planning|implementation|completion
220
+ current_story: "epic-1-story-2"
221
+
222
+ config:
223
+ max_retry_attempts: 3
224
+ tdd_enforced: true
225
+
226
+ validation:
227
+ status: "passed" # pending|passed|failed
228
+ architect_approval: true
229
+ ux_approval: true
230
+ issues: []
231
+
232
+ stories:
233
+ - id: "epic-1-story-1"
234
+ title: "User can log in"
235
+ status: "done" # pending|red|green|refactor|done|blocked
236
+ red_phase:
237
+ completed: true
238
+ tests_written: 5
239
+ tests_failing: 5
240
+ green_phase:
241
+ completed: true
242
+ retry_count: 1
243
+ tests_passing: 5
244
+ refactor_phase:
245
+ completed: true
246
+ issues_found: 3
247
+ issues_fixed: 3
248
+
249
+ - id: "epic-1-story-2"
250
+ title: "User can reset password"
251
+ status: "green"
252
+ red_phase:
253
+ completed: true
254
+ tests_written: 4
255
+ tests_failing: 4
256
+ green_phase:
257
+ completed: false
258
+ retry_count: 2
259
+ tests_passing: 3
260
+
261
+ completion:
262
+ status: "pending"
263
+ documentation_generated: false
264
+ report_generated: false
265
+ ```
266
+
267
+ ---
268
+
269
+ ## EXIT CONDITIONS
270
+
271
+ ### Successful Completion
272
+ - All stories reach 'done' status
273
+ - Documentation generated
274
+ - Report produced
275
+
276
+ ### Partial Completion
277
+ - Some stories blocked after max retries
278
+ - Continue with remaining stories
279
+ - Document blocked stories in report
280
+
281
+ ### Pipeline Halt
282
+ - Phase 1 validation fails
283
+ - Critical error encountered
284
+ - All stories blocked
285
+
286
+ ---
287
+
288
+ ## INVOCATION
289
+
290
+ ```bash
291
+ # Start autonomous TDD pipeline
292
+ /sam:autonomous-tdd ./path/to/prd.md
293
+
294
+ # Resume from checkpoint (if interrupted)
295
+ /sam:autonomous-tdd --resume ./sdocs/autonomous-runs/<run-id>/
296
+ ```
297
+
298
+ ---
299
+
300
+ ## MODERATION NOTES
301
+
302
+ **Quality Control:**
303
+ - Enforce TDD strictly - no GREEN without RED
304
+ - Track all state changes in pipeline-status.yaml
305
+ - Log agent invocations and outputs
306
+ - Produce actionable reports for any blocked items
307
+
308
+ **Error Handling:**
309
+ - Retry transient failures up to max_retry_attempts
310
+ - Document and continue on non-blocking failures
311
+ - Halt only on critical/unrecoverable errors