@cassiomc1/forgeloop 0.1.1 → 0.1.3

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 (103) hide show
  1. package/.cursor/rules/project-loop.mdc +12 -1
  2. package/.github/copilot-instructions.md +11 -0
  3. package/AGENTS.md +13 -1
  4. package/AGENT_COMPATIBILITY.md +14 -1
  5. package/CLAUDE.md +11 -1
  6. package/ENG/accessibility-eng.md +5 -0
  7. package/ENG/clean-code-eng.md +1 -0
  8. package/ENG/design-code-eng.md +5 -0
  9. package/ENG/games-code-design-web-eng.md +6 -0
  10. package/ENG/perf-code-eng.md +3 -0
  11. package/ENG/premium-sites-studio-eng.md +9 -0
  12. package/ENG/sec-code-eng.md +5 -0
  13. package/ENG/test-code-eng.md +3 -0
  14. package/GUIDE_ROUTER.md +16 -0
  15. package/LOOP_ENGINEERING.md +163 -4
  16. package/ORCHESTRATOR_INTEGRATION.md +15 -0
  17. package/QUALITY_SCORECARD.md +16 -0
  18. package/README.md +64 -1
  19. package/THREAT_MODEL.md +6 -0
  20. package/conformance/README.md +47 -0
  21. package/conformance/backend-auth/EXPECTED_ROUTE.json +7 -0
  22. package/conformance/backend-auth/REQUEST.md +4 -0
  23. package/conformance/backend-auth/REQUIRED_EVIDENCE.json +3 -0
  24. package/conformance/backend-auth/REQUIRED_GATES.json +3 -0
  25. package/conformance/blind-premium-website/EXPECTED_ROUTE.json +7 -0
  26. package/conformance/blind-premium-website/REQUEST.md +6 -0
  27. package/conformance/blind-premium-website/REQUIRED_EVIDENCE.json +14 -0
  28. package/conformance/blind-premium-website/REQUIRED_GATES.json +3 -0
  29. package/conformance/complete-website/EXPECTED_ROUTE.json +7 -0
  30. package/conformance/complete-website/REQUEST.md +6 -0
  31. package/conformance/complete-website/REQUIRED_EVIDENCE.json +3 -0
  32. package/conformance/complete-website/REQUIRED_GATES.json +3 -0
  33. package/conformance/docs-only/EXPECTED_ROUTE.json +7 -0
  34. package/conformance/docs-only/REQUEST.md +4 -0
  35. package/conformance/docs-only/REQUIRED_EVIDENCE.json +3 -0
  36. package/conformance/docs-only/REQUIRED_GATES.json +3 -0
  37. package/conformance/runs/2026-08-11-codex-first-live.md +98 -0
  38. package/conformance/runs/2026-08-11-codex-second-live.md +87 -0
  39. package/conformance/simple-bug/EXPECTED_ROUTE.json +7 -0
  40. package/conformance/simple-bug/REQUEST.md +4 -0
  41. package/conformance/simple-bug/REQUIRED_EVIDENCE.json +3 -0
  42. package/conformance/simple-bug/REQUIRED_GATES.json +3 -0
  43. package/package.json +4 -3
  44. package/schemas/activation.schema.json +15 -0
  45. package/schemas/check.schema.json +23 -0
  46. package/schemas/config.schema.json +16 -0
  47. package/schemas/current-contract.schema.json +50 -0
  48. package/schemas/event.schema.json +20 -0
  49. package/schemas/evidence-coverage.schema.json +17 -0
  50. package/schemas/execution-receipt.schema.json +10 -0
  51. package/schemas/gate.schema.json +32 -0
  52. package/schemas/policy.schema.json +19 -0
  53. package/schemas/preflight.schema.json +23 -0
  54. package/schemas/routing-result.schema.json +1 -0
  55. package/schemas/source-registry.schema.json +29 -0
  56. package/schemas/task-bundle.schema.json +14 -0
  57. package/schemas/work-state.schema.json +7 -1
  58. package/src/cli.js +249 -9
  59. package/src/commands/activate.js +11 -0
  60. package/src/commands/advance.js +12 -0
  61. package/src/commands/audit.js +12 -0
  62. package/src/commands/bundle.js +10 -0
  63. package/src/commands/complete.js +18 -0
  64. package/src/commands/next.js +29 -0
  65. package/src/commands/policy.js +19 -0
  66. package/src/commands/preflight.js +12 -0
  67. package/src/commands/prepare-completion.js +18 -0
  68. package/src/commands/record-check.js +20 -0
  69. package/src/commands/report.js +10 -0
  70. package/src/commands/route.js +14 -2
  71. package/src/commands/validate-receipt.js +7 -6
  72. package/src/core/activation.js +16 -0
  73. package/src/core/artifacts.js +132 -0
  74. package/src/core/audit.js +88 -0
  75. package/src/core/bundles.js +120 -0
  76. package/src/core/checks.js +115 -0
  77. package/src/core/completion-artifacts.js +321 -0
  78. package/src/core/completion-relationships.js +141 -0
  79. package/src/core/completion.js +266 -0
  80. package/src/core/config.js +35 -0
  81. package/src/core/conformance.js +7 -0
  82. package/src/core/contract.js +141 -0
  83. package/src/core/coverage.js +89 -0
  84. package/src/core/events.js +158 -0
  85. package/src/core/execution-prerequisites.js +200 -0
  86. package/src/core/gate-artifact.js +54 -0
  87. package/src/core/gates.js +55 -0
  88. package/src/core/guide-metadata.js +62 -0
  89. package/src/core/next-action.js +709 -0
  90. package/src/core/phase.js +212 -0
  91. package/src/core/policies.js +69 -0
  92. package/src/core/preflight.js +409 -0
  93. package/src/core/profile.js +48 -0
  94. package/src/core/protocol.js +34 -0
  95. package/src/core/receipt.js +40 -1
  96. package/src/core/report.js +49 -0
  97. package/src/core/repository.js +18 -0
  98. package/src/core/route-artifact.js +33 -0
  99. package/src/core/router.js +16 -8
  100. package/src/core/schema-validation.js +11 -0
  101. package/src/core/sources.js +86 -0
  102. package/src/core/templates.js +11 -0
  103. package/src/core/work-state.js +41 -13
