forge-orkes 0.3.11 → 0.3.14

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.
@@ -1,26 +1,26 @@
1
1
  ---
2
2
  name: reviewing
3
- description: "Post-verification health gate. Runs security audit (10 categories), architecture audit (4 dimensions), and refactoring scan (6 categories) in parallel. Determines if the milestone can ship and catalogs improvement opportunities."
3
+ description: "Post-verification health gate. Security (10), architecture (4), refactoring (6) in parallel. Gates shipping + catalogs improvements."
4
4
  ---
5
5
 
6
- # Reviewing: Health Audit + Refactoring Review
6
+ # Reviewing
7
7
 
8
- The pre-completion gate. After `verifying` confirms deliverables, assess codebase health and catalog improvements. Three parallel scans produce a structured report that gates milestone completion.
8
+ After `verifying` passes, 3 parallel scans assess health + catalog improvements.
9
9
 
10
10
  ## Triggers
11
11
 
12
- - **Auto:** after `verifying` returns PASSED (Standard/Full tiers)
13
- - **Manual:** on user request
12
+ - **Auto:** after `verifying` PASSED (Standard/Full)
13
+ - **Manual:** user request
14
14
 
15
15
  ## Process
16
16
 
17
- 1. Read project context from `.forge/project.yml`
18
- 2. Scope the review — glob source files, determine milestone diff
19
- 3. Spawn three parallel subagents: Security + Architecture + Refactoring
20
- 4. Collect results, score per-category, determine overall status
21
- 5. Write health report to `.forge/audits/milestone-{id}-health-report.md`
22
- 6. Write accepted refactoring items to `.forge/refactor-backlog.yml`
23
- 7. Route: healthycomplete, criticaluser decides
17
+ 1. Read context from `.forge/project.yml`
18
+ 2. Scope -- glob sources, milestone diff
19
+ 3. Spawn 3 subagents: Security + Architecture + Refactoring
20
+ 4. Score, determine status
21
+ 5. Write `.forge/audits/milestone-{id}-health-report.md`
22
+ 6. Write `.forge/refactor-backlog.yml`
23
+ 7. Route: healthy->complete, critical->user decides
24
24
 
25
25
  ## Step 1: Read Context
26
26
 
@@ -29,43 +29,34 @@ Read: .forge/project.yml → tech stack, framework, database, dependencies
29
29
  Read: .forge/state/milestone-{id}.yml → milestone ID and name
30
30
  Read: .forge/constitution.md → active architectural gates (if exists)
31
31
  Read: .forge/refactor-backlog.yml → existing backlog items (if any)
32
+ Read: .forge/deferred-issues.md → pre-existing failures logged during execution (if exists)
32
33
  ```
33
34
 
34
- Skip inapplicable security categories based on tech stack:
35
- - No database → SQL/NoSQL Injection N/A
36
- - No frontend → XSS Prevention N/A
37
- - No CI/CD config → Pipeline Security N/A
35
+ Skip by stack: no DB->SQL/NoSQL N/A, no frontend->XSS N/A, no CI/CD->Pipeline N/A.
38
36
 
39
- Determine the milestone's git diff starting point:
40
- - Check git log for the milestone start commit
41
- - Fallback: first commit after previous milestone's completion date
42
- - Last resort: ask the user
37
+ Diff start: git log milestone start -> fallback: first commit after prev milestone -> ask user.
43
38
 
44
- ## Step 2: Scope the Review
39
+ ## Step 2: Scope
45
40
 
46
41
  ```
47
- Glob: src/**/*.{ts,tsx,js,jsx,py,go,rs,java} (adapt to project language)
42
+ Glob: src/**/*.{ts,tsx,js,jsx,py,go,rs,java} (adapt to language)
48
43
  Glob: **/*.env*, **/docker-compose*, **/.github/workflows/*
49
44
  Glob: **/next.config*, **/vite.config*, **/webpack.config*
50
45
  ```
51
46
 
52
- Get diff file list for refactoring scan:
53
47
  ```
