Factory
Top-level orchestrator for the software factory. Manages the full lifecycle: launch products, build them, evolve for revenue, track progress.
Instructions
CRITICAL — NON-INTERACTIVE for build/evolve: When running build or evolve, execute without pausing. For launch, follow the /launch-app interactive flow. For status and list, display and stop.
Step 0: Parse Command
Read the $ARGS to determine the command:
launch <idea> → Step 1
build [project] → Step 2
evolve [project] → Step 3
status [project] → Step 4
list → Step 5
- No argument → Step 5 (show list)
Step 1: Launch (/factory launch <idea>)
Invoke /launch-app with the idea argument — this creates the project folder, configures the team, generates CLAUDE.md and all stage plans.
After /launch-app completes, register the project. Read the new project's CLAUDE.md to extract name, stack, and team.
Read or create factory/registry.json in the current directory (claude-code-utils root):
mkdir -p factory
Add the project entry:
{
"name": "[project-name]",
"path": "../[project-name]",
"stack": "[stack]",
"team": "[team-preset]",
"status": "planned",
"created_at": "[ISO timestamp]",
"current_cycle": 0,
"latest_score": null,
"baseline_score": null,
"deploy_target": "vercel"
}
Display summary:
Project registered in factory.
Next: Run /factory build [project-name] to start building.
Step 2: Build (/factory build [project])
Resolve project path:
- If
[project] provided, look it up in factory/registry.json
- If not provided, use the current directory
Update registry status to "building"
Change to the project directory and invoke /build-app
After build completes, update registry status to "built"
Step 3: Evolve (/factory evolve [project])
Resolve project path (same as Step 2)
Change to the project directory
Read factory/evolution-state.json (create if missing — /evaluate-product will initialize it)
Based on current status, invoke the next skill in the evolution loop:
| Status |
Action |
"" / "idle" / "approved" |
Invoke /evaluate-product |
"evaluating" |
Invoke /evaluate-product (resume) |
"hypothesizing" |
Invoke /generate-hypotheses |
"planning" |
Invoke /plan-optimization |
"building" |
Invoke /build-app |
"preview_deployed" / "awaiting_approval" |
Display preview info and instructions (see below) |
"rejected" |
Invoke /generate-hypotheses |
If status is preview_deployed or awaiting_approval, display:
================================================================
Preview Deployed — Awaiting Human Approval
================================================================
Cycle: [N]
Branch: [preview branch name]
Preview: [expected preview URL]
Hypotheses in this cycle:
- [hypothesis title 1]
- [hypothesis title 2]
Actions:
/evolution-gate approve — merge to production
/evolution-gate reject — discard and try next
================================================================
Update registry with current cycle and latest score
Step 4: Status (/factory status [project])
Factory-wide status (no project specified):
- Read
factory/registry.json
- For each project, read its
factory/evolution-state.json if it exists
- Display:
================================================================
Software Factory Status
================================================================
Registered Projects: N
Currently Evolving: M
Project Status Cycle Score Baseline Delta
─────────────────────────────────────────────────────────
expense-tracker evolving 3 78 62 +16
blog-platform built 0 — — —
Next Action: [most important pending action]
================================================================
Per-project status (project specified):
- Resolve project path
- Read
factory/evolution-state.json
- Read all evaluations from
factory/evaluations/
- Display detailed evolution history:
================================================================
Evolution Status: [project-name]
================================================================
Status: [current status]
Cycle: [N]
Score History:
Cycle 0 (baseline): 62/100
Cycle 1 (social proof): 71/100 (+9) approved
Cycle 2 (form reduction): 78/100 (+7) approved
Cycle 3 (hero rewrite): pending
Current Hypothesis:
[hypothesis title]
Expected: +[X] composite score
Rejected Hypotheses:
- [title] — [reason]
Next Action:
[what needs to happen next]
================================================================
Step 5: List (/factory list)
- Read
factory/registry.json
- Display project list:
Registered Projects:
1. expense-tracker (nextjs-app, saas-product) — evolving, cycle 3, score 78
2. blog-platform (nextjs-app, marketing) — built, not yet evolving
3. api-service (express, enterprise) — building, stage 4 of 7
Registry Schema
File: factory/registry.json (in claude-code-utils root)
{
"version": 1,
"projects": [
{
"name": "expense-tracker",
"path": "../expense-tracker",
"stack": "nextjs-app",
"team": "saas-product",
"status": "planned | building | built | evolving | idle",
"created_at": "ISO timestamp",
"current_cycle": 0,
"latest_score": null,
"baseline_score": null,
"deploy_target": "vercel"
}
]
}
Error Recovery
| Scenario |
Recovery |
| Registry doesn't exist |
Create it with empty projects array |
| Project not in registry |
Search for project directory by name in parent directories |
| Project directory missing |
Report error, suggest re-running /factory launch |
| Evolution state missing |
/evaluate-product will create it on first run |
1---2name: factory3description: Use when managing the software factory lifecycle — launching new products, building them, evolving them for revenue, or checking factory-wide status.4---56# Factory78Top-level orchestrator for the software factory. Manages the full lifecycle: launch products, build them, evolve for revenue, track progress.910## Instructions1112> **CRITICAL — NON-INTERACTIVE for build/evolve**: When running `build` or `evolve`, execute without pausing. For `launch`, follow the `/launch-app` interactive flow. For `status` and `list`, display and stop.1314---1516### Step 0: Parse Command1718Read the `$ARGS` to determine the command:1920- **`launch <idea>`** → Step 121- **`build [project]`** → Step 222- **`evolve [project]`** → Step 323- **`status [project]`** → Step 424- **`list`** → Step 525- **No argument** → Step 5 (show list)2627---2829### Step 1: Launch (`/factory launch <idea>`)30311. Invoke `/launch-app` with the idea argument — this creates the project folder, configures the team, generates CLAUDE.md and all stage plans.32332. After `/launch-app` completes, register the project. Read the new project's `CLAUDE.md` to extract name, stack, and team.34353. Read or create `factory/registry.json` in the current directory (claude-code-utils root):36 ```bash37 mkdir -p factory38 ```39404. Add the project entry:41 ```json42 {43 "name": "[project-name]",44 "path": "../[project-name]",45 "stack": "[stack]",46 "team": "[team-preset]",47 "status": "planned",48 "created_at": "[ISO timestamp]",49 "current_cycle": 0,50 "latest_score": null,51 "baseline_score": null,52 "deploy_target": "vercel"53 }54 ```55565. Display summary:57 ```58 Project registered in factory.59 Next: Run /factory build [project-name] to start building.60 ```6162---6364### Step 2: Build (`/factory build [project]`)65661. Resolve project path:67 - If `[project]` provided, look it up in `factory/registry.json`68 - If not provided, use the current directory69702. Update registry status to `"building"`71723. Change to the project directory and invoke `/build-app`73744. After build completes, update registry status to `"built"`7576---7778### Step 3: Evolve (`/factory evolve [project]`)79801. Resolve project path (same as Step 2)81822. Change to the project directory83843. Read `factory/evolution-state.json` (create if missing — `/evaluate-product` will initialize it)85864. Based on current status, invoke the next skill in the evolution loop:8788 | Status | Action |89 |--------|--------|90 | `""` / `"idle"` / `"approved"` | Invoke `/evaluate-product` |91 | `"evaluating"` | Invoke `/evaluate-product` (resume) |92 | `"hypothesizing"` | Invoke `/generate-hypotheses` |93 | `"planning"` | Invoke `/plan-optimization` |94 | `"building"` | Invoke `/build-app` |95 | `"preview_deployed"` / `"awaiting_approval"` | Display preview info and instructions (see below) |96 | `"rejected"` | Invoke `/generate-hypotheses` |97985. If status is `preview_deployed` or `awaiting_approval`, display:99 ```100 ================================================================101 Preview Deployed — Awaiting Human Approval102 ================================================================103104 Cycle: [N]105 Branch: [preview branch name]106 Preview: [expected preview URL]107108 Hypotheses in this cycle:109 - [hypothesis title 1]110 - [hypothesis title 2]111112 Actions:113 /evolution-gate approve — merge to production114 /evolution-gate reject — discard and try next115 ================================================================116 ```1171186. Update registry with current cycle and latest score119120---121122### Step 4: Status (`/factory status [project]`)123124#### Factory-wide status (no project specified):1251261. Read `factory/registry.json`1272. For each project, read its `factory/evolution-state.json` if it exists1283. Display:129130```131================================================================132 Software Factory Status133================================================================134135 Registered Projects: N136 Currently Evolving: M137138 Project Status Cycle Score Baseline Delta139 ─────────────────────────────────────────────────────────140 expense-tracker evolving 3 78 62 +16141 blog-platform built 0 — — —142143 Next Action: [most important pending action]144================================================================145```146147#### Per-project status (project specified):1481491. Resolve project path1502. Read `factory/evolution-state.json`1513. Read all evaluations from `factory/evaluations/`1524. Display detailed evolution history:153154```155================================================================156 Evolution Status: [project-name]157================================================================158159 Status: [current status]160 Cycle: [N]161162 Score History:163 Cycle 0 (baseline): 62/100164 Cycle 1 (social proof): 71/100 (+9) approved165 Cycle 2 (form reduction): 78/100 (+7) approved166 Cycle 3 (hero rewrite): pending167168 Current Hypothesis:169 [hypothesis title]170 Expected: +[X] composite score171172 Rejected Hypotheses:173 - [title] — [reason]174175 Next Action:176 [what needs to happen next]177================================================================178```179180---181182### Step 5: List (`/factory list`)1831841. Read `factory/registry.json`1852. Display project list:186187```188Registered Projects:189190 1. expense-tracker (nextjs-app, saas-product) — evolving, cycle 3, score 78191 2. blog-platform (nextjs-app, marketing) — built, not yet evolving192 3. api-service (express, enterprise) — building, stage 4 of 7193```194195---196197## Registry Schema198199File: `factory/registry.json` (in claude-code-utils root)200201```json202{203 "version": 1,204 "projects": [205 {206 "name": "expense-tracker",207 "path": "../expense-tracker",208 "stack": "nextjs-app",209 "team": "saas-product",210 "status": "planned | building | built | evolving | idle",211 "created_at": "ISO timestamp",212 "current_cycle": 0,213 "latest_score": null,214 "baseline_score": null,215 "deploy_target": "vercel"216 }217 ]218}219```220221---222223## Error Recovery224225| Scenario | Recovery |226|----------|----------|227| Registry doesn't exist | Create it with empty projects array |228| Project not in registry | Search for project directory by name in parent directories |229| Project directory missing | Report error, suggest re-running /factory launch |230| Evolution state missing | /evaluate-product will create it on first run |