@itz4blitz/agentful 0.4.0 → 1.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 +131 -16
- package/bin/cli.js +1031 -47
- package/bin/hooks/README.md +338 -82
- package/bin/hooks/analyze-trigger.js +69 -0
- package/bin/hooks/block-random-docs.js +77 -0
- package/bin/hooks/health-check.js +153 -0
- package/bin/hooks/post-agent.js +101 -0
- package/bin/hooks/post-feature.js +227 -0
- package/bin/hooks/pre-agent.js +118 -0
- package/bin/hooks/pre-feature.js +138 -0
- package/lib/VALIDATION_README.md +455 -0
- package/lib/atomic.js +350 -0
- package/lib/ci/claude-action-integration.js +641 -0
- package/lib/ci/index.js +10 -0
- package/lib/core/CLAUDE_EXECUTOR.md +371 -0
- package/lib/core/README.md +321 -0
- package/lib/core/analyzer.js +497 -0
- package/lib/core/claude-executor.example.js +210 -0
- package/lib/core/claude-executor.js +1046 -0
- package/lib/core/cli.js +141 -0
- package/lib/core/detectors/conventions.js +342 -0
- package/lib/core/detectors/framework.js +276 -0
- package/lib/core/detectors/index.js +15 -0
- package/lib/core/detectors/language.js +199 -0
- package/lib/core/detectors/patterns.js +356 -0
- package/lib/core/generator.js +626 -0
- package/lib/core/index.js +9 -0
- package/lib/core/output-parser.example.js +250 -0
- package/lib/core/output-parser.js +458 -0
- package/lib/core/storage.js +515 -0
- package/lib/core/templates.js +556 -0
- package/lib/index.js +32 -0
- package/lib/init.js +252 -21
- package/lib/pipeline/cli.js +423 -0
- package/lib/pipeline/engine.js +928 -0
- package/lib/pipeline/executor.js +440 -0
- package/lib/pipeline/index.js +33 -0
- package/lib/pipeline/integrations.js +559 -0
- package/lib/pipeline/schemas.js +288 -0
- package/lib/presets.js +207 -0
- package/lib/remote/client.js +361 -0
- package/lib/server/auth.js +286 -0
- package/lib/server/client-example.js +190 -0
- package/lib/server/executor.js +426 -0
- package/lib/server/index.js +469 -0
- package/lib/update-helpers.js +505 -0
- package/lib/validation.js +460 -0
- package/package.json +19 -2
- package/template/.claude/agents/architect.md +260 -0
- package/template/.claude/agents/backend.md +203 -0
- package/template/.claude/agents/fixer.md +244 -0
- package/template/.claude/agents/frontend.md +232 -0
- package/template/.claude/agents/orchestrator.md +528 -0
- package/template/.claude/agents/product-analyzer.md +1130 -0
- package/template/.claude/agents/reviewer.md +229 -0
- package/template/.claude/agents/tester.md +242 -0
- package/{.claude → template/.claude}/commands/agentful-analyze.md +151 -43
- package/template/.claude/commands/agentful-decide.md +470 -0
- package/{.claude → template/.claude}/commands/agentful-product.md +89 -5
- package/template/.claude/commands/agentful-start.md +432 -0
- package/{.claude → template/.claude}/commands/agentful-status.md +88 -3
- package/template/.claude/commands/agentful-update.md +402 -0
- package/template/.claude/commands/agentful-validate.md +369 -0
- package/{.claude → template/.claude}/commands/agentful.md +110 -183
- package/template/.claude/product/EXAMPLES.md +167 -0
- package/{.claude → template/.claude}/settings.json +9 -13
- package/{.claude → template/.claude}/skills/conversation/SKILL.md +13 -7
- package/template/.claude/skills/deployment/SKILL.md +116 -0
- package/template/.claude/skills/product-planning/SKILL.md +463 -0
- package/template/.claude/skills/testing/SKILL.md +228 -0
- package/template/.claude/skills/validation/SKILL.md +650 -0
- package/template/CLAUDE.md +73 -5
- package/template/bin/hooks/block-random-docs.js +121 -0
- package/version.json +1 -1
- package/.claude/agents/architect.md +0 -524
- package/.claude/agents/backend.md +0 -315
- package/.claude/agents/fixer.md +0 -263
- package/.claude/agents/frontend.md +0 -274
- package/.claude/agents/orchestrator.md +0 -283
- package/.claude/agents/product-analyzer.md +0 -792
- package/.claude/agents/reviewer.md +0 -332
- package/.claude/agents/tester.md +0 -410
- package/.claude/commands/agentful-decide.md +0 -214
- package/.claude/commands/agentful-start.md +0 -182
- package/.claude/commands/agentful-validate.md +0 -127
- package/.claude/product/EXAMPLES.md +0 -610
- package/.claude/product/README.md +0 -326
- package/.claude/skills/validation/SKILL.md +0 -271
- package/bin/hooks/analyze-trigger.sh +0 -57
- package/bin/hooks/health-check.sh +0 -36
- /package/{.claude → template/.claude}/commands/agentful-generate.md +0 -0
- /package/{.claude → template/.claude}/product/index.md +0 -0
- /package/{.claude → template/.claude}/skills/product-tracking/SKILL.md +0 -0
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agentful-start
|
|
3
|
+
description: Start or resume structured product development loop. Delegates to orchestrator agent.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# agentful Start
|
|
7
|
+
|
|
8
|
+
This command initiates the structured product development loop with human checkpoints.
|
|
9
|
+
|
|
10
|
+
## Startup Sequence
|
|
11
|
+
|
|
12
|
+
### 0. State File Validation
|
|
13
|
+
|
|
14
|
+
Before processing any state files, validate their existence and structure. This prevents corrupted or missing state from causing failures.
|
|
15
|
+
|
|
16
|
+
#### Validation Pattern
|
|
17
|
+
|
|
18
|
+
```javascript
|
|
19
|
+
function validate_state_file(file_path, required_fields) {
|
|
20
|
+
// Check file exists
|
|
21
|
+
if (!exists(file_path)) {
|
|
22
|
+
return { valid: false, error: `File not found: ${file_path}`, action: "initialize" };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Check file is valid JSON
|
|
26
|
+
let content;
|
|
27
|
+
try {
|
|
28
|
+
content = JSON.parse(Read(file_path));
|
|
29
|
+
} catch (e) {
|
|
30
|
+
return { valid: false, error: `Invalid JSON in ${file_path}`, action: "backup_and_reset" };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Check required fields exist
|
|
34
|
+
for (const field of required_fields) {
|
|
35
|
+
if (!(field in content)) {
|
|
36
|
+
return { valid: false, error: `Missing field '${field}' in ${file_path}`, action: "add_field", missing_field: field };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return { valid: true };
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
#### Validate Core State Files
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Validate state.json
|
|
48
|
+
validation = validate_state_file(".agentful/state.json", ["current_task", "current_phase", "iterations", "blocked_on", "last_updated"])
|
|
49
|
+
|
|
50
|
+
if !validation.valid:
|
|
51
|
+
if validation.action == "initialize":
|
|
52
|
+
# Create default state.json
|
|
53
|
+
Write(".agentful/state.json", JSON.stringify({
|
|
54
|
+
version: "1.0",
|
|
55
|
+
current_task: null,
|
|
56
|
+
current_phase: "idle",
|
|
57
|
+
iterations: 0,
|
|
58
|
+
last_updated: new Date().toISOString(),
|
|
59
|
+
blocked_on: []
|
|
60
|
+
}))
|
|
61
|
+
else if validation.action == "backup_and_reset":
|
|
62
|
+
# Backup corrupted file
|
|
63
|
+
Bash("cp .agentful/state.json .agentful/state.json.backup-$(date +%s)")
|
|
64
|
+
# Create fresh file
|
|
65
|
+
Write(".agentful/state.json", JSON.stringify({
|
|
66
|
+
version: "1.0",
|
|
67
|
+
current_task: null,
|
|
68
|
+
current_phase: "idle",
|
|
69
|
+
iterations: 0,
|
|
70
|
+
last_updated: new Date().toISOString(),
|
|
71
|
+
blocked_on: []
|
|
72
|
+
}))
|
|
73
|
+
console.log("⚠️ Corrupted state.json backed up and reset")
|
|
74
|
+
else if validation.action == "add_field":
|
|
75
|
+
# Read, add field, write back
|
|
76
|
+
content = JSON.parse(Read(".agentful/state.json"))
|
|
77
|
+
if validation.missing_field == "blocked_on":
|
|
78
|
+
content.blocked_on = []
|
|
79
|
+
else if validation.missing_field == "iterations":
|
|
80
|
+
content.iterations = 0
|
|
81
|
+
else if validation.missing_field == "last_updated":
|
|
82
|
+
content.last_updated = new Date().toISOString()
|
|
83
|
+
Write(".agentful/state.json", JSON.stringify(content))
|
|
84
|
+
|
|
85
|
+
# Validate completion.json
|
|
86
|
+
validation = validate_state_file(".agentful/completion.json", ["features", "gates"])
|
|
87
|
+
|
|
88
|
+
if !validation.valid:
|
|
89
|
+
if validation.action == "initialize":
|
|
90
|
+
# Create default completion.json
|
|
91
|
+
Write(".agentful/completion.json", JSON.stringify({
|
|
92
|
+
features: {},
|
|
93
|
+
gates: {
|
|
94
|
+
tests_passing: false,
|
|
95
|
+
no_type_errors: false,
|
|
96
|
+
no_dead_code: false,
|
|
97
|
+
coverage_80: false,
|
|
98
|
+
security_clean: false
|
|
99
|
+
},
|
|
100
|
+
overall_progress: 0
|
|
101
|
+
}))
|
|
102
|
+
else if validation.action == "backup_and_reset":
|
|
103
|
+
# Backup corrupted file
|
|
104
|
+
Bash("cp .agentful/completion.json .agentful/completion.json.backup-$(date +%s)")
|
|
105
|
+
# Create fresh file
|
|
106
|
+
Write(".agentful/completion.json", JSON.stringify({
|
|
107
|
+
features: {},
|
|
108
|
+
gates: {
|
|
109
|
+
tests_passing: false,
|
|
110
|
+
no_type_errors: false,
|
|
111
|
+
no_dead_code: false,
|
|
112
|
+
coverage_80: false,
|
|
113
|
+
security_clean: false
|
|
114
|
+
},
|
|
115
|
+
overall_progress: 0
|
|
116
|
+
}))
|
|
117
|
+
console.log("⚠️ Corrupted completion.json backed up and reset")
|
|
118
|
+
else if validation.action == "add_field":
|
|
119
|
+
content = JSON.parse(Read(".agentful/completion.json"))
|
|
120
|
+
if validation.missing_field == "features":
|
|
121
|
+
content.features = {}
|
|
122
|
+
else if validation.missing_field == "gates":
|
|
123
|
+
content.gates = {
|
|
124
|
+
tests_passing: false,
|
|
125
|
+
no_type_errors: false,
|
|
126
|
+
no_dead_code: false,
|
|
127
|
+
coverage_80: false,
|
|
128
|
+
security_clean: false
|
|
129
|
+
}
|
|
130
|
+
else if validation.missing_field == "overall_progress":
|
|
131
|
+
content.overall_progress = 0
|
|
132
|
+
Write(".agentful/completion.json", JSON.stringify(content))
|
|
133
|
+
|
|
134
|
+
# Validate architecture.json (if exists - not required)
|
|
135
|
+
if exists(".agentful/architecture.json"):
|
|
136
|
+
validation = validate_state_file(".agentful/architecture.json", ["language", "framework"])
|
|
137
|
+
|
|
138
|
+
if !validation.valid && validation.action == "backup_and_reset":
|
|
139
|
+
# Architecture is critical - backup and warn
|
|
140
|
+
Bash("cp .agentful/architecture.json .agentful/architecture.json.backup-$(date +%s)")
|
|
141
|
+
console.log("❌ Corrupted architecture.json backed up. Run /agentful-analyze to regenerate")
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 1. Detect User Intent
|
|
145
|
+
|
|
146
|
+
Check if the user provided a specific request with this command:
|
|
147
|
+
|
|
148
|
+
**Examples:**
|
|
149
|
+
- `/agentful-start "Fix the memory leak in checkout flow"` → BUGFIX workflow
|
|
150
|
+
- `/agentful-start "Add subscription proration logic"` → FEATURE_DEVELOPMENT workflow
|
|
151
|
+
- `/agentful-start "Migrate from REST to GraphQL"` → REFACTOR workflow
|
|
152
|
+
- `/agentful-start` (no args) → Continue structured development loop
|
|
153
|
+
|
|
154
|
+
**User Request Detection Logic:**
|
|
155
|
+
|
|
156
|
+
```javascript
|
|
157
|
+
// Extract command arguments
|
|
158
|
+
const args = extract_command_args(); // Everything after "/agentful-start"
|
|
159
|
+
|
|
160
|
+
if (args && args.trim().length > 0) {
|
|
161
|
+
// User provided a specific task description
|
|
162
|
+
const user_request = args.trim();
|
|
163
|
+
|
|
164
|
+
// Pass to orchestrator for classification and execution
|
|
165
|
+
// Orchestrator will determine work type and route to appropriate workflow
|
|
166
|
+
delegate_to_orchestrator(user_request);
|
|
167
|
+
|
|
168
|
+
} else {
|
|
169
|
+
// No arguments - run standard autonomous development loop
|
|
170
|
+
// Orchestrator reads state, picks next task from product spec, executes
|
|
171
|
+
run_autonomous_loop();
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Delegation Flow:**
|
|
176
|
+
|
|
177
|
+
If user provided request:
|
|
178
|
+
```javascript
|
|
179
|
+
Task("orchestrator", `User request: "${user_request}". Classify work type (FEATURE_DEVELOPMENT, BUGFIX, ENHANCEMENT, REFACTOR, MAINTENANCE, META_WORK) and execute appropriate workflow.`);
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
If no request (autonomous mode):
|
|
183
|
+
```javascript
|
|
184
|
+
Task("orchestrator", "Run autonomous development loop. Read state, pick next incomplete task from product spec, delegate to specialist agents, validate, update state, continue until complete or blocked.");
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### 2. Load State
|
|
188
|
+
|
|
189
|
+
Read these files in order:
|
|
190
|
+
- `.claude/product/index.md` - What we're building
|
|
191
|
+
- `.agentful/state.json` - Current work state
|
|
192
|
+
- `.agentful/completion.json` - What's done vs not done
|
|
193
|
+
- `.agentful/decisions.json` - Pending user decisions
|
|
194
|
+
- `.agentful/agent-improvements.json` - Agent improvement suggestions (if exists)
|
|
195
|
+
- `.agentful/skill-improvements.json` - Skill improvement suggestions (if exists)
|
|
196
|
+
- `.agentful/last-known-framework-version.json` - Framework version tracking (if exists)
|
|
197
|
+
|
|
198
|
+
### 3. Check Framework Updates
|
|
199
|
+
|
|
200
|
+
If `.agentful/last-known-framework-version.json` exists:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# Calculate current checksums
|
|
204
|
+
current_checksums = calculate_checksums(".claude/")
|
|
205
|
+
|
|
206
|
+
# Compare with stored checksums
|
|
207
|
+
if current_checksums != stored_checksums:
|
|
208
|
+
if context == "agentful_framework":
|
|
209
|
+
# We're in agentful repo
|
|
210
|
+
"Framework updated. Changes detected in:
|
|
211
|
+
- orchestrator.md (improved)
|
|
212
|
+
- validation skill (new gate added)
|
|
213
|
+
|
|
214
|
+
Testing updated framework..."
|
|
215
|
+
else:
|
|
216
|
+
# User project - agentful was updated
|
|
217
|
+
"agentful framework updated.
|
|
218
|
+
New capabilities available:
|
|
219
|
+
- Enhanced orchestrator with work classification
|
|
220
|
+
- New validation gates
|
|
221
|
+
|
|
222
|
+
Would you like to:
|
|
223
|
+
1. Continue using current setup
|
|
224
|
+
2. Re-run architect to regenerate specialized agents
|
|
225
|
+
3. See what's new"
|
|
226
|
+
|
|
227
|
+
# Update stored checksums
|
|
228
|
+
update_last_known_version()
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### 4. Check Agent Improvement Suggestions
|
|
232
|
+
|
|
233
|
+
If `.agentful/agent-improvements.json` has HIGH priority items:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
if agent_improvements.pending.any(priority == "HIGH"):
|
|
237
|
+
if context == "agentful_framework":
|
|
238
|
+
"Agent improvement suggestions detected:
|
|
239
|
+
- Backend agent needs migration workflow
|
|
240
|
+
|
|
241
|
+
Proceeding with agent improvements..."
|
|
242
|
+
|
|
243
|
+
# Delegate to orchestrator for META_WORK
|
|
244
|
+
else:
|
|
245
|
+
"Note: The agentful framework has suggested improvements.
|
|
246
|
+
These will be available when you update agentful."
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### 5. Check Decisions
|
|
250
|
+
|
|
251
|
+
If `.agentful/decisions.json` has pending items:
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
⚠️ Pending decisions need your input:
|
|
255
|
+
1. "How should we handle race conditions in inventory allocation?"
|
|
256
|
+
Options: Pessimistic locking, Optimistic locking with retry, Queue-based
|
|
257
|
+
Blocking: checkout-feature
|
|
258
|
+
Run: /agentful-decide
|
|
259
|
+
|
|
260
|
+
Cannot proceed until decisions are resolved.
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### 6. Initialize All Required State Files
|
|
264
|
+
|
|
265
|
+
If any required state files don't exist, initialize them on first run:
|
|
266
|
+
|
|
267
|
+
```javascript
|
|
268
|
+
// Initialize state.json
|
|
269
|
+
if (!exists(".agentful/state.json")) {
|
|
270
|
+
Write(".agentful/state.json", JSON.stringify({
|
|
271
|
+
version: "1.0",
|
|
272
|
+
current_task: null,
|
|
273
|
+
current_phase: "idle",
|
|
274
|
+
iterations: 0,
|
|
275
|
+
last_updated: new Date().toISOString(),
|
|
276
|
+
blocked_on: []
|
|
277
|
+
}, null, 2));
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Initialize completion.json
|
|
281
|
+
if (!exists(".agentful/completion.json")) {
|
|
282
|
+
Write(".agentful/completion.json", JSON.stringify({
|
|
283
|
+
features: {},
|
|
284
|
+
gates: {
|
|
285
|
+
tests_passing: false,
|
|
286
|
+
no_type_errors: false,
|
|
287
|
+
no_dead_code: false,
|
|
288
|
+
coverage_80: false,
|
|
289
|
+
security_clean: false
|
|
290
|
+
},
|
|
291
|
+
overall_progress: 0
|
|
292
|
+
}, null, 2));
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Initialize decisions.json
|
|
296
|
+
if (!exists(".agentful/decisions.json")) {
|
|
297
|
+
Write(".agentful/decisions.json", JSON.stringify({
|
|
298
|
+
pending: [],
|
|
299
|
+
resolved: []
|
|
300
|
+
}, null, 2));
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Initialize conversation-state.json
|
|
304
|
+
if (!exists(".agentful/conversation-state.json")) {
|
|
305
|
+
Write(".agentful/conversation-state.json", JSON.stringify({
|
|
306
|
+
current_feature: null,
|
|
307
|
+
current_phase: "idle",
|
|
308
|
+
last_action: null,
|
|
309
|
+
related_features: [],
|
|
310
|
+
session_start: new Date().toISOString(),
|
|
311
|
+
last_message_time: new Date().toISOString(),
|
|
312
|
+
message_count: 0
|
|
313
|
+
}, null, 2));
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// Initialize conversation-history.json
|
|
317
|
+
if (!exists(".agentful/conversation-history.json")) {
|
|
318
|
+
Write(".agentful/conversation-history.json", JSON.stringify({
|
|
319
|
+
version: "1.0",
|
|
320
|
+
session_id: crypto.randomUUID(),
|
|
321
|
+
started_at: new Date().toISOString(),
|
|
322
|
+
messages: [],
|
|
323
|
+
context_snapshot: null
|
|
324
|
+
}, null, 2));
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### 7. Delegate to Orchestrator
|
|
329
|
+
|
|
330
|
+
You are NOT the orchestrator. Use the Task tool to delegate. Handle delegation failures gracefully:
|
|
331
|
+
|
|
332
|
+
**If user provided a specific request:**
|
|
333
|
+
```javascript
|
|
334
|
+
try {
|
|
335
|
+
Task("orchestrator", `User request: "${user_request}". Classify work type (FEATURE_DEVELOPMENT, BUGFIX, ENHANCEMENT, REFACTOR, MAINTENANCE, META_WORK) and execute appropriate workflow.`);
|
|
336
|
+
} catch (error) {
|
|
337
|
+
// Orchestrator delegation failed
|
|
338
|
+
console.error("Failed to delegate to orchestrator:", error.message);
|
|
339
|
+
|
|
340
|
+
// Fallback: Check if orchestrator agent exists
|
|
341
|
+
if (!exists(".claude/agents/orchestrator.md")) {
|
|
342
|
+
throw new Error(`
|
|
343
|
+
❌ Orchestrator agent not found!
|
|
344
|
+
|
|
345
|
+
The orchestrator coordinates all development work. To fix:
|
|
346
|
+
|
|
347
|
+
1. Run: /agentful-analyze
|
|
348
|
+
(This will detect your stack and generate necessary agents)
|
|
349
|
+
|
|
350
|
+
2. Or manually ensure .claude/agents/orchestrator.md exists
|
|
351
|
+
|
|
352
|
+
Cannot proceed without orchestrator.
|
|
353
|
+
`);
|
|
354
|
+
} else {
|
|
355
|
+
// File exists but Task delegation failed for another reason
|
|
356
|
+
throw new Error(`
|
|
357
|
+
❌ Failed to delegate to orchestrator: ${error.message}
|
|
358
|
+
|
|
359
|
+
The orchestrator agent exists but delegation failed. Possible causes:
|
|
360
|
+
- Task tool not available
|
|
361
|
+
- Orchestrator agent has syntax errors
|
|
362
|
+
- System resource limits
|
|
363
|
+
|
|
364
|
+
Please check the error above and try again.
|
|
365
|
+
`);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
**If no request provided (default autonomous mode):**
|
|
371
|
+
```javascript
|
|
372
|
+
try {
|
|
373
|
+
Task("orchestrator", "Run autonomous development loop. Read state, pick next incomplete task from product spec, delegate to specialist agents, validate, update state, continue until complete or blocked.");
|
|
374
|
+
} catch (error) {
|
|
375
|
+
console.error("Failed to delegate to orchestrator:", error.message);
|
|
376
|
+
|
|
377
|
+
if (!exists(".claude/agents/orchestrator.md")) {
|
|
378
|
+
throw new Error(`
|
|
379
|
+
❌ Orchestrator agent not found!
|
|
380
|
+
|
|
381
|
+
Run /agentful-analyze to set up your project.
|
|
382
|
+
`);
|
|
383
|
+
} else {
|
|
384
|
+
throw new Error(`Failed to start orchestrator: ${error.message}`);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
## Ralph Wiggum Integration
|
|
390
|
+
|
|
391
|
+
When running in a Ralph loop (`/ralph-loop`), this command will be called repeatedly.
|
|
392
|
+
|
|
393
|
+
Output this **ONLY when truly complete** (all features done, all gates passing):
|
|
394
|
+
|
|
395
|
+
```
|
|
396
|
+
<promise>AGENTFUL_COMPLETE</promise>
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
## Example Flow
|
|
400
|
+
|
|
401
|
+
```
|
|
402
|
+
1. Read state.json → "checkout-cart" in progress
|
|
403
|
+
2. Read completion.json → checkout: 60% complete
|
|
404
|
+
3. Read .claude/product/index.md → e-commerce requirements
|
|
405
|
+
4. Delegate to @backend → "Implement tax calculation service"
|
|
406
|
+
5. Wait for completion
|
|
407
|
+
6. Delegate to @reviewer → "Review checkout changes"
|
|
408
|
+
7. If issues → @fixer → @reviewer again
|
|
409
|
+
8. Update completion.json → checkout: 80%
|
|
410
|
+
9. Loop → What's next?
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
## Manual Usage
|
|
414
|
+
|
|
415
|
+
For one-shot development (not a Ralph loop):
|
|
416
|
+
1. Run `/agentful-start`
|
|
417
|
+
2. Orchestrator picks one task
|
|
418
|
+
3. Completes it with validation
|
|
419
|
+
4. Reports progress
|
|
420
|
+
5. Run again to continue
|
|
421
|
+
|
|
422
|
+
## Autonomous Usage
|
|
423
|
+
|
|
424
|
+
For continuous development:
|
|
425
|
+
```bash
|
|
426
|
+
/ralph-loop "/agentful-start" --max-iterations 50 --completion-promise "AGENTFUL_COMPLETE"
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
This will run 24/7 until:
|
|
430
|
+
- All features complete (100%)
|
|
431
|
+
- All quality gates passing
|
|
432
|
+
- Or max-iterations reached
|
|
@@ -9,7 +9,7 @@ This command shows the current state of autonomous product development.
|
|
|
9
9
|
|
|
10
10
|
## Display Format
|
|
11
11
|
|
|
12
|
-
### Product Readiness (if `.
|
|
12
|
+
### Product Readiness (if `.agentful/product-analysis.json` exists)
|
|
13
13
|
|
|
14
14
|
Display this section FIRST, before the header:
|
|
15
15
|
|
|
@@ -116,9 +116,94 @@ Iterations: 24
|
|
|
116
116
|
|
|
117
117
|
## Implementation
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
### State File Validation
|
|
120
|
+
|
|
121
|
+
Before reading any state files, validate their existence and structure:
|
|
122
|
+
|
|
123
|
+
```javascript
|
|
124
|
+
function validate_state_file(file_path, required_fields) {
|
|
125
|
+
// Check file exists
|
|
126
|
+
if (!exists(file_path)) {
|
|
127
|
+
return { valid: false, error: `File not found: ${file_path}`, action: "not_found" };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Check file is valid JSON
|
|
131
|
+
let content;
|
|
132
|
+
try {
|
|
133
|
+
content = JSON.parse(Read(file_path));
|
|
134
|
+
} catch (e) {
|
|
135
|
+
return { valid: false, error: `Invalid JSON in ${file_path}`, action: "corrupted" };
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Check required fields exist
|
|
139
|
+
for (const field of required_fields) {
|
|
140
|
+
if (!(field in content)) {
|
|
141
|
+
return { valid: false, error: `Missing field '${field}' in ${file_path}`, action: "incomplete" };
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return { valid: true, content };
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Validate Required Files
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Validate state.json
|
|
153
|
+
validation = validate_state_file(".agentful/state.json", ["current_task", "current_phase", "iterations"])
|
|
154
|
+
|
|
155
|
+
if !validation.valid:
|
|
156
|
+
if validation.action == "not_found":
|
|
157
|
+
console.log(`
|
|
158
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
159
|
+
No Active Development Session
|
|
160
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
161
|
+
|
|
162
|
+
No state file found. Run /agentful-start to begin development.
|
|
163
|
+
`)
|
|
164
|
+
return # Exit - nothing to show
|
|
165
|
+
else if validation.action == "corrupted":
|
|
166
|
+
console.log("❌ Corrupted state.json file. Run /agentful-start to reset.")
|
|
167
|
+
return
|
|
168
|
+
else if validation.action == "incomplete":
|
|
169
|
+
console.log("⚠️ Incomplete state.json. Run /agentful-start to repair.")
|
|
170
|
+
return
|
|
171
|
+
|
|
172
|
+
# Validate completion.json
|
|
173
|
+
validation = validate_state_file(".agentful/completion.json", ["features", "gates"])
|
|
174
|
+
|
|
175
|
+
if !validation.valid:
|
|
176
|
+
if validation.action == "not_found":
|
|
177
|
+
console.log("⚠️ No completion.json found. Run /agentful-start to initialize.")
|
|
178
|
+
return
|
|
179
|
+
else if validation.action == "corrupted":
|
|
180
|
+
console.log("❌ Corrupted completion.json file. Run /agentful-start to reset.")
|
|
181
|
+
return
|
|
182
|
+
|
|
183
|
+
# Validate product-analysis.json (optional - may not exist)
|
|
184
|
+
product_analysis_exists = exists(".agentful/product-analysis.json")
|
|
185
|
+
if product_analysis_exists:
|
|
186
|
+
validation = validate_state_file(".agentful/product-analysis.json", ["readiness_score", "issues"])
|
|
187
|
+
|
|
188
|
+
if !validation.valid && validation.action == "corrupted":
|
|
189
|
+
console.log("⚠️ Corrupted product-analysis.json - skipping product readiness section")
|
|
190
|
+
product_analysis_exists = false
|
|
191
|
+
|
|
192
|
+
# Validate decisions.json (optional - may not exist)
|
|
193
|
+
decisions_exists = exists(".agentful/decisions.json")
|
|
194
|
+
if decisions_exists:
|
|
195
|
+
validation = validate_state_file(".agentful/decisions.json", ["pending"])
|
|
196
|
+
|
|
197
|
+
if !validation.valid && validation.action == "corrupted":
|
|
198
|
+
console.log("⚠️ Corrupted decisions.json - initializing with empty array")
|
|
199
|
+
Write(".agentful/decisions.json", JSON.stringify({ pending: [], resolved: [] }))
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Read and Display
|
|
203
|
+
|
|
204
|
+
After validation passes, read and display:
|
|
120
205
|
|
|
121
|
-
1. `.
|
|
206
|
+
1. `.agentful/product-analysis.json` (optional) - Product readiness score and breakdown
|
|
122
207
|
- Only display product readiness section if this file exists
|
|
123
208
|
- Calculate emoji based on score thresholds (90-100: ✅, 70-89: ⚠️, <70: ❌)
|
|
124
209
|
- Show blocking issues count if > 0
|