54
48
  git diff --name-only {milestone_start}..HEAD
55
49
  ```
56
50
 
57
- Present scope summary:
58
- *"Review scope: {N} source files, {N} config files, {N} changed files. Scanning security (10), architecture (4), refactoring (6)."*
51
+ Present: *"Scope: {N} source, {N} config, {N} changed. Scanning security(10), arch(4), refactoring(6)."*
59
52
 
60
- Build explicit file lists for each subagent — pass paths, not globs.
53
+ File lists per subagent (paths, not globs).
61
54
 
62
- ## Step 3: Spawn Parallel Scans
55
+ ## Step 3: Parallel Scans
63
56
 
64
- Spawn all three as fresh-context subagents. Each receives: explicit file list, tech stack from `project.yml`, instructions below.
57
+ Fresh-context subagents with file list + tech stack.
65
58
 
66
- ### Part 1: Security Audit (subagent)
67
-
68
- **10 Security Categories:**
59
+ ### Part 1: Security Audit
69
60
 
70
61
  | # | Category | Checks |
71
62
  |---|----------|--------|
@@ -80,18 +71,7 @@ Spawn all three as fresh-context subagents. Each receives: explicit file list, t
80
71
  | 9 | HTTP Security Headers | CSP, X-Frame-Options, HSTS, X-Content-Type-Options, Referrer-Policy |
81
72
  | 10 | CI/CD Pipeline Security | Secrets via secrets context, not hardcoded in workflows |
82
73
 
83
- **Rules:**
84
- - Read every file. No sampling.
85
- - Every finding needs: file path, line number, issue, severity, remediation.
86
- - Check surrounding code for middleware/wrappers before flagging.
87
- - Document intentionally public endpoints — don't flag them.
88
- - Severity: `critical` = exploitable vulnerability, `warning` = defense-in-depth gap, `info` = observation.
89
- - Prefer false negatives over false positives.
90
- - Inapplicable categories → N/A with brief reason.
91
-
92
- **Adapt checks to detected stack:** Express/Next.js/Fastify endpoints, PostgreSQL/MongoDB/SQLite queries, GitHub Actions/GitLab CI, React/Vue/Svelte frontends.
93
-
94
- **Output format:**
74
+ **Rules:** Every file, no sampling. Finding = path + line + issue + severity + remediation. Check middleware before flagging. Doc public endpoints, don't flag. `critical`=exploitable, `warning`=defense gap, `info`=observation. False negatives > false positives. Inapplicable -> N/A. Adapt to detected stack.
95
75
 
96
76
  ```yaml
97
77
  security_audit:
@@ -109,24 +89,16 @@ security_audit:
109
89
  notes: "Optional context about intentional decisions"
110
90
  ```
111
91
 
112
- ### Part 2: Architecture Audit (subagent)
113
-
114
- **4 Dimensions:**
92
+ ### Part 2: Architecture Audit
115
93
 
116
94
  | Dimension | Checks |
117
95
  |-----------|--------|
118
- | **Scalability** | Synchronous blocking, missing pagination, unbounded queries, N+1 patterns, missing caching, single points of failure, hardcoded limits |
119
- | **Maintainability** | Files >300 lines, nesting >4 levels, god components/classes, circular deps, duplicated logic warranting abstraction |
120
- | **Code Health** | Dead code/unused exports, TODO/FIXME inventory with age, untested critical paths, stale/vulnerable deps |
121
- | **Structural Quality** | Business logic in UI layer, inconsistent patterns across features, missing error boundaries, API contract inconsistency |
96
+ | **Scalability** | Synchronous blocking, missing pagination, unbounded queries, N+1, missing caching, SPOFs, hardcoded limits |
97
+ | **Maintainability** | Files >300 lines, nesting >4, god components/classes, circular deps, dup logic |
98
+ | **Code Health** | Dead code/unused exports, TODO/FIXME inventory, untested critical paths, stale deps, deferred issues in `.forge/deferred-issues.md` |
99
+ | **Structural Quality** | Biz logic in UI, inconsistent patterns, missing error boundaries, API contract drift |
122
100
 
123
- **Rules:**
124
- - Check actual code, not theoretical concerns.
125
- - Every finding references specific files with evidence.
126
- - Severity: `critical` = debt causing production issues or blocking future work, `warning` = quality concern, `info` = improvement opportunity.
127
- - Respect existing ADRs in `.forge/decisions/` and constitutional articles — don't flag intentional choices.
128
-
129
- **Output format:**
101
+ **Rules:** Actual code, not theory. Specific files + evidence. `critical`=prod issues/blocking, `warning`=quality, `info`=improvement. Respect ADRs + constitution.
130
102
 
131
103
  ```yaml
