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,91 @@
1
+ ---
2
+ name: sam
3
+ displayName: SAM
4
+ title: Smart Agent Manager - Orchestrator
5
+ icon: "🤖"
6
+ ---
7
+
8
+ # SAM - Smart Agent Manager
9
+
10
+ **Role:** Master Orchestrator + Pipeline Controller
11
+
12
+ **Identity:** SAM is the master orchestrator for autonomous development pipelines. Coordinates specialized agents (Atlas, Dyna, Titan, Argus, Sage, Iris) through TDD cycles, manages state, and ensures quality gates are enforced.
13
+
14
+ ---
15
+
16
+ ## Core Responsibilities
17
+
18
+ 1. **Pipeline Orchestration** - Coordinate agents through the autonomous TDD pipeline
19
+ 2. **State Management** - Track progress in pipeline-status.yaml
20
+ 3. **Gate Enforcement** - Ensure quality gates are passed before proceeding
21
+ 4. **Agent Coordination** - Invoke the right agent at the right time
22
+ 5. **Error Handling** - Manage retries and escalations
23
+
24
+ ---
25
+
26
+ ## Communication Style
27
+
28
+ Direct and systematic, focused on pipeline execution and agent coordination. Presents clear status updates and orchestrates workflows efficiently.
29
+
30
+ ---
31
+
32
+ ## Principles
33
+
34
+ - Orchestrate agents through RED-GREEN-REFACTOR cycles without human intervention
35
+ - Enforce quality gates: tests must fail before impl, pass after
36
+ - Track state meticulously in pipeline-status.yaml
37
+ - Escalate only when max retries exceeded
38
+ - Never skip phases - TDD discipline is mandatory
39
+
40
+ ---
41
+
42
+ ## Pipeline Phases
43
+
44
+ ### Phase 1: Validation
45
+ - Validate PRD completeness
46
+ - Check technical feasibility (Architect)
47
+ - Verify acceptance criteria are testable
48
+
49
+ ### Phase 2: Planning
50
+ - Generate epics and stories from PRD
51
+ - Initialize sprint-status tracking
52
+ - Prioritize story order
53
+
54
+ ### Phase 3: TDD Loop (per story)
55
+ 1. **RED** - Titan (Test Architect) writes failing tests
56
+ 2. **GREEN** - Dyna (Developer) implements until tests pass
57
+ 3. **REFACTOR** - Argus (Reviewer) reviews and improves
58
+
59
+ ### Phase 4: Completion
60
+ - Verify all stories complete
61
+ - Generate documentation (Sage - Tech Writer)
62
+ - Produce final report
63
+
64
+ ---
65
+
66
+ ## State Tracking
67
+
68
+ SAM Master maintains state in `sdocs/autonomous-runs/<run-id>/pipeline-status.yaml`:
69
+
70
+ ```yaml
71
+ run_id: <timestamp>
72
+ prd_path: <path-to-prd>
73
+ current_phase: validation|planning|implementation|completion
74
+ current_story: <story-id>
75
+ stories:
76
+ - id: story-1
77
+ status: pending|red|green|refactor|done
78
+ retry_count: 0
79
+ tests_written: false
80
+ tests_passing: false
81
+ review_passed: false
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Escalation Rules
87
+
88
+ - **Max 3 retries** per story phase before escalation
89
+ - **Blocking errors** escalate immediately
90
+ - **Ambiguous requirements** halt pipeline with clear error
91
+ - Escalation produces detailed report for human review
@@ -0,0 +1,31 @@
1
+ # SAM - Smart Agent Manager
2
+ # Core Configuration
3
+ # Version: 1.0.0
4
+
5
+ # User Settings
6
+ user_name: Santosh
7
+ communication_language: English
8
+ document_output_language: English
9
+
10
+ # Output Configuration
11
+ output_folder: "{project-root}/sdocs"
12
+
13
+ # Pipeline Settings
14
+ autonomous_mode: true
15
+ max_retry_attempts: 3
16
+ tdd_enforced: true
17
+
18
+ # Agent Manifest Location
19
+ agent_manifest_path: "{project-root}/_sam/_config/agent-manifest.csv"
20
+
21
+ # Workflow Settings
22
+ default_workflow: autonomous-tdd
23
+ standalone_mode: false # Allows chaining without human prompts
24
+
25
+ # Gate Configurations
26
+ gates:
27
+ prd_validation: true
28
+ tests_must_fail_before_impl: true
29
+ tests_must_pass_after_impl: true
30
+ code_review_required: true
31
+ coverage_threshold: 80
@@ -0,0 +1,213 @@
1
+ ---
2
+ step: 1
3
+ name: validate-prd
4
+ description: Validate PRD completeness and technical feasibility
5
+ agents: [architect, ux-designer]
6
+ ---
7
+
8
+ # Step 1: Validate PRD
9
+
10
+ **Purpose:** Ensure the PRD is complete, technically feasible, and has testable acceptance criteria before proceeding with development.
11
+
12
+ ---
13
+
14
+ ## ENTRY CONDITIONS
15
+
16
+ - PRD file path provided
17
+ - PRD file exists and is readable
18
+ - Pipeline status initialized
19
+
20
+ ---
21
+
22
+ ## PROCESS
23
+
24
+ ### 1.1 Load and Parse PRD
25
+
26
+ ```
27
+ 1. Read PRD file from provided path
28
+ 2. Extract:
29
+ - Project/feature name
30
+ - Objectives
31
+ - Features/requirements
32
+ - Acceptance criteria
33
+ - Technical constraints (if any)
34
+ - UX requirements (if any)
35
+ 3. Store parsed data in pipeline context
36
+ ```
37
+
38
+ ### 1.2 Architect Review (Winston)
39
+
40
+ **Invoke Architect agent to assess:**
41
+
42
+ ```yaml
43
+ architect_review:
44
+ technical_feasibility:
45
+ - Can each feature be implemented?
46
+ - Are there technical blockers?
47
+ - What technologies/patterns required?
48
+
49
+ risks_and_dependencies:
50
+ - External dependencies?
51
+ - Integration points?
52
+ - Scalability concerns?
53
+
54
+ testability:
55
+ - Are acceptance criteria testable?
56
+ - Can we write automated tests?
57
+ - Any criteria needing clarification?
58
+
59
+ effort_assessment:
60
+ - Rough complexity estimate
61
+ - Suggested story breakdown
62
+ ```
63
+
64
+ **Architect Output Format:**
65
+
66
+ ```markdown
67
+ ## Technical Feasibility Review
68
+
69
+ ### Overall Assessment: [APPROVED / NEEDS_REVISION / BLOCKED]
70
+
71
+ ### Feature Analysis
72
+ | Feature | Feasible | Concerns | Notes |
73
+ |---------|----------|----------|-------|
74
+ | Feature 1 | Yes | None | Straightforward |
75
+ | Feature 2 | Yes | Minor | Needs API design |
76
+
77
+ ### Risks Identified
78
+ 1. [Risk 1] - Mitigation: [...]
79
+ 2. [Risk 2] - Mitigation: [...]
80
+
81
+ ### Dependencies
82
+ - [Dependency 1]
83
+ - [Dependency 2]
84
+
85
+ ### Testability Assessment
86
+ - All AC testable: [Yes/No]
87
+ - Clarification needed: [List items]
88
+
89
+ ### Recommendation
90
+ [Proceed / Revise PRD / Block with reason]
91
+ ```
92
+
93
+ ### 1.3 UX Review (Sally) - If UI Present
94
+
95
+ **Invoke UX Designer agent if PRD contains UI requirements:**
96
+
97
+ ```yaml
98
+ ux_review:
99
+ user_flow:
100
+ - Is user journey clear?
101
+ - Are interactions defined?
102
+
103
+ accessibility:
104
+ - Accessibility requirements stated?
105
+ - WCAG compliance level?
106
+
107
+ design_requirements:
108
+ - Design specs available?
109
+ - Style guide referenced?
110
+
111
+ testability:
112
+ - Can UX criteria be tested?
113
+ - Automation possible?
114
+ ```
115
+
116
+ **UX Output Format:**
117
+
118
+ ```markdown
119
+ ## UX Requirements Review
120
+
121
+ ### Overall Assessment: [APPROVED / NEEDS_REVISION]
122
+
123
+ ### User Flow Analysis
124
+ - Primary flow clear: [Yes/No]
125
+ - Edge cases defined: [Yes/No]
126
+
127
+ ### Accessibility
128
+ - Requirements stated: [Yes/No]
129
+ - Recommendations: [...]
130
+
131
+ ### Design Completeness
132
+ - Sufficient for implementation: [Yes/No]
133
+ - Missing elements: [List]
134
+
135
+ ### Recommendation
136
+ [Proceed / Revise PRD]
137
+ ```
138
+
139
+ ### 1.4 Consolidate Validation Results
140
+
141
+ ```yaml
142
+ validation_result:
143
+ status: "passed|failed"
144
+ architect_approval: true|false
145
+ ux_approval: true|false|not_applicable
146
+
147
+ blocking_issues: []
148
+ warnings: []
149
+ clarifications_needed: []
150
+
151
+ recommendation: "proceed|revise|block"
152
+ ```
153
+
154
+ ---
155
+
156
+ ## UPDATE STATE
157
+
158
+ ```yaml
159
+ # Update pipeline-status.yaml
160
+ validation:
161
+ status: "passed" # or "failed"
162
+ completed_at: "<timestamp>"
163
+ architect_approval: true
164
+ ux_approval: true
165
+ issues:
166
+ - type: "warning"
167
+ description: "..."
168
+ - type: "clarification"
169
+ description: "..."
170
+ ```
171
+
172
+ ---
173
+
174
+ ## EXIT CONDITIONS
175
+
176
+ ### Pass → Proceed to Phase 2
177
+ - Architect approves technical feasibility
178
+ - UX approves (if applicable)
179
+ - No blocking issues
180
+ - All AC deemed testable
181
+
182
+ ### Fail → Halt Pipeline
183
+ - Technical feasibility blocked
184
+ - Critical UX issues
185
+ - Untestable acceptance criteria
186
+
187
+ **On Failure:**
188
+ ```yaml
189
+ # Generate validation failure report
190
+ validation_failure_report:
191
+ prd_path: "<path>"
192
+ blocking_issues:
193
+ - issue: "..."
194
+ agent: "architect|ux-designer"
195
+ recommendation: "..."
196
+
197
+ action_required: "Revise PRD and re-run pipeline"
198
+ ```
199
+
200
+ ---
201
+
202
+ ## AUTONOMOUS BEHAVIOR
203
+
204
+ In autonomous mode:
205
+ - **No human prompts** - proceed or fail based on gates
206
+ - **Document everything** - all decisions logged
207
+ - **Clear failure reports** - actionable feedback if blocked
208
+
209
+ ---
210
+
211
+ ## NEXT STEP
212
+
213
+ On validation pass → Load `step-02-generate-stories.md`
@@ -0,0 +1,266 @@
1
+ ---
2
+ step: 2
3
+ name: generate-stories
4
+ description: Generate epics and user stories from validated PRD
5
+ agents: [sam-master]
6
+ ---
7
+
8
+ # Step 2: Generate Stories
9
+
10
+ **Purpose:** Break down the validated PRD into implementable epics and user stories with clear, testable acceptance criteria.
11
+
12
+ ---
13
+
14
+ ## ENTRY CONDITIONS
15
+
16
+ - Phase 1 validation passed
17
+ - PRD parsed and available in context
18
+ - Architect recommendations available
19
+
20
+ ---
21
+
22
+ ## PROCESS
23
+
24
+ ### 2.1 Analyze PRD Structure
25
+
26
+ ```
27
+ 1. Identify major feature areas (candidates for epics)
28
+ 2. Group related requirements
29
+ 3. Identify dependencies between features
30
+ 4. Note technical constraints from architect review
31
+ ```
32
+
33
+ ### 2.2 Create Epics
34
+
35
+ **For each major feature area:**
36
+
37
+ ```yaml
38
+ epic:
39
+ id: "epic-1"
40
+ title: "User Authentication"
41
+ description: "All features related to user authentication and session management"
42
+ prd_sections: ["3.1", "3.2"] # Reference to PRD sections
43
+ stories: [] # To be populated
44
+ dependencies: [] # Other epics this depends on
45
+ ```
46
+
47
+ ### 2.3 Break Down into Stories
48
+
49
+ **For each epic, create user stories:**
50
+
51
+ ```markdown
52
+ # Story: epic-1-story-1
53
+
54
+ ## Title
55
+ User can log in with email and password
56
+
57
+ ## Epic
58
+ User Authentication (epic-1)
59
+
60
+ ## User Story
61
+ As a registered user
62
+ I want to log in with my email and password
63
+ So that I can access my account
64
+
65
+ ## Acceptance Criteria
66
+
67
+ ### AC1: Successful Login
68
+ - GIVEN a registered user with valid credentials
69
+ - WHEN they submit email and password
70
+ - THEN they are authenticated and redirected to dashboard
71
+
72
+ ### AC2: Invalid Credentials
73
+ - GIVEN a user with invalid credentials
74
+ - WHEN they submit email and password
75
+ - THEN they see an error message "Invalid email or password"
76
+ - AND they remain on the login page
77
+
78
+ ### AC3: Empty Fields
79
+ - GIVEN the login form
80
+ - WHEN user submits with empty email or password
81
+ - THEN they see validation error for the empty field(s)
82
+
83
+ ## Technical Notes
84
+ - Use JWT for session management (per architect)
85
+ - Rate limit: 5 attempts per minute
86
+
87
+ ## Tasks
88
+ - [ ] Task 1: Create login API endpoint
89
+ - [ ] Task 2: Implement credential validation
90
+ - [ ] Task 3: Generate and return JWT
91
+ - [ ] Task 4: Create login form component
92
+ - [ ] Task 5: Handle error states
93
+
94
+ ## Dependencies
95
+ - None (first story)
96
+
97
+ ## Status
98
+ pending
99
+ ```
100
+
101
+ ### 2.4 Story Sizing and Ordering
102
+
103
+ **Apply sizing heuristics:**
104
+
105
+ | Size | Criteria |
106
+ |------|----------|
107
+ | Small | 1-3 tasks, single component, ≤1 day |
108
+ | Medium | 4-6 tasks, multiple components, 1-2 days |
109
+ | Large | 7+ tasks, consider splitting |
110
+
111
+ **Ordering rules:**
112
+ 1. Dependencies first
113
+ 2. Foundation before features
114
+ 3. Happy path before edge cases
115
+ 4. Core functionality before polish
116
+
117
+ ### 2.5 Write Story Files
118
+
119
+ **Create story files in run directory:**
120
+
121
+ ```
122
+ sdocs/autonomous-runs/<run-id>/stories/
123
+ ├── epic-1-story-1.md
124
+ ├── epic-1-story-2.md
125
+ ├── epic-2-story-1.md
126
+ └── ...
127
+ ```
128
+
129
+ **Story file template:**
130
+
131
+ ```markdown
132
+ ---
133
+ id: epic-1-story-1
134
+ epic: epic-1
135
+ title: "User can log in with email and password"
136
+ status: pending
137
+ priority: 1
138
+ size: medium
139
+ dependencies: []
140
+ ---
141
+
142
+ # User can log in with email and password
143
+
144
+ ## User Story
145
+ As a registered user
146
+ I want to log in with my email and password
147
+ So that I can access my account
148
+
149
+ ## Acceptance Criteria
150
+
151
+ ### AC1: Successful Login
152
+ - GIVEN a registered user with valid credentials
153
+ - WHEN they submit email and password
154
+ - THEN they are authenticated and redirected to dashboard
155
+
156
+ ### AC2: Invalid Credentials
157
+ - GIVEN a user with invalid credentials
158
+ - WHEN they submit email and password
159
+ - THEN they see an error message "Invalid email or password"
160
+ - AND they remain on the login page
161
+
162
+ ### AC3: Empty Fields Validation
163
+ - GIVEN the login form
164
+ - WHEN user submits with empty email or password
165
+ - THEN they see validation error for the empty field(s)
166
+
167
+ ## Technical Notes
168
+ [Notes from architect review]
169
+
170
+ ## Tasks
171
+ - [ ] Task 1: Create login API endpoint
172
+ - [ ] Task 2: Implement credential validation
173
+ - [ ] Task 3: Generate and return JWT
174
+ - [ ] Task 4: Create login form component
175
+ - [ ] Task 5: Handle error states
176
+
177
+ ## Test Coverage
178
+ - [ ] Acceptance tests (RED phase)
179
+ - [ ] Unit tests (GREEN phase)
180
+
181
+ ## Review Checklist
182
+ - [ ] Code review passed
183
+ - [ ] All tests passing
184
+ - [ ] No security issues
185
+ ```
186
+
187
+ ---
188
+
189
+ ## UPDATE STATE
190
+
191
+ ```yaml
192
+ # Update pipeline-status.yaml
193
+ current_phase: "implementation"
194
+ stories:
195
+ - id: "epic-1-story-1"
196
+ title: "User can log in with email and password"
197
+ epic: "epic-1"
198
+ status: "pending"
199
+ priority: 1
200
+ file_path: "stories/epic-1-story-1.md"
201
+
202
+ - id: "epic-1-story-2"
203
+ title: "User can reset password"
204
+ epic: "epic-1"
205
+ status: "pending"
206
+ priority: 2
207
+ file_path: "stories/epic-1-story-2.md"
208
+ dependencies: ["epic-1-story-1"]
209
+ ```
210
+
211
+ ---
212
+
213
+ ## VALIDATION
214
+
215
+ Before proceeding, verify:
216
+
217
+ - [ ] All PRD features have corresponding stories
218
+ - [ ] Each story has ≥1 acceptance criterion
219
+ - [ ] Acceptance criteria follow GIVEN-WHEN-THEN format
220
+ - [ ] Dependencies are acyclic (no circular deps)
221
+ - [ ] Stories are appropriately sized
222
+ - [ ] Priority order respects dependencies
223
+
224
+ ---
225
+
226
+ ## OUTPUT SUMMARY
227
+
228
+ ```markdown
229
+ ## Story Generation Complete
230
+
231
+ ### Epics Created: 3
232
+ 1. epic-1: User Authentication (4 stories)
233
+ 2. epic-2: Dashboard (3 stories)
234
+ 3. epic-3: Settings (2 stories)
235
+
236
+ ### Stories Created: 9
237
+ | ID | Title | Size | Dependencies |
238
+ |----|-------|------|--------------|
239
+ | epic-1-story-1 | User can log in | M | None |
240
+ | epic-1-story-2 | User can reset password | M | story-1 |
241
+ | ... | ... | ... | ... |
242
+
243
+ ### Implementation Order
244
+ 1. epic-1-story-1 (no deps)
245
+ 2. epic-1-story-2 (after story-1)
246
+ 3. ...
247
+
248
+ ### Ready for TDD Loop
249
+ Proceeding to Phase 3: Implementation
250
+ ```
251
+
252
+ ---
253
+
254
+ ## AUTONOMOUS BEHAVIOR
255
+
256
+ In autonomous mode:
257
+ - Generate all stories without prompts
258
+ - Apply sensible defaults for sizing
259
+ - Order by dependencies automatically
260
+ - Proceed to Phase 3 immediately upon completion
261
+
262
+ ---
263
+
264
+ ## NEXT STEP
265
+
266
+ On story generation complete → Load `step-03-tdd-loop.md`