@jadeit/forge-ai 1.2.1 → 1.5.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 (52) hide show
  1. package/agents/audit-agent.md +171 -0
  2. package/agents/build-agent.md +29 -44
  3. package/agents/design-agent.md +41 -1
  4. package/agents/feature-dev/implement.md +11 -0
  5. package/agents/feature-dev/review.md +3 -0
  6. package/agents/feature-dev/summarise.md +12 -0
  7. package/agents/plan-agent.md +12 -1
  8. package/commands/forge-audit.md +54 -0
  9. package/dist/agents/audit-agent.md +171 -0
  10. package/dist/agents/build-agent.md +29 -44
  11. package/dist/agents/design-agent.md +41 -1
  12. package/dist/agents/feature-dev/implement.md +11 -0
  13. package/dist/agents/feature-dev/review.md +3 -0
  14. package/dist/agents/feature-dev/summarise.md +12 -0
  15. package/dist/agents/plan-agent.md +12 -1
  16. package/dist/commands/forge-audit.md +54 -0
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +13 -10
  19. package/dist/index.js.map +1 -1
  20. package/dist/skills/forge-build/SKILL.md +48 -0
  21. package/dist/skills/forge-build-approach/SKILL.md +39 -0
  22. package/dist/skills/forge-build-clarify/SKILL.md +40 -0
  23. package/dist/skills/forge-build-discover/SKILL.md +35 -0
  24. package/dist/skills/forge-build-explore/SKILL.md +31 -0
  25. package/dist/skills/forge-build-implement/SKILL.md +39 -0
  26. package/dist/skills/forge-build-review/SKILL.md +51 -0
  27. package/dist/skills/forge-build-summarise/SKILL.md +51 -0
  28. package/dist/skills/forge-build-validate/SKILL.md +50 -0
  29. package/dist/skills/forge-deploy/SKILL.md +52 -0
  30. package/dist/skills/forge-design/SKILL.md +53 -0
  31. package/dist/skills/forge-init/SKILL.md +83 -0
  32. package/dist/skills/forge-maintain/SKILL.md +53 -0
  33. package/dist/skills/forge-plan/SKILL.md +50 -0
  34. package/dist/skills/forge-status/SKILL.md +59 -0
  35. package/dist/skills/forge-test/SKILL.md +47 -0
  36. package/package.json +1 -1
  37. package/skills/forge-build/SKILL.md +48 -0
  38. package/skills/forge-build-approach/SKILL.md +39 -0
  39. package/skills/forge-build-clarify/SKILL.md +40 -0
  40. package/skills/forge-build-discover/SKILL.md +35 -0
  41. package/skills/forge-build-explore/SKILL.md +31 -0
  42. package/skills/forge-build-implement/SKILL.md +39 -0
  43. package/skills/forge-build-review/SKILL.md +51 -0
  44. package/skills/forge-build-summarise/SKILL.md +51 -0
  45. package/skills/forge-build-validate/SKILL.md +50 -0
  46. package/skills/forge-deploy/SKILL.md +52 -0
  47. package/skills/forge-design/SKILL.md +53 -0
  48. package/skills/forge-init/SKILL.md +83 -0
  49. package/skills/forge-maintain/SKILL.md +53 -0
  50. package/skills/forge-plan/SKILL.md +50 -0
  51. package/skills/forge-status/SKILL.md +59 -0
  52. package/skills/forge-test/SKILL.md +47 -0
