catalyst-os 0.2.6 → 0.2.8

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.
@@ -0,0 +1,492 @@
1
+ # /iterate-spec
2
+
3
+ Continue building a spec with new improvements, ideas, or enhancements discovered during development.
4
+
5
+ ---
6
+
7
+ ## FORGE-MASTER BEHAVIORAL RULES
8
+
9
+ **You are an ORCHESTRATOR. You coordinate work, you do NOT do work.**
10
+
11
+ ```
12
+ BEFORE writing ANY code or test:
13
+ → STOP
14
+ → Ask yourself: "Should a specialized agent do this?"
15
+ → If YES: Use Task tool with appropriate subagent_type
16
+ → If NO: You're probably wrong. Use the Task tool.
17
+
18
+ You may ONLY:
19
+ ✓ Read files to understand context
20
+ ✓ Use Task tool to spawn agents (oracle, scribe, forger, enforcer, smith, shaper, alchemist)
21
+ ✓ Run test commands to verify gates
22
+ ✓ Report status to user
23
+
24
+ You may NEVER:
25
+ ✗ Write code (use smith or shaper)
26
+ ✗ Write tests (use enforcer)
27
+ ✗ Create task breakdowns (use forger)
28
+ ✗ Write database schemas (use alchemist)
29
+ ✗ Update spec documentation (use scribe)
30
+
31
+ IF YOU ARE ABOUT TO USE Edit/Write TOOL ON A .py/.ts/.js/.md FILE → STOP → SPAWN AN AGENT
32
+ ```
33
+
34
+ ---
35
+
36
+ ## Usage
37
+
38
+ ```
39
+ /iterate-spec @2025-11-29-stripe-integration "add support for annual billing with 20% discount"
40
+ /iterate-spec @2025-11-29-stripe-integration "handle the edge case where user cancels mid-checkout"
41
+ /iterate-spec @2025-11-29-stripe-integration "improve error messages for failed payments"
42
+ ```
43
+
44
+ ## When to Use
45
+
46
+ Use `/iterate-spec` when you're **in the middle of building** and:
47
+ - You discovered a better approach during testing
48
+ - You thought of an improvement or enhancement
49
+ - You found an edge case that should be handled
50
+ - You want to add something that makes the feature better
51
+
52
+ **NOT for bugs** - bugs are implementation issues, not spec changes.
53
+ **NOT for missing requirements** - if the spec was incomplete, use `/update-spec` first.
54
+
55
+ ---
56
+
57
+ ## Prerequisites
58
+
59
+ - Spec must exist in `.catalyst/specs/`
60
+ - Build has been started (tasks.md exists)
61
+ - You're on the feature branch (from `/build-spec`)
62
+
63
+ ---
64
+
65
+ ## KEY DIFFERENCE FROM OTHER COMMANDS
66
+
67
+ ```
68
+ ┌─────────────────────────────────────────────────────────────────┐
69
+ │ /update-spec → Updates docs → STOPS → Manual /build-spec │
70
+ │ │
71
+ │ /iterate-spec → Updates docs → CONTINUES BUILDING │
72
+ │ (Single continuous flow, no context loss) │
73
+ └─────────────────────────────────────────────────────────────────┘
74
+ ```
75
+
76
+ ---
77
+
78
+ ## GIT WORKFLOW
79
+
80
+ ```
81
+ ┌─────────────────────────────────────────────────────────────────┐
82
+ │ GIT CHECKPOINTS │
83
+ │ ─────────────── │
84
+ │ │
85
+ │ PHASE 0: Verify Branch │
86
+ │ └── Confirm on feature branch: {branch_prefix}/{spec-slug} │
87
+ │ │
88
+ │ GATE 1: RED FLAG (for new tests) │
89
+ │ └── Commit: "test({scope}): add tests for {improvement}" │
90
+ │ │
91
+ │ GATE 2: GREEN FLAG │
92
+ │ └── Commit: "feat({scope}): {improvement description}" │
93
+ │ │
94
+ └─────────────────────────────────────────────────────────────────┘
95
+ ```
96
+
97
+ ---
98
+
99
+ ## TDD IS MANDATORY - NO EXCEPTIONS
100
+
101
+ ```
102
+ IMPLEMENTATION WITHOUT TESTS IS FORBIDDEN
103
+
104
+ The iteration MUST follow this exact sequence:
105
+
106
+ 1. Task(subagent_type="scribe") -> Update spec.md
107
+ 2. Task(subagent_type="forger") -> Add new tasks to tasks.md
108
+ 3. Task(subagent_type="enforcer") -> Write tests for NEW tasks (must FAIL)
109
+ 4. Verify -> Run tests, confirm RED for new tests
110
+ 5. Task(subagent_type="smith/shaper/alchemist") -> Implement until GREEN
111
+ ```
112
+
113
+ ---
114
+
115
+ ## ORCHESTRATION MODE
116
+
117
+ Forge-Master spawns specialized agents using the **Task tool**. Each phase is a separate agent.
118
+
119
+ ### Output Location
120
+
121
+ All outputs go to the existing spec folder. See AGENTS.md "Documentation Output Policy".
122
+
123
+ ```
124
+ .catalyst/specs/YYYY-MM-DD-{slug}/
125
+ ├── spec.md # Scribe updates with new requirement
126
+ ├── research.md # Scribe appends if needed
127
+ ├── tasks.md # Forger adds new tasks
128
+ ├── validation.md # (unchanged until /validate-spec)
129
+ └── handoff.md # (regenerated on completion)
130
+ ```
131
+
132
+ ### Execution Order
133
+
134
+ ```
135
+ Phase 1: Clarify (Oracle - if needed)
136
+ |
137
+ Phase 2: Update Spec (Scribe)
138
+ |
139
+ Phase 3: Update Tasks (Forger)
140
+ |
141
+ Phase 4: Write Tests (Enforcer) - NEW tasks only
142
+ |
143
+ GATE 1: RED PHASE - New tests must FAIL
144
+ |
145
+ Phase 5: Implement (Smith/Shaper/Alchemist)
146
+ |
147
+ GATE 2: GREEN PHASE - All tests must PASS
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Workflow
153
+
154
+ ### Phase 0: Verify State
155
+
156
+ **Before any work begins, verify we're in the right state.**
157
+
158
+ ```
159
+ ┌─────────────────────────────────────────────────────────────────┐
160
+ │ 📍 STATE VERIFICATION │
161
+ │ ──────────────────── │
162
+ │ │
163
+ │ 1. Verify on feature branch: │
164
+ │ $ git branch --show-current │
165
+ │ Expected: {branch_prefix}/{spec-slug} │
166
+ │ │
167
+ │ 2. Read existing spec files: │
168
+ │ - spec.md (current requirements) │
169
+ │ - tasks.md (current tasks and progress) │
170
+ │ │
171
+ │ 3. If NOT on feature branch: │
172
+ │ → Ask user if they want to checkout the branch │
173
+ │ → Or if they need to run /build-spec first │
174
+ │ │
175
+ └─────────────────────────────────────────────────────────────────┘
176
+ ```
177
+
178
+ ---
179
+
180
+ ### Phase 1: Clarify Improvement (Oracle - Optional)
181
+
182
+ **If the improvement description is vague, spawn Oracle to clarify.**
183
+
184
+ **Spawn Oracle agent** using `Task` tool with `subagent_type="oracle"`:
185
+
186
+ ```
187
+ "Clarify this improvement for spec {slug}:
188
+ '{improvement description}'
189
+
190
+ Current spec is in spec.md. Ask focused questions to understand:
191
+ - What exactly should change?
192
+ - What's the expected behavior?
193
+ - Are there edge cases to consider?
194
+
195
+ Keep it brief - this is an iteration, not a new spec."
196
+ ```
197
+
198
+ **Skip this phase if the improvement is already clear and specific.**
199
+
200
+ ---
201
+
202
+ ### Phase 2: Update Specification (Scribe)
203
+
204
+ **Spawn Scribe agent** using `Task` tool with `subagent_type="scribe"`:
205
+
206
+ ```
207
+ "Update spec.md for spec {slug} with this improvement:
208
+ '{improvement description}'
209
+
210
+ Tasks:
211
+ 1. Add new requirement(s) to Requirements section
212
+ 2. Update Changelog with date and description
213
+ 3. If technical research needed, append to research.md
214
+ 4. Keep Status as IN_PROGRESS
215
+
216
+ Do NOT change existing completed requirements.
217
+ Mark this as an ITERATION, not a new feature."
218
+ ```
219
+
220
+ **WAIT for Scribe to complete before proceeding to Phase 3.**
221
+
222
+ ---
223
+
224
+ ### Phase 3: Update Tasks (Forger)
225
+
226
+ **Spawn Forger agent** using `Task` tool with `subagent_type="forger"`:
227
+
228
+ ```
229
+ "Update tasks.md for spec {slug} with new tasks for:
230
+ '{improvement description}'
231
+
232
+ Tasks:
233
+ 1. Read current tasks.md and identify completed vs pending tasks
234
+ 2. Add NEW tasks for the improvement (prefix with ITERATION marker)
235
+ 3. Update Build DAG with new task dependencies
236
+ 4. Place new tasks in appropriate phase (foundation/contracts/parallel)
237
+ 5. Do NOT modify completed tasks
238
+
239
+ New tasks should be marked with:
240
+ | ID | Agent | Scope | Depends On | Status |
241
+ | iter-001 | {agent} | {scope} | {deps} | pending |
242
+ "
243
+ ```
244
+
245
+ **WAIT for Forger to complete before proceeding to Phase 4.**
246
+
247
+ ---
248
+
249
+ ### Phase 4: Write Tests for New Tasks (Enforcer) - RED PHASE
250
+
251
+ **CRITICAL: Only write tests for the NEW iteration tasks.**
252
+
253
+ **Spawn Enforcer agent** using `Task` tool with `subagent_type="enforcer"`:
254
+
255
+ ```
256
+ "Write failing tests for NEW iteration tasks in tasks.md.
257
+ Look for tasks with 'iter-' prefix or marked as new.
258
+
259
+ Tests go in project test folders (src/__tests__/, tests/, etc.).
260
+ Update tasks.md Progress section with test file locations.
261
+
262
+ Do NOT modify existing tests.
263
+ New tests MUST fail (we haven't implemented yet)."
264
+ ```
265
+
266
+ **WAIT for Enforcer to complete before proceeding to Gate 1.**
267
+
268
+ ---
269
+
270
+ ### GATE 1: Red Phase Verification (RED FLAG)
271
+
272
+ **STOP! Before implementing:**
273
+
274
+ ```bash
275
+ # Run tests for new iteration tasks
276
+ npm test -- --grep "iter-" # or appropriate filter
277
+
278
+ # Expected: New tests FAIL, existing tests still PASS
279
+ ```
280
+
281
+ **Gate Checklist:**
282
+ - [ ] Every new task has at least one test
283
+ - [ ] All NEW tests FAIL
284
+ - [ ] All EXISTING tests still PASS (no regression)
285
+
286
+ ```
287
+ ┌─────────────────────────────────────────────────────────────────┐
288
+ │ 🚩 RED FLAG COMMIT │
289
+ │ ───────────────── │
290
+ │ │
291
+ │ After Gate 1 passes, commit the new tests: │
292
+ │ │
293
+ │ $ git add . │
294
+ │ $ git commit -m "test({scope}): add tests for {improvement}" │
295
+ │ │
296
+ │ Example: │
297
+ │ git commit -m "test(billing): add tests for annual discount" │
298
+ │ │
299
+ └─────────────────────────────────────────────────────────────────┘
300
+ ```
301
+
302
+ ---
303
+
304
+ ### Phase 5: Implement New Tasks (Smith/Shaper/Alchemist)
305
+
306
+ **Only start this phase AFTER Gate 1 passes!**
307
+
308
+ **Spawn appropriate agents based on task types in tasks.md.**
309
+
310
+ For database tasks, **spawn Alchemist**:
311
+ ```
312
+ "Implement iter-db-* tasks.
313
+ SCOPE (write): {from tasks.md}
314
+ Run tests after to verify progress."
315
+ ```
316
+
317
+ For backend tasks, **spawn Smith**:
318
+ ```
319
+ "Implement iter-api-* tasks.
320
+ SCOPE (write): {from tasks.md}
321
+ READS (no modify): src/types/**
322
+ Run tests after each change."
323
+ ```
324
+
325
+ For frontend tasks, **spawn Shaper**:
326
+ ```
327
+ "Implement iter-ui-* tasks.
328
+ SCOPE (write): {from tasks.md}
329
+ READS (no modify): src/types/**, src/components/shared/**
330
+ Run tests after each change."
331
+ ```
332
+
333
+ **Parallel execution allowed if tasks have non-overlapping scopes.**
334
+
335
+ ---
336
+
337
+ ### GATE 2: Green Phase Verification (GREEN FLAG)
338
+
339
+ **Before completing iteration:**
340
+
341
+ ```bash
342
+ # Run ALL tests - they MUST pass
343
+ npm test
344
+
345
+ # Expected output:
346
+ # Tests: XX passed, 0 failed
347
+ # Status: GREEN
348
+ ```
349
+
350
+ **Gate Checklist:**
351
+ - [ ] All new iteration tests PASS
352
+ - [ ] All existing tests still PASS
353
+ - [ ] No regressions introduced
354
+
355
+ ```
356
+ ┌─────────────────────────────────────────────────────────────────┐
357
+ │ 🟢 GREEN FLAG COMMIT │
358
+ │ ─────────────────── │
359
+ │ │
360
+ │ After Gate 2 passes, commit the implementation: │
361
+ │ │
362
+ │ $ git add . │
363
+ │ $ git commit -m "feat({scope}): {improvement description}" │
364
+ │ │
365
+ │ Example: │
366
+ │ git commit -m "feat(billing): add annual billing with 20% discount"
367
+ │ │
368
+ └─────────────────────────────────────────────────────────────────┘
369
+ ```
370
+
371
+ ---
372
+
373
+ ## Output
374
+
375
+ ```
376
+ Iteration complete!
377
+
378
+ Spec: 2025-11-29-stripe-integration
379
+ Branch: feat/2025-11-29-stripe-integration
380
+ Improvement: "add annual billing with 20% discount"
381
+
382
+ Git Commits:
383
+ ┌────────────────────────────────────────────────────────────────┐
384
+ │ 🚩 abc1234 test(billing): add tests for annual discount │
385
+ │ 🟢 def5678 feat(billing): add annual billing with 20% discount │
386
+ └────────────────────────────────────────────────────────────────┘
387
+
388
+ Changes Made:
389
+ - spec.md: Added REQ-011 (annual billing requirement)
390
+ - tasks.md: Added 3 new tasks (iter-001, iter-002, iter-003)
391
+ - New tests: 8 tests written, all passing
392
+ - Implementation: 4 files modified
393
+
394
+ TDD Compliance: VERIFIED
395
+ - New tests written before implementation
396
+ - All tests passing (existing + new)
397
+
398
+ Updated: .catalyst/specs/2025-11-29-stripe-integration/
399
+ ├── spec.md (new requirement added)
400
+ ├── tasks.md (new tasks added)
401
+ └── research.md (unchanged)
402
+
403
+ Next: Continue testing, or run another /iterate-spec
404
+ When ready: /validate-spec @2025-11-29-stripe-integration
405
+ ```
406
+
407
+ ---
408
+
409
+ ## Failure Modes
410
+
411
+ ### If Not on Feature Branch
412
+
413
+ ```
414
+ PROBLEM: Not on the spec's feature branch
415
+ ACTION: Either checkout the branch:
416
+ $ git checkout feat/{spec-slug}
417
+
418
+ Or if build hasn't started:
419
+ $ /build-spec @{spec-slug}
420
+ ```
421
+
422
+ ### If Spec Not Found
423
+
424
+ ```
425
+ PROBLEM: Spec doesn't exist in .catalyst/specs/
426
+ ACTION: Create the spec first:
427
+ $ /catalyze-spec "your feature description"
428
+ ```
429
+
430
+ ### If Tasks.md Doesn't Exist
431
+
432
+ ```
433
+ PROBLEM: No tasks.md found - build hasn't started
434
+ ACTION: Run /build-spec first to create initial tasks
435
+ $ /build-spec @{spec-slug}
436
+ ```
437
+
438
+ ### If Improvement Conflicts with Existing
439
+
440
+ ```
441
+ PROBLEM: New requirement conflicts with completed work
442
+ ACTION: Spawn Oracle to discuss with user
443
+ Options:
444
+ 1. Modify approach to avoid conflict
445
+ 2. Accept rework of completed tasks
446
+ 3. Create follow-up spec instead
447
+ ```
448
+
449
+ ### If New Tests Pass Immediately
450
+
451
+ ```
452
+ PROBLEM: New tests pass before implementation
453
+ ACTION: Tests are wrong - they're testing existing behavior
454
+ Delete and rewrite tests for the NEW functionality
455
+ ```
456
+
457
+ ---
458
+
459
+ ## Tips
460
+
461
+ Be specific about the improvement:
462
+ - Bad: "make it better"
463
+ - Good: "add 20% discount for annual billing plans"
464
+
465
+ - Bad: "handle errors"
466
+ - Good: "show user-friendly message when payment fails with insufficient funds"
467
+
468
+ - Bad: "improve performance"
469
+ - Good: "cache subscription status to reduce Stripe API calls"
470
+
471
+ ---
472
+
473
+ ## Multiple Iterations
474
+
475
+ You can run `/iterate-spec` multiple times during a build:
476
+
477
+ ```
478
+ /build-spec @my-feature
479
+
480
+ /iterate-spec @my-feature "add X"
481
+
482
+ /iterate-spec @my-feature "improve Y"
483
+
484
+ /iterate-spec @my-feature "handle edge case Z"
485
+
486
+ /validate-spec @my-feature
487
+ ```
488
+
489
+ Each iteration adds to the same spec, maintaining full history in:
490
+ - spec.md changelog
491
+ - tasks.md with iter-* prefixed tasks
492
+ - Git commits showing progression
@@ -0,0 +1,158 @@
1
+ # /primer-spec
2
+
3
+ Quickly load spec context into a fresh conversation.
4
+
5
+ ---
6
+
7
+ ## Purpose
8
+
9
+ When you start a new conversation (context was full), use this command to:
10
+ - Restore awareness of the spec's current state
11
+ - Understand what's done and what's pending
12
+ - Know which branch you're on
13
+ - Continue work without re-explaining everything
14
+
15
+ **This is NOT an orchestration command.** Read files directly and output a summary.
16
+
17
+ ---
18
+
19
+ ## Usage
20
+
21
+ ```
22
+ /primer-spec @2025-11-29-stripe-integration
23
+ ```
24
+
25
+ ---
26
+
27
+ ## What To Do
28
+
29
+ ### Step 1: Read Spec Files
30
+
31
+ Read these files from `.catalyst/specs/{slug}/`:
32
+
33
+ ```
34
+ 1. spec.md → What is this feature? Requirements?
35
+ 2. tasks.md → What's done? What's pending? What's in progress?
36
+ 3. research.md → (if exists) Any key technical decisions?
37
+ ```
38
+
39
+ ### Step 2: Check Git State
40
+
41
+ ```bash
42
+ git branch --show-current # What branch are we on?
43
+ git status --short # Any uncommitted changes?
44
+ git log --oneline -3 # Recent commits?
45
+ ```
46
+
47
+ ### Step 3: Output Brief Summary
48
+
49
+ Output a **concise** summary (aim for ~20-30 lines max):
50
+
51
+ ```
52
+ ## Spec Primer: {Feature Name}
53
+
54
+ **Branch:** feat/{slug}
55
+ **Status:** {phase - e.g., "Building", "Testing", "Validating"}
56
+
57
+ ### What It Does
58
+ {1-2 sentences from spec.md overview}
59
+
60
+ ### Progress
61
+ | Done | In Progress | Pending |
62
+ |------|-------------|---------|
63
+ | 3 | 1 | 2 |
64
+
65
+ **Completed:**
66
+ - ✓ {task-1}
67
+ - ✓ {task-2}
68
+
69
+ **In Progress:**
70
+ - → {task-3}
71
+
72
+ **Pending:**
73
+ - ○ {task-4}
74
+ - ○ {task-5}
75
+
76
+ ### Current Focus
77
+ {What was being worked on based on tasks.md status}
78
+
79
+ ### Git State
80
+ - Branch: feat/{slug}
81
+ - Last commit: {commit message}
82
+ - Uncommitted changes: {yes/no}
83
+
84
+ ---
85
+ Ready to continue. What would you like to work on?
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Rules
91
+
92
+ 1. **Be brief** - This is a primer, not a full report
93
+ 2. **Read directly** - Do NOT spawn agents, just read files
94
+ 3. **Focus on actionable state** - What's done, what's next
95
+ 4. **Preserve context** - Keep output short to leave room for actual work
96
+
97
+ ---
98
+
99
+ ## Example Output
100
+
101
+ ```
102
+ ## Spec Primer: Stripe Integration
103
+
104
+ **Branch:** feat/2025-11-29-stripe-integration
105
+ **Status:** Building (Phase 5 - Parallel Implementation)
106
+
107
+ ### What It Does
108
+ Integrate Stripe for subscription billing with monthly/annual plans and usage-based pricing.
109
+
110
+ ### Progress
111
+ | Done | In Progress | Pending |
112
+ |------|-------------|---------|
113
+ | 4 | 2 | 1 |
114
+
115
+ **Completed:**
116
+ - ✓ db-schema: Subscription tables
117
+ - ✓ api-types: Shared TypeScript types
118
+ - ✓ api-auth: Authentication endpoints
119
+ - ✓ iter-001: Annual billing discount
120
+
121
+ **In Progress:**
122
+ - → api-billing: Billing service (tests passing)
123
+ - → ui-pricing: Pricing page components
124
+
125
+ **Pending:**
126
+ - ○ integration: E2E tests
127
+
128
+ ### Current Focus
129
+ Working on api-billing and ui-pricing in parallel.
130
+ Annual billing iteration (iter-001) was added and completed.
131
+
132
+ ### Git State
133
+ - Branch: feat/2025-11-29-stripe-integration
134
+ - Last commit: feat(billing): add annual billing with 20% discount
135
+ - Uncommitted changes: no
136
+
137
+ ---
138
+ Ready to continue. What would you like to work on?
139
+ ```
140
+
141
+ ---
142
+
143
+ ## When to Use
144
+
145
+ | Situation | Command |
146
+ |-----------|---------|
147
+ | Context full, need to continue building | `/primer-spec` |
148
+ | Want to add improvement mid-build | `/iterate-spec` |
149
+ | Need full validation | `/validate-spec` |
150
+ | Check status without loading context | `/status-spec` |
151
+
152
+ ---
153
+
154
+ ## Tips
155
+
156
+ - Run this FIRST in a new conversation before doing any work
157
+ - After primer, you can run `/iterate-spec` or continue with `/build-spec`
158
+ - If tasks.md doesn't exist, the spec hasn't been built yet - run `/build-spec`
@@ -245,11 +245,9 @@ TDD Compliance: FAILED
245
245
  Action: Run /build-spec @2025-11-29-stripe-integration
246
246
  Follow TDD process (tests BEFORE code)
247
247
  Then re-run /validate-spec
248
- ```
249
-
250
- ### Validation Failure
248
+ ```### Validation Failure
251
249
  ```
252
250
  Validation failed!Spec: 2025-11-29-stripe-integrationFailed Checks:
253
251
  - E2E Tests: 2 failures
254
252
  - Security: 1 vulnerability foundCreated: .catalyst/specs/{slug}/validation.md (with details)Action: Fix issues and re-run /validate-spec
255
- ```
253
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catalyst-os",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "scripts": {
5
5
  "postinstall": "node .catalyst/bin/install.js"
6
6
  },