@cassiomc1/forgeloop 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/.cursor/rules/project-loop.mdc +18 -0
  2. package/.forgeloop/.gitignore +2 -0
  3. package/.github/copilot-instructions.md +16 -0
  4. package/AGENTS.md +16 -0
  5. package/AGENT_COMPATIBILITY.md +147 -0
  6. package/CLAUDE.md +14 -0
  7. package/CONTRACT_COVERAGE.md +27 -0
  8. package/DELEGATION_PROTOCOL.md +91 -0
  9. package/ENG/accessibility-eng.md +155 -0
  10. package/ENG/clean-code-eng.md +223 -0
  11. package/ENG/design-code-eng.md +511 -0
  12. package/ENG/games-code-design-web-eng.md +751 -0
  13. package/ENG/perf-code-eng.md +441 -0
  14. package/ENG/premium-sites-studio-eng.md +320 -0
  15. package/ENG/sec-code-eng.md +706 -0
  16. package/ENG/test-code-eng.md +257 -0
  17. package/EXECUTION_STATE.md +107 -0
  18. package/GUIDE_ROUTER.md +274 -0
  19. package/LICENSE +21 -0
  20. package/LICENSE-DOCS.md +13 -0
  21. package/LOOP_ENGINEERING.md +551 -0
  22. package/LOOP_SYSTEM_DESIGN.md +394 -0
  23. package/ORCHESTRATOR_INTEGRATION.md +106 -0
  24. package/PROJECT_PROFILE.md +124 -0
  25. package/QUALITY_SCORECARD.md +54 -0
  26. package/README.md +492 -0
  27. package/TERMINOLOGY.md +21 -0
  28. package/THIRD_PARTY_NOTICES.md +129 -0
  29. package/THREAT_MODEL.md +35 -0
  30. package/package.json +51 -0
  31. package/schemas/delegated-result.schema.json +33 -0
  32. package/schemas/evidence.schema.json +15 -0
  33. package/schemas/execution-receipt.schema.json +46 -0
  34. package/schemas/routing-input.schema.json +17 -0
  35. package/schemas/routing-result.schema.json +17 -0
  36. package/schemas/task-brief.schema.json +24 -0
  37. package/schemas/work-state.schema.json +46 -0
  38. package/src/cli.js +341 -0
  39. package/src/commands/clear-state.js +11 -0
  40. package/src/commands/doctor.js +165 -0
  41. package/src/commands/init.js +42 -0
  42. package/src/commands/inspect.js +17 -0
  43. package/src/commands/route.js +32 -0
  44. package/src/commands/status.js +29 -0
  45. package/src/commands/update.js +109 -0
  46. package/src/commands/validate-protocol.js +133 -0
  47. package/src/commands/validate-receipt.js +19 -0
  48. package/src/commands/validate-state.js +30 -0
  49. package/src/core/agent-support.js +89 -0
  50. package/src/core/conformance.js +133 -0
  51. package/src/core/delegation.js +283 -0
  52. package/src/core/evidence.js +56 -0
  53. package/src/core/filesystem.js +122 -0
  54. package/src/core/inspect.js +115 -0
  55. package/src/core/json-safety.js +54 -0
  56. package/src/core/manifest.js +75 -0
  57. package/src/core/protocol.js +81 -0
  58. package/src/core/receipt.js +129 -0
  59. package/src/core/repository.js +19 -0
  60. package/src/core/router.js +296 -0
  61. package/src/core/schema-validation.js +179 -0
  62. package/src/core/templates.js +56 -0
  63. package/src/core/work-state.js +471 -0