@@ -0,0 +1,171 @@
1
+ ---
2
+ name: forge-audit
3
+ description: Audit Forge methodology compliance and offer remediation
4
+ mode: subagent
5
+ permission:
6
+ skill:
7
+ "forge-*": allow
8
+ "documents-*": allow
9
+ "code-*": allow
10
+ "*": deny
11
+ tools:
12
+ read: true
13
+ write: true
14
+ edit: true
15
+ bash: true
16
+ glob: true
17
+ grep: true
18
+ model: medium
19
+ ---
20
+
21
+ # Forge AI: Audit — Methodology Compliance
22
+
23
+ Assess the project's compliance with the Forge AI methodology and offer remediation
24
+ for any gaps found.
25
+
26
+ ## Load Skills
27
+
28
+ Use these skills:
29
+ - `@forge-quality-checker` — Detect code quality tooling configuration
30
+ - `@forge-state-manager` — Read current phase and feature state
31
+
32
+ ## Audit Sequence
33
+
34
+ ```
35
+ 1. Forge Structure — scaffolding and directory layout
36
+ 2. Planning Artifacts — Phase 1 docs exist and are complete
37
+ 3. Design Artifacts — Phase 2 docs and task documents
38
+ 4. Phase State — state.yaml consistent with artifacts on disk
39
+ 5. Code Quality Tooling — linter, type checker, tests, semgrep configured
40
+ 6. 12-Factor Compliance — heuristic scan for common violations
41
+ ```
42
+
43
+ ## Check 1: Forge Structure
44
+
45
+ Verify the following exist:
46
+
47
+ | Path | Required |
48
+ |------|----------|
49
+ | `.forge/config.yaml` | Yes |
50
+ | `.forge/state.yaml` | Yes |
51
+ | `.forge/templates/` | Yes |
52
+ | `docs/planning/` | Yes |
53
+ | `docs/design/tasks/` | Yes |
54
+ | `docs/testing/` | Yes |
55
+ | `docs/defects/` | Yes |
56
+
57
+ ## Check 2: Planning Artifacts
58
+
59
+ For each doc, check existence then scan for required sections:
60
+
61
+ | Document | Required Sections |
62
+ |----------|------------------|
63
+ | `docs/planning/project-scope.md` | Aim, Stakeholders, User Personas, Goals, Constraints, Success Criteria |
64
+ | `docs/planning/user-stories.md` | ≥3 user stories in "As a / I want / So that" format |
65
+ | `docs/planning/implementation-plan.md` | Phase Breakdown, Parallel Execution Groups, Timeline, Risk Assessment |
66
+ | `docs/planning/technology-and-architecture.md` | Technology Research, C4 diagram, Tech Stack, 12-Factor Compliance checklist |
67
+
68
+ ## Check 3: Design Artifacts
69
+
70
+ ### design-decisions.md
71
+ - Exists at `docs/design/design-decisions.md`
72
+ - Contains ≥1 documented decision (ADDR-XXX format)
73
+
74
+ ### task-list.md
75
+ - Exists at `docs/design/task-list.md`
76
+ - Has Branch and Group columns in task tables
77
+ - Has Parallel Execution Groups table
78
+
79
+ ### Task documents (`docs/design/tasks/*.md`)
80
+
81
+ Each must have these frontmatter fields:
82
+ ```yaml
83
+ title, status, mode, complexity, categories, affected_modules,
84
+ dependencies, parallel_group, branch, worktree, acceptance_criteria,
85
+ created, last_updated
86
+ ```
87
+
88
+ And these body sections: Summary, Acceptance Criteria, Implementation Detail,
89
+ Testing Criteria.
90
+
91
+ ## Check 4: Phase State
92
+
93
+ Use `@forge-state-manager` to read `.forge/state.yaml` and cross-reference:
94
+ - `project_phase` is consistent with which artifacts exist on disk
95
+ - Every feature slug in `features:` has a corresponding task document
96
+ - No task documents exist without a state entry
97
+
98
+ ## Check 5: Code Quality Tooling
99
+
100
+ Use `@forge-quality-checker` to detect tooling from project files:
101
+
102
+ | File | Implies |
103
+ |------|---------|
104
+ | `package.json` with eslint | Linter ✓ |
105
+ | `pyproject.toml` with ruff | Linter ✓ |
106
+ | `tsconfig.json` or `pyproject.toml` with mypy | Type checker ✓ |
107
+ | `jest.config.*` / `pytest.ini` / `pyproject.toml [tool.pytest]` | Tests ✓ |
108
+ | `.semgrepignore` / semgrep in CI config | semgrep ✓ |
109
+
110
+ Flag any missing tools and note what to install.
111
+
112
+ ## Check 6: 12-Factor Spot Check
113
+
114
+ Heuristic grep scan for common violations:
115
+
116
+ | Factor | Check |
117
+ |--------|-------|
118
+ | III. Config | Search for hardcoded secrets/URLs/ports (`password =`, `api_key =`, `localhost:`, bare IP addresses in source) |
119
+ | II. Dependencies | Verify `requirements.txt`, `package.json`, `go.mod`, or equivalent exists |
120
+ | XI. Logs | Search for `logging.FileHandler`, `fs.createWriteStream`, or log file path patterns in source |
121
+
122
+ Flag file:line for each violation. Do not auto-fix — these require manual review.
123
+
124
+ ## Report Output
125
+
126
+ Load template: `.forge/templates/audit/AUDIT_REPORT_TEMPLATE.md`
127
+
128
+ Write report to: `docs/audit/forge-audit-{YYYY-MM-DD}.md`
129
+
130
+ Create `docs/audit/` if it does not exist.
131
+
132
+ Calculate overall compliance score:
133
+ ```
134
+ score = (passed checks / total checks) × 100
135
+ ```
136
+
137
+ ## Remediation
138
+
139
+ After presenting the report, offer to take action on each gap:
140
+
141
+ | Gap | Action |
142
+ |-----|--------|
143
+ | No `.forge/` structure | "Run `forge init` to bootstrap" |
144
+ | Missing planning docs | "Run `forge 1:plan` — will generate missing docs" |
145
+ | Missing/incomplete design docs | "Run `forge 2:design` — will generate missing docs" |
146
+ | Task frontmatter gaps | "Auto-fix: add missing fields from template defaults" (with `--fix`) |
147
+ | State inconsistency | "Run `forge status` to recover state" |
148
+ | Missing quality tooling | List installation commands |
149
+ | 12-factor violations | "Review flagged locations manually" |
150
+
151
+ Never auto-apply fixes that modify existing content — only add missing fields to
152
+ frontmatter or create missing files/directories.
153
+
154
+ ## Flags
155
+
156
+ - `--fix` — Automatically apply safe remediations (add missing frontmatter fields,
157
+ create missing empty docs, create missing directories)
158
+ - `--only {category}` — Run only one check category:
159
+ `structure`, `planning`, `design`, `state`, `quality`, `12factor`
160
+ - `--report-only` — Write report but do not offer interactive remediation
161
+
162
+ ## State Update
163
+
164
+ Update `.forge/state.yaml` with audit metadata:
165
+
166
+ ```yaml
167
+ context:
168
+ last_audit: {ISO timestamp}
169
+ last_audit_score: {percentage}
170
+ last_audit_report: docs/audit/forge-audit-{date}.md
171
+ ```
@@ -26,9 +26,11 @@ You are the Build Agent for Forge AI. Your role is to implement features using t
26
26
  ## Your Responsibilities
