forge-workflow 0.1.0-beta.4 → 0.1.0-beta.6

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 (196) hide show
  1. package/AGENTS.md +18 -7
  2. package/CHANGELOG.md +79 -1
  3. package/CLAUDE.md +0 -12
  4. package/CODING_STANDARDS.md +72 -0
  5. package/README.md +6 -2
  6. package/bin/forge-cmd.js +20 -0
  7. package/bin/forge.js +28 -375
  8. package/docs/INDEX.md +1 -1
  9. package/docs/guides/BEADS_GITHUB_SYNC.md +2 -31
  10. package/docs/guides/MIGRATION.md +4 -4
  11. package/docs/guides/SETUP.md +16 -16
  12. package/docs/reference/COMMANDS.md +8 -5
  13. package/docs/reference/FORGE_KERNEL_STORAGE_MODEL.md +4 -0
  14. package/docs/reference/INSIGHTS_RECAP.md +9 -20
  15. package/docs/reference/INSTALL.md +4 -0
  16. package/docs/reference/LEGACY_CLAIM_REPAIR.md +112 -0
  17. package/docs/reference/RELEASE.md +5 -3
  18. package/docs/reference/TOOLCHAIN.md +8 -0
  19. package/docs/reference/github-accounts.md +134 -0
  20. package/docs/reference/protected-state-surfaces.md +4 -4
  21. package/docs/reference/shepherd.md +114 -35
  22. package/lefthook.yml +12 -0
  23. package/lib/activation/ensure-forge-home.js +33 -15
  24. package/lib/adapters/pr-state-adapter.js +359 -144
  25. package/lib/audit-evidence.js +71 -110
  26. package/lib/base-remote.js +138 -0
  27. package/lib/beta5-compatibility-evidence.js +1093 -0
  28. package/lib/bun-lockfile-proof.js +413 -0
  29. package/lib/bun-workflow-pins.js +461 -0
  30. package/lib/capabilities/index.js +9 -0
  31. package/lib/capabilities/model.js +141 -0
  32. package/lib/capabilities/probes.js +347 -0
  33. package/lib/capped-jsonl-log.js +236 -0
  34. package/lib/codex-skills.js +2 -2
  35. package/lib/commands/_manifest.js +1 -0
  36. package/lib/commands/_registry.js +50 -20
  37. package/lib/commands/clean.js +252 -32
  38. package/lib/commands/dev.js +4 -33
  39. package/lib/commands/doctor.js +37 -6
  40. package/lib/commands/gate.js +197 -27
  41. package/lib/commands/github.js +215 -0
  42. package/lib/commands/hooks.js +276 -30
  43. package/lib/commands/insights.js +8 -3
  44. package/lib/commands/memory.js +66 -2
  45. package/lib/commands/merge.js +1265 -58
  46. package/lib/commands/plan.js +33 -2
  47. package/lib/commands/pr.js +3 -1
  48. package/lib/commands/preflight.js +21 -4
  49. package/lib/commands/prime.js +21 -8
  50. package/lib/commands/push.js +146 -54
  51. package/lib/commands/recall.js +127 -49
  52. package/lib/commands/recap.js +6 -1
  53. package/lib/commands/release.js +39 -3
  54. package/lib/commands/remember.js +28 -4
  55. package/lib/commands/serve.js +26 -9
  56. package/lib/commands/setup.js +323 -98
  57. package/lib/commands/shepherd.js +591 -73
  58. package/lib/commands/ship.js +36 -91
  59. package/lib/commands/skill.js +127 -11
  60. package/lib/commands/status.js +17 -1
  61. package/lib/commands/team.js +47 -8
  62. package/lib/commands/test.js +187 -38
  63. package/lib/commands/validate.js +65 -21
  64. package/lib/commands/worktree.js +359 -45
  65. package/lib/core/runtime-graph.js +1 -1
  66. package/lib/doc-assertions.js +297 -0
  67. package/lib/existing-tdd-gate.js +253 -0
  68. package/lib/fixtures/beta5-corpus/v1/README.md +9 -0
  69. package/lib/fixtures/beta5-corpus/v1/contract/command-contract.json +26 -0
  70. package/lib/fixtures/beta5-corpus/v1/contract/package-contract.json +13 -0
  71. package/lib/fixtures/beta5-corpus/v1/contract/workflow-stage-matrix.json +8 -0
  72. package/lib/fixtures/beta5-corpus/v1/manifest.json +25 -0
  73. package/lib/fixtures/beta5-corpus/v1/state/comments.jsonl +1 -0
  74. package/lib/fixtures/beta5-corpus/v1/state/config.yaml +6 -0
  75. package/lib/fixtures/beta5-corpus/v1/state/dependencies.jsonl +1 -0
  76. package/lib/fixtures/beta5-corpus/v1/state/issues.jsonl +2 -0
  77. package/lib/fixtures/beta5-corpus/v1/state/kernel.sql +20 -0
  78. package/lib/forge-context.js +1 -4
  79. package/lib/forge-issues.js +134 -32
  80. package/lib/gate-events.js +98 -10
  81. package/lib/git-defaults.js +56 -0
  82. package/lib/github-context.js +308 -0
  83. package/lib/global-flags.js +1 -0
  84. package/lib/harness-capability-matrix.js +3 -3
  85. package/lib/hook-renderer.js +122 -5
  86. package/lib/insights.js +96 -80
  87. package/lib/issue-render.js +19 -0
  88. package/lib/kernel/backing-issue.js +14 -2
  89. package/lib/kernel/broker.js +739 -31
  90. package/lib/kernel/claim-reconciler.js +238 -0
  91. package/lib/kernel/cli-broker-factory.js +12 -1
  92. package/lib/kernel/close-on-merge.js +154 -0
  93. package/lib/kernel/fs-class.js +42 -25
  94. package/lib/kernel/lease-enforcer.js +9 -4
  95. package/lib/kernel/legacy-claim-repair.js +442 -0
  96. package/lib/kernel/live-claim-projection.js +26 -0
  97. package/lib/kernel/migrations.js +118 -3
  98. package/lib/kernel/readiness-model.js +184 -12
  99. package/lib/kernel/schema.js +49 -1
  100. package/lib/kernel/sqlite-driver.js +3435 -172
  101. package/lib/kernel/taxonomy-validator.js +4 -1
  102. package/lib/kernel/windows-private-acl.js +239 -0
  103. package/lib/lefthook-wiring.js +21 -1
  104. package/lib/memory/hygiene.js +191 -0
  105. package/lib/memory/router.js +110 -28
  106. package/lib/memory/usage-evidence.js +4 -0
  107. package/lib/memory-digest.js +106 -15
  108. package/lib/memory-recall-events.js +145 -0
  109. package/lib/memory-recall.js +71 -10
  110. package/lib/merge-rules.js +143 -21
  111. package/lib/npm-publish-workflow.js +465 -0
  112. package/lib/orientation.js +68 -43
  113. package/lib/package-root.js +2 -0
  114. package/lib/plugin-catalog.js +14 -4
  115. package/lib/pr-bundle.js +5 -6
  116. package/lib/pr-monitor/auto-actions.js +169 -28
  117. package/lib/pr-monitor/differ.js +110 -4
  118. package/lib/pr-monitor/events.js +0 -0
  119. package/lib/pr-monitor/flow-monitor.js +1424 -0
  120. package/lib/pr-monitor/gather.js +251 -44
  121. package/lib/pr-monitor/journal.js +18 -39
  122. package/lib/pr-monitor/monitor.js +117 -10
  123. package/lib/pr-monitor/process-identity.js +117 -0
  124. package/lib/pr-monitor/reconcile-executor.js +1129 -470
  125. package/lib/pr-monitor/reconcile.js +0 -0
  126. package/lib/pr-monitor/render-summary.js +293 -0
  127. package/lib/pr-monitor/review-preflight.js +269 -0
  128. package/lib/pr-monitor/shepherd-lease.js +38 -20
  129. package/lib/pr-monitor/verdict.js +438 -0
  130. package/lib/pr-monitor/watch-lifecycle.js +145 -27
  131. package/lib/pr-monitor/watch-owner.js +1414 -0
  132. package/lib/pr-monitor/watch.js +129 -58
  133. package/lib/pr-pull.js +33 -14
  134. package/lib/pr-shepherd.js +51 -11
  135. package/lib/preflight/gates.js +65 -18
  136. package/lib/preflight/runner.js +5 -0
  137. package/lib/project-memory.js +178 -4
  138. package/lib/protected-state-authority.js +1100 -0
  139. package/lib/protected-state-surfaces.js +243 -45
  140. package/lib/release-readiness.js +53 -7
  141. package/lib/review-adapter.js +65 -0
  142. package/lib/shell-utils.js +1 -1
  143. package/lib/skills-sync.js +71 -35
  144. package/lib/smart-merge.js +28 -4
  145. package/lib/symlink-utils.js +74 -26
  146. package/lib/upgrade-safety.js +39 -0
  147. package/lib/using-forge.js +19 -6
  148. package/lib/validation/risk-manifest.js +339 -0
  149. package/lib/workflow/enforce-stage.js +44 -0
  150. package/lib/workflow/plan-authority.js +225 -0
  151. package/package.json +12 -9
  152. package/scripts/commitlint.js +13 -15
  153. package/scripts/doc-asserting-tests.js +158 -0
  154. package/scripts/generate-risk-manifest.js +91 -0
  155. package/scripts/github-context-bridge.sh +10 -0
  156. package/scripts/legacy-claim-repair.js +145 -0
  157. package/scripts/lib/behavioral-eval-runner.js +310 -0
  158. package/scripts/lib/behavioral-eval-runtime.js +457 -0
  159. package/scripts/lib/eval-evidence.js +328 -0
  160. package/scripts/lib/eval-runner.js +81 -41
  161. package/scripts/lib/immutable-eval-corpus.js +309 -0
  162. package/scripts/lib/promotion-evidence-loader.js +94 -0
  163. package/scripts/lib/promotion-scorecard.js +314 -0
  164. package/scripts/npm-release-receipt.js +134 -0
  165. package/scripts/process-tree.js +773 -0
  166. package/scripts/protected-state-check.js +479 -31
  167. package/scripts/run-command-eval.js +29 -1
  168. package/scripts/sync-agent-skills.js +333 -34
  169. package/scripts/sync-d20-audit.js +172 -0
  170. package/scripts/test-full-suite.js +935 -37
  171. package/scripts/test-profile.js +13 -3
  172. package/scripts/test.js +271 -57
  173. package/skills/coverage.json +1 -0
  174. package/skills/review/SKILL.md +6 -11
  175. package/skills/review/evals/scorecard.json +4 -4
  176. package/skills/rollback/SKILL.md +4 -11
  177. package/skills/rollback/evals/scorecard.json +3 -3
  178. package/skills/setup/SKILL.md +18 -0
  179. package/skills/setup/evals/scorecard.json +3 -3
  180. package/skills/shepherd/SKILL.md +39 -16
  181. package/skills/shepherd/evals/scorecard.json +4 -4
  182. package/skills/ship/SKILL.md +4 -12
  183. package/skills/ship/evals/scorecard.json +3 -3
  184. package/skills/validate/SKILL.md +3 -0
  185. package/skills/validate/evals/scorecard.json +1 -1
  186. package/skills/worktree/SKILL.md +6 -1
  187. package/skills/worktree/evals/scorecard.json +2 -2
  188. package/lib/beads-setup.js +0 -538
  189. package/lib/beads-sync-scaffold.js +0 -189
  190. package/lib/pat-setup.js +0 -207
  191. package/lib/pr-monitor/render-sticky.js +0 -206
  192. package/lib/pr-monitor/upsert-sticky.js +0 -169
  193. package/scripts/beads-context.sh +0 -577
  194. package/scripts/beads-migrate-to-dolt.sh +0 -7
  195. package/scripts/beads-upgrade-smoke.sh +0 -284
  196. package/scripts/lib/beads-migrate-to-dolt.mjs +0 -503
