@cassiomc1/forgeloop 1.5.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/CONTRACT_COVERAGE.md +1 -0
  2. package/DOCS_INDEX.md +20 -10
  3. package/EXECUTION_STATE.md +20 -0
  4. package/LOOP_ENGINEERING.md +103 -1
  5. package/LOOP_SYSTEM_DESIGN.md +32 -0
  6. package/PROTOCOL_INTEGRATION.md +90 -0
  7. package/QUALITY_SCORECARD.md +2 -0
  8. package/README.md +47 -9
  9. package/THIRD_PARTY_NOTICES.md +15 -0
  10. package/THREAT_MODEL.md +41 -1
  11. package/docs/ARTIFACT_REFERENCE.md +159 -0
  12. package/docs/CLI_REFERENCE.md +294 -3
  13. package/docs/DIAGNOSTIC_MODEL.md +181 -0
  14. package/docs/DOCUMENTATION_GUIDE.md +22 -13
  15. package/docs/EXECUTION_TRACE.md +76 -0
  16. package/docs/MCP.md +34 -1
  17. package/docs/RECIPES.md +67 -0
  18. package/docs/RELEASE_CHECKLIST_1_6_1.md +121 -0
  19. package/docs/TROUBLESHOOTING.md +133 -2
  20. package/docs/assets/diagrams/forgeloop-engineering-flow.html +13797 -0
  21. package/docs/assets/diagrams/forgeloop-engineering-flow.receipt.json +37 -0
  22. package/docs/assets/diagrams/forgeloop-engineering-flow.svg +5002 -0
  23. package/docs/diagrams/README.md +55 -0
  24. package/docs/diagrams/forgeloop-engineering-flow.workflow.json +122 -0
  25. package/docs/diagrams/manifest.json +42 -0
  26. package/docs/diagrams/reviews/forgeloop-engineering-flow.review.json +20 -0
  27. package/package.json +13 -8
  28. package/schemas/action.schema.json +100 -0
  29. package/schemas/approval.schema.json +51 -0
  30. package/schemas/capability-policy.schema.json +41 -0
  31. package/schemas/diagnostic-case.schema.json +85 -0
  32. package/schemas/execution-receipt.schema.json +16 -0
  33. package/schemas/execution.schema.json +15 -0
  34. package/schemas/hypothesis-disposition.schema.json +16 -0
  35. package/schemas/intervention.schema.json +27 -0
  36. package/schemas/policy-lock.schema.json +1 -0
  37. package/schemas/policy-snapshot.schema.json +2 -0
  38. package/schemas/trajectory-evaluation.schema.json +64 -0
  39. package/schemas/trajectory-scenario.schema.json +42 -0
  40. package/src/cli.js +94 -0
  41. package/src/commands/action-authorize.js +41 -0
  42. package/src/commands/action-propose.js +10 -0
  43. package/src/commands/action-reconcile.js +10 -0
  44. package/src/commands/action-record.js +47 -0
  45. package/src/commands/action-show.js +10 -0
  46. package/src/commands/action-verify.js +10 -0
  47. package/src/commands/advance.js +7 -2
  48. package/src/commands/approval-request.js +64 -0
  49. package/src/commands/approval-resolve.js +10 -0
  50. package/src/commands/baseline.js +3 -3
  51. package/src/commands/eval.js +6 -0
  52. package/src/commands/history.js +18 -0
  53. package/src/commands/init.js +2 -2
  54. package/src/commands/inspect.js +49 -0
  55. package/src/commands/metrics.js +7 -0
  56. package/src/commands/next.js +8 -2
  57. package/src/commands/policy-discover.js +2 -2
  58. package/src/commands/record-diagnosis.js +37 -1
  59. package/src/commands/record-hypothesis-disposition.js +45 -0
  60. package/src/commands/record-intervention.js +35 -0
  61. package/src/commands/reflect.js +38 -0
  62. package/src/commands/report.js +9 -1
  63. package/src/commands/run-action.js +18 -0
  64. package/src/commands/run-check.js +1 -0
  65. package/src/commands/trace.js +34 -0
  66. package/src/commands/validate-protocol.js +21 -13
  67. package/src/core/action-authorization.js +106 -0
  68. package/src/core/action-constants.js +86 -0
  69. package/src/core/action-execution.js +106 -0
  70. package/src/core/action-ledger-projection.js +302 -0
  71. package/src/core/action-model.js +581 -0
  72. package/src/core/action-readiness.js +141 -0
  73. package/src/core/action-reconciliation-policy.js +49 -0
  74. package/src/core/action-reconciliation.js +66 -0
  75. package/src/core/action-verification.js +111 -0
  76. package/src/core/actions.js +462 -0
  77. package/src/core/approvals.js +405 -0
  78. package/src/core/artifact-registry.js +48 -0
  79. package/src/core/audit.js +25 -0
  80. package/src/core/bundles.js +15 -0
  81. package/src/core/capability-policy.js +226 -0
  82. package/src/core/cli-command-definitions.js +210 -1
  83. package/src/core/command-executors.js +171 -15
  84. package/src/core/command-runtime.js +12 -1
  85. package/src/core/completion-artifacts.js +71 -14
  86. package/src/core/completion-recovery-rebind.js +194 -0
  87. package/src/core/completion.js +70 -0
  88. package/src/core/continuity-reconciliation.js +24 -5
  89. package/src/core/diagnostic-model.js +396 -0
  90. package/src/core/diagnostic-projection.js +51 -0
  91. package/src/core/diagnostic-record.js +360 -0
  92. package/src/core/error-codes.js +363 -0
  93. package/src/core/events.js +41 -1
  94. package/src/core/execution-prerequisites.js +4 -1
  95. package/src/core/execution.js +29 -188
  96. package/src/core/failure-signature.js +70 -0
  97. package/src/core/failure-surface.js +57 -0
  98. package/src/core/history.js +110 -0
  99. package/src/core/hypothesis-projection.js +85 -0
  100. package/src/core/information-gain-projection.js +283 -0
  101. package/src/core/information-gain.js +138 -0
  102. package/src/core/inspect.js +105 -7
  103. package/src/core/integration-invocation-policy.js +55 -0
  104. package/src/core/integration-resources.js +51 -0
  105. package/src/core/next-action-model.js +35 -1
  106. package/src/core/next-action.js +459 -3
  107. package/src/core/phase.js +40 -21
  108. package/src/core/policy-engine.js +113 -6
  109. package/src/core/preflight-consistency.js +31 -5
  110. package/src/core/preflight.js +19 -2
  111. package/src/core/prepared-execution.js +256 -0
  112. package/src/core/progress.js +41 -4
  113. package/src/core/protocol-info.js +56 -0
  114. package/src/core/protocol.js +14 -0
  115. package/src/core/receipt.js +1 -0
  116. package/src/core/reconcile-closure.js +15 -12
  117. package/src/core/reflection.js +305 -0
  118. package/src/core/resumability.js +57 -3
  119. package/src/core/runtime-context.js +19 -1
  120. package/src/core/schema-validation.js +8 -0
  121. package/src/core/strategy-analysis.js +97 -0
  122. package/src/core/task-paths.js +28 -0
  123. package/src/core/task-snapshot.js +53 -0
  124. package/src/core/templates.js +8 -0
  125. package/src/core/trace.js +548 -0
  126. package/src/core/trajectory-evaluation.js +71 -0
  127. package/src/core/trajectory-metrics.js +80 -0
  128. package/src/core/transaction.js +8 -0
  129. package/src/core/verification-execution.js +257 -0
  130. package/src/core/work-state.js +10 -5
  131. package/src/integration.js +8 -0
  132. package/docs/assets/forgeloop-flow.svg +0 -1
  133. package/docs/forgeloop-flow.mmd +0 -51