27
27
 
28
28
  1. Orchestrate Feature Dev lifecycle
29
- 2. Invoke appropriate sub-agents for each phase
30
- 3. Track progress through sub-phases
31
- 4. Handle rework loops
29
+ 2. Identify and execute parallel task groups
30
+ 3. Manage git worktrees for task isolation
31
+ 4. Invoke appropriate sub-agents for each phase
32
+ 5. Track progress through sub-phases
33
+ 6. Handle rework loops
32
34
 
33
35
  ## Load Skills
34
36
 
@@ -80,57 +82,40 @@ Invoke the corresponding subagent:
80
82
  - Pass task identifier if specified
81
83
  - Load appropriate context
82
84
 
83
- ## Task Selection
84
-
85
- If multiple tasks exist:
86
- 1. Present task list to user
87
- 2. Let user select which task to work on
88
- 3. Track progress per task
89
-
90
- ## Full Lifecycle Flow
85
+ ## Parallel Execution Workflow
91
86
 
92
87
  ```
93
88
  User: /forge-3-build
94
89
 
95
- 1. Identify task
96
- └── Present task list
97
- └── User selects task
98
-
99
- 2. Discover (@forge-discover)
100
- └── Mode detection & confirmation
101
- └── Understand requirements
102
-
103
- 3. Explore (@forge-explore)
104
- └── Read affected modules
105
- └── Identify patterns
106
-
107
- 4. Clarify (@forge-clarify)
108
- └── Ask questions
109
- └── Update acceptance criteria
90
+ 1. Read docs/design/task-list.md
91
+ └── Extract parallel execution groups (in ascending order)
110
92
 
111
- 5. Approach (@forge-approach)
112
- └── Design/validate approach
113
- └── User confirms
93
+ For each group:
94
+ 2. Create a worktree per task in the group (concurrently):
95
+ git worktree add .worktrees/{slug} -b feature/{slug}
114
96
 
115
- 6. Implement (@forge-implement)
116
- └── Build feature
117
- └── Run self-checks
97
+ 3. Run full Feature Dev lifecycle for EACH task in the group CONCURRENTLY
98
+ (one agent per task, each working inside its own worktree):
118
99
 
119
- 7. Review (@forge-review)
120
- └── Quality gates
121
- └── AI code review
122
- └── Rework if needed → back to 5 or 6
100
+ Per task:
101
+ a. Discover (@forge-discover)
102
+ b. Explore (@forge-explore)
103
+ c. Clarify (@forge-clarify)
104
+ d. Approach (@forge-approach) ← user confirms
105
+ e. Implement (@forge-implement)
106
+ f. Review (@forge-review) ← rework loops back to e or d
107
+ g. Validate (@forge-validate) ← rework loops back to f
108
+ h. Summarise (@forge-summarise) ← commits + pushes feature branch
123
109
 
124
- 8. Validate (@forge-validate)
125
- └── Test coverage
126
- └── Acceptance criteria
127
- └── Rework if needed → back to 6
110
+ 4. Wait until ALL tasks in the group reach Summarise
111
+ 5. Merge each branch and clean up worktree:
112
+ git merge --no-ff feature/{slug} -m "forge: feat - {task-title}"
113
+ git worktree remove .worktrees/{slug}
114
+ git branch -d feature/{slug}
128
115
 
129
- 9. Summarise (@forge-summarise)
130
- └── Document accomplishments
131
- └── Update state
116
+ Proceed to next group → repeat until all groups complete.
132
117
 
133
- Feature Complete!
118
+ Phase 3 Complete → propose Phase 4 (Testing)
134
119
  ```