@@ -1,6 +1,6 @@
1
1
  # Migration Guide
2
2
 
3
- Use this guide when moving older Forge docs, habits, or installed scaffolding toward the v0.0.11 public framing.
3
+ Use this guide when moving older Forge docs, habits, or installed scaffolding toward the v0.1.0-beta.6 public framing.
4
4
 
5
5
  ## What Changed
6
6
 
@@ -26,7 +26,7 @@ Use both entry points correctly:
26
26
 
27
27
  - `forge init` creates the `.forge/` adoption skeleton.
28
28
  - `forge setup` installs agent instructions, skills, harness files, local Beads compatibility, and optional setup material.
29
- - `forge setup --sync` is deprecated and retained only to remove old generated Beads/GitHub sync scaffolding when present.
29
+ - `forge setup` also removes old generated Beads/GitHub sync scaffolding when present, with no flag needed.
30
30
 
31
31
  ## From Singular Agent Flags
32
32
 
@@ -39,8 +39,8 @@ forge setup --agents claude,cursor
39
39
 
40
40
  ## Version Labels
41
41
 
42
- - `0.0.11` is the package version for this public docs/readiness release.
43
- - `0.0.10` is the previous published package version.
42
+ - `0.1.0-beta.6` is the current prerelease package version.
43
+ - `0.1.0-beta.5` is the previous prerelease package version.
44
44
  - Internal labels such as `0.0.19` or `v3` describe roadmap slices or historical codenames. Do not present them as current package versions.
