forge-orkes 0.3.10 → 0.3.13

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
 
@@ -31,41 +31,31 @@ Read: .forge/constitution.md → active architectural gates (if exists)
31
31
  Read: .forge/refactor-backlog.yml → existing backlog items (if any)
32
32
  ```
33
33
 
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
34
+ Skip by stack: no DB->SQL/NoSQL N/A, no frontend->XSS N/A, no CI/CD->Pipeline N/A.
38
35
 
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
36
+ Diff start: git log milestone start -> fallback: first commit after prev milestone -> ask user.
43
37
 
44
- ## Step 2: Scope the Review
38
+ ## Step 2: Scope
45
39
 
46
40
  ```
47
- Glob: src/**/*.{ts,tsx,js,jsx,py,go,rs,java} (adapt to project language)
41
+ Glob: src/**/*.{ts,tsx,js,jsx,py,go,rs,java} (adapt to language)
48
42
  Glob: **/*.env*, **/docker-compose*, **/.github/workflows/*
49
43
  Glob: **/next.config*, **/vite.config*, **/webpack.config*
50
44
  ```
51
45
 
52
- Get diff file list for refactoring scan:
53
46
  ```
54
47
  git diff --name-only {milestone_start}..HEAD
55
48
  ```
56
49
 
57
- Present scope summary:
58
- *"Review scope: {N} source files, {N} config files, {N} changed files. Scanning security (10), architecture (4), refactoring (6)."*
50
+ Present: *"Scope: {N} source, {N} config, {N} changed. Scanning security(10), arch(4), refactoring(6)."*
59
51
 
60
- Build explicit file lists for each subagent — pass paths, not globs.
52
+ File lists per subagent (paths, not globs).
61
53
 
62
- ## Step 3: Spawn Parallel Scans
54
+ ## Step 3: Parallel Scans
63
55
 
64
- Spawn all three as fresh-context subagents. Each receives: explicit file list, tech stack from `project.yml`, instructions below.
56
+ Fresh-context subagents with file list + tech stack.
65
57
 
66
- ### Part 1: Security Audit (subagent)
67
-
68
- **10 Security Categories:**
58
+ ### Part 1: Security Audit
69
59
 
70
60
  | # | Category | Checks |
71
61
  |---|----------|--------|
@@ -80,18 +70,7 @@ Spawn all three as fresh-context subagents. Each receives: explicit file list, t
80
70
  | 9 | HTTP Security Headers | CSP, X-Frame-Options, HSTS, X-Content-Type-Options, Referrer-Policy |
81
71
  | 10 | CI/CD Pipeline Security | Secrets via secrets context, not hardcoded in workflows |
82
72
 
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:**
73
+ **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
74
 
96
75
  ```yaml
97
76
  security_audit:
@@ -109,24 +88,16 @@ security_audit:
109
88
  notes: "Optional context about intentional decisions"
110
89
  ```
111
90
 
112
- ### Part 2: Architecture Audit (subagent)
113
-
114
- **4 Dimensions:**
91
+ ### Part 2: Architecture Audit
115
92
 
116
93
  | Dimension | Checks |
117
94
  |-----------|--------|
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 |
95
+ | **Scalability** | Synchronous blocking, missing pagination, unbounded queries, N+1, missing caching, SPOFs, hardcoded limits |
96
+ | **Maintainability** | Files >300 lines, nesting >4, god components/classes, circular deps, dup logic |
97
+ | **Code Health** | Dead code/unused exports, TODO/FIXME inventory, untested critical paths, stale deps |
98
+ | **Structural Quality** | Biz logic in UI, inconsistent patterns, missing error boundaries, API contract drift |
122
99
 
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:**
100
+ **Rules:** Actual code, not theory. Specific files + evidence. `critical`=prod issues/blocking, `warning`=quality, `info`=improvement. Respect ADRs + constitution.
130
101
 
131
102
  ```yaml
132
103
  architecture_audit:
@@ -151,31 +122,20 @@ architecture_audit:
151
122
  findings: []