132
104
  architecture_audit:
@@ -151,31 +123,20 @@ architecture_audit:
151
123
  findings: []
152
124
  ```
153
125
 
154
- ### Part 3: Refactoring Scan (subagent)
155
-
156
- Pass only files changed during the milestone (from git diff).
126
+ ### Part 3: Refactoring Scan
157
127
 
158
- **6 Categories:**
128
+ Milestone-changed files only (git diff).
159
129
 
160
130
  | # | Category | Look For |
161
131
  |---|----------|----------|
162
- | 1 | **Duplication** | Similar logic in 2+ places extractable into shared function/hook/utility |
163
- | 2 | **Complexity hotspots** | Functions >50 lines, nesting >3 levels, high cyclomatic complexity, overly long files |
164
- | 3 | **Naming & clarity** | Unclear names, misleading abstractions, functions exceeding their name's scope |
165
- | 4 | **Pattern inconsistency** | Same concern handled differently across milestone files (error handling, data fetching, state) |
166
- | 5 | **Dead code** | Unused functions, unreachable branches, commented-out code, unused imports |
167
- | 6 | **Abstraction issues** | Over-engineered one-use helpers, repeated inline code warranting extraction, premature/missing abstractions |
168
-
169
- **Rules:**
170
- - Read every file in the diff. No sampling.
171
- - Every finding references a specific file and line range.
172
- - Don't flag patterns documented in the constitution.
173
- - Don't duplicate security or architecture findings.
174
- - Estimate effort: `quick` (< 30 min, < 50 lines) or `standard` (needs planning).
175
- - Suggest a concrete approach, not "refactor this."
176
- - Fewer high-quality findings over many low-signal ones.
177
-
178
- **Output format:**
132
+ | 1 | **Duplication** | Similar logic in 2+ places -> shared function/hook/util |
133
+ | 2 | **Complexity** | Functions >50 lines, nesting >3, high cyclomatic |
134
+ | 3 | **Naming** | Unclear names, misleading abstractions, scope > name |
135
+ | 4 | **Inconsistency** | Same concern handled differently across files |
136
+ | 5 | **Dead code** | Unused functions, unreachable branches, commented code |
137
+ | 6 | **Abstraction** | Over-engineered helpers, missing extraction, premature abstractions |
138
+
139
+ **Rules:** Every diff file, no sampling. File + line range. Skip constitutional patterns. No security/arch dupes. Effort: `quick`(<30min, <50 lines) or `standard`. Concrete approach. Quality > quantity.
179
140
 
180
141
  ```yaml
181
142
  refactoring_scan:
@@ -189,32 +150,30 @@ refactoring_scan:
189
150
  suggested_approach: "Extract shared validateEmail() helper to src/utils/validation.ts"