45
45
 
46
46
  ## Safe Upgrade Path
@@ -59,10 +59,16 @@ bunx forge setup --agents claude cursor
59
59
  bunx forge setup --all --quick
60
60
  bunx forge setup --path ./my-project --agents codex --dry-run
61
61
  bunx forge setup --merge smart --agents claude,cursor
62
+ bunx forge setup --agents claude --skills-only
62
63
  ```
63
64
 
64
65
  Use `--agents`, not `--agent`.
65
66
 
67
+ Use `--skills-only` (or its `--no-hooks` alias) when you want the Forge skill
68
+ suite without installing Git hooks, Forge-native hook scripts, or Claude/Cursor
69
+ native hook enforcement. The default `forge setup` behavior is unchanged, and
70
+ the option is safe to re-run.
71
+
66
72
  ## Agent Notes
67
73
 
68
74
  Forge currently supports Claude Code, Codex, and Cursor. Hermes support is planned.
@@ -75,31 +81,25 @@ Exact generated files depend on selected agents and existing repository files. U
75
81
 
76
82
  ## Issue Backend
77
83
 
78
- Forge issue commands (`forge ready`, `forge show`, `forge claim`, `forge create`, `forge close`) use the built-in **kernel** backend by default. No install or initialization is required — a fresh clone can track issues immediately.
84
+ Forge issue commands (`forge ready`, `forge show`, `forge claim`, `forge create`, `forge close`) use the built-in **kernel** backend. No install or initialization is required — a fresh clone can track issues immediately.
79
85
 
80
- ## Beads (Opt-Out Backend)
86
+ ## Migrating From Beads
81
87
 
82
- Beads (`bd`) is an optional opt-out backend for teams that prefer Dolt-backed sync internals. Select it (precedence, highest first) with `--issue-backend beads`, `FORGE_ISSUE_BACKEND=beads`, or `issueBackend: beads` in `.forge/config.yaml`; only then is `bd` required. Prefer the current Beads installer documented by Beads itself and this repo's toolchain docs. On Windows, avoid stale global install examples if they hit EPERM or shim issues; use the PowerShell installer path described in [Toolchain](../reference/TOOLCHAIN.md).
88
+ Beads is no longer a selectable backend: `--issue-backend beads`, `FORGE_ISSUE_BACKEND=beads`, and `issueBackend: beads` are rejected, and `bd` is never required. An existing `.beads` directory is import-only state.
83
89
 
84
- When Beads is selected, health checks:
90
+ Import it once, then use the kernel issue commands:
85
91
 
86
92
  ```bash
87
- bd doctor
88
- bd dolt status
89
- forge sync
93
+ forge migrate --from beads
90
94
  ```
91
95
 
92
- If a feature worktree reports `database "forge" not found on Dolt server`, diagnose in the root checkout before changing issue state. This applies only to the Beads backend.
93
-
94
96
  ## Deprecated GitHub Sync Cleanup
95
97
 
96
- To remove old generated GitHub/Beads sync files from an existing install:
97
-
98
- ```bash
99
- bunx forge setup --sync
100
- ```
101
-
102
- `forge setup --sync` is deprecated. It now removes old generated Beads/GitHub sync files instead of creating new sync workflows. Future GitHub issue sync belongs to Forge Kernel/server authority, not Beads runtime files or metadata commits.
98
+ `forge setup` removes old generated GitHub/Beads sync files from an existing
99
+ install automatically — there is no flag for it. Only files whose content
100
+ matches a known generated template are removed, so files you have edited
101
+ yourself are left alone. Future GitHub issue sync belongs to Forge Kernel/server
102
+ authority, not Beads runtime files or metadata commits.
103
103
 
104
104
  ## Validate Setup
105
105
 
@@ -53,22 +53,25 @@ forge plan "<feature description>"
53
53
  forge dev [--issue-id <id>] [--phase red|green|refactor]
54
54
  forge validate
55
55
  forge ship <feature-slug> [<title>] [--dry-run]
56
- forge status [--full] [--json]
57
- forge prime [--budget N] [--json]
56
+ forge status [-v|--verbose] [--full] [--json]
57
+ forge prime [--budget N] [--json] # deprecated alias for `forge status -v`
58
58
  forge orient [--budget N] [--json]
59
59
  forge recap <issue> [--budget N] [--json]
60
60
  forge recall [query] [--limit N] [--all] [--json]
61
61
  forge remember <note> [--tag <label>]... [--json]
62
62
  forge skill for "<situation>" [--json]
63
+ forge skill eval <skill> --full --tier <30|100|300> [--json]
63
64
  ```