152
123
  ```
153
124
 
154
- ### Part 3: Refactoring Scan (subagent)
155
-
156
- Pass only files changed during the milestone (from git diff).
125
+ ### Part 3: Refactoring Scan
157
126
 
158
- **6 Categories:**
127
+ Milestone-changed files only (git diff).
159
128
 
160
129
  | # | Category | Look For |
161
130
  |---|----------|----------|
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:**
131
+ | 1 | **Duplication** | Similar logic in 2+ places -> shared function/hook/util |
132
+ | 2 | **Complexity** | Functions >50 lines, nesting >3, high cyclomatic |
133
+ | 3 | **Naming** | Unclear names, misleading abstractions, scope > name |
134
+ | 4 | **Inconsistency** | Same concern handled differently across files |
135
+ | 5 | **Dead code** | Unused functions, unreachable branches, commented code |
136
+ | 6 | **Abstraction** | Over-engineered helpers, missing extraction, premature abstractions |
137
+
138
+ **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
139
 
180
140
  ```yaml
181
141
  refactoring_scan:
@@ -189,32 +149,30 @@ refactoring_scan:
189
149
  suggested_approach: "Extract shared validateEmail() helper to src/utils/validation.ts"
190
150
  ```
191
151
 
192
- ## Step 4: Score Results
152
+ ## Step 4: Score
193
153
 
194
- **Per-category scoring (security + architecture):**
154
+ **Per-category:**
195
155
 
196
156
  | Status | Meaning |
197
157
  |--------|---------|
198
158
  | `passed` | No issues |
199
- | `warning` | Non-critical issues |
200
- | `critical` | Exploitable vulnerabilities or architectural blockers |
201
- | `na` | Category doesn't apply |
159
+ | `warning` | Non-critical |
160
+ | `critical` | Exploitable vulns or blockers |
161
+ | `na` | N/A |
202
162
 
203
- **Overall health:**
163
+ **Overall:**
204
164
 
205
165
  | Overall | Condition |
206
166
  |---------|-----------|
207
- | `passed` | All categories passed or N/A |
208
- | `warnings_only` | One+ warnings, zero critical |
209
- | `issues_found` | One+ critical findings |
167
+ | `passed` | All passed/N/A |
168
+ | `warnings_only` | 1+ warnings, 0 critical |
169
+ | `issues_found` | 1+ critical |
210
170
 
211
- Refactoring findings are separate — they never block completion.
171
+ Refactoring never blocks.
212
172
 
213
- ## Step 5: Write Health Report
173
+ ## Step 5: Write Report
214
174
 
215
- Create `.forge/audits/` if needed. Write to `.forge/audits/milestone-{id}-health-report.md`.
216
-
217
- **YAML frontmatter:**
175
+ Create `.forge/audits/` if needed:
218
176
 
219
177
  ```yaml
220
178
  ---
@@ -242,13 +200,11 @@ total_files_scanned: N
242
200
  ---
243
201
  ```
244
202
 
245
- **Body structure:**
246
-
247
203
  ```markdown
248
204
  # Review Report: {milestone name}
249
205
 
250
206
  ## Executive Summary
251
- {1-3 sentences: health assessment, key findings, refactoring highlights, recommendation}
207
+ {1-3 sentences: health, findings, refactoring, recommendation}
252
208
 
253
209
  ## Security Findings
254
210
 
@@ -257,7 +213,7 @@ total_files_scanned: N
257
213
  |------|------|----------|-------|-------------|
258
214
  | ... | ... | ... | ... | ... |
259
215
 
260
- {Repeat per category. N/A categories: single line "N/A — {reason}"}
216
+ {Repeat per category. N/A: "N/A — {reason}"}
261
217
 
262
218
  ## Architecture Findings
263
219
 
@@ -275,56 +231,34 @@ total_files_scanned: N
275
231
  |------|-------|-------------|--------|----------|
276
232
  | ... | ... | ... | quick/standard | ... |
277
233
 
278
- {Repeat per category with findings}
234
+ {Repeat per category}
279
235
 
280
236
  ## Public Endpoints
