@cassiomc1/forgeloop 1.3.0 → 1.5.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 (76) hide show
  1. package/.github/copilot-instructions.md +1 -0
  2. package/AGENTS.md +1 -0
  3. package/CLAUDE.md +1 -0
  4. package/DOCS_INDEX.md +7 -0
  5. package/EXECUTION_STATE.md +40 -0
  6. package/LOOP_ENGINEERING.md +54 -5
  7. package/LOOP_SYSTEM_DESIGN.md +22 -1
  8. package/PROTOCOL_INTEGRATION.md +41 -0
  9. package/README.md +38 -0
  10. package/TERMINOLOGY.md +15 -0
  11. package/THIRD_PARTY_NOTICES.md +15 -0
  12. package/THREAT_MODEL.md +20 -1
  13. package/docs/ARTIFACT_REFERENCE.md +43 -0
  14. package/docs/CLI_REFERENCE.md +97 -3
  15. package/docs/CROSS_HARNESS_CONTINUITY.md +23 -0
  16. package/docs/DOCUMENTATION_GUIDE.md +14 -0
  17. package/docs/GETTING_STARTED.md +1 -0
  18. package/docs/MCP.md +126 -0
  19. package/docs/RECIPES.md +82 -0
  20. package/docs/RELEASE_CHECKLIST_1_4.md +38 -0
  21. package/docs/RELEASE_CHECKLIST_1_5_MCP.md +78 -0
  22. package/docs/TROUBLESHOOTING.md +111 -1
  23. package/docs/UNIVERSAL_INTEGRATION.md +48 -0
  24. package/package.json +14 -3
  25. package/schemas/task-recovery.schema.json +61 -0
  26. package/src/cli.js +173 -347
  27. package/src/commands/audit.js +5 -0
  28. package/src/commands/inspect.js +6 -0
  29. package/src/commands/progress.js +6 -2
  30. package/src/commands/status.js +17 -0
  31. package/src/commands/task-create.js +39 -1
  32. package/src/commands/task-list.js +14 -1
  33. package/src/commands/task-lock-status.js +2 -2
  34. package/src/commands/task-recover.js +202 -0
  35. package/src/commands/task-repair-legacy-recovery.js +417 -0
  36. package/src/commands/task-resume.js +172 -0
  37. package/src/commands/task-scope.js +23 -4
  38. package/src/commands/task-show.js +18 -4
  39. package/src/commands/validate-protocol.js +19 -2
  40. package/src/core/artifact-registry.js +12 -0
  41. package/src/core/audit.js +20 -4
  42. package/src/core/bundles.js +15 -0
  43. package/src/core/cli-command-definitions.js +50 -4
  44. package/src/core/command-executors.js +387 -0
  45. package/src/core/command-input.js +107 -0
  46. package/src/core/command-runtime.js +106 -0
  47. package/src/core/completion-artifacts.js +2 -3
  48. package/src/core/completion-ownership.js +88 -0
  49. package/src/core/error-codes.js +118 -1
  50. package/src/core/events.js +130 -1
  51. package/src/core/filesystem.js +55 -6
  52. package/src/core/inspect.js +27 -0
  53. package/src/core/integration-invocation-policy.js +170 -0
  54. package/src/core/integration-limits.js +20 -0
  55. package/src/core/integration-resources.js +127 -0
  56. package/src/core/next-action-model.js +60 -0
  57. package/src/core/next-action.js +31 -0
  58. package/src/core/phase.js +2 -1
  59. package/src/core/project-root.js +21 -0
  60. package/src/core/protocol-info.js +13 -0
  61. package/src/core/reconcile-closure.js +32 -10
  62. package/src/core/recovery-history.js +116 -0
  63. package/src/core/schema-validation.js +1 -0
  64. package/src/core/task-claim-state.js +272 -0
  65. package/src/core/task-command.js +5 -1
  66. package/src/core/task-conflict-inspection.js +321 -0
  67. package/src/core/task-context.js +32 -29
  68. package/src/core/task-discovery.js +14 -1
  69. package/src/core/task-lock.js +216 -22
  70. package/src/core/task-paths.js +3 -2
  71. package/src/core/task-recovery-migration.js +192 -0
  72. package/src/core/task-recovery.js +205 -0
  73. package/src/core/task-scope.js +33 -1
  74. package/src/core/templates.js +1 -0
  75. package/src/core/transaction.js +28 -2
  76. package/src/integration.js +47 -0
@@ -54,6 +54,7 @@ Key continuity invariants:
54
54
  | --- | --- | --- | --- |
55
55
  | **Task Descriptor** | `.forgeloop/task-state/<taskKey>/task.json` | Task ID, write claims, and task registration | Descriptor authority |
56
56
  | **Lifecycle Checkpoint** | `.forgeloop/task-state/<taskKey>/work-state.json` | Current phase, cycle, active guides, preflight binding | Canonical lifecycle truth |
57
+ | **Recovery State** | `.forgeloop/task-state/<taskKey>/recovery.json` | Candidate current suspension bound to ledger history | One input to canonical validated claim ownership; never sufficient alone and never completion evidence |
57
58
  | **Operational Continuity** | `.forgeloop/task-state/<taskKey>/continuity.json` | Active focus, remaining items, known issues, inspect-first paths | Operational context only (non-evidence) |
58
59
  | **Implementation Truth** | Git checkout / filesystem | Actual source code and files | Ground truth for changes |
59
60
  | **Task Intent** | `.forgeloop/task-state/<taskKey>/contract.json` | Objectives, constraints, deliverables, verification requirements | Contract authority |
@@ -182,6 +183,26 @@ forgeloop next --task auth-feature --json
182
183
 
183
184
  Follow the deterministic action returned by ForgeLoop (e.g. `CONTINUE_IMPLEMENTATION`, `ENTER_VERIFYING`, or `RECORD_CHECK`).
184
185
 