@@ -0,0 +1,181 @@
1
+ # ForgeLoop Diagnostic Model
2
+
3
+ Canonical reference for structured diagnostic cases, interventions, and hypothesis dispositions (ForgeLoop 1.6.0+, Protocol v1 additive).
4
+
5
+ ## Principles
6
+
7
+ 1. **Observation is not hypothesis.** Observations are bounded statements grounded in recorded evidence. Hypotheses are falsifiable claims that may explain observations.
8
+ 2. **Hypothesis is not proof.** Statuses are `OPEN`, `SUPPORTED`, `WEAKENED`, `FALSIFIED`, `SUPERSEDED`, `UNRESOLVED`. ForgeLoop never emits `ROOT_CAUSE_CONFIRMED` or similar.
9
+ 3. **Append-only truth.** Diagnostic revisions are never rewritten; the ledger records evolving understanding.
10
+ 4. **Diagnostic prose is metadata.** Statements, settlement predicates, and next-safe-action text are never executed by ForgeLoop.
11
+
12
+ ## Structured diagnostic case
13
+
14
+ One diagnostic revision for one verification cycle, recorded with:
15
+
16
+ ```bash
17
+ forgeloop record-diagnosis --task <id> --file diagnostic-case.json --json
18
+ ```
19
+
20
+ Legacy flag-based `record-diagnosis` syntax remains valid; both forms cannot be combined.
21
+
22
+ Schema: `schemas/diagnostic-case.schema.json`. Bounded limits: 64 observations, 64 contributors, 32 hypotheses per case; statements up to 4096 characters; IDs match `^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$`.
23
+
24
+ ### Semantic fingerprint
25
+
26
+ `diagnosticFingerprint` hashes the canonicalized semantic content (cycle, failure class, observations/contributors/hypotheses semantics, next-safe action). Whitespace, key ordering, unordered reference arrays, and object IDs are excluded. Re-recording a semantically identical case is idempotent.
27
+
28
+ ### Revisions
29
+
30
+ `diagnosticRevision` starts at 1 and increases monotonically per cycle. Each revision binds `previousDiagnosticFingerprint` to the prior active revision.
31
+
32
+ ## Interventions
33
+
34
+ Recorded in `CORRECTING` phase:
35
+
36
+ ```bash
37
+ forgeloop record-intervention --task <id> --file intervention.json --json
38
+ ```
39
+
40
+ Interventions bind to at least one recorded hypothesis and carry a semantic fingerprint used to detect repetition without information gain.
41
+
42
+ ## Hypothesis dispositions
43
+
44
+ ```bash
45
+ forgeloop record-hypothesis-disposition --task <id> \
46
+ --hypothesis h-timeout-latency --status SUPPORTED \
47
+ --evidence-ref checkout-tests --reason "..." --json
48
+ ```
49
+
50
+ Allowed transitions: `OPEN → {SUPPORTED, WEAKENED, FALSIFIED, SUPERSEDED, UNRESOLVED}`, `SUPPORTED → {WEAKENED, FALSIFIED, SUPERSEDED}`, `WEAKENED → {SUPPORTED, FALSIFIED, SUPERSEDED}`.
51
+
52
+ ## Diagnostic precedence
53
+
54
+ One canonical resolver backs every lifecycle gate, `next`, `progress`, and reflection:
55
+
56
+ 1. latest valid structured diagnostic case (`DIAGNOSTIC_CASE_RECORDED`) for the active task/cycle;
57
+ 2. latest valid legacy diagnosis (`DIAGNOSIS_RECORDED`) for the active task/cycle;
58
+ 3. none.
59
+
60
+ Structured diagnosis is therefore a first-class protocol-native diagnostic source: a task using only `record-diagnosis --file` can traverse `DIAGNOSING -> CORRECTING -> VERIFYING` without any legacy event, and no duplicate legacy event is synthesized. Legacy diagnosis remains fully valid as a compatibility input.
61
+
62
+ ## Hypothesis state projection
63
+
64
+ Hypothesis status is projected forward from append-only chronology (case creation in `OPEN`, then each disposition validated against the last effective projected state) — never re-read from the source case. Terminal states (`FALSIFIED`, `SUPERSEDED`, `UNRESOLVED`) do not transition unless a future protocol revision explicitly allows reopening. Invalid transitions fail closed with `E_HYPOTHESIS_DISPOSITION_INVALID`. `trace`, `reflect`, and continuity `openHypotheses` all consume this same projection.
65
+
66
+ ## Evidence binding
67
+
68
+ Structured cases require at least one hypothesis; `CHECK_RESULT` observations must resolve to a real check from the active verification cycle; a `VERIFICATION_FAILURE` case must bind at least one hypothesis or observation to failed/blocked evidence from the active cycle. Revision chains are revalidated at read time (`revision N.previousDiagnosticFingerprint == revision N-1.diagnosticFingerprint`).
69
+
70
+ ## Effective gain definition
71
+
72
+ Effective Information Gain exists when a diagnostic cycle changes a meaningful
73
+ semantic dimension of the verified engineering state:
74
+
75
+ ```text
76
+ new observation new contributor new hypothesis
77
+ new evidence hypothesis disposition hypothesis elimination
78
+ failure signature failure surface intervention semantics
79
+ strategy
80
+ ```
81
+
82
+ All of these participate in `effectiveGain`. Semantic noise — new IDs,
83
+ timestamps, property order, whitespace-equivalent paraphrases — never does.
84
+
85
+ ## Classification vs effective gain
86
+
87
+ The compatibility classification (`FIRST_DIAGNOSIS`, `NEW_HYPOTHESIS`,
88
+ `NEW_EVIDENCE`, `NEW_HYPOTHESIS_AND_EVIDENCE`, `NONE`) intentionally does not
89
+ encode every v2 dimension. A cycle can therefore report:
90
+
91
+ ```text
92
+ classification = NONE
93
+ failureSurfaceChanged = true
94
+ effectiveGain = true
95
+ ```
96
+
97
+ `effectiveGain` is computed once from the final dimensions by the authoritative
98
+ cycle analysis projection; consumers (progress, reflect, next, inspect,
99
+ continuity) must not recompute or post-mutate it.
100
+
101
+ ## Stall policy (fail-fast)
102
+
103
+ A structured diagnostic state is **stalled** when its latest comparable
104
+ diagnostic state has no effective information gain. There is no two-cycle
105
+ threshold: one no-gain comparison blocks another blind correction retry with
106
+ `E_DIAGNOSIS_NO_NEW_INFORMATION`, and progress/reflect/next/inspect expose the
107
+ same condition. The first diagnosis is never stalled. High correction-cycle
108
+ count alone remains advisory (`WATCH`), never `STALLED`.
109
+
110
+ Stall is not terminal: recording a diagnostic with meaningful new information
111
+ (a new observation, contributor, evidence, hypothesis change, and so on)
112
+ clears it immediately. Strategy oscillation (`A -> B -> A`) keeps the more
113
+ specific `INTRODUCE_NEW_OBSERVATION` guidance over generic no-gain guidance.
114
+ Historical repetition metrics remain available as reflective explanation
115
+ (`stallAnalysis`) but do not change the stall decision. Semantic noise — new IDs,
116
+ timestamps, property order, whitespace-equivalent paraphrases — never counts as
117
+ gain or as hypothesis elimination.
118
+
119
+ ## Failure surface evolution
120
+
121
+ Every canonically verified cycle appears in failure surfaces, including
122
+ successful ones:
123
+
124
+ ```text
125
+ cycle 2 ["lint"]
126
+ cycle 3 [] <- explicit empty successful cycle, direction REDUCED
127
+ ```
128
+
129
+ A full reduction to `[]` classifies the preceding intervention as `IMPROVED`.
130
+
131
+ ## Intervention repetition
132
+
133
+ ```text
134
+ repeatedSemanticIntervention
135
+ = the same intervention semantic fingerprint was recorded before
136
+
137
+ NON_INFORMATIVE
138
+ = later verification produced no meaningful semantic change
139
+ ```
140
+
141
+ Recording an intervention returns `repeatedSemanticIntervention` plus
142
+ `effectiveness: "PENDING"`. Only a subsequent completed verification cycle can
143
+ classify `IMPROVED | REGRESSED | INFORMATIVE | NON_INFORMATIVE`.
144
+
145
+ ## Continuity diagnostic context
146
+
147
+ ```json
148
+ {
149
+ "activeFailureSignatures": ["<sha256-like canonical fingerprint>"],
150
+ "activeFailedRequirements": ["auth-tests"],
151
+ "openHypotheses": [],
152
+ "latestIntervention": null,
153
+ "nextExperiment": null,
154
+ "doNotRepeat": []
155
+ }
156
+ ```
157
+
158
+ `activeFailureSignatures` contains canonical `computeFailureSignature` hashes
159
+ scoped to the active verification cycle; requirement names are exposed
160
+ separately in `activeFailedRequirements`.
161
+
162
+ ## Structured case hypothesis invariant
163
+
164
+ At least one hypothesis is mandatory: `hypotheses.minItems = 1` is enforced
165
+ identically by the JSON schema, the runtime validator, ledger validation, and
166
+ the record-diagnosis command path.
167
+
168
+ ## Information gain
169
+
170
+ Compatibility values (`FIRST_DIAGNOSIS`, `NEW_HYPOTHESIS`, `NEW_EVIDENCE`, `NEW_HYPOTHESIS_AND_EVIDENCE`, `NONE`) remain valid. Structured dimensions add observation/contributor/hypothesis novelty, disposition changes, failure-signature change, failure-surface change, and intervention change. New IDs, timestamps, whitespace, paraphrases, and identical reruns never constitute gain.
171
+
172
+ ## Stall and oscillation
173
+
174
+ - High correction-cycle count alone is advisory (`WATCH`), never `STALLED`.
175
+ - Strong stall requires identical failure signature, strategy, contributors, hypotheses, surface, and no new evidence across consecutive cycles. Two consecutive correction cycles without effective gain under the same strategy reach `STALLED` (`REQUIRE_NEW_DIAGNOSTIC_INFORMATION`).
176
+ - Repetition of an intervention is not automatically non-informative: effectiveness (`PENDING | IMPROVED | REGRESSED | INFORMATIVE | NON_INFORMATIVE`) is classified only after subsequent verification. Continuity `doNotRepeat` requires semantic repetition AND at least two completed post-intervention verification cycles AND unchanged failure surface.
177
+ - Oscillation (`A→B→A`) surfaces as `OSCILLATING_STRATEGY`; `next` recommends `INTRODUCE_NEW_OBSERVATION`.
178
+
179
+ ## Capability discovery
180
+
181
+ `forgeloop protocol-info --json` advertises `features.diagnostics`, `executionHistory`, `structuredTrace`, `taskInspection`, and `reflection`.
@@ -14,7 +14,7 @@ ForgeLoop strictly separates normative protocol definitions from operational doc
14
14
  | **Operational & Reference** | `docs/` (`GETTING_STARTED.md`, `CROSS_HARNESS_CONTINUITY.md`, `CLI_REFERENCE.md`, `ARTIFACT_REFERENCE.md`, `TROUBLESHOOTING.md`, `RECIPES.md`) | Tutorials, command reference, handoff workflows, and troubleshooting | Explains how to operate the system. Links to normative sources for formal specifications. |
