forgedock 1.0.22 → 1.1.1

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 (46) hide show
  1. package/README.md +217 -218
  2. package/bin/cinema.mjs +320 -0
  3. package/bin/engine/phases.mjs +148 -0
  4. package/bin/engine/projector.mjs +32 -0
  5. package/bin/engine/reconcile.mjs +11 -0
  6. package/bin/engine/runlog.mjs +79 -0
  7. package/bin/engine/state.mjs +27 -0
  8. package/bin/engine-cli.mjs +50 -0
  9. package/bin/engine.mjs +138 -0
  10. package/bin/forgedock.mjs +464 -1491
  11. package/bin/journey.mjs +783 -0
  12. package/bin/runner.mjs +80 -13
  13. package/bin/settings-hook.mjs +112 -0
  14. package/bin/tui.mjs +6 -3
  15. package/commands/autopilot.md +4 -4
  16. package/commands/deploy-info.md +5 -3
  17. package/commands/design-bench.md +1 -0
  18. package/commands/design-render-critique-loop.md +1 -0
  19. package/commands/design.md +1 -0
  20. package/commands/forge-stats.md +1 -0
  21. package/commands/issue.md +1 -1
  22. package/commands/orchestrate.md +27 -9
  23. package/commands/quality-gate.md +80 -34
  24. package/commands/review-pr-agents.md +7 -7
  25. package/commands/review-pr.md +21 -4
  26. package/commands/work-on/build/implement.md +16 -4
  27. package/commands/work-on/build/validate.md +38 -1
  28. package/commands/work-on/build.md +27 -9
  29. package/commands/work-on/close.md +2 -2
  30. package/commands/work-on/review.md +24 -0
  31. package/commands/work-on-monolithic.md +1 -0
  32. package/commands/work-on.md +45 -3
  33. package/docs/BRAND.md +6 -2
  34. package/docs/CONFIG.md +39 -34
  35. package/docs/site/.vitepress/config.mjs +85 -0
  36. package/docs/site/getting-started.md +15 -8
  37. package/docs/site/index.md +1 -1
  38. package/docs/superpowers/plans/2026-07-03-cinematic-onboarding-tui.md +2339 -0
  39. package/docs/superpowers/plans/2026-07-03-durable-execution-engine.md +1223 -0
  40. package/docs/superpowers/specs/2026-07-03-cinematic-onboarding-tui-design.md +157 -0
  41. package/docs/superpowers/specs/2026-07-03-durable-execution-engine-design.md +194 -0
  42. package/package.json +10 -4
  43. package/scripts/verify-env-vars.sh +18 -2
  44. package/scripts/verify-host-headers.sh +4 -4
  45. package/scripts/verify-route-registration.sh +2 -2
  46. package/scripts/worktree-lifecycle.sh +202 -0
package/README.md CHANGED
@@ -4,336 +4,335 @@
4
4
 
5
5
  <h1>ForgeDock</h1>
6
6
 
7
- <p><strong>Autonomous software development for Claude Code.</strong></p>
7
+ <p><strong>Deterministic orchestration for autonomous software engineering.</strong></p>
8
8
 
9
- <p>ForgeDock turns every bug found, every fix shipped, and every review finding into structured context that makes the next agent smarter. It catches integration bugs that code review can't see — missing route registrations, env vars present in CI but absent in deploy, Docker permission mismatches, sibling code paths left unfixed. Every finding feeds back as a prevention rule for future builds. After thousands of issues on production codebases, the system catches bugs before they reach a testing branch.</p>
9
+ <p>LLMs generate the code. ForgeDock owns everything else — <strong>state, scheduling, recovery, review, and memory</strong> — as durable, inspectable structure on the GitHub you already have. Issues are the queue. PRs are the ledger. Annotations are the memory. Point it at an issue and get a merged, reviewed PR; point it at a <strong>milestone</strong> and get parallel pipelines with conflict-aware scheduling.</p>
10
+
11
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-AGPL--3.0-blue.svg" alt="License: AGPL-3.0" /></a>
12
+ <a href="https://github.com/RapierCraftStudios/ForgeDock/stargazers"><img src="https://img.shields.io/github/stars/RapierCraftStudios/ForgeDock?style=social" alt="GitHub Stars" /></a>
13
+ <a href="https://docs.anthropic.com/en/docs/claude-code"><img src="https://img.shields.io/badge/Built%20for-Claude%20Code-blueviolet" alt="Claude Code" /></a>
14
+ <a href="https://www.npmjs.com/package/forgedock"><img src="https://img.shields.io/npm/v/forgedock?color=cb3837&logo=npm" alt="npm" /></a>
15
+ <a href="https://www.npmjs.com/package/forgedock"><img src="https://img.shields.io/npm/dm/forgedock?color=cb3837&logo=npm&label=downloads" alt="npm downloads per month" /></a>
16
+ <a href="https://github.com/RapierCraftStudios/ForgeDock/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome" /></a>
17
+ <a href="https://github.com/sponsors/RapierCraftStudios"><img src="https://img.shields.io/badge/Sponsor-❤-ea4aaa.svg" alt="Sponsor" /></a>
18
+
19
+ </div>
10
20
 
11
- <a href="https://www.npmjs.com/package/forgedock"><img src="https://img.shields.io/npm/dm/forgedock?label=npm%20downloads&style=flat-square&color=CB3837" alt="npm downloads/month" /></a>&nbsp;
12
- <a href="https://www.npmjs.com/package/forgedock"><img src="https://img.shields.io/npm/v/forgedock?style=flat-square&color=CB3837" alt="npm version" /></a>&nbsp;
13
- <a href="https://nodejs.org/"><img src="https://img.shields.io/node/v/forgedock?style=flat-square&color=339933" alt="node version" /></a>&nbsp;
14
- <a href="https://docs.anthropic.com/en/docs/claude-code"><img src="https://img.shields.io/badge/Built%20for-Claude%20Code-7C3AED?style=flat-square" alt="Claude Code" /></a>
15
21
  <br />