190
151
  ```
191
152
 
192
- ## Step 4: Score Results
153
+ ## Step 4: Score
193
154
 
194
- **Per-category scoring (security + architecture):**
155
+ **Per-category:**
195
156
 
196
157
  | Status | Meaning |
197
158
  |--------|---------|
198
159
  | `passed` | No issues |
199
- | `warning` | Non-critical issues |
200
- | `critical` | Exploitable vulnerabilities or architectural blockers |
201
- | `na` | Category doesn't apply |
160
+ | `warning` | Non-critical |
161
+ | `critical` | Exploitable vulns or blockers |
162
+ | `na` | N/A |
202
163
 
203
- **Overall health:**
164
+ **Overall:**
204
165
 
205
166
  | Overall | Condition |
206
167
  |---------|-----------|
207
- | `passed` | All categories passed or N/A |
208
- | `warnings_only` | One+ warnings, zero critical |
209
- | `issues_found` | One+ critical findings |
168
+ | `passed` | All passed/N/A |
169
+ | `warnings_only` | 1+ warnings, 0 critical |
170
+ | `issues_found` | 1+ critical |
210
171
 
211
- Refactoring findings are separate — they never block completion.
172
+ Refactoring never blocks.
212
173
 
213
- ## Step 5: Write Health Report
174
+ ## Step 5: Write Report
214
175
 
215
- Create `.forge/audits/` if needed. Write to `.forge/audits/milestone-{id}-health-report.md`.
216
-
217
- **YAML frontmatter:**
176
+ Create `.forge/audits/` if needed:
218
177
 
219
178
  ```yaml
220
179
  ---
@@ -242,13 +201,11 @@ total_files_scanned: N
242
201
  ---
243
202
  ```
244
203
 
245
- **Body structure:**
246
-
247
204
  ```markdown
248
205
  # Review Report: {milestone name}
249
206
 
250
207
  ## Executive Summary
251
- {1-3 sentences: health assessment, key findings, refactoring highlights, recommendation}
208
+ {1-3 sentences: health, findings, refactoring, recommendation}
252
209
 
253
210
  ## Security Findings
254
211
 
@@ -257,7 +214,7 @@ total_files_scanned: N
257
214
  |------|------|----------|-------|-------------|
258
215
  | ... | ... | ... | ... | ... |
259
216
 
260
- {Repeat per category. N/A categories: single line "N/A — {reason}"}
217
+ {Repeat per category. N/A: "N/A — {reason}"}
261
218
 
262
219
  ## Architecture Findings
263
220
 
@@ -275,56 +232,41 @@ total_files_scanned: N
275
232
  |------|-------|-------------|--------|----------|
276
233
  | ... | ... | ... | quick/standard | ... |
277
234
 
278
- {Repeat per category with findings}
235
+ {Repeat per category}
279
236
 
280
237
  ## Public Endpoints
281
- {Intentionally public endpoints documented during security audit}
238
+ {Intentionally public endpoints}
282
239
 
283
240
  ## Files Scanned
