@izkac/forgekit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/bin/forge.mjs +100 -0
  2. package/bin/forgekit.mjs +84 -0
  3. package/bin/review.mjs +82 -0
  4. package/package.json +46 -0
  5. package/scripts/prepack.mjs +78 -0
  6. package/scripts/run-tests.mjs +43 -0
  7. package/src/adr.mjs +236 -0
  8. package/src/adr.test.mjs +170 -0
  9. package/src/change.mjs +234 -0
  10. package/src/change.test.mjs +83 -0
  11. package/src/cleanup-sessions.mjs +70 -0
  12. package/src/config.mjs +103 -0
  13. package/src/defer.mjs +75 -0
  14. package/src/doctor.mjs +341 -0
  15. package/src/doctor.test.mjs +114 -0
  16. package/src/init.mjs +575 -0
  17. package/src/install.mjs +777 -0
  18. package/src/install.test.mjs +104 -0
  19. package/src/integrity-check.mjs +58 -0
  20. package/src/integrity.mjs +317 -0
  21. package/src/integrity.test.mjs +296 -0
  22. package/src/lib/workspaces.mjs +55 -0
  23. package/src/lib.mjs +138 -0
  24. package/src/models.defaults.json +41 -0
  25. package/src/new-session.mjs +82 -0
  26. package/src/openspec-overlays/README.md +19 -0
  27. package/src/openspec-overlays/openspec-apply-change-footer.md +14 -0
  28. package/src/openspec-overlays/opsx-apply-completion-step.md +1 -0
  29. package/src/openspec-overlays/opsx-apply-implement-step.md +11 -0
  30. package/src/paths.mjs +92 -0
  31. package/src/plan-engine.mjs +260 -0
  32. package/src/plan-engine.test.mjs +245 -0
  33. package/src/preferences.defaults.json +78 -0
  34. package/src/preferences.mjs +438 -0
  35. package/src/preferences.test.mjs +174 -0
  36. package/src/record-evidence.mjs +204 -0
  37. package/src/record-evidence.test.mjs +260 -0
  38. package/src/resolve-model.mjs +312 -0
  39. package/src/resolve-model.test.mjs +194 -0
  40. package/src/review/carryforward.mjs +413 -0
  41. package/src/review/carryforward.test.mjs +587 -0
  42. package/src/review/cli.test.mjs +117 -0
  43. package/src/review/export.mjs +172 -0
  44. package/src/review/export.test.mjs +197 -0
  45. package/src/review/fixtures/valid-review.json +42 -0
  46. package/src/review/lib.mjs +894 -0
  47. package/src/review/lib.test.mjs +266 -0
  48. package/src/review/merge-tentative.mjs +292 -0
  49. package/src/review/merge-tentative.test.mjs +363 -0
  50. package/src/review/new-review.mjs +200 -0
  51. package/src/review/render.mjs +108 -0
  52. package/src/review/schema-consistency.test.mjs +83 -0
  53. package/src/review/schema.json +196 -0
  54. package/src/review/signals.mjs +144 -0
  55. package/src/review/signals.test.mjs +62 -0
  56. package/src/score-cli.mjs +68 -0
  57. package/src/score.mjs +489 -0
  58. package/src/score.test.mjs +253 -0
  59. package/src/session-reminder.mjs +168 -0
  60. package/src/session-status.mjs +70 -0
  61. package/src/set-models.mjs +186 -0
  62. package/src/set-phase.mjs +177 -0
  63. package/src/set-phase.test.mjs +317 -0
  64. package/src/set-prefs.mjs +294 -0
  65. package/src/spine.mjs +91 -0
  66. package/src/triage-prompt.mjs +175 -0
  67. package/src/triage-prompt.test.mjs +50 -0
  68. package/src/vendor-openspec-overlays.mjs +176 -0
  69. package/src/vendor-openspec-overlays.test.mjs +62 -0
  70. package/vendor/skills/archive-to-adr/SKILL.md +149 -0
  71. package/vendor/skills/forge/SKILL.md +136 -0
  72. package/vendor/skills/forge/phases/brainstorm.md +23 -0
  73. package/vendor/skills/forge/phases/finish.md +87 -0
  74. package/vendor/skills/forge/phases/implement.md +76 -0
  75. package/vendor/skills/forge/phases/plan-openspec.md +40 -0
  76. package/vendor/skills/forge/phases/plan-specs.md +97 -0
  77. package/vendor/skills/forge/phases/review.md +25 -0
  78. package/vendor/skills/forge/phases/verify.md +120 -0
  79. package/vendor/skills/forge/references/forge-layout.md +85 -0
  80. package/vendor/skills/forge/references/pace.md +115 -0
  81. package/vendor/skills/forge/references/plan-routing.md +51 -0
  82. package/vendor/skills/forge/references/runtime-integrity.md +157 -0
  83. package/vendor/skills/forge/references/substantial-work.md +37 -0
  84. package/vendor/skills/forge/references/tdd-core.md +29 -0
  85. package/vendor/skills/forge/references/test-evidence.md +30 -0
  86. package/vendor/skills/forge/references/test-strategy.md +68 -0
  87. package/vendor/skills/forge/skills/NOTICE.md +17 -0
  88. package/vendor/skills/forge/skills/brainstorming/SKILL.md +120 -0
  89. package/vendor/skills/forge/skills/requesting-code-review/SKILL.md +67 -0
  90. package/vendor/skills/forge/skills/requesting-code-review/code-reviewer.md +146 -0
  91. package/vendor/skills/forge/skills/subagent-driven-development/SKILL.md +87 -0
  92. package/vendor/skills/forge/skills/systematic-debugging/SKILL.md +234 -0
  93. package/vendor/skills/forge/skills/systematic-debugging/condition-based-waiting.md +115 -0
  94. package/vendor/skills/forge/skills/systematic-debugging/defense-in-depth.md +122 -0
  95. package/vendor/skills/forge/skills/systematic-debugging/find-polluter.sh +63 -0
  96. package/vendor/skills/forge/skills/systematic-debugging/root-cause-tracing.md +169 -0
  97. package/vendor/skills/forge/skills/test-driven-development/SKILL.md +290 -0
  98. package/vendor/skills/forge/skills/test-driven-development/testing-anti-patterns.md +299 -0
  99. package/vendor/skills/forge/skills/verification-before-completion/SKILL.md +59 -0
  100. package/vendor/skills/forge/subagents/final-reviewer-prompt.md +53 -0
  101. package/vendor/skills/forge/subagents/implementer-prompt.md +38 -0
  102. package/vendor/skills/forge/subagents/task-reviewer-prompt.md +61 -0
  103. package/vendor/skills/git-resolve-adr-conflict/SKILL.md +132 -0
  104. package/vendor/skills/thorough-code-review/SKILL.md +290 -0
  105. package/vendor/skills/thorough-code-review/examples/accepted-risks-janus.md +32 -0
  106. package/vendor/skills/thorough-code-review/examples.md +133 -0
  107. package/vendor/skills/thorough-code-review/reference/accepted-risks.md +26 -0
  108. package/vendor/skills/thorough-code-review/reference/lenses.md +96 -0
  109. package/vendor/skills/thorough-code-review/reference/phase1-scout.md +62 -0
  110. package/vendor/skills/thorough-code-review/reference/phase1c-coverage.md +44 -0
  111. package/vendor/skills/thorough-code-review/reference/phase2-skeptic.md +105 -0
  112. package/vendor/skills/thorough-code-review/reference/report-schema.json +222 -0
  113. package/vendor/skills/thorough-code-review/reference/report-template.md +115 -0
  114. package/vendor/skills/thorough-code-review/reference/severity-rubric.md +49 -0
  115. package/vendor/skills/thorough-code-review/reference/signals-preflight.md +55 -0
  116. package/vendor/templates/adr/README.md +7 -0
  117. package/vendor/templates/adr/decisions.md +141 -0
  118. package/vendor/templates/adr/hooks/check-pending-adrs.mjs +74 -0
  119. package/vendor/templates/adr/hooks/check-pending-adrs.sh +3 -0
  120. package/vendor/templates/adr/hooks/openspec-archive-agent-message.mjs +52 -0
  121. package/vendor/templates/adr/hooks/openspec-archive-agent-message.sh +3 -0
  122. package/vendor/templates/project/claude/commands/forge-apply.md +75 -0
  123. package/vendor/templates/project/claude/commands/forge-brainstorm.md +7 -0
  124. package/vendor/templates/project/claude/commands/forge-build.md +17 -0
  125. package/vendor/templates/project/claude/commands/forge-plan.md +12 -0
  126. package/vendor/templates/project/claude/commands/forge-skip.md +14 -0
  127. package/vendor/templates/project/claude/commands/forge-status.md +16 -0
  128. package/vendor/templates/project/claude/commands/forge.md +16 -0
  129. package/vendor/templates/project/claude/hooks/forge-prompt-hook.mjs +73 -0
  130. package/vendor/templates/project/claude/hooks/forge-session-start.mjs +19 -0
  131. package/vendor/templates/project/claude/hooks/forge-triage-hook.mjs +77 -0
  132. package/vendor/templates/project/claude/rules/forge.md +16 -0
  133. package/vendor/templates/project/codex/rules/forge.md +10 -0
  134. package/vendor/templates/project/cursor/commands/forge-apply.md +75 -0
  135. package/vendor/templates/project/cursor/commands/forge-brainstorm.md +10 -0
  136. package/vendor/templates/project/cursor/commands/forge-build.md +17 -0
  137. package/vendor/templates/project/cursor/commands/forge-plan.md +15 -0
  138. package/vendor/templates/project/cursor/commands/forge-skip.md +14 -0
  139. package/vendor/templates/project/cursor/commands/forge-status.md +16 -0
  140. package/vendor/templates/project/cursor/commands/forge.md +16 -0
  141. package/vendor/templates/project/cursor/hooks/forge-session-start.mjs +30 -0
  142. package/vendor/templates/project/cursor/hooks/forge-session-start.sh +3 -0
  143. package/vendor/templates/project/cursor/rules/forge.mdc +21 -0
