bemadralphy 0.3.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +312 -381
- package/dist/ai/anthropic.d.ts +7 -0
- package/dist/ai/anthropic.js +38 -0
- package/dist/ai/anthropic.js.map +1 -0
- package/dist/ai/index.d.ts +3 -0
- package/dist/ai/index.js +52 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/ollama.d.ts +7 -0
- package/dist/ai/ollama.js +39 -0
- package/dist/ai/ollama.js.map +1 -0
- package/dist/ai/openai.d.ts +7 -0
- package/dist/ai/openai.js +37 -0
- package/dist/ai/openai.js.map +1 -0
- package/dist/ai/provider.d.ts +10 -0
- package/dist/ai/provider.js +14 -0
- package/dist/ai/provider.js.map +1 -0
- package/dist/beads/adapter.d.ts +3 -1
- package/dist/beads/adapter.js +17 -1
- package/dist/beads/adapter.js.map +1 -1
- package/dist/cli.js +82 -1
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +9 -0
- package/dist/config.js.map +1 -1
- package/dist/engines/cli-adapter.js +42 -3
- package/dist/engines/cli-adapter.js.map +1 -1
- package/dist/engines/index.js +0 -2
- package/dist/engines/index.js.map +1 -1
- package/dist/engines/ralphy.d.ts +7 -1
- package/dist/engines/ralphy.js +5 -8
- package/dist/engines/ralphy.js.map +1 -1
- package/dist/execution/retry.d.ts +7 -0
- package/dist/execution/retry.js +56 -0
- package/dist/execution/retry.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/orchestrator.d.ts +12 -0
- package/dist/orchestrator.js +94 -203
- package/dist/orchestrator.js.map +1 -1
- package/dist/phases/execute.js +53 -29
- package/dist/phases/execute.js.map +1 -1
- package/dist/phases/sync.js +11 -9
- package/dist/phases/sync.js.map +1 -1
- package/dist/phases/types.d.ts +8 -0
- package/dist/planning/index.js +61 -50
- package/dist/planning/index.js.map +1 -1
- package/dist/specs/archive.js +15 -7
- package/dist/specs/archive.js.map +1 -1
- package/dist/specs/delta.js +3 -4
- package/dist/specs/delta.js.map +1 -1
- package/dist/specs/generate.js +7 -4
- package/dist/specs/generate.js.map +1 -1
- package/dist/specs/index.d.ts +1 -0
- package/dist/specs/index.js +1 -0
- package/dist/specs/index.js.map +1 -1
- package/dist/specs/validate.d.ts +1 -0
- package/dist/specs/validate.js +92 -0
- package/dist/specs/validate.js.map +1 -0
- package/dist/state.d.ts +10 -0
- package/dist/state.js.map +1 -1
- package/dist/steering/index.js +16 -3
- package/dist/steering/index.js.map +1 -1
- package/dist/tasks/db.d.ts +3 -0
- package/dist/tasks/db.js +42 -0
- package/dist/tasks/db.js.map +1 -0
- package/dist/tasks/index.d.ts +2 -0
- package/dist/tasks/index.js +2 -0
- package/dist/tasks/index.js.map +1 -0
- package/dist/tasks/manager.d.ts +36 -0
- package/dist/tasks/manager.js +166 -0
- package/dist/tasks/manager.js.map +1 -0
- package/dist/templates/index.d.ts +4 -0
- package/dist/templates/index.js +37 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/utils/exec.d.ts +9 -0
- package/dist/utils/exec.js +22 -1
- package/dist/utils/exec.js.map +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,207 +1,247 @@
|
|
|
1
1
|
# BeMadRalphy
|
|
2
2
|
|
|
3
|
-
**Be**(ads) + (B)**Mad** + **Ralphy** + [OpenSpec](https://github.com/Fission-AI/OpenSpec)
|
|
3
|
+
**Be**(ads) + (B)**Mad** + **Ralphy** + [OpenSpec](https://github.com/Fission-AI/OpenSpec) + [Superpowers](https://github.com/obra/superpowers) -- five parents, one self-contained CLI.
|
|
4
4
|
|
|
5
5
|
BeMadRalphy is a product-delivery operating system for AI-assisted teams: methodology first, code generation second.
|
|
6
6
|
|
|
7
|
-
> End-to-end automated coding: idea in
|
|
7
|
+
> End-to-end automated coding: idea in, planning, task graph, swarm-aware execution, living specs, deployment out.
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/bemadralphy)
|
|
10
10
|
[](https://www.npmjs.com/package/bemadralphy)
|
|
11
11
|
[](LICENSE)
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Quick Links
|
|
16
|
+
|
|
17
|
+
- First local run: [docs/getting-started.md](docs/getting-started.md)
|
|
18
|
+
- Contributor setup: [docs/onboarding.md](docs/onboarding.md)
|
|
19
|
+
- Architecture deep dive: [docs/architecture.md](docs/architecture.md)
|
|
20
|
+
- Positioning and ICP: [docs/positioning.md](docs/positioning.md)
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## What Is BeMadRalphy?
|
|
14
25
|
|
|
15
|
-
BeMadRalphy
|
|
26
|
+
BeMadRalphy v2 is a **self-contained CLI agent**. All planning, task management, specification lifecycle, and execution orchestration run internally -- no external parent CLIs required.
|
|
16
27
|
|
|
17
|
-
|
|
28
|
+
It absorbs the best ideas from five projects:
|
|
18
29
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
|
|
30
|
+
| Parent | What BeMadRalphy absorbs |
|
|
31
|
+
| --- | --- |
|
|
32
|
+
| [BMAD-METHOD](https://github.com/bmad-code-org/BMAD-METHOD) | Planning prompts, workflow patterns, agent personas |
|
|
33
|
+
| [Beads](https://github.com/steveyegge/beads) | Task schema, dependency resolution, ready-queue algorithm |
|
|
34
|
+
| [Ralphy](https://github.com/michaelshimeles/ralphy) | Execution orchestration, retry logic, prompt construction |
|
|
35
|
+
| [OpenSpec](https://github.com/Fission-AI/OpenSpec) | Spec templates, validation rules, delta/archive lifecycle |
|
|
36
|
+
| [Superpowers](https://github.com/obra/superpowers) | TDD guardrails, two-stage review, anti-rationalization patterns |
|
|
37
|
+
|
|
38
|
+
The result is a single CLI that takes you from a rough idea to a deployed, documented, and tested codebase with minimal human intervention.
|
|
26
39
|
|
|
27
40
|
---
|
|
28
41
|
|
|
29
|
-
##
|
|
42
|
+
## Prerequisites
|
|
43
|
+
|
|
44
|
+
- **Node.js 18+** (or Bun 1.0+)
|
|
45
|
+
- **Git**
|
|
46
|
+
- **At least one AI API key** (`ANTHROPIC_API_KEY` or `OPENAI_API_KEY`) for the planning phase
|
|
47
|
+
- **At least one coding agent CLI** on PATH (e.g., `claude`, `cursor`, `codex`, `kimi`, `gemini`, `ollama`)
|
|
48
|
+
- Optional: `gh` (GitHub CLI) for `--create-pr` support
|
|
49
|
+
- Optional: `ollama` for local model execution
|
|
30
50
|
|
|
31
|
-
|
|
32
|
-
- Contributor/developer setup: [`docs/onboarding.md`](docs/onboarding.md)
|
|
33
|
-
- Architecture and flow details: [`docs/architecture.md`](docs/architecture.md)
|
|
51
|
+
No external `bmad`, `bd`, `openspec`, or `ralphy` CLIs are required.
|
|
34
52
|
|
|
35
53
|
---
|
|
36
54
|
|
|
37
|
-
##
|
|
55
|
+
## Installation
|
|
38
56
|
|
|
39
|
-
|
|
57
|
+
```bash
|
|
58
|
+
# npm (recommended)
|
|
59
|
+
npm install -g bemadralphy
|
|
40
60
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
- **[Ralphy](https://github.com/michaelshimeles/ralphy)** — Autonomous AI coding loop with multi-engine support ([site](https://ralphy.goshen.fyi/))
|
|
44
|
-
- **[OpenSpec](https://github.com/Fission-AI/OpenSpec)** — Living specifications and delta-based change tracking
|
|
61
|
+
# pnpm
|
|
62
|
+
pnpm add -g bemadralphy
|
|
45
63
|
|
|
46
|
-
|
|
64
|
+
# bun
|
|
65
|
+
bun add -g bemadralphy
|
|
47
66
|
|
|
48
|
-
|
|
67
|
+
# yarn
|
|
68
|
+
yarn global add bemadralphy
|
|
49
69
|
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
|
|
70
|
+
# or use the install script
|
|
71
|
+
curl -fsSL https://raw.githubusercontent.com/hxp-pxh/BeMadRalphy/main/install.sh | bash
|
|
72
|
+
```
|
|
53
73
|
|
|
54
|
-
|
|
74
|
+
Verify:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
bemadralphy --version
|
|
78
|
+
bemadralphy --help
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
If your shell cannot find `bemadralphy` after global install:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npx bemadralphy --help
|
|
85
|
+
|
|
86
|
+
# or add npm global bin to PATH
|
|
87
|
+
export PATH="$(npm config get prefix)/bin:$PATH"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Docker
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
docker pull ghcr.io/hxp-pxh/bemadralphy:latest
|
|
94
|
+
docker run -v $(pwd):/workspace ghcr.io/hxp-pxh/bemadralphy init
|
|
95
|
+
```
|
|
55
96
|
|
|
56
97
|
---
|
|
57
98
|
|
|
58
|
-
##
|
|
99
|
+
## Quick Start
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# 1. Create a new project directory
|
|
103
|
+
mkdir my-awesome-app && cd my-awesome-app
|
|
104
|
+
|
|
105
|
+
# 2. Initialize BeMadRalphy
|
|
106
|
+
npx bemadralphy init
|
|
107
|
+
|
|
108
|
+
# 3. Write your idea
|
|
109
|
+
echo "A todo app with real-time sync and offline support" > idea.md
|
|
110
|
+
|
|
111
|
+
# 4. Set an API key for planning
|
|
112
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
59
113
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
end
|
|
66
|
-
subgraph intake [Phase 1: Idea Intake]
|
|
67
|
-
IdeaMD[idea.md]
|
|
68
|
-
DetectMode{Greenfield or brownfield?}
|
|
69
|
-
IntakeYAML[intake.yaml]
|
|
70
|
-
end
|
|
71
|
-
subgraph planning [Phase 2: Planning]
|
|
72
|
-
Brief[Product brief]
|
|
73
|
-
PRD[PRD]
|
|
74
|
-
Arch[Architecture]
|
|
75
|
-
Stories[Epics and stories]
|
|
76
|
-
end
|
|
77
|
-
subgraph steer [Phase 3: Agent Steering]
|
|
78
|
-
AllFiles[14+ steering files]
|
|
79
|
-
end
|
|
80
|
-
subgraph scaffold [Phase 4: Scaffolding]
|
|
81
|
-
GitInit[git init + monorepo]
|
|
82
|
-
PkgJson[package.json]
|
|
83
|
-
end
|
|
84
|
-
subgraph tasks [Phase 5: Task Sync]
|
|
85
|
-
Beads[(Beads graph)]
|
|
86
|
-
TasksMD[tasks.md]
|
|
87
|
-
end
|
|
88
|
-
subgraph exec [Phase 6: Execution]
|
|
89
|
-
Detect{Swarm capable?}
|
|
90
|
-
NativeSwarm[Native swarm]
|
|
91
|
-
ProcessParallel[Process parallel]
|
|
92
|
-
end
|
|
93
|
-
subgraph verify [Phase 7: Verification]
|
|
94
|
-
Completeness[Completeness]
|
|
95
|
-
Correctness[Correctness]
|
|
96
|
-
Coherence[Coherence]
|
|
97
|
-
end
|
|
98
|
-
subgraph post [Phase 8: Post-Execution]
|
|
99
|
-
CodeReview[Code review]
|
|
100
|
-
Docs[Documentation]
|
|
101
|
-
Deploy[Deployment]
|
|
102
|
-
end
|
|
103
|
-
ExploreCmd --> ExploreReport --> IdeaMD
|
|
104
|
-
IdeaMD --> DetectMode --> IntakeYAML
|
|
105
|
-
IntakeYAML --> Brief --> PRD --> Arch --> Stories
|
|
106
|
-
Stories --> AllFiles --> GitInit --> PkgJson
|
|
107
|
-
PkgJson --> Beads --> TasksMD
|
|
108
|
-
TasksMD --> Detect
|
|
109
|
-
Detect -->|yes| NativeSwarm
|
|
110
|
-
Detect -->|no| ProcessParallel
|
|
111
|
-
NativeSwarm --> Completeness
|
|
112
|
-
ProcessParallel --> Completeness
|
|
113
|
-
Completeness --> Correctness --> Coherence
|
|
114
|
-
Coherence --> CodeReview --> Docs --> Deploy
|
|
114
|
+
# 5. Run the full pipeline
|
|
115
|
+
npx bemadralphy run
|
|
116
|
+
|
|
117
|
+
# 6. Check environment readiness any time
|
|
118
|
+
npx bemadralphy doctor
|
|
115
119
|
```
|
|
116
120
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
| **8. Post-Execution** | Code review, full docs suite, living specs, deployment, release management, final summary. |
|
|
121
|
+
BeMadRalphy will:
|
|
122
|
+
|
|
123
|
+
1. Parse your idea and detect greenfield vs. brownfield
|
|
124
|
+
2. Generate a full PRD, architecture, and stories via direct AI calls
|
|
125
|
+
3. Create steering files for every major AI agent/IDE
|
|
126
|
+
4. Scaffold the project (git, configs, CI)
|
|
127
|
+
5. Convert stories to dependency-aware tasks in an embedded SQLite database
|
|
128
|
+
6. Execute tasks with retry logic and optional two-stage review
|
|
129
|
+
7. Verify the implementation against living specs
|
|
130
|
+
8. Generate documentation and deploy
|
|
128
131
|
|
|
129
132
|
---
|
|
130
133
|
|
|
131
|
-
##
|
|
134
|
+
## The 9-Phase Pipeline
|
|
132
135
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
```text
|
|
137
|
+
Phase 0 Phase 1 Phase 2 Phase 3 Phase 4
|
|
138
|
+
Explore > Intake > Planning > Steering > Scaffold
|
|
139
|
+
|
|
|
140
|
+
Phase 8 Phase 7 Phase 6 Phase 5 v
|
|
141
|
+
Post < Verify < Execute < Task Sync <-----+
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
| Phase | What happens |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| **0. Explore** | Optional. Investigate a codebase or problem domain before planning. |
|
|
147
|
+
| **1. Intake** | Read `idea.md`, detect greenfield/brownfield, classify project, output `intake.yaml`. |
|
|
148
|
+
| **2. Planning** | Direct AI calls generate product brief, PRD, architecture, and stories using embedded templates. |
|
|
149
|
+
| **3. Steering** | Generate 14+ steering files for every IDE and agent (Cursor, Claude, Copilot, Windsurf, Cline, Kiro, etc.). |
|
|
150
|
+
| **4. Scaffold** | `git init`, monorepo structure, `package.json`, lint/test/CI configs. |
|
|
151
|
+
| **5. Task Sync** | Convert stories to tasks in `.bemadralphy/tasks.db` (embedded SQLite) and generate `tasks.md`. |
|
|
152
|
+
| **6. Execute** | Swarm-aware execution using the internal ready queue, retry with exponential backoff, and optional two-stage review (spec compliance + code quality). |
|
|
153
|
+
| **7. Verify** | Semantic check: completeness, correctness, coherence. Fix-up tasks fed back if needed. |
|
|
154
|
+
| **8. Post** | Code review, full documentation suite, living specs, deployment, release management. |
|
|
143
155
|
|
|
144
156
|
---
|
|
145
157
|
|
|
146
|
-
##
|
|
158
|
+
## AI Engine Support
|
|
159
|
+
|
|
160
|
+
BeMadRalphy delegates code execution to whichever coding agent CLI you have installed:
|
|
161
|
+
|
|
162
|
+
| Engine | Native swarm |
|
|
163
|
+
| --- | --- |
|
|
164
|
+
| `claude` (default) | Yes |
|
|
165
|
+
| `kimi` | Yes |
|
|
166
|
+
| `codex` | Yes |
|
|
167
|
+
| `cursor` | No |
|
|
168
|
+
| `opencode` | No |
|
|
169
|
+
| `qwen` | No |
|
|
170
|
+
| `copilot` | No |
|
|
171
|
+
| `gemini` | No |
|
|
172
|
+
| `ollama` | No |
|
|
147
173
|
|
|
148
|
-
|
|
149
|
-
| ------------------------------------ | ------------------------------------------------------------------------------------------------ |
|
|
150
|
-
| **Full Autonomous** (`--mode auto`) | Zero pauses after Q&A. Everything runs unattended. |
|
|
151
|
-
| **Hybrid** (`--mode hybrid`) | Planning gates only (after brief, PRD, architecture, stories). Execution is autonomous. Default. |
|
|
152
|
-
| **Supervised** (`--mode supervised`) | Planning gates + execution milestones (after scaffolding, each epic, before deployment). |
|
|
174
|
+
Planning model selection is independent: the planning phase uses the Anthropic, OpenAI, or Ollama API directly (configured via API keys or `--model`).
|
|
153
175
|
|
|
154
176
|
---
|
|
155
177
|
|
|
156
178
|
## CLI Commands
|
|
157
179
|
|
|
158
180
|
```bash
|
|
159
|
-
# Initialize a
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
# Notes:
|
|
163
|
-
# - Creates .bemadralphy/, openspec/, and _bmad-output/
|
|
164
|
-
# - Initializes `bd` and `openspec`
|
|
165
|
-
# - Fails fast if required CLIs are missing
|
|
181
|
+
# Initialize a project
|
|
182
|
+
bemadralphy init
|
|
166
183
|
|
|
167
184
|
# Run the full pipeline
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
# Run with specific options
|
|
171
|
-
npx bemadralphy run --mode auto --engine claude --max-parallel 5 --budget 50
|
|
185
|
+
bemadralphy run
|
|
186
|
+
bemadralphy run --mode auto --engine claude --max-parallel 5 --budget 50
|
|
172
187
|
|
|
173
|
-
# Run
|
|
174
|
-
|
|
188
|
+
# Run planning phases only (intake + planning + steering)
|
|
189
|
+
bemadralphy plan
|
|
190
|
+
bemadralphy plan --model claude-sonnet-4-20250514
|
|
175
191
|
|
|
176
|
-
#
|
|
177
|
-
|
|
192
|
+
# Run execution phases only (sync + execute)
|
|
193
|
+
bemadralphy execute --engine claude
|
|
178
194
|
|
|
179
|
-
# Resume a failed
|
|
180
|
-
|
|
195
|
+
# Resume a failed or interrupted run
|
|
196
|
+
bemadralphy resume
|
|
197
|
+
bemadralphy resume --from execute
|
|
181
198
|
|
|
182
|
-
#
|
|
183
|
-
|
|
199
|
+
# Preview pipeline and cost estimate without execution
|
|
200
|
+
bemadralphy run --dry-run --output json
|
|
184
201
|
|
|
185
202
|
# Explore before planning (optional)
|
|
186
|
-
|
|
203
|
+
bemadralphy explore "How should I structure authentication?"
|
|
187
204
|
|
|
188
205
|
# Check pipeline status
|
|
189
|
-
|
|
206
|
+
bemadralphy status
|
|
190
207
|
|
|
191
|
-
# Show run history
|
|
192
|
-
|
|
193
|
-
|
|
208
|
+
# Show run history
|
|
209
|
+
bemadralphy history
|
|
210
|
+
bemadralphy history --output json
|
|
194
211
|
|
|
195
|
-
#
|
|
196
|
-
|
|
197
|
-
|
|
212
|
+
# Replay a previous run
|
|
213
|
+
bemadralphy replay <runId> --from-phase execute
|
|
214
|
+
|
|
215
|
+
# Check environment readiness
|
|
216
|
+
bemadralphy doctor
|
|
217
|
+
bemadralphy doctor --output json
|
|
218
|
+
|
|
219
|
+
# Manage tasks
|
|
220
|
+
bemadralphy tasks list
|
|
221
|
+
bemadralphy tasks list --status open
|
|
222
|
+
bemadralphy tasks show <id>
|
|
223
|
+
bemadralphy tasks retry <id>
|
|
224
|
+
|
|
225
|
+
# Set persistent config
|
|
226
|
+
bemadralphy config set engine claude
|
|
227
|
+
bemadralphy config set mode auto
|
|
198
228
|
```
|
|
199
229
|
|
|
200
230
|
---
|
|
201
231
|
|
|
232
|
+
## Autonomy Modes
|
|
233
|
+
|
|
234
|
+
| Mode | Description |
|
|
235
|
+
| --- | --- |
|
|
236
|
+
| **Full Autonomous** (`--mode auto`) | Zero pauses after intake Q&A. Everything runs unattended. |
|
|
237
|
+
| **Hybrid** (`--mode hybrid`) | Planning gates only (after brief, PRD, architecture, stories). Execution is autonomous. Default. |
|
|
238
|
+
| **Supervised** (`--mode supervised`) | Planning gates + execution milestones (after scaffolding, each epic, before deployment). |
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
202
242
|
## The `idea.md` File
|
|
203
243
|
|
|
204
|
-
BeMadRalphy starts with an `idea.md` file in your project root. It can be as simple or detailed as you want.
|
|
244
|
+
BeMadRalphy starts with an `idea.md` file in your project root. It can be as simple or as detailed as you want.
|
|
205
245
|
|
|
206
246
|
### Minimal example
|
|
207
247
|
|
|
@@ -237,84 +277,87 @@ Key features:
|
|
|
237
277
|
- AI coach for personalized recommendations
|
|
238
278
|
```
|
|
239
279
|
|
|
240
|
-
BeMadRalphy extracts what you
|
|
280
|
+
BeMadRalphy extracts what you have already decided and only asks about the rest.
|
|
241
281
|
|
|
242
282
|
---
|
|
243
283
|
|
|
244
|
-
## Greenfield vs Brownfield
|
|
284
|
+
## Greenfield vs. Brownfield
|
|
245
285
|
|
|
246
|
-
| Mode
|
|
247
|
-
|
|
|
248
|
-
| **Greenfield** | No existing codebase
|
|
249
|
-
| **Brownfield** | Existing codebase detected | Analyze codebase, generate proposal + spec deltas, skip scaffolding, execute changes |
|
|
286
|
+
| Mode | When | What happens |
|
|
287
|
+
| --- | --- | --- |
|
|
288
|
+
| **Greenfield** | No existing codebase | Full pipeline: idea, PRD, architecture, stories, build from scratch. |
|
|
289
|
+
| **Brownfield** | Existing codebase detected | Analyze codebase, generate proposal + spec deltas, skip scaffolding, execute changes. |
|
|
250
290
|
|
|
251
291
|
Brownfield is auto-detected (looks for `package.json`, `src/`, etc.) or forced with `--brownfield`.
|
|
252
292
|
|
|
253
293
|
---
|
|
254
294
|
|
|
255
|
-
## Living Specs
|
|
295
|
+
## Living Specs
|
|
256
296
|
|
|
257
297
|
After the initial build, BeMadRalphy generates living specifications in `openspec/specs/`:
|
|
258
298
|
|
|
259
299
|
```text
|
|
260
300
|
openspec/
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
301
|
+
specs/
|
|
302
|
+
auth/spec.md
|
|
303
|
+
workouts/spec.md
|
|
304
|
+
goals/spec.md
|
|
305
|
+
changes/
|
|
306
|
+
archive/
|
|
267
307
|
```
|
|
268
308
|
|
|
269
|
-
For subsequent brownfield changes, new requirements are expressed as **delta specs** (ADDED/MODIFIED/REMOVED) against the current specs. On completion, deltas merge into the main specs.
|
|
309
|
+
For subsequent brownfield changes, new requirements are expressed as **delta specs** (ADDED/MODIFIED/REMOVED) against the current specs. On completion, deltas merge into the main specs. All spec validation and archiving runs internally -- no external `openspec` CLI needed.
|
|
270
310
|
|
|
271
311
|
---
|
|
272
312
|
|
|
273
|
-
## Target Project Structure
|
|
313
|
+
## Target Project Structure
|
|
314
|
+
|
|
315
|
+
After scaffolding, your project looks like:
|
|
274
316
|
|
|
275
317
|
```text
|
|
276
318
|
your-project/
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
319
|
+
.bemadralphy/ # Internal state
|
|
320
|
+
state.yaml # Pipeline state and checkpoints
|
|
321
|
+
tasks.db # SQLite task database
|
|
322
|
+
intake.yaml # Processed intake decisions
|
|
323
|
+
cost.log # Per-task cost tracking
|
|
324
|
+
failures.log # Phase failure log
|
|
325
|
+
runs.jsonl # Append-only run history
|
|
326
|
+
_bmad-output/ # Planning artifacts
|
|
327
|
+
product-brief.md
|
|
328
|
+
prd.md
|
|
329
|
+
architecture.md
|
|
330
|
+
stories/
|
|
331
|
+
openspec/ # Living specs
|
|
332
|
+
specs/
|
|
333
|
+
changes/
|
|
334
|
+
archive/
|
|
335
|
+
docs/
|
|
336
|
+
adr/ # Architecture Decision Records
|
|
337
|
+
onboarding.md
|
|
338
|
+
runbook.md
|
|
339
|
+
src/ # Your application code
|
|
340
|
+
tests/
|
|
341
|
+
.github/
|
|
342
|
+
workflows/
|
|
343
|
+
ISSUE_TEMPLATE/
|
|
344
|
+
pull_request_template.md
|
|
345
|
+
AGENTS.md # Universal agent steering
|
|
346
|
+
CLAUDE.md # Claude-specific steering
|
|
347
|
+
.cursorrules # Cursor-specific steering
|
|
348
|
+
idea.md # Your original idea
|
|
349
|
+
tasks.md # Human-readable task list
|
|
350
|
+
package.json
|
|
351
|
+
README.md
|
|
309
352
|
```
|
|
310
353
|
|
|
311
354
|
---
|
|
312
355
|
|
|
313
356
|
## Configuration
|
|
314
357
|
|
|
315
|
-
### `.bemadralphy/state.yaml`
|
|
358
|
+
### State file (`.bemadralphy/state.yaml`)
|
|
316
359
|
|
|
317
|
-
Tracks pipeline state for resumability
|
|
360
|
+
Tracks pipeline state for resumability:
|
|
318
361
|
|
|
319
362
|
```yaml
|
|
320
363
|
phase: execution
|
|
@@ -332,234 +375,121 @@ Resume and replay behavior:
|
|
|
332
375
|
|
|
333
376
|
- `--resume` retries the failed phase when a run fails.
|
|
334
377
|
- `--resume` starts at the next phase when the previous phase completed successfully.
|
|
335
|
-
-
|
|
336
|
-
- `replay <runId>` resolves from the latest run-history record for that `runId
|
|
337
|
-
|
|
338
|
-
Run/cost logs are append-only JSONL and use atomic append writes:
|
|
339
|
-
|
|
340
|
-
- `.bemadralphy/runs.jsonl` (history)
|
|
341
|
-
- `.bemadralphy/cost.log` (cost tracking)
|
|
342
|
-
- `.bemadralphy/failures.log` (phase failures)
|
|
343
|
-
|
|
344
|
-
### Run defaults via config file
|
|
378
|
+
- Completed runs clear `resumeFromPhase`, so a later `--resume` starts fresh.
|
|
379
|
+
- `replay <runId>` resolves from the latest run-history record for that `runId`.
|
|
345
380
|
|
|
346
|
-
|
|
381
|
+
### Persistent defaults via config file
|
|
347
382
|
|
|
348
|
-
|
|
383
|
+
Define defaults in `.bemadralphyrc` (YAML/JSON) or `bemad.config.js`:
|
|
349
384
|
|
|
350
385
|
```yaml
|
|
386
|
+
# .bemadralphyrc
|
|
351
387
|
mode: hybrid
|
|
352
|
-
engine:
|
|
388
|
+
engine: claude
|
|
353
389
|
maxParallel: 2
|
|
354
390
|
executionProfile: balanced
|
|
355
391
|
output: text
|
|
392
|
+
model: claude-sonnet-4-20250514
|
|
356
393
|
plugins:
|
|
357
394
|
- ./bemad.plugins/local-plugin.mjs
|
|
358
395
|
```
|
|
359
396
|
|
|
360
|
-
Example `bemad.config.js`:
|
|
361
|
-
|
|
362
397
|
```js
|
|
398
|
+
// bemad.config.js
|
|
363
399
|
export default {
|
|
364
400
|
mode: 'hybrid',
|
|
365
|
-
engine: '
|
|
401
|
+
engine: 'claude',
|
|
366
402
|
output: 'json',
|
|
367
403
|
};
|
|
368
404
|
```
|
|
369
405
|
|
|
370
406
|
CLI flags always override config file values.
|
|
371
407
|
|
|
372
|
-
### Flags
|
|
373
|
-
|
|
374
|
-
| Flag
|
|
375
|
-
|
|
|
376
|
-
| `--mode auto\|hybrid\|supervised` | Autonomy mode
|
|
377
|
-
| `--engine <name>`
|
|
378
|
-
| `--planning-engine <name>`
|
|
379
|
-
| `--
|
|
380
|
-
| `--
|
|
381
|
-
| `--
|
|
382
|
-
| `--
|
|
383
|
-
| `--
|
|
384
|
-
| `--
|
|
385
|
-
| `--
|
|
386
|
-
| `--
|
|
387
|
-
| `--
|
|
388
|
-
| `--
|
|
389
|
-
| `--
|
|
390
|
-
| `--
|
|
408
|
+
### Flags reference
|
|
409
|
+
|
|
410
|
+
| Flag | Description |
|
|
411
|
+
| --- | --- |
|
|
412
|
+
| `--mode auto\|hybrid\|supervised` | Autonomy mode |
|
|
413
|
+
| `--engine <name>` | AI engine for execution |
|
|
414
|
+
| `--planning-engine <name>` | Override engine for planning phase only |
|
|
415
|
+
| `--model <name>` | Model for direct AI planning calls |
|
|
416
|
+
| `--timeout <seconds>` | Task timeout hint |
|
|
417
|
+
| `--max-parallel N` | Max parallel tasks (default: 3) |
|
|
418
|
+
| `--execution-profile <profile>` | Guardrails: `safe\|balanced\|fast` |
|
|
419
|
+
| `--audience-profile <profile>` | ICP: `solo-dev\|agency-team\|product-team\|enterprise-team` |
|
|
420
|
+
| `--budget N` | Cost cap in USD |
|
|
421
|
+
| `--brownfield` | Force brownfield mode |
|
|
422
|
+
| `--swarm native\|process\|off` | Override swarm detection |
|
|
423
|
+
| `--create-pr` | Create PRs for each task |
|
|
424
|
+
| `--dry-run` | Preflight plan + cost estimate only |
|
|
425
|
+
| `--resume` | Resume from latest checkpoint |
|
|
426
|
+
| `--from-phase <name>` | Start at a specific phase |
|
|
427
|
+
| `--output text\|json` | Human-readable or structured output |
|
|
428
|
+
| `--plugin <paths...>` | Load custom plugin modules |
|
|
391
429
|
|
|
392
430
|
### Execution profiles
|
|
393
431
|
|
|
394
|
-
-
|
|
395
|
-
-
|
|
396
|
-
-
|
|
432
|
+
- **safe**: Single-lane execution, process-mode bias, lowest coordination risk.
|
|
433
|
+
- **balanced** (default): Controlled concurrency for day-to-day product work.
|
|
434
|
+
- **fast**: Maximum requested concurrency for throughput-focused runs.
|
|
397
435
|
|
|
398
436
|
---
|
|
399
437
|
|
|
400
|
-
##
|
|
401
|
-
|
|
402
|
-
### Quick Install (Recommended)
|
|
403
|
-
|
|
404
|
-
```bash
|
|
405
|
-
# npm
|
|
406
|
-
npm install -g bemadralphy
|
|
407
|
-
|
|
408
|
-
# pnpm
|
|
409
|
-
pnpm add -g bemadralphy
|
|
410
|
-
|
|
411
|
-
# bun
|
|
412
|
-
bun add -g bemadralphy
|
|
413
|
-
|
|
414
|
-
# yarn
|
|
415
|
-
yarn global add bemadralphy
|
|
416
|
-
|
|
417
|
-
# or use the install script
|
|
418
|
-
curl -fsSL https://raw.githubusercontent.com/hxp-pxh/BeMadRalphy/main/install.sh | bash
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
Verify the install:
|
|
422
|
-
|
|
423
|
-
```bash
|
|
424
|
-
bemadralphy --version
|
|
425
|
-
bemadralphy --help
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
If your shell cannot find `bemadralphy` right after global install:
|
|
429
|
-
|
|
430
|
-
```bash
|
|
431
|
-
# still works without global PATH wiring
|
|
432
|
-
npx bemadralphy --help
|
|
433
|
-
|
|
434
|
-
# if you use a custom npm prefix, add its bin dir to PATH
|
|
435
|
-
export PATH="$(npm config get prefix)/bin:$PATH"
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
### Docker
|
|
439
|
-
|
|
440
|
-
```bash
|
|
441
|
-
# Pull from GitHub Container Registry
|
|
442
|
-
docker pull ghcr.io/hxp-pxh/bemadralphy:latest
|
|
443
|
-
|
|
444
|
-
# Run
|
|
445
|
-
docker run -v $(pwd):/workspace ghcr.io/hxp-pxh/bemadralphy init
|
|
446
|
-
```
|
|
438
|
+
## Internal Architecture (High-Level)
|
|
447
439
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
bd --version
|
|
472
|
-
openspec --version
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
### Install BeMadRalphy dependencies
|
|
476
|
-
|
|
477
|
-
```bash
|
|
478
|
-
npm install
|
|
479
|
-
npm run build
|
|
480
|
-
node dist/cli.js --help
|
|
440
|
+
```text
|
|
441
|
+
idea.md
|
|
442
|
+
|
|
|
443
|
+
v
|
|
444
|
+
[ AI Provider ] -- Anthropic / OpenAI / Ollama
|
|
445
|
+
|
|
|
446
|
+
v
|
|
447
|
+
[ Planning Templates ] -- product-brief / PRD / architecture / stories
|
|
448
|
+
|
|
|
449
|
+
v
|
|
450
|
+
[ TaskManager ] -- embedded SQLite (.bemadralphy/tasks.db)
|
|
451
|
+
| dependency-aware ready queue (recursive CTE)
|
|
452
|
+
v
|
|
453
|
+
[ Engine Adapters ] -- claude / cursor / codex / kimi / gemini / ollama / ...
|
|
454
|
+
| rich prompt construction with project context
|
|
455
|
+
v
|
|
456
|
+
[ Retry + Review ] -- exponential backoff, error classification
|
|
457
|
+
| two-stage review (spec compliance + code quality)
|
|
458
|
+
v
|
|
459
|
+
[ Spec Engine ] -- internal validate / archive / delta merge
|
|
460
|
+
|
|
|
461
|
+
v
|
|
462
|
+
delivered project
|
|
481
463
|
```
|
|
482
464
|
|
|
483
|
-
|
|
465
|
+
For the full module-level walkthrough, see [docs/architecture.md](docs/architecture.md).
|
|
484
466
|
|
|
485
|
-
|
|
486
|
-
- Git
|
|
487
|
-
- Ralphy CLI (`ralphy`) for execution fallback and parallel orchestration
|
|
488
|
-
- BMAD CLI (`bmad`)
|
|
489
|
-
- Beads CLI (`bd`)
|
|
490
|
-
- OpenSpec CLI (`openspec`)
|
|
491
|
-
- Optional local engine: Ollama (`ollama`) when using `--engine ollama`
|
|
467
|
+
---
|
|
492
468
|
|
|
493
469
|
## Fail-Fast Behavior
|
|
494
470
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
- Missing required CLIs fail immediately with actionable errors.
|
|
498
|
-
- Planning fails if BMAD command fails or required artifacts are missing.
|
|
499
|
-
- Sync fails if stories cannot be parsed or Beads writes fail.
|
|
500
|
-
- Execute fails for unknown/unavailable engines.
|
|
501
|
-
- Verify/Post fail if OpenSpec commands fail.
|
|
502
|
-
|
|
503
|
-
`init` is now soft for onboarding:
|
|
504
|
-
|
|
505
|
-
- Always scaffolds `.bemadralphy/`, `openspec/`, `_bmad-output/`, and starter `idea.md`.
|
|
506
|
-
- If `bd`, `bmad`, `openspec`, or `ralphy` are missing, it attempts `npm install -g` automatically.
|
|
507
|
-
- If those CLIs already exist and npm is available, it checks for newer npm releases and upgrades to latest when needed.
|
|
508
|
-
- If npm packages are installed globally but CLIs are not on PATH, it creates command shims in `~/.local/bin` when possible.
|
|
509
|
-
- If auto-install/update fails, `init` still completes with warnings and reports actionable install hints.
|
|
510
|
-
- Use `bemadralphy doctor` to check readiness before full pipeline runs.
|
|
471
|
+
BeMadRalphy is strict by design:
|
|
511
472
|
|
|
512
|
-
|
|
473
|
+
- **Init** scaffolds `.bemadralphy/`, `openspec/`, `_bmad-output/`, and starter `idea.md`. No external CLIs are auto-installed.
|
|
474
|
+
- **Doctor** checks Node, npm, API keys, SQLite access, and at least one coding agent CLI.
|
|
475
|
+
- **Planning** fails if AI provider calls fail and fallback generation cannot produce required artifacts.
|
|
476
|
+
- **Sync** fails if stories cannot be parsed or task creation fails.
|
|
477
|
+
- **Execute** fails for unknown or unavailable engines.
|
|
478
|
+
- **Verify** fails if internal spec validation detects issues.
|
|
513
479
|
|
|
514
|
-
|
|
515
|
-
- If BMAD exits successfully but still leaves missing/empty planning artifacts, the same fallback is generated.
|
|
516
|
-
- Fallback files include explicit markers indicating BMAD automation needs to be rerun when non-interactive BMAD workflows are available.
|
|
517
|
-
|
|
518
|
-
Typical recovery flow:
|
|
519
|
-
|
|
520
|
-
```bash
|
|
521
|
-
# 1) Verify toolchain
|
|
522
|
-
ralphy --version && bmad --version && bd --version && openspec --version
|
|
523
|
-
|
|
524
|
-
# 2) Re-run setup and checks
|
|
525
|
-
npm install
|
|
526
|
-
npm run verify
|
|
527
|
-
node dist/cli.js init
|
|
528
|
-
|
|
529
|
-
# 3) Run pipeline
|
|
530
|
-
node dist/cli.js run --mode auto --engine ralphy
|
|
531
|
-
```
|
|
532
|
-
|
|
533
|
-
---
|
|
534
|
-
|
|
535
|
-
## Quick Start
|
|
480
|
+
Recovery is straightforward:
|
|
536
481
|
|
|
537
482
|
```bash
|
|
538
|
-
#
|
|
539
|
-
|
|
483
|
+
# Check environment
|
|
484
|
+
bemadralphy doctor
|
|
540
485
|
|
|
541
|
-
#
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
# 3. Write your idea
|
|
545
|
-
echo "A todo app with real-time sync and offline support" > idea.md
|
|
486
|
+
# Fix the issue (API key, engine CLI, etc.)
|
|
487
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
546
488
|
|
|
547
|
-
#
|
|
548
|
-
|
|
489
|
+
# Re-run
|
|
490
|
+
bemadralphy run
|
|
549
491
|
```
|
|
550
492
|
|
|
551
|
-
For full expected outputs and fail-fast troubleshooting, see [`docs/getting-started.md`](docs/getting-started.md).
|
|
552
|
-
|
|
553
|
-
That's it. BeMadRalphy will:
|
|
554
|
-
|
|
555
|
-
1. Ask clarifying questions about your stack preferences
|
|
556
|
-
2. Generate a full PRD and architecture
|
|
557
|
-
3. Create all the steering files for your AI agents
|
|
558
|
-
4. Scaffold the project
|
|
559
|
-
5. Execute all tasks with tests
|
|
560
|
-
6. Verify the implementation
|
|
561
|
-
7. Generate documentation and deploy
|
|
562
|
-
|
|
563
493
|
---
|
|
564
494
|
|
|
565
495
|
## Contributing
|
|
@@ -568,7 +498,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on:
|
|
|
568
498
|
|
|
569
499
|
- Fork/clone workflow
|
|
570
500
|
- Branch naming conventions
|
|
571
|
-
- Commit message format
|
|
501
|
+
- Commit message format (Conventional Commits)
|
|
572
502
|
- PR process
|
|
573
503
|
- Code standards
|
|
574
504
|
|
|
@@ -576,7 +506,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on:
|
|
|
576
506
|
|
|
577
507
|
## License
|
|
578
508
|
|
|
579
|
-
[MIT](LICENSE)
|
|
509
|
+
[MIT](LICENSE) -- Copyright (c) 2026 hxp-pxh
|
|
580
510
|
|
|
581
511
|
---
|
|
582
512
|
|
|
@@ -584,7 +514,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on:
|
|
|
584
514
|
|
|
585
515
|
BeMadRalphy builds on the shoulders of giants:
|
|
586
516
|
|
|
587
|
-
- [BMAD-METHOD](https://github.com/bmad-code-org/BMAD-METHOD)
|
|
588
|
-
- [Beads](https://github.com/steveyegge/beads)
|
|
589
|
-
- [Ralphy](https://github.com/michaelshimeles/ralphy)
|
|
590
|
-
- [OpenSpec](https://github.com/Fission-AI/OpenSpec)
|
|
517
|
+
- [BMAD-METHOD](https://github.com/bmad-code-org/BMAD-METHOD) -- The planning framework
|
|
518
|
+
- [Beads](https://github.com/steveyegge/beads) -- The task graph and dependency model
|
|
519
|
+
- [Ralphy](https://github.com/michaelshimeles/ralphy) -- The execution loop and retry patterns ([site](https://ralphy.goshen.fyi/))
|
|
520
|
+
- [OpenSpec](https://github.com/Fission-AI/OpenSpec) -- The living spec model
|
|
521
|
+
- [Superpowers](https://github.com/obra/superpowers) -- The TDD and review methodology
|