284
- {Count and list of all files scanned}
241
+ {Count + list}
285
242
  ```
286
243
 
287
- If a previous milestone audit exists in `.forge/audits/`, compare results and note improvements/regressions in the executive summary.
288
-
289
- ## Step 6: Present Results + Triage Refactoring
290
-
291
- ### Health Results
292
-
293
- Present health status first — this is the gate.
294
-
295
- **HEALTHY (all passed):**
296
- *"Health audit passed. No security vulnerabilities or architectural concerns."*
244
+ Previous audit? Note improvements/regressions in summary.
297
245
 
298
- **NEEDS ATTENTION (critical issues):**
299
- *"Critical issues found:"*
300
- Inline top 3 findings per critical category.
246
+ ## Step 6: Present + Triage
301
247
 
302
- **WARNINGS ONLY:**
303
- *"Passed with warnings no critical issues, {N} items worth noting. Full report: `.forge/audits/milestone-{id}-health-report.md`."*
248
+ Health status first (gates completion):
249
+ - **HEALTHY:** *"Passed. No vulns or arch concerns."*
250
+ - **NEEDS ATTENTION:** *"Critical issues:"* top 3 per critical category.
251
+ - **WARNINGS:** *"Passed with warnings -- {N} noted. Report: `.forge/audits/milestone-{id}-health-report.md`."*
304
252
 
305
- ### Refactoring Triage
253
+ Refactoring triage (max 10): *"{N} opportunities:"*
254
+ *"**Duplication** ({N}): 1. `src/api/users.ts:42-67` -- Dup email validation. [Accept/Dismiss]*"
306
255
 
307
- Show findings grouped by category (max 10 initially):
256
+ **Accept**->backlog | **Dismiss**->skip | **Accept all** | **Dismiss all**
308
257
 
309
- *"{N} refactoring opportunities found:"*
258
+ Deferred issues triage: If `.forge/deferred-issues.md` has `status: pending` items, surface them:
259
+ *"**Test debt** ({N} pre-existing failures): 1. `{summary}` -- first seen {date}. [Accept/Dismiss/Fix-now]*"*
310
260
 
311
- Per category:
312
- *"**Duplication** ({N}):*
313
- *1. `src/api/users.ts:42-67` Duplicate email validation. Quick fix: extract helper. [Accept / Dismiss]*"
261
+ - **Accept** → add to refactor-backlog.yml as `category: test-debt`, mark `status: triaged` in deferred-issues.md
262
+ - **Fix-now** → route to `planning` fix mode before completing milestone
263
+ - **Dismiss** mark `status: dismissed` in deferred-issues.md with reason
314
264
 
315
- User responses:
316
- - **Accept** → add to backlog
317
- - **Dismiss** → skip (optionally ask reason to calibrate future scans)
318
- - **Accept all** → bulk add remaining
319
- - **Dismiss all** → skip everything
265
+ ## Step 7: Backlog + Route
320
266
 
321
- ## Step 7: Write Backlog + Route
267
+ ### Backlog
322
268
 
323
- ### Write Refactoring Backlog
324
-
325
- Read existing `.forge/refactor-backlog.yml`. Determine next item ID by incrementing from highest existing.
326
-
327
- Append accepted items:
269
+ Read `.forge/refactor-backlog.yml`. Next ID = max + 1. Append:
328
270
 
329
271
  ```yaml
330
272
  items:
@@ -341,41 +283,23 @@ items:
341
283
  completed: null
342
284
  ```
343
285
 
344
- If file doesn't exist, create from `.forge/templates/refactor-backlog.yml`.
345
-
346
- ### Route Based on Health Status
347
-
348
- #### HEALTHY or WARNINGS ONLY (accepted)
349
-
350
- Update `.forge/state/milestone-{id}.yml`: set `current.status` to `complete`.
351
- Update `.forge/state/index.yml`: set milestone status to `complete`, update `last_updated`.
352
-
353
- *"Milestone [{name}] complete. {N} refactoring items in backlog."*
286
+ Missing? Create from `.forge/templates/refactor-backlog.yml`.
354
287
 
355
- If Beads installed, run `bd complete`.
288
+ ### Route
356
289
 
357
- #### NEEDS ATTENTION (critical issues)
290
+ **HEALTHY/WARNINGS (accepted):** `current.status: complete` in milestone + index. *"Milestone [{name}] complete. {N} backlog items."* Beads: `bd complete`.
358
291
 
359
- Do NOT mark complete. Present choices:
292
+ **CRITICAL:** Don't complete. A) Fix->`planning` fix mode->re-verify->re-review. B) Accept risk->doc in report->complete.
360
293
 
361
- - **A. Fix critical issues** — return to `planning` in fix mode with findings as requirements
362
- - **B. Accept risk** — document accepted risks in report, complete the milestone
294
+ **WARNINGS (fix):** ->`planning` fix mode->fix->re-review.
363
295
 
364
- If A: create fix requirements from findings → route to `planning` → after fix + re-verification → re-run `reviewing`.
365
- If B: append "Accepted Risks" section to report → complete milestone (same as HEALTHY path).
296
+ ## Gates
366
297
 
367
- #### WARNINGS ONLY (user wants to fix)
298
+ - **Security/arch critical** -> soft gate (accept risk)
299
+ - **Warnings** -> advisory
300
+ - **Refactoring** -> never block
368
301
 
369
- Create fix requirements from warnings → route to `planning` in fix mode → after fix → re-run `reviewing`.
370
-
371
- ## Gate Type: Mixed
372
-
373
- - **Security critical** → soft gate (user can accept risk)
374
- - **Architecture critical** → soft gate (user has final authority)
375
- - **Warnings** → advisory (noted in report, user chooses)
376
- - **Refactoring items** → never block (cataloged to backlog)
377
-
378
- The report documents the decision either way — audit trail.
302
+ Report = audit trail.
379
303
 
380
304
  ## Backlog Lifecycle
381
305
 
@@ -384,23 +308,12 @@ pending → in_progress → done
384
308
  pending → dismissed (during triage or later)
385
309
  ```
