@cassiomc1/forgeloop 0.1.14 → 0.1.16

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 (61) hide show
  1. package/.forgeloop/forgeloop.gitignore +1 -0
  2. package/DOCS_INDEX.md +60 -0
  3. package/EXECUTION_STATE.md +9 -0
  4. package/LOOP_ENGINEERING.md +44 -6
  5. package/LOOP_SYSTEM_DESIGN.md +8 -0
  6. package/PROTOCOL_INTEGRATION.md +41 -0
  7. package/QUALITY_SCORECARD.md +2 -0
  8. package/README.md +183 -643
  9. package/TERMINOLOGY.md +4 -0
  10. package/THREAT_MODEL.md +14 -0
  11. package/docs/assets/forgeloop-flow.svg +1 -0
  12. package/docs/forgeloop-flow.mmd +51 -0
  13. package/package.json +16 -3
  14. package/schemas/check.schema.json +2 -0
  15. package/schemas/continuity.schema.json +57 -0
  16. package/schemas/execution.schema.json +63 -0
  17. package/scripts/CI_VALIDATORS.md +32 -0
  18. package/src/cli.js +351 -196
  19. package/src/commands/clear-continuity.js +9 -0
  20. package/src/commands/continuity.js +25 -0
  21. package/src/commands/doctor.js +17 -2
  22. package/src/commands/reconcile-continuity.js +23 -0
  23. package/src/commands/record-continuity.js +63 -0
  24. package/src/commands/run-check.js +83 -0
  25. package/src/commands/status.js +14 -1
  26. package/src/commands/update.js +12 -13
  27. package/src/commands/validate-protocol.js +37 -0
  28. package/src/core/artifacts.js +9 -0
  29. package/src/core/bundles.js +78 -0
  30. package/src/core/checks.js +16 -0
  31. package/src/core/command-resolution.js +295 -0
  32. package/src/core/command-tokenizer.js +122 -0
  33. package/src/core/completion-artifacts.js +229 -47
  34. package/src/core/completion.js +19 -1
  35. package/src/core/conformance.js +8 -2
  36. package/src/core/continuity-cli-options.js +58 -0
  37. package/src/core/continuity-conformance.js +46 -0
  38. package/src/core/continuity-observability.js +20 -0
  39. package/src/core/continuity-reconciliation.js +224 -0
  40. package/src/core/continuity.js +245 -0
  41. package/src/core/evidence-readiness.js +26 -1
  42. package/src/core/execution.js +185 -0
  43. package/src/core/inspect.js +9 -1
  44. package/src/core/installation-authority.js +178 -0
  45. package/src/core/json-safety.js +17 -13
  46. package/src/core/next-action-artifacts.js +118 -0
  47. package/src/core/next-action-continuity.js +65 -0
  48. package/src/core/next-action-model.js +127 -0
  49. package/src/core/next-action-phases.js +12 -0
  50. package/src/core/next-action.js +22 -249
  51. package/src/core/npm-classifier.js +343 -0
  52. package/src/core/package-manager-classifiers.js +37 -0
  53. package/src/core/preflight-consistency.js +221 -0
  54. package/src/core/preflight-loaders.js +112 -0
  55. package/src/core/preflight-model.js +83 -0
  56. package/src/core/preflight.js +34 -444
  57. package/src/core/protocol.js +7 -0
  58. package/src/core/schema-validation.js +16 -1
  59. package/src/core/templates.js +3 -0
  60. package/src/core/verification-capability.js +31 -495
  61. package/src/core/verification-constants.js +61 -0
package/README.md CHANGED
@@ -2,345 +2,126 @@
2
2
 
3
3
  [![Docs quality](https://github.com/cassiomc1/forgeloop/actions/workflows/docs-quality.yml/badge.svg?branch=main)](https://github.com/cassiomc1/forgeloop/actions/workflows/docs-quality.yml)
4
4
 
5
- ForgeLoop is a portable, verifiable engineering protocol for AI-assisted development and developer workflows.
6
-
7
- It is project-scoped, capability-based, and vendor-neutral. It turns intent into contract-driven execution with deterministic routing, resumable state, evidence-backed verification, recovery, and validator-backed completion.
8
-
9
- ForgeLoop does not depend on a specific model, provider, agent product, IDE, or orchestration runtime.
10
-
11
- The repository also provides an English-only collection of operational engineering guides covering product strategy, clean code, testing, security, performance, accessibility, visual design, and web games across web, mobile, and desktop projects.
12
-
13
- Project-local discovery surfaces (`AGENTS.md`, `CLAUDE.md`, `.cursor/rules/project-loop.mdc`, `.github/copilot-instructions.md`) and manual bootstrap paths delegate to the same canonical protocol in `.forgeloop/kit/`. The capability levels and integration contract are documented in [`PROTOCOL_INTEGRATION.md`](./PROTOCOL_INTEGRATION.md). Adopt only the guides relevant to the target project.
14
-
15
- The npm package also ships the local `forgeloop` CLI. In a target project it installs canonical documents under `.forgeloop/kit/`, keeps only small native discovery shims at the root, and stores mutable protocol artifacts under `.forgeloop/`.
5
+ ForgeLoop is a portable, vendor-neutral protocol for AI-assisted development
6
+ and developer workflows. It turns an outcome into a contract, deterministic
7
+ routing, resumable state, evidence-backed verification, recovery, and
8
+ validator-backed completion. It is a protocol/support CLI, not an agent or LLM
9
+ runtime.
10
+
11
+ The operational sources are indexed in [`DOCS_INDEX.md`](./DOCS_INDEX.md).
12
+ [`LOOP_ENGINEERING.md`](./LOOP_ENGINEERING.md) is the canonical process;
13
+ [`PROTOCOL_INTEGRATION.md`](./PROTOCOL_INTEGRATION.md) defines capability
14
+ levels and discovery; [`PROJECT_PROFILE.md`](./PROJECT_PROFILE.md) stores
15
+ durable project facts; and [`GUIDE_ROUTER.md`](./GUIDE_ROUTER.md) selects only
16
+ relevant guides.
16
17
 
17
18
  ## Catalog
18
19
 
19
- | Topic | When to use it | Guide |
20
- | --- | --- | --- |
21
- | Premium websites | End-to-end process from strategy to launch | [`premium-sites-studio-eng.md`](./ENG/premium-sites-studio-eng.md) |
22
- | Clean code | Readable, observable, secure, and operable code | [`clean-code-eng.md`](./ENG/clean-code-eng.md) |
23
- | Testing | Risk-based testing strategy | [`test-code-eng.md`](./ENG/test-code-eng.md) |
24
- | Security | Web, mobile, desktop, APIs, and supply chain | [`sec-code-eng.md`](./ENG/sec-code-eng.md) |
25
- | Design | Visual direction, UX, motion, and perceived performance | [`design-code-eng.md`](./ENG/design-code-eng.md) |
26
- | Taste frontend | Contextual design-read, anti-slop, and visual pre-flight for premium frontend work | [`taste-frontend-eng.md`](./ENG/taste-frontend-eng.md) |
27
- | Performance | Measurement, diagnosis, budgets, and optimization | [`perf-code-eng.md`](./ENG/perf-code-eng.md) |
28
- | Accessibility | WCAG 2.2-oriented protocol for interfaces | [`accessibility-eng.md`](./ENG/accessibility-eng.md) |
29
- | Web games | Architecture, design, and operation of 2D, 3D, and procedural games | [`games-code-design-web-eng.md`](./ENG/games-code-design-web-eng.md) |
30
-
31
- Each guide declares its name, `language: en`, description, version, and review
32
- date in frontmatter. The repository validator checks that the guide metadata
33
- and catalog remain synchronized.
34
-
35
- ## Universal project loop
36
-
37
- The kit turns each request into a verifiable cycle: discover the project,
38
- define an execution contract, select applicable guides, execute, verify,
39
- diagnose, and correct until success or a genuine external blocker.
40
- [`LOOP_ENGINEERING.md`](./LOOP_ENGINEERING.md) is the operational source (and
41
- is installed under `.forgeloop/kit/` in a target);
42
- [`GUIDE_ROUTER.md`](./GUIDE_ROUTER.md) prevents irrelevant context from being
43
- loaded; and [`PROJECT_PROFILE.md`](./PROJECT_PROFILE.md) preserves only durable,
44
- proven project facts (installed as `.forgeloop/kit/PROJECT_PROFILE.md` in a
45
- target).
46
-
47
- The canonical system map, including the routing/state/evidence architecture, is
48
- in [`LOOP_SYSTEM_DESIGN.md`](./LOOP_SYSTEM_DESIGN.md).
49
-
50
- <p align="center">
51
- <img
52
- src="./docs/assets/forgeloop-flow.svg"
53
- alt="ForgeLoop evidence-first engineering flow"
54
- width="100%"
55
- />
56
- </p>
57
-
58
- Equivalent reading for text-only environments: adapters load the canonical kit;
59
- an older target follows validate paths → write hidden files → verify their bytes
60
- → switch manifest authority atomically → hash-checked cleanup. An interruption
61
- after hidden writes, after verification, after the authority switch, or during
62
- cleanup is diagnosed by `doctor` as `E_MIGRATION_INCOMPLETE` and retried by
63
- `update`; modified or unmanaged residual files remain preserved;
64
- discovery creates the contract and deterministic route; contract, route, and
65
- required gates must produce `PREFLIGHT_READY` before the resumable state and
66
- append-only event ledger authorize the lifecycle. Verification produces
67
- structured evidence evaluated by one canonical readiness model. Failed checks
68
- enter diagnosis and correction. An evidence-only completion rejection records
69
- `COMPLETION_REJECTED` and opens a new numbered verification cycle without
70
- editing protocol JSON manually. `audit`, `complete`, and `validate-protocol`
71
- classify the result as `VALID`, `INCOMPLETE`, `STALE`, `INCONSISTENT`, or
72
- `INVALID`. Optional delegation creates a handoff; it is not an agent runtime.
73
-
74
- The operational request loop remains:
75
-
76
- ```text
77
- Request → discovery → profile → routing → plan → execution
78
- → verification → review → completion validation
79
- ↑ │
80
- └ evidence-only rejection / next cycle
81
- ```
82
-
83
- ForgeLoop is project-scoped, capability-based, and vendor-neutral.
84
-
85
- Project-local discovery surfaces delegate to the same canonical ForgeLoop protocol. Execution environments that automatically discover one of those instruction surfaces can use it directly, while custom runtimes, automation systems, and developer workflows can use the manual bootstrap path.
86
-
87
- Capabilities determine execution. Runtime names do not determine protocol applicability.
88
-
89
- See [`PROTOCOL_INTEGRATION.md`](./PROTOCOL_INTEGRATION.md) for discovery, capability levels, degradation rules, and precedence.
90
-
91
- ### Migration recovery and release freeze
92
-
93
- Legacy layout migration keeps `.forgeloop/kit/` as the canonical layout and
94
- does not make `layoutVersion: 2` authoritative until every planned hidden file
95
- has been written and byte-verified. Cleanup runs only after the manifest switch
96
- and only for legacy files whose recorded ownership hash still matches when
97
- ForgeLoop revalidates it immediately before deletion. A modified, unmanaged,
98
- or `preserve=true` file is retained for manual review.
99
-
100
- The interruption vocabulary is test-only and is not a runtime state machine:
101
-
102
- ```text
103
- VALIDATED → HIDDEN_WRITTEN → HIDDEN_VERIFIED → MANIFEST_SWITCHED
104
- → LEGACY_CLEANED → COMPLETE
105
- ```
106
-
107
- The regression suite injects failures at these boundaries and verifies that
108
- `doctor` explains the incomplete migration before a later `update` recovers
109
- owned cleanup. The frozen published installation under
110
- [`tests/fixtures/legacy-0.1.6/`](./tests/fixtures/legacy-0.1.6/) is derived
111
- from the real npm tarball, includes provenance and digests, and is copied into
112
- The latest verified published npm release is `@cassiomc1/forgeloop@0.1.14`.
113
- The repository release is `0.1.14`.
114
- Earlier `0.1.8`, `0.1.9`, `0.1.10`, `0.1.11`, `0.1.12`, and `0.1.13` references are historical; never move
115
- their tags or `v0.1.10`. Release `0.1.14` enforces verification installation
116
- authority, provides recoverable stale receipt lifecycle in `prepare-completion`,
117
- and validates single-actor protocol runs.
118
-
119
- ## How to prompt ForgeLoop
120
-
121
- You do not need a perfect prompt to use ForgeLoop.
122
-
123
- 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.
124
-
125
- > **Don't engineer the perfect prompt. Define the outcome and let ForgeLoop engineer the feedback loop.**
126
-
127
- ### Minimal
128
-
129
- A short request should be enough for ordinary work:
130
-
131
- ```text
132
- Create a premium website for a law firm.
133
- ```
134
-
135
- ### Recommended
136
-
137
- Add the important outcome and product constraints:
138
-
139
- ```text
140
- Create a premium website for a law firm.
141
-
142
- It should feel modern, sophisticated and trustworthy, work well on mobile and desktop, and include a contact form.
143
- ```
144
-
145
- ### Structured
146
-
147
- For larger or more constrained tasks, you can optionally use a lightweight task brief:
148
-
149
- ```text
150
- Build: Premium law firm website
151
-
152
- Goal:
153
- Create a modern, sophisticated and trustworthy experience.
154
-
155
- Requirements:
156
- - Responsive on mobile and desktop
157
- - Accessible navigation
158
- - Contact form
159
- - Premium visual design
160
- - Good performance
161
-
162
- Done when:
163
- - The implementation is complete
164
- - Required verification passes
165
- - Mobile and desktop layouts are verified
166
- - The contact form works
167
- ```
168
-
169
- The structured format is optional. It gives ForgeLoop more explicit constraints and success criteria, but it should not be necessary for ordinary tasks.
170
-
171
- ### What not to put in the prompt
172
-
173
- Avoid recreating the ForgeLoop process inside the prompt:
174
-
175
- ```text
176
- First analyze the task.
177
- Then create a plan.
178
- Then inspect the files.
179
- Then choose the guides.
180
- Then implement.
181
- Then run tests.
182
- If tests fail, fix them.
183
- Then review everything.
184
- Then produce a report.
185
- ```
186
-
187
- That workflow belongs to ForgeLoop.
188
-
189
- Your prompt should primarily describe:
190
-
191
- ```text
192
- what you want
193
- important requirements
194
- real constraints
195
- observable success conditions
196
- ```
197
-
198
- ForgeLoop should determine how to execute and verify the work.
20
+ | Topic | Guide |
21
+ | --- | --- |
22
+ | Premium websites | [`ENG/premium-sites-studio-eng.md`](./ENG/premium-sites-studio-eng.md) |
23
+ | Clean code | [`ENG/clean-code-eng.md`](./ENG/clean-code-eng.md) |
24
+ | Testing | [`ENG/test-code-eng.md`](./ENG/test-code-eng.md) |
25
+ | Security | [`ENG/sec-code-eng.md`](./ENG/sec-code-eng.md) |
26
+ | Design and UX | [`ENG/design-code-eng.md`](./ENG/design-code-eng.md) |
27
+ | Taste frontend | [`ENG/taste-frontend-eng.md`](./ENG/taste-frontend-eng.md) |
28
+ | Performance | [`ENG/perf-code-eng.md`](./ENG/perf-code-eng.md) |
29
+ | Accessibility | [`ENG/accessibility-eng.md`](./ENG/accessibility-eng.md) |
30
+ | Web games | [`ENG/games-code-design-web-eng.md`](./ENG/games-code-design-web-eng.md) |
199
31
 
200
- ### Use with npm
32
+ Each guide declares its name, language, version, and review date in
33
+ frontmatter. Repository validators keep the catalog and metadata synchronized.
201
34
 
202
- The npm CLI targets Node.js 20 or newer and installs the kit into an existing
203
- project without overwriting local instructions. When the package is available
204
- in the npm registry, use the commands below; otherwise use the repository
205
- checkout fallback.
35
+ ## Quickstart
206
36
 
207
- The current repository package is `@cassiomc1/forgeloop@0.1.14`.
208
- The latest verified published npm release is `@cassiomc1/forgeloop@0.1.14`.
209
- For reproducible published-package runs or release-identity checks,
210
- pin the published version:
37
+ From a published package, initialize a target project with:
211
38
 
212
39
  ```bash
213
- npx @cassiomc1/forgeloop@0.1.14 --version
214
40
  npx @cassiomc1/forgeloop init
215
41
  npx @cassiomc1/forgeloop doctor
216
- npx @cassiomc1/forgeloop update
217
42
  ```
218
43
 
219
- Protocol-support commands are local and do not invoke an agent or model:
44
+ The CLI installs canonical documents under `.forgeloop/kit/`, keeps small
45
+ native discovery shims at the project root, and stores mutable contract, route,
46
+ gate, state, event, receipt, and execution artifacts under `.forgeloop/`.
47
+ `update` preserves target-specific profile facts and locally modified files.
220
48
 
221
- The lifecycle example assumes that the harness has already written a
222
- schema-valid `.forgeloop/current-contract.json` and the required
223
- `.forgeloop/gates/*.json` files. `route` persists routing; `preflight` validates
224
- the contract, route, and gates before execution.
49
+ Before npm publication, the same source checkout can be exercised without a
50
+ network or package lookup:
225
51
 
226
52
  ```bash
227
- npx @cassiomc1/forgeloop route --work complete-website --surface ui --risk untrusted-input
228
- npx @cassiomc1/forgeloop activate
229
- npx @cassiomc1/forgeloop preflight --json
230
- npx @cassiomc1/forgeloop next
231
- npx @cassiomc1/forgeloop next --json
232
- npx @cassiomc1/forgeloop advance --to PLANNED
233
- npx @cassiomc1/forgeloop advance --to EXECUTING
234
- npx @cassiomc1/forgeloop advance --to VERIFYING
235
- npx @cassiomc1/forgeloop prepare-completion --json
236
- npx @cassiomc1/forgeloop record-check --id tests --requirement tests --status passed --evidence-kind OBSERVED --command "npm test" --result "exit 0" --exit-code 0 --json
237
- npx @cassiomc1/forgeloop record-terminal-result --requirement "Package published" --type PUBLICATION --status published --source "npm publish" --result "Published package to npm" --json
238
- npx @cassiomc1/forgeloop advance --to REVIEWING
239
- npx @cassiomc1/forgeloop audit --json
240
- npx @cassiomc1/forgeloop complete --json
241
- npx @cassiomc1/forgeloop report
242
- npx @cassiomc1/forgeloop policy web-premium
243
- npx @cassiomc1/forgeloop bundle --task website-001 --json
244
- npx @cassiomc1/forgeloop inspect --json
245
- npx @cassiomc1/forgeloop status --json
246
- npx @cassiomc1/forgeloop status --contract-file .forgeloop/current-contract.json --json
247
- npx @cassiomc1/forgeloop validate-state --json
248
- npx @cassiomc1/forgeloop validate-receipt --file .forgeloop/execution-receipt.json --json
249
- npx @cassiomc1/forgeloop validate-protocol --route-file .forgeloop/routing-result.json --state-file .forgeloop/work-state.json --receipt-file .forgeloop/execution-receipt.json --contract-file .forgeloop/current-contract.json --json
53
+ node src/cli.js init
54
+ node src/cli.js doctor
55
+ node src/cli.js update
250
56
  ```
251
57
 
252
- For `complete-website`, record one structured check for each required success
253
- criterion before `complete`; the single `tests` entry above only illustrates the
254
- command shape. Route, receipt, state, and contract artifacts all live under
255
- `.forgeloop/` in the target.
58
+ ## Universal project loop
256
59
 
257
- The query-driven post-implementation path is:
60
+ The lifecycle is:
258
61
 
259
62
  ```text
260
- implementation
261
- forgeloop next
262
- → advance --to VERIFYING
263
- forgeloop next
264
- → prepare-completion
265
- → forgeloop next
266
- → checks + record-check
267
- → forgeloop next
268
- → advance --to REVIEWING
269
- → forgeloop next
270
- → (record-terminal-result if publication/production required)
271
- → complete
63
+ request → discovery → contract → routing → plan → execution
64
+ verification → review → completion validation
65
+ ↑ │
66
+ └──── evidence-only rejection / next cycle
272
67
  ```
273
68
 
274
- `forgeloop next` and `forgeloop next --json` read persisted state only. They do
275
- not run project checks or mutate protocol artifacts.
276
-
277
- A `READY` preflight is a resumable checkpoint, not only a status value. It must
278
- reconcile the contract, route, required gates, `.forgeloop/work-state.json`,
279
- `.forgeloop/events.ndjson`, and a matching `.forgeloop/preflight.json`. If
280
- `READY` remains while the work state is missing, `next` returns
281
- `RESOLVE_BLOCKER` with `E_STATE_MISSING_AFTER_PREFLIGHT_READY`; it does not
282
- silently fall back to discovery.
283
-
284
- `route` expands declared signals into deterministic guide IDs and reason codes.
285
- `activate` records a session marker without storing prompts or hidden reasoning.
286
- Before implementation, write the canonical contract, persist the route, create
287
- required gate artifacts under `.forgeloop/gates/`, and require `preflight` to
288
- return `READY`. `advance` enforces legal phase transitions; it never runs the
289
- project's commands. After implementation, advance to `VERIFYING`, use
290
- `prepare-completion` to create a safe receipt skeleton, and use `record-check`
291
- to serialize results that the agent has already observed. `record-check` never
292
- executes the supplied command text. Advance to `REVIEWING` before running
293
- `audit` and `complete`.
294
- `audit` is a read-only consistency check. `complete` validates the final
295
- contract, route, gates, phase ledger, structured evidence, coverage, receipt,
296
- and freshness before it can return `VALID`. `report` renders the same result as
297
- independent task, verification, publication, and production-readiness
298
- dimensions. `policy` selects a local strictness pack and `bundle` exports
299
- canonical protocol artifacts for handoff or review.
300
- `inspect`, `status`, and `validate-state` explain installation and resumable
301
- state; they do not execute commands from the target profile.
302
- `inspect` and `status` parse the target-local schemas and report `valid`,
303
- `missing`, `invalid`, or `unsupported-version` health. A status without a
304
- current contract file reports contract comparison as `NOT_VERIFIED` and does
305
- not claim full freshness. `validate-protocol` is read-only and checks
306
- cross-artifact relationships plus the same derived freshness classification
307
- used by `inspect` and `status`. Supply `--contract-file` to compare the saved
308
- contract fingerprint with the current contract; omitting it leaves contract
309
- freshness as `NOT_VERIFIED` and a complete artifact set requires revalidation.
310
- Delegation artifacts are required only when delegation is present in the
311
- canonical execution history or explicitly supplied as part of a delegated run.
312
- For a purely local single-actor lifecycle, the delegation dimension is
313
- `NOT_APPLICABLE` and does not require task briefs or delegated results. When
314
- delegation is in scope, also supply the matching repeated
315
- `--task-brief <path>` and `--delegated-result <path>` inputs; omitting them in a
316
- delegated run reports `INCOMPLETE`.
317
- It returns `VALID`, `INCOMPLETE`, `STALE`, `INCONSISTENT`, or `INVALID` with
318
- exact invariant codes and derived stale reasons. The persisted
319
- `.forgeloop/work-state.json` schema is unchanged: `status`, `stale`, and `fresh`
320
- are never stored in that file. Status precedence is `INVALID` > `INCONSISTENT`
321
- > `STALE` > `INCOMPLETE` > `VALID`.
322
- All protocol-support commands are local and offline-capable by default; the
323
- package sends no telemetry and has no central trace service.
324
- Capability gaps and inline/non-Git degraded mode are defined in
325
- [`PROTOCOL_INTEGRATION.md`](./PROTOCOL_INTEGRATION.md); they are reported as
326
- limitations rather than treated as silent successes.
327
-
328
- ### Live conformance modes
329
-
330
- Standard blind conformance uses the same mode throughout a run:
69
+ The harness writes a schema-valid `.forgeloop/current-contract.json`, required
70
+ gate artifacts, and routing. `preflight` must return `PREFLIGHT_READY` before
71
+ implementation. ForgeLoop then records an append-only event ledger and protects
72
+ the lifecycle with contract, route, repository, and artifact fingerprints.
331
73
 
332
- ```text
333
- forgeloop preflight
334
- → forgeloop audit
335
- forgeloop complete
336
- ```
74
+ Typical local commands are:
75
+
76
+ ```bash
77
+ forgeloop route --work complete-website --surface ui --risk untrusted-input
78
+ forgeloop activate
79
+ forgeloop preflight --json
80
+ forgeloop next --json
81
+ forgeloop advance --to PLANNED
82
+ forgeloop advance --to EXECUTING
83
+ forgeloop advance --to VERIFYING
84
+ forgeloop prepare-completion --json
85
+ forgeloop run-check --json --id tests --requirement tests -- npm test
86
+ forgeloop advance --to REVIEWING
87
+ forgeloop audit --json
88
+ forgeloop complete --json
89
+ ```
90
+
91
+ `advance` changes protocol phase only; it never runs target commands.
92
+ `run-check` classifies the exact argv before launch and records ForgeLoop-owned
93
+ execution provenance. `record-check` stores an observation and never executes
94
+ the text supplied to `--command`. `complete` validates the contract, route,
95
+ gates, ledger, evidence, coverage, receipt, and freshness. `audit` is
96
+ read-only. `report` exposes independent completion, publication, and
97
+ production-readiness dimensions.
98
+
99
+ The status precedence is `INVALID` > `INCONSISTENT` > `STALE` > `INCOMPLETE` >
100
+ `VALID`. A `READY` preflight is a resumable checkpoint: if its work state is
101
+ missing, `forgeloop next` returns `RESOLVE_BLOCKER` rather than silently
102
+ falling back to discovery. Delegation artifacts are required only when
103
+ delegation is present in the execution history; ForgeLoop does not provide a
104
+ graph runtime, agent runtime, or hidden prompt store.
105
+
106
+ ## Architecture flow
107
+
108
+ The canonical source is [`docs/forgeloop-flow.mmd`](./docs/forgeloop-flow.mmd),
109
+ and the committed render is [`docs/assets/forgeloop-flow.svg`](./docs/assets/forgeloop-flow.svg).
110
+ The broader architecture and boundaries are in
111
+ [`LOOP_SYSTEM_DESIGN.md`](./LOOP_SYSTEM_DESIGN.md).
112
+
113
+ <p align="center">
114
+ <img src="./docs/assets/forgeloop-flow.svg" alt="ForgeLoop evidence-first engineering flow" width="100%" />
115
+ </p>
337
116
 
338
- Strict blind conformance is a separate profile. First verify the target
339
- `.forgeloop/kit/PROJECT_PROFILE.md`, then use `--strict` consistently with `preflight`,
340
- `audit`, and `complete`. Do not evaluate a Standard run with Strict criteria
341
- unless that escalation is explicitly recorded.
117
+ Text-only fallback: discovery creates the contract and route; required gates
118
+ and `PREFLIGHT_READY` authorize execution; verification creates structured
119
+ evidence; failures enter diagnosis and correction; review precedes
120
+ validator-backed completion. Drift reopens verification, and migration keeps
121
+ modified or unmanaged files for review. The terminal result is one of
122
+ `VALID`, `INCOMPLETE`, `STALE`, `INCONSISTENT`, or `INVALID`.
342
123
 
343
- ### Protocol compatibility
124
+ ## Protocol compatibility
344
125
 
345
126
  The npm package version is independent of protocol version. The current
346
127
  serializable artifact contract is `schemaVersion: 1` and `protocolVersion: 1`.
@@ -348,364 +129,123 @@ serializable artifact contract is `schemaVersion: 1` and `protocolVersion: 1`.
348
129
  - Patch releases preserve the v1 schemas, enums, transitions, and existing
349
130
  command contracts while correcting implementation defects.
350
131
  - Minor releases preserve existing v1 artifacts and commands; they may add
351
- documentation, new commands, new guide IDs, or a new explicitly named
352
- schema. Existing consumers must still reject unknown fields rather than
353
- silently treating an unrecognized artifact as valid.
132
+ documentation, commands, guides, or an explicitly named schema.
354
133
  - Major releases may change required fields, enums, transitions, or safety
355
- semantics and must document migration requirements together with a protocol
356
- version change.
357
-
358
- The compatibility fixture in
359
- [`tests/fixtures/compatibility/protocol-v1.json`](./tests/fixtures/compatibility/protocol-v1.json)
360
- is a small conformance marker, not a runtime configuration file.
361
-
362
- ### CLI security and trust boundaries
363
-
364
- The CLI is a local validator and installer. It does not execute instructions,
365
- profile commands, receipt data, state data, or hidden prompts supplied by a
366
- target project. Its main threat boundaries are:
367
-
368
- | Threat | Mitigation or accepted limit |
369
- | --- | --- |
370
- | Path traversal and symlink escape | Target and managed paths use safe-path and realpath containment checks; a symlinked target or escaped child is rejected. |
371
- | Manifest tampering | Managed-file hashes and manifest shape are checked by `doctor`; discrepancies become findings rather than silent overwrites. |
372
- | Untrusted state or profile data | JSON schemas, semantic checks, secret-like field checks, and non-execution rules apply before state or profile data is used. |
373
- | Command injection | Git inspection uses fixed arguments without a shell; the CLI never treats project text as a command. |
374
- | Data exposure | Receipts and checkpoints reject secret-like keys and values; examples use placeholders, and the repository secret scanner runs in CI. |
375
- | Unsafe update overwrite | `update` preserves locally modified files and the target's `.forgeloop/kit/PROJECT_PROFILE.md`; adoption and writes remain bounded to the selected target. |
376
- | Dependency supply chain | Runtime code uses Node built-ins only; the package does not install agents, providers, plugins, or remote services. |
377
- | Installation authority provenance | Standalone CLI uses `trustMode: NONE`: environment-selected `FORGELOOP_AUTHORITY_FILE`/`FORGELOOP_AUTHORITY_DIR` sources are untrusted candidates; only an internal `HOST_ATTESTED` context may select a trusted source outside the actor-writable target. Project-local authority claims remain untrusted. |
378
- | Stale replay | Work state records contract and repository fingerprints; drift requires revalidation and never reruns destructive or publication actions automatically. |
379
- | Unverified publication | Receipts carry explicit publication booleans; local success never implies a push, pull request, merge, release, or deployment. |
380
-
381
- The full boundary inventory, residual limitations, and executable evidence are
382
- in [`THREAT_MODEL.md`](./THREAT_MODEL.md).
383
-
384
- An external path is not equivalent to external authority ownership. Actor-controlled
385
- environment configuration is not sufficient proof of host/operator authority;
386
- trusted authority requires a host-attested integration boundary.
387
-
388
- The CLI cannot protect a target from a separately privileged or hostile process
389
- that changes the filesystem after validation. Consumers must still review
390
- permissions, package provenance, and external actions before granting authority.
391
-
392
- From a repository checkout before npm publication, run the same commands with
393
- Node directly:
394
-
395
- ```bash
396
- node src/cli.js init
397
- node src/cli.js doctor
398
- node src/cli.js update
399
- ```
400
-
401
- The release workflow uses [npm trusted publishing](https://docs.npmjs.com/trusted-publishers)
402
- through GitHub Actions OIDC. Before the first release, register this repository
403
- and workflow as the package's trusted publisher in npm; each `vX.Y.Z` tag must
404
- match `package.json`. After publishing, verify the complete immutable release
405
- identity before a blind run:
406
-
407
- ```bash
408
- RELEASE_COMMIT="$(git rev-list -n1 vX.Y.Z)"
409
- npm run release:identity -- --version X.Y.Z --release-commit "$RELEASE_COMMIT"
410
- ```
134
+ semantics and must document migration requirements with a protocol version
135
+ change.
411
136
 
412
- Only `RELEASE_IDENTITY_VALID` is sufficient. The read-only check compares the
413
- release commit and GitHub tag with npm's version, `gitHead`, tarball URL,
414
- SHA-1, and SHA-512 integrity; it never publishes or changes a tag.
415
-
416
- The commands above use the current directory. To install into another existing
417
- project directory, pass a relative or absolute `--path`:
418
-
419
- ```bash
420
- # Existing project relative to the current directory
421
- npx @cassiomc1/forgeloop init --path ./my-project
422
- npx @cassiomc1/forgeloop doctor --path ./my-project
423
- npx @cassiomc1/forgeloop update --path ./my-project
424
-
425
- # Existing project at an absolute path
426
- npx @cassiomc1/forgeloop init --path /path/to/my-project
427
- npx @cassiomc1/forgeloop doctor --path /path/to/my-project
428
- npx @cassiomc1/forgeloop update --path /path/to/my-project
429
- ```
430
-
431
- The target must already exist and be a directory; the CLI will not create or
432
- replace an arbitrary path. Use `--dry-run` to preview writes before `init` or
433
- `update`. `--json`, `--strict`, and `--adopt <path>` are supported by `doctor`;
434
- adoption is limited to a supported adapter that has been reviewed locally. The
435
- CLI records managed files and their hashes in `.forgeloop/manifest.json`; a new
436
- target receives canonical documents under `.forgeloop/kit/` and only small
437
- native shims at the root. `update` leaves locally modified files and the
438
- project profile untouched. If a target already has a manifest, rerun `update`
439
- instead of `init`. Symlinked targets or template parents are rejected, and
440
- unadopted pre-existing adapters are reported for manual merge with the loop
441
- reference.
442
-
443
- Targets created by an older package layout are migrated by `update`: unchanged
444
- managed root files move into the hidden kit, while modified or unowned root
445
- files are preserved and reported as conflicts. The migration never follows a
446
- symlink or deletes a file whose managed hash no longer matches. The migration
447
- writes and verifies the complete hidden plan, atomically switches the manifest
448
- authority, and only then cleans owned legacy files. If a process stops between
449
- those stages, `doctor` reports `E_MIGRATION_INCOMPLETE` and the next `update`
450
- retries cleanup only when the recorded legacy hash still matches; modified or
451
- unowned files remain for manual review.
452
-
453
- ### Migrate an existing mdfiles installation
454
-
455
- The ForgeLoop rename changes the target metadata namespace. From the existing
456
- project root, move the directory manually and refresh its manifest:
457
-
458
- ```bash
459
- mv .mdfiles .forgeloop
460
- npx @cassiomc1/forgeloop update
461
- ```
462
-
463
- ForgeLoop does not automatically migrate, dual-write, or delete a legacy
464
- `.mdfiles` directory. The serialized contract remains `schemaVersion: 1` and
465
- `protocolVersion: 1`; only the package, CLI, and target namespace change.
466
-
467
- ### Install in a target project
468
-
469
- If npm is unavailable, download this public repository as a ZIP or clone it
470
- into a temporary directory, then invoke the bundled CLI against the target:
471
-
472
- ```bash
473
- node /path/to/forgeloop/src/cli.js init --path /path/to/my-project
474
- node /path/to/forgeloop/src/cli.js doctor --path /path/to/my-project
475
- ```
476
-
477
- Copying source-root files directly is not equivalent to initialization: the
478
- canonical documents must be mapped into the hidden kit and the native adapters
479
- must remain thin. The resulting target layout is:
480
-
481
- ```text
482
- AGENTS.md
483
- CLAUDE.md
484
- .forgeloop/.gitignore
485
- .forgeloop/kit/PROTOCOL_INTEGRATION.md
486
- .forgeloop/kit/AGENT_COMPATIBILITY.md
487
- .forgeloop/kit/LOOP_ENGINEERING.md
488
- .forgeloop/kit/GUIDE_ROUTER.md
489
- .forgeloop/kit/PROJECT_PROFILE.md
490
- .forgeloop/kit/LOOP_SYSTEM_DESIGN.md
491
- .forgeloop/kit/QUALITY_SCORECARD.md
492
- .forgeloop/kit/TERMINOLOGY.md
493
- .forgeloop/kit/EXECUTION_STATE.md
494
- .forgeloop/kit/DELEGATION_PROTOCOL.md
495
- .forgeloop/kit/ORCHESTRATOR_INTEGRATION.md
496
- .forgeloop/kit/THREAT_MODEL.md
497
- .forgeloop/kit/CONTRACT_COVERAGE.md
498
- .forgeloop/kit/THIRD_PARTY_NOTICES.md
499
- .forgeloop/kit/LICENSE
500
- .forgeloop/kit/LICENSE-DOCS.md
501
- .forgeloop/kit/ENG/
502
- .forgeloop/kit/schemas/
503
- .github/copilot-instructions.md
504
- .cursor/rules/project-loop.mdc
505
- ```
137
+ Consumers must reject unknown artifact fields rather than silently treating
138
+ unrecognized protocol data as valid. The compatibility marker is
139
+ [`tests/fixtures/compatibility/protocol-v1.json`](./tests/fixtures/compatibility/protocol-v1.json).
506
140
 
507
- If the target already has `AGENTS.md`, `CLAUDE.md`, Copilot instructions, or
508
- Cursor rules, merge only the adapter block that points to the loop. Never
509
- overwrite specific local instructions. The `scripts/`, `.github/workflows/`,
510
- and quality configuration files are optional for kit consumers but required to
511
- maintain and validate this source repository.
141
+ ## Security and dependency boundary
512
142
 
513
- ### First run
143
+ The runtime uses Node built-ins only and does not install agents, providers,
144
+ plugins, remote services, or telemetry. Target paths and symlinks are bounded;
145
+ JSON is size/depth limited; manifests, schemas, receipts, and secret-like
146
+ values are checked; and install-capable verification requires trusted host
147
+ authority. See [`THREAT_MODEL.md`](./THREAT_MODEL.md) for the full inventory.
514
148
 
515
- On the first task in a target project with code or manifests, change
516
- `profile-mode` from `template` to `project` in
517
- `.forgeloop/kit/PROJECT_PROFILE.md`, discover the stack, and record only
518
- confirmed facts there. In this source checkout, the canonical profile is the
519
- root `PROJECT_PROFILE.md`. Keep `language: en`.
149
+ Development tooling is intentionally separate from runtime dependencies. The
150
+ repository policy allows only ESLint, c8, and Mermaid CLI as development
151
+ dependencies; `npm run dependency:policy` fails if runtime or unapproved
152
+ dependencies appear.
520
153
 
521
- The profile must not store tokens, passwords, keys, credentials, or task logs.
522
- Unknown commands remain unverified until a real source identifies them.
154
+ ## Autonomous blind-run isolation
523
155
 
524
- To confirm activation before the first implementation, ask the agent:
156
+ The repository does not claim a live blind conformance result for an external
157
+ harness. The isolated scenario is `TEST_NOT_STARTED`; do not reinterpret it as
158
+ a pass or failure. The compatible autonomous boundary is explicit:
525
159
 
526
160
  ```text
527
- Before implementing, report the confirmed project profile, the guide IDs
528
- selected through GUIDE_ROUTER.md, and the checks you will use. Do not change
529
- files yet.
161
+ mandatory-approval workflows enabled: NO
162
+ external brainstorming hard gate enabled: NO
163
+ external design approval gate enabled: NO
164
+ subagents enabled: NO
165
+ delegation enabled: NO
530
166
  ```
531
167
 
532
- A useful response cites profile evidence, selected guide IDs, and real project
533
- commands. A generic response that does not mention the loop, router, or sources
534
- indicates that the adapter was not loaded.
535
-
536
- After installation, start the preferred agent from the target project
537
- directory. Use `PROTOCOL_INTEGRATION.md` to confirm which file it should load and
538
- which native entry point is expected. A live agent session is not required for
539
- package installation or its automated tests.
540
-
541
- ### Update the kit
542
-
543
- When adopting a newer version, preserve target-specific facts from
544
- `.forgeloop/kit/PROJECT_PROFILE.md`. Compare adapters before replacing them, update the loop,
545
- router, notices, and guides as one coherent set, and never erase local
546
- instructions. If validators were copied, run:
547
-
548
- ```bash
549
- python3 scripts/validate_loop_system.py --self-test
550
- python3 scripts/validate_loop_system.py
551
- python3 scripts/scan_secrets.py
552
- ```
553
-
554
- When maintaining a checkout of this source repository, run the npm package
555
- checks as well:
556
-
557
- ```bash
558
- npm test
559
- npm run pack:check
560
- ```
561
-
562
- Architecture and boundaries are documented in
563
- [`LOOP_SYSTEM_DESIGN.md`](./LOOP_SYSTEM_DESIGN.md).
564
-
565
- ## Tool approval policy
566
-
567
- Identify the stack, current stage, and applicable checks. Prefer an equivalent
568
- tool already available when it produces compatible evidence. The task-scoped
569
- Qwen-MM-Plugins installation described below is the narrow capability exception
570
- when a required capability is missing; system tools, credentials, and unrelated
571
- environment changes remain subject to their normal host controls. If a required
572
- check cannot run and no safe alternative exists, record the blocker and do not
573
- claim that the check passed. Unrelated optional references must never be
574
- installed automatically.
168
+ An environment that requires those gates is `INCOMPATIBLE WITH AUTONOMOUS MODE`.
169
+ This constraint concerns the harness boundary and does not turn reversible
170
+ local product choices into blocking questions.
575
171
 
576
172
  ## Optional multimodal capabilities
577
173
 
578
- [Qwen-MM-Plugins](https://github.com/QwenLM/Qwen-MM-Plugins) can extend an
579
- execution environment with skills and optional MCP servers. Before using a
580
- multimodal or media operation, the agent checks the model and harness for a
581
- callable native capability. If the task requires a missing keyless capability,
582
- the agent installs only the smallest matching `qwen-mm-plugins-<cap>` capability
583
- and verifies that it is callable before continuing; it does not install every
584
- capability at startup.
174
+ [Qwen-MM-Plugins](https://github.com/QwenLM/Qwen-MM-Plugins) is an optional,
175
+ task-scoped capability extension. The agent checks native/callable support
176
+ first, installs only the smallest missing capability when authorized, and
177
+ verifies it before use. No API key is used by default for native image, video,
178
+ or document reading.
585
179
 
586
- No API key is used by default for native image, video, or document reading.
587
- Optional provider-backed operations follow this boundary:
588
-
589
- | Capability or operation | Configuration required |
180
+ | Capability | Configuration |
590
181
  | --- | --- |
591
- | Native image, video, and document reading | No API key; video/audio workflows may need `ffmpeg` and other documented system tools |
592
- | Vision chat, OCR, grounding, audio transcription, Omni audio-video understanding, generation, and video-memory construction | `DASHSCOPE_API_KEY` |
593
- | Web search, web extraction, and image search | `SERPER_API_KEY` |
182
+ | Vision, OCR, grounding, transcription, generation, and video memory | `DASHSCOPE_API_KEY` |
183
+ | Web and image search | `SERPER_API_KEY` |
594
184
  | Segmentation through a SAM3 service | `SAM3_SERVER_URL` |
595
- | Blender, FreeCAD, Office, browser-backed visualization, and `edu-agent` workflows | The selected application's system dependencies and upstream configuration; `edu-agent` TTS requires `DASHSCOPE_API_KEY` |
596
-
597
- Provide optional credentials through the process environment or the official
598
- Qwen configuration file at `~/.qwen-mm-plugins/config` (or its documented
599
- override). Never put keys in Git, the target's
600
- `.forgeloop/kit/PROJECT_PROFILE.md`, or copied instruction files. The agent must
601
- leave an API-backed capability disabled when its key or
602
- service endpoint is absent, and report missing system dependencies instead of
603
- claiming that the feature is available.
604
-
605
- Use the upstream [installation guide](https://github.com/QwenLM/Qwen-MM-Plugins/blob/main/docs/en/installation.md)
606
- for the active harness's current install and verification commands, supported
607
- capabilities, system dependencies, and Windows/WSL2 constraints. This project
608
- does not vendor Qwen code, add it to the npm package, or install it through
609
- `forgeloop init`, `update`, or `doctor`.
610
-
611
- ## HyperFrames for video and motion
612
-
613
- [HyperFrames](https://hyperframes.heygen.com) is an option for deterministic
614
- HTML, CSS, and JavaScript-based trailers, demos, presentations, and motion
615
- graphics. It complements the design, accessibility, performance, and testing
616
- guides; it does not replace those checks. Review the
617
- [quickstart](https://hyperframes.heygen.com/quickstart) and
618
- [CLI documentation](https://hyperframes.heygen.com/packages/cli) before
619
- adoption. Local rendering requires Node.js 22+ and FFmpeg.
620
-
621
- ## Structure
622
-
623
- ```text
624
- .
625
- ├── AGENTS.md # shared Codex-compatible entry point
626
- ├── CLAUDE.md # Claude Code entry point
627
- ├── PROTOCOL_INTEGRATION.md # vendor-neutral capability integration
628
- ├── AGENT_COMPATIBILITY.md # compatibility alias
629
- ├── LOOP_ENGINEERING.md # canonical operating cycle
630
- ├── GUIDE_ROUTER.md # contextual guide selection
631
- ├── PROJECT_PROFILE.md # source profile (target copy is under .forgeloop/kit/)
632
- ├── LOOP_SYSTEM_DESIGN.md # architecture and boundaries
633
- ├── THIRD_PARTY_NOTICES.md # provenance and rights
634
- ├── LICENSE # CLI and validator code license
635
- ├── LICENSE-DOCS.md # original documentation license boundary
636
- ├── ENG/ # package-source English guides
637
- ├── .cursor/rules/ # always-active Cursor rule
638
- ├── .github/copilot-instructions.md # GitHub Copilot entry point
639
- ├── .github/workflows/ # quality automation
640
- ├── scripts/ # structural, language, and secret checks
641
- ├── tests/ # validator regression tests
642
- ├── src/ # npm CLI implementation
643
- ├── .gitignore # ignored local files
644
- ├── .lychee.toml # link-check configuration
645
- ├── .markdownlint-cli2.jsonc # Markdown rules
646
- └── README.md
647
- ```
648
-
649
- The source repository keeps canonical documents at the root for package
650
- development and validation. A bootstrapped target uses the hidden-kit layout
651
- shown above; mutable contract, route, state, gate, event, preflight, and
652
- receipt artifacts remain directly under `.forgeloop/`.
653
-
654
- ## Maintenance
655
-
656
- - Preserve guide requirements, exceptions, numbers, examples, and references when editing.
657
- - Update `version` and `last-reviewed` when a guide's normative content changes.
658
- - Verify that relative links remain inside the repository.
659
- - Keep root instructions, comments, examples, fixtures, and guide content in English.
660
- - Keep `THIRD_PARTY_NOTICES.md` with every distributed copy of the kit.
185
+ | Blender, FreeCAD, Office, browser-backed visualization, and `edu-agent` | System dependencies and upstream configuration; `edu-agent` TTS also needs `DASHSCOPE_API_KEY` |
661
186
 
662
- ### Workflow quality gates
187
+ Credentials belong in the process environment or the official Qwen
188
+ configuration file, never in Git, `.forgeloop/kit/PROJECT_PROFILE.md`, or
189
+ copied instruction files. ForgeLoop does not vendor Qwen code or install it
190
+ through `init`, `update`, or `doctor`.
663
191
 
664
- For non-trivial behavior changes, use the proportional design, plan, test, and
665
- review gates in [`LOOP_ENGINEERING.md`](./LOOP_ENGINEERING.md). Keep adapters
666
- and entry-point instructions thin so the canonical workflow stays in one place.
192
+ ## Cross-harness continuity
667
193
 
668
- ### Local checks
194
+ ForgeLoop can optionally persist bounded execution-continuity context for a
195
+ resumable task so another compatible harness can reconcile the current checkout
196
+ and continue without replacing the task contract. Continuity is operational
197
+ context only; it is never verification evidence or authority. See
198
+ [`EXECUTION_STATE.md`](./EXECUTION_STATE.md) and
199
+ [`LOOP_ENGINEERING.md`](./LOOP_ENGINEERING.md).
669
200
 
670
- First check whether the Markdown linter is already installed:
201
+ ## Release and maintenance
671
202
 
672
- ```bash
673
- command -v markdownlint-cli2
674
- ```
675
-
676
- When it is available, run it directly without downloading anything:
203
+ The release workflow uses [npm trusted publishing](https://docs.npmjs.com/trusted-publishers)
204
+ through GitHub Actions OIDC. A `vX.Y.Z` tag must match `package.json`; after
205
+ publishing, verify the immutable release identity:
677
206
 
678
207
  ```bash
679
- markdownlint-cli2
208
+ RELEASE_COMMIT="$(git rev-list -n1 vX.Y.Z)"
209
+ npm run release:identity -- --version X.Y.Z --release-commit "$RELEASE_COMMIT"
680
210
  ```
681
211
 
682
- If it is missing, request approval before running this pinned one-off download:
683
-
684
- ```bash
685
- npx --yes markdownlint-cli2@0.23.2
686
- ```
212
+ Only `RELEASE_IDENTITY_VALID` is sufficient. Publication, pull requests,
213
+ merges, releases, and deployments are external actions and are never inferred
214
+ from local test success.
687
215
 
688
- In a checkout of this source repository, run the repository validators with
689
- Python's standard library:
216
+ When updating a target, preserve `.forgeloop/kit/PROJECT_PROFILE.md`, compare
217
+ adapters before replacement, and run the repository checks. Python validators
218
+ remain frozen CI-only compatibility tools; their scope and invocation are
219
+ documented in [`scripts/CI_VALIDATORS.md`](./scripts/CI_VALIDATORS.md).
690
220
 
691
221
  ```bash
692
- python3 scripts/validate_loop_system.py --self-test
693
- python3 scripts/validate_loop_system.py
694
- python3 scripts/validate_markdown.py --self-test
695
- python3 scripts/validate_markdown.py
696
- python3 -m unittest discover -s tests -v
697
- python3 scripts/scan_secrets.py
222
+ npm ci
223
+ npm test
224
+ npm run lint
225
+ npm run coverage
226
+ npm run pack:check
227
+ npm run dependency:policy
228
+ npm run docs:flow
229
+ npm run docs:check
698
230
  ```
699
231
 
700
- The [Docs quality workflow](./.github/workflows/docs-quality.yml) also checks
701
- Markdown, links, frontmatter, unique names, code fences, relative links,
702
- adapters, the guide catalog, routing scenarios, and secret-shaped values on
703
- pushes and pull requests.
232
+ ## Repository structure
704
233
 
705
- ## Rights and provenance
706
-
707
- The CLI and validator code use the MIT text in [`LICENSE`](./LICENSE). Original
708
- documentation uses CC BY 4.0 as described in [`LICENSE-DOCS.md`](./LICENSE-DOCS.md),
709
- and adapted or externally sourced material remains subject to the conditions in
710
- [`THIRD_PARTY_NOTICES.md`](./THIRD_PARTY_NOTICES.md). The npm `license` field
711
- points to the code license; it does not relicense the bundled documentation.
234
+ ```text
235
+ src/ npm CLI and protocol implementation
236
+ schemas/ versioned artifact schemas
237
+ ENG/ package-source engineering guides
238
+ docs/forgeloop-flow.mmd canonical Mermaid source
239
+ docs/assets/ committed diagram render
240
+ scripts/ checks, renderer, release identity, CI notes
241
+ tests/ Node and Python regression coverage
242
+ .forgeloop/ local protocol ledger and mutable artifacts
243
+ DOCS_INDEX.md documentation map and ownership boundaries
244
+ ```
245
+
246
+ The source repository keeps canonical documents at the root. A bootstrapped
247
+ target uses the hidden kit layout; mutable protocol artifacts remain directly
248
+ under `.forgeloop/`.
249
+
250
+ For document ownership, guide routing, capability degradation, and integration
251
+ details, start at [`DOCS_INDEX.md`](./DOCS_INDEX.md).