16
- <a href="LICENSE"><img src="https://img.shields.io/badge/License-AGPL--3.0-blue.svg?style=flat-square" alt="License: AGPL-3.0" /></a>&nbsp;
17
- <a href="https://github.com/RapierCraftStudios/ForgeDock/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square" alt="PRs Welcome" /></a>
18
22
 
19
- <br /><br />
23
+ <div align="center">
20
24
 
21
- <img src="docs/demo.gif" alt="ForgeDock demo — parallel orchestration across 15+ issues" width="900" />
25
+ <img src="docs/demo.gif" alt="ForgeDock orchestrating multiple GitHub issues in parallel — agents investigate, build, review, and flip workflow labels through to merged" width="900" />
22
26
 
23
- <p><em>15+ issues orchestrated in parallel — investigated, built, reviewed, and shipped autonomously.</em></p>
27
+ <p><em><strong>One <code>/orchestrate</code> runs a whole milestone.</strong> Agents pick up issues in parallel, drive each through investigate → build → review, and flip the GitHub labels to <code>merged</code> — live.</em></p>
24
28
 
25
29
  </div>
26
30
 
27
- <br />
31
+ **This repository builds itself with ForgeDock.** In its first 30 days (June 4 → July 4, 2026): **693 issues filed, 605 closed, 603 PRs merged — median 56 minutes from open to merged-and-closed.** 57% of those issues were filed by the pipeline itself; 49% are findings its own review agents raised, filed, and then fixed. Every run leaves a public audit trail — [click through the receipts](#watch-the-machine-work), or count them yourself:
32
+
33
+ ```bash
34
+ gh issue list -R RapierCraftStudios/ForgeDock --state closed --limit 1000 --json number --jq 'length'
35
+ ```
36
+
37
+ **A single run, up close** — a real one, [issue #1230](https://github.com/RapierCraftStudios/ForgeDock/issues/1230):
28
38
 
29
- ## What ForgeDock Does
39
+ ```console
40
+ $ /work-on #1230 "orchestrate: Layer 5 co-change signal is dead code"
30
41
 
31
- ForgeDock runs the full issue lifecycle inside Claude Code — **investigate, architect, build, quality-gate, review, and merge** — autonomously. You open an issue, run `/work-on #42`, and click merge. Every stage writes structured context back to GitHub, so the next agent starts smart, not blind.
42
+ ✓ investigate CONFIRMED/HIGH — feature shipped 3h earlier (PR #1204) reads a
43
+ never-populated variable; the co-change query can never fire
44
+ ✓ build fix branch, 1 file
45
+ ✓ review caught a defect in the fix itself: stray backticks in the grep
46
+ meant every git-log pathspec silently matched zero commits —
47
+ "the fix would not have actually worked." Corrected.
48
+ ✓ merged 30m 37s → staging
32
49
 
50
+ filed by the pipeline's own staging review. fixed before a human read it.
33
51
  ```
34
- You: /work-on #42
35
- ForgeDock: Investigate → Architect → Build → Quality Gate → Review → open PR
36
- You: click merge
52
+
53
+ ### Try it in 30 seconds — on a throwaway repo, nothing to lose
54
+
55
+ ```bash
56
+ npx forgedock demo # spins up a risk-free demo repo and shows you the pipeline end to end
37
57
  ```
38
58
 
39
- No new runtime, no separate process, no cloud service — just prompt-engineered command specs that run inside the Claude Code you already use.
59
+ Ready to use it for real? **`npx forgedock`** walks you through one continuous setup: it checks your environment, installs the slash commands, reads your repo, and hands you a single annotated `forge.yaml` to review — you press Enter once.
60
+
61
+ > ⭐ **If ForgeDock saves you time, [star the repo](https://github.com/RapierCraftStudios/ForgeDock/stargazers)** — it's the whole marketing budget.
40
62
 
41
63
  ---
42
64
 
43
- ## What You Get
65
+ **Your AI coding agent forgets everything after every session.** It re-explores the codebase from scratch, re-makes mistakes that were already fixed, and has no idea why the code it's touching looks the way it does. ForgeDock fixes that by making **GitHub itself the memory** — every pipeline stage writes structured findings that every later agent reads.
44
66
 
45
- | Capability | How it works |
46
- |---|---|
47
- | **Full-lifecycle automation** | `/work-on #42` — investigates the issue, architects a fix, builds it, runs quality gates, opens a PR, and reviews it. You click merge. |
48
- | **Persistent agent memory** | Structured `FORGE:` annotations on GitHub issues/PRs survive context resets and session boundaries. Agents never start blind. |
49
- | **9 specialist review agents** | Security, billing, database, concurrency, auth, frontend, API, performance, infrastructure — every PR gets domain-expert review. |
50
- | **Institutional memory that compounds** | Agent fixing issue #43 reads the investigation from #42 and applies the known pattern — no re-investigation. |
51
- | **Self-improving pipeline** | Review agents learn from past findings — recurring patterns automatically become new quality gate checks. |
52
- | **Parallel orchestration** | `/orchestrate` decomposes milestones into waves and runs `/work-on` on each in parallel. |
67
+ ## Without ForgeDock vs. With ForgeDock
53
68
 
54
- > **Cost note:** ForgeDock itself is free and open-source. It orchestrates Claude Code sessions, so you pay your normal Anthropic API usage. A typical `/work-on` run on a straightforward bug uses roughly the same tokens as a 15–20 minute manual Claude Code session.
69
+ | Without ForgeDock | With ForgeDock |
70
+ |---|---|
71
+ | Agent starts every session blind — no context from prior work | Agent reads structured investigation, root cause, and history straight from GitHub |
72
+ | The same bugs get reintroduced across PRs | Review agents surface known pitfalls from past PRs *before* you commit |
73
+ | A crash or compaction loses the run | State lives on GitHub and in an event-sourced run log — the pipeline resumes where it stopped |
74
+ | You write the issue, plan the fix, open the PR, and review it | `/work-on #42` → investigated, built, reviewed, merged |
75
+ | Review depends on whoever has capacity | 9 domain-specialist agents (security, billing, DB, concurrency…) review every PR |
76
+ | One task at a time, serialized by your attention | `/orchestrate` runs a whole milestone — many issues in parallel, each its own full pipeline |
55
77
 
56
78
  ---
57
79
 
58
- ## How It Works
80
+ ## The idea in one paragraph
81
+
82
+ AI agents have **no lookback**. They don't know a function was shaped by a bug fix in #347, that an approach was tried and reverted in PR #891, or that three other files need the same change. Context window isn't the bottleneck — **memory is.** But GitHub already stores everything an agent needs: commits, PRs, issues, blame, cross-references. It's a citation graph; agents just don't use it as one. ForgeDock makes every stage write **machine-readable annotations** to issues and PRs, and every downstream agent read them. The `gh` CLI becomes the query interface to institutional memory. The result: agents that follow structured data, not vibes.
59
83
 
60
84
  ```
61
- Issue → Investigate → Architect → Build → Quality Gate → Review → Merge
62
- ↓ ↓ ↓ ↓ ↓
63
- writes to reads from reads from reads from writes to
64
- GitHub GitHub GitHub GitHub GitHub
85
+ ┌──────────────────────────────────────────────────────────────────┐
86
+ │ GITHUB (Knowledge Graph) │
87
+ │ │
88
+ │ Issues: FORGE:INVESTIGATOR → FORGE:CONTEXT → FORGE:ARCHITECT │
89
+ │ → FORGE:TRAJECTORY (the run's full audit trail) │
90
+ │ PRs: FORGE:BUILDER → structured review FINDING blocks │
91
+ │ Links: git blame → commit → PR → issue → related issues │
92
+ │ │
93
+ │ Every agent reads this. Every agent writes to it. │
94
+ │ Nothing is lost between conversations. │
95
+ └──────────────────────────────────────────────────────────────────┘
65
96
  ```
66
97
 
67
- Each stage writes a structured annotation (`<!-- FORGE:INVESTIGATOR -->`, `<!-- FORGE:CONTRACT -->`, etc.) to the GitHub issue or PR. Each downstream stage reads what came before. The `gh` CLI is the query interface.
68
-
69
- | Stage | What it does |
70
- |---|---|
71
- | **Investigate** | Traces root cause via `git blame`, related issues/PRs. Writes verdict, affected files, severity. |
72
- | **Context** | Surfaces historical bugs and known pitfalls from the same module. Institutional memory. |
73
- | **Architect** | Produces ordered implementation plan with exact file/function/line targets. |
74
- | **Build** | Writes code, creates branch, makes commits. Follows the architect's plan. |
75
- | **Quality Gate** | 14+ domain-specific checks (security, auth, DB, concurrency, etc.) |
76
- | **Review** | 9 specialist agents review the PR diff with confidence-rated findings. |
77
- | **Close** | Records full audit trail as `FORGE:TRAJECTORY`. |
78
-
79
- Labels track workflow state (`workflow:investigating`, `workflow:building`, `workflow:in-review`, `workflow:merged`). The pipeline resumes from whatever state GitHub says it's in — restart-safe by design.
80
-
81
98
  ---
82
99
 
83
- ## Install
100
+ ## Watch the machine work
84
101
 
85
- **Requirements:** [Node.js 18+](https://nodejs.org/), [Claude Code](https://docs.anthropic.com/en/docs/claude-code), [GitHub CLI (`gh`)](https://cli.github.com/), [`yq`](https://github.com/mikefarah/yq) (YAML parser used by pipeline commands to read `forge.yaml`), and **[Playwright MCP](https://github.com/microsoft/playwright-mcp)** (browser automation for `/qa-sweep` and visual testing commands)
102
+ Not a staged demo — these are real, public runs on this repository. Open any of them and read the full trail:
86
103
 
87
- > **Playwright MCP** is a guaranteed ForgeDock dependency for browser automation commands. Register it in Claude Code after installing ForgeDock:
88
- > ```bash
89
- > claude mcp add playwright npx @playwright/mcp@latest
90
- > ```
91
- > Verify with `npx forgedock doctor` — Check 9 confirms Playwright MCP is registered.
104
+ - **[#1230](https://github.com/RapierCraftStudios/ForgeDock/issues/1230)** — the pipeline's staging review caught dead code in a feature the pipeline had shipped three hours earlier; review then caught a bug in the fix itself. Intent to merged: **30 minutes**.
105
+ - **[#1172](https://github.com/RapierCraftStudios/ForgeDock/issues/1172)** — review found an `ANTHROPIC_API_KEY` exfiltration path in the headless runner (an in-process file read bypassed the env scrub), with exact line evidence. Fixed and merged in **18 minutes**, with regression tests. A later re-review found a second-order bypass of the first fix ([#1243](https://github.com/RapierCraftStudios/ForgeDock/issues/1243)) — the pipeline red-teams its own fixes.
106
+ - **[#952](https://github.com/RapierCraftStudios/ForgeDock/issues/952)** — the investigator closed the pipeline's *own proposal* as INVALID with receipts: the deliverable had already shipped weeks earlier. Zero code written, 34 minutes, full explanation.
107
+ - **[#1256](https://github.com/RapierCraftStudios/ForgeDock/issues/1256)** — decomposition that respects the existing graph: it created only the two net-new sub-issues no open issue already claimed, then sequenced three existing issues into the dependency order.
108
+ - **[#1322](https://github.com/RapierCraftStudios/ForgeDock/issues/1322)** — a heavyweight feature (the durable execution engine itself): 9 TDD tasks, whole-branch review caught two Criticals pre-merge, merged in **under 2 hours**.
92
109
 
93
- ```bash
94
- # Install pipeline commands
95
- npx forgedock
110
+ And the part that makes it compound — the context phase citing past bugs *by number* before a line is written (from [#1196](https://github.com/RapierCraftStudios/ForgeDock/issues/1196)):
96
111
 
97
- # Generate config for your repo
98
- npx forgedock init
112
+ > "`commands/orchestrate.md` has a dense review-finding history from PR #1081/#1107/#1126… associative-array declaration mistakes (#1113), array-element removal via pattern substitution corrupting partial matches (#1108)… the new Layer 5 subsection should not introduce a competing edge-direction convention that could reintroduce a cycle class."
99
113
 
100
- # Verify everything is wired up correctly
101
- npx forgedock doctor
102
- ```
114
+ > Numbers on this page are point-in-time (2026-07-04), from this repository's first 30 days of dogfooding. A reproducible cost-per-issue benchmark is a hard gate on our own launch plan — [#1264](https://github.com/RapierCraftStudios/ForgeDock/issues/1264): no estimated efficiency claims.
103
115
 
104
- This symlinks 25+ pipeline commands into `~/.claude/commands/` and generates a `forge.yaml` config in your project root. `npx forgedock doctor` runs an installation health check — command symlinks, `forge.yaml`, required tools (`gh`, `yq`, Claude Code), GitHub workflow labels, and Playwright MCP — printing a clear pass/fail/warn line with a fix hint for each, and exiting non-zero if anything is broken. Run it any time your setup feels off. That's it — open Claude Code and run `/work-on #42`.
116
+ ---
105
117
 
106
- **Try it risk-free:** Follow the [5-minute Getting Started walkthrough](docs/site/getting-started.md) to install, configure, and run your first pipeline end-to-end. New to the commands? Start with the [Command Reference](docs/site/command-reference.md) for a guided tour of what each one does.
118
+ ## Orchestrate an entire milestone
107
119
 
108
- <details>
109
- <summary><strong>Other install methods & commands</strong></summary>
120
+ `/work-on` ships one issue. **`/orchestrate` ships a milestone.** It decomposes the milestone into dependency-ordered waves and runs a full `/work-on` pipeline on each issue **in parallel** — investigating, building, reviewing, and merging many at once, while GitHub labels track every agent's state live. On this repo's record day, that meant **29 issues taken to merged inside a single hour**.
110
121
 
111
- **Claude Code Plugin Marketplace** (v2.1.143+):
112
- ```
113
- /plugin marketplace add RapierCraftStudios/ForgeDock
114
- /plugin install forgedock@forgedock
115
- ```
122
+ Scheduling is conflict-aware before it is parallel. Five detection layers decide what may run concurrently: same-file overlap, directory proximity, shared-module fan-in, a conservative fallback when file extraction is low-confidence, and **historical co-change coupling mined from `git log`** — files that changed together in the past are assumed to conflict now. Database-touching issues are always serialized. The resulting graph is cycle-checked (Kahn's algorithm) and executed in topologically sorted waves; overlapping work is expressed as ordinary `Depends on #N` edges anyone can read.
116
123
 
117
- **CLI commands:**
118
- ```bash
119
- npx forgedock update # Pull latest commands
120
- npx forgedock uninstall # Remove all ForgeDock commands from ~/.claude/commands/
121
- npx forgedock help # Show all available commands
122
- ```
124
+ <div align="center">
125
+ <img src="assets/orchestration.svg" alt="One milestone fanned out into parallel work-on pipelines, each issue advancing through investigating, building, in-review, and merged" width="920" />
126
+ </div>
123
127
 
124
- **Standalone runner** (run pipelines outside Claude Code — CI/CD, headless batch):
125
128
  ```bash
126
- # Preview the assembled prompt + tool plan (no API key needed)
127
- npx forgedock run work-on 42 --dry-run
128
-
129
- # Execute headlessly via the Anthropic API directly
130
- export ANTHROPIC_API_KEY=sk-ant-...
131
- npm install @anthropic-ai/sdk # optional dependency — only needed for live runs
132
- npx forgedock run work-on 42
129
+ /orchestrate milestone/checkout-v2 # decompose → conflict-aware waves → merged PRs
133
130
  ```
134
- `forgedock run` loads the same `commands/*.md` specs and drives an Anthropic
135
- tool-use loop directly, so the pipeline no longer depends on the Claude Code
136
- agent loop. Claude Code remains the recommended interactive experience; the
137
- runner adds CI/CD and non-Claude-Code paths. Flags: `--dry-run`, `--model <id>`,
138
- `--max-iterations <n>`.
139
131
 
140
- **AI-powered setup** (inside Claude Code):
141
- ```
142
- /forgedock-init # Guided config walkthrough — scans your repo, queries GitHub, auto-fills forge.yaml
143
- ```
144
-
145
- </details>
132
+ ---
146
133
 
147
- <details>
148
- <summary><strong>See a real pipeline run</strong></summary>
134
+ ## How it works
149
135
 
150
- Here's what a real run looks like on [issue #619](https://github.com/RapierCraftStudios/ForgeDock/issues/619) — a performance bug where command specs were burning ~200K tokens in context:
136
+ Each stage reads the structured output of the stages before it and writes its own findings back:
151
137
 
152
138
  ```
153
- FORGE:INVESTIGATOR → CONFIRMED. All 27 command spec files (848KB) load into
154
- context at session start via symlinks. ~200K tokens wasted.
139
+ Issue → Investigate → Context → Architect → Build → Quality Gate → Review → Merge
140
+ └──────────── each stage reads & writes GitHub ────────────┘
141
+ ```
155
142
 
156
- FORGE:CONTRACT → Replace symlink-based install with stub-file pattern.
157
- Installer parses frontmatter, writes minimal stubs.
143
+ | Stage | Reads | Writes |
144
+ | --- | --- | --- |
145
+ | **Investigate** | Issue body, `git blame`, related issues/PRs | `FORGE:INVESTIGATOR` — verdict, root cause, affected files, severity |
146
+ | **Context** | Historical findings from related PRs, known pitfalls | `FORGE:CONTEXT` — institutional memory for this module |
147
+ | **Architect** | Investigation + context | `FORGE:ARCHITECT` — ordered plan, code paths, risks |
148
+ | **Build** | Everything above | `FORGE:BUILDER` — branch, commits, files changed |
149
+ | **Quality Gate** | Builder output, domain-specific checks | gate results, recorded in the run's trajectory |
150
+ | **Review** | PR diff, contract, gate results | `FORGE:REVIEW_STARTED` on the issue; per-agent findings as structured `FINDING` blocks on the PR |
151
+ | **Close** | All of the above | `FORGE:TRAJECTORY` — the full audit trail of the run |
158
152
 
159
- FORGE:CONTEXT → Issue #577: install() had overly broad catch{} — fixed to
160
- check err.code === 'ENOENT'. Issue #587: Windows writes
161
- regular files, not symlinks — keep both paths working.
153
+ **GitHub as the database.** Every annotation is wrapped in an HTML comment (`<!-- FORGE:INVESTIGATOR -->`) that makes it machine-parseable. When an agent starts — even in a brand-new conversation after compaction — it queries the issue via `gh` and reconstructs full context from these tags. Workflow labels (`workflow:investigating`, `workflow:in-review`, `workflow:merged`…) track state, and the pipeline resumes from whatever state GitHub reports. The annotation format is an open standard — see the [FORGE Annotation Protocol](docs/FORGE-PROTOCOL.md).
162
154
 
163
- FORGE:ARCHITECT → 3 new functions in bin/forgedock.mjs: parseFrontmatter(),
164
- generateStubContent(), updated install() flow.
155
+ **Durable by design.** Headless runs are backed by a real execution engine, not prompt-hope: every phase transition is appended to an event-sourced, crash-safe run log, mirrored to the issue as a compact `FORGE:STATE` index, and guarded by leases so two agents can never own the same issue. Kill the process mid-run and restart it — the engine reconciles local state against GitHub (GitHub wins), adopts branches and PRs that already exist instead of re-running the LLM, and escalates to `needs-human` after bounded retries instead of looping. Phase selection is a pure rule-based state machine: **the engine, not the model, decides what happens next.** The headless core shipped in [PR #1326](https://github.com/RapierCraftStudios/ForgeDock/pull/1326); wiring the interactive path onto the same engine is in progress ([#1323](https://github.com/RapierCraftStudios/ForgeDock/issues/1323)–[#1325](https://github.com/RapierCraftStudios/ForgeDock/issues/1325)).
165
156
 
166
- FORGE:BUILDER → Branch feat/stub-install-pattern-619, 1 file changed.
157
+ **Domain-specialist review.** Every PR is reviewed by agents with deep, narrow expertise — Security, Auth & Access Control, Billing Integrity, Database, Concurrency, Frontend, API, Performance, Infrastructure. Findings carry a confidence level, and a **reproduction gate** keeps them honest: a finding only blocks if the reviewer traced an actual code path or input that triggers it — pattern-match suspicions are downgraded, not merged into noise. Findings above the severity threshold are **automatically filed as new issues** that enter the same pipeline: on this repo, that loop produced 49% of all issues ever filed.
167
158
 
168
- FORGE:REVIEW → Auto-merged to staging.
159
+ **It measures itself.** `/pipeline-health` correlates every prompt change against review-finding rates, build failures, and manual fix-up commits, then files its own report — including failing grades — as an issue. `/autopilot` pulls production signals (errors, CI failures, stale issues, analytics), files issues from them, and optionally runs `/work-on` on the top ones. The pipeline also invalidates its own bad ideas: proposals that turn out to be already-shipped or wrong are closed `workflow:invalid` with the reasoning attached ([example](https://github.com/RapierCraftStudios/ForgeDock/issues/952)).
169
160
 
170
- FORGE:TRAJECTORY → Full audit trail recorded.
171
- ```
161
+ ---
172
162
 
173
- The context phase surfaced two historical bugs (#577, #587) in the same module — preventing the builder from repeating known mistakes. [View the full issue →](https://github.com/RapierCraftStudios/ForgeDock/issues/619)
163
+ ## Built for the ways agents fail
174
164
 
175
- </details>
165
+ Every mechanism above exists because autonomous agents fail in predictable ways. The skeptics are right about the failure modes — the answer is structure, not optimism:
166
+
167
+ | "We've all seen this go wrong…" | The mechanism |
168
+ | --- | --- |
169
+ | Parallel agents just turn typing time into *reading* time | Review is a pipeline stage: domain specialists with confidence ratings and a reproduction gate — not a pile of raw diffs |
170
+ | Agents game their own checks (or delete the tests) | Builders never grade their own work — the quality gate and reviewers are separate agents reading the diff cold |
171
+ | Third retry = increasingly creative excuses | Engine-owned state machine: bounded retries, then escalation to `needs-human` |
172
+ | One runaway agent wrecks the codebase | 1 issue = 1 agent, bounded by decomposition; conflict-aware scheduling; isolated worktrees |
173
+ | No institutional memory — "it can't read the Slack thread from 2023" | Every run writes citable annotations to GitHub; the context phase quotes past bugs by number |
174
+ | No way to tell when an agent drifts | A `FORGE:TRAJECTORY` receipt on the issue records what every phase actually did |
175
+ | Humans rubber-stamp 95%-good output | Specialist review raises the floor *before* a human looks at the PR |
176
+ | The economics are opaque | ForgeDock runs on your existing Claude account — it resells no compute and takes no per-task cut. Cost-per-issue benchmarks are tracked in the open ([#1264](https://github.com/RapierCraftStudios/ForgeDock/issues/1264)) |
176
177
 
177
178
  ---
178
179
 
179
- ## Where to Start
180
+ ## Commands
180
181
 
181
- ForgeDock installs 25+ commands, but **you only need three to start.** They cover the entire issue-to-merge loop:
182
+ **The core loop:**
182
183
 
183
184
  | Command | What it does |
184
- |---|---|
185
- | `/issue` | Describe what you want — get a pipeline-ready issue |
186
- | **`/work-on #N`** | Investigate, build, review, and merge it automatically |
187
- | `/review-pr` | Review a PR with domain-specialist agents |
185
+ | --- | --- |
186
+ | **`/work-on`** | Full issue lifecycle: investigate → build → quality gate → review → merge |
187
+ | `/orchestrate` | A whole milestone in parallel — conflict-aware waves, one pipeline per issue |
188
+ | `/issue` | Creates pipeline-ready GitHub issues |
189
+ | `/milestone` | Create, manage, and ship milestones |
190
+ | `/review-pr` | Context-aware PR review with domain-specialist agents |
191
+ | `/quality-gate` | Pre-commit checks, gated by the domains your change actually touches |
192
+ | `/test-gate` | Acceptance verification against running code before anything deploys |
188
193
 
189
- Everything else is additive — add commands as your workflow grows: **Team Workflows** (`/orchestrate`, `/milestone`) when you run work in parallel, **Operations** (`/rollback`, `/incident-response`) when production needs it, and **Pipeline Tuning** (`/autopilot`, `/pipeline-health`) once it's routine. See the [Command Learning Path](docs/site/command-learning-path.md) for the full tiered guide.
194
+ **Observe & recover** — the durable-state story, as commands:
190
195
 
191
- ---
196
+ | Command | What it does |
197
+ | --- | --- |
198
+ | `/pipeline-status` | Fleet view of every in-flight issue, straight from workflow labels |
199
+ | `/pipeline-resume` | Resume an interrupted run from whatever state GitHub reports |
200
+ | `/diagnose` | Trace why a run failed, from its annotations |
201
+ | `/explain` | Translate the FORGE annotations on any issue into plain language |
202
+ | `/replay` | Replay a past run's full audit trail |
203
+ | `/changelog` | Release notes assembled from merged PRs and trajectory receipts |
192
204
 
193
- ## Commands
205
+ **Ops:**
194
206
 
195
207
  | Command | What it does |
196
- |---|---|
197
- | **`/work-on #N`** | Full issue lifecycle: investigate → build → review → merge |
198
- | `/issue` | Create a pipeline-ready GitHub issue |
199
- | `/orchestrate` | Parallel execution across a milestone's issues |
200
- | `/review-pr` | PR review with 9 domain-specialist agents |
201
- | `/quality-gate` | Pre-commit checks across 14+ domains |
202
- | `/milestone` | Plan and ship milestones |
203
- | `/deploy-info` | Staging vs main diff with risk assessment |
204
- | `/review-pr-staging` | Staging-to-main review gate |
208
+ | --- | --- |
209
+ | `/deploy-info` | Staging vs. main diff with risk assessment |
205
210
  | `/rollback` | Automated revert PR for production incidents |
206
- | `/incident-response` | P0 coordination: hotfix, timeline, postmortem |
207
- | `/autopilot` | Autonomous improvement: recon → triage → fix |
208
- | `/pipeline-health` | Self-analysis and prompt tuning |
209
- | `/security-audit` | 4-phase security posture audit |
210
- | `/qa-sweep` | Full platform QA via browser automation |
211
- | `/analytics` | Pull metrics from GSC, Clarity, Umami, Stripe |
212
- | `/cleanup` | Sweep stale issues, branches, worktrees |
211
+ | `/autopilot` | Production signals → triaged issues → fixes |
212
+ | `/security-audit` | Multi-phase security posture audit |
213
+ | `/cleanup` | Sweeps stale issues, branches, worktrees |
214
+
215
+ More ship today (web-property analytics, browser QA sweeps, self-benchmarking) — see the [full command reference](docs/site/command-reference.md). A leaner, tiered install that keeps the core loop front and center is planned in [#1257](https://github.com/RapierCraftStudios/ForgeDock/issues/1257).
213
216
 
214
217
  ---
215
218
 
216
- ## Global Command Namespace
219
+ ## Install
217
220
 
218
- ForgeDock owns the **global** `~/.claude/commands/` namespace. When `npx forgedock` runs, it symlinks all pipeline commands there and writes a `.symlink-source` sentinel file so other installers can detect the owner:
221
+ **Requirements:** [Claude Code](https://docs.anthropic.com/en/docs/claude-code) · [GitHub CLI](https://cli.github.com/) (authenticated) · Node.js ≥ 18.
219
222
 
220
- ```
221
- ~/.claude/commands/
222
- .symlink-source ← sentinel: "ForgeDock owns this namespace"
223
- work-on.md → /path/to/forgedock/commands/work-on.md
224
- review-pr.md → /path/to/forgedock/commands/review-pr.md
225
- ...
223
+ ```bash
224
+ npx forgedock # checks your environment, installs the commands, detects your repo, and hands you a reviewed forge.yaml
226
225
  ```
227
226
 
228
- **Project-specific commands** should install to the **project-local** `.claude/commands/` directory instead:
227
+ One command does everything: it checks your environment, installs the slash commands into Claude Code, detects your repo (owner, branches, paths), and hands you a single annotated `forge.yaml` to review — press Enter to accept. Run `npx forgedock init` any time afterward to re-generate the config only.
229
228
 
230
- ```
231
- your-project/
232
- .claude/
233
- commands/
234
- my-custom-command.md ← project-local — Claude Code merges these in
235
- ```
229
+ Installing also registers a SessionStart hook, so every Claude Code session
230
+ in a forge-managed directory starts already knowing ForgeDock runs it.
231
+ Per-directory control: `npx forgedock enable` / `disable` / `status`.
236
232
 
237
- Claude Code merges global (`~/.claude/commands/`) and project-local (`.claude/commands/`) automatically. Project-local commands win on name collisions.
233
+ Then just open Claude Code and run `/work-on <issue>`.
238
234
 
239
- If another tool runs its own install script that targets `~/.claude/commands/`, it will silently repoint ForgeDock's symlinks to its own source path — breaking all ForgeDock commands globally. The `.symlink-source` sentinel is a machine-readable warning to other installers; ForgeDock also emits a per-command warning during `npx forgedock install` when it detects a collision.
235
+ > **Cost:** ForgeDock is free and open-source. It orchestrates sessions on **your** Claude account — no compute resold, no per-task markup. A typical `/work-on` run on a straightforward bug costs about what a 15–20 minute manual Claude Code session does.
240
236
 
241
- ---
242
-
243
- ## Why ForgeDock
237
+ <details>
238
+ <summary><strong>Other install options & commands</strong></summary>
244
239
 
245
- AI coding agents forget everything between sessions. They re-investigate the same bugs, miss context from past PRs, and make mistakes that were already caught and fixed last week. There's no institutional memory.
240
+ **Claude Code plugin marketplace** (Claude Code v2.1.143+):
246
241
 
247
- ForgeDock fixes this by using **GitHub itself** as the memory layer. Every pipeline stage writes structured `FORGE:` annotations to issues and PRs. Every downstream agent reads them. When a new session starts — even after Claude's context resets — the agent queries GitHub and picks up exactly where the last one left off.
242
+ ```
243
+ /plugin marketplace add RapierCraftStudios/ForgeDock
244
+ /plugin install forgedock@forgedock
245
+ ```
248
246
 
249
- ---
247
+ Commands then appear as `/forgedock:work-on`, etc. You still run `npx forgedock init` to generate `forge.yaml`.
250
248
 
251
- ## How Is This Different
249
+ **Headless / CI:** the pipeline also runs outside Claude Code. `npx forgedock run work-on <issue> --dry-run` previews the assembled prompt and tool plan; with an `ANTHROPIC_API_KEY`, `npx forgedock run` drives the same command specs through a hardened tool-use loop, and `npx forgedock run-issue <issue>` executes them on the durable engine (event-sourced run log, leases, crash-safe resume).
252
250
 
253
- ForgeDock is **not another AI coding agent.** It's a set of prompt-engineered command specs (`.md` files) that run inside Claude Code. No new runtime, no separate process, no vendor lock-in beyond what you already use.
251
+ **Maintenance:**
254
252
 
255
- | | ForgeDock | Plain Claude Code | Cursor / Windsurf | Devin / Sweep |
256
- |---|---|---|---|---|
257
- | Memory across sessions | Structured annotations on GitHub | CLAUDE.md + manual notes | Per-project context | Proprietary cloud state |
258
- | Autonomous pipeline | Full lifecycle: investigate → merge | Manual, step by step | Autocomplete + chat | Autonomous but opaque |
259
- | Review quality | 9 domain-specialist agents | You review everything | Basic suggestions | Varies |
260
- | Infrastructure needed | None — just `npx forgedock` | None | IDE-specific | Cloud service |
261
- | Codebase visibility | Everything stays on GitHub | Local | Local + cloud sync | Cloud-only |
253
+ ```bash
254
+ npx forgedock update # relink commands + refresh the SessionStart hook
255
+ npx forgedock enable # turn ForgeDock on for this directory
256
+ npx forgedock disable # turn ForgeDock off for this directory
257
+ npx forgedock status # show ForgeDock's state for this directory
258
+ npx forgedock doctor # installation health check with fix hints
259
+ npx forgedock uninstall # remove commands, the hook, and tracked copies
260
+ npx forgedock help # show everything
261
+ ```
262
262
 
263
- ---
263
+ > Running `npx forgedock` from *inside* this repo uses the local working tree. From your own project, use `npx forgedock@latest` to pin the published release.
264
264
 
265
- ## FAQ — How is ForgeDock different from X?
265
+ </details>
266
266
 
267
- **vs. DeepWiki (Devin)** — DeepWiki generates a read-only wiki from your codebase once. ForgeDock's FORGE annotations are written by pipeline agents during every issue run — capturing root causes, architectural decisions, and review findings as they happen, not as a snapshot of static code.
267
+ ---
268
268
 
269
- **vs. AGENTS.md / CLAUDE.md** — These files are written and maintained by you. They capture conventions and rules. ForgeDock annotations are written automatically by pipeline agents and capture execution history — what bugs were confirmed, what fixes were shipped, what review findings recurred. Use both: CLAUDE.md for conventions, ForgeDock for institutional memory.
269
+ ## For companies
270
270
 
271
- **vs. Cursor Memories** — Cursor Memories are scoped to the Cursor IDE's backend and don't survive a Claude Code context reset. ForgeDock annotations live on GitHub — any agent, any tool, any human can read them. When Claude's context window compacts mid-session, a ForgeDock agent queries GitHub and resumes exactly where it left off.
271
+ The core is AGPL-3.0 and stays that way: engineers run the full pipeline on their own Claude account, forever free.
272
272
 
273
- **vs. Devin Knowledge Base** — Devin's KB is proprietary, opaque, and vendor-locked. ForgeDock context is plain GitHub issue comments — readable, editable, and queryable with `gh api`. No vendor lock-in, no black box.
273
+ Two things are for sale:
274
274
 
275
- [Full comparison →](docs/comparison.md)
275
+ - **A [commercial license](COMMERCIAL-LICENSE.md)** — for organizations that need ForgeDock inside proprietary workflows or products without AGPL copyleft obligations. Contact [licensing@rapiercraft.studio](mailto:licensing@rapiercraft.studio).
276
+ - **The fleet layer** *(in development)* — org-wide observability over every pipeline run: the receipts on this page, live, across all your repos, plus policy controls and audit-grade provenance for autonomous merges. We're onboarding a small group of design partners — [open a Discussion](https://github.com/RapierCraftStudios/ForgeDock/discussions) or email the address above to get in early.
276
277
 
277
278
  ---
278
279
 
279
- ## Uninstall
280
-
281
- ```bash
282
- npx forgedock uninstall
283
- ```
280
+ ## Where it's going
284
281
 
285
- Removes all ForgeDock command symlinks from `~/.claude/commands/`. Your `forge.yaml` config and any `FORGE:` annotations on GitHub issues/PRs are left untouched.
282
+ Month one built the execution layer. The open roadmap — tracked in the [five-foundations epic (#1320)](https://github.com/RapierCraftStudios/ForgeDock/issues/1320) — is about earning trust while unattended:
286
283
 
287
- ---
284
+ 1. **Durability** — engine-owned state instead of prose-owned state. Headless core shipped ([PR #1326](https://github.com/RapierCraftStudios/ForgeDock/pull/1326)); interactive wiring in progress.
285
+ 2. **Verification** — an outcome-based acceptance gate and a graded eval corpus, so "done" is machine-checkable before anything claims success.
286
+ 3. **Learning** — per-codebase memory that compounds across runs.
287
+ 4. **Economics** — per-run cost accounting and risk×cost dispatch decisions.
288
+ 5. **Provenance** — signed, replayable records of every autonomous change.
288
289
 
289
- ## Documentation
290
-
291
- - [Try ForgeDock Risk-Free](examples/forgedock-demo/) — a tiny demo repo with 5 pre-written issues; clone, `npx forgedock`, `/work-on 1`, and watch a full pipeline run without touching your real code
292
- - [Getting Started in 5 Minutes](docs/site/getting-started.md) — install, configure, first pipeline run
293
- - [How the Knowledge Graph Works](docs/site/how-it-works.md) — FORGE annotations, context relay, compaction resilience
294
- - [What Are Those FORGE Comments?](docs/site/annotations-explained.md) — 2-minute newcomer explainer for the annotations on your issues
295
- - [ForgeDock vs. Manual Workflows](docs/site/vs-manual-workflows.md) — structured pipelines vs. ad-hoc prompting
296
- - [ForgeDock vs. DeepWiki, AGENTS.md, and Cursor Memories](docs/comparison.md) — structural differences between context tools
297
- - [FORGE Annotation Protocol](docs/site/forge-annotation-protocol.md) — open standard spec for AI context passing
298
- - [FORGE Annotation Protocol v1.0 (formal spec)](docs/spec/forge-protocol-v1.md) — standalone, versioned, CC-BY-4.0 specification you can implement in any agent pipeline
299
- - [Command Learning Path](docs/site/command-learning-path.md) — which commands to learn first, tiered by when you need them
300
- - [Command Reference](docs/site/command-reference.md) — all 25+ commands with usage and examples
301
- - [Troubleshooting & Recovery Guide](docs/site/troubleshooting.md) — symptom, cause, and fix for the most common pipeline failures
290
+ Marketing is held to the same standard: [#1264](https://github.com/RapierCraftStudios/ForgeDock/issues/1264) gates our own launch on measured cost-per-issue benchmarks — no estimated claims.
302
291
 
303
292
  ---
304
293
 
305
- ## Star History
306
-
307
- <a href="https://star-history.com/#RapierCraftStudios/ForgeDock&Date">
308
- <picture>
309
- <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=RapierCraftStudios/ForgeDock&type=Date&theme=dark" />
310
- <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=RapierCraftStudios/ForgeDock&type=Date" />
311
- <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=RapierCraftStudios/ForgeDock&type=Date" />
312
- </picture>
313
- </a>
294
+ ## Show your support
314
295
 
315
- ---
296
+ Using ForgeDock in your pipeline? Add the badge — each one is a backlink and a signal to other developers:
316
297
 
317
- ## Contributing
298
+ ```markdown
299
+ [![Built with ForgeDock](https://raw.githubusercontent.com/RapierCraftStudios/ForgeDock/main/assets/built-with-forgedock.svg)](https://github.com/RapierCraftStudios/ForgeDock)
300
+ ```
318
301
 
319
- PRs welcome. Every change goes through a PR, tested against 3+ scenarios, using conventional commits (`fix(command):`, `feat(command):`, `refactor(command):`).
302
+ [![Built with ForgeDock](assets/built-with-forgedock.svg)](https://github.com/RapierCraftStudios/ForgeDock)
320
303
 
321
- ## License
304
+ ---
322
305
 
323
- ForgeDock uses a **dual-licensing model**:
306
+ ## Star History
324
307
 
325
- - **[AGPL-3.0](LICENSE)** — free to use, modify, and distribute for open-source and personal use. If you modify ForgeDock and offer it as a service (including over a network), you must open-source your modifications under AGPL-3.0.
308
+ <div align="center">
326
309
 
327
- - **[Commercial License](COMMERCIAL-LICENSE.md)** — for organizations that need to use ForgeDock in proprietary workflows or products without AGPL-3.0 copyleft obligations. [Contact RapierCraft Studios](mailto:licensing@rapiercraft.studio) to obtain a commercial license.
310
+ <a href="https://star-history.com/#RapierCraftStudios/ForgeDock&Date">
311
+ <picture>
312
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=RapierCraftStudios/ForgeDock&type=Date&theme=dark" />
313
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=RapierCraftStudios/ForgeDock&type=Date" width="600" />
314
+ </picture>
315
+ </a>
328
316
 
329
- The open-source core remains free under AGPL-3.0. The commercial license is an exception for customers who cannot meet the copyleft requirements.
317
+ </div>
330
318
 
331
319
  ---
332
320
 
333
- <div align="center">
321
+ ## Docs & community
334
322
 
335
- <p>Built by <a href="https://github.com/RapierCraftStudios">RapierCraft Studios</a></p>
323
+ - [Getting Started in 5 Minutes](docs/site/getting-started.md)
324
+ - [How the Knowledge Graph Works](docs/site/how-it-works.md)
325
+ - [What Are Those FORGE Comments?](docs/site/annotations-explained.md) — 2-minute explainer for annotations you meet in the wild
326
+ - [FORGE Annotation Protocol](docs/FORGE-PROTOCOL.md) — the open standard for AI context passing ([formal v1.0 spec](docs/spec/forge-protocol-v1.md))
327
+ - [ForgeDock vs. Manual Claude Code Workflows](docs/site/vs-manual-workflows.md)
328
+ - [ForgeDock vs. DeepWiki, AGENTS.md, and Cursor Memories](docs/comparison.md)
329
+ - [Command Learning Path](docs/site/command-learning-path.md) — which commands to learn first
330
+ - [Complete Command Reference](docs/site/command-reference.md)
331
+ - [Troubleshooting & Recovery](docs/site/troubleshooting.md)
336
332
 
337
- <a href="https://github.com/sponsors/RapierCraftStudios"><img src="https://img.shields.io/badge/Sponsor-%E2%9D%A4-ea4aaa.svg?style=flat-square" alt="Sponsor" /></a>
333
+ **Contributing:** PRs welcome — every change goes through a PR, tested against 3+ scenarios, using conventional commits (`fix(command):`, `feat(command):`). **License:** [AGPL-3.0](LICENSE) — free to use, modify, and distribute; network use of modifications must be open-sourced under the same license. Commercial licenses are available for proprietary use — see [COMMERCIAL-LICENSE.md](COMMERCIAL-LICENSE.md).
338
334
 
335
+ <div align="center">
336
+ <br />
337
+ <p>Built and dogfooded in production by <a href="https://github.com/RapierCraftStudios">RapierCraft Studios</a>.</p>
339
338
  </div>