64
65
 
65
66
  - `forge plan` creates the implementation plan, kernel issue, and feature branch/worktree from a researched feature description; it prints the created issue id, branch name, and the suggested next command.
66
67
  - `forge dev` runs the TDD development stage with RED/GREEN/REFACTOR phase guidance; `--issue-id` scopes it to a specific kernel issue and `--phase` overrides auto-detection.
67
68
  - `forge validate` runs the validation orchestration pipeline (conflict markers, type check, lint, security, tests) with no arguments — see also `bun run check` under Validation And Packaging.
68
69
  - `forge ship` creates the pull request from validated feature work (wraps `gh pr create`); `--dry-run` previews without creating a PR.
69
- - `forge status` is the one-glance orientation command: where you are, what to run next, and your active work; `--full` also shows blocked/stale/recently-completed issues.
70
- - `forge prime` emits the bounded session-entry orientation envelope agents read at the start of a session; it now leads with a bounded (<=20-line) **live-state** block — current stage, claimed issue(s), ready-work count, enabled gates/rails, and one progressive-adoption nudge — collected best-effort (never blocks, honest fallbacks) before the deterministic orientation.
71
- - `forge skill for "<situation>"` is the deterministic intent-to-skill router: it reads the canonical skill catalog and prints the best-fit Forge skill(s) plus why, as the reasoning fallback for harnesses without a SessionStart hook that auto-injects the `using-forge` dispatch skill. `--json` emits the machine-readable routing result. The `forge skill` noun is structured so later waves can add `forge skill eval` / `forge skill scores`.
70
+ - `forge status` is the one-glance orientation command: where you are, what to run next, and your active work; `--full` also shows blocked/stale/recently-completed issues. `-v`/`--verbose` prints the full session-entry briefing instead of the short pulse (git-status-v semantics).
71
+ - `forge status -v` emits the bounded session-entry orientation envelope agents read at the start of a session; it leads with a bounded (<=20-line) **live-state** block — current stage, claimed issue(s), ready-work count, enabled gates/rails, and one progressive-adoption nudge — collected best-effort (never blocks, honest fallbacks) before the deterministic orientation.
72
+ - `forge prime` is a **deprecated** alias for `forge status -v`. It still works and its stdout is byte-identical (session-start hooks consume it as context), but it prints a one-line deprecation notice on stderr.
73
+ - `forge skill for "<situation>"` is the deterministic intent-to-skill router: it reads the canonical skill catalog and prints the best-fit Forge skill(s) plus why, as the reasoning fallback for harnesses without a SessionStart hook that auto-injects the `using-forge` dispatch skill. `--json` emits the machine-readable routing result.
74
+ - `forge skill eval <skill> --full --tier <30|100|300>` runs the controlled four-arm behavioral protocol against the current PR head. It requires a live Kernel issue, an open PR at the exact local HEAD, and an isolated supported runtime. Tier 30 is instrumentation-only, tier 100 is the decision gate, and tier 300 is confirmation. Missing attribution, controls, usage, or reconstructable evidence returns `INCOMPLETE`; the command never authorizes merge.
72
75
  - `forge orient` emits bounded project orientation from deterministic source files (broader than `prime`, still token-budgeted via `--budget`).
73
76
  - `forge recap <issue>` is the issue-scoped counterpart to `forge orient`/`forge prime` — it summarizes a single issue from the same deterministic file assembly instead of the whole project. Requires an issue id; running it with no id (or `--help`) prints usage only.
74
77
  - `forge recall` retrieves project-memory notes from the kernel-backed memory store; omit `query` to list recent notes.
@@ -79,6 +79,10 @@ Forge Kernel local mode uses a builtin SQLite runtime driver. Driver selection m
79
79
 
80
80
  The selected driver must pass conformance checks for WAL mode, `busy_timeout`, transactions, WAL checkpointing, backup creation, and FTS5 before Forge claims real local SQLite authority behavior.
81
81
 
82
+ Legacy claim contradictions are handled only by the explicit, human-gated
83
+ [legacy claim repair](./LEGACY_CLAIM_REPAIR.md). The broker never starts or applies
84
+ that repair automatically.
85
+
82
86
  ## Team Mode
83
87
 
84
88
  Team mode requires server authority.
@@ -1,6 +1,6 @@
1
1
  # Insights And Recap
2
2
 
3
- `forge insights` and `forge recap` summarize recurring local workflow evidence from existing Forge and Beads state.
3
+ `forge insights` summarizes recurring local workflow evidence from Kernel and Forge state. `forge recap <issue>` renders a bounded, issue-scoped orientation envelope from the same Kernel issue record.
4
4
 
5
5
  ## Commands
6
6
 
@@ -11,24 +11,24 @@ forge insights --min-count 2 --limit 5
11
11
  forge insights --json
12
12
  forge insights accept <candidate-id> --note "why this is useful"
13
13
  forge insights reject <candidate-id> --note "why this is noise"