186
+ If `next` returns `RESUME_RECOVERED_TASK`, the handoff is still the same task,
187
+ but ordinary mutation is suspended. Inspect the recovery metadata and current
188
+ claim owners, then reacquire claims explicitly:
189
+
190
+ ```bash
191
+ forgeloop task-show --task auth-feature --json
192
+ forgeloop task-resume --task auth-feature --json
193
+ ```
194
+
195
+ Do not create, edit, or delete `recovery.json` manually. Every harness must use
196
+ the canonical validated descriptor + work-state + recovery + ledger projection;
197
+ a tombstone alone never releases claims. If another task owns an
198
+ overlapping path, `task-resume` fails with `E_TASK_SCOPE_CONFLICT` and leaves
199
+ the recovery state intact.
200
+
201
+ A project containing active task recovery state requires ForgeLoop 1.4.0 or
202
+ newer and `features.taskClaimRecovery.validatedClaimProjection=true` in
203
+ `protocol-info`. An unaware reader must fail closed rather than continue from
204
+ descriptor-only ownership.
205
+
185
206
  ---
186
207
 
187
208
  ## 6. Stale, Inconsistent, or Missing Handoffs
@@ -197,6 +218,8 @@ ForgeLoop handles edge cases deterministically:
197
218
  | **Multiple Active Tasks** | No `--task` or `FORGELOOP_TASK` supplied | `E_TASK_AMBIGUOUS` | List tasks with `task-list` and supply `--task` |
198
219
  | **Different Task ID** | Contract / state ID mismatch | `TASK_MISMATCH` | Do not merge contexts; complete or clear previous state |
199
220
  | **Malformed State** | Corrupted JSON or invalid hash chain | `INVALID` | Fails closed; inspect errors via `forgeloop doctor --json` |
221
+ | **Recovered Task** | `recovery.json` and its complete ledger history validate as one active recovery cycle | `RESUME_RECOVERED_TASK` | Inspect ownership, then use `task-resume`; recovery is not completion |
222
+ | **Recovery Inconsistency** | Artifact/history, descriptor claims, lock, or ledger evidence is missing, corrupt, or mismatched | `RESOLVE_RECOVERY_INCONSISTENCY` | Historical claims remain reserved; run `validate-protocol` and repair the named artifact instead of forcing recovery |
200
223
 
201
224
  ---
202
225
 