15
15
  | **Domain Engineering** | `ENG/` (`clean-code-eng.md`, `design-code-eng.md`, `test-code-eng.md`, etc.) | Domain-specific implementation and quality standards | Frontmatter must adhere to `validate_loop_system.py` standards. |
16
16
  | **Consumer Documentation Quality** | [`ENG/documentation-quality-eng.md`](../ENG/documentation-quality-eng.md) | Quality standards for documentation work in projects using ForgeLoop | Governs client/consumer project documentation tasks via guide routing. |
17
- | **Visual Architecture** | `docs/forgeloop-flow.mmd` | Canonical architecture diagram source | Rendered SVG committed at `docs/assets/forgeloop-flow.svg`. |
17
+ | **Visual Architecture** | `docs/diagrams/manifest.json` + `docs/diagrams/forgeloop-engineering-flow.workflow.json` | Governance metadata and canonical typed Archify workflow source | Animated HTML explorer, animated SVG fallback, deterministic receipt, and source-bound human review are committed under `docs/assets/diagrams/` and `docs/diagrams/reviews/`. |
18
18
  | **Documentation Index** | `DOCS_INDEX.md` | Single repository index and ownership map | Updated whenever documentation structure changes. |
19
19
 
20
20
  ---
@@ -84,7 +84,7 @@ cross-platform CI (.github/workflows/docs-quality.yml)
84
84
  | **CLI Command Options** | `CLI_COMMAND_DEFINITIONS` (`src/core/cli-command-definitions.js`) | `docs/CLI_REFERENCE.md` | `<!-- BEGIN FORGELOOP GENERATED: cli:<command>:options -->` |
