@cassiomc1/forgeloop 1.12.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/.github/copilot-instructions.md +1 -1
  2. package/AGENTS.md +1 -1
  3. package/AGENT_COMPATIBILITY.md +8 -0
  4. package/CLAUDE.md +1 -1
  5. package/CONTRIBUTING.md +90 -0
  6. package/DOCS_INDEX.md +46 -12
  7. package/ENG/c-development-eng.md +112 -0
  8. package/ENG/cpp-development-eng.md +109 -0
  9. package/ENG/dotnet-aspnetcore-development-eng.md +401 -0
  10. package/ENG/go-development-eng.md +103 -0
  11. package/ENG/java-development-eng.md +125 -0
  12. package/ENG/nodejs-backend-development-eng.md +605 -0
  13. package/ENG/php-development-eng.md +104 -0
  14. package/ENG/rust-development-eng.md +422 -0
  15. package/ENG/sec-code-eng.md +7 -7
  16. package/ENG/sql-development-eng.md +108 -0
  17. package/ENG/swift-development-eng.md +111 -0
  18. package/ENG/typescript-development-eng.md +108 -0
  19. package/EXECUTION_STATE.md +12 -0
  20. package/GUIDE_ROUTER.md +418 -9
  21. package/LOOP_ENGINEERING.md +28 -2
  22. package/ORCHESTRATOR_INTEGRATION.md +9 -5
  23. package/PROTOCOL_INTEGRATION.md +55 -2
  24. package/QUALITY_SCORECARD.md +1 -0
  25. package/README.md +78 -52
  26. package/TERMINOLOGY.md +2 -0
  27. package/THIRD_PARTY_NOTICES.md +19 -7
  28. package/THREAT_MODEL.md +140 -1
  29. package/completions/_forgeloop +22 -4
  30. package/completions/forgeloop.bash +40 -4
  31. package/completions/forgeloop.fish +130 -1
  32. package/docs/ADVISORY_CONTEXT.md +25 -0
  33. package/docs/AGENT_BROWSER_ADAPTER.md +81 -0
  34. package/docs/AGENT_BROWSER_VERIFICATION.md +6 -0
  35. package/docs/AGENT_PROTOCOL_SUMMARY.md +81 -3
  36. package/docs/AGENT_SKILL.md +66 -0
  37. package/docs/ARTIFACT_REFERENCE.md +123 -0
  38. package/docs/AUDIT_UX.md +46 -0
  39. package/docs/BROWSER_VERIFICATION.md +136 -0
  40. package/docs/CLI_REFERENCE.md +392 -10
  41. package/docs/CODE_ATTESTATION.md +2 -2
  42. package/docs/DOCUMENTATION_GUIDE.md +34 -12
  43. package/docs/GETTING_STARTED.md +59 -0
  44. package/docs/JEV_BENCHMARKS.md +31 -0
  45. package/docs/MODEL_ROUTING.md +37 -0
  46. package/docs/OPENSRC_ADAPTER.md +241 -0
  47. package/docs/PACKAGE_CONTENTS.md +60 -19
  48. package/docs/PROVIDERS.md +126 -0
  49. package/docs/PROVIDER_ARCHITECTURE.md +199 -0
  50. package/docs/RECIPES.md +32 -0
  51. package/docs/RELEASE_CHECKLIST.md +66 -5
  52. package/docs/SECURITY_REVIEW.md +71 -0
  53. package/docs/SEMANTIC_DECISION_PLANE.md +71 -0
  54. package/docs/TEST_INTELLIGENCE.md +29 -0
  55. package/docs/TEST_PRUNING.md +14 -0
  56. package/docs/TROUBLESHOOTING.md +298 -3
  57. package/docs/UNIVERSAL_INTEGRATION.md +31 -0
  58. package/docs/assets/diagrams/forgeloop-code-attestation-flow.html +2 -2
  59. package/docs/assets/diagrams/forgeloop-code-attestation-flow.receipt.json +5 -5
  60. package/docs/assets/diagrams/forgeloop-code-attestation-flow.svg +1 -1
  61. package/docs/assets/diagrams/forgeloop-engineering-flow.html +39 -26
  62. package/docs/assets/diagrams/forgeloop-engineering-flow.receipt.json +6 -6
  63. package/docs/assets/diagrams/forgeloop-engineering-flow.svg +26 -26
  64. package/docs/assets/diagrams/forgeloop-verification-trust-flow.html +2 -1
  65. package/docs/assets/diagrams/forgeloop-verification-trust-flow.receipt.json +5 -5
  66. package/docs/assets/diagrams/forgeloop-verification-trust-flow.svg +1 -1
  67. package/docs/diagrams/README.md +13 -9
  68. package/docs/diagrams/forgeloop-code-attestation-flow.workflow.json +1 -1
  69. package/docs/diagrams/forgeloop-engineering-flow.workflow.json +24 -19
  70. package/docs/diagrams/forgeloop-verification-trust-flow.workflow.json +1 -0
  71. package/docs/diagrams/reviews/forgeloop-code-attestation-flow.review.json +4 -4
  72. package/docs/diagrams/reviews/forgeloop-engineering-flow.review.json +4 -4
  73. package/docs/diagrams/reviews/forgeloop-verification-trust-flow.review.json +4 -4
  74. package/docs/documentation-manifest.json +1397 -0
  75. package/docs/protocol-requirements.json +101 -0
  76. package/package.json +46 -4
  77. package/schemas/config.schema.json +14 -0
  78. package/schemas/context-plan.schema.json +18 -0
  79. package/schemas/routing-input.schema.json +1 -1
  80. package/schemas/semantic-decision.schema.json +46 -0
  81. package/schemas/test-utility.schema.json +44 -0
  82. package/scripts/CI_VALIDATORS.md +84 -11
  83. package/scripts/benchmark-jev.mjs +5 -0
  84. package/scripts/benchmark-test-intelligence.mjs +4 -0
  85. package/scripts/generate-agent-protocol-summary.mjs +40 -1
  86. package/scripts/generate-forgeloop-skill.mjs +133 -0
  87. package/scripts/jev-smoke.mjs +19 -0
  88. package/skills/forgeloop/README.md +9 -0
  89. package/skills/forgeloop/SKILL.md +77 -0
  90. package/skills/forgeloop/references/lifecycle.md +9 -0
  91. package/skills/forgeloop/references/recovery.md +7 -0
  92. package/skills/forgeloop/references/verification.md +7 -0
  93. package/src/adapters/agent-browser/assertions.js +47 -0
  94. package/src/adapters/agent-browser/commands.js +54 -0
  95. package/src/adapters/agent-browser/index.js +3 -0
  96. package/src/adapters/agent-browser/locator.js +40 -0
  97. package/src/adapters/agent-browser/process.js +215 -0
  98. package/src/adapters/agent-browser/provider.js +313 -0
  99. package/src/adapters/emulated-services/constants.js +24 -0
  100. package/src/adapters/emulated-services/index.js +7 -0
  101. package/src/adapters/emulated-services/process.js +162 -0
  102. package/src/adapters/emulated-services/provider.js +282 -0
  103. package/src/adapters/opensrc/normalize.js +90 -0
  104. package/src/adapters/opensrc/process.js +248 -0
  105. package/src/adapters/opensrc/provider.js +338 -0
  106. package/src/adapters/opensrc/search.js +264 -0
  107. package/src/adapters/typesafe/client.js +28 -0
  108. package/src/adapters/typesafe/engine.js +63 -0
  109. package/src/adapters/typesafe/normalize.js +41 -0
  110. package/src/cli.js +108 -0
  111. package/src/commands/checkpoint-revalidate.js +176 -0
  112. package/src/commands/context-plan.js +38 -0
  113. package/src/commands/contract-create.js +264 -0
  114. package/src/commands/contract-revise.js +236 -0
  115. package/src/commands/decision-show.js +14 -0
  116. package/src/commands/decision-status.js +22 -0
  117. package/src/commands/discover.js +41 -0
  118. package/src/commands/doctor.js +15 -0
  119. package/src/commands/gate-record.js +205 -0
  120. package/src/commands/gate-revalidate.js +137 -0
  121. package/src/commands/model-route.js +32 -0
  122. package/src/commands/next.js +19 -7
  123. package/src/commands/route.js +146 -18
  124. package/src/commands/semantic-plan.js +17 -0
  125. package/src/commands/task-abandon.js +224 -0
  126. package/src/commands/task-create.js +84 -25
  127. package/src/commands/task-list.js +22 -2
  128. package/src/commands/task-migrate-contract-bootstrap-repair.js +288 -0
  129. package/src/commands/task-repair-contract-bootstrap.js +263 -0
  130. package/src/commands/test-inventory.js +5 -0
  131. package/src/commands/test-prune-plan.js +5 -0
  132. package/src/commands/test-prune-probe.js +5 -0
  133. package/src/commands/test-utility.js +5 -0
  134. package/src/commands/validate-protocol.js +10 -1
  135. package/src/config/guides.json +44 -0
  136. package/src/core/artifact-registry.js +24 -0
  137. package/src/core/audit-ux.js +514 -0
  138. package/src/core/browser-verification/constants.js +149 -0
  139. package/src/core/browser-verification/normalize.js +254 -0
  140. package/src/core/browser-verification/provider.js +519 -0
  141. package/src/core/browser-verification/service.js +115 -0
  142. package/src/core/build-script.js +151 -0
  143. package/src/core/c-cpp-project.js +143 -0
  144. package/src/core/checkpoint-revalidation.js +319 -0
  145. package/src/core/cli-command-definitions.js +249 -1
  146. package/src/core/command-executors.js +115 -3
  147. package/src/core/command-input.js +212 -102
  148. package/src/core/completion-artifacts.js +14 -5
  149. package/src/core/completion.js +4 -6
  150. package/src/core/config.js +3 -0
  151. package/src/core/context-compiler/budget.js +9 -0
  152. package/src/core/context-compiler/candidates.js +39 -0
  153. package/src/core/context-compiler/compiler.js +63 -0
  154. package/src/core/context-compiler/fingerprint.js +11 -0
  155. package/src/core/context-compiler/policy.js +13 -0
  156. package/src/core/context-compiler/result.js +23 -0
  157. package/src/core/contract-bootstrap-recovery.js +655 -0
  158. package/src/core/contract-presets.js +82 -0
  159. package/src/core/contract-revision.js +210 -0
  160. package/src/core/decision/artifact.js +69 -0
  161. package/src/core/decision/benchmarks.js +103 -0
  162. package/src/core/decision/cache.js +27 -0
  163. package/src/core/decision/constants.js +58 -0
  164. package/src/core/decision/cutover.js +34 -0
  165. package/src/core/decision/engine.js +22 -0
  166. package/src/core/decision/errors.js +68 -0
  167. package/src/core/decision/events.js +101 -0
  168. package/src/core/decision/freshness.js +19 -0
  169. package/src/core/decision/normalizers/index.js +115 -0
  170. package/src/core/decision/policy.js +18 -0
  171. package/src/core/decision/projection.js +16 -0
  172. package/src/core/decision/question-registry.js +201 -0
  173. package/src/core/decision/request.js +26 -0
  174. package/src/core/decision/resolver.js +130 -0
  175. package/src/core/decision/result.js +58 -0
  176. package/src/core/decision/service.js +156 -0
  177. package/src/core/decision/state-builder.js +65 -0
  178. package/src/core/decision/task-bindings.js +30 -0
  179. package/src/core/decision/test-provider.js +32 -0
  180. package/src/core/decision/thresholds.js +15 -0
  181. package/src/core/error-codes.js +281 -3
  182. package/src/core/events.js +226 -57
  183. package/src/core/evidence-readiness.js +9 -0
  184. package/src/core/execution-prerequisites.js +14 -0
  185. package/src/core/execution-profile.js +63 -38
  186. package/src/core/filesystem.js +1 -10
  187. package/src/core/gate-provenance.js +124 -0
  188. package/src/core/go-project.js +206 -0
  189. package/src/core/integration-invocation-policy.js +27 -4
  190. package/src/core/integration-resources.js +86 -61
  191. package/src/core/java-project.js +403 -0
  192. package/src/core/model-router/constants.js +10 -0
  193. package/src/core/model-router/policy.js +103 -0
  194. package/src/core/model-router/router.js +37 -0
  195. package/src/core/multi-language-project.js +117 -0
  196. package/src/core/next-action-model.js +58 -0
  197. package/src/core/next-action-phases.js +130 -42
  198. package/src/core/next-action-refresh.js +43 -9
  199. package/src/core/next-action-review-phase.js +7 -2
  200. package/src/core/next-action.js +35 -7
  201. package/src/core/next-explanation.js +63 -0
  202. package/src/core/phase.js +128 -10
  203. package/src/core/php-project.js +85 -0
  204. package/src/core/preflight-consistency.js +23 -9
  205. package/src/core/preflight-loaders.js +37 -5
  206. package/src/core/project-detection.js +1760 -52
  207. package/src/core/protocol-info.js +65 -0
  208. package/src/core/protocol.js +20 -0
  209. package/src/core/reconcile-closure.js +132 -53
  210. package/src/core/recovery-history.js +1 -0
  211. package/src/core/resumability.js +154 -44
  212. package/src/core/route-artifact.js +15 -1
  213. package/src/core/router.js +223 -4
  214. package/src/core/runtime-context.js +118 -61
  215. package/src/core/rust-project.js +400 -0
  216. package/src/core/schema-validation.js +3 -0
  217. package/src/core/security-review/constants.js +64 -0
  218. package/src/core/security-review/normalize.js +245 -0
  219. package/src/core/security-review/provider.js +204 -0
  220. package/src/core/security-review/service.js +134 -0
  221. package/src/core/semantic-planning/constants.js +19 -0
  222. package/src/core/semantic-planning/projection.js +94 -0
  223. package/src/core/semantic-planning/service.js +15 -0
  224. package/src/core/sources.js +37 -0
  225. package/src/core/sql-project.js +141 -0
  226. package/src/core/swift-project.js +200 -0
  227. package/src/core/task-claim-state.js +201 -1
  228. package/src/core/task-conflict-inspection.js +31 -5
  229. package/src/core/task-paths.js +13 -0
  230. package/src/core/task-recovery.js +1 -0
  231. package/src/core/templates.js +3 -0
  232. package/src/core/test-intelligence/benchmarks.js +68 -0
  233. package/src/core/test-intelligence/inventory.js +73 -0
  234. package/src/core/test-intelligence/prune.js +90 -0
  235. package/src/core/test-intelligence/semantic-state.js +15 -0
  236. package/src/core/test-intelligence/service.js +40 -0
  237. package/src/core/test-intelligence/utility.js +50 -0
  238. package/src/core/trace.js +11 -7
  239. package/src/core/transaction.js +1 -0
  240. package/src/core/typescript-project.js +349 -0
  241. package/src/core/xml-structure.js +123 -0
  242. package/src/integration.d.ts +492 -0
  243. package/src/integration.js +54 -0
  244. package/src/providers/README.md +47 -0
  245. package/src/providers/capabilities.js +46 -0
  246. package/src/providers/errors.js +15 -0
  247. package/src/providers/index.js +29 -0
  248. package/src/providers/json-snapshot.js +105 -0
  249. package/src/providers/registry.js +152 -0