281
- {Intentionally public endpoints documented during security audit}
237
+ {Intentionally public endpoints}
282
238
 
283
239
  ## Files Scanned
284
- {Count and list of all files scanned}
240
+ {Count + list}
285
241
  ```
286
242
 
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."*
297
-
298
- **NEEDS ATTENTION (critical issues):**
299
- *"Critical issues found:"*
300
- Inline top 3 findings per critical category.
243
+ Previous audit? Note improvements/regressions in summary.
301
244
 
302
- **WARNINGS ONLY:**
303
- *"Passed with warnings — no critical issues, {N} items worth noting. Full report: `.forge/audits/milestone-{id}-health-report.md`."*
245
+ ## Step 6: Present + Triage
304
246
 
305
- ### Refactoring Triage
247
+ Health status first (gates completion):
248
+ - **HEALTHY:** *"Passed. No vulns or arch concerns."*
249
+ - **NEEDS ATTENTION:** *"Critical issues:"* top 3 per critical category.
250
+ - **WARNINGS:** *"Passed with warnings -- {N} noted. Report: `.forge/audits/milestone-{id}-health-report.md`."*
306
251
 
307
- Show findings grouped by category (max 10 initially):
252
+ Refactoring triage (max 10): *"{N} opportunities:"*
253
+ *"**Duplication** ({N}): 1. `src/api/users.ts:42-67` -- Dup email validation. [Accept/Dismiss]*"
308
254
 
309
- *"{N} refactoring opportunities found:"*
255
+ **Accept**->backlog | **Dismiss**->skip | **Accept all** | **Dismiss all**
310
256
 
311
- Per category:
312
- *"**Duplication** ({N}):*
313
- *1. `src/api/users.ts:42-67` — Duplicate email validation. Quick fix: extract helper. [Accept / Dismiss]*"
257
+ ## Step 7: Backlog + Route
314
258
 
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
259
+ ### Backlog
320
260
 
321
- ## Step 7: Write Backlog + Route
322
-
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:
261
+ Read `.forge/refactor-backlog.yml`. Next ID = max + 1. Append:
328
262
 
329
263
  ```yaml
330
264
  items:
@@ -341,41 +275,23 @@ items:
341
275
  completed: null
342
276
  ```
343
277
 
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."*
278
+ Missing? Create from `.forge/templates/refactor-backlog.yml`.
354
279
 
355
- If Beads installed, run `bd complete`.
280
+ ### Route
356
281
 
357
- #### NEEDS ATTENTION (critical issues)
282
+ **HEALTHY/WARNINGS (accepted):** `current.status: complete` in milestone + index. *"Milestone [{name}] complete. {N} backlog items."* Beads: `bd complete`.
358
283
 
359
- Do NOT mark complete. Present choices:
284
+ **CRITICAL:** Don't complete. A) Fix->`planning` fix mode->re-verify->re-review. B) Accept risk->doc in report->complete.
360
285
 
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
286
+ **WARNINGS (fix):** ->`planning` fix mode->fix->re-review.
363
287
 
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).
288
+ ## Gates
366
289
 
367
- #### WARNINGS ONLY (user wants to fix)
290
+ - **Security/arch critical** -> soft gate (accept risk)
291
+ - **Warnings** -> advisory
292
+ - **Refactoring** -> never block
368
293
 
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.
294
+ Report = audit trail.
379
295
 
380
296
  ## Backlog Lifecycle
381
297
 
@@ -384,23 +300,12 @@ pending → in_progress → done
384
300
  pending → dismissed (during triage or later)
385
301
  ```
386
302
 
387
- `effort: quick` items → pick up via `quick-tasking`.
388
- `effort: standard` items → Standard tier flow.
303
+ `quick` -> `quick-tasking`. `standard` -> Standard tier.
389
304
 
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
305
+ `forge` surfaces -> user selects -> route by effort -> `status: done` + date.
395
306
 
396
307
  ## Phase Handoff
397
308
 
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."*
309
+ 1. Confirm report + backlog
310
+ 2. Set `current.status: complete`
311
+ 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: ""