85
85
  | **Work-State Transitions** | `WORK_PHASES` / `WORK_TRANSITIONS` (`src/core/protocol.js`) | `ORCHESTRATOR_INTEGRATION.md` | `<!-- BEGIN FORGELOOP GENERATED: work-transitions -->` |
86
86
  | **Public Error Codes** | `PUBLIC_ERROR_CODES` (`src/core/error-codes.js`) | `docs/TROUBLESHOOTING.md` | `<!-- BEGIN FORGELOOP GENERATED: public-error-codes -->` |
87
- | **Architecture Flow** | `docs/forgeloop-flow.mmd` | `docs/assets/forgeloop-flow.svg` | Verified via embedded SHA-256 fingerprint |
87
+ | **Architecture Flow** | `docs/diagrams/manifest.json` + `docs/diagrams/forgeloop-engineering-flow.workflow.json` | `docs/assets/diagrams/forgeloop-engineering-flow.{html,svg,receipt.json}` + `docs/diagrams/reviews/forgeloop-engineering-flow.review.json` | Verified via pinned Archify renderer, trace-animation markers, source/SVG fingerprints, artifact hashes, persistent review, and composition checks |
88
88
 
89
89
  ### Maintenance Workflow
90
90
 
@@ -122,7 +122,7 @@ conformance checks detect omissions.
122
122
  | **Discovery resume rules** | `DISCOVERY_SURFACES` & `nativeShim` | `scripts/validate_documentation_conformance.mjs` |
123
123
  | **Task-layout path freshness** | `TASK_LAYOUT_DOCUMENTS` & `task-paths.js` | `scripts/validate_documentation_conformance.mjs` |
124
124
  | **Package-shipped docs** | `package.json` (`files`) | `tests/package.test.js` |
125
- | **Architecture diagram** | `docs/forgeloop-flow.mmd` | `scripts/check-generated-diagram.mjs` |
125
+ | **Architecture diagram** | `docs/diagrams/forgeloop-engineering-flow.workflow.json` | `scripts/check-documentation-diagrams.mjs` and `scripts/documentation-diagram-inventory.mjs` |
126
126
 
127
127
  ---
128
128
 
@@ -177,21 +177,29 @@ migration, or security-sensitive require `npm run docs:check` before merge.
177
177
 
178
178
  ---
179
179
 
180
- ## 7. Mermaid Diagrams and SVG Generation
180
+ ## 7. Archify Diagrams and Animated SVG Generation
181
181
 
