@atlashub/smartstack-cli 3.7.0 → 3.9.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/dist/index.js +365 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
- package/templates/agents/action.md +1 -0
- package/templates/agents/ba-writer.md +33 -0
- package/templates/agents/explore-codebase.md +1 -0
- package/templates/agents/explore-docs.md +1 -0
- package/templates/agents/fix-grammar.md +1 -0
- package/templates/agents/snipper.md +1 -0
- package/templates/skills/admin/SKILL.md +6 -0
- package/templates/skills/ai-prompt/SKILL.md +32 -136
- package/templates/skills/ai-prompt/steps/step-01-implementation.md +122 -0
- package/templates/skills/apex/SKILL.md +120 -0
- package/templates/skills/apex/_shared.md +86 -0
- package/templates/skills/apex/references/agent-teams-protocol.md +164 -0
- package/templates/skills/apex/references/smartstack-layers.md +173 -0
- package/templates/skills/apex/steps/step-00-init.md +156 -0
- package/templates/skills/apex/steps/step-01-analyze.md +169 -0
- package/templates/skills/apex/steps/step-02-plan.md +160 -0
- package/templates/skills/apex/steps/step-03-execute.md +166 -0
- package/templates/skills/apex/steps/step-04-validate.md +138 -0
- package/templates/skills/apex/steps/step-05-examine.md +124 -0
- package/templates/skills/apex/steps/step-06-resolve.md +105 -0
- package/templates/skills/apex/steps/step-07-tests.md +130 -0
- package/templates/skills/apex/steps/step-08-run-tests.md +115 -0
- package/templates/skills/application/SKILL.md +10 -0
- package/templates/skills/application/references/backend-controller-hierarchy.md +58 -0
- package/templates/skills/application/references/backend-entity-seeding.md +72 -0
- package/templates/skills/application/references/backend-verification.md +88 -0
- package/templates/skills/application/references/frontend-verification.md +111 -0
- package/templates/skills/application/references/nav-fallback-procedure.md +200 -0
- package/templates/skills/application/references/provider-template.md +134 -0
- package/templates/skills/application/references/test-frontend.md +73 -0
- package/templates/skills/application/references/test-prerequisites.md +72 -0
- package/templates/skills/application/steps/step-01-navigation.md +7 -198
- package/templates/skills/application/steps/step-03b-provider.md +4 -128
- package/templates/skills/application/steps/step-04-backend.md +20 -350
- package/templates/skills/application/steps/step-05-frontend.md +12 -101
- package/templates/skills/application/steps/step-07-tests.md +12 -132
- package/templates/skills/business-analyse/SKILL.md +11 -2
- package/templates/skills/business-analyse/html/ba-interactive.html +3214 -2246
- package/templates/skills/business-analyse/html/build-html.js +77 -0
- package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +130 -0
- package/templates/skills/business-analyse/html/src/scripts/02-navigation.js +22 -0
- package/templates/skills/business-analyse/html/src/scripts/03-render-cadrage.js +208 -0
- package/templates/skills/business-analyse/html/src/scripts/04-render-modules.js +211 -0
- package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +554 -0
- package/templates/skills/business-analyse/html/src/scripts/06-render-consolidation.js +110 -0
- package/templates/skills/business-analyse/html/src/scripts/07-render-handoff.js +90 -0
- package/templates/skills/business-analyse/html/src/scripts/08-editing.js +45 -0
- package/templates/skills/business-analyse/html/src/scripts/09-export.js +168 -0
- package/templates/skills/business-analyse/html/src/scripts/10-comments.js +171 -0
- package/templates/skills/business-analyse/html/src/scripts/11-review-panel.js +161 -0
- package/templates/skills/business-analyse/html/src/styles/01-variables.css +38 -0
- package/templates/skills/business-analyse/html/src/styles/02-layout.css +101 -0
- package/templates/skills/business-analyse/html/src/styles/03-navigation.css +62 -0
- package/templates/skills/business-analyse/html/src/styles/04-cards.css +196 -0
- package/templates/skills/business-analyse/html/src/styles/05-modules.css +325 -0
- package/templates/skills/business-analyse/html/src/styles/06-wireframes.css +230 -0
- package/templates/skills/business-analyse/html/src/styles/07-comments.css +184 -0
- package/templates/skills/business-analyse/html/src/styles/08-review-panel.css +241 -0
- package/templates/skills/business-analyse/html/src/template.html +623 -0
- package/templates/skills/business-analyse/references/cadrage-structure-cards.md +78 -0
- package/templates/skills/business-analyse/references/cadrage-vibe-coding.md +97 -0
- package/templates/skills/business-analyse/references/consolidation-structural-checks.md +92 -0
- package/templates/skills/business-analyse/references/deploy-data-build.md +121 -0
- package/templates/skills/business-analyse/references/deploy-modes.md +49 -0
- package/templates/skills/business-analyse/references/handoff-file-templates.md +119 -0
- package/templates/skills/business-analyse/references/handoff-mappings.md +81 -0
- package/templates/skills/business-analyse/references/html-data-mapping.md +10 -2
- package/templates/skills/business-analyse/references/init-schema-deployment.md +65 -0
- package/templates/skills/business-analyse/references/review-data-mapping.md +363 -0
- package/templates/skills/business-analyse/references/spec-auto-inference.md +57 -0
- package/templates/skills/business-analyse/references/ui-dashboard-spec.md +85 -0
- package/templates/skills/business-analyse/references/ui-resource-cards.md +110 -0
- package/templates/skills/business-analyse/references/validate-incremental-html.md +55 -0
- package/templates/skills/business-analyse/steps/step-00-init.md +35 -68
- package/templates/skills/business-analyse/steps/step-01-cadrage.md +5 -194
- package/templates/skills/business-analyse/steps/step-03a-data.md +6 -49
- package/templates/skills/business-analyse/steps/step-03b-ui.md +12 -178
- package/templates/skills/business-analyse/steps/step-03d-validate.md +3 -48
- package/templates/skills/business-analyse/steps/step-04-consolidation.md +9 -104
- package/templates/skills/business-analyse/steps/step-05a-handoff.md +25 -441
- package/templates/skills/business-analyse/steps/step-05b-deploy.md +19 -187
- package/templates/skills/business-analyse/steps/step-06-review.md +277 -0
- package/templates/skills/cc-agent/references/agent-behavior-patterns.md +95 -0
- package/templates/skills/cc-agent/steps/step-02-generate.md +5 -78
- package/templates/skills/check-version/SKILL.md +7 -0
- package/templates/skills/controller/references/controller-code-templates.md +159 -0
- package/templates/skills/controller/references/permission-sync-templates.md +152 -0
- package/templates/skills/controller/steps/step-03-generate.md +6 -158
- package/templates/skills/controller/steps/step-04-perms.md +5 -144
- package/templates/skills/debug/SKILL.md +7 -0
- package/templates/skills/explore/SKILL.md +6 -0
- package/templates/skills/feature-full/SKILL.md +39 -142
- package/templates/skills/feature-full/steps/step-01-implementation.md +120 -0
- package/templates/skills/gitflow/references/init-config-template.md +135 -0
- package/templates/skills/gitflow/references/init-name-normalization.md +103 -0
- package/templates/skills/gitflow/references/plan-template.md +69 -0
- package/templates/skills/gitflow/references/start-efcore-preflight.md +70 -0
- package/templates/skills/gitflow/references/start-local-config.md +110 -0
- package/templates/skills/gitflow/steps/step-init.md +18 -289
- package/templates/skills/gitflow/steps/step-plan.md +6 -63
- package/templates/skills/gitflow/steps/step-start.md +16 -126
- package/templates/skills/mcp/SKILL.md +9 -213
- package/templates/skills/mcp/steps/step-01-healthcheck.md +108 -0
- package/templates/skills/mcp/steps/step-02-tools.md +73 -0
- package/templates/skills/notification/SKILL.md +7 -0
- package/templates/skills/quick-search/SKILL.md +5 -0
- package/templates/skills/ralph-loop/SKILL.md +99 -381
- package/templates/skills/ralph-loop/references/category-rules.md +259 -0
- package/templates/skills/ralph-loop/references/compact-loop.md +182 -0
- package/templates/skills/ralph-loop/references/task-transform-legacy.md +259 -0
- package/templates/skills/ralph-loop/references/team-orchestration.md +189 -0
- package/templates/skills/ralph-loop/steps/step-00-init.md +111 -383
- package/templates/skills/ralph-loop/steps/step-01-task.md +79 -896
- package/templates/skills/ralph-loop/steps/step-02-execute.md +68 -680
- package/templates/skills/ralph-loop/steps/step-03-commit.md +47 -277
- package/templates/skills/ralph-loop/steps/step-04-check.md +124 -607
- package/templates/skills/ralph-loop/steps/step-05-report.md +68 -367
- package/templates/skills/refactor/SKILL.md +12 -176
- package/templates/skills/refactor/steps/step-01-discover.md +60 -0
- package/templates/skills/refactor/steps/step-02-execute.md +67 -0
- package/templates/skills/review-code/SKILL.md +19 -257
- package/templates/skills/review-code/steps/step-01-smartstack.md +96 -0
- package/templates/skills/review-code/steps/step-02-detailed-review.md +80 -0
- package/templates/skills/review-code/steps/step-03-react.md +44 -0
- package/templates/skills/ui-components/SKILL.md +7 -0
- package/templates/skills/utils/SKILL.md +6 -0
- package/templates/skills/validate/SKILL.md +6 -0
- package/templates/skills/validate-feature/SKILL.md +8 -0
- package/templates/skills/workflow/SKILL.md +40 -118
- package/templates/skills/workflow/steps/step-01-implementation.md +84 -0
|
@@ -2,447 +2,165 @@
|
|
|
2
2
|
name: ralph-loop
|
|
3
3
|
description: Iterative AI development loop with MCP validation, progress tracking, and completion promises.
|
|
4
4
|
argument-hint: "[-m N] [-c TEXT] [-v] <task description>"
|
|
5
|
-
disable-model-invocation: true
|
|
6
5
|
---
|
|
7
6
|
|
|
8
7
|
<objective>
|
|
9
|
-
Execute the Ralph Weegund technique
|
|
8
|
+
Execute the Ralph Weegund technique — iterative development where the same prompt is fed repeatedly until completion. Uses progressive step loading with MCP validation, progress persistence, and Agent Teams for multi-module parallelization.
|
|
10
9
|
</objective>
|
|
11
10
|
|
|
12
11
|
<quick_start>
|
|
13
|
-
**Three ways to start Ralph Loop:**
|
|
14
|
-
|
|
15
|
-
1. **From Business Analysis (RECOMMENDED):**
|
|
16
|
-
```bash
|
|
17
|
-
/business-analyse MyFeature
|
|
18
|
-
# At the end, BA offers to launch ralph-loop automatically
|
|
19
|
-
# If PRD files are missing, ralph-loop auto-recovers via ss derive-prd
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
2. **Manual start with existing prd.json:**
|
|
23
|
-
```bash
|
|
24
|
-
/ralph-loop
|
|
25
|
-
# Ralph detects .ralph/prd.json and resumes automatically
|
|
26
|
-
# Works after BA handoff or previous Ralph session
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
3. **Direct task (no BA):**
|
|
30
|
-
```bash
|
|
31
|
-
/ralph-loop implement user authentication
|
|
32
|
-
# Ralph creates prd.json on the fly
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
**With options:**
|
|
36
12
|
|
|
13
|
+
**From Business Analysis (RECOMMENDED):**
|
|
37
14
|
```bash
|
|
38
|
-
|
|
39
|
-
/ralph-loop -
|
|
40
|
-
|
|
41
|
-
# Max iterations
|
|
42
|
-
/ralph-loop -m 20 -c "TESTS PASS" add comprehensive tests
|
|
43
|
-
|
|
44
|
-
# Verbose mode
|
|
45
|
-
/ralph-loop -v -c "DONE" fix all linting errors
|
|
15
|
+
/business-analyse MyFeature
|
|
16
|
+
# Then: /ralph-loop -r
|
|
46
17
|
```
|
|
47
18
|
|
|
48
|
-
**
|
|
19
|
+
**Manual start:**
|
|
20
|
+
```bash
|
|
21
|
+
/ralph-loop implement user authentication
|
|
22
|
+
/ralph-loop -c "COMPLETE" -m 20 refactor cache layer
|
|
23
|
+
/ralph-loop -r # Resume previous
|
|
24
|
+
```
|
|
49
25
|
|
|
50
|
-
|
|
51
|
-
- `-c TEXT` (complete): Completion promise text
|
|
52
|
-
- `-v` (verbose): Detailed logging
|
|
53
|
-
- `-r` (resume): Resume from previous state
|
|
26
|
+
**Flags:** `-m N` (max iterations), `-c TEXT` (completion promise), `-v` (verbose), `-r` (resume)
|
|
54
27
|
|
|
55
|
-
See `<parameters>` for complete flag list.
|
|
56
28
|
</quick_start>
|
|
57
29
|
|
|
58
30
|
<parameters>
|
|
59
|
-
|
|
60
|
-
<flags>
|
|
61
|
-
**Flags:**
|
|
62
31
|
| Short | Long | Description |
|
|
63
32
|
|-------|------|-------------|
|
|
64
|
-
| `-m N` | `--max-iterations N` |
|
|
65
|
-
| `-c TEXT` | `--completion-promise TEXT` |
|
|
66
|
-
| `-v` | `--verbose` |
|
|
33
|
+
| `-m N` | `--max-iterations N` | Max iterations (default: 50) |
|
|
34
|
+
| `-c TEXT` | `--completion-promise TEXT` | Completion signal text |
|
|
35
|
+
| `-v` | `--verbose` | Detailed logging |
|
|
67
36
|
| `-r` | `--resume` | Resume from previous state |
|
|
68
|
-
</flags>
|
|
69
|
-
|
|
70
|
-
<examples>
|
|
71
|
-
```bash
|
|
72
|
-
# Basic loop
|
|
73
|
-
/ralph-loop implement feature X
|
|
74
|
-
|
|
75
|
-
# With completion signal
|
|
76
|
-
/ralph-loop -c "ALL TESTS PASS" fix failing tests
|
|
77
|
-
|
|
78
|
-
# Limited iterations with completion
|
|
79
|
-
/ralph-loop -m 10 -c "REFACTOR COMPLETE" clean up auth module
|
|
80
|
-
|
|
81
|
-
# Resume previous loop
|
|
82
|
-
/ralph-loop -r
|
|
83
|
-
|
|
84
|
-
# Verbose mode
|
|
85
|
-
/ralph-loop -v -m 25 -c "DONE" implement CRUD for products
|
|
86
|
-
```
|
|
87
|
-
</examples>
|
|
88
|
-
|
|
89
|
-
<parsing_rules>
|
|
90
|
-
**Argument parsing:**
|
|
91
|
-
|
|
92
|
-
1. `-m N` or `--max-iterations N` -> `{max_iterations}` = N
|
|
93
|
-
2. `-c TEXT` or `--completion-promise TEXT` -> `{completion_promise}` = TEXT
|
|
94
|
-
3. `-v` or `--verbose` -> `{verbose_mode}` = true
|
|
95
|
-
4. `-r` or `--resume` -> `{resume_mode}` = true
|
|
96
|
-
5. Remainder -> `{task_description}`
|
|
97
|
-
</parsing_rules>
|
|
98
|
-
|
|
99
37
|
</parameters>
|
|
100
38
|
|
|
101
|
-
<ralph_concept>
|
|
102
|
-
**Core concept:**
|
|
103
|
-
|
|
104
|
-
The same prompt is fed to Claude repeatedly. The "self-referential" aspect comes from Claude seeing its own previous work in files and git history.
|
|
105
|
-
|
|
106
|
-
**Each iteration:**
|
|
107
|
-
1. Claude receives the SAME prompt
|
|
108
|
-
2. Works on the task, modifying files
|
|
109
|
-
3. Checks completion criteria
|
|
110
|
-
4. If not complete: saves progress, iteration count increments
|
|
111
|
-
5. Claude sees previous work in the files
|
|
112
|
-
6. Iteratively improves until completion promise is output
|
|
113
|
-
|
|
114
|
-
**Iterative Development Cycle (per task):**
|
|
115
|
-
```
|
|
116
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
117
|
-
│ RALPH LOOP - CYCLE │
|
|
118
|
-
├─────────────────────────────────────────────────────────────┤
|
|
119
|
-
│ │
|
|
120
|
-
│ 1. ANALYSE → Load next task from prd.json │
|
|
121
|
-
│ (UC, FR, BR, wireframes, acceptance) │
|
|
122
|
-
│ │
|
|
123
|
-
│ 2. DÉVELOPPEMENT → Generate code for task │
|
|
124
|
-
│ ├─ Backend: Entity, Service, Repository, Controller │
|
|
125
|
-
│ ├─ Tests: Unit tests (xUnit) + non-regression │
|
|
126
|
-
│ ├─ Frontend: Page, Component, Hook (match wireframe) │
|
|
127
|
-
│ ├─ Tests: Frontend tests (React Testing Library) │
|
|
128
|
-
│ ├─ SeedData: CORE RBAC (5 entries) + business data │
|
|
129
|
-
│ └─ Docs: Inline comments + tooltips + i18n keys │
|
|
130
|
-
│ │
|
|
131
|
-
│ 3. VALIDATION → Commit changes + MCP conventions check │
|
|
132
|
-
│ (validate_conventions, check_migrations) │
|
|
133
|
-
│ │
|
|
134
|
-
│ 4. TEST → Run tests (dotnet test + npm test) │
|
|
135
|
-
│ ├─ Unit tests │
|
|
136
|
-
│ ├─ Integration tests │
|
|
137
|
-
│ ├─ Security tests (tenant isolation) │
|
|
138
|
-
│ └─ E2E tests (critical flows) │
|
|
139
|
-
│ │
|
|
140
|
-
│ 5. CORRECTION → If tests fail: │
|
|
141
|
-
│ ├─ Analyze error logs │
|
|
142
|
-
│ ├─ Fix root cause │
|
|
143
|
-
│ ├─ Commit fix │
|
|
144
|
-
│ └─ Return to step 4 │
|
|
145
|
-
│ │
|
|
146
|
-
│ 6. NEXT TASK → Mark task as completed, loop to step 1 │
|
|
147
|
-
│ │
|
|
148
|
-
│ 🎯 Goal: 100% tests pass before moving to next task │
|
|
149
|
-
│ 📊 Coverage: 95-100% (tests auto-generated) │
|
|
150
|
-
│ │
|
|
151
|
-
└─────────────────────────────────────────────────────────────┘
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
**Completion signal:**
|
|
155
|
-
```
|
|
156
|
-
<promise>{completion_promise}</promise>
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
The loop only stops when this exact tag is output or max iterations reached.
|
|
160
|
-
|
|
161
|
-
**What Ralph generates per task:**
|
|
162
|
-
- **Backend code**: Entities (Domain), Services (Application), Repositories (Infrastructure), Controllers (API)
|
|
163
|
-
- **Unit tests**: xUnit tests for domain logic, services, repositories
|
|
164
|
-
- **Integration tests**: Controller tests with WebApplicationFactory
|
|
165
|
-
- **Frontend code**: React pages, components, custom hooks (matching BA wireframes)
|
|
166
|
-
- **Frontend tests**: React Testing Library for components and pages
|
|
167
|
-
- **SeedData**: 5 CORE entries (Navigation, Permissions, Roles, Tenants, Users) + business reference data
|
|
168
|
-
- **Documentation**: Inline code comments, user-facing tooltips, i18n translation keys
|
|
169
|
-
- **Security tests**: Tenant isolation, permission checks, OWASP validations
|
|
170
|
-
|
|
171
|
-
**prd.json structure (input from BA):**
|
|
172
|
-
The prd.json is generated by `/business-analyse` via `ss derive-prd` command. It contains:
|
|
173
|
-
- **feature**: Feature description (from BA)
|
|
174
|
-
- **tasks[]**: Task breakdown by category (domain, application, infrastructure, api, frontend, i18n, test, validation)
|
|
175
|
-
- Each task has: id, description, category, dependencies, acceptance_criteria, linkedFRs, linkedUCs, linkedBRs
|
|
176
|
-
- Frontend tasks include: linkedWireframes (screen IDs from BA mockups), wireframeAcceptanceCriteria
|
|
177
|
-
- SeedData tasks specify: category (core|business), source (specification.seedDataCore or seedDataBusiness)
|
|
178
|
-
- **source**: Traceability to feature.json path (source of truth)
|
|
179
|
-
- **metadata**: Project context (branch, namespace, module order)
|
|
180
|
-
- **config**: max_iterations, completion_promise, current_iteration
|
|
181
|
-
|
|
182
|
-
Ralph reads prd.json to know WHAT to generate, then generates it, tests it, fixes it, and moves to the next task.
|
|
183
|
-
</ralph_concept>
|
|
184
|
-
|
|
185
39
|
<workflow>
|
|
186
|
-
**Standard flow (single module):**
|
|
187
|
-
1. Parse flags and task description (step-00)
|
|
188
|
-
2. Verify MCP servers are available (step-00, MANDATORY)
|
|
189
|
-
3. Initialize .ralph/ structure and state files (step-00)
|
|
190
|
-
4. Load current task from prd.json — create task breakdown if new (step-01, READ ONCE)
|
|
191
|
-
5. Execute first task (step-02, READ ONCE)
|
|
192
|
-
6. Commit changes, update progress (step-03, READ ONCE)
|
|
193
|
-
7. Check completion → enter COMPACT LOOP (step-04)
|
|
194
|
-
8. **COMPACT LOOP** (step-04 section 5, NO re-reading step files):
|
|
195
|
-
- Find eligible tasks → batch by category (max 5)
|
|
196
|
-
- Execute batch inline (generate code)
|
|
197
|
-
- Run tests (dotnet test + npm test)
|
|
198
|
-
- If tests fail: analyze → fix → re-test (loop until 100% pass)
|
|
199
|
-
- Commit batch (only when tests pass)
|
|
200
|
-
- Re-check completion → loop or finish
|
|
201
|
-
9. When complete: generate final report (step-05)
|
|
202
|
-
|
|
203
|
-
**Multi-module flow (from BA handoff - NEW v6.1: automatic launch):**
|
|
204
|
-
1-3. Same as standard flow (or launched automatically from `/business-analyse`)
|
|
205
|
-
4. Detect `prd-*.json` files → create `modules-queue.json`
|
|
206
|
-
5. Copy current module's prd to `prd.json`
|
|
207
|
-
6. Execute all tasks for current module via COMPACT LOOP:
|
|
208
|
-
- Process tasks by category (domain → seeddata → application → infrastructure → api → frontend → i18n → tests)
|
|
209
|
-
- For each task: generate → test → fix (if needed) → re-test → commit (when pass)
|
|
210
|
-
- Each task generates: backend code + tests + frontend code + tests + seeddata + docs
|
|
211
|
-
- Each frontend task respects wireframes from BA (specification.uiWireframes[])
|
|
212
|
-
- Continue until ALL tasks of module = completed
|
|
213
|
-
7. When module complete: advance to next module in queue (step-04 section 3)
|
|
214
|
-
8. Repeat steps 5-7 for each module (step-01 is re-read ONLY for module transitions)
|
|
215
|
-
9. When all modules done: generate cross-module report
|
|
216
40
|
|
|
217
|
-
**
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
-
|
|
225
|
-
|
|
226
|
-
|
|
41
|
+
**Single module:**
|
|
42
|
+
1. Init: parse flags, verify MCP, setup .ralph/ (step-00)
|
|
43
|
+
2. Load tasks from prd.json — unified v3 has pre-computed tasks (step-01, READ ONCE)
|
|
44
|
+
3. Execute first task (step-02, READ ONCE)
|
|
45
|
+
4. Commit + update progress (step-03, READ ONCE)
|
|
46
|
+
5. Check completion → enter COMPACT LOOP (step-04)
|
|
47
|
+
6. **COMPACT LOOP** (step-04 → references/compact-loop.md):
|
|
48
|
+
- Find eligible → batch by category (max 5) → execute → test → commit → loop
|
|
49
|
+
7. Report (step-05)
|
|
50
|
+
|
|
51
|
+
**Multi-module (2+ modules, from BA handoff):**
|
|
52
|
+
1. Init: detect prd-*.json, read dependency layers (step-00)
|
|
53
|
+
2. **IF dependency graph available:** Agent Teams (parallel)
|
|
54
|
+
```
|
|
55
|
+
Team Lead → TeamCreate("ralph-{app}")
|
|
56
|
+
Layer 0: Spawn "mod-employees" (foundation) → wait LAYER_READY
|
|
57
|
+
Layer 1: Spawn "mod-timetracking" + "mod-leavemanagement" (parallel)
|
|
58
|
+
Layer 2: Spawn "mod-reporting"
|
|
59
|
+
→ Cross-module verify → Report → TeamDelete
|
|
60
|
+
```
|
|
61
|
+
3. **IF no dependency graph:** Sequential (compact loop per module)
|
|
62
|
+
4. Report with per-module aggregation (step-05)
|
|
227
63
|
|
|
228
|
-
**Task execution cycle
|
|
64
|
+
**Task execution cycle:**
|
|
229
65
|
```
|
|
230
|
-
LOAD
|
|
231
|
-
|
|
232
|
-
(loop until 100% tests pass)
|
|
66
|
+
LOAD → GENERATE → COMPILE → TEST → [FAIL?] → FIX → RE-TEST → [PASS!] → COMMIT → NEXT
|
|
67
|
+
↑___________________________|
|
|
233
68
|
```
|
|
234
69
|
|
|
235
|
-
**What gets generated per module:**
|
|
236
|
-
1. **Domain layer**: Entities, Value Objects, Enums, Domain Exceptions
|
|
237
|
-
2. **SeedData layer**: 5 CORE entries (Navigation, Permissions, Roles, Tenants, Users) + business reference data
|
|
238
|
-
3. **Application layer**: Services, DTOs, Validators, Query Handlers
|
|
239
|
-
4. **Infrastructure layer**: Repositories, DbContext, Specifications
|
|
240
|
-
5. **API layer**: Controllers, Error Handlers, Validation Responses
|
|
241
|
-
6. **Frontend layer**: Pages (matching wireframes), Components, Custom Hooks, Forms
|
|
242
|
-
7. **I18n layer**: Translation keys (fr, en, it, de) for UI labels
|
|
243
|
-
8. **Tests layer**: Unit tests (Domain, Application), Integration tests (API), Security tests (tenant isolation), E2E tests (critical flows)
|
|
244
|
-
|
|
245
|
-
**Acceptance criteria per task:**
|
|
246
|
-
- Code compiles (dotnet build + npm build)
|
|
247
|
-
- Tests pass (dotnet test + npm test)
|
|
248
|
-
- MCP conventions validated (validate_conventions)
|
|
249
|
-
- Wireframes respected (frontend pages match BA mockups from specification.uiWireframes[])
|
|
250
|
-
- Business rules implemented (BR-to-code mapping from BA)
|
|
251
|
-
- Security enforced (tenant isolation, RBAC permissions)
|
|
252
70
|
</workflow>
|
|
253
71
|
|
|
254
72
|
<state_variables>
|
|
255
|
-
**Persist throughout all steps:**
|
|
256
|
-
|
|
257
73
|
| Variable | Type | Description |
|
|
258
74
|
|----------|------|-------------|
|
|
259
|
-
| `{task_description}` | string | The
|
|
260
|
-
| `{max_iterations}` | number |
|
|
261
|
-
| `{completion_promise}` | string |
|
|
262
|
-
| `{
|
|
263
|
-
| `{
|
|
264
|
-
| `{
|
|
265
|
-
| `{tasks_completed}` | number | Number of tasks completed |
|
|
266
|
-
| `{tasks_total}` | number | Total tasks in prd.json |
|
|
267
|
-
| `{task_status}` | string | Current task status (pending/in_progress/completed/failed/skipped/blocked) |
|
|
268
|
-
| `{task_category}` | string | Task category (domain/application/infrastructure/api/frontend/i18n/test/validation) |
|
|
269
|
-
| `{files_created}` | string[] | Files created during current task |
|
|
270
|
-
| `{files_modified}` | string[] | Files modified during current task |
|
|
271
|
-
| `{current_module}` | string\|null | Current module code (multi-module only) |
|
|
272
|
-
| `{modules_queue}` | object\|null | Module queue state (multi-module only) |
|
|
273
|
-
|
|
75
|
+
| `{task_description}` | string | The task to execute |
|
|
76
|
+
| `{max_iterations}` | number | Max iterations |
|
|
77
|
+
| `{completion_promise}` | string | Completion signal |
|
|
78
|
+
| `{current_iteration}` | number | Current iteration |
|
|
79
|
+
| `{current_module}` | string\|null | Current module (multi-module) |
|
|
80
|
+
| `{modules_queue}` | object\|null | Module queue (multi-module) |
|
|
274
81
|
</state_variables>
|
|
275
82
|
|
|
276
83
|
<mcp_requirements>
|
|
277
|
-
**MANDATORY
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
-
|
|
286
|
-
-
|
|
287
|
-
-
|
|
288
|
-
-
|
|
289
|
-
|
|
290
|
-
**Throughout work, use:**
|
|
291
|
-
- `mcp__smartstack__validate_conventions` - Before commits
|
|
292
|
-
- `mcp__smartstack__check_migrations` - Before EF Core changes
|
|
293
|
-
- `mcp__smartstack__scaffold_extension` - For code generation
|
|
84
|
+
**MANDATORY before any work:**
|
|
85
|
+
1. `mcp__smartstack__validate_conventions` — verify connectivity
|
|
86
|
+
2. `mcp__context7__resolve-library-id` — verify connectivity
|
|
87
|
+
|
|
88
|
+
**During work:**
|
|
89
|
+
- `validate_conventions` — before commits
|
|
90
|
+
- `check_migrations` — before EF Core changes
|
|
91
|
+
- `suggest_migration` — migration naming
|
|
92
|
+
- `generate_permissions` — RBAC seed data
|
|
93
|
+
- `scaffold_api_client` — frontend API client
|
|
94
|
+
- `scaffold_routes` — frontend routing
|
|
95
|
+
- `scaffold_tests` — test generation
|
|
294
96
|
</mcp_requirements>
|
|
295
97
|
|
|
296
98
|
<entry_point>
|
|
297
|
-
|
|
298
99
|
**FIRST ACTION:** Load `steps/step-00-init.md`
|
|
299
|
-
|
|
300
100
|
</entry_point>
|
|
301
101
|
|
|
302
102
|
<step_files>
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
|
306
|
-
|
|
307
|
-
|
|
|
308
|
-
|
|
|
309
|
-
|
|
|
310
|
-
|
|
|
311
|
-
| 04 | `steps/step-04-check.md` | Check completion, decide next action |
|
|
312
|
-
| 05 | `steps/step-05-report.md` | Generate final report |
|
|
103
|
+
| Step | File | Purpose | Target Lines |
|
|
104
|
+
|------|------|---------|-------------|
|
|
105
|
+
| 00 | `steps/step-00-init.md` | Parse args, verify MCP, init state, team setup | ~150 |
|
|
106
|
+
| 01 | `steps/step-01-task.md` | Load/create tasks from prd.json | ~365 |
|
|
107
|
+
| 02 | `steps/step-02-execute.md` | Execute ONE task (first iteration) | ~140 |
|
|
108
|
+
| 03 | `steps/step-03-commit.md` | Commit, update prd.json/progress.txt | ~135 |
|
|
109
|
+
| 04 | `steps/step-04-check.md` | Check completion, compact loop entry | ~185 |
|
|
110
|
+
| 05 | `steps/step-05-report.md` | Generate final report | ~150 |
|
|
313
111
|
|
|
314
112
|
**Reference files (loaded conditionally):**
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
|
319
|
-
|
|
113
|
+
| File | Loaded when |
|
|
114
|
+
|------|-------------|
|
|
115
|
+
| `references/category-rules.md` | Step-02 and compact loop (execution rules per category) |
|
|
116
|
+
| `references/compact-loop.md` | Step-04 section 5 (inline execution after first iteration) |
|
|
117
|
+
| `references/core-seed-data.md` | Infrastructure task with seed data keywords |
|
|
118
|
+
| `references/team-orchestration.md` | Step-00 when multi-module detected (2+ PRDs) |
|
|
320
119
|
</step_files>
|
|
321
120
|
|
|
322
121
|
<file_structure>
|
|
323
|
-
**Ralph creates these files:**
|
|
324
|
-
|
|
325
122
|
```
|
|
326
123
|
.ralph/
|
|
327
|
-
├── prd.json #
|
|
328
|
-
├── progress.txt # Persistent memory
|
|
329
|
-
├── modules-queue.json # Multi-module tracking (
|
|
330
|
-
├── prd-{
|
|
331
|
-
├── prd-{module2}.json # Per-module PRD from BA handoff (source, not modified)
|
|
124
|
+
├── prd.json # Active task list (unified v3: reference data + pre-computed tasks)
|
|
125
|
+
├── progress.txt # Persistent memory
|
|
126
|
+
├── modules-queue.json # Multi-module tracking (if applicable)
|
|
127
|
+
├── prd-{module}.json # Per-module PRDs (from ss derive-prd, unified v3 format)
|
|
332
128
|
├── logs/
|
|
333
|
-
│ └── {timestamp}.log
|
|
334
129
|
└── reports/
|
|
335
|
-
└── {feature
|
|
130
|
+
└── {feature}.md
|
|
336
131
|
```
|
|
337
|
-
|
|
338
|
-
**modules-queue.json structure (multi-module only):**
|
|
339
|
-
```json
|
|
340
|
-
{
|
|
341
|
-
"modules": [
|
|
342
|
-
{
|
|
343
|
-
"code": "module-code",
|
|
344
|
-
"prdFile": ".ralph/prd-module-code.json",
|
|
345
|
-
"status": "pending|in-progress|completed|failed|partial"
|
|
346
|
-
}
|
|
347
|
-
],
|
|
348
|
-
"currentIndex": 0,
|
|
349
|
-
"totalModules": 3,
|
|
350
|
-
"completedModules": 0
|
|
351
|
-
}
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
**prd.json structure:**
|
|
355
|
-
```json
|
|
356
|
-
{
|
|
357
|
-
"$version": "2.0.0",
|
|
358
|
-
"feature": "{task_description}",
|
|
359
|
-
"status": "in_progress",
|
|
360
|
-
"created": "2026-01-30T15:00:00.000Z",
|
|
361
|
-
"updated_at": "2026-01-30T16:30:00.000Z",
|
|
362
|
-
"metadata": {
|
|
363
|
-
"cli_version": "1.36.0",
|
|
364
|
-
"branch": "feature/user-auth",
|
|
365
|
-
"project_path": "/path/to/project",
|
|
366
|
-
"mcp_servers": { "smartstack": true, "context7": true }
|
|
367
|
-
},
|
|
368
|
-
"config": {
|
|
369
|
-
"max_iterations": 50,
|
|
370
|
-
"completion_promise": "COMPLETE",
|
|
371
|
-
"current_iteration": 1
|
|
372
|
-
},
|
|
373
|
-
"source": {
|
|
374
|
-
"type": "ba-handoff",
|
|
375
|
-
"handoff_path": "path/to/4-development-handoff.md",
|
|
376
|
-
"feature_json_path": null
|
|
377
|
-
},
|
|
378
|
-
"tasks": [
|
|
379
|
-
{
|
|
380
|
-
"id": 1,
|
|
381
|
-
"description": "Create User entity in Domain layer",
|
|
382
|
-
"status": "pending",
|
|
383
|
-
"category": "domain",
|
|
384
|
-
"dependencies": [],
|
|
385
|
-
"acceptance_criteria": "Entity compiles, properties match handoff spec",
|
|
386
|
-
"started_at": null,
|
|
387
|
-
"completed_at": null,
|
|
388
|
-
"iteration": null,
|
|
389
|
-
"commit_hash": null,
|
|
390
|
-
"files_changed": { "created": [], "modified": [] },
|
|
391
|
-
"validation": null,
|
|
392
|
-
"error": null
|
|
393
|
-
}
|
|
394
|
-
],
|
|
395
|
-
"history": []
|
|
396
|
-
}
|
|
397
|
-
```
|
|
398
|
-
|
|
399
|
-
> **Schema v2 notes:**
|
|
400
|
-
> - `$version`: Schema version for forward migration
|
|
401
|
-
> - `status` (top-level): `pending` | `in_progress` | `completed` | `failed` | `partial`
|
|
402
|
-
> - `source.type`: `ba-handoff` | `direct` | `feature-full` — `null` when tasks are created directly by Ralph Loop
|
|
403
|
-
> - `task.status`: `pending` | `in_progress` | `completed` | `failed` | `skipped` | `blocked`
|
|
404
|
-
> - `task.category`: `domain` | `application` | `infrastructure` | `api` | `frontend` | `i18n` | `test` | `validation` | `other`
|
|
405
|
-
> - `task.dependencies`: Array of task IDs that must be `completed` before this task can start
|
|
406
|
-
> - `history`: Structured iteration journal (replaces unstructured progress.txt for traceability)
|
|
407
132
|
</file_structure>
|
|
408
133
|
|
|
409
134
|
<execution_rules>
|
|
410
135
|
|
|
411
|
-
- **
|
|
412
|
-
- **
|
|
413
|
-
- **
|
|
414
|
-
- **
|
|
415
|
-
- **
|
|
416
|
-
- **
|
|
417
|
-
- **NEVER fake completion**
|
|
418
|
-
- **NEVER
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
- DO NOT reduce scope autonomously ("I'll skip frontend/tests to save time")
|
|
425
|
-
- The ONLY valid stop reasons: ALL tasks complete, max iterations reached, dead-end (all remaining blocked/failed), or explicit user interruption via Ctrl+C
|
|
426
|
-
- **CONTEXT BUDGET** - Keep ALL output COMPACT during loop iterations. Verbose reasoning wastes context tokens and causes premature termination. Use 1-2 lines per task during the loop. Save detailed output for the final report ONLY. During init, skip verbose MCP output and keep summaries minimal.
|
|
427
|
-
- **MODULE COMPLETENESS** - A module is NOT complete unless ALL expected layers have completed tasks: domain, infrastructure, application, api, frontend, i18n, test. If any layer is missing, inject guardrail tasks before advancing to the next module.
|
|
136
|
+
- **Single module:** Main agent runs compact loop (NEVER delegate to sub-agent)
|
|
137
|
+
- **Multi-module (2+):** Team lead + module workers via TeamCreate (see references/team-orchestration.md)
|
|
138
|
+
- **Load step files ONCE** — after first iteration, use compact-loop.md
|
|
139
|
+
- **VERIFY MCP FIRST** — never skip
|
|
140
|
+
- **BATCH** same-category tasks (max 5 per iteration)
|
|
141
|
+
- **COMMIT** after each batch (not per task)
|
|
142
|
+
- **NEVER fake completion** — only output promise when truly done
|
|
143
|
+
- **NEVER stop the loop** — autonomous until complete, max iterations, or dead-end
|
|
144
|
+
- **CONTEXT BUDGET** — compact output during loop (1-2 lines per task)
|
|
145
|
+
- **MODULE COMPLETENESS** — all layers (domain, infra, app, api, frontend, test) before advancing
|
|
146
|
+
- **MIGRATION MANDATORY** — after EF configs, before tests (no DB = no tests)
|
|
147
|
+
- **TESTS BLOCKING** — 100% pass before proceeding to next task
|
|
148
|
+
|
|
428
149
|
</execution_rules>
|
|
429
150
|
|
|
430
151
|
<success_criteria>
|
|
431
|
-
|
|
432
|
-
- All tasks in prd.json have `status: "completed"` (or `"skipped"`)
|
|
433
|
-
- No tasks with `status: "blocked"` remain
|
|
152
|
+
- All tasks completed (or skipped) in prd.json
|
|
434
153
|
- MCP validations pass
|
|
435
|
-
- Git commits atomic
|
|
436
|
-
-
|
|
437
|
-
-
|
|
438
|
-
-
|
|
439
|
-
-
|
|
440
|
-
-
|
|
441
|
-
-
|
|
154
|
+
- Git commits atomic with commit_hash tracked
|
|
155
|
+
- Tests pass (dotnet test + npm test)
|
|
156
|
+
- Migrations created and applied
|
|
157
|
+
- Seed data complete (navigation, permissions, roles via MCP)
|
|
158
|
+
- Frontend in correct hierarchy (Context/App/Module)
|
|
159
|
+
- Report generated in .ralph/reports/
|
|
160
|
+
- Multi-module: all modules processed, cross-module report
|
|
442
161
|
</success_criteria>
|
|
443
162
|
|
|
444
163
|
<available_commands>
|
|
445
|
-
|
|
446
|
-
- `/ralph-loop:
|
|
447
|
-
- `/ralph-loop:help` - Show documentation
|
|
164
|
+
- `/ralph-loop:cancel-ralph` — Cancel active loop
|
|
165
|
+
- `/ralph-loop:help` — Show documentation
|
|
448
166
|
</available_commands>
|