@@ -13,6 +13,17 @@ alwaysApply: true
13
13
  6. Make the minimum change, run a specific check, and then run proportional regression checks.
14
14
  7. Diagnose failures before fixing them and do not repeat an attempt without new evidence.
15
15
  8. Request authority for unrelated external or destructive actions, installations, and publications. For a task-scoped missing Qwen-MM-Plugins capability, follow `LOOP_ENGINEERING.md`; API credentials and system dependencies remain separately gated.
16
- 9. Report only demonstrated results and checks.
16
+ 9. After implementation begins, do not return a final result in `EXECUTING`: follow `VERIFYING` → structured evidence → `REVIEWING` → execution receipt → validator-backed `COMPLETE`; otherwise report `BLOCKED` or `PARTIALLY VERIFIED` with exact findings.
17
+
18
+ After implementation work for the current task is complete, run `forgeloop next`
19
+ before returning a final result. Follow the returned lifecycle action until
20
+ ForgeLoop reaches a terminal state or an explicit blocker.
21
+
22
+ 10. Report only demonstrated results and checks.
23
+
24
+ Do not stop for non-blocking missing product details. When a safe, reversible
25
+ local default exists, record it as an agent assumption and follow the Blocking vs Non-Blocking Decisions policy in `LOOP_ENGINEERING.md`. Ask only for
26
+ load-bearing, irreversible, externally consequential, unsafe, or real
27
+ user/business decisions.
17
28
 
18
29
  The loop and router are canonical sources; do not duplicate domain rules.
@@ -11,6 +11,17 @@ directory or file rules.
11
11
  - Make the smallest coherent change and validate it with a specific check followed by proportional regression checks.
12
12
  - Diagnose the cause before fixing a failure; do not make random attempts.
13
13
  - Do not install unrelated software, publish, delete, migrate, or alter external state without authority. For a task-scoped missing Qwen-MM-Plugins capability, follow `LOOP_ENGINEERING.md`; API credentials and system dependencies remain separately gated.
14
+ - After implementation begins, do not return a final result in `EXECUTING`: follow `VERIFYING` → structured evidence → `REVIEWING` → execution receipt → validator-backed `COMPLETE`; otherwise report `BLOCKED` or `PARTIALLY VERIFIED` with exact findings.
15
+
16
+ After implementation work for the current task is complete, run `forgeloop next`
17
+ before returning a final result. Follow the returned lifecycle action until
18
+ ForgeLoop reaches a terminal state or an explicit blocker.
19
+
14
20
  - Report the result, checks actually run, limitations, and publication state.
15
21
 
22
+ Do not stop for non-blocking missing product details. When a safe, reversible
23
+ local default exists, record it as an agent assumption and follow the Blocking vs Non-Blocking Decisions policy in `LOOP_ENGINEERING.md`. Ask only for
24
+ load-bearing, irreversible, externally consequential, unsafe, or real
25
+ user/business decisions.
26
+
16
27
  The loop and router are canonical; do not replicate domain rules here.
package/AGENTS.md CHANGED
@@ -11,6 +11,18 @@ specific rule overrides them.
11
11
  6. Make the smallest coherent change, run specific checks, and then run proportional regression checks.
12
12
  7. Diagnose a failure before fixing it; do not repeat the same attempt without new evidence.
13
13
  8. Do not install unrelated software, publish, delete, migrate data, or change external systems without applicable authority. For a task-scoped missing Qwen-MM-Plugins capability, follow the discovery protocol in `LOOP_ENGINEERING.md`; API credentials and system dependencies remain separately gated.
14
- 9. Finish with the result, checks actually run, limitations, and publication state.
14
+ 9. Before implementation, create/validate `.forgeloop/current-contract.json`, persist deterministic routing, satisfy mandatory gates, and require `forgeloop preflight` to return `READY`.
15
+ 10. Before claiming `COMPLETE`, require `forgeloop complete` to return `VALID`; otherwise report completion as not protocol-verified.
16
+ 11. After implementation begins, do not return a final result in `EXECUTING`: advance through `VERIFYING`, record structured evidence, reach `REVIEWING`, prepare/update the execution receipt, and require `forgeloop complete` to return `VALID`. If closure cannot be reached, report `BLOCKED` or `PARTIALLY VERIFIED` with exact findings.
17
+
18
+ 12. After implementation work for the current task is complete, run `forgeloop next`
19
+ before returning a final result. Follow the returned lifecycle action until
20
+ ForgeLoop reaches a terminal state or an explicit blocker.
21
+ 13. Finish with the result, checks actually run, limitations, and publication state.
22
+
23
+ Do not stop for non-blocking missing product details. When a safe, reversible
24
+ local default exists, record it as an agent assumption and follow the Blocking vs Non-Blocking Decisions policy in `LOOP_ENGINEERING.md`. Ask only for
25
+ load-bearing, irreversible, externally consequential, unsafe, or real
26
+ user/business decisions.
15
27
 