182
- 1. **Source is Canonical**: Diagram source files live in `.mmd` files (e.g. `docs/forgeloop-flow.mmd`). Never modify SVG files directly.
183
- 2. **Local Committed SVGs**: Generated SVGs are committed locally in `docs/assets/`. Never hotlink externally rendered diagram images.
184
- 3. **Self-Contained & GitHub-Safe**: Generated SVGs must not import external stylesheets (e.g. `@import url(...)`), must not embed `<script>` or `<foreignObject>`, and must be visible via standard Markdown image syntax (`![alt](./path.svg)`).
185
- 4. **Fingerprint Verification**: Generated SVGs embed a `data-forgeloop-source-sha256` attribute verified by `npm run docs:check`.
182
+ 1. **Typed source is canonical**: The architecture flow is authored in Archify workflow IR at `docs/diagrams/forgeloop-engineering-flow.workflow.json`. Never modify generated HTML or SVG files directly.
183
+ 2. **Pinned local renderer**: Generation uses only the vendored Archify v2.15.0 source at the reviewed commit recorded in `docs/diagrams/manifest.json` and `vendor/archify/v2.15.0/PIN.json`.
184
+ 3. **Animated committed outputs**: The source uses `meta.animation: "trace"`. The interactive HTML is the primary animated explorer, and the self-contained SVG fallback carries trace-capable edge/node animation while remaining usable in repository previews. The deterministic receipt is committed under `docs/assets/diagrams/`.
185
+ 4. **GitHub-safe SVG**: The SVG must not embed `<script>` or `<foreignObject>`, must expose accessible title/description metadata, and must remain visible through standard Markdown image syntax.
186
+ 5. **Fingerprint and review verification**: The generated SVG embeds a `data-forgeloop-source-sha256` attribute, the outputs expose trace markers, and the receipt binds the source, HTML, and SVG hashes. The human-owned review at `docs/diagrams/reviews/` binds the current source and SVG hashes and is never generated or overwritten. Run `npm run docs:diagrams:check` before review.
187
+ 6. **Scoped wrapper**: The ForgeLoop Archify wrapper is intentionally documentation-scoped. It reads canonical inputs only from `docs/diagrams/` and permits deliver outputs only under `docs/assets/diagrams/`.
188
+
189
+ ForgeLoop governs five documentation-diagram categories: workflow,
190
+ architecture, sequence, dataflow, and lifecycle. The current repository has
191
+ one canonical workflow diagram. Governance support does not imply renderer
192
+ support: a type requires an explicit renderer mapping before it can be added as
193
+ an active diagram.
186
194
 
187
195
  ---
188
196
 
189
197
  ## 8. README Hero and Package Boundary
190
198
 
191
199
  README hero assets are branding/conceptual illustrations. They are not the
192
- canonical protocol diagram. `docs/forgeloop-flow.mmd` remains the canonical
193
- architecture flow source and `docs/assets/forgeloop-flow.svg` remains its
194
- generated render.
200
+ canonical protocol diagram. The typed Archify workflow under `docs/diagrams/`
201
+ remains the canonical architecture flow source, with generated outputs under
202
+ `docs/assets/diagrams/`.
195
203
 
196
204
  The README hero is intentionally GitHub-repository-only:
197
205
 
@@ -206,8 +214,9 @@ The README hero is intentionally GitHub-repository-only:
206
214
  packaged Markdown must be present in the package and covered by
207
215
  `tests/package.test.js`.
208
216
 
209
- Never delete `docs/assets/forgeloop-flow.svg`; it is generator-owned output of
210
- the diagram workflow.
217
+ Never edit or delete a generated diagram output independently of its source;
218
+ regenerate `docs/assets/diagrams/` from the typed workflow and keep the receipt
219
+ in sync.
211
220
 
212
221
  ---
213
222
 