@@ -31,10 +31,24 @@ Reason-code truth -> exported protocol constants (src/core/error-codes.js,
31
31
  Guide registry truth -> canonical guide registry (src/config/guides.json)
32
32
  Package contents truth -> package.json + package tests (tests/package.test.js)
33
33
  Documentation routing -> DOCS_INDEX.md
34
+ Integration API truth -> src/integration.js (exports, envelope, limits, risk classes, resources)
35
+ MCP behavior truth -> integrations/mcp/src/* and integrations/mcp/package.json
36
+ MCP package boundary -> MCP package tests + scripts/mcp-package-smoke.mjs
34
37
  ```
35
38
 
36
39
  Operational documentation must explain canonical behavior, not redefine it.
37
40
 
41
+ Documentation-impact questions for integration/MCP changes:
42
+
43
+ - Did a server mode or capability gate change?
44
+ - Did an MCP transport change?
45
+ - Did an adapter error code change?
46
+ - Did an integration limit or resource list change?
47
+
48
+ Anti-drift invariant: every `documentation-manifest.json` entry marked
49
+ `packaged: true` is mechanically checked against the core npm tarball
50
+ contents (`tests/package.test.js`).
51
+
38
52
  Canonical phase and transition inventories must be derived from `WORK_PHASES`
39
53
  and `WORK_TRANSITIONS`; do not maintain independent hand-written transition
40
54
  enums when a generated or mechanically validated representation is available.
@@ -382,6 +382,7 @@ forgeloop task-migrate --json
382
382
  ## 8. Next Steps
383
383
 
384
384
  - Continue a task across different AI harnesses: [`docs/CROSS_HARNESS_CONTINUITY.md`](./CROSS_HARNESS_CONTINUITY.md)
385
+ - Optional: use ForgeLoop through MCP or the Integration API — [`docs/MCP.md`](./MCP.md) and [`docs/UNIVERSAL_INTEGRATION.md`](./UNIVERSAL_INTEGRATION.md). MCP is not required; CLI and MCP share the same canonical project/task state.
385
386
  - Complete command reference: [`docs/CLI_REFERENCE.md`](./CLI_REFERENCE.md)
386
387
  - Artifact and schema reference: [`docs/ARTIFACT_REFERENCE.md`](./ARTIFACT_REFERENCE.md)
387
388
  - Common symptoms and recovery: [`docs/TROUBLESHOOTING.md`](./TROUBLESHOOTING.md)
package/docs/MCP.md ADDED
@@ -0,0 +1,126 @@
1
+ # ForgeLoop MCP
2
+
3
+ The `@cassiomc1/forgeloop-mcp` package is a **local-first MCP adapter** over
4
+ the canonical ForgeLoop integration API (`@cassiomc1/forgeloop/integration`).
5
+ It is an **adapter, never a second implementation**: every tool call executes
6
+ a canonical ForgeLoop command and every ownership value comes from the
7
+ canonical claim resolver.
8
+
9
+ Two transports ship in one package:
10
+
11
+ - `forgeloop-mcp` — **stdio**, the default/recommended transport;
12
+ - `forgeloop-mcp-http` — **optional** strict-modern MCP 2026 HTTP,
13
+ loopback-only (remote access is unsupported).
14
+
15
+ ## Core principles
16
+
17
+ - **No duplicated protocol logic.** The server contains no lifecycle,
18
+ ownership, recovery, lock, or transaction code.
19
+ - **No direct protocol-state access.** The adapter never reads or writes
20
+ `.forgeloop` files; all mutation flows through ForgeLoop's own guards
21
+ (locks, transactions, revision checks, ledger append serialization).
22
+ - **`COMPLETE` is not enough.** Claim release is presented exactly as the
23
+ canonical resolver reports it; forged COMPLETE stays INCONSISTENT with
24
+ historical claims retained.
25
+ - **Recovery acknowledgement is not authorization.** `acknowledgeRecovery`
26
+ in tool input only satisfies ForgeLoop's caller acknowledgement after the
27
+ server was started with recovery capability.
28
+
29
+ ## Modes
30
+
31
+ | Mode | Read | Loop mutations | task-resume | External | Maintenance | Recovery | Legacy repair | Force |
32
+ | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
33
+ | `readonly` | yes | no | no | no | no | no | no | no |
34
+ | `safe` (default) | yes | yes | yes | no | no | no | no | no |
35
+ | `full` | yes | yes | yes | opt-in | opt-in | opt-in | opt-in | opt-in |
36
+
37
+ Capability flags (process-scoped, immutable after launch):
38
+ `--allow-external-execution`, `--allow-maintenance`, `--allow-recovery`,
39
+ `--allow-legacy-repair`, `--allow-force-recovery`.
40
+
41
+ ## Resources
42
+
43
+ - `forgeloop://protocol/info`
44
+ - `forgeloop://project/tasks`
45
+ - `forgeloop://task/{taskId}/status`
46
+ - `forgeloop://task/{taskId}/ownership` — canonical validated ownership
47
+ - `forgeloop://task/{taskId}/contract`
48
+ - `forgeloop://task/{taskId}/continuity`
49
+
50
+ Raw recovery artifacts, transaction journals, lock files, and unbounded event
51
+ ledgers are intentionally not exposed.
52
+
53
+ ## Optional stateless HTTP transport
54
+
55
+ `forgeloop-mcp-http` serves the same deterministic catalog over the **strict
56
+ modern** stateless MCP 2026 model (legacy-era traffic rejected):
57
+
58
+ ```bash
59
+ forgeloop-mcp-http --project /repo --mode safe # 127.0.0.1:3333
60
+ ```
61
+
62
+ - **Loopback only**: non-loopback binds fail closed with
63
+ `E_MCP_REMOTE_NOT_SUPPORTED`. Authenticated remote access is not designed
64
+ yet; Host validation is DNS-rebinding defense, not authentication.
65
+ - Strict modern: legacy-era handshakes are rejected, never silently served.
66
+ - Stateless: no session identity is issued, so transport metadata is never
67
+ ForgeLoop authority.
68
+ - Resource bounds: 4 MiB body cap, POST-only, header/request/keepalive
69
+ timeouts, in-flight ceiling (503 `E_MCP_HTTP_BUSY`).
70
+
71
+ ## Version matrix
72
+
73
+ | Component | Current contract |
74
+ | --- | --- |
75
+ | ForgeLoop core package | `1.5.x` repository generation |
76
+ | ForgeLoop protocol | `1` |
77
+ | Integration API | `1` |
78
+ | MCP package | `0.1.x` initial package |
79
+ | MCP protocol target | `2026-07-28` |
80
+
81
+ Repository implementation is separate from npm publication; nothing here
82
+ claims a published release.
83
+
84
+ ## Risk classes and gating examples
85
+
86
+ Invocations are classified at the adapter boundary:
87
+
88
+ ```text
89
+ READ_ONLY · LOOP_MUTATION · CLAIM_REACQUISITION · EXTERNAL_EXECUTION
90
+ MAINTENANCE · CLAIM_RELEASE_RECOVERY · LEGACY_MIGRATION · FORCE_DESTRUCTIVE
91
+ ```
92
+
93
+ Examples: `bundle` → MAINTENANCE (hidden in readonly/safe);
94
+ `task-resume` → CLAIM_REACQUISITION (available in safe — canonical claim
95
+ reacquisition); `task-recover` → CLAIM_RELEASE_RECOVERY (full +
96
+ `--allow-recovery`, plus the canonical acknowledgement); legacy repair →
97
+ separately gated/hidden; force unlock → separately gated. Tool input can
98
+ never elevate launch policy.
99
+
100
+ ## Bounds and timeouts
101
+
102
+ - Structured MCP input is byte-bounded (`E_MCP_INPUT_TOO_LARGE`).
103
+ - External execution cannot exceed the server launch timeout maximum:
104
+ omitted/null timeout receives the maximum; `0`, negative, non-integer, or
105
+ above-maximum values are refused.
106
+ - Tool, capabilities and resource output is bounded using the exact UTF-8
107
+ serialization actually transmitted. Oversized output fails closed with
108
+ `E_MCP_RESULT_TOO_LARGE` and is never silently truncated.
109
+
110
+ ## Adapter errors
111
+
112
+ Adapter-level errors are separate from the generated ForgeLoop core error
113
+ list in [TROUBLESHOOTING](./TROUBLESHOOTING.md):
114
+
115
+ | Code | Meaning |
116
+ | --- | --- |
117
+ | `E_MCP_INPUT_TOO_LARGE` | structured tool input exceeds the byte bound |
118
+ | `E_MCP_RESULT_TOO_LARGE` | serialized output exceeds the output bound |
119
+ | `E_MCP_HTTP_BUSY` | in-flight HTTP ceiling reached (503, Retry-After) |
120
+ | `E_MCP_REMOTE_NOT_SUPPORTED` | non-loopback bind attempted |
121
+ | `E_MCP_EXECUTION_TIMEOUT_INVALID` | timeout not a positive integer |
122
+ | `E_MCP_EXECUTION_TIMEOUT_EXCEEDS_LIMIT` | timeout above server maximum |
123
+ | `E_MCP_FORGELOOP_INTEGRATION_UNSUPPORTED` | installed core integration API mismatch |
124
+
125
+ Canonical ForgeLoop errors (e.g. `E_TASK_SCOPE_CONFLICT`,
126
+ `E_TASK_CLAIM_OWNERSHIP_INCONSISTENT`) are always preserved verbatim.
package/docs/RECIPES.md CHANGED
@@ -20,6 +20,7 @@ Concise, copy-paste friendly recipes for common ForgeLoop tasks.
20
20
  12. [Migrate Legacy 1.0 Single-Task Layout](#recipe-12--migrate-legacy-10-single-task-layout)
21
21
  13. [Record Decision Settlement Criteria](#recipe-13--record-decision-settlement-criteria)
22
22
  14. [Executable Policy, Baseline Ratchet, and Recovery](#recipe-14--executable-policy-baseline-ratchet-and-recovery)
23
+ 15. [Release and Reacquire Claims for an Abandoned Task](#recipe-15--release-and-reacquire-claims-for-an-abandoned-task)
23
24
 
24
25
  ---
25
26
 
@@ -311,3 +312,84 @@ forgeloop next --task task-001 --json
311
312
  # Intentional operator-authorized baseline reset (not normal recovery)
312
313
  forgeloop baseline --record --policy-reset-authorized --json
313
314
  ```
315
+
316
+ ---
317
+
318
+ ### Recipe 15 — Release and Reacquire Claims for an Abandoned Task
319
+
320
+ ```bash
321
+ # 1. Inspect deterministic classification and structured next action
322
+ forgeloop next --task task-001 --json
323
+
324
+ # 2. RECOVERABLE must use reconcile-closure; do not use task-recover
325
+ forgeloop reconcile-closure --task task-001 --id <verification-id> \
326
+ --requirement "<exact verification text>" -- <verification-command>
327
+
328
+ # 3. Only STALE or ABANDONED may release effective claims
329
+ forgeloop task-recover --task task-001 --acknowledge-recovery --json
330
+
331
+ # 4. Other tasks may now adopt the released paths
332
+ forgeloop task-create --task replacement-task --claim src --json
333
+
334
+ # 5. Reacquisition fails while replacement-task owns src
335
+ forgeloop task-resume --task task-001 --json
336
+
337
+ # 6. After the conflicting owner completes, reacquire claims explicitly
338
+ forgeloop task-resume --task task-001 --claim src --json
339
+ ```
340
+
341
+ `--acknowledge-recovery` records caller acknowledgement only. It does not grant
342
+ host authority or mark the task complete. Recovery preserves work state,
343
+ receipts, failures, policy snapshots, and continuity until normal lifecycle
344
+ work resumes. Claims are released only after ForgeLoop validates the recovery
345
+ artifact against the complete ledger history. If `next` returns
346
+ `RESOLVE_RECOVERY_INCONSISTENCY`, run `validate-protocol`; do not create, edit,
347
+ or delete `recovery.json` manually.
348
+
349
+ ## Run ForgeLoop through MCP (safe mode)
350
+
351
+ Start the local MCP adapter and inspect what it exposes:
352
+
353
+ ```bash
354
+ forgeloop-mcp --project . --mode safe
355
+ ```
356
+
357
+ `safe` mode permits reads, normal loop mutations, and canonical `task-resume`.
358
+ Call the `forgeloop_capabilities` tool first: it reports versions, features,
359
+ launch policy, and the resource list. Task ownership is available from the
360
+ `forgeloop://task/{taskId}/ownership` resource — always the canonical claim
361
+ resolver projection.
362
+
363
+ ## Resume a recovered task through MCP
364
+
365
+ Recovered tasks stay mutation-disabled until claims are reacquired:
366
+
367
+ ```json
368
+ { "tool": "forgeloop_task_resume", "arguments": { "taskId": "my-task" } }
369
+ ```
370
+
371
+ Conflicting claims fail with `E_TASK_SCOPE_CONFLICT` and keep recovery intact.
372
+ Ordinary mutations against a recovered task are refused by core regardless of
373
+ transport.
374
+
375
+ ## Deliberately opt into external execution
376
+
377
+ `run-check`/`reconcile-closure` require a full-mode launch flag; tool input
378
+ cannot grant it:
379
+
380
+ ```bash
381
+ forgeloop-mcp --mode full --allow-external-execution
382
+ ```
383
+
384
+ Execution uses exact argv arrays only — there is no generic shell tool — and
385
+ the server `--max-execution-time-ms` ceiling always applies. Output is bounded
386
+ on the exact UTF-8 serialization transmitted (`E_MCP_RESULT_TOO_LARGE`);
387
+ oversized structured input fails with `E_MCP_INPUT_TOO_LARGE`.
388
+
389
+ ## Diagnose loopback-only HTTP errors
390
+
391
+ `forgeloop-mcp-http` binds loopback only. A non-loopback bind fails closed
392
+ with `E_MCP_REMOTE_NOT_SUPPORTED`; remote/authenticated HTTP is unsupported.
393
+ Host/Origin validation is DNS-rebinding defense, not authentication. Under
394
+ load, requests beyond the in-flight ceiling receive 503 `E_MCP_HTTP_BUSY`
395
+ with `Retry-After`.
@@ -0,0 +1,38 @@
1
+ # ForgeLoop 1.4.0 release checklist
2
+
3
+ This checklist prepares the validated claim-recovery capability for release. It does not authorize publication, tagging, or deployment.
4
+
5
+ ## Ownership and recovery gates
6
+
7
+ - [ ] Fake, deleted, corrupt, schema-invalid, and mismatched `recovery.json` cases resolve to `INCONSISTENT`.
8
+ - [ ] `INCONSISTENT` preserves historical claims, disables mutation, blocks overlapping acquisition, and is visible in list/show/status/audit/inspect/next.
9
+ - [ ] Only a fully matched recovery artifact and append-only recovery history releases claims.
10
+ - [ ] `task-recover` remains restricted to `STALE` and `ABANDONED`; `RECOVERABLE` keeps its canonical reconciliation path.
11
+ - [ ] `task-resume` validates ownership, settles only an unchanged stale task lock, and reacquires claims under the project claims lock.
12
+ - [ ] Project claim locks classify `NONE`, `LIVE`, `STALE`, `UNKNOWN`, and `CORRUPT`, with CAS-safe stale settlement.
13
+ - [ ] Manually forged COMPLETE state cannot release claims.
14
+ - [ ] Canonically completed task does release claims.
15
+ - [ ] Corrupt/missing completion lifecycle proof retains historical claims.
16
+ - [ ] Task locks with incomplete identity classify UNKNOWN.
17
+ - [ ] Single COMPLETE/RECOVERED task can be inspected implicitly by READ commands.
18
+ - [ ] Single COMPLETE/RECOVERED task cannot be selected implicitly for mutation.
19
+ - [ ] Ownership ledger validation is not redundantly repeated inside one immutable snapshot.
20
+ - [ ] Legacy recovery repair CAS-settles only unchanged stale task locks.
21
+ - [ ] Legacy recovery repair refuses UNKNOWN/CORRUPT task locks.
22
+ - [ ] alreadyRepaired requires a fully valid canonical recovery relationship.
23
+ - [ ] No exported claim helper releases claims from COMPLETE phase alone.
24
+ - [ ] Legacy recovery migration v1 accepts only CALLER_ACKNOWLEDGED authority.
25
+
26
+ ## Compatibility and package gates
27
+
28
+ - [ ] `package.json` and `package-lock.json` agree on `1.4.0`.
29
+ - [ ] `protocol-info --json` advertises `features.taskClaimRecovery.validatedClaimProjection=true` and task-recovery schema v1.
30
+ - [ ] Documentation states that active task-recovery schema v1 requires a recovery-aware ForgeLoop reader (`>=1.4.0`).
31
+ - [ ] The packed package contains the recovery schema, claim-state core, recovery-history core, and this checklist.
32
+ - [ ] `npm test && npm run lint && npm run coverage && npm run docs:check && npm run pack:check && npm run pack:smoke && npm run dependency:policy` passes once on the release candidate.
33
+ - [ ] `git diff --check` and the repository ForgeLoop audit pass.
34
+
35
+ ## Publication boundary
36
+
37
+ - [ ] A separately authorized release workflow verifies the final commit, `v1.4.0` tag, npm metadata, tarball digests, and GitHub release identity.
38
+ - [ ] No actor treats caller acknowledgement as `HOST_ATTESTED` authority.
@@ -0,0 +1,78 @@
1
+ # ForgeLoop 1.5.0 + MCP release checklist
2
+
3
+ Preparation checklist for the `@cassiomc1/forgeloop` 1.5.0 and
4
+ `@cassiomc1/forgeloop-mcp` releases. It does not authorize publication.
5
+
6
+ ## Core integration gates
7
+
8
+ - [ ] Core package version is `1.5.0`; integration API version is `1`.
9
+ - [ ] `exports` map exposes only `.` and `./integration`.
10
+ - [ ] Executor registry is in parity with canonical command definitions.
11
+ - [ ] `bundle` is MAINTENANCE-gated; hidden in readonly/safe.
12
+ - [ ] `resolveForgeLoopProjectRoot` applies CLI target semantics (symlinks rejected).
13
+ - [ ] Integration limits bound strings, arrays, argv, and structured inputs.
14
+
15
+ ## MCP package gates
16
+
17
+ - [ ] Official SDK v2; target protocol generation `2026-07-28`.
18
+ - [ ] stdio works with clean stdout (protocol-only) and JSON stderr diagnostics.
19
+ - [ ] HTTP is strict modern (`legacy: "reject"`) and loopback-only
20
+ (`E_MCP_REMOTE_NOT_SUPPORTED` for any other bind).
21
+ - [ ] Transport bounds active: header/request/keepalive timeouts, 4 MiB body cap,
22
+ POST-only, in-flight ceiling (503 `E_MCP_HTTP_BUSY`).
23
+ - [ ] Tool/resource catalogs are deterministic and identical across transports.
24
+ - [ ] Task-aware mutation tools require explicit `taskId`.
25
+ - [ ] Capability gates re-checked per invocation; tool input cannot elevate policy.
26
+ - [ ] `task-recover`, legacy repair, and force unlock are separately gated;
27
+ legacy repair hidden by default; `operatorAuthorized` absent from schemas.
28
+ - [ ] No generic shell/exec tool exists.
29
+
30
+ ## Ownership/recovery parity
31
+
32
+ - [ ] `task/ownership` derives exclusively from the canonical claim resolver.
33
+ - [ ] Forged COMPLETE stays INCONSISTENT with retained claims on every surface.
34
+ - [ ] RECOVERED tasks block ordinary mutation; `task-resume` reacquires canonically.
35
+ - [ ] Concurrent resume yields exactly one winner.
36
+
37
+ ## Safety
38
+
39
+ - [ ] `maxExecutionTimeMs` enforced: missing→max, zero/negative/float rejected,
40
+ over-max rejected.
41
+ - [ ] Error payloads preserve canonical codes; secrets redacted; stacks stripped;
42
+ messages bounded.
43
+ - [ ] Oversized tool/resource output refused with `E_MCP_RESULT_TOO_LARGE`.
44
+
45
+ ## Packaging/docs
46
+
47
+ - [ ] Core tarball contains integration modules and both integration docs.
48
+ - [ ] MCP tarball contains both bins, src, README; core tarball never ships
49
+ `integrations/`.
50
+ - [ ] Server `serverInfo.version` equals MCP package.json version.
51
+ - [ ] MCP README documents stdio-default + optional loopback-only HTTP.
52
+ - [ ] THIRD_PARTY_NOTICES covers the Model Context Protocol SDK.
53
+ - [ ] CHANGELOG entries present.
54
+
55
+ ## Exact output-bound gates (post-PR #80)
56
+
57
+ - [ ] Output bounds measure the exact UTF-8 serialization transmitted
58
+ (pretty-printed included), not compact JSON.
59
+ - [ ] Compact-below/pretty-above regression covered by tests.
60
+ - [ ] UTF-8 byte-count regression covered by tests.
61
+ - [ ] `forgeloop_capabilities` complete result is bounded like command tools.
62
+ - [ ] Non-size serialization errors are rethrown, not mislabeled as overflow.
63
+ - [ ] Structured tool input is byte-bounded (`E_MCP_INPUT_TOO_LARGE`).
64
+
65
+ ## Documentation gates
66
+
67
+ - [ ] Repository-wide documentation audit complete.
68
+ - [ ] Documentation manifest/index current.
69
+ - [ ] Generated references current (`docs:generate` leaves no diff).
70
+ - [ ] README / CHANGELOG current.
71
+ - [ ] MCP / Universal Integration docs current.
72
+ - [ ] Security docs current.
73
+
74
+ ## Publication boundary
75
+
76
+ - [ ] Release identity verification passes.
77
+ - [ ] Publication of either package is separately authorized; this checklist
78
+ does not itself authorize npm publishing.
@@ -24,6 +24,7 @@ This guide provides symptom-first recovery procedures for common ForgeLoop proto
24
24
  - [Baseline re-record blocked during active task (`E_BASELINE_RECORD_DURING_ACTIVE_TASK`)](#symptom-baseline-re-record-blocked-during-active-task)
25
25
  - [Mutation checker execution error (`E_CHECK_MUTATION_EXECUTION_ERROR`)](#symptom-mutation-checker-execution-error)
26
26
  - [Another harness cannot resume the task](#symptom-another-harness-cannot-resume)
27
+ - [Task claim conflict or recovered task](#symptom-task-creation-blocked-by-a-write-claim-conflict-e_task_scope_conflict)
27
28
  - [Stable Error & Reason Code Reference](#stable-error-and-reason-codes)
28
29
 
29
30
  ---
@@ -235,6 +236,14 @@ forgeloop complete --task <id>
235
236
  ```
236
237
 
237
238
  Write claims release only when completion is validator-backed (`COMPLETE`).
239
+ A `phase: COMPLETE` that was never produced by the official completion pipeline
240
+ is not sufficient: the ownership resolver requires canonical lifecycle proof (a
241
+ validated ledger containing the task-bound `COMPLETION_VALIDATED` event with
242
+ coherent state). Unproven completion reports
243
+ `E_COMPLETION_OWNERSHIP_UNPROVEN` / `E_TASK_CLAIM_OWNERSHIP_INCONSISTENT`,
244
+ retains historical claims, and blocks mutation and overlapping acquisition.
245
+ Re-run the official completion pipeline or restore the canonical completion
246
+ event; never edit `work-state.json` by hand.
238
247
 
239
248
  ---
240
249
 
@@ -303,6 +312,94 @@ export FORGELOOP_TASK="<task-id>"
303
312
 
304
313
  ---
305
314
 
315
+ ### Symptom: Task Creation Blocked by a Write-Claim Conflict (`E_TASK_SCOPE_CONFLICT`)
316
+
317
+ #### What it means
318
+
319
+ Another non-`COMPLETE` task already holds a write claim that overlaps the claims you requested. ForgeLoop inspects the conflicting task automatically before failing and attaches a deterministic classification to the error.
320
+
321
+ #### Inspect
322
+
323
+ The conflict error carries machine-readable fields directly on each
324
+ `error.conflicts[]` entry, plus the full nested `inspection`:
325
+
326
+ - `classification`: one of `ACTIVE`, `RECOVERABLE`, `STALE`, `ABANDONED`, `INCONSISTENT`, `RECOVERED`, or `COMPLETE`;
327
+ - `reasonCodes`: the deterministic evidence codes behind the classification;
328
+ - `nextAction`: the deterministic recovery or wait action;
329
+ - `commandSpecs`: direct-process command metadata and required inputs;
330
+ - `inspection`: the complete classification evidence.
331
+
332
+ Classification is derived from machine state only: the validated relationship
333
+ between descriptor, work state, recovery artifact, and complete recovery
334
+ history; lock/lease,
335
+ checkpoint freshness, drift kinds, ledger validity, all recorded check statuses,
336
+ verification evidence, meaningful ledger activity, and idle time. Lock state
337
+ distinguishes `NONE`, `LIVE`, `STALE`, `UNKNOWN`, and `CORRUPT`; unknown,
338
+ corrupt, or unreadable evidence fails closed as `INCONSISTENT`. A `REVIEWING`
339
+ phase plus an old timestamp alone is never `STALE`; post-execution tasks whose
340
+ only drift is `REPOSITORY_CHANGED` remain `RECOVERABLE`.
341
+
342
+ #### Safe recovery
343
+
344
+ Follow the classification:
345
+
346
+ ```bash
347
+ # RECOVERABLE: reconcile through the official pipeline first
348
+ forgeloop reconcile-closure --task <task-id> --id <verification-id> \
349
+ --requirement "<exact contract verification text>" -- <command>
350
+
351
+ # STALE / ABANDONED only: caller-acknowledged claim release
352
+ forgeloop task-recover --task <task-id> --acknowledge-recovery --json
353
+
354
+ # RECOVERED: reacquire claims through normal ownership checks
355
+ forgeloop task-resume --task <task-id> --json
356
+
357
+ # INCONSISTENT: diagnose; do not force claim release
358
+ forgeloop validate-protocol --task <task-id> --json
359
+ ```
360
+
361
+ `task-recover` uses an explicit allowlist: only `STALE` and `ABANDONED` are
362
+ accepted. It refuses `ACTIVE`, `RECOVERABLE`, `INCONSISTENT`, `RECOVERED`,
363
+ `COMPLETE`, and unknown future classifications. A stale task lock is released
364
+ only if its lock ID, heartbeat, and owner instance still match the observation;
365
+ recovery then revalidates phase, revision, ledger sequence, and classification
366
+ under project-claims and task locks.
367
+
368
+ The command writes durable `recovery.json` and a linked append-only recovery
369
+ event in one transaction. For PR #66 compatibility, the writer retains the
370
+ event name `OPERATOR_RECOVERY_RECORDED`, but records
371
+ `authorityKind: CALLER_ACKNOWLEDGED`; readers also accept
372
+ `TASK_RECOVERY_RECORDED`. Recovery does not refresh `work-state.json`, change
373
+ phase, erase evidence, alter policy/continuity, or fabricate completion.
374
+ Historical descriptor claims remain visible, while canonical effective claims
375
+ are empty only when that relationship validates; ordinary mutations then fail
376
+ with `E_TASK_RECOVERED`. Fake, missing, corrupt, deleted, or mismatched recovery
377
+ evidence is `INCONSISTENT`, keeps historical claims effective, disables
378
+ mutation, and routes `next` to `RESOLVE_RECOVERY_INCONSISTENCY`.
379
+
380
+ `--acknowledge-recovery` is a caller declaration, not host-attested authority.
381
+ The deprecated `--operator-authorized` alias has the same limited meaning.
382
+ Only `task-resume` can transactionally remove recovery state and reacquire
383
+ claims. If another task owns an overlapping path, resume returns
384
+ `E_TASK_SCOPE_CONFLICT` and leaves the recovered task suspended.
385
+
386
+ Never create, delete, or edit `recovery.json` manually. Never remove task
387
+ recovery state to resume a task. Never interpret `recovery.json` without
388
+ validating its ledger binding. Direct changes bypass locks, transactions,
389
+ expected revisions, and the append-only ledger.
390
+
391
+ If `.forgeloop/.claims.lock` is stale, ForgeLoop quarantines and removes it only
392
+ when `lockId`, `heartbeatAt`, and `ownerInstanceId` still match. A live lock
393
+ returns `E_TASK_LOCKED`; unknown, corrupt, or concurrently replaced ownership
394
+ returns `E_PROJECT_CLAIMS_LOCK_INCONSISTENT`. Do not force-delete unknown lock
395
+ ownership.
396
+
397
+ A project containing active task recovery state requires ForgeLoop 1.4.0 or
398
+ newer. An older reader that cannot advertise validated claim projection must
399
+ fail closed instead of inferring ownership from the descriptor or tombstone.
400
+
401
+ ---
402
+
306
403
  ### Symptom: Verification Tool is Missing
307
404
 
308
405
  #### Error Code: `E_VERIFICATION_TOOL_UNAVAILABLE`
@@ -584,6 +681,7 @@ forgeloop next --task <id> --json
584
681
  | `E_CHECK_STATUS_CONTRADICTION` | 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. |
585
682
  | `E_CIRCULAR_COMPLETION_REQUIREMENT` | 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. |
586
683
  | `E_COMMAND_RESOLUTION_AMBIGUOUS` | 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. |
684
+ | `E_COMPLETION_OWNERSHIP_UNPROVEN` | Work-state claims COMPLETE but the canonical lifecycle/ledger completion proof is missing or invalid, so historical claims stay reserved. | Restore the canonical completion event and a valid ledger, or re-run the official completion pipeline; phase=COMPLETE alone never releases claims. |
587
685
  | `E_COMPLETION_RECOVERY_UNAUTHORIZED` | 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. |
588
686
  | `E_COMPLETION_REJECTED` | 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. |
589
687
  | `E_COMPLETION_REJECTION_LEDGER_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. |
@@ -622,6 +720,7 @@ forgeloop next --task <id> --json
622
720
  | `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. |
623
721
  | `E_INIT_KIT_CONFLICT` | A canonical ForgeLoop kit destination already exists with content that does not match the shipped canonical template. | Inspect the conflicting `.forgeloop/kit/...` file. If it is stale or partial ForgeLoop output, remove or restore it and rerun `forgeloop init`. Do not overwrite unknown content automatically. |
624
722
  | `E_INSTALLATION_AUTHORITY_REQUIRED` | Attempted software installation without host authority grant. | Use local non-installing binaries or request host authority grant. |
723
+ | `E_LEGACY_RECOVERY_MIGRATION_INVALID` | The legacy recovery-event repair was refused because the ledger does not match the exact known legacy defect signature, has incompatible later activity, holds a live lock, or is otherwise ambiguous. | Inspect the structured plan/errors; ambiguous or tampered ledgers stay INCONSISTENT and are never migrated. |
625
724
  | `E_MIGRATION_INCOMPLETE` | 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. |
626
725
  | `E_MIGRATION_WRITE_VERIFY` | 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. |
627
726
  | `E_MIXED_TERMINAL_REQUIREMENT` | 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. |
@@ -654,6 +753,7 @@ forgeloop next --task <id> --json
654
753
  | `E_PROFILE_SOURCE_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. |
655
754
  | `E_PROFILE_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. |
656
755
  | `E_PROGRESS_STALLED` | Persisted correction history shows no new diagnostic information. | Use an independent check, revisit assumptions, or record a materially different diagnosis. |
756
+ | `E_PROJECT_CLAIMS_LOCK_INCONSISTENT` | The project-wide claim reservation lock has unknown, corrupt, or concurrently changed ownership metadata. | Inspect .forgeloop/.claims.lock and retry only after its lease and owner identity can be validated; never force-delete unknown ownership. |
657
757
  | `E_PROTOCOL_MIGRATION_TARGET_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. |
658
758
  | `E_PUBLICATION_CLAIM_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. |
659
759
  | `E_PUBLICATION_REQUIREMENT_PENDING` | 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. |
@@ -683,9 +783,12 @@ forgeloop next --task <id> --json
683
783
  | `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. |
684
784
  | `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. |
685
785
  | `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. |
786
+ | `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. |
686
787
  | `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>. |
687
788
  | `E_TASK_CHANGE_ATTRIBUTION_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. |
688
789
  | `E_TASK_CHANGE_OUTSIDE_SCOPE` | Modified paths in repository exceed the declared task write claims. | Update write claims with forgeloop task-scope or revert out-of-scope modifications. |
790
+ | `E_TASK_CLAIM_OWNERSHIP_INCONSISTENT` | ForgeLoop cannot prove whether a task still owns its historical write claims. | Repair and validate the task descriptor, recovery artifact, and complete event ledger before acquiring overlapping claims or mutating the task. |
791
+ | `E_TASK_COMPLETE` | A validator-backed COMPLETE task is terminal and cannot be mutated. | Create or select a non-terminal task for further work; do not modify terminal task state. |
689
792
  | `E_TASK_CONTEXT_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. |
690
793
  | `E_TASK_DESCRIPTOR_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. |
691
794
  | `E_TASK_KEY_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. |
@@ -695,8 +798,15 @@ forgeloop next --task <id> --json
695
798
  | `E_TASK_MIGRATION_IDENTITY_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. |
696
799
  | `E_TASK_MIGRATION_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. |
697
800
  | `E_TASK_NOT_FOUND` | 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. |
801
+ | `E_TASK_NOT_RECOVERED` | task-resume was requested for a task without active recovered state. | Inspect the task with forgeloop task-show; task-resume is only valid while recovery.json is active. |
802
+ | `E_TASK_RECOVERED` | The task released its write claims through recovery and ordinary mutation is suspended. | Run forgeloop task-resume --task <id> to reacquire the released claims before mutating the task. |
803
+ | `E_TASK_RECOVERY_AUTHORITY_INVALID` | Recovery authority metadata is invalid or claims host attestation without a host-owned grant reference. | Use caller acknowledgement, or provide a host-attested recovery grant through a trusted host integration. |
804
+ | `E_TASK_RECOVERY_AUTHORIZATION_REQUIRED` | task-recover requires explicit caller acknowledgement; this is not host-attested authority. | Re-run with --acknowledge-recovery only when evidence shows the task is STALE or ABANDONED; --operator-authorized remains a deprecated alias. |
805
+ | `E_TASK_RECOVERY_INCONSISTENT` | Claim-release recovery was refused because the task state, recovery artifact, lock, or event ledger is inconsistent. | Repair the underlying artifact through its dedicated recovery surface; do not force-complete an unreadable task. |
806
+ | `E_TASK_RECOVERY_OFFICIAL_PATH_AVAILABLE` | Claim-release recovery was refused because canonical lifecycle reconciliation is available. | Use forgeloop reconcile-closure and the normal verification/completion pipeline instead of task-recover. |
807
+ | `E_TASK_RECOVERY_UNSAFE` | Claim-release recovery was refused because the conflicting task is active, inconsistent, already complete, or holds a live lease. | Resolve the reported classification first; live leases must expire or be released by their owner before recovery. |
698
808
  | `E_TASK_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. |
699
- | `E_TASK_SCOPE_CONFLICT` | Task write claims overlap with another non-complete task in the same checkout. | Adjust write claims to non-overlapping paths or run tasks in separate worktrees. |
809
+ | `E_TASK_SCOPE_CONFLICT` | Task write claims overlap with another non-complete task in the same checkout. | Inspect the conflicting task classification reported in error.conflicts, then reconcile or recover it through its reported official recovery commands before retrying task creation. |
700
810
  | `E_TASK_SCOPE_DIRTY` | Claimed paths contain pre-existing uncommitted changes. | Commit or stash changes in claimed paths before defining or adopting the scope. |
701
811
  | `E_TASK_SCOPE_FROZEN` | 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. |
702
812
  | `E_TASK_SCOPE_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. |
@@ -0,0 +1,48 @@
1
+ # Universal ForgeLoop Integration
2
+
3
+ ForgeLoop applies to any agent, harness, IDE, or orchestration runtime — with
4
+ or without MCP. The universal rule:
5
+
6
+ > If the active host exposes an official ForgeLoop structured integration,
7
+ > prefer it for protocol operations. Otherwise use the project-local ForgeLoop
8
+ > CLI. Never manually synthesize ForgeLoop-managed lifecycle, claim, recovery,
9
+ > ledger, or completion state because an integration is unavailable.
10
+
11
+ ## The programmatic integration API
12
+
13
+ `@cassiomc1/forgeloop/integration` (integration API version 1) is the
14
+ transport-neutral entrypoint:
15
+
16
+ ```js
17
+ import {
18
+ executeForgeLoopCommand,
19
+ validateForgeLoopCommandInput,
20
+ getForgeLoopCapabilities,
21
+ classifyForgeLoopInvocation,
22
+ readForgeLoopIntegrationResource,
23
+ } from "@cassiomc1/forgeloop/integration";
24
+ ```
25
+
26
+ - `executeForgeLoopCommand({command, projectPath, input})` returns a
27
+ deterministic envelope: `{ok, command, exitCode, result, error, metadata}`.
28
+ Domain rejections (preflight BLOCKED, audit INVALID) keep `ok:true` with a
29
+ non-zero exit code; `ok:false` means the command could not be executed and
30
+ preserves the canonical public error code.
31
+ - Ownership values always come from `resolveTaskClaimState()` through the
32
+ `task/ownership` resource — never derived from raw artifacts.
33
+ - Invocation risk classes (READ_ONLY, LOOP_MUTATION, CLAIM_REACQUISITION,
34
+ EXTERNAL_EXECUTION, MAINTENANCE, CLAIM_RELEASE_RECOVERY, LEGACY_MIGRATION,
35
+ FORCE_DESTRUCTIVE) describe what an invocation would do; launch policy
36
+ decides what is allowed.
37
+
38
+ ## Consumers
39
+
40
+ | Surface | Entry |
41
+ | --- | --- |
42
+ | ForgeLoop CLI | human terminal rendering over the same executors |
43
+ | ForgeLoop MCP | `@cassiomc1/forgeloop-mcp`: stdio (default/recommended) plus optional strict-modern loopback-only HTTP; see [MCP.md](./MCP.md) |
44
+ | Studio / IDE / CI adapters | the same integration subpath |
45
+
46
+ All consumers share one protocol authority: `.forgeloop/` state written only
47
+ by canonical ForgeLoop commands, so cross-harness continuity and recovery work
48
+ identically regardless of transport.