16
28
  The guides provide technical defaults; explicit requirements and project evidence prevail.
@@ -4,6 +4,19 @@
4
4
  native entry point required by each supported agent. The package does not
5
5
  install an agent, configure a provider, or run a live model session.
6
6
 
7
+ Compatibility has three distinct levels:
8
+
9
+ - `ADAPTER_COMPATIBLE`: the harness recognizes the installed instruction entry
10
+ file.
11
+ - `PROTOCOL_CAPABLE`: the harness can create the local contract, route, gates,
12
+ state, evidence, and receipt artifacts and run the validators.
13
+ - `CONFORMANCE_VERIFIED`: a live run passed one of the scenarios under
14
+ `conformance/` for that harness/model combination.
15
+
16
+ Reading `AGENTS.md` proves only instruction compatibility. It does not prove
17
+ that an active session followed preflight, legal phase chronology, or completion
18
+ validation.
19
+
7
20
  ## Optional capability extensions
8
21
 
9
22
  The installed loop can direct the active agent to inspect its native model and
@@ -143,5 +156,5 @@ ENG/
143
156
  schemas/
144
157
  ```
145
158
 
146
- See the main [README](https://github.com/cassiomc1/mdfiles#readme) for the complete `npx` installation,
159
+ See the main [README](https://github.com/cassiomc1/forgeloop#readme) for the complete `npx` installation,
147
160
  diagnostic, first-run, and update workflow.
package/CLAUDE.md CHANGED
@@ -9,6 +9,16 @@ When working in this repository:
9
9
  5. Make small changes, run a specific check, and then run proportional regression checks.
10
10
  6. Investigate the root cause of a failure before fixing it.
11
11
  7. Request authority for unrelated installation, publication, deletion, migration, or another external or destructive action. For a task-scoped missing Qwen-MM-Plugins capability, follow `LOOP_ENGINEERING.md`; API credentials and system dependencies remain separately gated.
12
- 8. Report current evidence, limitations, and publication state without claiming checks that were not run.
12
+ 8. After implementation begins, do not return a final result in `EXECUTING`: follow `VERIFYING` → structured evidence → `REVIEWING` → execution receipt → validator-backed `COMPLETE`; otherwise report `BLOCKED` or `PARTIALLY VERIFIED` with exact findings.
13
+
14
+ 9. After implementation work for the current task is complete, run `forgeloop next`
15
+ before returning a final result. Follow the returned lifecycle action until
16
+ ForgeLoop reaches a terminal state or an explicit blocker.
17
+ 10. Report current evidence, limitations, and publication state without claiming checks that were not run.
18
+
19
+ Do not stop for non-blocking missing product details. When a safe, reversible
20
+ local default exists, record it as an agent assumption and follow the Blocking vs Non-Blocking Decisions policy in `LOOP_ENGINEERING.md`. Ask only for
21
+ load-bearing, irreversible, externally consequential, unsafe, or real
22
+ user/business decisions.
13
23
 
14
24
  Do not duplicate guide rules here; treat the loop and router as canonical sources.
@@ -4,6 +4,11 @@ language: en
4
4
  description: "Practical WCAG 2.2-oriented accessibility protocol for web, mobile, and desktop."
5
5
  version: "2026.09"
6
6
  last-reviewed: "2026-08-10"
7
+ guide-id: accessibility
8
+ completion-evidence:
9
+ - keyboard-navigation
10
+ - focus-management
11
+ - mobile-viewport
7
12
  ---
8
13
 
9
14
  # Accessibility as a Baseline (A11Y)
@@ -4,6 +4,7 @@ language: en
4
4
  description: "Practices for readable, observable, secure code operated by AI agents."
5
5
  version: "2026.09"
6
6
  last-reviewed: "2026-08-10"
7
+ guide-id: clean
7
8
  ---
8
9
 
9
10
  # Clean Code for AI Agents
@@ -4,6 +4,11 @@ language: en
4
4
  description: "Visual direction, UX, motion, and perceived performance for premium digital experiences."
5
5
  version: "2026.09"
6
6
  last-reviewed: "2026-08-10"
7
+ guide-id: design
8
+ requires-gates:
9
+ - design
10
+ completion-evidence:
11
+ - visual-validation
7
12
  ---
8
13
 
9
14
  # Web Design Premium v2 — Practical Guidelines
@@ -4,6 +4,12 @@ language: en
4
4
  description: "Architecture, design, testing, and operation of 2D, 3D, and procedural web games."
5
5
  version: "2026.09"
6
6
  last-reviewed: "2026-08-10"
7
+ guide-id: games
8
+ requires-gates:
9
+ - simulation
10
+ completion-evidence:
11
+ - game-loop
12
+ - accessibility-validation
7
13
  ---
8
14
 
9
15
  # Web Game Development Guide — 2D, 3D, and Procedural Systems
@@ -4,6 +4,9 @@ language: en
4
4
  description: "Performance measurement, diagnosis, and improvement for web, mobile, desktop, APIs, and data."
5
5
  version: "2026.09"
6
6
  last-reviewed: "2026-08-10"
7
+ guide-id: performance
8
+ completion-evidence:
9
+ - performance-validation
7
10
  ---
8
11
 
9
12
  # Performance Guide for Web, Mobile, Desktop, and Database Development
@@ -4,6 +4,15 @@ language: en
4
4
  description: "Complete process for building premium websites at major design-studio quality."
5
5
  version: "2026.09"
6
6
  last-reviewed: "2026-08-10"
7
+ guide-id: premium
8
+ requires-gates:
9
+ - design
10
+ - quality
11
+ completion-evidence:
12
+ - responsive-validation
13
+ - accessibility-validation
14
+ - build
15
+ - visual-validation
7
16
  ---
8
17
 
9
18
  # Premium Websites at Studio Level — Complete Process
@@ -4,6 +4,11 @@ language: en
4
4
  description: "Verifiable security guidance for web, mobile, desktop, APIs, and the software supply chain."
5
5
  version: "2026.09"
6
6
  last-reviewed: "2026-08-10"
7
+ guide-id: security
8
+ requires-gates:
9
+ - threat-boundary
10
+ completion-evidence:
11
+ - security-validation
7
12
  ---
8
13
 
9
14
  # Security Guide for Web, Mobile, and Desktop Development
@@ -4,6 +4,9 @@ language: en
4
4
  description: "Risk-based testing strategy and tools for modern languages and platforms."
5
5
  version: "2026.09"
6
6
  last-reviewed: "2026-08-10"
7
+ guide-id: test
8
+ completion-evidence:
9
+ - tests
7
10
  ---
8
11
 
9
12
  # Risk-Based Testing Guide by Language and Technology
package/GUIDE_ROUTER.md CHANGED
@@ -24,6 +24,22 @@ Useful questions:
24
24
 
25
25
  ## Canonical catalog
26
26
 
27
+ Guide frontmatter may declare protocol metadata in addition to its human
28
+ description:
29
+
30
+ ```yaml
31
+ guide-id: premium
32
+ requires-gates:
33
+ - design
34
+ completion-evidence:
35
+ - build
36
+ ```
37
+
38
+ `requires-gates` contributes to `forgeloop preflight`; each
39
+ `completion-evidence` identifier contributes to completion coverage. Metadata
40
+ is descriptive and local: it does not authorize tools, remote services, or
41
+ project commands.
42
+
27
43
  | ID | Guide | Responsibility |
28
44
  | --- | --- | --- |
29
45
  | `premium` | [Premium websites](./ENG/premium-sites-studio-eng.md) | End-to-end delivery of high-quality websites and web experiences |
@@ -4,6 +4,141 @@
4
4
  > technical rules remain in the guides selected through
5
5
  > [`GUIDE_ROUTER.md`](./GUIDE_ROUTER.md).
6
6
 
7
+ ## Blocking vs Non-Blocking Decisions
8
+
9
+ Classify every unresolved decision before deciding whether to ask the user.
10
+
11
+ `NON_BLOCKING` applies when a safe local default exists, the choice is
12
+ reversible, it does not change external state, it is not sensitive or
13
+ authoritative, and it does not assert a real user or business fact. Examples
14
+ include fictional company name, demo phone number, placeholder copy, temporary logo text,
15
+ palette, typography, local-only fictional identity, fictional identity, demo
16
+ contacts, visual defaults, section ordering, and local-only form behavior.
17
+
18
+ `BLOCKING` applies when proceeding would require real legal business name,
19
+ real contact details, credentials, payment data, production endpoint,
20
+ deployment target, deployment or domain authority, destructive operation,
21
+ irreversible architectural decision, irreversible data choice, regulated/legal claim,
22
+ regulated claim, or another externally consequential/high-impact decision.
23
+
24
+ ### Safe assumption rule
25
+
26
+ When a missing product detail is non-blocking, choose the smallest reasonable reversible default, explicitly classify it as an agent assumption, and record it in `current-contract.assumptions[]`. Each assumption must include `value`, `reason`, `scope`, `reversible=true`, and `source=agent-default`. Do not place resolved safe assumptions in unresolvedDecisions[]. Never present an assumption as a verified user or business fact.
27
+
28
+ The assumption boundary is:
29
+
30
+ ```text
31
+ SAFE + REVERSIBLE + LOCAL + NON-SENSITIVE + NON-AUTHORITATIVE + NON-DESTRUCTIVE
32
+ ```
33
+
34
+ Record the choice with an explicit `ASSUMPTION` marker. Unresolved blocking decisions must be recorded in `current-contract.unresolvedDecisions[]`; they prevent `preflight` from returning `READY` and block `EXECUTING` until resolved, but do not prevent contract serialization.
35
+
36
+ ## Serialized protocol preparation
37
+
38
+ ForgeLoop keeps the agent responsible for implementation while making the
39
+ pre-implementation contract observable. Before executable changes, the target
40
+ should contain a schema-valid `.forgeloop/current-contract.json` and a persisted
41
+ `.forgeloop/routing-result.json`. Guide metadata can declare mandatory gates;
42
+ those gates are recorded under `.forgeloop/gates/` and are checked by:
43
+
44
+ ```text
45
+ forgeloop preflight
46
+ ```
47
+
48
+ `preflight` validates local ForgeLoop artifacts only. It does not invoke the model, run project commands, or treat a prose declaration as evidence. A `READY` result is required before `EXECUTING` in standard and strict workflows. A non-empty `current-contract.unresolvedDecisions[]` causes `forgeloop preflight` to return `BLOCKED` with `E_CONTRACT_UNRESOLVED_DECISION`; a valid `current-contract.assumptions[]` list does not block preparation.
49
+
50
+ ## Completion validation and chronology
51
+
52
+ `COMPLETE` is a validator result, not a string an agent may assign by itself.
53
+ The local `events.ndjson` ledger records protocol milestones and hash links,
54
+ without prompts, hidden reasoning, credentials, or arbitrary command output.
55
+ The final validator checks the contract, route, state, gates, structured checks,
56
+ evidence coverage, receipt consistency, freshness, and chronology:
57
+
58
+ ```text
59
+ forgeloop audit --strict
60
+ forgeloop complete
61
+ ```
62
+
63
+ Every load-bearing success criterion must have `COVERED` evidence. A required
64
+ `OBSERVED` check cannot be satisfied by `INFERRED`, `NOT_VERIFIED`, or
65
+ `BLOCKED` evidence. If the validator cannot be run, use
66
+ `COMPLETE (FORGELOOP COMPLETION NOT VERIFIED)` rather than claiming protocol
67
+ validity.
68
+
69
+ ## Post-implementation closure
70
+
71
+ Implementation finished is not task finished, and tests executed are not the
72
+ same as verification recorded. After implementation begins, do not stop or
73
+ return the final result while the ForgeLoop task remains in `EXECUTING`.
74
+
75
+ ACT → QUERY NEXT → ACT → QUERY NEXT → … → TERMINAL
76
+
77
+ At each lifecycle boundary, query persisted state with `forgeloop next` before
78
+ choosing the next action. Always query after implementation, verification,
79
+ correction, and review. The query is advisory and read-only; the host agent
80
+ runs checks and applies the returned legal transition or repair action.
81
+
82
+ ```text
83
+ POST-IMPLEMENTATION CLOSURE
84
+
85
+ EXECUTING
86
+ ↓ forgeloop next
87
+ advance --to VERIFYING
88
+ ↓ forgeloop next
89
+ prepare-completion
90
+
91
+ run applicable project checks
92
+
93
+ record observed results with record-check
94
+ ↓ forgeloop next
95
+ advance --to REVIEWING
96
+ ↓ forgeloop next
97
+ complete
98
+ ↓ VALID
99
+ COMPLETE
100
+ ```
101
+
102
+ `prepare-completion` creates or refreshes the in-progress execution receipt.
103
+ It does not claim completion. The receipt is the structured container used by
104
+ subsequent `record-check` operations; completion remains invalid until required
105
+ observed evidence, review state, chronology, and validator requirements are
106
+ satisfied.
107
+
108
+ The host agent runs applicable checks after the receipt exists, records their
109
+ observed results with `record-check`, and queries `forgeloop next` before each
110
+ subsequent lifecycle action. `record-check` records results already observed by
111
+ the agent; it never executes the supplied command text.
112
+
113
+ Continue until the terminal outcome is either validator-backed `COMPLETE` or
114
+ an explicitly reported `BLOCKED` / `PARTIALLY VERIFIED` result with exact
115
+ unresolved findings. Record verification evidence before review. If a required
116
+ check fails, use `VERIFYING → DIAGNOSING → CORRECTING → VERIFYING`; do not skip
117
+ the evidence recording step or replace it with prose.
118
+
119
+ ## Independent completion dimensions
120
+
121
+ Local task completion, verification, publication, and production readiness are
122
+ separate dimensions. A valid local result can therefore be reported as:
123
+
124
+ ```text
125
+ TASK: COMPLETE
126
+ VERIFICATION: VALID
127
+ PUBLICATION: LOCAL_ONLY
128
+ PRODUCTION_READINESS: NOT_VERIFIED
129
+ ```
130
+
131
+ ForgeLoop does not execute commands from profiles, contracts, receipts, state,
132
+ or policy artifacts. Publication and deployment require their own authority and
133
+ observed evidence.
134
+
135
+ Validators expose stable repair-oriented codes such as
136
+ `E_CONTRACT_MISSING`, `E_ROUTE_STALE`, `E_GATE_UNVERIFIED`,
137
+ `E_PHASE_CHRONOLOGY_INVALID`, `E_EVIDENCE_COVERAGE_PARTIAL`,
138
+ `E_PROFILE_SOURCE_UNKNOWN`, `E_RECEIPT_ROUTE_MISMATCH`, and
139
+ `E_PUBLICATION_CLAIM_UNVERIFIED`. Integrations should consume the code and
140
+ artifact paths rather than parse human-readable prose.
141
+
7
142
  ## Core principle
8
143
 
9
144
  Never treat a request as an isolated instruction or the first plausible answer
@@ -92,6 +227,19 @@ The loop invariants are:
92
227
  8. no unrelated refactor during uncertain diagnosis;
93
228
  9. no secret in the profile, work state, receipt, or delegation artifacts;
94
229
  10. no independent-agent claim when only self-review occurred.
230
+ 11. no EXECUTING phase without a valid current contract.
231
+ 12. no EXECUTING phase without a valid route when routing is required.
232
+ 13. no EXECUTING phase while a mandatory pre-implementation gate is unsatisfied.
233
+ 14. no COMPLETE phase without evidence coverage for every required success criterion.
234
+ 15. no COMPLETE phase with stale contract, route, gate, state, or receipt fingerprints.
235
+ 16. selected guides must match across route, work state, and receipt.
236
+ 17. an agent decision cannot be recorded as a user fact.
237
+ 18. a required OBSERVED check cannot be satisfied by INFERRED evidence.
238
+ 19. BLOCKED evidence cannot be represented as PASSED.
239
+ 20. completion must be validated by the protocol, not only declared by the agent.
240
+ 21. protocol chronology must not permit execution before mandatory preflight events.
241
+ 22. publication status and production readiness must remain independent from local task completion.
242
+ 23. a task with implemented deliverables must not terminate in EXECUTING.
95
243
 
96
244
  The serializable phase and transition contract is maintained in
97
245
  [`ORCHESTRATOR_INTEGRATION.md`](./ORCHESTRATOR_INTEGRATION.md). It is a host
@@ -155,6 +303,13 @@ Do not interrupt the user for information that can be discovered safely in the
155
303
  project. Request a decision when legitimate alternatives produce materially
156
304
  different outcomes, authority is missing, or the action is destructive.
157
305
 
306
+ Unknown non-blocking details do not prevent contract creation. Record them as
307
+ reversible agent assumptions in `current-contract.assumptions[]` and continue.
308
+ Unresolved blocking decisions, missing authority, and unsafe-to-infer facts
309
+ must be serialized in `current-contract.unresolvedDecisions[]`; they prevent
310
+ `preflight` from returning `READY` and block `EXECUTING` until resolved, not
311
+ contract creation or serialization.
312
+
158
313
  ### Classify the request
159
314
 
160
315
  - **Answer, explain, or review:** inspect and report evidence; do not make implicit changes.
@@ -275,10 +430,14 @@ requirements, closer instructions, code evidence, or higher-level host rules.
275
430
  ### Design gate
276
431
 
277
432
  Before behavior, feature, architecture, or instruction changes, do proportional
278
- design after discovery. Work through one unresolved decision question at a
279
- time, surface meaningful alternatives with tradeoffs, and obtain approval
280
- before implementation. For small documentation maintenance, keep the treatment
281
- compact while still confirming the objective, boundaries, and verification.
433
+ design after discovery. Classify unresolved design decisions before requesting
434
+ approval. Require user approval only for load-bearing decisions whose
435
+ alternatives materially change the requested product and cannot be resolved
436
+ through a safe, reversible local default. For non-blocking prototype choices,
437
+ choose a reasonable default, record the assumption, and continue. Retain
438
+ approval for material alternatives and external or irreversible decisions. For
439
+ small documentation maintenance, keep the treatment compact while still
440
+ confirming the objective, boundaries, and verification.
282
441
 
283
442
  Use the [Execution contract](#execution-contract), [Project discovery](#project-discovery),
284
443
  [Guide selection](#guide-selection), and [Proportional planning](#proportional-planning)
@@ -76,6 +76,15 @@ The following JSON Schemas define the boundaries a host may implement:
76
76
  - `schemas/task-brief.schema.json` and
77
77
  `schemas/delegated-result.schema.json` define optional delegation.
78
78
  - `schemas/evidence.schema.json` defines the shared evidence vocabulary.
79
+ - `schemas/current-contract.schema.json`, `schemas/gate.schema.json`,
80
+ `schemas/preflight.schema.json`, and `schemas/source-registry.schema.json`
81
+ define preparation and provenance artifacts.
82
+ - `schemas/check.schema.json` and `schemas/evidence-coverage.schema.json`
83
+ define observed verification and load-bearing success coverage.
84
+ - `schemas/event.schema.json`, `schemas/activation.schema.json`,
85
+ `schemas/config.schema.json`, `schemas/policy.schema.json`, and
86
+ `schemas/task-bundle.schema.json` define chronology, mode, policy, and
87
+ handoff boundaries.
79
88
 
80
89
  `src/core/conformance.js` validates relationships that individual schemas
81
90
  cannot express: route/state protocol versions, route/state guide sets,
@@ -84,6 +93,12 @@ statuses are `VALID`, `INCOMPLETE`, `STALE`, `INCONSISTENT`, and `INVALID`.
84
93
  `forgeloop validate-protocol` is read-only and reports the exact failed
85
94
  invariant.
86
95
 
96
+ The preparation and completion commands are also local validators:
97
+ `preflight` must be `READY` before executable work, `audit` is a consistency
98
+ report, and `complete` returns `VALID` only after current evidence, coverage,
99
+ receipt relationships, and ledger chronology pass. None of these commands
100
+ execute a project command or a model.
101
+
87
102
  Every artifact is JSON-compatible, carries `schemaVersion: 1` and
88
103
  `protocolVersion: 1`, and contains no executable callbacks, provider-specific
89
104
  tool objects, credentials, hidden prompts, or remote database references.
@@ -14,6 +14,10 @@ policy are all present.
14
14
  | Graph readiness | Serializable state/transition contracts and `ORCHESTRATOR_INTEGRATION.md`; no runtime required. |
15
15
  | Portability | Node 20/22/24 Linux depth, OS smoke coverage, path/line-ending fixtures, and adapter compatibility evidence. |
16
16
  | Observability | `inspect`/`status`/`validate-protocol` shared derived state classification, real schema health, shared evidence, rich doctor findings, receipts, and no telemetry. |
17
+ | Completion enforcement | Canonical contract, persisted route, guide-declared gates, preflight, phase ledger, structured checks, evidence coverage, `audit`, `report`, and `complete` validators. |
18
+ | Agent lifecycle navigation | Read-only `forgeloop next` decisions, stable action/reason output, persisted-state safety, and adapter guidance at lifecycle boundaries. |
19
+ | Execution → Verification handoff | Legal `EXECUTING` → `VERIFYING` transition, implementation-step reconciliation, and preservation of verification evidence. |
20
+ | Pre-contract autonomy | Blocking vs Non-Blocking Decisions policy, explicit ASSUMPTION / source=agent-default recording, safe-boundary invariant, positive and negative tests, and a blind run showing non-blocking ambiguity continues while blocking ambiguity remains user-gated. |
17
21
  | 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
22
  | Multi-agent coordination | Self-contained briefs, write/write and write/read ownership checks, dependency-set validation, reviewer independence, normalized results, and inline fallback. |
19
23
  | Security boundaries | Realpath containment, bounded untrusted JSON, threat model, nested secret scanning, publication evidence, and explicit authority rules. |
@@ -33,6 +37,16 @@ policy are all present.
33
37
  - Literal graph runtime and runtime multi-agent orchestration are `N/A by