14
- forge recap
15
- forge recap --json
14
+ forge recap <issue>
15
+ forge recap <issue> --json
16
16
  ```
17
17
 
18
- `--review-feedback` is a compatibility alias. In this MVP it reads Beads interactions and issue evidence; it does not infer external review-provider comments.
18
+ `--review-feedback` is a compatibility alias. It reads kernel events and issue evidence; it does not infer external review-provider comments.
19
19
 
20
20
  ## Evidence Sources
21
21
 
22
- - `.beads/interactions.jsonl`: field changes and review/close outcome reasons.
23
- - `.beads/issues.jsonl`: tokenized issue titles and descriptions for themes, plus statuses and timestamps for recap context.
22
+ - Kernel events (`kernel_events`, newest first): field changes and review/close outcome reasons. Interactions imported from a legacy Beads store are read here too, as `beads.interaction.<kind>` events.
23
+ - Kernel issues (`forge issue list`): tokenized issue titles and descriptions for themes, plus statuses and timestamps.
24
24
  - `.forge/log.jsonl` and `.forge/audit.log`: optional audit event counts when present.
25
- - Beads-backed typed memory: accept/reject decisions are recorded through `lib/memory/typed-api.js`.
25
+ - Typed memory: accept/reject decisions are recorded through `lib/memory/typed-api.js`.
26
26
 
27
27
  ## What It Can Infer
28
28
 
29
29
  - Repeated local workflow patterns.
30
30
  - Candidate follow-ups based on frequency, source diversity, and evidence count.
31
- - Recent issue activity and review outcome counts.
31
+ - Recent issue activity counts.
32
32
  - Whether history is too sparse for a useful suggestion.
33
33
 
34
34
  ## What It Cannot Infer
@@ -48,16 +48,5 @@ Ranked candidates:
48
48
  Next: Review interaction evidence and consider a local workflow skill only if the pattern is still useful.
49
49
  Limitations:
50
50
  - Insights are local workflow signals, not proof of correctness.
51
- ```
52
-
53
- ```text
54
- Forge recap
55
- Issues: 260 total, 94 open, 166 closed
56
- Review outcomes found: 4
57
- Recent work:
58
- - forge-besw.12: forge insights --review-feedback PoC (Week 1 deliverable) [open]
59
- Insight candidates:
60
- - insight-interaction-status-closed-merged-and-verified: status changed to closed (merged-and-verified)
61
- Limitations:
62
- - Sparse Beads interactions or missing Forge audit logs reduce confidence.
51
+ - Sparse kernel events or missing Forge audit logs reduce confidence.
63
52
  ```
@@ -155,6 +155,10 @@ installed and on your `PATH`:
155
155
  These are runtime prerequisites checked by `forge`'s own health checks; the
156
156
  installer does not install them for you.
157
157
 
158
+ Using personal and work GitHub accounts together? See the optional
159
+ [per-clone GitHub account guide](github-accounts.md). Ordinary single-account
160
+ setup is unchanged.
161
+
158
162
  ---
159
163
 
160
164
  ## Uninstall
@@ -0,0 +1,112 @@
1
+ # Legacy Claim Repair
2
+
3
+ This is an explicit operator tool for the one-time pre-0.1.0 reconciliation of
4
+ legacy Kernel claim rows. It is not called by setup, startup, broker migrations,
5
+ claim acquisition, or any background process.
6
+
7
+ ## Safety contract
8
+
9
+ - Always use an explicit, file-backed database path and a different backup path.
10
+ - The observation time is mandatory and must be one canonical UTC instant. Reuse
11
+ that literal time for approval and apply.
12
+ - Dry-run does not mutate Kernel authority. It creates a separate SQLite backup,
13
+ restores that backup into an isolated temporary database, and requires the
14
+ restored snapshot digest to equal the source preflight digest. On POSIX
15
+ systems, both the temporary and final backup are forced to owner-only `0600`
16
+ permissions before the backup is accepted. On Windows, inherited access is
17
+ removed and a private DACL for the current operator is applied and verified.
18
+ - The digest covers the complete Kernel database schema and every row in every
19
+ authority table, while the report exposes only the digest and aggregate claim
20
+ counts. Any intervening Kernel write invalidates approval.
21
+ - Preflight fails closed on integrity, foreign-key, schema/index, duplicate-row,
22
+ state, timestamp, read faults, or active claims attached to unclaimable issue
23
+ types.
24
+ - Apply requires the human-approved exact digest and the verified backup. It
25
+ acquires `BEGIN IMMEDIATE`, re-reads the complete repair snapshot, rejects any
26
+ digest drift, and compare-and-swaps every exact row before committing one
27
+ privacy-safe receipt.
28
+ - Terminal issue state wins over expiry: its active claim becomes `released`.
29
+ An expired active claim on nonterminal work becomes `reclaimable`. Valid
30
+ unexpired leases and historical null-expiry leases remain active.
31
+ - Replaying the same approved digest returns the original receipt without another
32
+ mutation. Any interruption before receipt commit rolls back the whole repair.
33
+
34
+ ## Dry-run and approval
35
+
36
+ Choose the observation time once; do not substitute a moving clock between steps.
37
+
38
+ ```powershell
39
+ bun scripts/legacy-claim-repair.js --dry-run `
40
+ --database <absolute-kernel.sqlite> `
41
+ --backup <absolute-separate-backup.sqlite> `
42
+ --at <YYYY-MM-DDTHH:mm:ss.sssZ>
43
+ ```
44
+
45
+ ```bash
46
+ bun scripts/legacy-claim-repair.js --dry-run \
47
+ --database <absolute-kernel.sqlite> \
48
+ --backup <absolute-separate-backup.sqlite> \
49
+ --at <YYYY-MM-DDTHH:mm:ss.sssZ>
50
+ ```
51
+
52
+ Every dry-run requires a new, unused `--backup` path. Repeating a dry-run with
53
+ the same path fails closed instead of overwriting the immutable backup.
54
+
55
+ Review the privacy-safe counts, `preflight.digest`, `preflight.after_digest`, and
56
+ backup proof. Approval must name the exact `preflight.digest`.
57
+
58
+ ## Apply (human-gated)
59
+
60
+ Do not run this command until the exact dry-run digest is explicitly approved.
61
+
62
+ ```powershell
63
+ bun scripts/legacy-claim-repair.js --apply `
64
+ --database <absolute-kernel.sqlite> `
65
+ --backup <absolute-separate-backup.sqlite> `
66
+ --at <same-literal-observation-time> `
67
+ --approved-digest <approved-preflight-digest> `
68
+ --actor <operator-id>
69
+ ```
70
+
71
+ ```bash
72
+ bun scripts/legacy-claim-repair.js --apply \
73
+ --database <absolute-kernel.sqlite> \
74
+ --backup <absolute-separate-backup.sqlite> \
75
+ --at <same-literal-observation-time> \
76
+ --approved-digest <approved-preflight-digest> \
77
+ --actor <operator-id>
78
+ ```
79
+
80
+ If an apply process is forcibly terminated, it may leave empty blocker
81
+ directories named `<backup>-wal`, `<backup>-shm`, and `<backup>-journal`. After
82
+ confirming that no repair process is still running, remove those stale
83
+ directories before verifying or reusing that backup. An already committed
84
+ receipt can still be replayed without this cleanup.
85
+
86
+ `CLAIM_REPAIR_BACKUP_POSTCOMMIT_DRIFT` means the repair and receipt committed,
87
+ but the named backup changed during commit. Do not discard the
88
+ `details.recovery_path` copy: it is the independently retained verified backup.
89
+ Fence writers and investigate the named path before any restore. Repeating the
90
+ same approved apply returns the committed receipt without mutating rows again.
91
+
92
+ A successful first apply also reports `receipt.recovery_path`, and its durable
93
+ receipt stores a privacy-safe `recovery_ref` suffix so a retry with the same
94
+ `--backup` path reconstructs the retained artifact after response loss. The
95
+ tool never automatically unlinks this owner-only independent copy after commit
96
+ because no final check can make a later unlink race-free. Keep it until the
97
+ named backup and receipt have been independently verified. A human may then
98
+ remove that exact reported recovery path after confirming that no repair
99
+ process is running.
100
+
101
+ On POSIX the recovery file and its parent directory entry are synced before the
102
+ authority transaction commits. Every receipt replay reopens the retained copy,
103
+ reapplies owner-only permissions, and verifies its exact digest and identity
104
+ before reporting success.
105
+
106
+ ## Restore boundary
107
+
108
+ Restore is deliberately not automated. Fence every Kernel writer, stop Forge
109
+ processes, and close all database handles first. Preserve the failed database and
110
+ its `-wal`/`-shm` sidecars for diagnosis, then restore the separately verified
111
+ backup to a new path and run the same fixed-time dry-run there before replacing
112
+ authority. Never overwrite a live or open SQLite database.
@@ -2,9 +2,9 @@
2
2
 