386
310
 
387
- `effort: quick` items → pick up via `quick-tasking`.
388
- `effort: standard` items → Standard tier flow.
311
+ `quick` -> `quick-tasking`. `standard` -> Standard tier.
389
312
 
390
- Working a backlog item:
391
- 1. `forge` surfaces it as available
392
- 2. User selects it
393
- 3. Route to `quick-tasking` or Standard tier based on effort
394
- 4. On completion, set `status: done` and `completed` date
313
+ `forge` surfaces -> user selects -> route by effort -> `status: done` + date.
395
314
 
396
315
  ## Phase Handoff
397
316
 
398
- After reviewing completes (all paths):
399
-
400
- 1. Confirm health report written to `.forge/audits/milestone-{id}-health-report.md` and backlog updated
401
- 2. Set `current.status` to `complete` in `.forge/state/milestone-{id}.yml`
402
- 3. Present:
403
-
404
- *"Milestone [{name}] complete. Report: `.forge/audits/milestone-{id}-health-report.md`. {N} refactoring items in backlog.*
405
-
406
- *Start new work with `/forge` or tackle backlog items anytime."*
317
+ 1. Confirm report + backlog
318
+ 2. Set `current.status: complete`
319
+ 3. *"Milestone [{name}] complete. Report: `.forge/audits/milestone-{id}-health-report.md`. {N} backlog items. `/forge` or backlog."*
@@ -116,6 +116,16 @@ Production code must be debuggable. Logging, error reporting, and health checks
116
116
 
117
117
  _Add custom articles below during project init. Follow the same format: rule + gate checkboxes._
118
118
 
119
+ ### Article XII: Token Efficiency
120
+
121
+ Minimize framework token footprint. Compress prose, route models by task complexity, eliminate duplication across load paths.
122
+
123
+ **Gate:**
124
+ - [ ] No duplicated content across load paths (CLAUDE.md, skills, agents)
125
+ - [ ] All framework prose uses compressed style (terse, fragments OK, no filler)
126
+ - [ ] Model routing configured in project.yml with justified defaults
127
+ - [ ] Periodic compression audit: heaviest skill files measured and trimmed if >10KB
128
+
119
129
  ---
120
130
 
121
131
  ## Amending the Constitution
@@ -46,6 +46,23 @@ success_criteria: # How do we know we're done?
46
46
  - "" # e.g., "All tests pass with >80% coverage"
47
47
  - "" # e.g., "Page load < 2 seconds"
48
48
 
49
+ models:
50
+ default: sonnet # Fallback for skills without explicit override
51
+ parent_session: sonnet # Advisory — forge warns on mismatch
52
+ skills:
53
+ architecting: opus # Deep reasoning for structural decisions
54
+ planning: opus # Deep reasoning for task decomposition
55
+ researching: sonnet # Solid analysis for investigation
56
+ executing: sonnet # Solid code generation
57
+ verifying: haiku # Structured/mechanical verification
58
+ reviewing: sonnet # Needs judgment for audit findings
59
+ quick-tasking: haiku # Fast for small changes
60
+ initializing: sonnet # Needs analysis for project detection
61
+ designing: sonnet # UI decisions need good judgment
62
+ securing: sonnet # Security analysis needs depth
63
+ debugging: sonnet # Investigation needs solid reasoning
64
+ discussing: sonnet # Conversation needs natural fluency
65
+
49
66
  risks: # What could go wrong?
50
67
  - risk: ""
51
68
  mitigation: ""