@@ -0,0 +1,76 @@
1
+ # ForgeLoop Execution Trace
2
+
3
+ Reference for `history`, `trace`, `reflect`, and task-level `inspect` observability projections (ForgeLoop 1.6.0+).
4
+
5
+ All views are deterministic read-only projections of canonical artifacts (event ledger + work state). There is no second truth store.
6
+
7
+ ## history
8
+
9
+ ```bash
10
+ forgeloop history --task <id> [--json] [--compact] [--verbose]
11
+ [--type <types>] [--phase <phases>] [--failures] [--checks]
12
+ [--since <ts>] [--until <ts>] [--limit <n>]
13
+ ```
14
+
15
+ Human output shows chronological events with timestamps from the ledger. JSON output includes:
16
+
17
+ - `snapshot`: consistency anchors (`stateRevision`, `ledgerTailSequence`)
18
+ - `summary`: event/check/diagnostic counts
19
+ - `historyQuality`: `COMPLETE | PARTIAL | MINIMAL` with reasons
20
+ - `integrity`: ledger validation result
21
+ - `events`: normalized events (category, phase, provenance, references)
22
+
23
+ Filters are presentation-only; they never weaken integrity validation. Truncation via `--limit` is explicit (`truncated: true`).
24
+
25
+ ## trace
26
+
27
+ ```bash
28
+ forgeloop trace --task <id> --json
29
+ ```
30
+
31
+ Machine-readable reconstruction containing events, lifecycle transitions (including `VERIFICATION_STARTED`), check attempts, diagnostics (legacy diagnoses, structured cases, interventions, dispositions), failure signatures/surfaces, executions, evidence, continuity, recovery, completion, integrity, and snapshot anchors.
32
+
33
+ Failure surfaces include every canonically verified cycle; a successful
34
+ verification appears explicitly as `surface: []`, enabling deterministic
35
+ `REDUCED -> empty` and intervention `IMPROVED` classification.
36
+
37
+ Attempt cardinality comes primarily from ledger chronology: one ledger attempt plus its state checkpoint counts once; two distinct ledger events count twice; a state-only check appears as one fallback attempt (`source: "state-fallback"`). Phases are reconstructed forward from milestone events (`TASK_RECEIVED -> RECEIVED` ... `COMPLETION_VALIDATED -> COMPLETE`); events between milestones carry derived phases (for example failed verification -> `DIAGNOSING`, recorded intervention -> `CORRECTING`) with `phaseQuality: "authoritative" | "derived" | "unknown"`. Determinism: identical canonical artifacts produce identical traces except `snapshot.capturedAt`.
38
+
39
+ ## reflect
40
+
41
+ ```bash
42
+ forgeloop reflect --task <id> [--json]
43
+ ```
44
+
45
+ Whole-task retrospective (gain truth comes from the canonical cycle analysis;
46
+ `stallAnalysis` explains historical repetition without changing the fail-fast
47
+ stall decision): verification cycles, failure surfaces, hypothesis summary, intervention effectiveness (`PENDING | INFORMATIVE | NON_INFORMATIVE | IMPROVED | REGRESSED`), strategy fingerprints, oscillation patterns, signals, and a recommended protocol action. Deterministic — ForgeLoop does not call an LLM.
48
+
49
+ ## inspect --task
50
+
51
+ `forgeloop inspect --task <id>` extends target health with an additive `taskInspection` section: snapshot, lifecycle transitions, history quality, verification attempts per requirement, diagnostic summary, progress evaluation, integrity issues, deterministic explanation reason codes, and the safe next command. Existing top-level inspect fields are unchanged.
52
+
53
+ ## Read-only invariant
54
+
55
+ `history`, `trace`, `reflect`, `inspect`, `progress` never mutate protocol state, acquire ownership, or append events. Test suites enforce this by hashing the complete `.forgeloop` tree before/after invocation.
56
+
57
+ ## Durable actions in the trace
58
+
59
+ `trace --json` adds an `actions` projection with totals, state and capability
60
+ counts, required/verified/failed/ambiguous counts, repeated idempotency-key
61
+ attempts, reconciliation count, and action-event count. The projection reads
62
+ the task action artifacts and the same ledger already used by history; it is
63
+ not a second source of lifecycle truth.
64
+
65
+ An action recorded as `COMMIT_UNKNOWN` is an external-state uncertainty, not a
66
+ diagnostic failure. Reflection surfaces `EXTERNAL_ACTION_RECONCILIATION_REQUIRED`
67
+ and recommends `RECONCILE_EXTERNAL_ACTION` before ordinary retry guidance.
68
+ `FORGELOOP_EXECUTED`, `HOST_REPORTED`, and `EXTERNAL_OBSERVED` remain distinct
69
+ provenance values.
70
+
71
+ `forgeloop metrics --task <id> --json` projects trajectory counts, action
72
+ outcomes, observed executions, and first/last authoritative ledger timestamps.
73
+ Usage fields remain `null` with `source: "UNKNOWN"` when the host did not
74
+ report them. `forgeloop eval --task <id> --scenario <path> --json` evaluates a
75
+ validated current trace against a project-local reference scenario; an
76
+ efficiency ratio is omitted when no positive comparable-step reference exists.
package/docs/MCP.md CHANGED
@@ -46,6 +46,39 @@ Capability flags (process-scoped, immutable after launch):
46
46
  - `forgeloop://task/{taskId}/ownership` — canonical validated ownership
47
47
  - `forgeloop://task/{taskId}/contract`
48
48
  - `forgeloop://task/{taskId}/continuity`
49
+ - `forgeloop://task/{taskId}/actions`
50
+ - `forgeloop://task/{taskId}/action/{actionId}`
51
+ - `forgeloop://task/{taskId}/approvals`
52
+ - `forgeloop://task/{taskId}/metrics`
53
+ - `forgeloop://task/{taskId}/evaluations`
54
+ - `forgeloop://project/capability-policy`
55
+
56
+ The durable-action resources are read-only projections. The first release does
57
+ not expose `run-action` or host-attestation minting over MCP. An action that is
58
+ `COMMIT_UNKNOWN` is surfaced as an external reconciliation requirement; MCP
59
+ transport/session metadata cannot authorize a retry or manufacture
60
+ `HOST_ATTESTED` authority. Capability policy remains policy, not authority.
61
+
62
+ ### Approval resolution and reconciliation settlement capabilities
63
+
64
+ Two launch flags expose transport surfaces; neither creates host authority:
65
+
66
+ - `--allow-approval-resolution` exposes the `approval-resolve` tool.
67
+ Resolving an approval as `HOST_ATTESTED` still requires a trusted
68
+ out-of-band authority context supplied by the embedding host through
69
+ `createForgeLoopMcpServer({ authorityContextProvider })`. Without a
70
+ provider, `HOST_ATTESTED` resolutions fail closed with
71
+ `E_ACTION_AUTHORITY_REQUIRED`. Tool arguments can never carry the context:
72
+ any actor-supplied `authorityContext` property is stripped before dispatch.
73
+ - `--allow-reconciliation-settlement` exposes settlement-class
74
+ `action-reconcile` invocations (`--outcome COMMITTED|NOT_COMMITTED`).
75
+ Recording an `UNKNOWN` observation needs no special capability, but settling
76
+ external commit state is independently gated and still requires trusted
77
+ host attestation plus evidence at the core layer.
78
+
79
+ Capability introspection reports whether these surfaces are enabled
80
+ (`hostAttestationAvailable: false` by default) but never exposes grant
81
+ content.
49
82
 
50
83
  Raw recovery artifacts, transaction journals, lock files, and unbounded event
51
84
  ledgers are intentionally not exposed.
@@ -72,7 +105,7 @@ forgeloop-mcp-http --project /repo --mode safe # 127.0.0.1:3333
72
105
 
73
106
  | Component | Current contract |
74
107
  | --- | --- |
75
- | ForgeLoop core package | `1.5.x` repository generation |
108
+ | ForgeLoop core package | `>=1.5.0 <2` dependency range; current repository generation `1.6.x` |
76
109
  | ForgeLoop protocol | `1` |
77
110
  | Integration API | `1` |
78
111
  | MCP package | `0.1.x` initial package |
