forge-orkes 0.3.6 → 0.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forge-orkes",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "Set up the Forge meta-prompting framework for Claude Code in your project",
5
5
  "bin": {
6
6
  "create-forge": "./bin/create-forge.js"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "forge": {
3
- "version": "0.3.1",
3
+ "version": "0.1.0",
4
4
  "default_tier": "standard",
5
5
  "beads_integration": false,
6
6
  "context_gates": {
@@ -17,7 +17,11 @@
17
17
  "refactor",
18
18
  "chore",
19
19
  "docs"
20
- ]
20
+ ],
21
+ "verification": {
22
+ "auto_fix": true,
23
+ "max_retries": 2
24
+ }
21
25
  },
22
26
  "hooks": {
23
27
  "PostToolUse": [
@@ -92,7 +92,8 @@ For each task in the plan:
92
92
  5. **Verify** using the verify step (run tests, inspect output)
93
93
  6. **Confirm** done criteria are met
94
94
  7. **Commit** atomically
95
- 8. **Mark complete** — `TaskUpdate` the native task to `completed`
95
+ 8. **Run verification gate** — execute configured verification commands (see Verification Gate below)
96
+ 9. **Mark complete** — `TaskUpdate` the native task to `completed`
96
97
 
97
98
  ## TDD Flow (When task type="tdd")
98
99
 
@@ -127,6 +128,73 @@ feat(auth-01): implement JWT-based login
127
128
  - Include integration test for login flow
128
129
  ```
129
130
 
131
+ ## Verification Gate
132
+
133
+ After each task commit, run the project's configured verification commands to catch regressions immediately. This is mechanical enforcement — not optional, not agent-directed.
134
+
135
+ ### Load Config
136
+
137
+ Read `.forge/project.yml → verification`. If `verification.commands` is empty or missing, skip this section entirely.
138
+
139
+ ```yaml
140
+ # Example from project.yml:
141
+ verification:
142
+ commands:
143
+ - cmd: "npm run lint"
144
+ advisory: false
145
+ - cmd: "npm test"
146
+ advisory: false
147
+ - cmd: "npx tsc --noEmit"
148
+ advisory: true # pre-existing failures — warn only
149
+ auto_fix: true
150
+ max_retries: 2
151
+ ```
152
+
153
+ ### Execution Flow
154
+
155
+ For each verification command, in order:
156
+
157
+ 1. **Run the command** via Bash
158
+ 2. **If it passes** → move to next command
159
+ 3. **If it fails:**
160
+ - **Advisory command?** → Log warning: *"Advisory: `{cmd}` failed (pre-existing issue, not blocking)."* Move to next command.
161
+ - **Non-advisory + `auto_fix: false`?** → Log failure and continue to next task. Don't block.
162
+ - **Non-advisory + `auto_fix: true`?** → Enter auto-fix loop (below)
163
+
164
+ ### Auto-Fix Loop
165
+
166
+ When a non-advisory verification command fails with `auto_fix: true`:
167
+
168
+ ```
169
+ Attempt 1:
170
+ 1. Read the command output (error messages, failing tests, lint errors)
171
+ 2. Identify the issue — is it caused by the current task's changes?
172
+ - YES → fix the code, stage fixes, amend the commit
173
+ - NO (pre-existing) → mark this command as advisory for this session, log warning, continue
174
+ 3. Re-run the verification command
175
+ 4. If passes → continue to next command
176
+ 5. If fails → attempt 2 (up to max_retries)
177
+
178
+ After max_retries exhausted:
179
+ → Log the failure in the execution summary
180
+ → Continue to next task (don't block the whole plan)
181
+ → The verifying skill will catch persistent failures later
182
+ ```
183
+
184
+ ### Integration with 3-Strike Rule
185
+
186
+ Verification auto-fix attempts count toward the task's 3-strike limit. If a task has already used 2 strikes on implementation issues, it gets 1 verification retry max.
187
+
188
+ ### What NOT to Fix in Verification
189
+
190
+ - **Pre-existing failures** not caused by the current task → mark advisory
191
+ - **Flaky tests** that pass on re-run without code changes → note in summary, don't count as a strike
192
+ - **Unrelated warnings** (deprecation notices, non-blocking lint info) → ignore
193
+
194
+ ### Quick Tier
195
+
196
+ Verification gates also run for Quick tier tasks (`quick-tasking` skill). After the commit, run all non-advisory verification commands once. If they fail, show the output and let the agent fix — but limit to 1 retry (Quick tier shouldn't spend time in fix loops).
197
+
130
198
  ## Context Engineering
131
199
 
132
200
  ### When to Spawn Fresh Agent
@@ -30,12 +30,11 @@ Check for state files in this order:
30
30
  5. **If no active milestones:** Proceed to init or ask user to create one.
31
31
  6. Load the selected milestone's state file (`.forge/state/milestone-{id}.yml`)
32
32
  7. **Route based on `current.status`, NOT on `overall_percent`.** The `current.status` field is the authoritative workflow position. A milestone is only complete when `current.status` equals `complete`. Even if `overall_percent` is 100%, the milestone still needs to go through any remaining workflow steps (verifying, auditing, refactoring) before it is truly done.
33
- 8. Report position from the milestone-specific state:
33
+ 8. Report position briefly, then **immediately route to the next skill** (see Step 3: Mandatory Auto-Routing):
34
34
  - **Workflow status** (`current.status`) — this is the primary indicator of where you are
35
- - Current phase, plan, task
35
+ - Phase progress using precise terminology: "Executed" (code done, not verified), "Verified", "Pending", "In progress" — **never say "Complete" for a phase that hasn't been verified**
36
36
  - Task progress percentage (`overall_percent`) — this measures task completion, not workflow completion
37
- - Active blockers
38
- - Recent decisions
37
+ - **Do NOT present a menu of options.** State the position, state the next action, invoke the skill.
39
38
 
40
39
  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.
41
40
 
@@ -61,393 +60,7 @@ If state exists → go to **Step 2B: Detect Tier**.
61
60
 
62
61
  ## Step 2A: Project Init
63
62
 
64
- 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.
65
-
66
- ### Detect Project Type
67
-
68
- Check for signals of an existing codebase:
69
-
70
- ```
71
- Check: package.json OR requirements.txt OR go.mod OR Cargo.toml (dependency manifest)
72
- Check: .git/ (version control history)
73
- Check: src/ OR app/ OR lib/ (source directories)
74
- Check: existing config files (tsconfig.json, .eslintrc, vite.config, etc.)
75
- ```
76
-
77
- - **2+ signals found** → **Brownfield path** (existing codebase)
78
- - **0-1 signals** → **Greenfield path** (new project)
79
-
80
- Ask user to confirm: *"This looks like an [existing project / new project]. Is that right?"*
81
-
82
- ---
83
-
84
- ### Brownfield Path: Discover Existing Project
85
-
86
- For existing codebases, **scan first, confirm with user second.** Don't ask the user to describe what you can discover.
87
-
88
- #### Discovery Step 0: Framework Detection
89
-
90
- 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.
91
-
92
- **Meta-Framework Signatures** (contain project knowledge — candidates for absorption):
93
-
94
- ```
95
- # GSD (Get Shit Done)
96
- Check: agents/gsd-*.md OR commands/gsd/ directory
97
- Check: Root-level PROJECT.md + REQUIREMENTS.md + ROADMAP.md + STATE.md
98
- Check: get-shit-done/ directory
99
- Check: CONTEXT.md with "NON-NEGOTIABLE" or "DEFERRED" sections
100
-
101
- # Spec-Kit
102
- Check: spec-driven.md
103
- Check: templates/ with spec-template.md
104
- Check: extensions/catalog.json
105
- Check: constitution-template.md
106
-
107
- # BMAD
108
- Check: agents/ with 20+ agent files
109
- Check: workflows/ directory
110
- Check: bmad-* prefixed files
111
-
112
- # Generic / Unknown
113
- Check: .claude/agents/ or .claude/skills/ (someone else's custom framework)
114
- Check: CLAUDE.md with framework-like routing tables
115
- Check: Any structured agent/workflow system
116
- ```
117
-
118
- **Companion Tool Signatures** (not frameworks — independent tools that work alongside Forge):
119
-
120
- ```
121
- # Beads (persistent cross-session memory)
122
- Check: .beads/ directory
123
- Check: beads.jsonl or beads.db
124
- Check: bd CLI available (Bash: which bd)
125
- → If found: Enable forge.beads_integration in settings.json. Do NOT absorb or archive.
126
- → Beads is independent — it runs alongside Forge, not inside it.
127
- ```
128
-
129
- **If a meta-framework is detected**, present the finding and offer three options:
130
-
131
- *"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?"*
132
-
133
- **Option A: Absorb & Convert** (recommended)
134
- Read all existing framework documentation, extract the project knowledge, and convert it into Forge's format. This means:
135
- - Project descriptions → `.forge/project.yml`
136
- - Requirements → `.forge/requirements.yml`
137
- - Roadmaps/plans → `.forge/roadmap.yml`
138
- - Context/decisions → `.forge/context.md`
139
- - Current state/progress → `.forge/state/index.yml` + `.forge/state/milestone-{id}.yml`
140
- - Constitutional rules (if any) → `.forge/constitution.md`
141
- - Design system rules (if any) → `.forge/design-system.md`
142
-
143
- → Go to **Framework Absorption** below.
144
-
145
- **Option B: Archive & Start Fresh**
146
- 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.
147
-
148
- **Option C: Keep Both (Transition Period)**
149
- 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.
150
-
151
- ---
152
-
153
- #### Framework Absorption (Option A)
154
-
155
- When absorbing an existing framework, read its documentation and convert systematically.
156
-
157
- **GSD Absorption Map:**
158
-
159
- | GSD Source | Read | Extract | Write to Forge |
160
- |-----------|------|---------|---------------|
161
- | `PROJECT.md` | Project name, description, tech stack, goals | Structured project info | `.forge/project.yml` |
162
- | `REQUIREMENTS.md` | Feature requirements, acceptance criteria | Convert prose to YAML with IDs | `.forge/requirements.yml` |
163
- | `ROADMAP.md` | Phases, milestones, dependencies | Convert to YAML with dependency refs | `.forge/roadmap.yml` |
164
- | `STATE.md` | Current phase, progress, blockers | Machine-readable state | `.forge/state/index.yml` + `.forge/state/milestone-{id}.yml` |
165
- | `CONTEXT.md` | NON-NEGOTIABLE decisions, DEFERRED ideas | Locked decisions, deferred items | `.forge/context.md` |
166
- | `references/ui-brand.md` | Design system rules, brand guidelines | Component mappings, style rules | `.forge/design-system.md` |
167
- | `references/verification-patterns.md` | Verification approach | Inform `verifying` skill config | Constitution articles |
168
- | `references/tdd.md` | Testing approach | Inform constitution Article II | Constitution articles |
169
- | Agent customizations | Custom agent behaviors, tool restrictions | Map to Forge agent definitions | `.claude/agents/*.md` (if custom) |
170
-
171
- **Spec-Kit Absorption Map:**
172
-
173
- | Spec-Kit Source | Read | Extract | Write to Forge |
174
- |----------------|------|---------|---------------|
175
- | `spec-driven.md` | Core methodology | Governance patterns | `.forge/constitution.md` |
176
- | `templates/spec-template.md` | Spec structure | Requirements format | `.forge/requirements.yml` |
177
- | `templates/constitution-template.md` | Constitutional articles | Immutable gates | `.forge/constitution.md` |
178
- | `extensions/` | Extension configs | Specialized skills | `.claude/skills/` (if relevant) |
179
- | Project specs (if filled in) | Project-specific decisions | Locked decisions | `.forge/context.md` |
180
-
181
- **Generic Framework Absorption:**
182
-
183
- For unknown frameworks, use the `researching` skill to:
184
- 1. Read all markdown and config files in the framework directory
185
- 2. Identify: project descriptions, requirements, decisions, state, design rules
186
- 3. Map each to the closest Forge equivalent
187
- 4. Present the mapping to the user for confirmation before writing
188
-
189
- **Absorption Process:**
190
-
191
- 1. Read all source files from the existing framework
192
- 2. For each Forge target file, synthesize content from the relevant sources
193
- 3. Convert prose to YAML where Forge expects YAML (project, requirements, roadmap, state)
194
- 4. Preserve markdown where Forge expects markdown (constitution, context, design-system)
195
- 5. **Never discard information** — if something doesn't map to a Forge file, note it in `.forge/context.md` under a "Carried Forward" section
196
- 6. Move original framework files to `.forge/archive/{framework-name}/`
197
- 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?"*
198
-
199
- 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.
200
-
201
- #### Documentation vs. Codebase Verification
202
-
203
- **Never trust framework documentation at face value.** Documentation drifts. The codebase is the source of truth.
204
-
205
- After reading existing framework docs, **cross-reference every claim against the actual code**:
206
-
207
- ```
208
- For each claim in the documentation:
209
- 1. Find the corresponding code (Glob, Grep, Read)
210
- 2. Verify the claim matches reality
211
- 3. Flag any discrepancies
212
- ```
213
-
214
- **Common drift patterns to check:**
215
-
216
- | Documentation Says | Verify Against |
217
- |-------------------|----------------|
218
- | "Tech stack: React + PostgreSQL" | `package.json` dependencies, actual imports in `src/` |
219
- | "Uses PrimeReact for all UI" | `Grep: src/ for "from 'primereact"` — are there also raw HTML tables, custom modals? |
220
- | "Tests written for all features" | `Glob: src/**/*.test.*` — actual coverage vs. claimed coverage |
221
- | "Auth uses Clerk/Auth0/etc." | `Grep: src/ for auth imports` — is there also custom auth code? |
222
- | "State management via Redux" | `package.json` + actual imports — did they switch to Zustand mid-project? |
223
- | "API uses REST" | `Grep: src/ for GraphQL, tRPC, WebSocket` — mixed protocols? |
224
- | Requirements list features A, B, C | Do routes/components for A, B, C actually exist? Are any partially implemented? |
225
- | Roadmap says "Phase 2 complete" | Are Phase 2 features actually wired and working, or are there stubs? |
226
-
227
- **When discrepancies are found:**
228
-
229
- Present them to the user clearly:
230
-
231
- *"I found some differences between the GSD documentation and the actual codebase:*
232
-
233
- - *PROJECT.md says 'PostgreSQL' but I only see SQLite in dependencies*
234
- - *REQUIREMENTS.md lists a 'notifications' feature but I can't find any notification code*
235
- - *STATE.md says Phase 2 is complete, but the dashboard component looks like a stub (returns placeholder text)*
236
- - *The docs mention PrimeReact exclusively, but I found 3 files using raw HTML tables instead of DataTable*
237
-
238
- *Should I update the Forge config to match what's actually in the code, or are some of these features that were removed/deferred?"*
239
-
240
- **Priority order for truth:**
241
- 1. **What the code actually does** — highest authority
242
- 2. **What the user confirms** — resolves ambiguity
243
- 3. **What the documentation says** — useful context, but may be stale
244
-
245
- 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.
246
-
247
- ---
248
-
249
- #### Discovery Step 1: Tech Stack Scan
250
-
251
- ```bash
252
- # Package manifest
253
- Read: package.json → name, dependencies, devDependencies, scripts
254
- # Or: requirements.txt, go.mod, Cargo.toml, etc.
255
-
256
- # Config files
257
- Glob: tsconfig.json, .eslintrc*, vite.config.*, next.config.*, webpack.config.*
258
- Glob: .env.example, docker-compose.yml
259
-
260
- # Source structure
261
- Bash: find src/ -type f | head -50 # understand file organization
262
- Bash: wc -l src/**/*.{ts,tsx,js,jsx} 2>/dev/null | tail -1 # codebase size
263
- ```
264
-
265
- From this, auto-detect:
266
- - Language and framework
267
- - Build tools and test framework
268
- - Database (from dependencies or config)
269
- - Project name and description (from package.json or README)
270
-
271
- #### Discovery Step 2: Design System Detection
272
-
273
- ```bash
274
- # Check dependencies for known UI libraries
275
- Grep: package.json for: primereact, @mui/, @chakra-ui/, @radix-ui/, antd, @headlessui/
276
- Grep: package.json for: tailwindcss, primeflex, @emotion/, styled-components
277
-
278
- # Check actual usage in source
279
- Grep: src/ for import patterns: "from 'primereact", "from '@mui/", "from '@/components/ui"
280
- Grep: src/ for icon usage: "pi pi-", "Material", "lucide-react"
281
-
282
- # Check for theme files
283
- Glob: **/*theme*, **/*variables.scss, **/tailwind.config*, **/globals.css
284
- ```
285
-
286
- From this, auto-detect:
287
- - Component library (and version from package.json)
288
- - Icon set in use
289
- - Layout system (PrimeFlex, Tailwind, MUI Grid, etc.)
290
- - Theme approach (SCSS variables, CSS-in-JS, Tailwind config, design tokens)
291
-
292
- #### Discovery Step 3: Pattern Analysis
293
-
294
- ```bash
295
- # Existing conventions
296
- Glob: src/**/*.test.* OR src/**/*.spec.* # test patterns
297
- Grep: src/ for error handling patterns
298
- Grep: src/ for auth/session patterns
299
- Bash: git log --oneline -20 # commit style
300
-
301
- # Architecture patterns
302
- Bash: ls -la src/ # top-level structure (pages, components, services, etc.)
303
- Glob: src/**/index.{ts,tsx,js} # barrel exports
304
- Grep: src/ for "import.*from.*@/" # path aliases
305
- ```
306
-
307
- #### Discovery Step 4: Present Findings
308
-
309
- Present a structured summary to the user:
310
-
311
- *"I've scanned your codebase. Here's what I found:*
312
-
313
- *Project: {name} — {description from README or package.json}*
314
- *Stack: {language} + {framework} + {database}*
315
- *UI: {component library} with {icon set}, layout via {layout system}*
316
- *Testing: {test framework}, {X} existing test files*
317
- *Size: ~{N} source files, ~{N}K lines*
318
- *Patterns: {commit style}, {folder structure approach}, {key conventions}*
319
-
320
- *Does this look right? Anything I missed or got wrong?"*
321
-
322
- #### Discovery Step 5: Design System Mapping
323
-
324
- If a component library was detected:
325
- 1. Check `.forge/templates/design-systems/` for an existing example config
326
- 2. If found (e.g., PrimeReact) → copy it as starting point for `.forge/design-system.md`
327
- 3. If not found → use `researching` skill to build a component mapping from docs
328
- 4. **Cross-reference with actual usage**: scan the codebase for which components are already in use and prioritize those in the mapping
329
- 5. Present mapping to user for validation
330
-
331
- If no component library detected but UI files exist:
332
- - Ask: *"I see UI code but no component library. Are you using a design system, or is this custom HTML/CSS?"*
333
-
334
- #### Discovery Step 6: Constitutional Inference
335
-
336
- Based on discovered patterns, **suggest** which articles to enable:
337
-
338
- | Discovery | Suggested Articles |
339
- |-----------|-------------------|
340
- | Test files found | Article II: Test-First (already practicing) |
341
- | Component library detected | Article V: Design System Fidelity |
342
- | Auth/session patterns found | Article VI: Security by Default |
343
- | Established conventions detected | Article IV: Consistency (preserve them) |
344
- | package-lock.json or yarn.lock | Article I: Library-First (already using libraries) |
345
- | Logging/monitoring deps | Article IX: Observability |
346
-
347
- Present grouped recommendations and let user confirm, add, or remove articles.
348
-
349
- ---
350
-
351
- ### Greenfield Path: Build from Description
352
-
353
- For new projects, ask the user to describe what they're building.
354
-
355
- #### Greenfield Step 1: Project Basics
356
-
357
- Ask the user to describe the project. From their description, fill in `.forge/project.yml`:
358
-
359
- - Project name and description
360
- - Primary goal
361
- - Tech stack (language, framework, database, testing)
362
- - Time and scope constraints
363
- - Success criteria
364
- - Known risks
365
-
366
- Present a summary: *"Does this capture your project correctly? Anything to add or change?"*
367
-
368
- #### Greenfield Step 2: Design System Setup
369
-
370
- Ask: *"Does this project use a UI component library or design system?"*
371
-
372
- **If yes**, ask which one and configure `design_system` in `project.yml`:
373
-
374
- ```yaml
375
- design_system:
376
- library: "" # e.g., PrimeReact, Material-UI, shadcn/ui, Ant Design, Chakra UI
377
- version: "" # e.g., 10.x, 5.x
378
- icon_set: "" # e.g., PrimeIcons, Material Icons, Lucide, none
379
- layout_system: "" # e.g., PrimeFlex, MUI Grid, Tailwind, CSS Grid
380
- theme_approach: "" # e.g., SCSS variables, CSS-in-JS, Tailwind config, design tokens
381
- docs_url: "" # e.g., https://primereact.org/datatable/
382
- ```
383
-
384
- Then:
385
- 1. Check `.forge/templates/design-systems/` for a starter config
386
- 2. If found → copy and customize for the project
387
- 3. If not → use `researching` skill to build a component mapping from docs
388
- 4. Write the mapping to `.forge/design-system.md`
389
-
390
- **If no** (plain HTML/CSS, utility-only, or non-UI project):
391
- - Set `design_system.library: none` in project.yml
392
- - Skip design-system.md creation
393
- - Disable Article V in the constitution
394
-
395
- #### Greenfield Step 3: Constitutional Setup
396
-
397
- Present the 9 constitutional articles grouped by domain:
398
-
399
- **Code quality** (recommended for most projects):
400
- - Article I: Library-First — prefer proven libraries over custom code
401
- - Article II: Test-First — tests before or alongside implementation
402
- - Article III: Simplicity — simplest solution wins
403
- - Article IV: Consistency — follow existing project patterns
404
-
405
- **Design & UI** (enable if project has UI):
406
- - Article V: Design System Fidelity — use the design system, don't fight it
407
-
408
- **Security & data** (enable if auth, user data, or APIs involved):
409
- - Article VI: Security by Default — auth, validation, secrets are requirements
410
-
411
- **Architecture** (enable based on project complexity):
412
- - Article VII: Integration-First — real dependencies before mocks
413
- - Article VIII: Documentation-Driven — decisions documented where code lives
414
- - Article IX: Observability — logging, error reporting, health checks
415
-
416
- Ask: *"Which of these articles apply? I'd recommend [suggest based on stack and project type]. You can also add project-specific articles."*
417
-
418
- ---
419
-
420
- ### Finalize Init (Both Paths)
421
-
422
- 1. Write `.forge/project.yml` with all gathered/discovered info
423
- 2. Write `.forge/constitution.md` with selected articles
424
- 3. Write `.forge/design-system.md` (if design system configured)
425
- 4. Initialize milestone-aware state:
426
- - Create `.forge/state/` directory
427
- - Write `.forge/state/index.yml`:
428
- ```yaml
429
- milestones:
430
- - id: 1
431
- name: "{project name}"
432
- status: active
433
- last_updated: "{date}"
434
- ```
435
- - Write `.forge/state/milestone-1.yml`:
436
- ```yaml
437
- milestone:
438
- id: 1
439
- name: "{project name}"
440
- current:
441
- tier: null
442
- phase: null
443
- phase_name: ""
444
- plan: null
445
- task: null
446
- status: not_started
447
- ```
448
- 5. Copy remaining templates as needed
449
-
450
- Confirm: *"Project initialized. Here's what's set up: [summary]. Ready to start working?"*
63
+ If no `.forge/project.yml` exists, invoke the `initializing` skill via `Skill(initializing)`. It handles brownfield/greenfield detection, framework absorption, tech stack scanning, design system setup, and constitutional configuration. After init completes, return here for tier detection.
451
64
 
452
65
  ## Step 2B: Detect Tier
453
66
 
@@ -502,9 +115,23 @@ Based on detected tier and current state, tell the user which skill comes next a
502
115
 
503
116
  **CRITICAL: NEVER use `EnterPlanMode` or Claude Code's native plan mode.** All Forge phases are handled by Forge skills invoked via the `Skill` tool. When the workflow says "planning", that means invoke `Skill(planning)` — not enter native plan mode. Native plan mode writes to a different file format and bypasses Forge's constitutional gates, state management, and structured plan output.
504
117
 
505
- If resuming mid-workflow:
506
- - Read the selected milestone's state file (`.forge/state/milestone-{id}.yml`) for current position
507
- - **Use `current.status` to determine the next skill** this is the authoritative workflow position:
118
+ ### Mandatory Auto-Routing on Resume
119
+
120
+ **When resuming mid-workflow, DO NOT present a menu of options or ask "What would you like to do?".** Routing is deterministic. Give a brief status briefing, then route automatically. The only time to ask the user for a choice is when `current.status == complete` (milestone done) or when state is ambiguous/corrupted.
121
+
122
+ Resume steps:
123
+ 1. Read the selected milestone's state file (`.forge/state/milestone-{id}.yml`) for current position
124
+ 2. **Check for status advancement** (see below)
125
+ 3. **Use `current.status` to determine the next skill** — this is the authoritative workflow position
126
+ 4. **Brief the user, then route.** Show a compact status summary so the user can orient, then immediately invoke the next skill. Format:
127
+
128
+ *"Resuming Milestone {id}: {name}*
129
+ *Workflow: {current.status} — next step: {next skill name}*
130
+ *Phases: {compact phase list with statuses using correct wording — Executed/Verified/Pending/In progress}*
131
+ *Progress: {overall_percent}% of tasks executed*
132
+ *Routing to {skill}..."*
133
+
134
+ This is a **briefing, not a prompt** — the user sees where they are and what's happening next. They can interrupt if they want to do something different, but the default is forward motion.
508
135
 
509
136
  | `current.status` | Next Action (invoke via `Skill` tool) |
510
137
  |-------------------|-------------|
@@ -522,6 +149,27 @@ If resuming mid-workflow:
522
149
  - Skip completed phases (phases before `current.status`)
523
150
  - Resume from current phase
524
151
 
152
+ ### Status Advancement Check
153
+
154
+ Sometimes a session ends before the executing skill advances `current.status`. On resume, detect and fix this:
155
+
156
+ - **If `current.status == executing`**: Check if all phases in the roadmap have been executed (all plans completed, commits made). If YES → advance `current.status` to `verifying` in the state file, then route to verifying. If NO → route to executing for the next unexecuted phase.
157
+ - **If `current.status == verifying`**: Check if verification report exists. If YES and it passed → advance to `auditing`. If NO → route to verifying.
158
+ - **General rule**: If the work for the current status is done but the status wasn't advanced (session ended mid-handoff), advance it now and route to the next skill.
159
+
160
+ ### Phase Status Wording
161
+
162
+ When reporting phase progress on resume, use precise terminology to avoid confusion:
163
+
164
+ | Phase State | Display As | Meaning |
165
+ |------------|-----------|---------|
166
+ | All tasks executed, commits made | **"Executed"** | Code is written and committed, but NOT yet verified |
167
+ | Verified by verifying skill | **"Verified"** | Passed goal-backward verification |
168
+ | Not yet started | **"Pending"** | No work done yet |
169
+ | Currently in progress | **"In progress"** | Partially executed |
170
+
171
+ **Never say a phase is "Complete" unless it has passed through the full workflow** (executed + verified + audited). Use "Executed" for phases where code is done but verification hasn't run. This prevents users from thinking a phase is fully done when it still needs verification.
172
+
525
173
  ### On-Demand Discussion
526
174
 
527
175
  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).
@@ -0,0 +1,475 @@
1
+ ---
2
+ name: initializing
3
+ description: "Run once per project to detect brownfield/greenfield, scan tech stack, absorb existing frameworks, configure design system, and set up constitutional gates. Invoked by the forge skill when no .forge/project.yml exists."
4
+ ---
5
+
6
+ # Initializing: Project Setup
7
+
8
+ This interactive workflow runs once when Forge doesn't find an existing project (no `.forge/project.yml`). First, detect whether this is a **brownfield** (existing codebase) or **greenfield** (new project) — then run the appropriate init path.
9
+
10
+ ## Detect Project Type
11
+
12
+ Check for signals of an existing codebase:
13
+
14
+ ```
15
+ Check: package.json OR requirements.txt OR go.mod OR Cargo.toml (dependency manifest)
16
+ Check: .git/ (version control history)
17
+ Check: src/ OR app/ OR lib/ (source directories)
18
+ Check: existing config files (tsconfig.json, .eslintrc, vite.config, etc.)
19
+ ```
20
+
21
+ - **2+ signals found** → **Brownfield path** (existing codebase)
22
+ - **0-1 signals** → **Greenfield path** (new project)
23
+
24
+ Ask user to confirm: *"This looks like an [existing project / new project]. Is that right?"*
25
+
26
+ ---
27
+
28
+ ## Brownfield Path: Discover Existing Project
29
+
30
+ For existing codebases, **scan first, confirm with user second.** Don't ask the user to describe what you can discover.
31
+
32
+ ### Discovery Step 0: Framework Detection
33
+
34
+ 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.
35
+
36
+ **Meta-Framework Signatures** (contain project knowledge — candidates for absorption):
37
+
38
+ ```
39
+ # GSD (Get Shit Done)
40
+ Check: agents/gsd-*.md OR commands/gsd/ directory
41
+ Check: Root-level PROJECT.md + REQUIREMENTS.md + ROADMAP.md + STATE.md
42
+ Check: get-shit-done/ directory
43
+ Check: CONTEXT.md with "NON-NEGOTIABLE" or "DEFERRED" sections
44
+
45
+ # Spec-Kit
46
+ Check: spec-driven.md
47
+ Check: templates/ with spec-template.md
48
+ Check: extensions/catalog.json
49
+ Check: constitution-template.md
50
+
51
+ # BMAD
52
+ Check: agents/ with 20+ agent files
53
+ Check: workflows/ directory
54
+ Check: bmad-* prefixed files
55
+
56
+ # Generic / Unknown
57
+ Check: .claude/agents/ or .claude/skills/ (someone else's custom framework)
58
+ Check: CLAUDE.md with framework-like routing tables
59
+ Check: Any structured agent/workflow system
60
+ ```
61
+
62
+ **Companion Tool Signatures** (not frameworks — independent tools that work alongside Forge):
63
+
64
+ ```
65
+ # Beads (persistent cross-session memory)
66
+ Check: .beads/ directory
67
+ Check: beads.jsonl or beads.db
68
+ Check: bd CLI available (Bash: which bd)
69
+ → If found: Enable forge.beads_integration in settings.json. Do NOT absorb or archive.
70
+ → Beads is independent — it runs alongside Forge, not inside it.
71
+ ```
72
+
73
+ **If a meta-framework is detected**, present the finding and offer three options:
74
+
75
+ *"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?"*
76
+
77
+ **Option A: Absorb & Convert** (recommended)
78
+ Read all existing framework documentation, extract the project knowledge, and convert it into Forge's format. This means:
79
+ - Project descriptions → `.forge/project.yml`
80
+ - Requirements → `.forge/requirements.yml`
81
+ - Roadmaps/plans → `.forge/roadmap.yml`
82
+ - Context/decisions → `.forge/context.md`
83
+ - Current state/progress → `.forge/state/index.yml` + `.forge/state/milestone-{id}.yml`
84
+ - Constitutional rules (if any) → `.forge/constitution.md`
85
+ - Design system rules (if any) → `.forge/design-system.md`
86
+
87
+ → Go to **Framework Absorption** below.
88
+
89
+ **Option B: Archive & Start Fresh**
90
+ 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.
91
+
92
+ **Option C: Keep Both (Transition Period)**
93
+ 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.
94
+
95
+ ---
96
+
97
+ ### Framework Absorption (Option A)
98
+
99
+ When absorbing an existing framework, read its documentation and convert systematically.
100
+
101
+ **GSD Absorption Map:**
102
+
103
+ | GSD Source | Read | Extract | Write to Forge |
104
+ |-----------|------|---------|---------------|
105
+ | `PROJECT.md` | Project name, description, tech stack, goals | Structured project info | `.forge/project.yml` |
106
+ | `REQUIREMENTS.md` | Feature requirements, acceptance criteria | Convert prose to YAML with IDs | `.forge/requirements.yml` |
107
+ | `ROADMAP.md` | Phases, milestones, dependencies | Convert to YAML with dependency refs | `.forge/roadmap.yml` |
108
+ | `STATE.md` | Current phase, progress, blockers | Machine-readable state | `.forge/state/index.yml` + `.forge/state/milestone-{id}.yml` |
109
+ | `CONTEXT.md` | NON-NEGOTIABLE decisions, DEFERRED ideas | Locked decisions, deferred items | `.forge/context.md` |
110
+ | `references/ui-brand.md` | Design system rules, brand guidelines | Component mappings, style rules | `.forge/design-system.md` |
111
+ | `references/verification-patterns.md` | Verification approach | Inform `verifying` skill config | Constitution articles |
112
+ | `references/tdd.md` | Testing approach | Inform constitution Article II | Constitution articles |
113
+ | Agent customizations | Custom agent behaviors, tool restrictions | Map to Forge agent definitions | `.claude/agents/*.md` (if custom) |
114
+
115
+ **Spec-Kit Absorption Map:**
116
+
117
+ | Spec-Kit Source | Read | Extract | Write to Forge |
118
+ |----------------|------|---------|---------------|
119
+ | `spec-driven.md` | Core methodology | Governance patterns | `.forge/constitution.md` |
120
+ | `templates/spec-template.md` | Spec structure | Requirements format | `.forge/requirements.yml` |
121
+ | `templates/constitution-template.md` | Constitutional articles | Immutable gates | `.forge/constitution.md` |
122
+ | `extensions/` | Extension configs | Specialized skills | `.claude/skills/` (if relevant) |
123
+ | Project specs (if filled in) | Project-specific decisions | Locked decisions | `.forge/context.md` |
124
+
125
+ **Generic Framework Absorption:**
126
+
127
+ For unknown frameworks, use the `researching` skill to:
128
+ 1. Read all markdown and config files in the framework directory
129
+ 2. Identify: project descriptions, requirements, decisions, state, design rules
130
+ 3. Map each to the closest Forge equivalent
131
+ 4. Present the mapping to the user for confirmation before writing
132
+
133
+ **Absorption Process:**
134
+
135
+ 1. Read all source files from the existing framework
136
+ 2. For each Forge target file, synthesize content from the relevant sources
137
+ 3. Convert prose to YAML where Forge expects YAML (project, requirements, roadmap, state)
138
+ 4. Preserve markdown where Forge expects markdown (constitution, context, design-system)
139
+ 5. **Never discard information** — if something doesn't map to a Forge file, note it in `.forge/context.md` under a "Carried Forward" section
140
+ 6. Move original framework files to `.forge/archive/{framework-name}/`
141
+ 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?"*
142
+
143
+ 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.
144
+
145
+ ### Documentation vs. Codebase Verification
146
+
147
+ **Never trust framework documentation at face value.** Documentation drifts. The codebase is the source of truth.
148
+
149
+ After reading existing framework docs, **cross-reference every claim against the actual code**:
150
+
151
+ ```
152
+ For each claim in the documentation:
153
+ 1. Find the corresponding code (Glob, Grep, Read)
154
+ 2. Verify the claim matches reality
155
+ 3. Flag any discrepancies
156
+ ```
157
+
158
+ **Common drift patterns to check:**
159
+
160
+ | Documentation Says | Verify Against |
161
+ |-------------------|----------------|
162
+ | "Tech stack: React + PostgreSQL" | `package.json` dependencies, actual imports in `src/` |
163
+ | "Uses PrimeReact for all UI" | `Grep: src/ for "from 'primereact"` — are there also raw HTML tables, custom modals? |
164
+ | "Tests written for all features" | `Glob: src/**/*.test.*` — actual coverage vs. claimed coverage |
165
+ | "Auth uses Clerk/Auth0/etc." | `Grep: src/ for auth imports` — is there also custom auth code? |
166
+ | "State management via Redux" | `package.json` + actual imports — did they switch to Zustand mid-project? |
167
+ | "API uses REST" | `Grep: src/ for GraphQL, tRPC, WebSocket` — mixed protocols? |
168
+ | Requirements list features A, B, C | Do routes/components for A, B, C actually exist? Are any partially implemented? |
169
+ | Roadmap says "Phase 2 complete" | Are Phase 2 features actually wired and working, or are there stubs? |
170
+
171
+ **When discrepancies are found:**
172
+
173
+ Present them to the user clearly:
174
+
175
+ *"I found some differences between the GSD documentation and the actual codebase:*
176
+
177
+ - *PROJECT.md says 'PostgreSQL' but I only see SQLite in dependencies*
178
+ - *REQUIREMENTS.md lists a 'notifications' feature but I can't find any notification code*
179
+ - *STATE.md says Phase 2 is complete, but the dashboard component looks like a stub (returns placeholder text)*
180
+ - *The docs mention PrimeReact exclusively, but I found 3 files using raw HTML tables instead of DataTable*
181
+
182
+ *Should I update the Forge config to match what's actually in the code, or are some of these features that were removed/deferred?"*
183
+
184
+ **Priority order for truth:**
185
+ 1. **What the code actually does** — highest authority
186
+ 2. **What the user confirms** — resolves ambiguity
187
+ 3. **What the documentation says** — useful context, but may be stale
188
+
189
+ 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.
190
+
191
+ ---
192
+
193
+ ### Discovery Step 1: Tech Stack Scan
194
+
195
+ ```bash
196
+ # Package manifest
197
+ Read: package.json → name, dependencies, devDependencies, scripts
198
+ # Or: requirements.txt, go.mod, Cargo.toml, etc.
199
+
200
+ # Config files
201
+ Glob: tsconfig.json, .eslintrc*, vite.config.*, next.config.*, webpack.config.*
202
+ Glob: .env.example, docker-compose.yml
203
+
204
+ # Source structure
205
+ Bash: find src/ -type f | head -50 # understand file organization
206
+ Bash: wc -l src/**/*.{ts,tsx,js,jsx} 2>/dev/null | tail -1 # codebase size
207
+ ```
208
+
209
+ From this, auto-detect:
210
+ - Language and framework
211
+ - Build tools and test framework
212
+ - Database (from dependencies or config)
213
+ - Project name and description (from package.json or README)
214
+
215
+ ### Discovery Step 1.5: Verification Command Detection
216
+
217
+ Auto-detect verification commands from the project's package manifest and config:
218
+
219
+ ```bash
220
+ # Node.js projects — scan package.json scripts
221
+ Read: package.json → scripts
222
+
223
+ # Look for these common script names:
224
+ # test, test:unit, test:integration, test:e2e
225
+ # lint, lint:fix, eslint
226
+ # typecheck, type-check, tsc, check-types
227
+ # check (often runs multiple checks)
228
+ # build (catches type errors in compiled languages)
229
+
230
+ # Python projects
231
+ Check: Makefile, tox.ini, pyproject.toml for test/lint commands
232
+ # e.g., pytest, ruff check, mypy
233
+
234
+ # Go projects
235
+ # Standard: go test ./..., go vet ./...
236
+
237
+ # Rust projects
238
+ # Standard: cargo test, cargo clippy
239
+ ```
240
+
241
+ **Auto-detection rules for Node.js (most common):**
242
+
243
+ | `package.json` script | Maps to verification command |
244
+ |----------------------|------------------------------|
245
+ | `test` or `test:unit` | `npm test` or `npm run test:unit` |
246
+ | `lint` | `npm run lint` |
247
+ | `typecheck` or `type-check` or `check-types` | `npm run typecheck` (etc.) |
248
+ | `tsc` in scripts or `typescript` in devDeps | `npx tsc --noEmit` |
249
+ | `eslint` in devDeps but no `lint` script | `npx eslint .` |
250
+
251
+ **Advisory mode detection:** After identifying commands, run each one once silently to check baseline health. Commands that fail on the current codebase (before Forge changes anything) are marked `advisory: true` — they'll run but won't block execution. This prevents Forge from being blocked by pre-existing tech debt.
252
+
253
+ ```yaml
254
+ # Example auto-detected config:
255
+ verification:
256
+ commands:
257
+ - cmd: "npm run lint"
258
+ advisory: false # passes on current codebase
259
+ - cmd: "npm test"
260
+ advisory: false # passes on current codebase
261
+ - cmd: "npx tsc --noEmit"
262
+ advisory: true # FAILED on current codebase — pre-existing type errors
263
+ auto_fix: true
264
+ max_retries: 2
265
+ ```
266
+
267
+ Present findings to user:
268
+
269
+ *"I detected these verification commands from your project:*
270
+ - *`npm run lint` — passes currently*
271
+ - *`npm test` — passes currently*
272
+ - *`npx tsc --noEmit` — currently failing (pre-existing type errors, will run in advisory mode)*
273
+
274
+ *These will run automatically after each task to catch regressions. Want to add, remove, or adjust any?"*
275
+
276
+ ### Discovery Step 2: Design System Detection
277
+
278
+ ```bash
279
+ # Check dependencies for known UI libraries
280
+ Grep: package.json for: primereact, @mui/, @chakra-ui/, @radix-ui/, antd, @headlessui/
281
+ Grep: package.json for: tailwindcss, primeflex, @emotion/, styled-components
282
+
283
+ # Check actual usage in source
284
+ Grep: src/ for import patterns: "from 'primereact", "from '@mui/", "from '@/components/ui"
285
+ Grep: src/ for icon usage: "pi pi-", "Material", "lucide-react"
286
+
287
+ # Check for theme files
288
+ Glob: **/*theme*, **/*variables.scss, **/tailwind.config*, **/globals.css
289
+ ```
290
+
291
+ From this, auto-detect:
292
+ - Component library (and version from package.json)
293
+ - Icon set in use
294
+ - Layout system (PrimeFlex, Tailwind, MUI Grid, etc.)
295
+ - Theme approach (SCSS variables, CSS-in-JS, Tailwind config, design tokens)
296
+
297
+ ### Discovery Step 3: Pattern Analysis
298
+
299
+ ```bash
300
+ # Existing conventions
301
+ Glob: src/**/*.test.* OR src/**/*.spec.* # test patterns
302
+ Grep: src/ for error handling patterns
303
+ Grep: src/ for auth/session patterns
304
+ Bash: git log --oneline -20 # commit style
305
+
306
+ # Architecture patterns
307
+ Bash: ls -la src/ # top-level structure (pages, components, services, etc.)
308
+ Glob: src/**/index.{ts,tsx,js} # barrel exports
309
+ Grep: src/ for "import.*from.*@/" # path aliases
310
+ ```
311
+
312
+ ### Discovery Step 4: Present Findings
313
+
314
+ Present a structured summary to the user:
315
+
316
+ *"I've scanned your codebase. Here's what I found:*
317
+
318
+ *Project: {name} — {description from README or package.json}*
319
+ *Stack: {language} + {framework} + {database}*
320
+ *UI: {component library} with {icon set}, layout via {layout system}*
321
+ *Testing: {test framework}, {X} existing test files*
322
+ *Size: ~{N} source files, ~{N}K lines*
323
+ *Patterns: {commit style}, {folder structure approach}, {key conventions}*
324
+
325
+ *Does this look right? Anything I missed or got wrong?"*
326
+
327
+ ### Discovery Step 5: Design System Mapping
328
+
329
+ If a component library was detected:
330
+ 1. Check `.forge/templates/design-systems/` for an existing example config
331
+ 2. If found (e.g., PrimeReact) → copy it as starting point for `.forge/design-system.md`
332
+ 3. If not found → use `researching` skill to build a component mapping from docs
333
+ 4. **Cross-reference with actual usage**: scan the codebase for which components are already in use and prioritize those in the mapping
334
+ 5. Present mapping to user for validation
335
+
336
+ If no component library detected but UI files exist:
337
+ - Ask: *"I see UI code but no component library. Are you using a design system, or is this custom HTML/CSS?"*
338
+
339
+ ### Discovery Step 6: Constitutional Inference
340
+
341
+ Based on discovered patterns, **suggest** which articles to enable:
342
+
343
+ | Discovery | Suggested Articles |
344
+ |-----------|-------------------|
345
+ | Test files found | Article II: Test-First (already practicing) |
346
+ | Component library detected | Article V: Design System Fidelity |
347
+ | Auth/session patterns found | Article VI: Security by Default |
348
+ | Established conventions detected | Article IV: Consistency (preserve them) |
349
+ | package-lock.json or yarn.lock | Article I: Library-First (already using libraries) |
350
+ | Logging/monitoring deps | Article IX: Observability |
351
+
352
+ Present grouped recommendations and let user confirm, add, or remove articles.
353
+
354
+ ---
355
+
356
+ ## Greenfield Path: Build from Description
357
+
358
+ For new projects, ask the user to describe what they're building.
359
+
360
+ ### Greenfield Step 1: Project Basics
361
+
362
+ Ask the user to describe the project. From their description, fill in `.forge/project.yml`:
363
+
364
+ - Project name and description
365
+ - Primary goal
366
+ - Tech stack (language, framework, database, testing)
367
+ - Time and scope constraints
368
+ - Success criteria
369
+ - Known risks
370
+
371
+ Present a summary: *"Does this capture your project correctly? Anything to add or change?"*
372
+
373
+ ### Greenfield Step 2: Design System Setup
374
+
375
+ Ask: *"Does this project use a UI component library or design system?"*
376
+
377
+ **If yes**, ask which one and configure `design_system` in `project.yml`:
378
+
379
+ ```yaml
380
+ design_system:
381
+ library: "" # e.g., PrimeReact, Material-UI, shadcn/ui, Ant Design, Chakra UI
382
+ version: "" # e.g., 10.x, 5.x
383
+ icon_set: "" # e.g., PrimeIcons, Material Icons, Lucide, none
384
+ layout_system: "" # e.g., PrimeFlex, MUI Grid, Tailwind, CSS Grid
385
+ theme_approach: "" # e.g., SCSS variables, CSS-in-JS, Tailwind config, design tokens
386
+ docs_url: "" # e.g., https://primereact.org/datatable/
387
+ ```
388
+
389
+ Then:
390
+ 1. Check `.forge/templates/design-systems/` for a starter config
391
+ 2. If found → copy and customize for the project
392
+ 3. If not → use `researching` skill to build a component mapping from docs
393
+ 4. Write the mapping to `.forge/design-system.md`
394
+
395
+ **If no** (plain HTML/CSS, utility-only, or non-UI project):
396
+ - Set `design_system.library: none` in project.yml
397
+ - Skip design-system.md creation
398
+ - Disable Article V in the constitution
399
+
400
+ ### Greenfield Step 2.5: Verification Commands
401
+
402
+ Ask: *"What verification commands should run after each task? Common options:"*
403
+
404
+ | If your stack includes... | Suggested commands |
405
+ |--------------------------|-------------------|
406
+ | TypeScript | `npx tsc --noEmit` |
407
+ | ESLint / Biome | `npm run lint` |
408
+ | Jest / Vitest / Mocha | `npm test` |
409
+ | Python + pytest | `pytest` |
410
+ | Python + ruff | `ruff check .` |
411
+ | Go | `go test ./...`, `go vet ./...` |
412
+ | Rust | `cargo test`, `cargo clippy` |
413
+
414
+ Pre-fill based on the tech stack chosen in Step 1. User confirms or adjusts. Write to the `verification` section of `project.yml`.
415
+
416
+ If the user doesn't want verification gates: set `verification.commands: []` — the executing skill will skip the gate entirely.
417
+
418
+ ### Greenfield Step 3: Constitutional Setup
419
+
420
+ Present the 9 constitutional articles grouped by domain:
421
+
422
+ **Code quality** (recommended for most projects):
423
+ - Article I: Library-First — prefer proven libraries over custom code
424
+ - Article II: Test-First — tests before or alongside implementation
425
+ - Article III: Simplicity — simplest solution wins
426
+ - Article IV: Consistency — follow existing project patterns
427
+
428
+ **Design & UI** (enable if project has UI):
429
+ - Article V: Design System Fidelity — use the design system, don't fight it
430
+
431
+ **Security & data** (enable if auth, user data, or APIs involved):
432
+ - Article VI: Security by Default — auth, validation, secrets are requirements
433
+
434
+ **Architecture** (enable based on project complexity):
435
+ - Article VII: Integration-First — real dependencies before mocks
436
+ - Article VIII: Documentation-Driven — decisions documented where code lives
437
+ - Article IX: Observability — logging, error reporting, health checks
438
+
439
+ Ask: *"Which of these articles apply? I'd recommend [suggest based on stack and project type]. You can also add project-specific articles."*
440
+
441
+ ---
442
+
443
+ ## Finalize Init (Both Paths)
444
+
445
+ 1. Write `.forge/project.yml` with all gathered/discovered info (including `verification` section with detected/configured commands)
446
+ 2. Write `.forge/constitution.md` with selected articles
447
+ 3. Write `.forge/design-system.md` (if design system configured)
448
+ 4. Initialize milestone-aware state:
449
+ - Create `.forge/state/` directory
450
+ - Write `.forge/state/index.yml`:
451
+ ```yaml
452
+ milestones:
453
+ - id: 1
454
+ name: "{project name}"
455
+ status: active
456
+ last_updated: "{date}"
457
+ ```
458
+ - Write `.forge/state/milestone-1.yml`:
459
+ ```yaml
460
+ milestone:
461
+ id: 1
462
+ name: "{project name}"
463
+ current:
464
+ tier: null
465
+ phase: null
466
+ phase_name: ""
467
+ plan: null
468
+ task: null
469
+ status: not_started
470
+ ```
471
+ 5. Copy remaining templates as needed
472
+
473
+ Confirm: *"Project initialized. Here's what's set up: [summary]. Ready to start working?"*
474
+
475
+ After init completes, return control to the `forge` skill for tier detection and routing.
@@ -30,6 +30,17 @@ constraints:
30
30
  - "" # e.g., "No custom auth — use Clerk"
31
31
  - "" # e.g., "No server-side rendering"
32
32
 
33
+ verification:
34
+ commands: # Shell commands run after each task commit
35
+ - "" # e.g., "npm run lint"
36
+ - "" # e.g., "npm test"
37
+ - "" # e.g., "npx tsc --noEmit"
38
+ auto_fix: true # On failure, agent fixes and retries
39
+ max_retries: 2 # Max auto-fix attempts per command (0 = fail immediately)
40
+ # Commands are auto-detected during init from package.json scripts.
41
+ # Advisory mode: commands that were already failing before Forge started
42
+ # run but don't block — they log warnings only.
43
+
33
44
  success_criteria: # How do we know we're done?
34
45
  - "" # e.g., "User can create and edit posts"
35
46
  - "" # e.g., "All tests pass with >80% coverage"
@@ -41,6 +41,7 @@ Forge auto-detects complexity. Override with: "Use Quick/Standard/Full tier."
41
41
  | When you need to... | Use skill | Tier |
42
42
  |---------------------|-----------|------|
43
43
  | Start any task (entry point) | `forge` | All |
44
+ | Set up a new project (brownfield or greenfield) | `initializing` | First run only |
44
45
  | Investigate codebase, tech, or requirements | `researching` | Standard, Full |
45
46
  | Talk through approach, trade-offs, or revisit a plan | `discussing` | Standard, Full (also on-demand) |
46
47
  | Make architectural decisions with rationale | `architecting` | Full |
@@ -114,7 +115,7 @@ For Quick tier tasks, init is skipped — just do the work.
114
115
  ## State Management
115
116
 
116
117
  Project state lives in `.forge/`:
117
- - `project.yml` — Vision, stack, design system, constraints (< 5 KB)
118
+ - `project.yml` — Vision, stack, design system, verification commands, constraints (< 5 KB)
118
119
  - `constitution.md` — Active architectural gates (selected during init)
119
120
  - `design-system.md` — Component mapping table (generated during init)
120
121
  - `requirements.yml` — Structured requirements with `[NEEDS CLARIFICATION]` markers
@@ -145,6 +146,27 @@ When the executor encounters issues during building:
145
146
 
146
147
  Priority: Rule 4 first (stop if architectural). Then Rules 1-3 (auto-fix). Uncertain? → Rule 4 (ask).
147
148
 
149
+ ## Verification Gates
150
+
151
+ After each task commit, the executor runs configured verification commands from `project.yml`:
152
+
153
+ ```yaml
154
+ verification:
155
+ commands:
156
+ - cmd: "npm run lint"
157
+ - cmd: "npm test"
158
+ - cmd: "npx tsc --noEmit"
159
+ advisory: true # pre-existing failures — warn only
160
+ auto_fix: true # agent fixes and retries on failure
161
+ max_retries: 2 # max auto-fix attempts per command
162
+ ```
163
+
164
+ - **Auto-detected during init** from `package.json` scripts (test, lint, typecheck)
165
+ - **Advisory mode**: commands that were already failing before Forge started run but don't block
166
+ - **Auto-fix loop**: on failure, agent reads output, fixes code, amends commit, re-runs (up to max_retries)
167
+ - **3-strike integration**: verification retries count toward the task's 3-strike limit
168
+ - Empty `commands` list = no verification gate (opt-out)
169
+
148
170
  ## Beads Integration (Optional)
149
171
 
150
172
  When Beads is installed, Forge gains persistent cross-session memory: