@cassiomc1/forgeloop 0.1.10 → 0.1.12

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 (69) hide show
  1. package/.cursor/rules/project-loop.mdc +16 -18
  2. package/.github/copilot-instructions.md +16 -19
  3. package/AGENTS.md +18 -24
  4. package/AGENT_COMPATIBILITY.md +4 -211
  5. package/CLAUDE.md +16 -18
  6. package/LOOP_ENGINEERING.md +73 -0
  7. package/LOOP_SYSTEM_DESIGN.md +9 -5
  8. package/ORCHESTRATOR_INTEGRATION.md +4 -0
  9. package/PROTOCOL_INTEGRATION.md +171 -0
  10. package/QUALITY_SCORECARD.md +1 -1
  11. package/README.md +123 -103
  12. package/TERMINOLOGY.md +2 -0
  13. package/THREAT_MODEL.md +4 -0
  14. package/package.json +5 -4
  15. package/schemas/current-contract.schema.json +48 -2
  16. package/schemas/evidence.schema.json +1 -0
  17. package/schemas/execution-receipt.schema.json +2 -0
  18. package/schemas/work-state.schema.json +44 -1
  19. package/src/cli.js +48 -4
  20. package/src/commands/record-terminal-result.js +18 -0
  21. package/src/commands/validate-protocol.js +14 -2
  22. package/src/core/checks.js +20 -0
  23. package/src/core/completion-artifacts.js +266 -11
  24. package/src/core/completion-recovery.js +15 -0
  25. package/src/core/completion-relationships.js +23 -9
  26. package/src/core/completion.js +130 -2
  27. package/src/core/contract.js +82 -4
  28. package/src/core/coverage.js +17 -12
  29. package/src/core/discovery-surfaces.js +22 -0
  30. package/src/core/events.js +183 -2
  31. package/src/core/evidence-readiness.js +333 -0
  32. package/src/core/evidence.js +22 -4
  33. package/src/core/execution-prerequisites.js +6 -1
  34. package/src/core/inspect.js +23 -12
  35. package/src/core/native-adapters.js +30 -2
  36. package/src/core/next-action.js +103 -27
  37. package/src/core/phase.js +68 -5
  38. package/src/core/protocol.js +28 -1
  39. package/src/core/receipt.js +5 -0
  40. package/src/core/schema-validation.js +28 -6
  41. package/src/core/templates.js +1 -0
  42. package/src/core/work-state.js +27 -0
  43. package/conformance/README.md +0 -148
  44. package/conformance/backend-auth/EXPECTED_ROUTE.json +0 -7
  45. package/conformance/backend-auth/REQUEST.md +0 -4
  46. package/conformance/backend-auth/REQUIRED_EVIDENCE.json +0 -3
  47. package/conformance/backend-auth/REQUIRED_GATES.json +0 -3
  48. package/conformance/blind-premium-website/EXPECTED_ROUTE.json +0 -7
  49. package/conformance/blind-premium-website/REQUEST.md +0 -6
  50. package/conformance/blind-premium-website/REQUIRED_EVIDENCE.json +0 -14
  51. package/conformance/blind-premium-website/REQUIRED_GATES.json +0 -3
  52. package/conformance/complete-website/EXPECTED_ROUTE.json +0 -7
  53. package/conformance/complete-website/REQUEST.md +0 -6
  54. package/conformance/complete-website/REQUIRED_EVIDENCE.json +0 -3
  55. package/conformance/complete-website/REQUIRED_GATES.json +0 -3
  56. package/conformance/docs-only/EXPECTED_ROUTE.json +0 -7
  57. package/conformance/docs-only/REQUEST.md +0 -4
  58. package/conformance/docs-only/REQUIRED_EVIDENCE.json +0 -3
  59. package/conformance/docs-only/REQUIRED_GATES.json +0 -3
  60. package/conformance/runs/2026-08-11-codex-first-live.md +0 -98
  61. package/conformance/runs/2026-08-11-codex-second-live.md +0 -87
  62. package/conformance/runs/2026-08-13-codex-fifth-live.md +0 -386
  63. package/conformance/runs/2026-08-13-codex-fourth-live.md +0 -309
  64. package/conformance/runs/2026-08-13-codex-sixth-live.md +0 -412
  65. package/conformance/simple-bug/EXPECTED_ROUTE.json +0 -7
  66. package/conformance/simple-bug/REQUEST.md +0 -4
  67. package/conformance/simple-bug/REQUIRED_EVIDENCE.json +0 -3
  68. package/conformance/simple-bug/REQUIRED_GATES.json +0 -3
  69. package/src/core/agent-support.js +0 -89
@@ -0,0 +1,171 @@
1
+ # Protocol Integration
2
+
3
+ ForgeLoop is a portable, project-scoped engineering protocol. It is vendor-neutral
4
+ and is not tied to a specific model, provider, agent product, IDE, or orchestration runtime.
5
+
6
+ The protocol becomes applicable because a project activates ForgeLoop, not because
7
+ an execution environment appears in a compatibility list.
8
+
9
+ <!-- FORGELOOP_PROJECT_PROTOCOL=REQUIRED -->
10
+
11
+ ## Universal applicability
12
+
13
+ If the active execution environment discovers a ForgeLoop project adapter,
14
+ the canonical ForgeLoop protocol applies to work performed in that project.
15
+
16
+ ```text
17
+ PROJECT HAS FORGELOOP ADAPTER
18
+ +
19
+ RUNTIME DISCOVERS IT
20
+ +
21
+ REQUIRED LOCAL CAPABILITIES ARE AVAILABLE
22
+ =
23
+ FORGELOOP APPLIES
24
+ ```
25
+
26
+ An execution environment that has not been previously tested is
27
+ `CONFORMANCE_UNVERIFIED`, not unsupported and not exempt from the protocol.
28
+
29
+ Capabilities determine how much of ForgeLoop can be executed. Brand names do not.
30
+
31
+ ### Interpretation rules
32
+
33
+ ```text
34
+ INVALID:
35
+ "I am not a named ForgeLoop integration, therefore ForgeLoop does not apply."
36
+ "I will follow ForgeLoop only in spirit because my harness is not documented."
37
+
38
+ VALID:
39
+ "I discovered the ForgeLoop project adapter. ForgeLoop applies.
40
+ My current runtime may have unverified or limited capabilities, which I will evaluate."
41
+ ```
42
+
43
+ ## Integration levels
44
+
45
+ Execution environments integrate with ForgeLoop by capability:
46
+
47
+ ### Level 1 — `INSTRUCTION_DISCOVERED`
48
+
49
+ The environment has automatically or explicitly loaded a project-local ForgeLoop
50
+ adapter (such as `AGENTS.md`, `CLAUDE.md`, `.cursor/rules/project-loop.mdc`,
51
+ `.github/copilot-instructions.md`, or manual bootstrap).
52
+
53
+ ### Level 2 — `PROTOCOL_CAPABLE`
54
+
55
+ The environment possesses the necessary local capabilities:
56
+
57
+ - Read project files.
58
+ - Write project-local files.
59
+ - Execute local commands.
60
+ - Invoke the project-local ForgeLoop CLI.
61
+ - Preserve project state across lifecycle transitions.
62
+
63
+ When these are available, the environment executes the complete ForgeLoop lifecycle.
64
+
65
+ ### Level 3 — `PROTOCOL_LIMITED`
66
+
67
+ The environment discovered ForgeLoop but lacks one or more required local
68
+ capabilities (for example, no command execution or no write access).
69
+
70
+ ForgeLoop **still applies**, but the runtime must:
71
+
72
+ - Fail closed for the affected lifecycle dimension.
73
+ - Report the missing capability explicitly.
74
+ - Never simulate missing capabilities.
75
+ - Never manually fabricate protocol-owned state.
76
+ - Never claim validator-backed completion.
77
+
78
+ ### Level 4 — `CONFORMANCE_VERIFIED`
79
+
80
+ A specific runtime, model, version, environment, and configuration has completed a
81
+ recorded blind conformance scenario under standard protocol verification.
82
+
83
+ Conformance verification is **evidence of tested interoperability**; it is
84
+ never an eligibility gate or allowlist for protocol adoption.
85
+
86
+ ## Discovery surfaces
87
+
88
+ ForgeLoop provides project-local shims for common instruction-discovery mechanisms:
89
+
90
+ - `AGENTS.md`: Standard discovery surface recognized by multiple AI coding tools and developers.
91
+ - `CLAUDE.md`: Discovery surface for Claude Code.
92
+ - `.cursor/rules/project-loop.mdc`: MDC rule format for Cursor.
93
+ - `.github/copilot-instructions.md`: Repository instructions for GitHub Copilot.
94
+
95
+ These files are discovery aliases. They all point to the same canonical project
96
+ protocol in `.forgeloop/kit/LOOP_ENGINEERING.md` and `.forgeloop/kit/PROTOCOL_INTEGRATION.md`.
97
+ They do not define separate ForgeLoop implementations.
98
+
99
+ ### Generic and manual bootstrap
100
+
101
+ For environments, internal enterprise agents, custom harnesses, or developer-operated
102
+ workflows that do not automatically discover one of the default files:
103
+
104
+ 1. Read `.forgeloop/kit/LOOP_ENGINEERING.md`.
105
+ 2. Read `.forgeloop/kit/PROTOCOL_INTEGRATION.md`.
106
+ 3. Resolve the project-local ForgeLoop CLI.
107
+ 4. Execute the contract, route, preflight, and lifecycle workflow.
108
+
109
+ A developer or custom automation can execute ForgeLoop identically to an AI agent.
110
+
111
+ ## CLI resolution policy
112
+
113
+ Lifecycle-owned protocol state must be managed through the project-local ForgeLoop CLI:
114
+
115
+ 1. Project-local `node_modules/.bin/forgeloop`
116
+ 2. Package manager local execution (e.g. `npx --no-install forgeloop` or equivalent)
117
+ 3. Direct package CLI entry point (`node src/cli.js`)
118
+ 4. Verified global `forgeloop` matching the installed package version
119
+
120
+ Do not automatically download a different version during a reproducible run.
121
+ The resolved CLI must match the installed project's package identity.
122
+
123
+ ## Protocol-owned state and no-simulation policy
124
+
125
+ The following protocol artifacts are strictly owned by ForgeLoop:
126
+
127
+ - `.forgeloop/preflight.json`
128
+ - `.forgeloop/work-state.json`
129
+ - `.forgeloop/events.ndjson`
130
+ - `.forgeloop/execution-receipt.json`
131
+ - Canonical check, evidence, and terminal-result state
132
+
133
+ If the required CLI or API capability cannot be resolved:
134
+
135
+ - **Do not** fabricate lifecycle state manually.
136
+ - **Do not** synthesize event history.
137
+ - **Do not** manually assign `COMPLETE`.
138
+ - **Do not** construct a fake execution receipt.
139
+ - **Do not** rewrite `events.ndjson` to simulate chronology.
140
+
141
+ Report the corresponding ForgeLoop dimension as `NOT_VERIFIED` / `E_FORGELOOP_CLI_UNAVAILABLE`.
142
+
143
+ ## Optional capability extensions
144
+
145
+ The installed loop directs the active actor to inspect native model and harness
146
+ capabilities. When a task requires a missing capability (e.g. multimodal vision),
147
+ the actor may install the smallest task-scoped capability (such as `Qwen-MM-Plugins`)
148
+ through native mechanisms or upstream installers, then verify it before use.
149
+
150
+ API credentials, system packages, and unrelated environment changes remain
151
+ separately gated.
152
+
153
+ ## Instruction precedence
154
+
155
+ When multiple instruction layers exist, follow standard precedence:
156
+
157
+ 1. Platform, sandbox, and system security rules.
158
+ 2. Direct user instructions in the latest prompt.
159
+ 3. Target project-specific rules and instructions.
160
+ 4. ForgeLoop project protocol (`LOOP_ENGINEERING.md`, `PROTOCOL_INTEGRATION.md`).
161
+ 5. Activated domain guides (`GUIDE_ROUTER.md` → `ENG/*.md`).
162
+ 6. Technical defaults and safe assumptions.
163
+
164
+ The absence of an environment's name from documentation is never a precedence conflict.
165
+
166
+ ## External workflow interaction
167
+
168
+ External planning, interview, or review workflows (such as `/grill-me`, `/plan`, or IDE
169
+ review gates) may assist in clarifying requirements, but they must not silently
170
+ redefine ForgeLoop `NON_BLOCKING` decisions as `BLOCKING` in autonomous mode.
171
+ Consult `LOOP_ENGINEERING.md#external-workflow-interaction` for the complete boundary.
@@ -80,7 +80,7 @@ are both present:
80
80
  | Hidden kit layout | `src/core/target-layout.js`, safe init/update migration, manifest layout version, native shims, and profile resolver | `tests/hidden-layout.test.js`, package and compatibility tests |
81
81
  | Contextual frontend taste | `ENG/taste-frontend-eng.md`, router metadata, attribution, and design/accessibility precedence | `tests/taste-guide.test.js`, route fixtures |
82
82
  | Pre-contract autonomy — structural | `LOOP_ENGINEERING.md`, `src/core/decision-classification.js`, `src/core/workflow-compatibility.js`, `CLAUDE.md`, `AGENTS.md`, `.github/copilot-instructions.md`, `.cursor/rules/project-loop.mdc` | `tests/decision-classification.test.js`, `tests/workflow-compatibility.test.js`, `tests/autonomy-policy.test.js`, `tests/preflight.test.js` |
83
- | External workflow compatibility — structural | `LOOP_ENGINEERING.md`, `AGENT_COMPATIBILITY.md`, `src/core/workflow-compatibility.js`, and sixth-run harness metadata rule | `tests/workflow-compatibility.test.js`, `conformance/README.md` |
83
+ | External workflow compatibility — structural | `LOOP_ENGINEERING.md`, `PROTOCOL_INTEGRATION.md`, `src/core/workflow-compatibility.js`, and sixth-run harness metadata rule | `tests/workflow-compatibility.test.js`, `conformance/README.md` |
84
84
  | Instruction-conflict handling — structural | Canonical source-attribution and `WORKFLOW_CONFLICT` policy in `LOOP_ENGINEERING.md` plus adapter references | `tests/autonomy-policy.test.js`, `tests/workflow-compatibility.test.js` |
85
85
  | Autonomous-mode precedence — structural | Autonomous/interactive mode contract and harness exclusion metadata | `tests/workflow-compatibility.test.js`, `tests/conformance-scenarios.test.js` |
86
86
  | Pre-contract autonomy — cross-agent live robustness | Prior third blind-run result, `conformance/runs/2026-08-13-codex-fourth-live.md`, preserved fifth-run report `conformance/runs/2026-08-13-codex-fifth-live.md`, and the exact blind request | `tests/conformance-scenarios.test.js`; sixth run is not started until mandatory approval is excluded |
package/README.md CHANGED
@@ -8,13 +8,14 @@ accessibility, design, and web games across web, mobile, and desktop projects.
8
8
 
9
9
  The files are Markdown and can be used as references, as a foundation for
10
10
  `AGENTS.md`, `CLAUDE.md`, `.cursor/rules`, and
11
- `.github/copilot-instructions.md`. The supported-agent contract is documented
12
- in [`AGENT_COMPATIBILITY.md`](./AGENT_COMPATIBILITY.md). Adopt only the guides
11
+ `.github/copilot-instructions.md`. The integration contract and capability levels are documented
12
+ in [`PROTOCOL_INTEGRATION.md`](./PROTOCOL_INTEGRATION.md). Adopt only the guides
13
13
  relevant to the target project.
14
14
 
15
- ForgeLoop is the portable, evidence-first loop that connects deterministic
16
- routing, checkpointed state, observable evidence, conformance, and delegation
17
- for compatible agent harnesses.
15
+ ForgeLoop is a portable, verifiable engineering protocol for AI coding environments
16
+ and developer workflows. It turns intent into contract-driven execution with
17
+ deterministic routing, resumable state, evidence-backed verification, recovery, and
18
+ validator-backed completion.
18
19
 
19
20
  The npm package also ships the local `forgeloop` CLI. In a target project it
20
21
  installs canonical documents under `.forgeloop/kit/`, keeps only small native
@@ -54,83 +55,13 @@ target).
54
55
  The canonical system map, including the routing/state/evidence architecture, is
55
56
  in [`LOOP_SYSTEM_DESIGN.md`](./LOOP_SYSTEM_DESIGN.md).
56
57
 
57
- ```mermaid
58
- flowchart TB
59
- root["FORGELOOP"]
60
-
61
- root --> entry["native adapters<br/>+ .forgeloop/kit/"]
62
- entry --> migration{"target<br/>layout"}
63
- migration -->|legacy v1| plan["validate paths<br/>+ build plan"]
64
- plan --> hidden["write hidden<br/>kit"]
65
- hidden --> verified["verify hidden<br/>bytes"]
66
- verified --> authority["atomic manifest<br/>authority switch"]
67
- authority --> cleanup["hash-checked<br/>legacy cleanup"]
68
- cleanup --> recovered["healthy or<br/>recoverable"]
69
- hidden -. interruption .-> incomplete["doctor: E_MIGRATION_INCOMPLETE"]
70
- verified -. interruption .-> incomplete
71
- authority -. interruption .-> incomplete
72
- cleanup -. interruption .-> incomplete
73
- migration -->|layout v2| retry["update + retry<br/>owned cleanup"]
74
- incomplete --> retry
75
- entry --> discovery["discovery +<br/>project profile"]
76
- discovery --> contract["current<br/>contract"]
77
- contract --> routing["deterministic<br/>route"]
78
-
79
- contract --> preflight["preflight"]
80
- routing --> preflight
81
- gates["required<br/>gates"] --> preflight
82
- preflight -->|READY| ready["PREFLIGHT_READY"]
83
- preflight -->|BLOCKED| blocker["repair /<br/>blocker"]
84
-
85
- ready --> state["work-state<br/>checkpoint"]
86
- ready --> events["append-only<br/>event ledger"]
87
- state --> lifecycle["plan → execute<br/>→ verify → review"]
88
- lifecycle --> prepare["prepare<br/>completion receipt"]
89
- prepare --> checks["checks + structured<br/>evidence"]
90
- checks --> receipt["updated execution<br/>receipt"]
91
- checks --> audit["audit +<br/>complete"]
92
- events --> audit
93
-
94
- contract --> freshness["freshness<br/>fingerprints"]
95
- routing --> freshness
96
- state --> freshness
97
- checks --> freshness
98
- routing --> conformance["validate-protocol<br/>/ conformance"]
99
- state --> conformance
100
- receipt --> conformance
101
- freshness --> conformance
102
- conformance --> verdict["VALID / INCOMPLETE /<br/>STALE / INCONSISTENT / INVALID"]
103
- audit --> verdict
104
-
105
- routing --> delegation["optional bundle /<br/>delegation"]
106
- checks --> delegation
107
- delegation --> handoff["handoff to<br/>compatible harness"]
108
- verdict --> handoff
109
- blocker --> handoff
110
-
111
- classDef root fill:#08090C,stroke:#6E6AF5,stroke-width:3px,color:#EDEEF0;
112
- classDef entry fill:#101218,stroke:#3EDBB8,stroke-width:2px,color:#EDEEF0;
113
- classDef migration fill:#0F766E,stroke:#5EEAD4,stroke-width:2px,color:#FFFFFF;
114
- classDef routing fill:#4F46E5,stroke:#A5B4FC,stroke-width:2px,color:#FFFFFF;
115
- classDef state fill:#373A46,stroke:#A1A1AA,stroke-width:2px,color:#FFFFFF;
116
- classDef evidence fill:#3EDBB8,stroke:#99F6E4,stroke-width:2px,color:#08090C;
117
- classDef fact fill:#181B24,stroke:#6E6AF5,stroke-width:1px,color:#EDEEF0;
118
- classDef gate fill:#3730A3,stroke:#A5B4FC,stroke-width:2px,color:#FFFFFF;
119
- classDef result fill:#C9A876,stroke:#F5D9A6,stroke-width:2px,color:#08090C;
120
- classDef harness fill:#101218,stroke:#3EDBB8,stroke-width:2px,color:#EDEEF0;
121
-
122
- class root root;
123
- class entry,discovery,delegation entry;
124
- class migration,plan,hidden,verified,authority,cleanup,recovered,retry,incomplete migration;
125
- class routing,preflight,ready routing;
126
- class state,events,lifecycle state;
127
- class checks,receipt,audit evidence;
128
- class contract,freshness,conformance fact;
129
- class gates,blocker gate;
130
- class verdict result;
131
- class handoff harness;
132
- linkStyle default stroke:#8A8F98,stroke-width:1.5px;
133
- ```
58
+ <p align="center">
59
+ <img
60
+ src="./docs/assets/forgeloop-flow.svg"
61
+ alt="ForgeLoop evidence-first engineering flow"
62
+ width="100%"
63
+ />
64
+ </p>
134
65
 
135
66
  Equivalent reading for text-only environments: adapters load the canonical kit;
136
67
  an older target follows validate paths → write hidden files → verify their bytes
@@ -141,22 +72,29 @@ cleanup is diagnosed by `doctor` as `E_MIGRATION_INCOMPLETE` and retried by
141
72
  discovery creates the contract and deterministic route; contract, route, and
142
73
  required gates must produce `PREFLIGHT_READY` before the resumable state and
143
74
  append-only event ledger authorize the lifecycle. Verification produces
144
- structured evidence and a receipt. `audit`/`complete` and `validate-protocol`
145
- then classify the result as `VALID`, `INCOMPLETE`, `STALE`, `INCONSISTENT`, or
75
+ structured evidence evaluated by one canonical readiness model. Failed checks
76
+ enter diagnosis and correction. An evidence-only completion rejection records
77
+ `COMPLETION_REJECTED` and opens a new numbered verification cycle without
78
+ editing protocol JSON manually. `audit`, `complete`, and `validate-protocol`
79
+ classify the result as `VALID`, `INCOMPLETE`, `STALE`, `INCONSISTENT`, or
146
80
  `INVALID`. Optional delegation creates a handoff; it is not an agent runtime.
147
81
 
148
82
  The operational request loop remains:
149
83
 
150
84
  ```text
151
85
  Request → discovery → profile → routing → plan → execution
152
- → verification → correction when needed final evidence
86
+ → verification → reviewcompletion validation
87
+ ↑ │
88
+ └ evidence-only rejection / next cycle
153
89
  ```
154
90
 
155
- Thin native adapters support Codex, Claude Code, Cursor, and GitHub Copilot.
156
- Antigravity, OpenCode, Hermes, Pi, Command Code, and Freebuff use the shared
157
- `AGENTS.md` entry point. All ten agents delegate to the same canonical
158
- documents; see [`AGENT_COMPATIBILITY.md`](./AGENT_COMPATIBILITY.md) for the
159
- official sources and precedence notes.
91
+ ForgeLoop is project-scoped, capability-based, and vendor-neutral. Thin
92
+ native adapters support common discovery surfaces including Codex, Claude Code,
93
+ Cursor, and GitHub Copilot, while Antigravity, OpenCode, Hermes, Pi, Command Code,
94
+ Freebuff, custom agents, and developer workflows discover the shared `AGENTS.md`
95
+ entry point or manual bootstrap. All environments delegate to the same canonical
96
+ protocol; see [`PROTOCOL_INTEGRATION.md`](./PROTOCOL_INTEGRATION.md) for
97
+ capability levels, degradation rules, and precedence notes.
160
98
 
161
99
  ### Migration recovery and release freeze
162
100
 
@@ -179,15 +117,93 @@ The regression suite injects failures at these boundaries and verifies that
179
117
  owned cleanup. The frozen published installation under
180
118
  [`tests/fixtures/legacy-0.1.6/`](./tests/fixtures/legacy-0.1.6/) is derived
181
119
  from the real npm tarball, includes provenance and digests, and is copied into
182
- tests locally; CI does not download npm packages.
120
+ The current published release is `@cassiomc1/forgeloop@0.1.11`.
121
+ Earlier `0.1.8`, `0.1.9`, and `0.1.10` references are historical; never move
122
+ their tags or `v0.1.10`. Version `0.1.11` adds canonical evidence readiness,
123
+ requirement-specific terminal result recording, legal repeated verification
124
+ cycles, future-result and compound-evidence safeguards, and lifecycle-ledger
125
+ divergence detection.
126
+
127
+ ## How to prompt ForgeLoop
128
+
129
+ You do not need a perfect prompt to use ForgeLoop.
130
+
131
+ Describe the outcome you want. ForgeLoop is designed to structure the execution around that request: resolve safe ambiguities, create an execution contract, route the relevant guides, satisfy gates, run preflight checks, implement, verify, correct, and repeat until the work is complete.
132
+
133
+ > **Don't engineer the perfect prompt. Define the outcome and let ForgeLoop engineer the feedback loop.**
134
+
135
+ ### Minimal
136
+
137
+ A short request should be enough for ordinary work:
138
+
139
+ ```text
140
+ Create a premium website for a law firm.
141
+ ```
142
+
143
+ ### Recommended
144
+
145
+ Add the important outcome and product constraints:
146
+
147
+ ```text
148
+ Create a premium website for a law firm.
149
+
150
+ It should feel modern, sophisticated and trustworthy, work well on mobile and desktop, and include a contact form.
151
+ ```
152
+
153
+ ### Structured
154
+
155
+ For larger or more constrained tasks, you can optionally use a lightweight task brief:
156
+
157
+ ```text
158
+ Build: Premium law firm website
159
+
160
+ Goal:
161
+ Create a modern, sophisticated and trustworthy experience.
162
+
163
+ Requirements:
164
+ - Responsive on mobile and desktop
165
+ - Accessible navigation
166
+ - Contact form
167
+ - Premium visual design
168
+ - Good performance
169
+
170
+ Done when:
171
+ - The implementation is complete
172
+ - Required verification passes
173
+ - Mobile and desktop layouts are verified
174
+ - The contact form works
175
+ ```
176
+
177
+ The structured format is optional. It gives ForgeLoop more explicit constraints and success criteria, but it should not be necessary for ordinary tasks.
178
+
179
+ ### What not to put in the prompt
180
+
181
+ Avoid recreating the ForgeLoop process inside the prompt:
182
+
183
+ ```text
184
+ First analyze the task.
185
+ Then create a plan.
186
+ Then inspect the files.
187
+ Then choose the guides.
188
+ Then implement.
189
+ Then run tests.
190
+ If tests fail, fix them.
191
+ Then review everything.
192
+ Then produce a report.
193
+ ```
194
+
195
+ That workflow belongs to ForgeLoop.
196
+
197
+ Your prompt should primarily describe:
198
+
199
+ ```text
200
+ what you want
201
+ important requirements
202
+ real constraints
203
+ observable success conditions
204
+ ```
183
205
 
184
- The current published baseline for a reproducible blind run is
185
- `@cassiomc1/forgeloop@0.1.9`. The supplied hardening brief's `0.1.8` reference
186
- is historical; never move `v0.1.8` or `v0.1.9`, and use the read-only release
187
- identity verifier before a live run. The repository candidate is `0.1.10`, but
188
- it is not published: its completion-validation and cleanup TOCTOU fixes are not
189
- part of the frozen `0.1.9` tarball. Publish, tag, and repeat identity
190
- verification before a blind run that needs those executable changes.
206
+ ForgeLoop should determine how to execute and verify the work.
191
207
 
192
208
  ### Use with npm
193
209
 
@@ -196,12 +212,12 @@ project without overwriting local instructions. When the package is available
196
212
  in the npm registry, use the commands below; otherwise use the repository
197
213
  checkout fallback.
198
214
 
199
- The current published release is `@cassiomc1/forgeloop@0.1.9`.
215
+ The current published release is `@cassiomc1/forgeloop@0.1.11`.
200
216
  Pin this version when a reproducible blind run or release-identity check is
201
217
  required:
202
218
 
203
219
  ```bash
204
- npx @cassiomc1/forgeloop@0.1.9 --version
220
+ npx @cassiomc1/forgeloop@0.1.11 --version
205
221
  npx @cassiomc1/forgeloop init
206
222
  npx @cassiomc1/forgeloop doctor
207
223
  npx @cassiomc1/forgeloop update
@@ -225,6 +241,7 @@ npx @cassiomc1/forgeloop advance --to EXECUTING
225
241
  npx @cassiomc1/forgeloop advance --to VERIFYING
226
242
  npx @cassiomc1/forgeloop prepare-completion --json
227
243
  npx @cassiomc1/forgeloop record-check --id tests --requirement tests --status passed --evidence-kind OBSERVED --command "npm test" --result "exit 0" --exit-code 0 --json
244
+ npx @cassiomc1/forgeloop record-terminal-result --requirement "Package published" --type PUBLICATION --status published --source "npm publish" --result "Published package to npm" --json
228
245
  npx @cassiomc1/forgeloop advance --to REVIEWING
229
246
  npx @cassiomc1/forgeloop audit --json
230
247
  npx @cassiomc1/forgeloop complete --json
@@ -257,6 +274,7 @@ implementation
257
274
  → forgeloop next
258
275
  → advance --to REVIEWING
259
276
  → forgeloop next
277
+ → (record-terminal-result if publication/production required)
260
278
  → complete
261
279
  ```
262
280
 
@@ -309,7 +327,7 @@ are never stored in that file. Status precedence is `INVALID` > `INCONSISTENT`
309
327
  All protocol-support commands are local and offline-capable by default; the
310
328
  package sends no telemetry and has no central trace service.
311
329
  Capability gaps and inline/non-Git degraded mode are defined in
312
- [`AGENT_COMPATIBILITY.md`](./AGENT_COMPATIBILITY.md); they are reported as
330
+ [`PROTOCOL_INTEGRATION.md`](./PROTOCOL_INTEGRATION.md); they are reported as
313
331
  limitations rather than treated as silent successes.
314
332
 
315
333
  ### Live conformance modes
@@ -464,6 +482,7 @@ must remain thin. The resulting target layout is:
464
482
  AGENTS.md
465
483
  CLAUDE.md
466
484
  .forgeloop/.gitignore
485
+ .forgeloop/kit/PROTOCOL_INTEGRATION.md
467
486
  .forgeloop/kit/AGENT_COMPATIBILITY.md
468
487
  .forgeloop/kit/LOOP_ENGINEERING.md
469
488
  .forgeloop/kit/GUIDE_ROUTER.md
@@ -515,7 +534,7 @@ commands. A generic response that does not mention the loop, router, or sources
515
534
  indicates that the adapter was not loaded.
516
535
 
517
536
  After installation, start the preferred agent from the target project
518
- directory. Use `AGENT_COMPATIBILITY.md` to confirm which file it should load and
537
+ directory. Use `PROTOCOL_INTEGRATION.md` to confirm which file it should load and
519
538
  which native entry point is expected. A live agent session is not required for
520
539
  package installation or its automated tests.
521
540
 
@@ -605,7 +624,8 @@ adoption. Local rendering requires Node.js 22+ and FFmpeg.
605
624
  .
606
625
  ├── AGENTS.md # shared Codex-compatible entry point
607
626
  ├── CLAUDE.md # Claude Code entry point
608
- ├── AGENT_COMPATIBILITY.md # supported agents and official sources
627
+ ├── PROTOCOL_INTEGRATION.md # vendor-neutral capability integration
628
+ ├── AGENT_COMPATIBILITY.md # compatibility alias
609
629
  ├── LOOP_ENGINEERING.md # canonical operating cycle
610
630
  ├── GUIDE_ROUTER.md # contextual guide selection
611
631
  ├── PROJECT_PROFILE.md # source profile (target copy is under .forgeloop/kit/)
package/TERMINOLOGY.md CHANGED
@@ -19,3 +19,5 @@
19
19
  | Evidence kind | One of `OBSERVED`, `INFERRED`, `NOT_VERIFIED`, or `BLOCKED`; evidence never upgrades an unverified claim by itself. |
20
20
  | Required artifact | A checkpoint-recorded relative path and SHA-256 hash that must still match before resume. |
21
21
  | Conformance | Relationship validation across route, state, receipt, task brief, and delegated-result artifacts. |
22
+ | Universal applicability | ForgeLoop applies whenever an execution environment discovers a project adapter, regardless of model, provider, agent, IDE, or tool name. |
23
+ | Integration level | The capability tier of an execution environment (`INSTRUCTION_DISCOVERED`, `PROTOCOL_CAPABLE`, `PROTOCOL_LIMITED`, `CONFORMANCE_VERIFIED`). |
package/THREAT_MODEL.md CHANGED
@@ -17,6 +17,7 @@ remaining trust boundaries and their executable evidence.
17
17
  | Malicious work-state | Resumes stale, secret-bearing, or invalid work | `.forgeloop/work-state.json` | Schema/semantic checks, version checks, transition checks, contract/HEAD/artifact freshness, secret scan, size/depth bounds | Freshness cannot prove that an external process did not alter a file immediately afterward | `tests/work-state.test.js`, `tests/checkpoint-freshness.test.js`, `tests/security-limits.test.js` |
18
18
  | Forged preparation | Makes an agent's prose claim look like a completed preflight | Contract, route, gate, and preflight artifacts | Canonical SHA-256 fingerprints, guide-declared gate requirements, stale-artifact checks, and `E_*` failures | The CLI cannot stop a separate process from writing project files before preflight | `tests/protocol-artifacts.test.js`, `tests/preflight.test.js` |
19
19
  | Chronology rewrite | Hides execution before route, gates, or verification | `.forgeloop/events.ndjson` | Append-only local ledger, sequence numbers, hash chaining, and chronology validation without prompts or hidden reasoning | A privileged process can still replace the ledger after validation | `tests/lifecycle.test.js` |
20
+ | Lifecycle artifact repair | Direct state or receipt edits fabricate a legal recovery or terminal phase | Work state, receipt, evidence checks, and event ledger | New verification cycles record phase events and fingerprints; validators reject state/ledger divergence and future lifecycle evidence | Local artifacts are detection-oriented, not cryptographically tamper-proof against a privileged process rewriting every linked artifact | `tests/lifecycle-evidence-recovery.test.js`, `tests/completion-ergonomics.test.js` |
20
21
  | Unsupported profile fact | Turns an agent decision into a durable user fact | `PROJECT_PROFILE.md` and `.forgeloop/sources.json` | Source IDs, source-kind validation, unknown-reference rejection, and explicit misclassification failures | Arbitrary Markdown semantics still require a human or host-specific parser | `tests/profile-provenance.test.js`, `src/core/profile.js` |
21
22
  | Weak verification | Treats a vague or inferred claim as observed evidence | Receipt checks and coverage | Versioned check schema, contradictory-status rejection, observed-evidence requirements, and coverage matrix | Evidence remains local and declarative; it is not a remote attestation service | `tests/evidence-coverage.test.js`, `tests/completion.test.js` |
22
23
  | Malicious receipt | Turns local claims into false publication or completion claims | Execution receipt JSON | Semantic evidence checks for completion, checks, review, push, commit, and deployment; explicit publication booleans | Evidence text is declarative and must still be reviewed for provenance | `tests/receipt-semantics.test.js`, `tests/observability.test.js` |
@@ -29,6 +30,9 @@ remaining trust boundaries and their executable evidence.
29
30
  | Protocol-version confusion | Old/future artifacts are silently reinterpreted | Cross-artifact protocol boundary | Explicit v1 checks and conformance errors for unsupported or mixed versions | A future protocol needs a deliberate migration implementation | `tests/conformance.test.js`, `tests/fixtures/protocol/invalid/` |
30
31
  | Dependency-cycle denial of service | Coordination cannot make progress or spends unbounded work | Delegation dependency graph | Deterministic DFS cycle detection, unknown-reference rejection, and bounded JSON | A caller can still submit many valid tasks; host-level quotas remain external | `tests/delegation.test.js`, `tests/delegation-set.test.js` |
31
32
  | Oversized JSON artifacts | Excess CPU or memory during validation | Any untrusted JSON artifact | Byte, depth, array, object-key, and string limits before semantic traversal | Limits are conservative defaults, not a complete resource scheduler | `tests/security-limits.test.js`, `src/core/json-safety.js` |
33
+ | Runtime self-exemption | An execution environment discovers ForgeLoop but decides that the protocol does not apply because the environment is not named in documentation | Project adapter discovery and runtime interpretation | Universal applicability marker, capability-based integration, explicit unknown-runtime rule, no finite eligibility allowlist | A non-compliant runtime can ignore project instructions entirely | `tests/discovery-surfaces.test.js`, `tests/test_workflow_policy.py` |
34
+ | Blind oracle exposure | The system under test reads expected route/gate/evidence answers from the installed package and contaminates a blind conformance run | Published npm package and agent-readable target workspace | Exclude conformance oracles from npm package, tarball leak scan in `pack:check`, external harness-owned oracle | A misconfigured external harness may still copy oracle material into target | `tests/package.test.js`, `conformance/README.md` |
35
+ | Lifecycle simulation after CLI resolution failure | A runtime manually writes protocol-owned JSON and falsely claims conformance when the CLI is unresolved | Lifecycle-owned protocol state and CLI availability | CLI-owned artifact policy, universal adapter prohibition, validator-backed completion, append-only ledger hash chain | A privileged local process can tamper with local files; ForgeLoop detects consistency, not remote attestation | `tests/discovery-surfaces.test.js`, `tests/lifecycle.test.js`, `LOOP_ENGINEERING.md` |
32
36
 
33
37
  ## Boundary rules
34
38
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cassiomc1/forgeloop",
3
- "version": "0.1.10",
4
- "description": "Portable, verifiable instruction kit for AI agents and developers",
3
+ "version": "0.1.12",
4
+ "description": "Portable, verifiable engineering protocol for AI coding environments and developer workflows",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/cassiomc1/forgeloop.git"
@@ -22,12 +22,12 @@
22
22
  "src",
23
23
  "ENG",
24
24
  "schemas",
25
- "conformance",
26
25
  ".forgeloop/forgeloop.gitignore",
27
26
  "AGENTS.md",
28
27
  "CLAUDE.md",
29
28
  "GUIDE_ROUTER.md",
30
29
  "LOOP_ENGINEERING.md",
30
+ "PROTOCOL_INTEGRATION.md",
31
31
  "LOOP_SYSTEM_DESIGN.md",
32
32
  "QUALITY_SCORECARD.md",
33
33
  "TERMINOLOGY.md",
@@ -48,6 +48,7 @@
48
48
  "scripts": {
49
49
  "test": "node scripts/run-tests.js",
50
50
  "pack:check": "node --test tests/package.test.js",
51
- "release:identity": "node scripts/verify_release_identity.mjs"
51
+ "release:identity": "node scripts/verify_release_identity.mjs",
52
+ "docs:flow": "node scripts/generate-readme-flow.mjs"
52
53
  }
53
54
  }
@@ -17,6 +17,36 @@
17
17
  "unresolvedDecisions",
18
18
  "sourceRefs"
19
19
  ],
20
+ "$defs": {
21
+ "requirement": {
22
+ "type": "object",
23
+ "required": ["text"],
24
+ "properties": {
25
+ "id": { "type": "string", "minLength": 1 },
26
+ "text": { "type": "string", "minLength": 1 },
27
+ "type": { "enum": ["PRODUCT", "VERIFICATION", "LIFECYCLE", "PUBLICATION", "PRODUCTION_READINESS"] },
28
+ "operator": { "enum": ["SINGLE", "ALL"] },
29
+ "requiredEvidenceKind": { "enum": ["OBSERVED", "INFERRED", "NOT_VERIFIED", "BLOCKED", "HYPOTHESIS"] },
30
+ "lifecycleOwned": { "type": "boolean" },
31
+ "terminalOwned": { "type": "boolean" },
32
+ "mixedTerminal": { "type": "boolean" },
33
+ "requiredPublicationStatus": {
34
+ "type": "string",
35
+ "enum": ["committed", "pushed", "published", "deployed"]
36
+ },
37
+ "requirements": {
38
+ "type": "array",
39
+ "items": {
40
+ "oneOf": [
41
+ { "type": "string", "minLength": 1 },
42
+ { "$ref": "#/$defs/requirement" }
43
+ ]
44
+ }
45
+ }
46
+ },
47
+ "additionalProperties": false
48
+ }
49
+ },
20
50
  "properties": {
21
51
  "schemaVersion": { "const": 1 },
22
52
  "protocolVersion": { "const": 1 },
@@ -40,8 +70,24 @@
40
70
  "deliverables": { "type": "array", "items": { "type": "string", "minLength": 1 } },
41
71
  "constraints": { "type": "array", "items": { "type": "string", "minLength": 1 } },
42
72
  "risks": { "type": "array", "items": { "type": "string", "minLength": 1 } },
43
- "verification": { "type": "array", "items": { "type": "string", "minLength": 1 } },
44
- "successCriteria": { "type": "array", "items": { "type": "string", "minLength": 1 } },
73
+ "verification": {
74
+ "type": "array",
75
+ "items": {
76
+ "oneOf": [
77
+ { "type": "string", "minLength": 1 },
78
+ { "$ref": "#/$defs/requirement" }
79
+ ]
80
+ }
81
+ },
82
+ "successCriteria": {
83
+ "type": "array",
84
+ "items": {
85
+ "oneOf": [
86
+ { "type": "string", "minLength": 1 },
87
+ { "$ref": "#/$defs/requirement" }
88
+ ]
89
+ }
90
+ },
45
91
  "stopConditions": { "type": "array", "items": { "type": "string", "minLength": 1 } },
46
92
  "unresolvedDecisions": { "type": "array", "items": { "type": "string", "minLength": 1 } },
47
93
  "sourceRefs": { "type": "array", "items": { "type": "string", "minLength": 1 } }
@@ -9,6 +9,7 @@
9
9
  "kind": { "enum": ["OBSERVED", "INFERRED", "NOT_VERIFIED", "BLOCKED"] },
10
10
  "source": { "type": "string", "minLength": 1 },
11
11
  "result": { "type": "string", "minLength": 1 },
12
+ "verificationCycle": { "type": "integer", "minimum": 1 },
12
13
  "details": { "type": "object" }
13
14
  },
14
15
  "additionalProperties": false
@@ -11,6 +11,7 @@
11
11
  "contractFingerprint": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
12
12
  "routeFingerprint": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
13
13
  "stateFingerprint": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
14
+ "verificationCycle": { "type": "integer", "minimum": 1 },
14
15
  "status": { "enum": ["in-progress", "complete", "blocked", "complete-with-concerns"] },
15
16
  "taskStatus": { "enum": ["in-progress", "complete", "blocked", "incomplete"] },
16
17
  "verificationStatus": { "enum": ["valid", "invalid", "not-verified", "blocked"] },
@@ -29,6 +30,7 @@
29
30
  "kind": { "enum": ["OBSERVED", "INFERRED", "NOT_VERIFIED", "BLOCKED"] },
30
31
  "source": { "type": "string", "minLength": 1 },
31
32
  "result": { "type": "string", "minLength": 1 },
33
+ "verificationCycle": { "type": "integer", "minimum": 1 },
32
34
  "details": { "type": "object" }
33
35
  },
34
36
  "additionalProperties": false