package/docs/RECIPES.md CHANGED
@@ -21,6 +21,7 @@ Concise, copy-paste friendly recipes for common ForgeLoop tasks.
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
23
  15. [Release and Reacquire Claims for an Abandoned Task](#recipe-15--release-and-reacquire-claims-for-an-abandoned-task)
24
+ 16. [Execute a Durable External Action Safely](#recipe-16--execute-a-durable-external-action-safely)
24
25
 
25
26
  ---
26
27
 
@@ -346,6 +347,72 @@ artifact against the complete ledger history. If `next` returns
346
347
  `RESOLVE_RECOVERY_INCONSISTENCY`, run `validate-protocol`; do not create, edit,
347
348
  or delete `recovery.json` manually.
348
349
 
350
+ ---
351
+
352
+ ### Recipe 16 — Execute a Durable External Action Safely
353
+
354
+ Record the intended external effect before execution, satisfy the capability
355
+ policy and fingerprint-bound approval, and execute with an exact argument list:
356
+
357
+ ```bash
358
+ forgeloop action-propose --task release --id action-publish --capability external.publish --effect-class EXTERNAL_PUBLICATION --target registry/release --operation "publish release" --idempotency-key release:publish:v1 --required-for-completion
359
+ forgeloop approval-request --task release --approval approval-publish --action action-publish --reason "reviewed release"
360
+ forgeloop approval-resolve --task release --approval approval-publish --decision APPROVED --authority CALLER_ACKNOWLEDGED
361
+ forgeloop run-action --task release --action action-publish --capability external.publish --effect-class EXTERNAL_PUBLICATION --target registry/release --idempotency-key release:publish:v1 --required-for-completion -- npm publish
362
+ # If the external outcome cannot be proven after start, do not retry:
363
+ forgeloop action-reconcile --task release --action action-publish --outcome UNKNOWN
364
+ ```
365
+
366
+ Provenance and authority truths for this recipe:
367
+
368
+ - `CALLER_ACKNOWLEDGED` approval resolution records an acknowledgement; if the
369
+ capability policy requires `REQUIRE_APPROVAL`, only a fresh `HOST_ATTESTED`
370
+ approval resolved through a trusted embedding-host boundary authorizes the
371
+ action. The standalone CLI can never mint it.
372
+ - `forgeloop next` evaluates the current capability policy before inspecting
373
+ approval state, but only after validating that the capability artifact is
374
+ bound to the active policy lock and task snapshot. Historical or stale
375
+ approvals never override `ALLOW`, `DENY`, or `REQUIRE_AUTHORITY`; only a
376
+ currently applicable `REQUIRE_APPROVAL` decision can make a pending approval
377
+ the active resolver target.
378
+ - `commands` in next-action guidance are safe standalone CLI commands. A
379
+ host-only authorization is returned with `commands: []` and structured
380
+ `hostActionRequired`/`authorityRequired` data so an embedding host can invoke
381
+ `action-authorize` while preserving its trusted authority context.
382
+ - `approval-request` is policy-aware: it creates a pending approval only for
383
+ `REQUIRE_APPROVAL`; `ALLOW`, `DENY`, and `REQUIRE_AUTHORITY` reject the request
384
+ without creating an approval artifact. A changed `capabilities.json` alone is
385
+ not a valid policy update: restore the recorded epoch or refresh the lock and
386
+ task snapshot through the supported policy lifecycle first.
387
+ - `COMMIT_UNKNOWN` is an explicit reconciliation boundary, not a failed retry.
388
+ Recording `UNKNOWN` keeps the action ambiguous. Settling `COMMITTED` or
389
+ `NOT_COMMITTED` requires trusted host attestation plus evidence through a
390
+ trusted integration boundary. A trusted `NOT_COMMITTED` returns the action
391
+ to `PROPOSED` so authorization is re-evaluated before any retry.
392
+
393
+ After commit ambiguity is settled as `COMMITTED`, verify the independent
394
+ postcondition before completion:
395
+
396
+ ```bash
397
+ forgeloop run-check --task release --id check-release-live --requirement publication -- npm view your-package-name@1.0.0 version
398
+ forgeloop action-verify --task release --action action-publish --evidence <execution-ref>
399
+ ```
400
+
401
+ `COMMITTED != VERIFIED`: exit code 0 from the action command proves local
402
+ completion only. Verification requires canonical evidence from an independent
403
+ check execution.
404
+
405
+ Inspect the observed trajectory without inventing usage data:
406
+
407
+ ```bash
408
+ forgeloop metrics --task release --json
409
+ forgeloop eval --task release --scenario scenarios/release.json --json
410
+ ```
411
+
412
+ The efficiency comparison is present only when the scenario declares a
413
+ positive `reference.comparableSteps`; absent host token/cost/model data stays
414
+ unknown.
415
+
349
416
  ## Run ForgeLoop through MCP (safe mode)
350
417
 
351
418
  Start the local MCP adapter and inspect what it exposes:
@@ -0,0 +1,121 @@
1
+ # ForgeLoop 1.6.1 release checklist
2
+
3
+ Preparation checklist for the `@cassiomc1/forgeloop` 1.6.1 release. It does not
4
+ authorize publication. Historical checklists:
5
+ [`RELEASE_CHECKLIST_1_5_MCP.md`](./RELEASE_CHECKLIST_1_5_MCP.md),
6
+ [`RELEASE_CHECKLIST_1_4.md`](./RELEASE_CHECKLIST_1_4.md).
7
+
8
+ ## Version and contract identity
9
+
10
+ - [ ] Core package version is `1.6.1` in `package.json` and the lockfile root.
11
+ - [ ] ForgeLoop protocol version is `1`.
12
+ - [ ] Integration API version is `1`
13
+ (`FORGELOOP_INTEGRATION_API_VERSION`).
14
+ - [ ] Candidate version is absent from npm and the `v1.6.1` tag is absent from
15
+ origin before release preparation starts.
16
+ - [ ] `CHANGELOG.md` has a versioned `1.6.1` section with the actual release
17
+ date and an empty `Unreleased` section above it.
18
+
19
+ ## Verification execution adapter contract (new in 1.6.x line)
20
+
21
+ - [ ] `src/core/verification-execution.js` defines the adapter boundary,
22
+ `VERIFICATION_ISOLATION_MODES`, and the two public error codes.
23
+ - [ ] `runtimeContext.verificationExecutionAdapter` and
24
+ `runtimeContext.verificationExecutionPolicy` are validated at context
25
+ creation and never accepted as CLI flags or command input.
26
+ - [ ] `createForgeLoopContext`, the isolation modes, and both error codes are
27
+ exported from `@cassiomc1/forgeloop/integration`.
28
+ - [ ] `protocol-info --json` advertises
29
+ `features.verificationExecutionIsolation` (version 1, adapter-backed,
30
+ modes enumerated, `protocolProjectRootSeparateFromExecutionCwd: true`).
31
+
32
+ ## Isolation metadata invariants
33
+
34
+ - [ ] `NATIVE_PROJECT` requires `isolated: false` and
35
+ `liveProjectWritable: true`; it is never described as isolated.
36
+ - [ ] `PROJECT_ISOLATED` and `SYSTEM_ISOLATED` require `isolated: true` and
37
+ `liveProjectWritable: false`; `SYSTEM_ISOLATED` additionally requires
38
+ `networkPolicy: DENIED`.
39
+ - [ ] Contradictory isolation metadata is rejected with
40
+ `E_VERIFICATION_EXECUTION_INVALID` before evidence persistence.
41
+ - [ ] Isolated execution must use a cwd separate from the protocol project
42
+ root; violation fails closed with `E_VERIFICATION_EXECUTION_INVALID`.
43
+ - [ ] Unsatisfiable isolation policy fails closed with
44
+ `E_VERIFICATION_ISOLATION_UNAVAILABLE` and never falls back to the live
45
+ project.
46
+ - [ ] Execution records persist `executionKind`, `protocolProjectRoot`,
47
+ `executionIsolation`, and the `isolation` object per
48
+ `schemas/execution.schema.json`.
49
+
50
+ ## Durable-action invariants
51
+
52
+ - [ ] Trusted `COMMITTED` reconciliation replays exactly once; reconciled
53
+ mirrors are corroborations, never second transitions.
54
+ - [ ] Action verification requires an independent passed execution covering the
55
+ action's exact immutable requirement.
56
+ - [ ] `REQUIRE_APPROVAL` authorizations bind approval fingerprints validated by
57
+ readiness and audit.
58
+ - [ ] Public provenance metadata matches behavior
59
+ (`CALLER_REPORTED` / `EXTERNAL_OBSERVED`).
60
+
61
+ ## PoC evidence validation
62
+
63
+ - [ ] `npm run poc:evidence:verify` passes against committed evidence bundles.
64
+ - [ ] `npm run poc:evidence:test` passes.
65
+ - [ ] PoC docs (`poc/README.md`,
66
+ `poc/FORGELOOP_REAL_EXECUTION_POC.md`) match committed evidence paths,
67
+ manifests, and hashes.
68
+
69
+ ## Documentation freshness
70
+
71
+ - [ ] `npm run docs:generate` leaves no diff (generated regions current).
72
+ - [ ] `npm run docs:generated:check` passes.
73
+ - [ ] `npm run docs:conformance` passes.
74
+ - [ ] `npm run docs:diagrams:check` passes (typed Archify source unchanged or
75
+ regenerated with receipt).
76
+ - [ ] `npm run docs:check` passes.
77
+ - [ ] Normative docs represent the post-`v1.6.0` verification execution
78
+ boundary without making a harness-specific backend normative.
79
+ - [ ] `DOCS_INDEX.md` points release maintainers to this checklist as current.
80
+
81
+ ## Local validation gates
82
+
83
+ - [ ] `npm run dependency:policy` passes (runtime dependencies remain zero).
84
+ - [ ] `npm run lint` passes.
85
+ - [ ] `npm test` passes.
86
+ - [ ] `npm run coverage` passes.
87
+ - [ ] `npm run pack:check` passes.
88
+ - [ ] Python validators pass: `python3 -m unittest discover -s tests`,
89
+ `validate_markdown.py` (+ self-test), `validate_loop_system.py`
90
+ (+ self-test).
91
+ - [ ] `python3 scripts/scan_secrets.py` passes.
92
+ - [ ] `npm pack` tarball inspected: correct name/version, intended docs, no
93
+ secrets, no `.git`, no `.forgeloop` execution state.
94
+
95
+ ## Protected-branch and PR gates
96
+
97
+ - [ ] Changes reach `main` only through a reviewed PR; `main-protection`
98
+ ruleset never bypassed.
99
+ - [ ] Required checks green: `audit`, `CodeQL`, `Verify generated Archify
100
+ diagram`, `validate (22)`, `tarball smoke (ubuntu-latest)`,
101
+ `dependency-review`; every other relevant check green.
102
+ - [ ] No unresolved review threads; PR merged without admin bypass.
103
+
104
+ ## Publication boundary
105
+
106
+ - [ ] Post-merge `main` workflows green before tagging.
107
+ - [ ] npm candidate version and tag re-checked for collision immediately before
108
+ tagging.
109
+ - [ ] Annotated tag `v1.6.1` created on the exact validated `main` commit and
110
+ pushed once; never moved after publication.
111
+ - [ ] `npm-publish.yml` retains `contents: read` + `id-token: write`; no
112
+ `NPM_TOKEN`/`NODE_AUTH_TOKEN` is added anywhere.
113
+ - [ ] `Publish npm package` workflow succeeds (trusted OIDC publishing).
114
+ - [ ] `Release notes` workflow succeeds; GitHub Release is not draft or
115
+ prerelease and carries the checksum asset.
116
+ - [ ] npm registry reports the exact version with `gitHead` equal to the
117
+ release commit.
118
+ - [ ] `npm run release:identity` returns `RELEASE_IDENTITY_VALID` with every
119
+ individual check `ok`.
120
+ - [ ] Optional clean-install smoke test installs `@cassiomc1/forgeloop@1.6.1`
121
+ and `forgeloop --version` reports `1.6.1`.