forge-orkes 0.1.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.
Files changed (38) hide show
  1. package/bin/create-forge.js +103 -0
  2. package/package.json +28 -0
  3. package/template/.claude/agents/executor.md +177 -0
  4. package/template/.claude/agents/planner.md +148 -0
  5. package/template/.claude/agents/researcher.md +111 -0
  6. package/template/.claude/agents/reviewer.md +211 -0
  7. package/template/.claude/agents/verifier.md +210 -0
  8. package/template/.claude/settings.json +40 -0
  9. package/template/.claude/skills/architecting/SKILL.md +121 -0
  10. package/template/.claude/skills/auditing/SKILL.md +302 -0
  11. package/template/.claude/skills/beads-integration/SKILL.md +125 -0
  12. package/template/.claude/skills/debugging/SKILL.md +130 -0
  13. package/template/.claude/skills/designing/SKILL.md +134 -0
  14. package/template/.claude/skills/discussing/SKILL.md +229 -0
  15. package/template/.claude/skills/executing/SKILL.md +154 -0
  16. package/template/.claude/skills/forge/SKILL.md +524 -0
  17. package/template/.claude/skills/planning/SKILL.md +225 -0
  18. package/template/.claude/skills/quick-tasking/SKILL.md +74 -0
  19. package/template/.claude/skills/refactoring/SKILL.md +168 -0
  20. package/template/.claude/skills/researching/SKILL.md +117 -0
  21. package/template/.claude/skills/securing/SKILL.md +104 -0
  22. package/template/.claude/skills/verifying/SKILL.md +201 -0
  23. package/template/.forge/templates/constitution.md +123 -0
  24. package/template/.forge/templates/context.md +53 -0
  25. package/template/.forge/templates/design-systems/material-ui.md +44 -0
  26. package/template/.forge/templates/design-systems/primereact.md +46 -0
  27. package/template/.forge/templates/design-systems/shadcn-ui.md +47 -0
  28. package/template/.forge/templates/framework-absorption/generic.md +52 -0
  29. package/template/.forge/templates/framework-absorption/gsd.md +174 -0
  30. package/template/.forge/templates/framework-absorption/spec-kit.md +52 -0
  31. package/template/.forge/templates/plan.md +84 -0
  32. package/template/.forge/templates/project.yml +40 -0
  33. package/template/.forge/templates/refactor-backlog.yml +16 -0
  34. package/template/.forge/templates/requirements.yml +49 -0
  35. package/template/.forge/templates/roadmap.yml +44 -0
  36. package/template/.forge/templates/state/index.yml +51 -0
  37. package/template/.forge/templates/state/milestone.yml +42 -0
  38. package/template/CLAUDE.md +150 -0