34
38
  design`; compatible harnesses own those capabilities.
35
39
 
40
+ ## Third-run conformance position
41
+
42
+ | Dimension | Classification |
43
+ | --- | --- |
44
+ | Execution → Verification | REPRODUCED FAILURE before this fix |
45
+ | Verification serialization | NOT_REACHED |
46
+ | Review transition | NOT_REACHED |
47
+ | Receipt generation | NOT_REACHED |
48
+ | Full conformance | PARTIAL |
49
+
36
50
  ## Evidence matrix
37
51
 
38
52
  The score is evidence-backed only when the contract and its executable proof
@@ -48,6 +62,8 @@ are both present:
48
62
  | Graph readiness | Serializable phase/transition mapping in `ORCHESTRATOR_INTEGRATION.md` | Python semantic validator and workflow-policy tests |
49
63
  | 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
64
  | 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 |
65
+ | Protocol preparation and completion | `src/core/preflight.js`, `src/core/completion.js`, `src/core/events.js`, policy packs, and portable bundles | `tests/preflight.test.js`, `tests/completion.test.js`, `tests/lifecycle.test.js`, `tests/policy.test.js`, and `tests/bundle.test.js` |
66
+ | Pre-contract autonomy | `LOOP_ENGINEERING.md`, `CLAUDE.md`, `AGENTS.md`, `.github/copilot-instructions.md`, `.cursor/rules/project-loop.mdc`, and the blind conformance artifacts | `tests/autonomy-policy.test.js`, `tests/conformance-scenarios.test.js` |
51
67
 
52
68
  The implementation references above are local observations. OS runners,
53
69
  remote links, provider sessions, publication, and deployment remain `Not
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ForgeLoop — Instruction Guides for AI Agents
2
2
 