@@ -0,0 +1,394 @@
1
+ # Universal Engineering Loop — System Design
2
+
3
+ **Status:** Implemented; repository checks validate the system contract.
4
+
5
+ ## Objective
6
+
7
+ Turn this collection into a portable instruction kit for future projects. After the kit is copied into a repository, requests handled by a compatible agent enter a cycle of discovery, guide selection, execution, verification, and correction.
8
+
9
+ The system should use every guide that materially helps the task without loading irrelevant documents or replacing project-specific instructions with generic defaults.
10
+
11
+ ## Primary decisions
12
+
13
+ - The package supports Codex, Claude Code, Cursor, GitHub Copilot, Antigravity,
14
+ OpenCode, Hermes, Pi, Command Code, and Freebuff.
15
+ - Codex, Claude Code, Cursor, and GitHub Copilot use native entry files; the
16
+ other six agents consume the shared `AGENTS.md` entry point.
17
+ - The portable instruction layer uses Markdown and each agent's native instruction mechanism; the optional local Node CLI validates and installs the kit without an agent runtime or third-party dependency.
18
+ - English is the only language used by repository content and guide metadata.
19
+ - The agent uses all applicable guides, not every file indiscriminately.
20
+ - Design, planning, test-first, and review process gates live in the canonical loop and scale with task risk instead of becoming unconditional boilerplate in every adapter or architecture note.
21
+ - The persistent project profile stores only verifiable facts and never secrets, tokens, or credentials.
22
+ - The loop continues while safe progress is possible. Repetition without new evidence triggers hypothesis reassessment or a blocked result, not infinite retries.
23
+ - Third-party provenance and reuse boundaries remain part of every portable copy.
24
+ - Qwen-MM-Plugins is an optional, task-scoped capability extension: the agent checks native support first, installs the smallest missing capability when needed, and verifies it before use; it is not a package or runtime dependency.
25
+
26
+ ## Alternatives considered
27
+
28
+ ### One large file
29
+
30
+ Combining the loop, routing rules, and technical content would simplify copying but increase context use, duplicate guide material, and make maintenance harder. This option was rejected.
31
+
32
+ ### Thin adapters with canonical modules
33
+
34
+ Small entry points for each agent, one central loop, one router, and specialized guides preserve modularity and allow the agent to load only relevant context. This is the selected architecture.
35
+
36
+ ### Generated configuration
37
+
38
+ A tool could detect the stack and generate instructions automatically, but that would add installation, compatibility, and maintenance costs before the need is proven. It may become a later enhancement but is outside the first version.
39
+
40
+ ## Architecture
41
+
42
+ The ForgeLoop system is organized around three observable control surfaces:
43
+ deterministic routing, checkpointed state, and evidence that can be inspected by
44
+ the compatible harness.
45
+
46
+ ```text
47
+ FORGELOOP
48
+
49
+ ┌─────────────┼─────────────┐
50
+ │ │ │
51
+ ROUTING STATE EVIDENCE
52
+ │ │ │
53
+ ▼ ▼ ▼
54
+ deterministic checkpoint observable
55
+ decisions facts claims
56
+ │ │ │
57
+ │ ┌─────┴─────┐ │
58
+ │ │ │ │
59
+ │ repository contract │
60
+ │ │ │ │
61
+ │ └─────┬─────┘ │
62
+ │ │ │
63
+ │ freshness │
64
+ │ │ │
65
+ └───────┬─────┴─────┬───────┘
66
+ │ │
67
+ ▼ ▼
68
+ CONFORMANCE DELEGATION
69
+ │ │
70
+ └─────┬─────┘
71
+
72
+ VALID / STALE / INVALID
73
+
74
+
75
+ compatible harness
76
+ ```
77
+
78
+ ```text
79
+ User request
80
+ |
81
+ v
82
+ Nearest agent adapter
83
+ |
84
+ +--> LOOP_ENGINEERING.md
85
+ | |
86
+ | +--> PROJECT_PROFILE.md
87
+ | +--> GUIDE_ROUTER.md
88
+ | |
89
+ | +--> ENG/*.md
90
+ |
91
+ +--> repository-specific instructions
92
+ |
93
+ v
94
+ Discovery -> contract -> route
95
+ |
96
+ v
97
+ proportional design -> plan -> change -> targeted check -> regression -> review
98
+ ^ |
99
+ +--------------- diagnosis and correction ----------+
100
+ |
101
+ v
102
+ Final result with evidence and limitations
103
+ ```
104
+
105
+ The canonical loop keeps proportional design, planning, implementation,
106
+ testing, and review visible between routing and delivery. Architecture names
107
+ the order of those stages without duplicating the detailed operating rules that
108
+ belong in `LOOP_ENGINEERING.md`.
109
+
110
+ ## Components and responsibilities
111
+
112
+ ### `AGENTS.md`
113
+
114
+ Primary entry point for Codex and agents that recognize repository instructions. It stays short and requires the loop, profile, and router to be read before execution.
115
+
116
+ ### `CLAUDE.md`
117
+
118
+ Adapter for Claude Code. It points to the same canonical source and does not repeat loop rules.
119
+
120
+ ### `.github/copilot-instructions.md`
121
+
122
+ GitHub Copilot adapter. It activates the same operational contract while preserving more specific instructions in the destination project.
123
+
124
+ ### `.cursor/rules/project-loop.mdc`
125
+
126
+ Always-applicable Cursor adapter. It delegates decisions to the loop and router.
127
+
128
+ ### `AGENT_COMPATIBILITY.md`
129
+
130
+ Human-readable support matrix for all ten agents. It explains each native entry
131
+ file, the shared `AGENTS.md` compatibility contract, official documentation,
132
+ precedence caveats, and the deterministic verification boundary.
133
+
134
+ ### `LOOP_ENGINEERING.md`
135
+
136
+ Canonical operational cycle. It defines:
137
+
138
+ - discovery of repository state and nearby instructions;
139
+ - capability discovery and task-scoped Qwen-MM-Plugins installation;
140
+ - conversion of the request into an execution contract;
141
+ - risk assessment and authority boundaries;
142
+ - guide selection;
143
+ - proportional design, planning, test-first, and review gates for behavior,
144
+ architecture, and instruction changes;
145
+ - small coherent changes;
146
+ - delivery-specific verification;
147
+ - evidence-driven diagnosis and root-cause correction;
148
+ - final regression checks;
149
+ - success and stop conditions;
150
+ - handling of destructive actions and external authority.
151
+
152
+ The loop is also the only place that defines harness-conditional behavior such
153
+ as native isolation, independent review, and capability fallback rules. The
154
+ system design references those boundaries but does not restate their detailed
155
+ criteria.
156
+
157
+ ### Capability extensions
158
+
159
+ The capability protocol is a narrow extension of the canonical loop. It asks
160
+ the agent to inspect native model and harness support, reuse an existing
161
+ callable tool, install only the smallest missing Qwen-MM-Plugins capability
162
+ when the task requires it, check API and system prerequisites, verify
163
+ registration, and then use the tool. Keyless multimodal reading is the default;
164
+ API-backed operations remain disabled until their documented credentials or
165
+ service endpoints are configured. The kit links to the upstream project but
166
+ does not bundle its source, MCP server, model, or dependencies.
167
+
168
+ ### `GUIDE_ROUTER.md`
169
+
170
+ Canonical map between request or project signals and applicable guides. Each route records:
171
+
172
+ - activation signals;
173
+ - exclusions;
174
+ - normal guide combinations;
175
+ - useful search targets;
176
+ - expected verification evidence.
177
+
178
+ ### `PROJECT_PROFILE.md`
179
+
180
+ Durable context for a destination project. The template captures:
181
+
182
+ - confirmed stack and versions;
183
+ - package manager and official commands;
184
+ - architecture and relevant directories;
185
+ - external services and risk surfaces;
186
+ - test, lint, build, and release commands;
187
+ - documentation and UI conventions;
188
+ - constraints, decisions, and unverified items;
189
+ - a source for every durable fact.
190
+
191
+ The profile changes only when discovery reveals a real project change; it is not a task diary. In this source repository, `profile-mode: template` keeps it as a reusable template. After copying it into a code repository, the first cycle may change the mode to `project` and fill only confirmed facts.
192
+
193
+ ### `DELEGATION_PROTOCOL.md`
194
+
195
+ The delegation document defines serializable task briefs, write ownership,
196
+ dependencies, normalized results, reviewer independence, and inline fallback.
197
+ It does not add agent personas, a scheduler, or a provider runtime.
198
+
199
+ ### `ORCHESTRATOR_INTEGRATION.md`
200
+
201
+ The integration contract is the graph-readiness boundary. It names the
202
+ serializable phases, transitions, invariants, artifact schemas, host
203
+ responsibilities, and inline fallback in one canonical document. It does not
204
+ implement a graph runtime or duplicate the detailed operational rules in
205
+ `LOOP_ENGINEERING.md`.
206
+
207
+ ### `THREAT_MODEL.md`
208
+
209
+ The threat model records path, symlink, artifact, secret, stale-state,
210
+ publication, schema, dependency, and resource-limit boundaries with their
211
+ mitigations, residual limitations, and executable evidence.
212
+
213
+ ### `ENG/*.md`
214
+
215
+ Eight canonical guides cover:
216
+
217
+ - clean code;
218
+ - testing;
219
+ - security;
220
+ - performance;
221
+ - design;
222
+ - accessibility;
223
+ - premium website production;
224
+ - web games.
225
+
226
+ Each guide has exact English frontmatter and a stable guide ID.
227
+
228
+ ### `THIRD_PARTY_NOTICES.md`
229
+
230
+ Records external provenance, trademarks, licenses, and reuse boundaries. It is required in the repository and in every portable copy.
231
+
232
+ ## Initial routing matrix
233
+
234
+ | Work type | Guide set |
235
+ | --- | --- |
236
+ | Documentation | Related domain and documentation checks |
237
+ | General code or bug fix | `clean`, `test`; add `security` or `performance` when the surface requires it |
238
+ | Backend, API, authentication, or data | `clean`, `test`, `security`; add `performance` for critical paths |
239
+ | Web, mobile, or desktop interface | `clean`, `test`, `design`, `accessibility`; add `security` and `performance` according to product risk |
240
+ | Complete site or landing page | `premium`, `design`, `accessibility`, `clean`, `test`, `security`, `performance` |
241
+ | Web game | `games`, `clean`, `test`, `security`, `performance`, `accessibility`; add `design` for UI or visual direction |
242
+ | HTML video or motion | `design`, `accessibility`, `performance`, `test`, `security`; use HyperFrames only when requested or already available |
243
+ | Infrastructure or CI/CD | `security`, `test`; add `performance` when availability or cost changes |
244
+
245
+ Routing uses the request and files actually affected. A single word in the repository is not enough to activate a stack or guide.
246
+
247
+ ## Execution flow
248
+
249
+ 1. Read the agent adapter and the nearest instructions for the scoped directory.
250
+ 2. Inspect manifests, configuration, documentation, tests, CI, and Git state.
251
+ 3. Confirm or update the project profile with sourced facts.
252
+ 4. Convert the request into an objective, deliverables, constraints, risks, checks, and a stop condition.
253
+ 5. Select the guide set in the router.
254
+ 6. Read only the required sections of each guide.
255
+ 7. Apply proportional design and plan gates before behavior, architecture, or instruction changes.
256
+ 8. Establish a baseline and reproduce the problem when applicable.
257
+ 9. Make the smallest coherent change that satisfies the objective.
258
+ 10. Run the targeted check first, then proportional regression checks.
259
+ 11. Use the loop's review gate after regression when the task or harness calls for self-review or independent review.
260
+ 12. On failure, collect evidence, identify the root cause, and repeat with a targeted correction.
261
+ 13. Finish only with current evidence, explicit limitations, and no unrelated changes.
262
+
263
+ ## Canonical workflow state model
264
+
265
+ The protocol represents the engineering loop with serializable conceptual
266
+ states rather than an executable graph:
267
+
268
+ ```text
269
+ RECEIVED → DISCOVERING → CONTRACT_READY → ROUTED
270
+ ├→ DESIGNING → PLANNED
271
+ └→ PLANNED
272
+ PLANNED → EXECUTING → VERIFYING
273
+ VERIFYING ├→ DIAGNOSING → CORRECTING → VERIFYING
274
+ └→ REVIEWING → COMPLETE
275
+ Any non-terminal state → BLOCKED when a genuine blocker is evidenced
276
+ ```
277
+
278
+ | From | Condition | To |
279
+ | --- | --- | --- |
280
+ | `RECEIVED` | context is required | `DISCOVERING` |
281
+ | `DISCOVERING` | sufficient sourced context | `CONTRACT_READY` |
282
+ | `CONTRACT_READY` | route is resolved | `ROUTED` |
283
+ | `ROUTED` | design decision is required | `DESIGNING` |
284
+ | `ROUTED` | no design gate is required | `PLANNED` |
285
+ | `DESIGNING` | design is approved | `PLANNED` |
286
+ | `PLANNED` | task work begins | `EXECUTING` |
287
+ | `EXECUTING` | targeted check is ready | `VERIFYING` |
288
+ | `VERIFYING` | a check fails | `DIAGNOSING` |
289
+ | `DIAGNOSING` | a fix hypothesis exists | `CORRECTING` |
290
+ | `CORRECTING` | the fix is applied | `VERIFYING` |
291
+ | `VERIFYING` | checks pass | `REVIEWING` |
292
+ | `REVIEWING` | contract and quality are accepted | `COMPLETE` |
293
+ | any non-terminal state | a genuine external blocker is evidenced | `BLOCKED` |
294
+
295
+ State invariants are machine-validatable: `COMPLETE` requires verification
296
+ evidence, `BLOCKED` requires a blocker category, `CORRECTING` requires a
297
+ diagnosed hypothesis, and `REVIEWING` cannot claim independent review from the
298
+ same identity as the implementer. Simple documentation tasks may skip design,
299
+ delegation, and full regression when the contract records why those states are
300
+ not applicable.
301
+
302
+ ## Precedence and conflicts
303
+
304
+ The system respects this order:
305
+
306
+ 1. platform and safety rules;
307
+ 2. the user's latest explicit request;
308
+ 3. more specific and nearer repository or directory instructions;
309
+ 4. applicable legal, security, and data-preservation requirements;
310
+ 5. confirmed project profile facts;
311
+ 6. router decisions;
312
+ 7. general guide recommendations.
313
+
314
+ A guide never authorizes installation, publication, deletion, migration, or an external change that the user did not place in scope.
315
+
316
+ ## Failures and stop conditions
317
+
318
+ - **Missing tool:** use an available equivalent only when it provides compatible evidence; otherwise request approval or report the check as not run.
319
+ - **Missing guide or broken link:** continue only with conservative defaults and disclose the limitation.
320
+ - **Missing credential:** report the blocked capability without exposing or inventing a credential.
321
+ - **Conflicting instructions:** apply precedence, choose the most conservative interpretation, and record any material decision.
322
+ - **Repeated failure without new evidence:** stop repeating the same action, reassess the hypothesis, and use another diagnostic method.
323
+ - **External or destructive action:** proceed only with explicit authority and an exact validated target.
324
+
325
+ ## Validation of the instruction system
326
+
327
+ The documentation workflow verifies:
328
+
329
+ - every file referenced by an adapter exists;
330
+ - repository-relative links resolve;
331
+ - exactly eight canonical English guides exist;
332
+ - guide IDs, filenames, frontmatter keys, and `language: en` match the catalog;
333
+ - no legacy language tree or bilingual metadata remains;
334
+ - all route contracts contain valid guide IDs;
335
+ - the canonical phase list, transition rows, state invariants, reason-code
336
+ language, graph-readiness evidence, and no-runtime boundary are present;
337
+ - Markdown and frontmatter are valid;
338
+ - secrets and credential-like assignments are absent;
339
+ - `THIRD_PARTY_NOTICES.md` is present.
340
+
341
+ The validator also exercises six routing scenarios:
342
+
343
+ 1. premium landing page;
344
+ 2. authenticated API;
345
+ 3. bug fix without UI;
346
+ 4. mobile app with UI;
347
+ 5. multiplayer web game;
348
+ 6. documentation-only change.
349
+
350
+ ## Distribution
351
+
352
+ The npm CLI installs the kit into the current directory or an existing
353
+ directory selected with `--path` when the package is available in the npm
354
+ registry. If it is not available yet, the same commands can run as
355
+ `node src/cli.js ...` from a repository checkout. A user may also download the
356
+ repository or a release archive and copy these items while preserving their
357
+ relative structure:
358
+
359
+ - the four native agent adapters plus `AGENT_COMPATIBILITY.md`;
360
+ - the shared `AGENTS.md` entry point for the six compatible agents;
361
+ - `LOOP_ENGINEERING.md`;
362
+ - `GUIDE_ROUTER.md`;
363
+ - `PROJECT_PROFILE.md`;
364
+ - `THIRD_PARTY_NOTICES.md`;
365
+ - `LICENSE` and `LICENSE-DOCS.md`;
366
+ - the `ENG/` guide directory.
367
+
368
+ The README explains the file set, activation behavior, current/relative/absolute
369
+ target installation, first-run profile flow, local validation commands, and safe
370
+ update practice.
371
+
372
+ ## Out of scope
373
+
374
+ - remote prompt services or databases;
375
+ - mandatory orchestration frameworks;
376
+ - infinite or unattended execution beyond agent limits;
377
+ - automatic installation of unrelated tools or provider runtimes; task-scoped
378
+ Qwen-MM-Plugins capability installation remains governed by the canonical
379
+ capability protocol and host approval controls;
380
+ - automatic modification of global computer files;
381
+ - duplication of complete guides inside adapters;
382
+ - versioned logs for every request.
383
+
384
+ ## Acceptance criteria
385
+
386
+ - The repository and its maintained content are English-only.
387
+ - All ten supported agents have a documented entry into one canonical loop,
388
+ with native adapters distinguished from shared `AGENTS.md` compatibility.
389
+ - The router selects every relevant guide and excludes irrelevant guides in the six defined scenarios.
390
+ - The profile contains verifiable facts, sources, and real commands without secrets.
391
+ - The loop requires evidence before completion claims and exits safely when blocked.
392
+ - Structural, Markdown, link, and secret checks pass locally and in CI.
393
+ - Portable-copy instructions always include third-party notices.
394
+ - The package does not alter destination commands, dependencies, or behavior without need and applicable authority.
@@ -0,0 +1,106 @@
1
+ # Orchestrator integration contract
2
+
3
+ `ForgeLoop` is a portable protocol, not an orchestrator. A compatible harness
4
+ may map these serializable contracts to its own state machine, worker pool, or
5
+ review primitive without adding that framework to the package.
6
+
7
+ ## Canonical workflow diagram
8
+
9
+ ```text
10
+ RECEIVED → DISCOVERING → CONTRACT_READY → ROUTED
11
+ ├→ DESIGNING → PLANNED
12
+ └→ PLANNED
13
+ PLANNED → EXECUTING → VERIFYING
14
+ VERIFYING ├→ DIAGNOSING → CORRECTING → VERIFYING
15
+ └→ REVIEWING → COMPLETE
16
+ Any non-terminal state → BLOCKED when a genuine blocker is evidenced
17
+ ```
18
+
19
+ ## Phase names
20
+
21
+ - `RECEIVED`
22
+ - `DISCOVERING`
23
+ - `CONTRACT_READY`
24
+ - `ROUTED`
25
+ - `DESIGNING`
26
+ - `PLANNED`
27
+ - `EXECUTING`
28
+ - `VERIFYING`
29
+ - `DIAGNOSING`
30
+ - `CORRECTING`
31
+ - `REVIEWING`
32
+ - `COMPLETE`
33
+ - `BLOCKED`
34
+
35
+ ## Canonical transition table
36
+
37
+ | From | Condition | To |
38
+ | --- | --- | --- |
39
+ | `RECEIVED` | context is required | `DISCOVERING` |
40
+ | `DISCOVERING` | sufficient sourced context | `CONTRACT_READY` |
41
+ | `CONTRACT_READY` | route is resolved | `ROUTED` |
42
+ | `ROUTED` | design decision is required | `DESIGNING` |
43
+ | `ROUTED` | no design gate is required | `PLANNED` |
44
+ | `DESIGNING` | design is approved | `PLANNED` |
45
+ | `PLANNED` | task work begins | `EXECUTING` |
46
+ | `EXECUTING` | targeted check is ready | `VERIFYING` |
47
+ | `VERIFYING` | a check fails | `DIAGNOSING` |
48
+ | `DIAGNOSING` | a fix hypothesis exists | `CORRECTING` |
49
+ | `CORRECTING` | the fix is applied | `VERIFYING` |
50
+ | `VERIFYING` | checks pass | `REVIEWING` |
51
+ | `REVIEWING` | contract and quality are accepted | `COMPLETE` |
52
+ | `Any non-terminal state` | a genuine external blocker is evidenced | `BLOCKED` |
53
+
54
+ The host may skip proportional phases, but it must preserve the state
55
+ invariants and record why a skipped phase was not applicable.
56
+
57
+ ## State invariants
58
+
59
+ - `COMPLETE` requires verification evidence current to the task.
60
+ - `BLOCKED` requires blocker evidence, a category, and a safe next action.
61
+ - `CORRECTING` requires a diagnosed hypothesis and a changed evidence basis.
62
+ - `REVIEWING` cannot claim independent review when reviewer and implementer
63
+ identities are equal.
64
+ - A retry requires new evidence or a changed hypothesis.
65
+
66
+ ## Serializable interfaces
67
+
68
+ The following JSON Schemas define the boundaries a host may implement:
69
+
70
+ - `schemas/routing-input.schema.json` and
71
+ `schemas/routing-result.schema.json` define deterministic guide selection
72
+ after semantic signals are declared.
73
+ - `schemas/work-state.schema.json` defines local checkpoint/resume data.
74
+ - `schemas/execution-receipt.schema.json` defines structured evidence and
75
+ explicit publication state.
76
+ - `schemas/task-brief.schema.json` and
77
+ `schemas/delegated-result.schema.json` define optional delegation.
78
+ - `schemas/evidence.schema.json` defines the shared evidence vocabulary.
79
+
80
+ `src/core/conformance.js` validates relationships that individual schemas
81
+ cannot express: route/state protocol versions, route/state guide sets,
82
+ state/receipt contract fingerprints, and delegated-result/task-brief IDs. Its
83
+ statuses are `VALID`, `INCOMPLETE`, `STALE`, `INCONSISTENT`, and `INVALID`.
84
+ `forgeloop validate-protocol` is read-only and reports the exact failed
85
+ invariant.
86
+
87
+ Every artifact is JSON-compatible, carries `schemaVersion: 1` and
88
+ `protocolVersion: 1`, and contains no executable callbacks, provider-specific
89
+ tool objects, credentials, hidden prompts, or remote database references.
90
+
91
+ ## Host responsibilities
92
+
93
+ The compatible harness owns model execution, tool execution, scheduling,
94
+ parallelism, lifecycle, isolation, and any remote services. It must pass
95
+ validated inputs to the protocol, preserve file ownership, report unavailable
96
+ capabilities, and never turn local success into an unverified publication
97
+ claim.
98
+
99
+ ## No-runtime boundary
100
+
101
+ The protocol does not provide a graph runtime.
102
+ The protocol does not provide a provider adapter.
103
+ The protocol does not provide a scheduler.
104
+ No runtime required: inline execution is the valid fallback when the host has
105
+ no subagents or worktrees. A future host may add those capabilities outside the
106
+ package, but must preserve the serialized contracts and explicit limitations.
@@ -0,0 +1,124 @@
1
+ ---
2
+ language: en
3
+ profile-mode: template
4
+ profile-status: uninitialized
5
+ last-confirmed: unknown
6
+ ---
7
+
8
+ # Project Profile
9
+
10
+ > Durable context for [Loop Engineering](./LOOP_ENGINEERING.md). Fill it only
11
+ > with evidence from the target project.
12
+
13
+ ## Maintenance rules
14
+
15
+ - Update a fact only after inspecting authoritative files, commands, or sources.
16
+ - Preserve `profile-mode: template` while maintaining this source kit. In a target project with product code or manifests, change it to `project` during the first discovery cycle.
17
+ - Record the source for every material fact.
18
+ - Never store secrets, tokens, passwords, private keys, or raw credentials.
19
+ - Preserve explicit project decisions until newer evidence replaces them.
20
+ - Set `profile-status` to `verified` only when the stack, essential architecture, and critical commands have evidence.
21
+ - Keep `language: en`; this kit has no alternate language variant.
22
+ - Do not use this file as a task diary.
23
+
24
+ ## Product and objective
25
+
26
+ | Field | Current state | Source |
27
+ | --- | --- | --- |
28
+ | Product | Not identified — confirm from the stated source | Source not identified |
29
+ | Users | Not identified — confirm from the stated source | Source not identified |
30
+ | Primary outcome | Not identified — confirm from the stated source | Source not identified |
31
+ | Durable exclusions | Not identified — confirm from the stated source | Source not identified |
32
+
33
+ ## Confirmed stack
34
+
35
+ | Layer | Technology and version | Source |
36
+ | --- | --- | --- |
37
+ | Frontend | Not identified — confirm from the stated source | Source not identified |
38
+ | Backend | Not identified — confirm from the stated source | Source not identified |
39
+ | Mobile | Not identified — confirm from the stated source | Source not identified |
40
+ | Desktop | Not identified — confirm from the stated source | Source not identified |
41
+ | Data | Not identified — confirm from the stated source | Source not identified |
42
+ | Infrastructure | Not identified — confirm from the stated source | Source not identified |
43
+
44
+ Record a missing manifest or configuration as verified absence. Do not infer a
45
+ stack from technology names found only in documentation or examples.
46
+
47
+ ## Official commands
48
+
49
+ | Purpose | Confirmed command | Source |
50
+ | --- | --- | --- |
51
+ | Installation | Not identified — confirm from the stated source | Source not identified |
52
+ | Development | Not identified — confirm from the stated source | Source not identified |
53
+ | Specific test | Not identified — confirm from the stated source | Source not identified |
54
+ | Full test suite | Not identified — confirm from the stated source | Source not identified |
55
+ | Lint and formatting | Not identified — confirm from the stated source | Source not identified |
56
+ | Typecheck | Not identified — confirm from the stated source | Source not identified |
57
+ | Build | Not identified — confirm from the stated source | Source not identified |
58
+ | Additional validation | Not identified — confirm from the stated source | Source not identified |
59
+
60
+ Never invent a command when the project already declares official scripts or
61
+ automation.
62
+
63
+ ## Architecture and directories
64
+
65
+ | Area | Path or responsibility | Source |
66
+ | --- | --- | --- |
67
+ | Primary entry point | Not identified — confirm from the stated source | Source not identified |
68
+ | Domain | Not identified — confirm from the stated source | Source not identified |
69
+ | Interfaces | Not identified — confirm from the stated source | Source not identified |
70
+ | Persistence | Not identified — confirm from the stated source | Source not identified |
71
+ | Tests | Not identified — confirm from the stated source | Source not identified |
72
+ | Documentation | Not identified — confirm from the stated source | Source not identified |
73
+ | CI/CD | Not identified — confirm from the stated source | Source not identified |
74
+
75
+ ## Supported platforms
76
+
77
+ | Surface | Confirmed targets | Evidence |
78
+ | --- | --- | --- |
79
+ | Web | Not identified — confirm from the stated source | Source not identified |
80
+ | Mobile | Not identified — confirm from the stated source | Source not identified |
81
+ | Desktop | Not identified — confirm from the stated source | Source not identified |
82
+ | Browsers and devices | Not identified — confirm from the stated source | Source not identified |
83
+ | Accessibility requirements | Not identified — confirm from the stated source | Source not identified |
84
+
85
+ ## Services and risk surfaces
86
+
87
+ | Item | Use and risk | Safe source |
88
+ | --- | --- | --- |
89
+ | Authentication and authorization | Not identified — confirm from the stated source | Source not identified |
90
+ | External APIs | Not identified — confirm from the stated source | Source not identified |
91
+ | Personal or sensitive data | Not identified — confirm from the stated source | Source not identified |
92
+ | Uploads and files | Not identified — confirm from the stated source | Source not identified |
93
+ | Payments | Not identified — confirm from the stated source | Source not identified |
94
+ | Queues, webhooks, and jobs | Not identified — confirm from the stated source | Source not identified |
95
+ | Deployment and production | Not identified — confirm from the stated source | Source not identified |
96
+
97
+ Record only the mechanism and safe configuration location. Never copy credential
98
+ values.
99
+
100
+ ## Constraints and decisions
101
+
102
+ | Decision or constraint | State | Source |
103
+ | --- | --- | --- |
104
+ | Required conventions | Not identified — confirm from the stated source | Source not identified |
105
+ | Compatibility | Not identified — confirm from the stated source | Source not identified |
106
+ | Performance budgets | Not identified — confirm from the stated source | Source not identified |
107
+ | Legal and license constraints | Not identified — confirm from the stated source | Source not identified |
108
+ | Operations requiring approval | Not identified — confirm from the stated source | Source not identified |
109
+
110
+ ## Unverified items
111
+
112
+ - Not identified — confirm from the stated source.
113
+
114
+ Remove an item from this section only after adding evidence and moving it to the
115
+ appropriate section.
116
+
117
+ ## Evidence
118
+
119
+ | Date | Confirmed fact | Source or command | Scope |
120
+ | --- | --- | --- | --- |
121
+ | Not identified | Not identified — confirm from the stated source | Source not identified | Not identified |
122
+
123
+ Keep evidence concise. Long outputs, temporary logs, and per-task history do not
124
+ belong in this file.
@@ -0,0 +1,54 @@
1
+ # ForgeLoop quality scorecard
2
+
3
+ This scorecard measures evidence-backed protocol quality. A dimension reaches
4
+ 10/10 only when its documented contract, deterministic structure, positive and
5
+ negative checks, failure behavior, portability boundary, and compatibility
6
+ policy are all present.
7
+
8
+ | Dimension | 10/10 evidence |
9
+ | --- | --- |
10
+ | Loop engineering | Failure taxonomy, retry rule, invariants, evidence categories, and semantic tests in `LOOP_ENGINEERING.md`. |
11
+ | Routing | `src/core/router.js`, versioned route schemas, reason codes, exclusions, and positive/negative fixtures. |
12
+ | Workflow model | Canonical phases, transition table, state invariants, proportional skips, and `LOOP_SYSTEM_DESIGN.md`. |
13
+ | Protocol executability | Versioned JSON schemas, semantic cross-artifact conformance, dependency-free validation, and compatibility fixtures. |
14
+ | Graph readiness | Serializable state/transition contracts and `ORCHESTRATOR_INTEGRATION.md`; no runtime required. |
15
+ | Portability | Node 20/22/24 Linux depth, OS smoke coverage, path/line-ending fixtures, and adapter compatibility evidence. |
16
+ | Observability | `inspect`/`status`/`validate-protocol` shared derived state classification, real schema health, shared evidence, rich doctor findings, receipts, and no telemetry. |
17
+ | Resume/checkpoint | Atomic local state, contract/HEAD/artifact freshness, age warning, schema/secret validation, status, safe validation, and bounded clearing without persisting derived freshness fields. |
18
+ | Multi-agent coordination | Self-contained briefs, write/write and write/read ownership checks, dependency-set validation, reviewer independence, normalized results, and inline fallback. |
19
+ | Security boundaries | Realpath containment, bounded untrusted JSON, threat model, nested secret scanning, publication evidence, and explicit authority rules. |
20
+ | Maintenance quality | Small modules, built-in runtime, deterministic JSON contracts, malformed/version fixtures, package gates, and backward-compatible protocol versions. |
21
+
22
+ ## Score rules
23
+
24
+ - `Observed` evidence is a command result, file, hash, or test output available
25
+ in the current checkout.
26
+ - `Inferred` evidence is a reasoned consequence of observed evidence and must
27
+ be labeled as inference.
28
+ - `Not verified` means the check was not run or the target is outside the
29
+ available environment.
30
+ - `Blocked` means a genuine external condition prevents safe progress.
31
+ - A passing local check never implies that a branch was pushed, a pull request
32
+ was merged, or a deployment succeeded.
33
+ - Literal graph runtime and runtime multi-agent orchestration are `N/A by
34
+ design`; compatible harnesses own those capabilities.
35
+
36
+ ## Evidence matrix
37
+
38
+ The score is evidence-backed only when the contract and its executable proof
39
+ are both present:
40
+
41
+ | Dimension | Implementation evidence | Executable evidence |
42
+ | --- | --- | --- |
43
+ | Routing | `src/core/router.js`, route schemas, stable reason codes, and exclusions | `tests/router.test.js`, `tests/fixtures/routes/` |
44
+ | Observability | `src/core/receipt.js`, `src/core/inspect.js`, `src/core/evidence.js`, and schema health | `tests/observability.test.js`, `tests/receipt-semantics.test.js`, `tests/schema-health.test.js` |
45
+ | Resume/checkpoint | `src/core/work-state.js`, `EXECUTION_STATE.md`, shared loaded-state classifier, contract/artifact classifiers, and atomic writes | `tests/work-state.test.js`, `tests/checkpoint-freshness.test.js`, status, validate-state, and validate-protocol tests |
46
+ | Delegation | `src/core/delegation.js`, delegation-set validator, and `DELEGATION_PROTOCOL.md` | `tests/delegation.test.js`, `tests/delegation-set.test.js` |
47
+ | Portability | `ORCHESTRATOR_INTEGRATION.md`, adapter compatibility, and OS smoke workflow | `tests/portability.test.js`, package checks |
48
+ | Graph readiness | Serializable phase/transition mapping in `ORCHESTRATOR_INTEGRATION.md` | Python semantic validator and workflow-policy tests |
49
+ | Security boundary | realpath containment, bounded JSON, `THREAT_MODEL.md`, secret-free artifacts, authority and no-runtime rules | `tests/security-limits.test.js`, Markdown/loop validators, and `scripts/scan_secrets.py` |
50
+ | Cross-artifact conformance | `src/core/conformance.js`, `classifyLoadedWorkState`, and `forgeloop validate-protocol --contract-file` | `tests/conformance.test.js`, `tests/validate-protocol-cli.test.js`, and protocol fixtures covering precedence and stale evidence |
51
+
52
+ The implementation references above are local observations. OS runners,
53
+ remote links, provider sessions, publication, and deployment remain `Not
54
+ verified` unless their own checks produce current evidence.