@@ -0,0 +1,524 @@
1
+ ---
2
+ name: forge
3
+ description: "START HERE for any task. Forge orchestrates Quick fixes, Standard features, and Full complex builds. Use this skill when starting new work, resuming a project, or unsure which workflow to follow. This is the entry point to the Forge framework."
4
+ ---
5
+
6
+ # Forging: Workflow Orchestration
7
+
8
+ You are the entry point. Detect the right tier, route to the right skills, manage state transitions. For new projects, run the interactive init before any work begins.
9
+
10
+ ## Step 1: Read State
11
+
12
+ ### Milestone Selection
13
+
14
+ Check for state files in this order:
15
+ 1. If `.forge/state/index.yml` exists → **new milestone-aware format**
16
+ 2. If `.forge/state.yml` exists (legacy) → suggest migration: *"I found a legacy state.yml. Would you like me to migrate it to the new milestone-aware format?"* If yes, create `.forge/state/` directory, split into `index.yml` + `milestone-1.yml`, delete old file.
17
+ 3. If neither exists → no state yet, proceed to init or tier detection.
18
+
19
+ **When milestone-aware state exists (`state/index.yml`):**
20
+ 1. Read `.forge/state/index.yml` to get the list of active milestones
21
+ 2. **If multiple active milestones:**
22
+ - Present all milestones with their progress and `last_updated` timestamp
23
+ - Default to the most recently updated milestone
24
+ - Ask user to confirm or switch: *"You have {N} active milestones. Most recent: [{name}] ({progress}%, last touched {date}). Work on this one, or switch?"*
25
+ 3. **If one milestone:** Auto-select it. Inform user: *"Resuming milestone: [{name}] ({progress}%)"*
26
+ 4. **If no active milestones:** Proceed to init or ask user to create one.
27
+ 5. Load the selected milestone's state file (`.forge/state/milestone-{id}.yml`)
28
+ 6. Report position from the milestone-specific state:
29
+ - Current phase, plan, task
30
+ - Progress percentage
31
+ - Active blockers
32
+ - Recent decisions
33
+
34
+ If Beads is installed and enabled (`settings.json → forge.beads_integration: true`), also run `bd prime` for cross-session context. See `beads-integration` skill for details. This is optional — Forge works fully without it.
35
+
36
+ Also read `.forge/context.md` if it exists. If the **Needs Resolution** section has unchecked items:
37
+ - **Warn the user immediately**: *"There are {N} unresolved discrepancies from project init that need your input before planning can proceed: [list items briefly]."*
38
+ - Quick tier tasks can proceed despite unresolved items (they don't go through planning)
39
+ - Standard/Full tier tasks will be blocked at the planning gate until resolved
40
+
41
+ Check `.forge/refactor-backlog.yml` for pending items. If found:
42
+ - Count pending items by effort level
43
+ - **Surface them early**: *"You have {N} pending refactoring items ({Q} quick, {S} standard). Want to tackle any before starting new work?"*
44
+ - If the user picks one → route to `quick-tasking` (for quick items) or Standard tier (for standard items). Update the item's `status` to `in_progress`.
45
+ - If the user says not now → proceed with normal workflow.
46
+
47
+ Check `.forge/state/index.yml → desire_paths` for any patterns with 3+ occurrences that haven't been acted on:
48
+ - **Surface them early**: *"I've noticed a recurring pattern: [{description}] ({N} times). Before we start, would you like to address this by [suggested framework change]?"*
49
+ - If the user agrees → apply the change (update skill, constitution, or template), reset the counter
50
+ - If the user says not now → note it and move on. Don't nag every session.
51
+
52
+ If no `.forge/project.yml` exists AND the task is Standard or Full tier → go to **Step 2A: Project Init** before anything else.
53
+
54
+ If state exists → go to **Step 2B: Detect Tier**.
55
+
56
+ ## Step 2A: Project Init
57
+
58
+ This interactive workflow runs once when Forge doesn't find an existing project. First, detect whether this is a **brownfield** (existing codebase) or **greenfield** (new project) — then run the appropriate init path.
59
+
60
+ ### Detect Project Type
61
+
62
+ Check for signals of an existing codebase:
63
+
64
+ ```
65
+ Check: package.json OR requirements.txt OR go.mod OR Cargo.toml (dependency manifest)
66
+ Check: .git/ (version control history)
67
+ Check: src/ OR app/ OR lib/ (source directories)
68
+ Check: existing config files (tsconfig.json, .eslintrc, vite.config, etc.)
69
+ ```
70
+
71
+ - **2+ signals found** → **Brownfield path** (existing codebase)
72
+ - **0-1 signals** → **Greenfield path** (new project)
73
+
74
+ Ask user to confirm: *"This looks like an [existing project / new project]. Is that right?"*
75
+
76
+ ---
77
+
78
+ ### Brownfield Path: Discover Existing Project
79
+
80
+ For existing codebases, **scan first, confirm with user second.** Don't ask the user to describe what you can discover.
81
+
82
+ #### Discovery Step 0: Framework Detection
83
+
84
+ Before scanning the tech stack, check for two things: (1) existing meta-prompting frameworks with project knowledge to absorb, and (2) companion tools that should be preserved alongside Forge.
85
+
86
+ **Meta-Framework Signatures** (contain project knowledge — candidates for absorption):
87
+
88
+ ```
89
+ # GSD (Get Shit Done)
90
+ Check: agents/gsd-*.md OR commands/gsd/ directory
91
+ Check: Root-level PROJECT.md + REQUIREMENTS.md + ROADMAP.md + STATE.md
92
+ Check: get-shit-done/ directory
93
+ Check: CONTEXT.md with "NON-NEGOTIABLE" or "DEFERRED" sections
94
+
95
+ # Spec-Kit
96
+ Check: spec-driven.md
97
+ Check: templates/ with spec-template.md
98
+ Check: extensions/catalog.json
99
+ Check: constitution-template.md
100
+
101
+ # BMAD
102
+ Check: agents/ with 20+ agent files
103
+ Check: workflows/ directory
104
+ Check: bmad-* prefixed files
105
+
106
+ # Generic / Unknown
107
+ Check: .claude/agents/ or .claude/skills/ (someone else's custom framework)
108
+ Check: CLAUDE.md with framework-like routing tables
109
+ Check: Any structured agent/workflow system
110
+ ```
111
+
112
+ **Companion Tool Signatures** (not frameworks — independent tools that work alongside Forge):
113
+
114
+ ```
115
+ # Beads (persistent cross-session memory)
116
+ Check: .beads/ directory
117
+ Check: beads.jsonl or beads.db
118
+ Check: bd CLI available (Bash: which bd)
119
+ → If found: Enable forge.beads_integration in settings.json. Do NOT absorb or archive.
120
+ → Beads is independent — it runs alongside Forge, not inside it.
121
+ ```
122
+
123
+ **If a meta-framework is detected**, present the finding and offer three options:
124
+
125
+ *"I found an existing [{framework name}] setup in this project. It contains project documentation and decisions that are valuable. How would you like to handle it?"*
126
+
127
+ **Option A: Absorb & Convert** (recommended)
128
+ Read all existing framework documentation, extract the project knowledge, and convert it into Forge's format. This means:
129
+ - Project descriptions → `.forge/project.yml`
130
+ - Requirements → `.forge/requirements.yml`
131
+ - Roadmaps/plans → `.forge/roadmap.yml`
132
+ - Context/decisions → `.forge/context.md`
133
+ - Current state/progress → `.forge/state/index.yml` + `.forge/state/milestone-{id}.yml`
134
+ - Constitutional rules (if any) → `.forge/constitution.md`
135
+ - Design system rules (if any) → `.forge/design-system.md`
136
+
137
+ → Go to **Framework Absorption** below.
138
+
139
+ **Option B: Archive & Start Fresh**
140
+ Move existing framework files into `.forge/archive/{framework-name}/` for reference, then run the standard brownfield discovery (which will still scan the codebase itself). The archive is preserved and can be consulted later.
141
+
142
+ **Option C: Keep Both (Transition Period)**
143
+ Initialize Forge alongside the existing framework. Forge reads from `.forge/` while old framework files remain in place. Useful when you want to try Forge without committing. Remove the old framework later when confident.
144
+
145
+ ---
146
+
147
+ #### Framework Absorption (Option A)
148
+
149
+ When absorbing an existing framework, read its documentation and convert systematically.
150
+
151
+ **GSD Absorption Map:**
152
+
153
+ | GSD Source | Read | Extract | Write to Forge |
154
+ |-----------|------|---------|---------------|
155
+ | `PROJECT.md` | Project name, description, tech stack, goals | Structured project info | `.forge/project.yml` |
156
+ | `REQUIREMENTS.md` | Feature requirements, acceptance criteria | Convert prose to YAML with IDs | `.forge/requirements.yml` |
157
+ | `ROADMAP.md` | Phases, milestones, dependencies | Convert to YAML with dependency refs | `.forge/roadmap.yml` |
158
+ | `STATE.md` | Current phase, progress, blockers | Machine-readable state | `.forge/state/index.yml` + `.forge/state/milestone-{id}.yml` |
159
+ | `CONTEXT.md` | NON-NEGOTIABLE decisions, DEFERRED ideas | Locked decisions, deferred items | `.forge/context.md` |
160
+ | `references/ui-brand.md` | Design system rules, brand guidelines | Component mappings, style rules | `.forge/design-system.md` |
161
+ | `references/verification-patterns.md` | Verification approach | Inform `verifying` skill config | Constitution articles |
162
+ | `references/tdd.md` | Testing approach | Inform constitution Article II | Constitution articles |
163
+ | Agent customizations | Custom agent behaviors, tool restrictions | Map to Forge agent definitions | `.claude/agents/*.md` (if custom) |
164
+
165
+ **Spec-Kit Absorption Map:**
166
+
167
+ | Spec-Kit Source | Read | Extract | Write to Forge |
168
+ |----------------|------|---------|---------------|
169
+ | `spec-driven.md` | Core methodology | Governance patterns | `.forge/constitution.md` |
170
+ | `templates/spec-template.md` | Spec structure | Requirements format | `.forge/requirements.yml` |
171
+ | `templates/constitution-template.md` | Constitutional articles | Immutable gates | `.forge/constitution.md` |
172
+ | `extensions/` | Extension configs | Specialized skills | `.claude/skills/` (if relevant) |
173
+ | Project specs (if filled in) | Project-specific decisions | Locked decisions | `.forge/context.md` |
174
+
175
+ **Generic Framework Absorption:**
176
+
177
+ For unknown frameworks, use the `researching` skill to:
178
+ 1. Read all markdown and config files in the framework directory
179
+ 2. Identify: project descriptions, requirements, decisions, state, design rules
180
+ 3. Map each to the closest Forge equivalent
181
+ 4. Present the mapping to the user for confirmation before writing
182
+
183
+ **Absorption Process:**
184
+
185
+ 1. Read all source files from the existing framework
186
+ 2. For each Forge target file, synthesize content from the relevant sources
187
+ 3. Convert prose to YAML where Forge expects YAML (project, requirements, roadmap, state)
188
+ 4. Preserve markdown where Forge expects markdown (constitution, context, design-system)
189
+ 5. **Never discard information** — if something doesn't map to a Forge file, note it in `.forge/context.md` under a "Carried Forward" section
190
+ 6. Move original framework files to `.forge/archive/{framework-name}/`
191
+ 7. Present a diff-style summary: *"Here's what I converted: [list]. And here's what I archived for reference: [list]. Anything I should handle differently?"*
192
+
193
+ After absorption, **always** continue with the standard brownfield steps below (tech stack scan, design system detection, etc.). This is critical — see the verification step next.
194
+
195
+ #### Documentation vs. Codebase Verification
196
+
197
+ **Never trust framework documentation at face value.** Documentation drifts. The codebase is the source of truth.
198
+
199
+ After reading existing framework docs, **cross-reference every claim against the actual code**:
200
+
201
+ ```
202
+ For each claim in the documentation:
203
+ 1. Find the corresponding code (Glob, Grep, Read)
204
+ 2. Verify the claim matches reality
205
+ 3. Flag any discrepancies
206
+ ```
207
+
208
+ **Common drift patterns to check:**
209
+
210
+ | Documentation Says | Verify Against |
211
+ |-------------------|----------------|
212
+ | "Tech stack: React + PostgreSQL" | `package.json` dependencies, actual imports in `src/` |
213
+ | "Uses PrimeReact for all UI" | `Grep: src/ for "from 'primereact"` — are there also raw HTML tables, custom modals? |
214
+ | "Tests written for all features" | `Glob: src/**/*.test.*` — actual coverage vs. claimed coverage |
215
+ | "Auth uses Clerk/Auth0/etc." | `Grep: src/ for auth imports` — is there also custom auth code? |
216
+ | "State management via Redux" | `package.json` + actual imports — did they switch to Zustand mid-project? |
217
+ | "API uses REST" | `Grep: src/ for GraphQL, tRPC, WebSocket` — mixed protocols? |
218
+ | Requirements list features A, B, C | Do routes/components for A, B, C actually exist? Are any partially implemented? |
219
+ | Roadmap says "Phase 2 complete" | Are Phase 2 features actually wired and working, or are there stubs? |
220
+
221
+ **When discrepancies are found:**
222
+
223
+ Present them to the user clearly:
224
+
225
+ *"I found some differences between the GSD documentation and the actual codebase:*
226
+
227
+ - *PROJECT.md says 'PostgreSQL' but I only see SQLite in dependencies*
228
+ - *REQUIREMENTS.md lists a 'notifications' feature but I can't find any notification code*
229
+ - *STATE.md says Phase 2 is complete, but the dashboard component looks like a stub (returns placeholder text)*
230
+ - *The docs mention PrimeReact exclusively, but I found 3 files using raw HTML tables instead of DataTable*
231
+
232
+ *Should I update the Forge config to match what's actually in the code, or are some of these features that were removed/deferred?"*
233
+
234
+ **Priority order for truth:**
235
+ 1. **What the code actually does** — highest authority
236
+ 2. **What the user confirms** — resolves ambiguity
237
+ 3. **What the documentation says** — useful context, but may be stale
238
+
239
+ Write the verified state to Forge files. For any unresolved discrepancies, add them to `.forge/context.md` under a "Needs Resolution" section so they get addressed during planning.
240
+
241
+ ---
242
+
243
+ #### Discovery Step 1: Tech Stack Scan
244
+
245
+ ```bash
246
+ # Package manifest
247
+ Read: package.json → name, dependencies, devDependencies, scripts
248
+ # Or: requirements.txt, go.mod, Cargo.toml, etc.
249
+
250
+ # Config files
251
+ Glob: tsconfig.json, .eslintrc*, vite.config.*, next.config.*, webpack.config.*
252
+ Glob: .env.example, docker-compose.yml
253
+
254
+ # Source structure
255
+ Bash: find src/ -type f | head -50 # understand file organization
256
+ Bash: wc -l src/**/*.{ts,tsx,js,jsx} 2>/dev/null | tail -1 # codebase size
257
+ ```
258
+
259
+ From this, auto-detect:
260
+ - Language and framework
261
+ - Build tools and test framework
262
+ - Database (from dependencies or config)
263
+ - Project name and description (from package.json or README)
264
+
265
+ #### Discovery Step 2: Design System Detection
266
+
267
+ ```bash
268
+ # Check dependencies for known UI libraries
269
+ Grep: package.json for: primereact, @mui/, @chakra-ui/, @radix-ui/, antd, @headlessui/
270
+ Grep: package.json for: tailwindcss, primeflex, @emotion/, styled-components
271
+
272
+ # Check actual usage in source
273
+ Grep: src/ for import patterns: "from 'primereact", "from '@mui/", "from '@/components/ui"
274
+ Grep: src/ for icon usage: "pi pi-", "Material", "lucide-react"
275
+
276
+ # Check for theme files
277
+ Glob: **/*theme*, **/*variables.scss, **/tailwind.config*, **/globals.css
278
+ ```
279
+
280
+ From this, auto-detect:
281
+ - Component library (and version from package.json)
282
+ - Icon set in use
283
+ - Layout system (PrimeFlex, Tailwind, MUI Grid, etc.)
284
+ - Theme approach (SCSS variables, CSS-in-JS, Tailwind config, design tokens)
285
+
286
+ #### Discovery Step 3: Pattern Analysis
287
+
288
+ ```bash
289
+ # Existing conventions
290
+ Glob: src/**/*.test.* OR src/**/*.spec.* # test patterns
291
+ Grep: src/ for error handling patterns
292
+ Grep: src/ for auth/session patterns
293
+ Bash: git log --oneline -20 # commit style
294
+
295
+ # Architecture patterns
296
+ Bash: ls -la src/ # top-level structure (pages, components, services, etc.)
297
+ Glob: src/**/index.{ts,tsx,js} # barrel exports
298
+ Grep: src/ for "import.*from.*@/" # path aliases
299
+ ```
300
+
301
+ #### Discovery Step 4: Present Findings
302
+
303
+ Present a structured summary to the user:
304
+
305
+ *"I've scanned your codebase. Here's what I found:*
306
+
307
+ *Project: {name} — {description from README or package.json}*
308
+ *Stack: {language} + {framework} + {database}*
309
+ *UI: {component library} with {icon set}, layout via {layout system}*
310
+ *Testing: {test framework}, {X} existing test files*
311
+ *Size: ~{N} source files, ~{N}K lines*
312
+ *Patterns: {commit style}, {folder structure approach}, {key conventions}*
313
+
314
+ *Does this look right? Anything I missed or got wrong?"*
315
+
316
+ #### Discovery Step 5: Design System Mapping
317
+
318
+ If a component library was detected:
319
+ 1. Check `.forge/templates/design-systems/` for an existing example config
320
+ 2. If found (e.g., PrimeReact) → copy it as starting point for `.forge/design-system.md`
321
+ 3. If not found → use `researching` skill to build a component mapping from docs
322
+ 4. **Cross-reference with actual usage**: scan the codebase for which components are already in use and prioritize those in the mapping
323
+ 5. Present mapping to user for validation
324
+
325
+ If no component library detected but UI files exist:
326
+ - Ask: *"I see UI code but no component library. Are you using a design system, or is this custom HTML/CSS?"*
327
+
328
+ #### Discovery Step 6: Constitutional Inference
329
+
330
+ Based on discovered patterns, **suggest** which articles to enable:
331
+
332
+ | Discovery | Suggested Articles |
333
+ |-----------|-------------------|
334
+ | Test files found | Article II: Test-First (already practicing) |
335
+ | Component library detected | Article V: Design System Fidelity |
336
+ | Auth/session patterns found | Article VI: Security by Default |
337
+ | Established conventions detected | Article IV: Consistency (preserve them) |
338
+ | package-lock.json or yarn.lock | Article I: Library-First (already using libraries) |
339
+ | Logging/monitoring deps | Article IX: Observability |
340
+
341
+ Present grouped recommendations and let user confirm, add, or remove articles.
342
+
343
+ ---
344
+
345
+ ### Greenfield Path: Build from Description
346
+
347
+ For new projects, ask the user to describe what they're building.
348
+
349
+ #### Greenfield Step 1: Project Basics
350
+
351
+ Ask the user to describe the project. From their description, fill in `.forge/project.yml`:
352
+
353
+ - Project name and description
354
+ - Primary goal
355
+ - Tech stack (language, framework, database, testing)
356
+ - Time and scope constraints
357
+ - Success criteria
358
+ - Known risks
359
+
360
+ Present a summary: *"Does this capture your project correctly? Anything to add or change?"*
361
+
362
+ #### Greenfield Step 2: Design System Setup
363
+
364
+ Ask: *"Does this project use a UI component library or design system?"*
365
+
366
+ **If yes**, ask which one and configure `design_system` in `project.yml`:
367
+
368
+ ```yaml
369
+ design_system:
370
+ library: "" # e.g., PrimeReact, Material-UI, shadcn/ui, Ant Design, Chakra UI
371
+ version: "" # e.g., 10.x, 5.x
372
+ icon_set: "" # e.g., PrimeIcons, Material Icons, Lucide, none
373
+ layout_system: "" # e.g., PrimeFlex, MUI Grid, Tailwind, CSS Grid
374
+ theme_approach: "" # e.g., SCSS variables, CSS-in-JS, Tailwind config, design tokens
375
+ docs_url: "" # e.g., https://primereact.org/datatable/
376
+ ```
377
+
378
+ Then:
379
+ 1. Check `.forge/templates/design-systems/` for a starter config
380
+ 2. If found → copy and customize for the project
381
+ 3. If not → use `researching` skill to build a component mapping from docs
382
+ 4. Write the mapping to `.forge/design-system.md`
383
+
384
+ **If no** (plain HTML/CSS, utility-only, or non-UI project):
385
+ - Set `design_system.library: none` in project.yml
386
+ - Skip design-system.md creation
387
+ - Disable Article V in the constitution
388
+
389
+ #### Greenfield Step 3: Constitutional Setup
390
+
391
+ Present the 9 constitutional articles grouped by domain:
392
+
393
+ **Code quality** (recommended for most projects):
394
+ - Article I: Library-First — prefer proven libraries over custom code
395
+ - Article II: Test-First — tests before or alongside implementation
396
+ - Article III: Simplicity — simplest solution wins
397
+ - Article IV: Consistency — follow existing project patterns
398
+
399
+ **Design & UI** (enable if project has UI):
400
+ - Article V: Design System Fidelity — use the design system, don't fight it
401
+
402
+ **Security & data** (enable if auth, user data, or APIs involved):
403
+ - Article VI: Security by Default — auth, validation, secrets are requirements
404
+
405
+ **Architecture** (enable based on project complexity):
406
+ - Article VII: Integration-First — real dependencies before mocks
407
+ - Article VIII: Documentation-Driven — decisions documented where code lives
408
+ - Article IX: Observability — logging, error reporting, health checks
409
+
410
+ Ask: *"Which of these articles apply? I'd recommend [suggest based on stack and project type]. You can also add project-specific articles."*
411
+
412
+ ---
413
+
414
+ ### Finalize Init (Both Paths)
415
+
416
+ 1. Write `.forge/project.yml` with all gathered/discovered info
417
+ 2. Write `.forge/constitution.md` with selected articles
418
+ 3. Write `.forge/design-system.md` (if design system configured)
419
+ 4. Initialize milestone-aware state:
420
+ - Create `.forge/state/` directory
421
+ - Write `.forge/state/index.yml`:
422
+ ```yaml
423
+ milestones:
424
+ - id: 1
425
+ name: "{project name}"
426
+ status: active
427
+ last_updated: "{date}"
428
+ ```
429
+ - Write `.forge/state/milestone-1.yml`:
430
+ ```yaml
431
+ milestone:
432
+ id: 1
433
+ name: "{project name}"
434
+ current:
435
+ tier: null
436
+ phase: null
437
+ phase_name: ""
438
+ plan: null
439
+ task: null
440
+ status: not_started
441
+ ```
442
+ 5. Copy remaining templates as needed
443
+
444
+ Confirm: *"Project initialized. Here's what's set up: [summary]. Ready to start working?"*
445
+
446
+ ## Step 2B: Detect Tier
447
+
448
+ Analyze the user's request against these patterns:
449
+
450
+ ### Quick Tier
451
+ Match ANY:
452
+ - Single file change
453
+ - Typo, grammar, formatting fix
454
+ - Config/environment update
455
+ - Dependency version bump
456
+ - Under 50 lines of changes estimated
457
+ - User says "quick", "small", "minor", "just"
458
+
459
+ → Route to `quick-tasking` skill
460
+
461
+ ### Standard Tier
462
+ Match ANY:
463
+ - New feature or component
464
+ - Bug fix requiring investigation
465
+ - Refactor touching multiple files
466
+ - Integration with external service
467
+ - Estimated 1-8 hours of work
468
+
469
+ → Route through: `researching` → `discussing` → `planning` → `executing` → `verifying` → `auditing` → `refactoring`
470
+
471
+ ### Full Tier
472
+ Match ANY:
473
+ - New project from scratch
474
+ - Major architectural change
475
+ - Multi-phase milestone
476
+ - Complex system with multiple subsystems
477
+ - Estimated days of work
478
+ - User says "full", "complex", "project", "milestone"
479
+
480
+ → Route through: `researching` → `discussing` → `architecting` → `planning` → `executing` → `verifying` → `auditing` → `refactoring`
481
+ → Add `designing` if UI work involved
482
+ → Add `securing` if auth/data/API touched
483
+
484
+ ### User Override
485
+ If user explicitly says "Use Quick/Standard/Full tier" — honor it. No arguments.
486
+
487
+ ## Step 3: Route to Next Skill
488
+
489
+ Based on detected tier and current state, tell the user which skill comes next and invoke it.
490
+
491
+ If resuming mid-workflow:
492
+ - Read the selected milestone's state file (`.forge/state/milestone-{id}.yml`) for current position
493
+ - Skip completed phases
494
+ - Resume from current phase
495
+
496
+ ### On-Demand Discussion
497
+
498
+ The `discussing` skill can be invoked at any time, regardless of current workflow position. If the user says "discuss Phase 2", "let's talk through the plan", "I want to rethink this", or similar — route to `discussing` immediately. After the discussion concludes, return to whatever skill was active (or re-plan if the discussion changed direction).
499
+
500
+ ## Deviation Rules (All Tiers)
501
+
502
+ While working at any tier, if you encounter:
503
+
504
+ | Situation | Action | Rule |
505
+ |-----------|--------|------|
506
+ | Bug blocking current task | Auto-fix, document | Rule 1 |
507
+ | Missing validation/error handling/null checks | Auto-add, document | Rule 2 |
508
+ | Broken import/dep/config blocking progress | Auto-fix, document | Rule 3 |
509
+ | Need new DB table, service layer, library swap | **STOP. Ask user.** | Rule 4 |
510
+ | After verifying passes | Run health audit before completion | `auditing` |
511
+ | After auditing passes | Review refactoring opportunities | `refactoring` |
512
+
513
+ When uncertain → Rule 4 (ask). Never silently make architectural decisions.
514
+
515
+ ## State Transitions
516
+
517
+ ```
518
+ not_started → [init if new] → researching → discussing → planning → executing → verifying → auditing → refactoring → complete
519
+ ↗ debugging (if stuck)
520
+ ↗ designing (if UI)
521
+ ↗ securing (if auth/data)
522
+ ```
523
+
524
+ Update `.forge/state/milestone-{id}.yml` at each transition. Update `.forge/state/index.yml` milestone `last_updated` timestamp.