@@ -0,0 +1,29 @@
1
+ # Test intelligence
2
+
3
+ ForgeLoop discovers test units deterministically and assigns stable IDs from
4
+ framework, path, suite, and trimmed name. Utility analysis is non-evidence
5
+ data. The task-bound utility command sends bounded batches of actual test
6
+ metadata (including source summary, target file, framework, signals, and
7
+ runtime or branch-coverage fields when present; deterministic inventory
8
+ currently supplies them as `null`) to canonical Jev `TEST_UTILITY` decisions.
9
+ Each test receives its own bounded semantic judgment. Protected or
10
+ contract-linked tests are never prune-authorized, and missing or low-confidence
11
+ utility remains blocked.
12
+
13
+ An unprotected semantic duplicate with sufficient confidence is classified as a
14
+ `REDUNDANT_CANDIDATE` and may reach the isolated `PROBE_REMOVAL` stage. The
15
+ probe is non-destructive and does not authorize deletion; protected tests,
16
+ low-confidence candidates, unknown utility, and candidates requiring a second
17
+ review remain blocked or retained.
18
+
19
+ `test-utility` persists the non-evidence `test-utility.json` analysis under
20
+ the task namespace. The canonical task mutation may also persist bounded
21
+ semantic-decision artifacts and task transaction or ledger state required to
22
+ make the analysis task-bound and reproducible. It does not delete tests, alter
23
+ completion evidence, or authorize external work.
24
+
25
+ `npm run benchmark:test-intelligence` exercises the real utility classifier on
26
+ a deterministic labeled fixture for redundancy, obsolescence, protected-test
27
+ false positives, and deletion safety. It reports precision and recall from the
28
+ classifier's observed output against the labeled fixture and never grants
29
+ deletion authority.
@@ -0,0 +1,14 @@
1
+ # Test pruning safety
2
+
3
+ `test-prune-plan` can return `KEEP`, `PROBE_REMOVAL`, or `BLOCKED`.
4
+ `PROBE_REMOVAL` requires both protected-test policy and sufficient deterministic
5
+ and semantic evidence. Unknown utility is `BLOCKED`.
6
+
7
+ The safe candidate boundary is an unprotected, high-confidence
8
+ `REDUNDANT_CANDIDATE`. Protected tests and low-confidence or ambiguous
9
+ recommendations remain `KEEP`/`BLOCKED`. The isolated probe is
10
+ non-destructive: it records an observation without editing the live worktree
11
+ or authorizing deletion.
12
+
13
+ `test-prune-probe` is fail-closed and must use an isolated disposable workspace.
14
+ No command in this feature deletes or edits a test in the live working tree.
@@ -7,10 +7,12 @@ This guide provides symptom-first recovery procedures for common ForgeLoop proto
7
7
  ## Quick Symptom Index