3
- [![Docs quality](https://github.com/cassiomc1/mdfiles/actions/workflows/docs-quality.yml/badge.svg?branch=main)](https://github.com/cassiomc1/mdfiles/actions/workflows/docs-quality.yml)
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
5
  An English-only collection of operational guides for AI agents and developers.
6
6
  It covers product strategy, code, testing, security, performance,
@@ -135,6 +135,20 @@ Protocol-support commands are local and do not invoke an agent or model:
135
135
 
136
136
  ```bash
137
137
  npx @cassiomc1/forgeloop route --work complete-website --surface ui --risk untrusted-input
138
+ npx @cassiomc1/forgeloop activate
139
+ npx @cassiomc1/forgeloop preflight --json
140
+ npx @cassiomc1/forgeloop next
141
+ npx @cassiomc1/forgeloop next --json
142
+ npx @cassiomc1/forgeloop advance --to EXECUTING
143
+ npx @cassiomc1/forgeloop advance --to VERIFYING
144
+ npx @cassiomc1/forgeloop prepare-completion --json
145
+ npx @cassiomc1/forgeloop record-check --id tests --requirement tests --status passed --evidence-kind OBSERVED --command "npm test" --result "exit 0" --json
146
+ npx @cassiomc1/forgeloop advance --to REVIEWING
147
+ npx @cassiomc1/forgeloop audit --json
148
+ npx @cassiomc1/forgeloop complete --json
149
+ npx @cassiomc1/forgeloop report
150
+ npx @cassiomc1/forgeloop policy web-premium
151
+ npx @cassiomc1/forgeloop bundle --task website-001 --json
138
152
  npx @cassiomc1/forgeloop inspect --json
139
153
  npx @cassiomc1/forgeloop status --json
140
154
  npx @cassiomc1/forgeloop status --contract-file .forgeloop/current-contract.json --json
@@ -143,7 +157,41 @@ npx @cassiomc1/forgeloop validate-receipt --file ./execution-receipt.json --json
143
157
  npx @cassiomc1/forgeloop validate-protocol --route-file ./routing-result.json --state-file .forgeloop/work-state.json --receipt-file ./execution-receipt.json --contract-file .forgeloop/current-contract.json --json
144
158
  ```
145
159
 
160
+ The query-driven post-implementation path is:
161
+
162
+ ```text
163
+ implementation
164
+ → forgeloop next
165
+ → advance --to VERIFYING
166
+ → forgeloop next
167
+ → prepare-completion
168
+ → forgeloop next
169
+ → checks + record-check
170
+ → forgeloop next
171
+ → advance --to REVIEWING
172
+ → forgeloop next
173
+ → complete
174
+ ```
175
+
176
+ `forgeloop next` and `forgeloop next --json` read persisted state only. They do
177
+ not run project checks or mutate protocol artifacts.
178
+
146
179
  `route` expands declared signals into deterministic guide IDs and reason codes.
180
+ `activate` records a session marker without storing prompts or hidden reasoning.
181
+ Before implementation, write the canonical contract, persist the route, create
182
+ required gate artifacts under `.forgeloop/gates/`, and require `preflight` to
183
+ return `READY`. `advance` enforces legal phase transitions; it never runs the
184
+ project's commands. After implementation, advance to `VERIFYING`, use
185
+ `prepare-completion` to create a safe receipt skeleton, and use `record-check`
186
+ to serialize results that the agent has already observed. `record-check` never
187
+ executes the supplied command text. Advance to `REVIEWING` before running
188
+ `audit` and `complete`.
189
+ `audit` is a read-only consistency check. `complete` validates the final
190
+ contract, route, gates, phase ledger, structured evidence, coverage, receipt,
191
+ and freshness before it can return `VALID`. `report` renders the same result as
192
+ independent task, verification, publication, and production-readiness
193
+ dimensions. `policy` selects a local strictness pack and `bundle` exports
194
+ canonical protocol artifacts for handoff or review.
147
195
  `inspect`, `status`, and `validate-state` explain installation and resumable
148
196
  state; they do not execute commands from the target profile.
149
197
  `inspect` and `status` parse the target-local schemas and report `valid`,
@@ -165,6 +213,21 @@ Capability gaps and inline/non-Git degraded mode are defined in
165
213
  [`AGENT_COMPATIBILITY.md`](./AGENT_COMPATIBILITY.md); they are reported as
166
214
  limitations rather than treated as silent successes.
167
215
 
216
+ ### Live conformance modes
217
+
218
+ Standard blind conformance uses the same mode throughout a run:
219
+
220
+ ```text
221
+ forgeloop preflight
222
+ → forgeloop audit
223
+ → forgeloop complete
224
+ ```
225
+
226
+ Strict blind conformance is a separate profile. First verify the target
227
+ `PROJECT_PROFILE.md`, then use `--strict` consistently with `preflight`,
228
+ `audit`, and `complete`. Do not evaluate a Standard run with Strict criteria
229
+ unless that escalation is explicitly recorded.
230
+
168
231
  ### Protocol compatibility
169
232
 
170
233
  The npm package version is independent of protocol version. The current
package/THREAT_MODEL.md CHANGED
@@ -14,6 +14,10 @@ remaining trust boundaries and their executable evidence.
14
14
  | Symlink escape | Redirects a managed path to another directory | Existing target parents and artifact paths | Reject symlinked targets, parents, and destinations before access | The check is not a filesystem lock | `tests/core.test.js`, `tests/portability.test.js`, `tests/fixtures/protocol/invalid/symlink-target.json` |
15
15
  | Malicious manifest | Causes unsafe update or false ownership claims | `.forgeloop/manifest.json` | Schema, hash, safe-path, and preserve-flag validation; conflicts remain visible | A trusted operator can still deliberately edit the manifest | `tests/cli.test.js`, `tests/core.test.js` |
16
16
  | 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` |
17
+ | 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` |
18
+ | 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` |
19
+ | 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` |
20
+ | 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` |
17
21
  | 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` |
18
22
  | Malicious task brief | Grants a child task more authority than intended | Delegation brief JSON and host harness | Relative path boundaries, guide/verification/authority checks, secret-free validation, set validation, parent integration ownership | The host harness remains responsible for OS permissions and execution policy | `tests/delegation.test.js`, `tests/delegation-set.test.js` |
19
23
  | Artifact content exposure | Sensitive material enters portable artifacts or diagnostics | State, receipt, delegation, evidence, and repository text | Nested key/value detection, shaped marker patterns, scanner coverage, no content echo in errors | Content scanners cannot prove that an unknown encoding is harmless | `tests/security-limits.test.js`, `tests/test_scan_secrets.py`, `scripts/scan_secrets.py` |
@@ -33,3 +37,5 @@ remaining trust boundaries and their executable evidence.
33
37
  - Local checks do not imply remote publication, merge, deployment, or provider
34
38
  confirmation.
35
39
  - Credentials remain outside Git and outside protocol artifacts.
40
+ - `preflight`, `audit`, `report`, and `complete` never execute commands copied
41
+ from a profile, contract, receipt, state, gate, policy, or bundle.