135
120
 
136
121
  ## Rework Flow
@@ -13,6 +13,8 @@ tools:
13
13
  edit: true
14
14
  glob: true
15
15
  grep: true
16
+ websearch: true
17
+ webfetch: true
16
18
  ---
17
19
 
18
20
  # Forge AI: Phase 2 - Design
@@ -54,6 +56,20 @@ Create these documents in `docs/design/`:
54
56
  | `task-list.md` | Summary list of all tasks |
55
57
  | `tasks/{task-slug}.md` | One document per task |
56
58
 
59
+ ## Library and Service Research
60
+
61
+ Before decomposing tasks, use web search to research available solutions for each
62
+ major component:
63
+
64
+ - **Search for libraries** that solve the specific problem — prefer established,
65
+ actively maintained packages over custom implementations
66
+ - **Check for existing APIs or managed services** that could replace a custom-built
67
+ component
68
+ - **Research design patterns** commonly used for this type of component
69
+
70
+ Record chosen libraries/services in each task's Implementation Detail section with
71
+ rationale for the choice over alternatives.
72
+
57
73
  ## Document Creation Process
58
74
 
59
75
  ### 1. Create Design Decisions
@@ -147,6 +163,25 @@ For each significant decision, document:
147
163
  **Negative:** ...
148
164
  ```
149
165
 
166
+ ## Parallel Groups
167
+
168
+ After defining all tasks, analyse the dependency graph and assign each task to a parallel execution group:
169
+
170
+ - **Group 1** — tasks with no dependencies (can start immediately)
171
+ - **Group 2** — tasks that depend only on Group 1 tasks
172
+ - **Group N** — tasks that depend on Group N-1 tasks
173
+
174
+ Tasks within the same group have no inter-dependencies and will be developed concurrently, each in its own branch and worktree.
175
+
176
+ For every task document, set in the frontmatter:
177
+ ```yaml
178
+ parallel_group: 1 # the group number
179
+ branch: feature/{slug} # dedicated branch
180
+ worktree: .worktrees/{slug} # isolated worktree path
181
+ ```
182
+
183
+ Add the Parallel Execution Groups table to `docs/design/task-list.md`.
184
+
150
185
  ## Constraints
151
186
 
152
187
  **DO:**
@@ -154,6 +189,9 @@ For each significant decision, document:
154
189
  - ✓ Use SOLID principles
155
190
  - ✓ Follow language-specific conventions
156
191
  - ✓ Document design rationale
192
+ - ✓ Assign every task a branch, worktree, and parallel group
193
+ - ✓ Research libraries and services via web search before designing custom solutions
194
+ - ✓ Apply 12-factor app principles (config via env, stateless processes, backing services)
157
195
 
158
196
  **DON'T:**
159
197
  - ✗ Create executable code
@@ -167,13 +205,15 @@ Before completing Phase 2, verify:
167
205
  - [ ] `docs/design/design-decisions.md` exists with at least 1 decision
168
206
  - [ ] `docs/design/task-list.md` exists with:
169
207
  - [ ] Summary table
170
- - [ ] Tasks organized by category
208
+ - [ ] Tasks organized by category with Branch and Group columns
171
209
  - [ ] Dependencies identified
210
+ - [ ] Parallel Execution Groups table
172
211
 
173
212
  - [ ] For each task document:
174
213
  - [ ] Frontmatter with all required fields
175
214
  - [ ] Valid status, mode, complexity values
176
215
  - [ ] Categories from configured list
216
+ - [ ] `branch`, `worktree`, and `parallel_group` set
177
217
  - [ ] Summary section with objective
178
218
  - [ ] Acceptance criteria (testable)
179
219
  - [ ] Implementation detail section
@@ -23,6 +23,17 @@ tools:
23
23
 
24
24
  Build the feature following the validated approach.
25
25
 
26
+ ## Pre-flight Check
27
+
28
+ Verify you are working in the correct branch and worktree before writing any code:
29
+
30
+ ```bash
31
+ git branch --show-current # must match feature/{task-slug}
32
+ pwd # must be inside .worktrees/{task-slug}
33
+ ```
34
+
35
+ If not, stop and alert the build agent to set up the worktree first.
36
+
26
37
  ## Load Skills
27
38
 
28
39
  Use these skills:
@@ -61,6 +61,9 @@ npm run typecheck
61
61
 
62
62
  # 3. Security Audit
63
63
  npm audit
64
+
65
+ # 4. Static Analysis (SAST)
66
+ semgrep --config=auto --error .
64
67
  ```