8
8
 
9
9
  - [`preflight` is `BLOCKED`](#symptom-preflight-is-blocked)
10
+ - [Project-aware .NET routing is missing](#symptom-project-aware-net-routing-is-missing)
10
11
  - [`forgeloop next` returns `RESOLVE_BLOCKER`](#symptom-forgeloop-next-returns-resolve_blocker)
11
12
  - [`forgeloop next` returns `RECORD_DIAGNOSIS`](#symptom-forgeloop-next-returns-record_diagnosis)
12
13
  - [Progress is `STALLED` or `forgeloop next` returns `CHANGE_STRATEGY`](#symptom-progress-is-stalled)
13
14
  - [Protocol state or contract is `STALE`](#symptom-state-or-contract-is-stale)
15
+ - [A pre-execution checkpoint is stale because the repository moved](#symptom-a-pre-execution-checkpoint-is-stale-because-the-repository-moved)
14
16
  - [Execution continuity is `STALE`](#symptom-continuity-is-stale)
15
17
  - [Multiple tasks ambiguous (`E_TASK_AMBIGUOUS`)](#symptom-multiple-tasks-ambiguous)
16
18
  - [Verification tool is missing (`E_VERIFICATION_TOOL_UNAVAILABLE`)](#symptom-verification-tool-is-missing)
@@ -37,6 +39,7 @@ This guide provides symptom-first recovery procedures for common ForgeLoop proto
37
39
  - [Repository search fails](#symptom-repository-search-fails)
38
40
  - [Persistent search host is unavailable](#symptom-persistent-search-host-is-unavailable)
39
41
  - [Persistent search host ownership is unverified or stale](#symptom-persistent-search-host-ownership-is-unverified-or-stale)
42
+ - [Local validation tier is unavailable or reports `NOT_VERIFIED`](#symptom-local-validation-tier-is-unavailable-or-reports-not_verified)
40
43
  - [Another harness cannot resume the task](#symptom-another-harness-cannot-resume)
41
44
  - [Task claim conflict or recovered task](#symptom-task-creation-blocked-by-a-write-claim-conflict-e_task_scope_conflict)
42
45
  - [Stable Error & Reason Code Reference](#stable-error-and-reason-codes)
@@ -54,6 +57,102 @@ forgeloop protocol-info --json
54
57
  ```
55
58
  <!-- END FORGELOOP EXAMPLE -->
56
59
 
60
+ ### Symptom: local validation tier is unavailable or reports `NOT_VERIFIED`
61
+
62
+ #### What it means
63
+
64
+ The selected local validation tier could not run a required external validator
65
+ or setup prerequisite. `NOT_VERIFIED` is an explicit limitation, not a test
66
+ pass and not permission to install tools implicitly.
67
+
68
+ #### Safe recovery
69
+
70
+ 1. Check the tier and its command list with `node scripts/run-validation.mjs
71
+ --tier <fast|local|prepush|release> --list`.
72
+ 2. Run `npm run mcp:setup` explicitly when MCP dependencies are in scope and
73
+ installation is authorized.
74
+ 3. Confirm Python 3.9 or newer is available for the frozen validators.
75
+ 4. Re-run the tier and record any still-unavailable check as `NOT_VERIFIED` in
76
+ the validation report.
77
+
78
+ The ordinary PR workflow remains path-aware and always publishes the required
79
+ status contexts; its `validate (22)` aggregator fails closed on an applicable
80
+ job failure, cancellation, or unexpected skip. Local success cannot substitute
81
+ for a required remote security or cross-platform check.
82
+
83
+ ### Symptom: the Node.js test suite is slow locally
84
+
85
+ #### Inspect
86
+
87
+ Use the fast, watch, and CI-specific entry points before running the full
88
+ coverage gate:
89
+
90
+ ```bash
91
+ npm run test:quick
92
+ npm run test:watch
93
+ npm run test:ci
94
+ npm run coverage
95
+ ```
96
+
97
+ `npm test` remains the complete no-coverage suite. `test:ci` runs the same
98
+ discovered files with a two-worker cap for small CI runners; it does not remove
99
+ tests or change assertions. Local coverage remains an explicit command because
100
+ instrumentation adds measurable overhead; the PR unit lane wraps that same
101
+ `test:ci` process across four deterministic shards, then aggregates coverage
102
+ without running the suite again. Docs-only changes run the quick suite only on
103
+ the first Node 24 shard; the other shards and the Node 20 lane do not install.
104
+
105
+ #### Native Windows guidance
106
+
107
+ Repeated Node process startup can be slowed by Windows Defender scanning the
108
+ repository and dependency tree. If local policy permits, request narrowly
109
+ scoped exclusions for the trusted `node.exe`, this repository root, and its
110
+ `node_modules` directory. Never disable Defender globally or exclude an
111
+ untrusted path. WSL2 can be used when native Windows remains slow, while
112
+ Windows CI continues to cover native path and process behavior.
113
+
114
+ ### Symptom: Project-aware .NET routing is missing
115
+
116
+ #### What it means
117
+
118
+ The route command did not find confirmed, affected SDK-style .NET project
119
+ evidence, or the task scope does not reach the confirmed project root. ASP.NET
120
+ Core and ABP are conditional overlays on the `dotnet` specialist; they are not
121
+ standalone guides.
122
+
123
+ #### Inspect
124
+
125
+ ```bash
126
+ forgeloop route --task <task-id> --work code --surface backend --json
127
+ forgeloop task-show --task <task-id> --json
128
+ ```
129
+
130
+ Then inspect the affected scope for a structurally valid `*.csproj`, `*.fsproj`,
131
+ or `*.vbproj` using the supported SDK allowlist. ASP.NET Core requires a web,
132
+ Razor, or Blazor SDK or a `FrameworkReference Include="Microsoft.AspNetCore.App"`.
133
+ ABP requires a structural `PackageReference Include="Volo.Abp..."` in the
134
+ confirmed .NET project.
135
+
136
+ #### Common causes
137
+
138
+ - The repository contains only prose, source snippets, Dockerfiles, lockfiles,
139
+ package names, or a malformed/oversized/non-SDK-style project file.
140
+ - A write claim points outside the project root, outside the applicable shared
141
+ `Directory.Build.*`/NuGet scope, or at a non-member of the named `.sln`/`.slnx`.
142
+ - A mixed Flutter/.NET monorepo was treated as one root; nested project roots
143
+ remain isolated.
144
+ - `projectEvidence.frameworks` contains `aspnetcore` or `abp` without
145
+ `dotnet`; route validation rejects that input.
146
+
147
+ #### Safe recovery
148
+
149
+ Do not add a manual `projectEvidence` claim to force specialist activation.
150
+ Correct the task scope or project structure, rerun the canonical route command,
151
+ and inspect its reason/exclusion codes. Project discovery is bounded and
152
+ non-symlinked; budget exhaustion fails closed. See
153
+ [`GUIDE_ROUTER.md`](../GUIDE_ROUTER.md) for the exact limits and reason-code
154
+ contract.
155
+
57
156
  ### Symptom: `preflight` is `BLOCKED`
58
157
 
59
158
  #### What it means
@@ -231,6 +330,73 @@ the blocked preflight is resolved, `preflight` appends a fresh
231
330
  details differ *without* an intervening BLOCKED outcome is still refused with
232
331
  `E_PHASE_CHRONOLOGY_INVALID`.
233
332
 
333
+ ### Symptom: A pre-execution checkpoint is stale because the repository moved
334
+
335
+ #### What it means
336
+
337
+ A `ROUTED` checkpoint has valid ownership, contract identity, route identity,
338
+ and no execution history, but its recorded repository branch or HEAD differs
339
+ from the current checkout. `next` returns `REVALIDATE_CHECKPOINT` with
340
+ `E_REPOSITORY_CHANGED` and `E_STATE_REVALIDATION_REQUIRED`.
341
+
342
+ #### Safe recovery
343
+
344
+ Run the canonical mutation:
345
+
346
+ ```bash
347
+ forgeloop checkpoint-revalidate --task <id> --json
348
+ forgeloop next --task <id> --explain --json
349
+ ```
350
+
351
+ The command derives the repository fingerprint from ForgeLoop while holding
352
+ the task mutation boundary. It preserves the phase, contract fingerprint,
353
+ route fingerprint, selected guides, gates, checks, and evidence. It does not
354
+ revise the contract, reroute the task, fabricate continuity or receipt
355
+ artifacts, or operate after `EXECUTION_STARTED`.
356
+
357
+ If the command fails with `E_CHECKPOINT_REVALIDATION_UNSAFE`, follow the named
358
+ contract, route, artifact, ownership, or lifecycle boundary. Do not edit
359
+ `work-state.json`, pass a caller-supplied branch or HEAD, or use
360
+ `reconcile-closure` for a `ROUTED` task.
361
+
362
+ ---
363
+
364
+ ### Symptom: The task contract must change before execution
365
+
366
+ #### What it means
367
+
368
+ The task is still before execution, but its objective, deliverables, or
369
+ constraints have changed. Existing route, preflight, gate, and plan evidence
370
+ must not authorize the new contract.
371
+
372
+ #### Safe recovery
373
+
374
+ Use exactly one bounded replacement source:
375
+
376
+ ```bash
377
+ forgeloop contract-revise --task <id> --preset <documentation|bug|feature|release> --json
378
+ forgeloop contract-revise --task <id> --contract-file <path> --json
379
+ ```
380
+
381
+ The command appends `CONTRACT_REVISED` followed immediately by
382
+ `TRANSACTION_COMMITTED(operation=contract-revise)`, resets derived evidence,
383
+ and preserves the task descriptor claims. A `ROUTED` task must be routed and
384
+ preflighted again; a `PLANNED` task is rewound to `ROUTED` and must receive a
385
+ fresh canonical route, preflight, and plan. Historical checkpoint identity
386
+ remains valid only when later contract and route evolution is proven by the
387
+ canonical append-only provenance chain.
388
+
389
+ `previousStateFingerprint` and `revisedStateFingerprint` on `CONTRACT_REVISED`
390
+ are transition-time audit bindings. They are checked when the revision is the
391
+ current state transition and participate in append-only event integrity; they
392
+ are not treated as permanently frozen current-state identity after later
393
+ canonical mutations.
394
+
395
+ Contract revision is unavailable after `EXECUTION_STARTED` and for active
396
+ contract-bootstrap repair or migration anchors. Do not rewrite the contract,
397
+ state, route, or ledger files manually. If `next` reports a stale route,
398
+ reroute it with the normal `route` command before running preflight.
399
+
234
400
  ---
235
401
 
236
402
  ### Symptom: `EXECUTING`/`VERIFYING` task is stale because the repository moved (`E_REPOSITORY_CHANGED`)
@@ -248,7 +414,7 @@ forgeloop reconcile-closure --task <id> --id <verification-id> \
248
414
 
249
415
  `reconcile-closure` requires:
250
416
 
251
- 1. The task is `EXECUTING`, `VERIFYING`, or `REVIEWING`. A `REVIEWING` task additionally requires authorized completion recovery (a persisted evidence-only rejection bound to the current checkpoint), or a rejection snapshot that can be rebound (see below).
417
+ 1. The task is `EXECUTING`, `VERIFYING`, or `REVIEWING`. A `REVIEWING` task may use authorized completion recovery (a persisted evidence-only rejection bound to the current checkpoint), or, when no completion rejection exists, the narrow bootstrap path for repository-only drift. The bootstrap path does not change phase, append completion events, or release claims.
252
418
  2. The only drift is `REPOSITORY_CHANGED` (contract or required-artifact drift stays blocked).
253
419
  3. The append-only event ledger is valid.
254
420
  4. `--id` and `--requirement` exactly match a `VERIFICATION` item of the task contract, and the executed command exits 0, proving the objective is present in the current repository.
@@ -263,6 +429,12 @@ forgeloop advance --task <id> --to REVIEWING
263
429
  forgeloop complete --task <id>
264
430
  ```
265
431
 
432
+ The bootstrap path is intentionally narrower than completion recovery: contract
433
+ identity, required artifacts, ledger validity, and active claim ownership must
434
+ already be valid, and the freshness classifier must report exactly
435
+ `REPOSITORY_CHANGED`. Contract or artifact drift remains blocked and must use
436
+ its dedicated canonical recovery surface.
437
+
266
438
  #### Drifted completion-rejection snapshots (`E_COMPLETION_REJECTION_STATE_FINGERPRINT_MISMATCH`)
267
439
 
268
440
  A `REVIEWING` task with a persisted evidence-only completion rejection can lose
@@ -389,6 +561,38 @@ corrupt, or unreadable evidence fails closed as `INCONSISTENT`. A `REVIEWING`
389
561
  phase plus an old timestamp alone is never `STALE`; post-execution tasks whose
390
562
  only drift is `REPOSITORY_CHANGED` remain `RECOVERABLE`.
391
563
 
564
+ #### Contract bootstrap repair
565
+
566
+ When `next` reports `REPAIR_CONTRACT_BOOTSTRAP`, do not edit `events.ndjson` or
567
+ `work-state.json`. Run the official, explicitly acknowledged repair:
568
+
569
+ ```bash
570
+ forgeloop task-repair-contract-bootstrap --task <task-id> --acknowledge-repair --json
571
+ ```
572
+
573
+ Only the exact duplicate `CONTRACT_VALIDATED` signature is accepted. The command
574
+ preserves historical lines, reconstructs the proven `CONTRACT_READY` or `ROUTED`
575
+ checkpoint, and records an append-only marker. Tampered artifacts, unrelated
576
+ chronology errors, live locks, or later meaningful activity fail closed.
577
+ If the ledger already contains `ROUTE_VALIDATED`, the route artifact is
578
+ required and must remain valid and contract-bound; ForgeLoop never downgrades
579
+ that history to `CONTRACT_READY`. After repair, a changed route identity is
580
+ accepted only when the route/state pair is canonical and a later
581
+ `TRANSACTION_COMMITTED` event has `operation: "route"`.
582
+
583
+ When `next` reports `MIGRATE_CONTRACT_BOOTSTRAP_REPAIR`, run the official
584
+ caller-acknowledged migration:
585
+
586
+ ```bash
587
+ forgeloop task-migrate-contract-bootstrap-repair --task <task-id> --acknowledge-migration --json
588
+ ```
589
+
590
+ This path is limited to the legacy marker schema that predates
591
+ `reconstructedStateRevision`. It proves the current state and route against the
592
+ recorded reconstruction, appends a bound migration witness, and preserves the
593
+ legacy marker byte-for-byte. It does not accept progressed ledgers, ambiguous
594
+ markers, or unknown/corrupt lock ownership.
595
+
392
596
  #### Safe recovery
393
597
 
394
598
  Follow the classification:
@@ -1134,6 +1338,25 @@ package/process recovery boundary. The relevant stable codes are
1134
1338
  `E_PERSISTENT_TRANSPORT_HOST_STALE`, and
1135
1339
  `E_PERSISTENT_TRANSPORT_PROTOCOL_MISMATCH`.
1136
1340
 
1341
+ ### Symptom: Security Review provider is unavailable or rejected
1342
+
1343
+ #### Error Codes: `E_SECURITY_REVIEW_PROVIDER_INVALID`, `E_SECURITY_REVIEW_PROVIDER_UNAVAILABLE`, `E_SECURITY_REVIEW_REQUEST_INVALID`, `E_SECURITY_REVIEW_RESULT_INVALID`, `E_SECURITY_REVIEW_TIMEOUT`, `E_SECURITY_REVIEW_CANCELLED`, `E_SECURITY_REVIEW_OUTPUT_LIMIT`, `E_SECURITY_REVIEW_EXECUTION_FAILED`
1344
+
1345
+ #### What it means
1346
+
1347
+ The optional Security Review Integration API provider was not registered,
1348
+ failed the strict provider/request/result contract, exceeded its shared
1349
+ deadline or output budget, was cancelled, or threw during observation. This
1350
+ surface is advisory and never blocks or authorizes ForgeLoop lifecycle.
1351
+
1352
+ #### Safe recovery
1353
+
1354
+ Register an explicit host-owned provider with a matching portable ID, use
1355
+ bounded project-relative request paths and limits, and make the provider honor
1356
+ the supplied `AbortSignal`. Do not install or discover a scanner through
1357
+ ForgeLoop, and do not treat findings as evidence, completion, commands, or
1358
+ canonical task state.
1359
+
1137
1360
  ## Stable Error and Reason Codes
1138
1361
 
1139
1362
  <!-- BEGIN FORGELOOP GENERATED: public-error-codes -->
@@ -1200,6 +1423,17 @@ package/process recovery boundary. The relevant stable codes are
1200
1423
  | `E_AUTHORITY_UNTRUSTED_SOURCE` | Authority file placed inside untrusted project tree. | Place authority file in host-managed trusted location. |
1201
1424
  | `E_BASELINE_EXPANSION` | Attempted unauthorized addition of new violations to brownfield baseline. | Resolve new violations rather than expanding the baseline. |
1202
1425
  | `E_BASELINE_RECORD_DURING_ACTIVE_TASK` | Cannot re-record baseline during an active task with policy snapshot. | Resolve new violations or use monotonic baseline --update. |
1426
+ | `E_BROWSER_VERIFICATION_CANCELLED` | Browser verification was cancelled by its caller before a valid observation completed. | Retry only when the caller still requires the optional observation. |
1427
+ | `E_BROWSER_VERIFICATION_EXECUTION_FAILED` | The optional browser provider process failed without establishing a valid observation. | Inspect the host-provided browser executable and retry; process success is not verification success. |
1428
+ | `E_BROWSER_VERIFICATION_ORIGIN_DENIED` | Browser verification navigation left the request origin allowlist. | Add the intended origin to allowedOrigins or correct the provider navigation result. |
1429
+ | `E_BROWSER_VERIFICATION_OUTPUT_LIMIT` | Browser verification output exceeded the configured character or item limit. | Reduce steps, assertions, snapshots, diagnostics, or artifacts at the provider. |
1430
+ | `E_BROWSER_VERIFICATION_PROVIDER_INVALID` | Browser verification provider configuration or interface implementation is invalid. | Use a provider implementing id, verify(input) with the documented browser-verification contract; verification is optional. |
1431
+ | `E_BROWSER_VERIFICATION_PROVIDER_UNAVAILABLE` | Requested browser verification provider is not registered in runtime context. | Register the provider in runtime context before verify, or proceed without browser verification; provider failure never blocks canonical lifecycle. |
1432
+ | `E_BROWSER_VERIFICATION_REQUEST_INVALID` | Browser verification request failed validation or exceeded budget. | Provide a bounded request with 1-8 https origins, 1-64 steps, 1-64 assertions, and timeoutMs within limits. |
1433
+ | `E_BROWSER_VERIFICATION_RESULT_INVALID` | Browser verification provider returned an invalid result structure. | Ensure provider returns a status with bounded assertions, diagnostics, and artifacts, and no authority fields. |
1434
+ | `E_BROWSER_VERIFICATION_TIMEOUT` | Browser verification exceeded its execution timeout. | Use a responsive provider or increase timeout within limits; verification is optional. |
1435
+ | `E_BROWSER_VERIFICATION_VERSION_UNSUPPORTED` | The configured Agent Browser version does not satisfy the provider's exact version contract. | Provide the expected host-qualified Agent Browser version or update the explicit executable selection. |
1436
+ | `E_CHECKPOINT_REVALIDATION_UNSAFE` | A pre-execution checkpoint could not be safely rebound to the current repository without changing lifecycle identity. | Preserve the checkpoint and resolve the reported contract, route, ownership, artifact, or lifecycle boundary through its canonical command. |
1203
1437
  | `E_CHECK_INERT` | An enabled check has no effective scope or target files. | Provide an applicable target scope, configure matching files, or mark the rule unsupported. |
1204
1438
  | `E_CHECK_INVALID` | Check structure or required parameters are invalid. | Provide valid check ID, requirement, and parameters. |
1205
1439
  | `E_CHECK_MUTATION_EXECUTION_ERROR` | A policy checker threw an unhandled exception while evaluating its mutation fixture. | Repair the checker execution path and rerun rule verification. |
@@ -1221,14 +1455,39 @@ package/process recovery boundary. The relevant stable codes are
1221
1455
  | `E_CONTINUITY_SCHEMA_UNSUPPORTED` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1222
1456
  | `E_CONTINUITY_STATE_MISSING` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1223
1457
  | `E_CONTINUITY_TASK_MISMATCH` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1458
+ | `E_CONTRACT_BOOTSTRAP_INCONSISTENT` | Contract bootstrap evidence is inconsistent and cannot be treated as a normal idempotent checkpoint. | Inspect the task ledger and use the exact official contract bootstrap repair only when next recommends it. |
1459
+ | `E_CONTRACT_BOOTSTRAP_REPAIR_AUTHORIZATION_REQUIRED` | The official contract bootstrap repair requires explicit caller acknowledgement. | Re-run with --acknowledge-repair after reviewing next and the exact defect signature. |
1460
+ | `E_CONTRACT_BOOTSTRAP_REPAIR_AVAILABLE` | The exact recognized contract bootstrap defect has an official append-only repair path. | Run forgeloop task-repair-contract-bootstrap --task <id> --acknowledge-repair. |
1461
+ | `E_CONTRACT_BOOTSTRAP_REPAIR_INVALID` | The contract bootstrap repair marker or its bound artifacts are invalid or tampered. | Restore the original artifacts from trusted evidence; ForgeLoop refuses to guess or rewrite history. |
1462
+ | `E_CONTRACT_BOOTSTRAP_REPAIR_MIGRATION_AUTHORIZATION_REQUIRED` | The legacy contract bootstrap repair migration requires fresh explicit caller acknowledgement. | Re-run with --acknowledge-migration after reviewing next and the exact legacy marker boundary. |
1463
+ | `E_CONTRACT_BOOTSTRAP_REPAIR_MIGRATION_AVAILABLE` | The exact legacy contract bootstrap repair marker has an official append-only migration path. | Run forgeloop task-migrate-contract-bootstrap-repair --task <id> --acknowledge-migration. |
1464
+ | `E_CONTRACT_BOOTSTRAP_REPAIR_MIGRATION_INVALID` | Legacy contract bootstrap repair migration was refused because its exact marker, state, route, lock, or ledger boundary could not be proven. | Inspect the structured migration errors; ambiguous or progressed historical ledgers remain inconsistent and are never rewritten. |
1465
+ | `E_CONTRACT_BOOTSTRAP_REPAIR_UNSAFE` | The historical contract bootstrap defect does not satisfy the narrow repair safety boundary. | Do not force repair; resolve the ledger inconsistency through a separately reviewed migration. |
1224
1466
  | `E_CONTRACT_INVALID` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1225
1467
  | `E_CONTRACT_MISSING` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1226
1468
  | `E_CONTRACT_STALE` | Contract modified after downstream artifacts were generated. | Re-run forgeloop route and forgeloop preflight. |
1227
1469
  | `E_CONTRACT_UNRESOLVED_DECISION` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1228
1470
  | `E_CONTRIBUTOR_INVALID` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1229
1471
  | `E_CONTRIBUTOR_REFERENCE_INVALID` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1472
+ | `E_DECISION_CACHE_INVALID` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1230
1473
  | `E_DECISION_CRITERION_INVALID` | Decision settlement criterion details or parameters are malformed. | Provide non-empty decision text and settledBy criterion. |
1474
+ | `E_DECISION_ENGINE_AUTH_INVALID` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1475
+ | `E_DECISION_ENGINE_AUTH_REQUIRED` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1476
+ | `E_DECISION_ENGINE_UNAVAILABLE` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1477
+ | `E_DECISION_LOW_CONFIDENCE` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1478
+ | `E_DECISION_MODEL_UNSUPPORTED` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1231
1479
  | `E_DECISION_NOT_UNRESOLVED` | A settlement criterion referenced a decision not present in current unresolvedDecisions. | Use the exact current unresolved decision text or update the contract first. |
1480
+ | `E_DECISION_POLICY_INVALID` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1481
+ | `E_DECISION_QUESTION_SET_STALE` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1482
+ | `E_DECISION_QUESTION_SET_UNKNOWN` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1483
+ | `E_DECISION_RATE_LIMITED` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1484
+ | `E_DECISION_REQUEST_INVALID` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1485
+ | `E_DECISION_REQUIRED` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1486
+ | `E_DECISION_RESULT_INVALID` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1487
+ | `E_DECISION_STALE` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1488
+ | `E_DECISION_STATE_LIMIT` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1489
+ | `E_DECISION_STATE_UNSAFE` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1490
+ | `E_DECISION_TIMEOUT` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1232
1491
  | `E_DIAGNOSIS_CYCLE_MISMATCH` | Diagnosis verification cycle does not match the active work state verification cycle. | Record diagnosis for the current active verification cycle. |
1233
1492
  | `E_DIAGNOSIS_EVIDENCE_INVALID` | Referenced diagnosis evidence is missing or has no failed checks in the current cycle. | Reference at least one failed or blocked check ID from the active verification cycle. |
1234
1493
  | `E_DIAGNOSIS_INVALID` | Diagnosis record details or parameters are malformed. | Provide valid failureClass, hypothesis, evidenceRefs, settledBy, and nextSafeAction. |
@@ -1252,6 +1511,8 @@ package/process recovery boundary. The relevant stable codes are
1252
1511
  | `E_FAILURE_SIGNATURE_INVALID` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1253
1512
  | `E_FUTURE_LIFECYCLE_EVIDENCE` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1254
1513
  | `E_FUTURE_TERMINAL_EVIDENCE` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1514
+ | `E_GATE_INVALID` | Gate input or evidence artifact is invalid or unsafe. | Use project-relative regular artifact paths and valid gate evidence. |
1515
+ | `E_GATE_NOT_REQUIRED` | Requested gate is not required by the active route or policy. | Inspect the active route and record only a required gate. |
1255
1516
  | `E_GATE_REQUIRED` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1256
1517
  | `E_GATE_STALE` | Referenced gate artifact changed after approval. | Update artifact SHA-256 in gate file. |
1257
1518
  | `E_GATE_UNVERIFIED` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
@@ -1291,6 +1552,7 @@ package/process recovery boundary. The relevant stable codes are
1291
1552
  | `E_PERSISTENT_TRANSPORT_TIMEOUT` | A persistent-search connection, handshake, or request exceeded its bounded timeout. | Retry once through the ownership-checked recovery path and inspect host/index health if it persists. |
1292
1553
  | `E_PERSISTENT_TRANSPORT_UNAVAILABLE` | The user-scoped persistent-search endpoint was not reachable. | ForgeLoop starts one verified local host and retries once; persistent failure is reported without an rg fallback. |
1293
1554
  | `E_PHASE_CHRONOLOGY_INVALID` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1555
+ | `E_PHASE_FREEZE` | The requested gate mutation is forbidden after execution begins. | Record required gates before entering EXECUTING. |
1294
1556
  | `E_PHASE_PREREQUISITE_MISSING` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1295
1557
  | `E_PHASE_TRANSITION_INVALID` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1296
1558
  | `E_POLICY_DRIFT` | Active policy lock does not match the policy snapshot captured at task activation. | Re-verify affected checks or restore original policy. |
@@ -1332,7 +1594,7 @@ package/process recovery boundary. The relevant stable codes are
1332
1594
  | `E_RECONCILE_EVIDENCE_FAILED` | The executed objective-satisfaction evidence command did not pass. | Inspect the execution artifact; reconciliation is refused until evidence passes in the current repository. |
1333
1595
  | `E_RECONCILE_LEDGER_INVALID` | The append-only event ledger is not valid, so reconciliation cannot be recorded. | Inspect the ledger errors and repair before reconciling. |
1334
1596
  | `E_RECONCILE_NOT_STALE` | reconcile-closure was invoked for a work-state checkpoint that is already fresh. | No reconciliation is required; continue the normal lifecycle. |
1335
- | `E_RECONCILE_PHASE_INVALID` | reconcile-closure was invoked for a task that is not EXECUTING or VERIFYING. | reconcile-closure supports EXECUTING or VERIFYING tasks whose objective is already satisfied. |
1597
+ | `E_RECONCILE_PHASE_INVALID` | reconcile-closure was invoked for a task that is not EXECUTING, VERIFYING, or REVIEWING. | reconcile-closure supports EXECUTING, VERIFYING, or REVIEWING tasks whose objective is already satisfied. |
1336
1598
  | `E_RECONCILE_REQUIREMENT_UNKNOWN` | The supplied check id and requirement text do not exactly match a contract verification item of type VERIFICATION. | Supply the exact id and requirement text of an existing contract verification item. |
1337
1599
  | `E_RECONCILE_UNSUPPORTED_DRIFT` | Work-state drift includes kinds other than REPOSITORY_CHANGED (contract or required-artifact drift). | Resolve contract or artifact drift through their dedicated recovery surfaces; reconcile-closure only refreshes repository fingerprint drift. |
1338
1600
  | `E_REPOSITORY_CHANGED` | The repository fingerprint (branch or HEAD) moved after the work-state checkpoint was recorded. | If the task objective is already satisfied in the current repository, run forgeloop reconcile-closure; otherwise resume from a checkpoint that matches the current repository. |
@@ -1369,10 +1631,18 @@ package/process recovery boundary. The relevant stable codes are
1369
1631
  | `E_ROUTE_MISSING` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1370
1632
  | `E_ROUTE_REASON_MISSING` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1371
1633
  | `E_ROUTE_STALE` | Routing result does not match the active contract fingerprint. | Re-run forgeloop route. |
1634
+ | `E_SECURITY_REVIEW_CANCELLED` | Security review provider execution was cancelled before a valid observation completed. | Retry only when the caller still requires the optional observation. |
1635
+ | `E_SECURITY_REVIEW_EXECUTION_FAILED` | The optional security review provider failed without producing a valid observation. | Inspect the host-provided provider and retry explicitly; provider failure never changes ForgeLoop state. |
1636
+ | `E_SECURITY_REVIEW_OUTPUT_LIMIT` | Security review provider output exceeded the bounded result limits. | Reduce findings, diagnostics, strings, or result size at the provider. |
1637
+ | `E_SECURITY_REVIEW_PROVIDER_INVALID` | Security review provider configuration or interface implementation is invalid. | Use a provider implementing id and review(input) through the explicit host-injected Integration API. |
1638
+ | `E_SECURITY_REVIEW_PROVIDER_UNAVAILABLE` | The requested security review provider is not registered in runtime context. | Register an optional host-owned provider before explicit invocation; ForgeLoop never installs one. |
1639
+ | `E_SECURITY_REVIEW_REQUEST_INVALID` | The bounded security review request failed validation. | Provide explicit scope, bounded project-relative paths, categories, requirements, identities, and timeout. |
1640
+ | `E_SECURITY_REVIEW_RESULT_INVALID` | The security review provider returned malformed or contradictory findings. | Return only bounded findings and diagnostics without authority, lifecycle, evidence, or executable fields. |
1641
+ | `E_SECURITY_REVIEW_TIMEOUT` | Security review provider execution exceeded the shared deadline. | Use a responsive provider or a bounded timeout within the supported limit; timed-out output is discarded. |
1372
1642
  | `E_STATE_LEDGER_DIVERGENCE` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1373
1643
  | `E_STATE_MISSING` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1374
1644
  | `E_STATE_MISSING_AFTER_PREFLIGHT_READY` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1375
- | `E_STATE_REVALIDATION_REQUIRED` | The work-state checkpoint must be revalidated before the lifecycle can continue. | Run forgeloop reconcile-closure for externally satisfied EXECUTING tasks, or inspect the freshness reasons for other drift. |
1645
+ | `E_STATE_REVALIDATION_REQUIRED` | The work-state checkpoint must be revalidated before the lifecycle can continue. | Run forgeloop reconcile-closure for externally satisfied EXECUTING, VERIFYING, or REVIEWING tasks, or inspect the freshness reasons for other drift. |
1376
1646
  | `E_STATE_TASK_MISMATCH` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1377
1647
  | `E_STRATEGY_OSCILLATION` | Correction history oscillates between previously exhausted strategies without new information. | Gather a genuinely new observation or test a materially different falsifiable hypothesis. |
1378
1648
  | `E_STRUCTURAL_QUALITY_BASELINE_BINDING_MISMATCH` | Structural-quality evidence did not satisfy its provider, artifact, comparison, or lifecycle boundary. | Reconcile contract, route, policy, scope, provider, or rules drift before using the baseline. |
@@ -1396,6 +1666,11 @@ package/process recovery boundary. The relevant stable codes are
1396
1666
  | `E_STRUCTURAL_QUALITY_SOURCE_DRIFT` | Structural-quality evidence did not satisfy its provider, artifact, comparison, or lifecycle boundary. | Ensure the worktree is not mutated during provider observation and rerun quality-baseline or quality-verify. |
1397
1667
  | `E_STRUCTURAL_QUALITY_SOURCE_FINGERPRINT_UNAVAILABLE` | Structural-quality evidence did not satisfy its provider, artifact, comparison, or lifecycle boundary. | Repair unreadable or unsafe source material before structural-quality evidence can be trusted. |
1398
1668
  | `E_STRUCTURAL_QUALITY_TIMEOUT` | Structural-quality evidence did not satisfy its provider, artifact, comparison, or lifecycle boundary. | Use a responsive provider or a bounded timeout within the supported limit; never promote a timed-out scan. |
1669
+ | `E_TASK_ABANDON_AUTHORIZATION_REQUIRED` | task-abandon requires explicit caller acknowledgement and never grants completion or publication authority. | Re-run task-abandon with --acknowledge-abandonment after confirming the explicit task identity and intended claim release. |
1670
+ | `E_TASK_ABANDON_INCONSISTENT` | Explicit abandonment was refused because canonical ownership or append-only ledger evidence is inconsistent. | Repair and validate the task descriptor, recovery artifact, and ledger through their dedicated protocol paths before retrying. |
1671
+ | `E_TASK_ABANDON_INVALID_STATE` | The selected task is terminal or otherwise not eligible for explicit active-task abandonment. | Inspect task-show and next; only a valid non-terminal active task may be explicitly abandoned. |
1672
+ | `E_TASK_ABANDON_UNSAFE` | Task identity, lifecycle revision, ledger boundary, or claim ownership changed during explicit abandonment. | Re-inspect the task and retry only after the competing mutation has settled; never force claim release. |
1673
+ | `E_TASK_ALREADY_ABANDONED` | The task already has an active explicit-abandonment recovery boundary. | Inspect the existing recovery state; use task-resume only when explicit reacquisition is intended. |
1399
1674
  | `E_TASK_ALREADY_EXISTS` | A ForgeLoop protocol validation or lifecycle condition was not satisfied. | Inspect the structured command result, correct the named artifact or prerequisite, then run forgeloop next --json. |
1400
1675
  | `E_TASK_ALREADY_RECOVERED` | The task already has active durable recovered state. | Inspect the existing recovery metadata; use task-resume to reacquire claims or leave the task recovered. |
1401
1676
  | `E_TASK_AMBIGUOUS` | Multiple tasks exist in the project but no task selector was provided. | Select a task explicitly using --task <id> or FORGELOOP_TASK=<id>. |
@@ -1458,3 +1733,23 @@ that order, satisfy any remaining gates, and require `READY` again.
1458
1733
  This recovery guidance is unavailable after execution has started, for an
1459
1734
  invalid ledger, or when the new route does not match the contract. Preserve
1460
1735
  those barriers and follow the task's canonical recovery guidance.
1736
+
1737
+ ## Gate Recording
1738
+
1739
+ When `preflight` reports `E_GATE_UNVERIFIED`, use the executable command returned
1740
+ by `next` or record the required gate directly:
1741
+
1742
+ ```bash
1743
+ node src/cli.js gate-record \
1744
+ --task <task-id> \
1745
+ --gate threat-boundary \
1746
+ --status satisfied \
1747
+ --artifact THREAT_MODEL.md \
1748
+ --decision "Threat boundary reviewed for this task" \
1749
+ --json
1750
+ ```
1751
+
1752
+ ForgeLoop validates that the gate is required by the active route or policy,
1753
+ rejects traversal and symlink escapes, and computes artifact hashes itself.
1754
+ Changed referenced files produce `E_GATE_STALE`; manual gate JSON editing is not
1755
+ supported. Caller-recorded decisions are observations, not host attestation.
@@ -67,6 +67,31 @@ may be absent only when the canonical protocol marks it not applicable;
67
67
  presentation depth cannot change evidence, verification truth, authority,
68
68
  provenance, safety-floor, or validator-backed completion requirements.
69
69
 
70
+ ### Audit UX read model
71
+
72
+ The read-only `task/audit-view` resource provides a bounded operator-facing
73
+ projection of canonical status, audit, report, history, trace, ownership, next
74
+ action, approvals, diagnostics, recovery, and completion data. It is suitable
75
+ for timelines and audit panels, but it is not a lifecycle or evidence
76
+ authority:
77
+
78
+ ```js
79
+ const view = await readForgeLoopIntegrationResource("task/audit-view", {
80
+ taskId: "task-1",
81
+ limit: 50,
82
+ categories: ["LIFECYCLE", "CHECK", "DIAGNOSTIC"],
83
+ });
84
+ ```
85
+
86
+ Timeline items use deterministic sequence-backed IDs and explicit `null`
87
+ timestamps when the ledger lacks an authoritative timestamp. `limit`,
88
+ `beforeSequence`, `afterSequence`, and category filters are bounded. Raw event
89
+ payloads, commands, environment values, credentials, absolute paths, and
90
+ provider output are not exposed. Reading the resource performs no command,
91
+ provider, artifact, claim, or lifecycle mutation. Use the canonical CLI/API
92
+ commands for every state-changing operation. See [`AUDIT_UX.md`](./AUDIT_UX.md)
93
+ for the complete projection contract.
94
+
70
95
  ### Repository Search boundary
71
96
 
72
97
  The Integration API exposes direct, transport-neutral repository operations:
@@ -183,6 +208,12 @@ there is no stock `context-recall` command. A consumer that only understands
183
208
  `canonicalHandoffs` v1 may disable only the handoff-specific UI while retaining
184
209
  the rest of Protocol v1 functionality.
185
210
 
211
+ `advisoryContextProviders` v1 is the existing dedicated, lazy, opt-in
212
+ Integration API capability. `providerExtensions` v1 is the broader experimental
213
+ architecture vocabulary advertised by `protocol-info`. Generic provider
214
+ registry injection is not public yet; do not add a generic `providers` field
215
+ to `createForgeLoopContext()`.
216
+
186
217
  ## Consumers
187
218
 
188
219
  | Surface | Entry |
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en" data-theme="dark" data-preset="signal-flow" data-present="true">
3
3
  <head>
4
- <meta name="forgeloop-diagram-source-sha256" content="33bb9c3c4f3fb4a793febeab34b2d07ca7bf2c058d4f5e7575dba3a6065eedeb">
4
+ <meta name="forgeloop-diagram-source-sha256" content="eb8ca8fdfceb9e50cf7cd07be8622dcac127cfee80c8e2929d604c40138cc594">
5
5
  <meta name="forgeloop-diagram-renderer" content="archify@2.15.0 (e1ac748f19cf805e44bf74fb93c796662152e273)">
6
6
  <meta charset="UTF-8">
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -5432,7 +5432,7 @@
5432
5432
  <h3>Trust Levels</h3>
5433
5433
  </div>
5434
5434
  <ul>
5435
- <li>&bull; PROCESSED means artifacts exist and parse</li>
5435
+ <li>&bull; PROCESSED is a minimum reported level; MISSING, DISABLED, and INVALID remain separate statuses</li>
5436
5436
  <li>&bull; VERIFIED means completion, evidence, manifest, and content bindings validate</li>
5437
5437
  <li>&bull; ATTESTED additionally requires a valid external signature policy</li>
5438
5438
  <li>&bull; No supplied CI receipt means NOT_VERIFIED, not a trust level</li>
@@ -15,16 +15,16 @@
15
15
  "license": "MIT"
16
16
  },
17
17
  "input": {
18
- "sha256": "33bb9c3c4f3fb4a793febeab34b2d07ca7bf2c058d4f5e7575dba3a6065eedeb",
19
- "bytes": 9857
18
+ "sha256": "eb8ca8fdfceb9e50cf7cd07be8622dcac127cfee80c8e2929d604c40138cc594",
19
+ "bytes": 9910
20
20
  },
21
21
  "artifacts": {
22
22
  "html": {
23
- "sha256": "85bb7abf910d3f6dd12037cfcd90c4b67f0aad4dca2b4cb21be1b0112cbdd92e",
24
- "bytes": 653258
23
+ "sha256": "58f12b47996c7e901dadbf60988e0a8aa9b4af3687e3924129e87f62a9a13f89",
24
+ "bytes": 653311
25
25
  },
26
26
  "svg": {
27
- "sha256": "3a768148886ffdfcce75221c11e51ee77a3702510e90917bf6e8ba0581ebdb44",
27
+ "sha256": "876c6400a34f9fe9773e61d968ddf773669cc14153933de2b2ceccd4386506a7",
28
28
  "bytes": 216543
29
29
  }
30
30
  },
@@ -1,4 +1,4 @@
1
- <svg data-archify-version="2.15.0" data-forgeloop-source-sha256="33bb9c3c4f3fb4a793febeab34b2d07ca7bf2c058d4f5e7575dba3a6065eedeb" data-theme="dark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 1024" role="img" aria-labelledby="archify-diagram-title archify-diagram-description" data-animation="trace" data-preset="signal-flow" data-quality-profile="showcase">
1
+ <svg data-archify-version="2.15.0" data-forgeloop-source-sha256="eb8ca8fdfceb9e50cf7cd07be8622dcac127cfee80c8e2929d604c40138cc594" data-theme="dark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 1024" role="img" aria-labelledby="archify-diagram-title archify-diagram-description" data-animation="trace" data-preset="signal-flow" data-quality-profile="showcase">
2
2
  <style>
3
3
  .c-bg-rect { fill: var(--bg); }
4
4
  /* Keep boundary labels clear of the first node in each group. */