3
3
  This page documents release readiness. Package publishing still requires the explicit publish step after merge.
4
4
 
5
- ## v0.0.11 Boundary
5
+ ## v0.1.0-beta.6 Boundary
6
6
 
7
- v0.0.11 is the public documentation and positioning package release. The release branch bumps package metadata to `0.0.11`; publish only after the release PR is merged, tagged, and validated.
7
+ v0.1.0-beta.6 is the current prerelease boundary. The release branch declares `0.1.0-beta.6`; publish only after the release PR is merged, tagged, and validated on that exact SHA.
8
8
 
9
9
  Keep these release steps explicit:
10
10
 
@@ -23,6 +23,8 @@ bun run check
23
23
  npm pack --dry-run
24
24
  ```
25
25
 
26
+ The trusted npm workflow is generated through `forge release generate-npm-workflow --expect-head "$(git rev-parse HEAD)"`; the full expected SHA must match the current checkout, and direct workflow edits remain blocked. The generated authorization is bound to that SHA, actor, worktree, path, and exact content, so moving HEAD before staging also fails closed. On a release event, the workflow resolves the tag once, runs the complete supported repository suite on that immutable commit, and allows publication only when the attributable suite receipt, verification checkout, and publish checkout all name the same SHA.
27
+
26
28
  For docs-heavy changes, also run a Markdown link check if available. If no docs checker exists and adding one would broaden the PR, create a follow-up issue instead.
27
29
 
28
30
  ## Packaging Check
@@ -41,7 +43,7 @@ Release notes should include:
41
43
  - adapter compatibility
42
44
  - DeepWiki refresh checklist
43
45
 
44
- The v0.0.11 release notes live in [CHANGELOG.md](../../CHANGELOG.md).
46
+ The v0.1.0-beta.6 release notes live in [CHANGELOG.md](../../CHANGELOG.md).
45
47
 
46
48
  ## Rollback
47
49
 
@@ -140,6 +140,14 @@ Forge project memory is a **kernel-backed** read model. `lib/project-memory.js`
140
140
 
141
141
  `forge remember` / `forge recall` route through this same `kernel_memories` table (via `lib/memory/router.js`), indexed by **FTS5** for token-AND BM25 recall: a `recall` query does full-text matching, and a no-query `recall` returns the newest notes plus a total count (never a full dump). Because the insights engine also writes `kernel_memories`, what it learns is recallable. Any legacy `.forge/memory/notes.jsonl` is imported once on first use, then retired. The opt-in **`graphiti`** backend is **experimental** — its config/doctor checks ship but the runtime write-through emitter is a fast-follow, so selecting it today still writes the local kernel floor. See [docs/guides/memory-backends.md](../guides/memory-backends.md).
142
142
 
143
+ Claude Code setup and upgrade repair the existing Forge-owned `SessionStart` and `UserPromptSubmit` hook groups without replacing user hooks. `SessionStart` supplies a bounded project-memory digest; each submitted prompt can receive relevant FTS5-ranked memory as `additionalContext`. Other harnesses keep their documented CLI/rule/`AGENTS.md` fallback surfaces—Forge does not claim a native dynamic prompt hook where none is verified.
144
+
145
+ Automatic recall is project-local. Forge derives scope from Git's canonical common directory so linked worktrees share one repository identity without crossing into another repository. Eligibility is applied before ranking: foreign scope, already-seen records, stale suggested records, and validly superseded records are excluded. Confirmed memories are authoritative project context; fresh suggested memories appear only under **Suggested memory — verify before relying**. Suggested memories outside the seven-day freshness window remain available to manual recall but are not injected automatically. User-global `.remember` data is not read because it has no authority-safe canonical project identity.
146
+
147
+ Recall is bounded and fail-open: automatic prompt and session memory each have a 400-token budget, while default manual `forge recall` has a 1,200-token budget. Prompt recall has an internal 4.5-second deadline and SessionStart has a 9-second deadline, keeping them inside the 5-second and 10-second hook limits; an unavailable or slow store injects nothing rather than blocking the agent. Local 1,000-record holdouts enforce an FTS5 p95 of at most 250 ms. Linux CI timing acceptance is not claimed yet.
148
+
149
+ The capped prompt shadow log stores aggregate candidate/injection counts and scores only—never prompt terms, session ids, selected memory ids, or memory bodies. The separate `memory.recall.observed` Kernel event likewise stores bounded outcomes, counts, selected ids, source/trust mixes, token estimates, elapsed time, and harness, with no prompt/query text, memory body/snippet, or correlation fingerprint.
150
+
143
151
  Typed memory helpers in `lib/memory/typed-api.js` add category and provenance conventions on top of the same kernel store; they do not create a new datastore. The supported categories are:
144
152
 
145
153
  | Category | Key prefix | Durable backend |
@@ -0,0 +1,134 @@
1
+ # Optional GitHub accounts per clone
2
+
3
+ Use this when you keep personal and work GitHub accounts signed in at the same
4
+ time. It is off by default. Installing Forge or running `forge setup` does not
5
+ select an account. Unbound projects keep native account selection.
6
+
7
+ ## Sign in once, select per clone
8
+
9
+ From a normal terminal outside any previously launched account session, run:
10
+
11
+ ```sh
12
+ gh auth login --hostname github.com --web --skip-ssh-key
13
+ ```
14
+
15
+ Complete the browser flow for one account, then repeat for the other account.
16
+ Choose the intended browser account each time. Keep your existing Git transport
17
+ choice and decline Git credential-helper changes unless you deliberately want
18
+ them. GitHub CLI owns login and credential storage; Forge does not create another
19
+ credential store. Native `gh` normally uses the system credential store, but can
20
+ fall back to a plaintext file when that store is unavailable. See
21
+ [GitHub CLI login](https://cli.github.com/manual/gh_auth_login).
22
+
23
+ Do not paste tokens into chat, commands, project files, shell profiles, or `.env`
24
+ files. You do not need to export or persist `GH_TOKEN` for this workflow. If your
25
+ normal terminal already supplies GitHub token variables, remove those overrides
26
+ from that session before interactive login; do not print their values.
27
+
28
+ Inside the work clone:
29
+
30
+ ```sh
31
+ forge github use WORK_LOGIN
32
+ forge github status
33
+ forge github run -- codex
34
+ ```
35
+
36
+ Inside the personal clone, in another terminal:
37
+
38
+ ```sh
39
+ forge github use PERSONAL_LOGIN
40
+ forge github status
41
+ forge github run -- t3
42
+ ```
43
+
44
+ Replace the uppercase labels with your GitHub logins. Both sessions can remain
45
+ open together. Substitute any installed, trusted CLI harness or shell for `codex`
46
+ or `t3`, such as `claude`, `pwsh`, or `bash`.
47
+
48
+ `use` verifies the named stored account and repository access, then writes only
49
+ `git config --local github.account`. It does not log in, switch the globally
50
+ active account, or modify another clone. Linked Git worktrees normally share this
51
+ clone-local configuration; use separate clones when you need separate bindings.
52
+
53
+ Supported GitHub-dependent Forge commands use the binding automatically. To give
54
+ the same identity to a harness's own `gh` calls, start that harness with
55
+ `forge github run --`. Already-running terminals and harnesses are not changed.
56
+
57
+ The launcher deliberately gives its child GitHub authority through transient
58
+ environment variables. Only launch programs you trust with that account. Forge
59
+ does not persist the token, but the launched program can access it. Harnesses or
60
+ tools using their own credentials instead of the inherited `gh` environment are
61
+ outside this guarantee.
62
+
63
+ ## Check or undo
64
+
65
+ ```sh
66
+ forge github status --json
67
+ forge github unset
68
+ ```
69
+
70
+ Status reports the selected and verified login, clone-local binding source,
71
+ effective Git author, origin transport, helper classification, and repository
72
+ access. It does not print tokens, raw remote URLs, or raw credential-helper
73
+ commands. Treat author and account labels as personal information when sharing
74
+ diagnostics.
75
+
76
+ `unset` is safe to repeat. It removes only the clone binding, not either stored
77
+ login. It does not revoke authority from a running child: close that session and
78
+ start a new one after changing or removing a binding.
79
+
80
+ ## Three separate identities
81
+
82
+ | Identity | Controlled by |
83
+ | --- | --- |
84
+ | GitHub API account used by supported Forge routes | Clone-local `github.account` |
85
+ | Commit author | Git `user.name` and `user.email` |
86
+ | Fetch/push authentication | SSH configuration or the HTTPS credential helper |
87
+
88
+ Forge does not change your author, origin, SSH keys, or credential helper.
89
+ Existing SSH keys and host aliases remain valid; custom aliases must resolve to
90
+ `github.com` for Forge's repository-access check. HTTPS and SSH GitHub.com origins
91
+ are supported; insecure HTTP/Git transports and Enterprise hosts are not V1 targets.
92
+
93
+ HTTPS has one important coupling: if Git uses `gh auth git-credential` as its
94
+ helper, Git commands inside the explicitly launched session may use that session's
95
+ selected token too. Other HTTPS helpers and SSH key selection remain independent.
96
+ For native multi-account transport, keep separate SSH keys/aliases or configure
97
+ your HTTPS credential manager to distinguish repository URLs (`useHttpPath`).
98
+ These are optional Git choices, not Forge setup steps; see
99
+ [GitHub's multi-account transport guide](https://docs.github.com/en/account-and-profile/how-tos/account-management/managing-multiple-accounts).
100
+
101
+ ## Platforms and recovery
102
+
103
+ The command syntax is the same on Windows, macOS, and Linux. Windows executable
104
+ and `.cmd` launchers are supported; quote paths or arguments containing spaces.
105
+ Everything after `run --` belongs to the child, including `--help`, `--version`,
106
+ and `--path`. Git Bash is still required for Forge's existing Windows Bash helpers.
107
+
108
+ - **Account missing or expired:** run the browser login again from a normal
109
+ terminal, then retry `use` or `status`. Forge never starts login automatically.
110
+ - **Account mismatch:** stop and check the clone with `forge github status`.
111
+ Reauthenticate the intended account, or explicitly bind the correct login.
112
+ A failed `use` leaves the prior binding intact.
113
+ - **Repository access denied:** check organization membership, SSO authorization,
114
+ and the intended repository with its administrator. Account identity alone does
115
+ not grant repository access.
116
+ - **Git push still uses the wrong account:** check the separate transport and
117
+ commit-author configuration above; changing the Forge API binding does not
118
+ replace SSH or credential-manager setup.
119
+ - **Unsupported GitHub CLI:** upgrade `gh` to a version supporting named-account
120
+ token retrieval. Unbound projects do not need that capability.
121
+ - **Program not found:** install the harness and check its executable name/PATH.
122
+
123
+ The supported workflow entrypoints are `forge`, `forge-workflow`, and the compiled
124
+ Forge executable. Direct developer invocation of `node bin/forge-cmd.js` is an
125
+ internal legacy utility, not an account-isolated V1 entrypoint.
126
+
127
+ ## CuraPod adoption
128
+
129
+ Only after this Forge feature is merged, the merged build is installed, and its
130
+ acceptance checks pass: open each intended CuraPod clone, run
131
+ `forge github use WORK_LOGIN`, verify `forge github status`, then launch the
132
+ chosen harness with `forge github run --`. Keep personal clones separately bound
133
+ to `PERSONAL_LOGIN`. This example does not discover or modify existing CuraPod
134
+ repositories, remotes, keys, or accounts automatically.
@@ -8,7 +8,7 @@ The committed manifest is `.forge/protected-paths.yaml`. Runtime enforcement is
8
8
 
9
9
  | Surface | Examples | Required write surface |
10
10
  | --- | --- | --- |
11
- | `beads_state` | `.beads/issues.jsonl`, `.beads/config.yaml` | `bd` or Forge issue commands |
11
+ | `beads_state` | `.beads/issues.jsonl`, `.beads/config.yaml` | `forge migrate --from beads`, then Forge issue commands |
12
12
  | `forge_config` | `.forge/config.yaml`, `.forge/protected-paths.yaml` | Forge config/setup API |
13
13
  | `generated_harness` | `AGENTS.md`, `.claude/skills/`, `.codex/skills/`, `.cursor/rules/` | `forge setup` or harness generator |
14
14
  | `memory_projection` | `docs/sessions/`, `docs/memory/`, `.forge/memory/` | Forge memory projection writer |
@@ -23,13 +23,13 @@ The committed manifest is `.forge/protected-paths.yaml`. Runtime enforcement is
23
23
 
24
24
  - Direct edits, additions, modifications, renames, and deletions of protected files are blocked by `scripts/protected-state-check.js`.
25
25
  - Allowed Forge API writes must declare the matching required surface. For example, a Forge config writer must call the protected writer with `surface: "forge_config"` and `viaForgeApi: true`.
26
- - Forge-owned commands that intentionally stage generated protected changes can set `FORGE_PROTECTED_STATE_ALLOWED_SURFACES` to the comma-separated surfaces they own for that command invocation.
26
+ - Surface-only environment declarations do not authorize protected changes. Forge-owned workflow commands must issue a content-bound Kernel capability for the exact actor, worktree, surface, path, and bytes.
27
27
  - Blocked decisions include actor, path, decision, required surface, reason, and repair hint.
28
- - Audit-ready events use kind `protected_state_write` and are recorded through Beads audit when available.
28
+ - Audit-ready events use kind `protected_state_write` and are appended as JSON lines to `.forge/protected-state-audit.jsonl` (git-ignored, capped at the newest 500 records). This log is visibility-only and never authorizes a protected edit. Forge-owned workflow authorization uses one-time, content-bound Kernel events that the protected-state checker consumes; hand-written JSON cannot grant authority. The audit write remains best-effort for ordinary blocked checks, while the workflow generator rolls back its file transaction if its required audit or Kernel authorization write fails.
29
29
 
30
30
  ## Repair Hint
31
31
 
32
- Every blocked path prints a repair hint. A repair hint is specific guidance such as using `bd update` for `beads_state`, `forge setup` for generated harness files, or the package manager for `lockfiles`.
32
+ Every blocked path prints a repair hint. A repair hint is specific guidance such as importing a legacy store with `forge migrate --from beads` for `beads_state`, `forge setup` for generated harness files, or the package manager for `lockfiles`.
33
33
 
34
34
  Example blocked output shape:
35
35