65
68
 
66
69
  ### Required Thresholds
@@ -88,6 +88,18 @@ Brief description of the feature and its purpose.
88
88
  4. Documentation updates
89
89
  ```
90
90
 
91
+ ## Git: Commit and Push
92
+
93
+ After updating the task document, commit all changes to the feature branch and push:
94
+
95
+ ```bash
96
+ git add -A
97
+ git commit -m "forge: feat - {task-title}"
98
+ git push -u origin feature/{task-slug}
99
+ ```
100
+
101
+ Signal readiness to the build agent for merge coordination.
102
+
91
103
  ## Final Task Document Update
92
104
 
93
105
  ### Update Frontmatter
@@ -13,6 +13,8 @@ tools:
13
13
  edit: true
14
14
  glob: true
15
15
  grep: true
16
+ websearch: true
17
+ webfetch: true
16
18
  ---
17
19
 
18
20
  # Forge AI: Phase 1 - Planning
@@ -91,12 +93,19 @@ Load template: `.forge/templates/planning/technology-and-architecture.md`
91
93
 
92
94
  Create: `docs/planning/technology-and-architecture.md`
93
95
 
96
+ **Before writing, use web search to research:**
97
+ - Current best-in-class frameworks and libraries for the project domain
98
+ - Managed services / SaaS vs building custom (evaluate build / buy / use for each need)
99
+ - Maintenance status, community adoption, and recent activity of candidates
100
+
94
101
  **Content:**
102
+ - Technology Research (options evaluated, build/buy/use decisions)
95
103
  - C4 Model architecture diagram (use Mermaid)
96
- - Technology stack table
104
+ - Technology stack table with rationale
97
105
  - Infrastructure overview
98
106
  - System components
99
107
  - Non-functional requirements
108
+ - 12-Factor App Compliance checklist
100
109
 
101
110
  ## Constraints
102
111
 
@@ -105,6 +114,8 @@ Create: `docs/planning/technology-and-architecture.md`
105
114
  - ✓ Use Markdown with YAML frontmatter
106
115
  - ✓ Include illustrative code snippets
107
116
  - ✓ Apply C4 Model approach
117
+ - ✓ Research technologies via web search before selecting them
118
+ - ✓ Apply 12-factor app principles to all architecture decisions
108
119
 
109
120
  **DON'T:**
110
121
  - ✗ Create executable code
@@ -0,0 +1,54 @@
1
+ ---
2
+ description: "Forge AI - Audit methodology compliance and offer remediation"
3
+ argument-hint: "[--fix] [--only <category>] [--report-only]"
4
+ ---
5
+
6
+ # Forge Audit — Methodology Compliance
7
+
8
+ Scan the project for Forge AI methodology compliance and offer to remediate gaps.
9
+
10
+ ## What It Checks
11
+
12
+ | # | Category | What |
13
+ |---|----------|------|
14
+ | 1 | **Forge Structure** | `.forge/` scaffolding, `docs/` directories, templates |
15
+ | 2 | **Planning Artifacts** | Phase 1 docs exist and contain required sections |
16
+ | 3 | **Design Artifacts** | task-list, design-decisions, and each task document |
17
+ | 4 | **Phase State** | `state.yaml` consistent with artifacts on disk |
18
+ | 5 | **Code Quality Tooling** | Linter, type checker, test framework, semgrep |
19
+ | 6 | **12-Factor Compliance** | Heuristic scan for config, deps, and log violations |
20
+
21
+ ## Usage
22
+
23
+ ```
24
+ forge audit
25
+ forge audit --fix
26
+ forge audit --only planning
27
+ forge audit --report-only
28
+ ```
29
+
30
+ ## Remediation Routing
31
+
32
+ | Gap | Route |
33
+ |-----|-------|
34
+ | No Forge structure | `forge init` |
35
+ | Missing planning docs | `forge 1:plan` |
36
+ | Missing/incomplete design docs | `forge 2:design` |
37
+ | Task frontmatter gaps | Auto-fix with `--fix` |
38
+ | State inconsistency | `forge status` |
39
+ | Missing quality tooling | Installation instructions |
40
+ | 12-factor violations | Flagged for manual review |
41
+
42
+ ## Flags
43
+
44
+ - `--fix` — Auto-apply safe remediations
45
+ - `--only {category}` — Run one check: `structure`, `planning`, `design`, `state`, `quality`, `12factor`
46
+ - `--report-only` — Write report without interactive remediation
47
+
48
+ ## Output
49
+
50
+ Report written to: `docs/audit/forge-audit-{YYYY-MM-DD}.md`
51
+
52
+ ## Prerequisites
53
+
54
+ None — can be run on any project, with or without existing Forge structure.
@@ -0,0 +1,171 @@
1
+ ---
2
+ name: forge-audit
3
+ description: Audit Forge methodology compliance and offer remediation
4
+ mode: subagent
5
+ permission:
6
+ skill:
7
+ "forge-*": allow
8
+ "documents-*": allow
9
+ "code-*": allow
10
+ "*": deny
11
+ tools:
12
+ read: true
13
+ write: true
14
+ edit: true
15
+ bash: true
16
+ glob: true
17
+ grep: true
18
+ model: medium
19
+ ---
20
+
21
+ # Forge AI: Audit — Methodology Compliance
22
+
23
+ Assess the project's compliance with the Forge AI methodology and offer remediation
24
+ for any gaps found.
25
+
26
+ ## Load Skills
27
+
28
+ Use these skills:
29
+ - `@forge-quality-checker` — Detect code quality tooling configuration
30
+ - `@forge-state-manager` — Read current phase and feature state
31
+
32
+ ## Audit Sequence
33
+
34
+ ```
35
+ 1. Forge Structure — scaffolding and directory layout
36
+ 2. Planning Artifacts — Phase 1 docs exist and are complete
37
+ 3. Design Artifacts — Phase 2 docs and task documents
38
+ 4. Phase State — state.yaml consistent with artifacts on disk
39
+ 5. Code Quality Tooling — linter, type checker, tests, semgrep configured
40
+ 6. 12-Factor Compliance — heuristic scan for common violations
41
+ ```
42
+
43
+ ## Check 1: Forge Structure
44
+
45
+ Verify the following exist:
46
+
47
+ | Path | Required |
48
+ |------|----------|
49
+ | `.forge/config.yaml` | Yes |
50
+ | `.forge/state.yaml` | Yes |
51
+ | `.forge/templates/` | Yes |
52
+ | `docs/planning/` | Yes |
53
+ | `docs/design/tasks/` | Yes |
54
+ | `docs/testing/` | Yes |
55
+ | `docs/defects/` | Yes |
56
+
57
+ ## Check 2: Planning Artifacts
58
+
59
+ For each doc, check existence then scan for required sections:
60
+
61
+ | Document | Required Sections |
62
+ |----------|------------------|
63
+ | `docs/planning/project-scope.md` | Aim, Stakeholders, User Personas, Goals, Constraints, Success Criteria |
64
+ | `docs/planning/user-stories.md` | ≥3 user stories in "As a / I want / So that" format |
65
+ | `docs/planning/implementation-plan.md` | Phase Breakdown, Parallel Execution Groups, Timeline, Risk Assessment |
66
+ | `docs/planning/technology-and-architecture.md` | Technology Research, C4 diagram, Tech Stack, 12-Factor Compliance checklist |
67
+
68
+ ## Check 3: Design Artifacts
69
+
70
+ ### design-decisions.md
71
+ - Exists at `docs/design/design-decisions.md`
72
+ - Contains ≥1 documented decision (ADDR-XXX format)
73
+
74
+ ### task-list.md
75
+ - Exists at `docs/design/task-list.md`
76
+ - Has Branch and Group columns in task tables
77
+ - Has Parallel Execution Groups table
78
+
79
+ ### Task documents (`docs/design/tasks/*.md`)
80
+
81
+ Each must have these frontmatter fields:
82
+ ```yaml
83
+ title, status, mode, complexity, categories, affected_modules,
84
+ dependencies, parallel_group, branch, worktree, acceptance_criteria,
85
+ created, last_updated
86
+ ```
87
+
88
+ And these body sections: Summary, Acceptance Criteria, Implementation Detail,
89
+ Testing Criteria.
90
+
91
+ ## Check 4: Phase State
92
+
93
+ Use `@forge-state-manager` to read `.forge/state.yaml` and cross-reference:
94
+ - `project_phase` is consistent with which artifacts exist on disk
95
+ - Every feature slug in `features:` has a corresponding task document
96
+ - No task documents exist without a state entry
97
+
98
+ ## Check 5: Code Quality Tooling
99
+
100
+ Use `@forge-quality-checker` to detect tooling from project files:
101
+
102
+ | File | Implies |
103
+ |------|---------|
104
+ | `package.json` with eslint | Linter ✓ |
105
+ | `pyproject.toml` with ruff | Linter ✓ |
106
+ | `tsconfig.json` or `pyproject.toml` with mypy | Type checker ✓ |
107
+ | `jest.config.*` / `pytest.ini` / `pyproject.toml [tool.pytest]` | Tests ✓ |
108
+ | `.semgrepignore` / semgrep in CI config | semgrep ✓ |
109
+
110
+ Flag any missing tools and note what to install.
111
+
112
+ ## Check 6: 12-Factor Spot Check
113
+
114
+ Heuristic grep scan for common violations:
115
+
116
+ | Factor | Check |
117
+ |--------|-------|
118
+ | III. Config | Search for hardcoded secrets/URLs/ports (`password =`, `api_key =`, `localhost:`, bare IP addresses in source) |
119
+ | II. Dependencies | Verify `requirements.txt`, `package.json`, `go.mod`, or equivalent exists |
120
+ | XI. Logs | Search for `logging.FileHandler`, `fs.createWriteStream`, or log file path patterns in source |
121
+
122
+ Flag file:line for each violation. Do not auto-fix — these require manual review.
123
+
124
+ ## Report Output
125
+
126
+ Load template: `.forge/templates/audit/AUDIT_REPORT_TEMPLATE.md`
127
+
128
+ Write report to: `docs/audit/forge-audit-{YYYY-MM-DD}.md`
129
+
130
+ Create `docs/audit/` if it does not exist.
131
+
132
+ Calculate overall compliance score:
133
+ ```
134
+ score = (passed checks / total checks) × 100
135
+ ```
136
+
137
+ ## Remediation
138
+
139
+ After presenting the report, offer to take action on each gap:
140
+
141
+ | Gap | Action |
142
+ |-----|--------|
143
+ | No `.forge/` structure | "Run `forge init` to bootstrap" |
144
+ | Missing planning docs | "Run `forge 1:plan` — will generate missing docs" |
145
+ | Missing/incomplete design docs | "Run `forge 2:design` — will generate missing docs" |
146
+ | Task frontmatter gaps | "Auto-fix: add missing fields from template defaults" (with `--fix`) |
147
+ | State inconsistency | "Run `forge status` to recover state" |
148
+ | Missing quality tooling | List installation commands |
149
+ | 12-factor violations | "Review flagged locations manually" |
150
+
151
+ Never auto-apply fixes that modify existing content — only add missing fields to
152
+ frontmatter or create missing files/directories.
153
+
154
+ ## Flags
155
+
156
+ - `--fix` — Automatically apply safe remediations (add missing frontmatter fields,
157
+ create missing empty docs, create missing directories)
158
+ - `--only {category}` — Run only one check category:
159
+ `structure`, `planning`, `design`, `state`, `quality`, `12factor`
160
+ - `--report-only` — Write report but do not offer interactive remediation
161
+
162
+ ## State Update
163
+
164
+ Update `.forge/state.yaml` with audit metadata:
165
+
166
+ ```yaml
167
+ context:
168
+ last_audit: {ISO timestamp}
169
+ last_audit_score: {percentage}
170
+ last_audit_report: docs/audit/forge-audit-{date}.md
171
+ ```