@@ -0,0 +1,157 @@
1
+ # Runtime integrity (hard rules)
2
+
3
+ Forge verifies **outcomes of the system**, not only artifacts of work. These
4
+ rules apply at every pace. Coordinators, implementers, and reviewers must not
5
+ weaken them in briefs.
6
+
7
+ ## 1. No stubs / no false success
8
+
9
+ A handler that only logs, bumps progress, or marks a job/request `succeeded`
10
+ without doing the domain work is **forbidden**.
11
+
12
+ - If a job kind (or API path) is enqueueable / callable in production, it MUST
13
+ run real domain logic, **or** fail closed with a clear error, **or** not be
14
+ exposed at all.
15
+ - Never authorize “stub OK”, “minimal poll loop only”, or “wire later” for a
16
+ path this change claims.
17
+
18
+ ## 2. Runtime owner required
19
+
20
+ A capability requirement is **not** met by a library module alone.
21
+
22
+ - For every REQ / capability this change implements, name the **production
23
+ caller** (worker job kind, HTTP endpoint, CLI command, scheduled job, …).
24
+ - Library-only = incomplete. Add a wiring task before marking the section done.
25
+
26
+ ## 3. Tests must fail on a no-op
27
+
28
+ Evidence that only asserts ceremony is invalid.
29
+
30
+ | Invalid | Valid |
31
+ | ------- | ----- |
32
+ | Job status became `succeeded` | Fixture upload/run left the expected domain side effects |
33
+ | Handler was called | Mongo/files/artifacts match the capability (or structured failure) |
34
+ | Queue claim/lease works | Pairing/stats/proposals/exports exist as specified |
35
+
36
+ If a test suite would still pass with a no-op handler, it does not prove the
37
+ task.
38
+
39
+ ## 4. Briefs may not narrow scope
40
+
41
+ **Capability specs beat narrow task wording** when they conflict.
42
+
43
+ - Coordinator briefs MUST NOT redefine done downward (e.g. authorize a stub
44
+ when the spec requires real ETL).
45
+ - To shrink scope: stop and ask the user. Do not silently checkbox around gaps.
46
+ - Prefer `DONE_WITH_CONCERNS` / incomplete tasks over green checkboxes.
47
+
48
+ ## 5. E2E means product loop, not job slice
49
+
50
+ Before claiming the change complete:
51
+
52
+ 1. Run (or document exact commands for) the **closed product loop** through the
53
+ live entry points, **or**
54
+ 2. Leave an explicit **`BLOCKED`** list in `verify-evidence.md` — and do **not**
55
+ mark the change complete / advance to `done`.
56
+
57
+ **A single job slice is not platform E2E.** When the design has a
58
+ producer/consumer split (analyze vs execute, proposals vs ratify, write vs
59
+ read), the required E2E is the full loop:
60
+
61
+ ```
62
+ produce artifact → consumer reads it → decision/state change →
63
+ next run's OUTPUT DIFFERS from the baseline
64
+ ```
65
+
66
+ Example: ingest→Parquet plus a thin run→`.sav` does **not** verify a
67
+ governance loop; analyze→proposals→ratify→run-applies-decisions does.
68
+ Record it under a `## Product loop` heading in `verify-evidence.md` —
69
+ the mechanical gate looks for it.
70
+
71
+ ## 6. Job-kind closure
72
+
73
+ Every job kind / entry point on the product surface (enums, API, UI) is, before
74
+ the change can be complete, exactly one of:
75
+
76
+ - **Wired end-to-end** (enqueueable + handled + domain side effects), or
77
+ - **Deleted** from the enums / API / UI surface.
78
+
79
+ “Fail closed for unsupported kind” is only a **temporary BLOCKED state**, never
80
+ “change complete.” Schema fiction (kinds nobody handles or enqueues) is a
81
+ verify failure.
82
+
83
+ ## 7. Consumer–producer rule
84
+
85
+ If a UI page, API response, or downstream job **reads** a collection, artifact,
86
+ or field, verify must prove something in the **production path writes it**
87
+ (fixture evidence), or the change is BLOCKED. Empty-forever queues that only
88
+ tests can fill are a REJECT.
89
+
90
+ ## 8. Deferrals are tracked debt, never checkboxes
91
+
92
+ “Wiring in a later task/section” is only acceptable when registered:
93
+
94
+ ```bash
95
+ forge defer add --task <id> --reason "wiring lands in task <id>"
96
+ forge defer resolve --task <id> # when the wiring task actually lands
97
+ ```
98
+
99
+ - Reviewers may only accept a deferral that names a **registered, still-open**
100
+ task (`forge defer list`).
101
+ - `forge phase done|finish` **refuses** while any deferral is unresolved.
102
+ - An unregistered "later" in a brief or review is a REJECT.
103
+
104
+ ## Spine matrix (mechanical — `forge spine`)
105
+
106
+ **Spine is mandatory for every Forge change** — not gated on pace, and not
107
+ inferred from slug keywords (that miss is how hollow platforms shipped).
108
+
109
+ At plan time (every change):
110
+
111
+ ```bash
112
+ forge spine init
113
+ ```
114
+
115
+ Then either:
116
+
117
+ 1. **Fill rows** — one per capability/REQ cluster:
118
+
119
+ | capability | library | runtimeOwner | writes | reads | uiConsumer | evidence |
120
+
121
+ Every cell filled (`reads` / `uiConsumer` may be `"N/A"`); `evidence` points
122
+ at the tier-2/E2E proof of the **wired** path. Library-only rows fail
123
+ `forge spine check` — and `forge phase done` runs the same check.
124
+
125
+ 2. **Or** set `"notApplicable": "<reason>"` for sync-only / docs-only work
126
+ (e.g. `"sync HTTP only — no async producer/consumer"`). That is the honest
127
+ opt-out; missing `spine.json` is not.
128
+
129
+ Product-loop evidence in `verify-evidence.md` is required when the spine has
130
+ real rows. Prefer `notApplicable` for sync-only changes instead of inventing a
131
+ fake loop.
132
+
133
+ ## Reviewer REJECT checklist (mandatory)
134
+
135
+ REJECT the task (or final review → `NOT READY`) if any of:
136
+
137
+ - Success path has no domain side effects required by the capability
138
+ - Tests would pass with a no-op handler
139
+ - API / UI can enqueue or trigger a kind the runtime cannot truly execute
140
+ - UI / consumers depend on data nothing in the production path writes
141
+ - Spec requirement has a library but no named runtime owner
142
+ - Deferred wiring without a registered open deferral (`forge defer list`)
143
+ - Spine row for this capability missing or library-only
144
+
145
+ ## Plan seam (every change)
146
+
147
+ Before apply-ready:
148
+
149
+ 1. `forge spine init` — **always**. Fill rows for each capability, or set
150
+ `notApplicable` with a reason (sync-only / docs-only).
151
+ 2. If the change involves workers, job queues, handlers, or cross-runtime
152
+ calls, `tasks.md` MUST also include:
153
+ - Explicit **wiring** tasks per job kind / entry point → domain pipeline
154
+ - One **product-loop acceptance** task (last implement task, before verify)
155
+
156
+ Missing spine = plan not ready. Keyword guesses about “jobs in scope” are not
157
+ an excuse to skip the spine.
@@ -0,0 +1,37 @@
1
+ # Substantial work triage
2
+
3
+ Run this check **before** implementation on every agent turn unless the user
4
+ sent **`/forge:skip`**.
5
+
6
+ **Forge = OpenSpec.** If work is substantial enough for Forge, it is substantial enough for a
7
+ tracked OpenSpec change. Smaller work skips Forge entirely (direct execution).
8
+
9
+ ## Enter Forge when ANY apply
10
+
11
+ - New feature or behavior change
12
+ - Bug fix that changes logic (not typo-only)
13
+ - Multi-file or multi-workspace edit
14
+ - Public API, Zod schema, OpenAPI, shared package export, or config schema change
15
+ - Cross-package / cross-product impact (grep consumers)
16
+ - User invokes `/forge` or any `/forge:*` command (except `/forge:skip`)
17
+ - Work would likely produce an ADR or new `openspec/specs/` capability
18
+
19
+ ## Skip Forge (execute directly) when ALL apply
20
+
21
+ - Pure question, explanation, or read-only review
22
+ - Typo, comment, formatting-only, or rename with zero behavior change
23
+ - User explicitly sent **`/forge:skip`** for this task
24
+
25
+ ## `/forge:skip` behaviour
26
+
27
+ 1. If an active Forge session exists, run:
28
+ ```bash
29
+ forge phase skipped
30
+ ```
31
+ 2. Do **not** start brainstorm or plan for this task.
32
+ 3. Proceed with the user's request under normal project rules.
33
+
34
+ ## Ambiguous cases
35
+
36
+ Ask one clarifying question: **would this produce an OpenSpec change?** If yes → Forge (OpenSpec).
37
+ If no → execute directly. Skip requires explicit user opt-out (`/forge:skip`).
@@ -0,0 +1,29 @@
1
+ # TDD core (condensed — inject into implementer briefs)
2
+
3
+ Full skill: [skills/test-driven-development/SKILL.md](../skills/test-driven-development/SKILL.md) — read it only when stuck (hard-to-test design, mock-heavy setup, unclear failures). Anti-patterns for mocks/test utilities: [testing-anti-patterns.md](../skills/test-driven-development/testing-anti-patterns.md).
4
+
5
+ ## Iron Law
6
+
7
+ **No production code without a failing test first.** Wrote code before the test? Delete it and start over — don't keep it as "reference".
8
+
9
+ ## The loop
10
+
11
+ 1. **RED** — write one minimal test for one behavior. Clear name, real code (mocks only if unavoidable).
12
+ 2. **Verify RED (mandatory)** — run the scoped test; confirm it *fails* for the right reason (feature missing, not a typo/error). Passes immediately? You're testing existing behavior — fix the test.
13
+ 3. **GREEN** — simplest code that passes. No extra features, options, or "improvements" beyond the test (YAGNI).
14
+ 4. **Verify GREEN (mandatory)** — re-run the same scoped file/pattern; output pristine. Test fails? Fix code, not test.
15
+ 5. **REFACTOR** — dedupe, rename, extract; stay green; no new behavior.
16
+ 6. Repeat with the next failing test.
17
+
18
+ ## Test tiers (Forge)
19
+
20
+ - **Tier 1 (each red/green cycle):** single test file or pattern — never the full workspace suite.
21
+ - **Tier 2 (task done):** narrowest command proving this task — changed tests + directly related tests. Full workspace runs **once at verify (tier 3)**, not per task. Report command + exit code + pass/fail summary.
22
+
23
+ ## Red flags — stop and start over
24
+
25
+ Code before test · test passes immediately · can't explain the failure · "I'll test after" · "already manually tested" · "too simple to test" · "keep as reference / adapt existing code" · "deleting X hours is wasteful" (sunk cost) · "run full workspace to be safe" (tier 3 belongs at verify) · "just this once".
26
+
27
+ ## Bugs
28
+
29
+ Reproduce with a failing test first, then fix. Never fix a bug without a test.
@@ -0,0 +1,30 @@
1
+ # Per-task test evidence (tier 2)
2
+
3
+ Each implement task records **tier 2** proof that subagents ran tests. See [test-strategy.md](./test-strategy.md) for all three tiers.
4
+
5
+ The **coordinator** records this file after the implementer reports — use `forge evidence --task <nn>-<slug> --command "<cmd>" --exit <code> --summary "<text>"` (machine timestamp; refuses non-zero exit without `--allow-fail`) rather than hand-writing it. Verify **audits** these files — it does **not** re-run the same tier 2 commands. Verify runs **tier 3** (full workspace) once separately; see [../phases/verify.md](../phases/verify.md).
6
+
7
+ ## Path
8
+
9
+ `.forge/sessions/<session-id>/tasks/<nn>-<slug>/test-evidence.md`
10
+
11
+ ## Template
12
+
13
+ ```markdown
14
+ # Test evidence — Task {nn}-{slug}
15
+
16
+ - **Tier:** 2 (task-scoped — not full workspace unless noted)
17
+ - **Command:** `npm test -- path/to/scoped.test.ts -- src/foo.test.ts`
18
+ - **Exit code:** 0
19
+ - **Summary:** 3/3 pass (or paste last ~20 lines of output)
20
+ - **Run at:** 2026-06-05T15:04:22Z
21
+ - **Recorded by:** implementer subagent (coordinator transcript)
22
+ ```
23
+
24
+ ## Rules
25
+
26
+ - **Exit code must be `0`** before the task is marked complete.
27
+ - **Default:** narrowest command — changed test file(s) + directly related tests. **Not** the full workspace suite.
28
+ - **Full workspace at tier 2** only when the task changes shared contracts, cross-module integration, or the brief explicitly requires it. Note `Tier: 2 (full workspace — contract/integration)` in the file.
29
+ - If the implementer re-ran tests after a fix, overwrite with the latest successful tier 2 run.
30
+ - Verify **audits** tier 2 files and runs **tier 3** (full workspace) once — see [test-strategy.md](./test-strategy.md).
@@ -0,0 +1,68 @@
1
+ # Tiered test strategy (Forge)
2
+
3
+ Forge uses **three tiers**. Do **not** run the full workspace or monorepo test suite on every subagent task — that is slow and redundant when verify runs tier 3 once.
4
+
5
+ ## Tier 1 — TDD loop (within a task)
6
+
7
+ During red/green/refactor, run **scoped** commands only:
8
+
9
+ ```bash
10
+ npm test -- path/to/scoped.test.ts -- path/to/changed.test.ts
11
+ ```
12
+
13
+ - Single test file or pattern for the behavior under change
14
+ - Mandatory for TDD integrity (watch fail → pass)
15
+ - Fast; repeat as often as needed
16
+
17
+ ## Tier 2 — Task completion evidence
18
+
19
+ Before marking a task complete, run the **narrowest** command that proves **this task's** changes work:
20
+
21
+ - Changed test file(s) + directly related tests in the same module/directory
22
+ - Subpath or pattern filter when the runner supports it
23
+ - **Not** the full workspace suite by default
24
+
25
+ Record in `.forge/sessions/<id>/tasks/<nn>-<slug>/test-evidence.md`. See [test-evidence.md](./test-evidence.md).
26
+
27
+ ### Tier 2 may be wider (still not full monorepo)
28
+
29
+ - Shared contract or public API change → include contract tests in affected packages
30
+ - Cross-module integration within one workspace → run the relevant integration test directory
31
+ - Task brief explicitly requires full workspace coverage
32
+
33
+ ### Do not use full workspace at tier 2 when
34
+
35
+ - Changes are localized (typical 1–3 file task)
36
+ - Multiple tasks target the same workspace (full suite runs once at **verify**)
37
+ - Motivation is only "to be safe" — that is **verify's** job
38
+
39
+ ## Tier 3 — Verify phase (coordinator, after all tasks)
40
+
41
+ After all implement tasks complete:
42
+
43
+ 1. **Audit** every `tasks/<nn>-<slug>/test-evidence.md` (exit `0`, pass summary, reviewers approved).
44
+ 2. Run **one fresh full workspace test** for each affected workspace (plus downstream consumer workspaces when contracts changed).
45
+ 3. Save output to `.forge/sessions/<id>/verify-evidence.md`.
46
+
47
+ Tier 3 is the integration/regression gate. Cite this file when claiming the implementation passes.
48
+
49
+ Re-run tier 3 when: tier 3 failed, coordinator edited code after verify evidence, quality/final review flagged test gaps, or the user asks for a fresh run.
50
+
51
+ **Do not** re-run tier 2 narrow commands at verify — audit them instead.
52
+
53
+ ## Quick reference
54
+
55
+ | Tier | Who | When | Scope |
56
+ | ---- | --- | ---- | ----- |
57
+ | 1 | Implementer | Each TDD red/green/refactor | Single file or pattern |
58
+ | 2 | Implementer | Task done | Narrowest proof for this task |
59
+ | 3 | Coordinator | Verify phase (once) | Full affected workspace(s) |
60
+
61
+ ## Anti-patterns
62
+
63
+ | Don't | Do instead |
64
+ | ----- | ---------- |
65
+ | Full workspace test on every task | Tier 1 scoped + tier 2 narrow evidence |
66
+ | Skip tier 3 because tasks passed | Always run tier 3 once at verify |
67
+ | Re-run tier 2 commands at verify | Audit task evidence; run tier 3 full suite |
68
+ | Full monorepo test at tier 2 | Tier 2 narrow; tier 3 per workspace (or listed consumers) |
@@ -0,0 +1,17 @@
1
+ # Vendored skills (Superpowers)
2
+
3
+ Forge bundles adapted copies of skills from the [Superpowers](https://github.com/obra/superpowers)
4
+ plugin (MIT). Upstream is not required at runtime.
5
+
6
+ | Skill | Purpose in Forge |
7
+ | ----- | ---------------- |
8
+ | brainstorming | Brainstorm phase |
9
+ | test-driven-development | Implement phase (per task) |
10
+ | subagent-driven-development | Implement phase orchestration |
11
+ | verification-before-completion | Verify phase |
12
+ | requesting-code-review | Review phase |
13
+ | systematic-debugging | Blockers during implement/debug |
14
+
15
+ These copies are a **maintained fork**: originally vendored from Superpowers (MIT), then
16
+ restructured (single task reviewer, tiered testing, trimmed prose). Do not re-vendor
17
+ from upstream — edit here and run `forgekit install --skills forge --force`.
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: brainstorming
3
+ description: Forge — brainstorm before plan. Internal skill; read via forge orchestrator.
4
+ ---
5
+
6
+ # Brainstorming Ideas Into Designs
7
+
8
+ Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
9
+
10
+ Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design and get user approval.
11
+
12
+ <HARD-GATE>
13
+ Do NOT invoke any implementation skill, write any code, scaffold any project, or take any implementation action until you have presented a design and the user has approved it. This applies to EVERY project regardless of perceived simplicity.
14
+ </HARD-GATE>
15
+
16
+ ## Anti-Pattern: "This Is Too Simple To Need A Design"
17
+
18
+ Every project goes through this process. A todo list, a single-function utility, a config change — all of them. "Simple" projects are where unexamined assumptions cause the most wasted work. The design can be short (a few sentences for truly simple projects), but you MUST present it and get approval.
19
+
20
+ ## Checklist
21
+
22
+ You MUST create a task for each of these items and complete them in order:
23
+
24
+ 1. **Explore project context** — check files, docs, recent commits
25
+ 2. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria (genuinely visual questions use `design/<surface>/` mockups — see Visual questions below)
26
+ 3. **Propose 2-3 approaches** — with trade-offs and your recommendation
27
+ 4. **Present design** — in sections scaled to their complexity, get user approval after each section
28
+ 5. **Write design doc** — save to `.forge/sessions/<session-id>/brainstorm/notes.md` and `decisions.md`
29
+ 6. **Spec self-review** — quick inline check for placeholders, contradictions, ambiguity, scope (see below)
30
+ 7. **User reviews written spec** — ask user to review the spec file before proceeding
31
+ 8. **OpenSpec propose** — invoke `openspec-propose` or `/opsx:propose <prefix>-<slug>` per forge plan-routing (no plan-mode prompt)
32
+
33
+ ## Process Flow
34
+
35
+ Explore context → clarify (one question at a time) → propose 2-3 approaches → present design sections (revise until approved) → write design doc → spec self-review (fix inline) → user reviews spec (revise until approved) → **OpenSpec propose**.
36
+
37
+ **The terminal state is OpenSpec propose.** Do NOT invoke frontend-design, mcp-builder, or any other implementation skill. Run `/opsx:propose` (or `openspec-propose`) — do not implement until OpenSpec artefacts are approved.
38
+
39
+ ## The Process
40
+
41
+ **Understanding the idea:**
42
+
43
+ - Check out the current project state first (files, docs, recent commits)
44
+ - Before asking detailed questions, assess scope: if the request describes multiple independent subsystems (e.g., "build a platform with chat, file storage, billing, and analytics"), flag this immediately. Don't spend questions refining details of a project that needs to be decomposed first.
45
+ - If the project is too large for a single spec, help the user decompose into sub-projects: what are the independent pieces, how do they relate, what order should they be built? Then brainstorm the first sub-project through the normal design flow. Each sub-project gets its own spec → plan → implementation cycle.
46
+ - For appropriately-scoped projects, ask questions one at a time to refine the idea
47
+ - Prefer multiple choice questions when possible, but open-ended is fine too
48
+ - Only one question per message - if a topic needs more exploration, break it into multiple questions
49
+ - Focus on understanding: purpose, constraints, success criteria
50
+
51
+ **Exploring approaches:**
52
+
53
+ - Propose 2-3 different approaches with trade-offs
54
+ - Present options conversationally with your recommendation and reasoning
55
+ - Lead with your recommended option and explain why
56
+
57
+ **Presenting the design:**
58
+
59
+ - Once you believe you understand what you're building, present the design
60
+ - Scale each section to its complexity: a few sentences if straightforward, up to 200-300 words if nuanced
61
+ - Ask after each section whether it looks right so far
62
+ - Cover: architecture, components, data flow, error handling, testing
63
+ - Be ready to go back and clarify if something doesn't make sense
64
+
65
+ **Design for isolation and clarity:**
66
+
67
+ - Break the system into smaller units that each have one clear purpose, communicate through well-defined interfaces, and can be understood and tested independently
68
+ - For each unit, you should be able to answer: what does it do, how do you use it, and what does it depend on?
69
+ - Can someone understand what a unit does without reading its internals? Can you change the internals without breaking consumers? If not, the boundaries need work.
70
+ - Smaller, well-bounded units are also easier for you to work with - you reason better about code you can hold in context at once, and your edits are more reliable when files are focused. When a file grows large, that's often a signal that it's doing too much.
71
+
72
+ **Working in existing codebases:**
73
+
74
+ - Explore the current structure before proposing changes. Follow existing patterns.
75
+ - Where existing code has problems that affect the work (e.g., a file that's grown too large, unclear boundaries, tangled responsibilities), include targeted improvements as part of the design - the way a good developer improves code they're working in.
76
+ - Don't propose unrelated refactoring. Stay focused on what serves the current goal.
77
+
78
+ ## After the Design
79
+
80
+ **Documentation:**
81
+
82
+ - Write the validated design (spec) to `.forge/sessions/<session-id>/brainstorm/notes.md`
83
+ - (User preferences for spec location override this default)
84
+ - Use elements-of-style:writing-clearly-and-concisely skill if available
85
+ - Do not commit unless the user explicitly asks
86
+
87
+ **Spec Self-Review:**
88
+ After writing the spec document, look at it with fresh eyes:
89
+
90
+ 1. **Placeholder scan:** Any "TBD", "TODO", incomplete sections, or vague requirements? Fix them.
91
+ 2. **Internal consistency:** Do any sections contradict each other? Does the architecture match the feature descriptions?
92
+ 3. **Scope check:** Is this focused enough for a single implementation plan, or does it need decomposition?
93
+ 4. **Ambiguity check:** Could any requirement be interpreted two different ways? If so, pick one and make it explicit.
94
+
95
+ Fix any issues inline. No need to re-review — just fix and move on.
96
+
97
+ **User Review Gate:**
98
+ After the spec review loop passes, ask the user to review the written spec before proceeding:
99
+
100
+ > "Spec written to `<path>`. Please review before we proceed to the implementation plan."
101
+
102
+ Wait for the user's response. If they request changes, make them and re-run the spec review loop. Only proceed once the user approves.
103
+
104
+ **Implementation:**
105
+
106
+ - Proceed to forge **plan phase** (OpenSpec via `/opsx:propose`)
107
+ - Do NOT invoke implement phase or write production code yet
108
+
109
+ ## Key Principles
110
+
111
+ - **One question at a time** - Don't overwhelm with multiple questions
112
+ - **Multiple choice preferred** - Easier to answer than open-ended when possible
113
+ - **YAGNI ruthlessly** - Remove unnecessary features from all designs
114
+ - **Explore alternatives** - Always propose 2-3 approaches before settling
115
+ - **Incremental validation** - Present design, get approval before moving on
116
+ - **Be flexible** - Go back and clarify when something doesn't make sense
117
+
118
+ ## Visual questions
119
+
120
+ When a question is genuinely visual (mockups, wireframes, layout comparisons — not merely *about* a UI topic), use the Janus convention instead of describing designs in prose: write static HTML mockups to `design/<surface-name>/` with a picker `index.html` plus one file per variant (AGENTS.md § Design exploration artefacts), then ask the user to open them and pick. Text questions (requirements, tradeoffs, A/B/C choices) stay in the terminal.
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: requesting-code-review
3
+ description: Forge — dispatch code review subagents. Internal skill; read via forge orchestrator.
4
+ ---
5
+
6
+ # Requesting Code Review
7
+
8
+ Dispatch forge/skills/code-reviewer subagent to catch issues before they cascade. The reviewer gets precisely crafted context for evaluation — never your session's history. This keeps the reviewer focused on the work product, not your thought process, and preserves your own context for continued work.
9
+
10
+ **Core principle:** Review early, review often.
11
+
12
+ ## When to Request Review
13
+
14
+ **Mandatory:**
15
+ - After each task in subagent-driven development
16
+ - After completing major feature
17
+ - Before hand-off to user
18
+
19
+ **Optional but valuable:**
20
+ - When stuck (fresh perspective)
21
+ - Before refactoring (baseline check)
22
+ - After fixing complex bug
23
+
24
+ ## How to Request
25
+
26
+ **1. Get git SHAs:**
27
+ ```bash
28
+ BASE_SHA=$(git rev-parse HEAD~1) # or origin/main
29
+ HEAD_SHA=$(git rev-parse HEAD)
30
+ ```
31
+
32
+ **2. Dispatch code-reviewer subagent:**
33
+
34
+ Use Task tool with forge/skills/code-reviewer type, fill template at `code-reviewer.md`
35
+
36
+ **Placeholders:**
37
+ - `{WHAT_WAS_IMPLEMENTED}` - What you just built
38
+ - `{PLAN_OR_REQUIREMENTS}` - What it should do
39
+ - `{BASE_SHA}` - Starting commit
40
+ - `{HEAD_SHA}` - Ending commit
41
+ - `{DESCRIPTION}` - Brief summary
42
+
43
+ **3. Act on feedback:**
44
+ - Fix Critical issues immediately
45
+ - Fix Important issues before proceeding
46
+ - Note Minor issues for later
47
+ - Push back if reviewer is wrong (with reasoning)
48
+
49
+ ## Integration with Forge
50
+
51
+ - Per-task review is handled by the **task reviewer** in the implement phase
52
+ - This skill drives the **final** whole-session review (and ad-hoc reviews when stuck or before merge)
53
+
54
+ ## Red Flags
55
+
56
+ **Never:**
57
+ - Skip review because "it's simple"
58
+ - Ignore Critical issues
59
+ - Proceed with unfixed Important issues
60
+ - Argue with valid technical feedback
61
+
62
+ **If reviewer wrong:**
63
+ - Push back with technical reasoning
64
+ - Show code/tests that prove it works
65
+ - Request clarification
66
+
67
+ Template: ./skills/requesting-code-review/code-reviewer.md
@@ -0,0 +1,146 @@
1
+ # Code Review Agent
2
+
3
+ You are reviewing code changes for production readiness.
4
+
5
+ **Your task:**
6
+ 1. Review {WHAT_WAS_IMPLEMENTED}
7
+ 2. Compare against {PLAN_OR_REQUIREMENTS}
8
+ 3. Check code quality, architecture, testing
9
+ 4. Categorize issues by severity
10
+ 5. Assess production readiness
11
+
12
+ ## What Was Implemented
13
+
14
+ {DESCRIPTION}
15
+
16
+ ## Requirements/Plan
17
+
18
+ {PLAN_REFERENCE}
19
+
20
+ ## Git Range to Review
21
+
22
+ **Base:** {BASE_SHA}
23
+ **Head:** {HEAD_SHA}
24
+
25
+ ```bash
26
+ git diff --stat {BASE_SHA}..{HEAD_SHA}
27
+ git diff {BASE_SHA}..{HEAD_SHA}
28
+ ```
29
+
30
+ ## Review Checklist
31
+
32
+ **Code Quality:**
33
+ - Clean separation of concerns?
34
+ - Proper error handling?
35
+ - Type safety (if applicable)?
36
+ - DRY principle followed?
37
+ - Edge cases handled?
38
+
39
+ **Architecture:**
40
+ - Sound design decisions?
41
+ - Scalability considerations?
42
+ - Performance implications?
43
+ - Security concerns?
44
+
45
+ **Testing:**
46
+ - Tests actually test logic (not mocks)?
47
+ - Edge cases covered?
48
+ - Integration tests where needed?
49
+ - All tests passing?
50
+
51
+ **Requirements:**
52
+ - All plan requirements met?
53
+ - Implementation matches spec?
54
+ - No scope creep?
55
+ - Breaking changes documented?
56
+
57
+ **Production Readiness:**
58
+ - Migration strategy (if schema changes)?
59
+ - Backward compatibility considered?
60
+ - Documentation complete?
61
+ - No obvious bugs?
62
+
63
+ ## Output Format
64
+
65
+ ### Strengths
66
+ [What's well done? Be specific.]
67
+
68
+ ### Issues
69
+
70
+ #### Critical (Must Fix)
71
+ [Bugs, security issues, data loss risks, broken functionality]
72
+
73
+ #### Important (Should Fix)
74
+ [Architecture problems, missing features, poor error handling, test gaps]
75
+
76
+ #### Minor (Nice to Have)
77
+ [Code style, optimization opportunities, documentation improvements]
78
+
79
+ **For each issue:**
80
+ - File:line reference
81
+ - What's wrong
82
+ - Why it matters
83
+ - How to fix (if not obvious)
84
+
85
+ ### Recommendations
86
+ [Improvements for code quality, architecture, or process]
87
+
88
+ ### Assessment
89
+
90
+ **Ready to hand off?** [Yes/No/With fixes]
91
+
92
+ **Reasoning:** [Technical assessment in 1-2 sentences]
93
+
94
+ ## Critical Rules
95
+
96
+ **DO:**
97
+ - Categorize by actual severity (not everything is Critical)
98
+ - Be specific (file:line, not vague)
99
+ - Explain WHY issues matter
100
+ - Acknowledge strengths
101
+ - Give clear verdict
102
+
103
+ **DON'T:**
104
+ - Say "looks good" without checking
105
+ - Mark nitpicks as Critical
106
+ - Give feedback on code you didn't review
107
+ - Be vague ("improve error handling")
108
+ - Avoid giving a clear verdict
109
+
110
+ ## Example Output
111
+
112
+ ```
113
+ ### Strengths
114
+ - Clean database schema with proper migrations (db.ts:15-42)
115
+ - Comprehensive test coverage (18 tests, all edge cases)
116
+ - Good error handling with fallbacks (summarizer.ts:85-92)
117
+
118
+ ### Issues
119
+
120
+ #### Important
121
+ 1. **Missing help text in CLI wrapper**
122
+ - File: index-conversations:1-31
123
+ - Issue: No --help flag, users won't discover --concurrency
124
+ - Fix: Add --help case with usage examples
125
+
126
+ 2. **Date validation missing**
127
+ - File: search.ts:25-27
128
+ - Issue: Invalid dates silently return no results
129
+ - Fix: Validate ISO format, throw error with example
130
+
131
+ #### Minor
132
+ 1. **Progress indicators**
133
+ - File: indexer.ts:130
134
+ - Issue: No "X of Y" counter for long operations
135
+ - Impact: Users don't know how long to wait
136
+
137
+ ### Recommendations
138
+ - Add progress reporting for user experience
139
+ - Consider config file for excluded projects (portability)
140
+
141
+ ### Assessment
142
+
143
+ **Ready to hand off: With fixes**
144
+
145
+ **Reasoning:** Core implementation is solid with good architecture and tests. Important issues (help text, date validation) are easily fixed and don't affect core functionality.
146
+ ```