loopforge 3.0.0 → 3.6.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 (194) hide show
  1. package/README.md +126 -143
  2. package/dist/audit.d.ts +50 -0
  3. package/dist/audit.d.ts.map +1 -0
  4. package/dist/audit.js +131 -0
  5. package/dist/audit.js.map +1 -0
  6. package/dist/canonical-state.d.ts +98 -23
  7. package/dist/canonical-state.d.ts.map +1 -1
  8. package/dist/canonical-state.js +257 -181
  9. package/dist/canonical-state.js.map +1 -1
  10. package/dist/cli.d.ts.map +1 -1
  11. package/dist/cli.js +40 -33
  12. package/dist/cli.js.map +1 -1
  13. package/dist/cognitive-facts.d.ts +17 -0
  14. package/dist/cognitive-facts.d.ts.map +1 -0
  15. package/dist/cognitive-facts.js +99 -0
  16. package/dist/cognitive-facts.js.map +1 -0
  17. package/dist/cognitive-governance.d.ts +25 -33
  18. package/dist/cognitive-governance.d.ts.map +1 -1
  19. package/dist/cognitive-governance.js +38 -138
  20. package/dist/cognitive-governance.js.map +1 -1
  21. package/dist/committed-round.d.ts +59 -0
  22. package/dist/committed-round.d.ts.map +1 -0
  23. package/dist/committed-round.js +222 -0
  24. package/dist/committed-round.js.map +1 -0
  25. package/dist/enforcement-gate.d.ts +78 -0
  26. package/dist/enforcement-gate.d.ts.map +1 -0
  27. package/dist/enforcement-gate.js +1109 -0
  28. package/dist/enforcement-gate.js.map +1 -0
  29. package/dist/engine.d.ts +111 -0
  30. package/dist/engine.d.ts.map +1 -0
  31. package/dist/engine.js +887 -0
  32. package/dist/engine.js.map +1 -0
  33. package/dist/evidence-claims.d.ts +50 -0
  34. package/dist/evidence-claims.d.ts.map +1 -0
  35. package/dist/evidence-claims.js +116 -0
  36. package/dist/evidence-claims.js.map +1 -0
  37. package/dist/evidence-provider.d.ts +50 -23
  38. package/dist/evidence-provider.d.ts.map +1 -1
  39. package/dist/evidence-provider.js +167 -50
  40. package/dist/evidence-provider.js.map +1 -1
  41. package/dist/generate-schema.js +1 -84
  42. package/dist/generate-schema.js.map +1 -1
  43. package/dist/index.d.ts +19 -22
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +16 -15
  46. package/dist/index.js.map +1 -1
  47. package/dist/loop-compiler.d.ts +58 -3
  48. package/dist/loop-compiler.d.ts.map +1 -1
  49. package/dist/loop-compiler.js +841 -304
  50. package/dist/loop-compiler.js.map +1 -1
  51. package/dist/loop-extras-parser.d.ts +2 -2
  52. package/dist/loop-extras-parser.d.ts.map +1 -1
  53. package/dist/loop-extras-parser.js +2 -2
  54. package/dist/loop-extras-parser.js.map +1 -1
  55. package/dist/loop-projection.d.ts +6 -0
  56. package/dist/loop-projection.d.ts.map +1 -0
  57. package/dist/loop-projection.js +26 -0
  58. package/dist/loop-projection.js.map +1 -0
  59. package/dist/loop-store.d.ts +115 -24
  60. package/dist/loop-store.d.ts.map +1 -1
  61. package/dist/loop-store.js +365 -218
  62. package/dist/loop-store.js.map +1 -1
  63. package/dist/mcp/round-lifecycle.d.ts +214 -0
  64. package/dist/mcp/round-lifecycle.d.ts.map +1 -0
  65. package/dist/mcp/round-lifecycle.js +935 -0
  66. package/dist/mcp/round-lifecycle.js.map +1 -0
  67. package/dist/mcp/server.d.ts +2 -1
  68. package/dist/mcp/server.d.ts.map +1 -1
  69. package/dist/mcp/server.js +29 -43
  70. package/dist/mcp/server.js.map +1 -1
  71. package/dist/mcp/session.d.ts +64 -101
  72. package/dist/mcp/session.d.ts.map +1 -1
  73. package/dist/mcp/session.js +433 -1110
  74. package/dist/mcp/session.js.map +1 -1
  75. package/dist/mcp/tools.d.ts +20 -11
  76. package/dist/mcp/tools.d.ts.map +1 -1
  77. package/dist/mcp/tools.js +587 -413
  78. package/dist/mcp/tools.js.map +1 -1
  79. package/dist/policy-metrics.d.ts +12 -24
  80. package/dist/policy-metrics.d.ts.map +1 -1
  81. package/dist/policy-metrics.js +78 -184
  82. package/dist/policy-metrics.js.map +1 -1
  83. package/dist/policy.d.ts +61 -50
  84. package/dist/policy.d.ts.map +1 -1
  85. package/dist/policy.js +48 -146
  86. package/dist/policy.js.map +1 -1
  87. package/dist/prompt-assembler.d.ts +37 -6
  88. package/dist/prompt-assembler.d.ts.map +1 -1
  89. package/dist/prompt-assembler.js +487 -278
  90. package/dist/prompt-assembler.js.map +1 -1
  91. package/dist/prompt-policy.d.ts +1 -8
  92. package/dist/prompt-policy.d.ts.map +1 -1
  93. package/dist/prompt-policy.js +8 -26
  94. package/dist/prompt-policy.js.map +1 -1
  95. package/dist/protocol.d.ts +398 -236
  96. package/dist/protocol.d.ts.map +1 -1
  97. package/dist/protocol.js +147 -17
  98. package/dist/protocol.js.map +1 -1
  99. package/dist/replay.d.ts +5 -13
  100. package/dist/replay.d.ts.map +1 -1
  101. package/dist/replay.js +32 -69
  102. package/dist/replay.js.map +1 -1
  103. package/dist/round-contract.d.ts +64 -0
  104. package/dist/round-contract.d.ts.map +1 -0
  105. package/dist/round-contract.js +80 -0
  106. package/dist/round-contract.js.map +1 -0
  107. package/dist/round-coordinator.d.ts +23 -25
  108. package/dist/round-coordinator.d.ts.map +1 -1
  109. package/dist/round-coordinator.js +103 -92
  110. package/dist/round-coordinator.js.map +1 -1
  111. package/dist/round-driver.d.ts +13 -13
  112. package/dist/round-driver.d.ts.map +1 -1
  113. package/dist/round-driver.js +25 -14
  114. package/dist/round-driver.js.map +1 -1
  115. package/dist/round-transaction.d.ts +14 -18
  116. package/dist/round-transaction.d.ts.map +1 -1
  117. package/dist/round-transaction.js +37 -47
  118. package/dist/round-transaction.js.map +1 -1
  119. package/dist/self-eval.d.ts +48 -0
  120. package/dist/self-eval.d.ts.map +1 -0
  121. package/dist/self-eval.js +248 -0
  122. package/dist/self-eval.js.map +1 -0
  123. package/dist/storage.d.ts +9 -4
  124. package/dist/storage.d.ts.map +1 -1
  125. package/dist/storage.js +18 -6
  126. package/dist/storage.js.map +1 -1
  127. package/dist/token-utils.d.ts +15 -3
  128. package/dist/token-utils.d.ts.map +1 -1
  129. package/dist/token-utils.js +24 -5
  130. package/dist/token-utils.js.map +1 -1
  131. package/dist/verification-gate.d.ts +149 -0
  132. package/dist/verification-gate.d.ts.map +1 -0
  133. package/dist/verification-gate.js +1343 -0
  134. package/dist/verification-gate.js.map +1 -0
  135. package/dist/workspace.d.ts +29 -0
  136. package/dist/workspace.d.ts.map +1 -0
  137. package/dist/workspace.js +61 -0
  138. package/dist/workspace.js.map +1 -0
  139. package/loop_policy.json +37 -16
  140. package/package.json +5 -10
  141. package/skills/perception/SKILL.md +184 -202
  142. package/dist/canonical-event-writer.d.ts +0 -20
  143. package/dist/canonical-event-writer.d.ts.map +0 -1
  144. package/dist/canonical-event-writer.js +0 -131
  145. package/dist/canonical-event-writer.js.map +0 -1
  146. package/dist/compiler-subgoals.d.ts +0 -7
  147. package/dist/compiler-subgoals.d.ts.map +0 -1
  148. package/dist/compiler-subgoals.js +0 -93
  149. package/dist/compiler-subgoals.js.map +0 -1
  150. package/dist/derive-id.d.ts +0 -12
  151. package/dist/derive-id.d.ts.map +0 -1
  152. package/dist/derive-id.js +0 -31
  153. package/dist/derive-id.js.map +0 -1
  154. package/dist/mcp/session-projection.d.ts +0 -5
  155. package/dist/mcp/session-projection.d.ts.map +0 -1
  156. package/dist/mcp/session-projection.js +0 -18
  157. package/dist/mcp/session-projection.js.map +0 -1
  158. package/dist/mcp/session-queue.d.ts +0 -3
  159. package/dist/mcp/session-queue.d.ts.map +0 -1
  160. package/dist/mcp/session-queue.js +0 -18
  161. package/dist/mcp/session-queue.js.map +0 -1
  162. package/dist/mcp/session-types.d.ts +0 -72
  163. package/dist/mcp/session-types.d.ts.map +0 -1
  164. package/dist/mcp/session-types.js +0 -2
  165. package/dist/mcp/session-types.js.map +0 -1
  166. package/dist/round-commit-store.d.ts +0 -12
  167. package/dist/round-commit-store.d.ts.map +0 -1
  168. package/dist/round-commit-store.js +0 -13
  169. package/dist/round-commit-store.js.map +0 -1
  170. package/dist/round-gate.d.ts +0 -31
  171. package/dist/round-gate.d.ts.map +0 -1
  172. package/dist/round-gate.js +0 -259
  173. package/dist/round-gate.js.map +0 -1
  174. package/dist/round-recovery.d.ts +0 -17
  175. package/dist/round-recovery.d.ts.map +0 -1
  176. package/dist/round-recovery.js +0 -117
  177. package/dist/round-recovery.js.map +0 -1
  178. package/dist/round-report.d.ts +0 -16
  179. package/dist/round-report.d.ts.map +0 -1
  180. package/dist/round-report.js +0 -401
  181. package/dist/round-report.js.map +0 -1
  182. package/dist/runtime-services.d.ts +0 -59
  183. package/dist/runtime-services.d.ts.map +0 -1
  184. package/dist/runtime-services.js +0 -460
  185. package/dist/runtime-services.js.map +0 -1
  186. package/dist/vault-format.d.ts +0 -4
  187. package/dist/vault-format.d.ts.map +0 -1
  188. package/dist/vault-format.js +0 -4
  189. package/dist/vault-format.js.map +0 -1
  190. package/dist/vault-types.d.ts +0 -24
  191. package/dist/vault-types.d.ts.map +0 -1
  192. package/dist/vault-types.js +0 -2
  193. package/dist/vault-types.js.map +0 -1
  194. package/loopforge-policy.json +0 -340
@@ -1,228 +1,210 @@
1
1
  ---
2
2
  name: perception
3
- description: Drive a recoverable multi-round task through the LoopForge MCP runtime while the Agent remains the execution owner.
3
+ description: Drive a recoverable multi-round coding task through LoopForge MCP while the external Agent remains the execution owner.
4
4
  ---
5
5
 
6
6
  # Perception
7
7
 
8
- Use LoopForge for work that spans multiple context windows, needs an auditable
9
- record, or must survive a process restart. LoopForge stores canonical facts and
10
- compiles prompts; you remain responsible for inspecting the repository,
11
- editing files, running tools, and making technical decisions.
8
+ Use LoopForge when a coding task needs several rounds, must survive context
9
+ compression or process restart, or benefits from an auditable record of goals,
10
+ constraints, evidence, and decisions.
12
11
 
13
- There is one public execution path. Do not create a second plan scheduler,
14
- background Agent, MCP Task, or local shadow state machine.
12
+ LoopForge has one factual source, the committed typed round documents in the
13
+ Vault, and one cognitive source, the Canonical State compiled from them. You
14
+ remain the Agent that reads files, edits code, runs commands, delegates work,
15
+ and decides how to reason.
15
16
 
16
- ## 1. Start one loop
17
+ ## Start
17
18
 
18
19
  Call `loopforge_start` with:
19
20
 
20
- - `task`: the complete user objective, not a short reminder;
21
- - `constraints`: hard boundaries that must survive every round;
22
- - `successCriteria`: explicit verifiable completion criteria when the task has
23
- more than the default objective-level criterion;
24
- - `maxRounds`: an explicit safety limit when the default (100) is unsuitable;
25
- - `domain`: an optional technology or repository hint;
26
- - `planSource`: an optional path to a user-provided plan (reference only).
27
-
28
- Keep the returned `sessionId`, `loopId`, `roundId`, prompt, and hashes. Execute
29
- the returned prompt in the bound workspace before submitting a report.
30
-
31
- ## 2. Submit `RoundReport`
32
-
33
- Call `loopforge_next` after an accepted round. Call `loopforge_retry` only when
34
- the previous logical round was rejected. Both calls require `sessionId` and a
35
- canonical report; free-form text and the old `status` report are invalid.
21
+ - `task`: the complete user objective.
22
+ - `constraints`: hard boundaries that must survive every round.
23
+ - `maxRounds`: optional positive safety limit. The default is 20.
24
+ - `domain`: optional context label.
25
+
26
+ Keep the returned `sessionId`, `roundId`, prompt, and level. Always pass the
27
+ most recent `roundId` to `loopforge_next`. It anchors the submission to the
28
+ exact round being reported.
29
+
30
+ ## Plan round boundaries
31
+
32
+ LoopForge does not decide how the Agent thinks about a large task. The Agent
33
+ chooses the next useful slice of work, while LoopForge checks the submitted
34
+ facts and evidence at the round boundary. Do not try to predict an exact number
35
+ of rounds before inspecting the repository. Re-plan after each committed round.
36
+
37
+ Choose a round around a coherent, verifiable change:
38
+
39
+ 1. Start with the dependency or discovery work that determines later choices.
40
+ 2. Group changes that must be edited and tested together; split unrelated work
41
+ or work with different rollback risks.
42
+ 3. End the round when its slice has a concrete result, a known blocker, or a
43
+ machine-checkable next boundary. A round may be small when uncertainty or
44
+ risk is high, and larger when the changes are tightly coupled.
45
+ 4. Before submitting, check the actual diff, relevant tests, hard constraints,
46
+ and the next action. Do not mark the whole task complete because one slice
47
+ is complete.
48
+
49
+ For work that spans several rounds, declare a `round_contract` as a proposal for
50
+ the next slice. Keep its `work_item` narrow, list observable `done_when` items,
51
+ name only configured evidence commands in `verification_plan`, and constrain
52
+ `scope` to the files or directories that slice may touch. The proposal becomes
53
+ active only after the current round commits. If the slice is blocked, report
54
+ `outcome: "blocked"` with a concrete `blocker`; do not silently replace the
55
+ active contract.
56
+
57
+ This is a granularity preflight, not another gate: ask whether the slice has a
58
+ clear boundary, evidence, and recovery path. LoopForge cannot see an implicit
59
+ plan inside the model. It learns only from committed evaluation fields,
60
+ Round Contract proposals, observed evidence, and the resulting changes. A
61
+ reasonable split may therefore be revised by the next prompt, a verification
62
+ finding, or a backtrack diagnosis.
63
+
64
+ ## Execute a round
65
+
66
+ 1. Execute the returned prompt and do real repository work.
67
+ 2. Use the tools and reasoning approach that fit the task.
68
+ 3. Check actual evidence before claiming success.
69
+ 4. Submit one structured `evaluation` with `loopforge_next`.
70
+
71
+ The four core evaluation fields are strict:
72
+
73
+ | Field | Rule |
74
+ | --- | --- |
75
+ | `success` | Boolean. Use `true` only when the whole objective and every hard constraint are satisfied. |
76
+ | `output_summary` | String. State what changed and what was verified this round. |
77
+ | `constraint_violations` | Array of strings. Report real violations; prefer constraint IDs such as `c-XXXXXXXX`. |
78
+ | `should_continue` | Boolean. Use `false` only when the entire task is complete. |
79
+
80
+ All other evaluation fields are optional and normalized by LoopForge. Useful
81
+ fields include `execution_evidence`, `discovered_constraints`,
82
+ `emerged_subtasks`, `completed_subtasks`, `blocked_subtasks`,
83
+ `canceled_subtasks`, `next_action`, `drift_clarification`, `prompt_requests`,
84
+ `outcome`, `blocker`, `round_contract`, `retroactiveClaims`, and
85
+ `worker_results`.
86
+
87
+ Optional malformed values are ignored or defaulted. They do not turn a valid
88
+ submission into a transport error. Missing or mistyped core fields return
89
+ `evaluation_invalid` with `details.missing` and `details.invalid`. Correct the
90
+ payload and resubmit the same `roundId`. This does not save session state,
91
+ write a round, enter either gate, increment rejection state, or record metrics.
92
+
93
+ Minimal evaluation:
36
94
 
37
95
  ```json
38
96
  {
39
- "format": "loopforge.round-report",
40
- "outcome": "partial",
41
- "continuation": "continue",
42
- "summary": "Implemented the parser and ran focused tests.",
43
- "violations": [],
44
- "evidence": {
45
- "files": ["src/parser.ts", "test/parser.test.ts"],
46
- "checks": [{"name": "npm test -- parser", "status": "passed", "counts": {"passed": 8, "failed": 0, "skipped": 0}}],
47
- "claims": [{"id": "claim-0123456789ab", "targetId": "cr-abcdef12", "evidenceRefs": ["command:npm test -- parser"]}],
48
- "provenance": {}
49
- },
50
- "agentIntent": "Add parser regression coverage next"
97
+ "success": false,
98
+ "output_summary": "Implemented the parser and added 8 passing tests.",
99
+ "constraint_violations": [],
100
+ "should_continue": true,
101
+ "execution_evidence": {
102
+ "files_changed": ["src/parser.ts", "tests/parser.test.ts"],
103
+ "test_results": { "passed": 8, "failed": 0, "skipped": 0 },
104
+ "success_criteria_met": [],
105
+ "success_criteria_remaining": ["All parser edge cases covered"],
106
+ "progress_estimate": 0.4
107
+ }
51
108
  }
52
109
  ```
53
110
 
54
- ### Outcome versus continuation
111
+ Do not put a guessed evaluation in free text. The structured object is the
112
+ authoritative submission; `output` is optional supporting context.
55
113
 
56
- - `outcome` is only this round's result: `success`, `partial`, `failed`, or
57
- `blocked`.
58
- - `continuation` is only the request to start another round: `continue` or
59
- `stop`.
60
- - `success` does not prove the total objective is complete. Completion requires
61
- runtime-verified claims for every remaining criterion, no contradictory
62
- checks, and no unresolved User Gate.
63
- - `blocked` requires a `blocker` object. Use `continuation: "stop"` for a
64
- user decision, external dependency, or side effect that must not be guessed.
65
- An Agent-resolvable blocker may use `continue`, but state the required
66
- evidence and resolution.
114
+ If a submission warns that its `roundId` no longer matches, the reported round
115
+ already committed. Use the returned held prompt and its `roundId` rather than
116
+ submitting against a later round.
67
117
 
68
- ### Report fields
118
+ ## Stable IDs and contracts
69
119
 
70
- | Field | How to use it |
71
- | --- | --- |
72
- | `summary` | Describe concrete work and observations from this round. |
73
- | `violations` | List every actual hard-constraint violation; do not hide one to obtain acceptance. Prefer `c-XXXXXXXX` IDs. |
74
- | `evidence` | Report files, checks, claims and references. Agent provenance is only a claim until a runtime provider observes it. |
75
- | `discoveries` | Record wrong assumptions, emerged work, durable facts and newly discovered constraints. |
76
- | `subGoalEvents` | Report completed, blocked or canceled existing sub-goals. Do not invent a second sub-goal lifecycle. Prefer `sg-XXXXXXXX` IDs. |
77
- | `constraintEvents` | Retire a constraint only when repository evidence shows it is no longer valid. |
78
- | `criterionRevisions` | Propose an old-to-new criterion change; never silently replace the user's objective. |
79
- | `objectiveRefinement` | Add a safe clarification when evidence changes the interpretation; it is validated by the runtime. |
80
- | `phaseBoundaryProposal` | Suggest a phase label and reason. The runtime decides whether the boundary is real. |
81
- | `contextRequest` | Per-round emphasis, expansion or confusion requests. It is consumed once and is not durable state. |
82
- | `agentIntent` | Optional Agent suggestion used only for audit and drift comparison. Runtime-derived Focus, Todo and Suggested Next Action take precedence. |
83
- | `driftClarification` | When drift is detected, provide a concrete explanation and a criterion/constraint ID or observed file path. Runtime validates it; do not submit a waiver boolean. |
84
-
85
- Do not submit derived `currentFocus`, `todoProjection`, `handoff`,
86
- `progress`, `failedPatterns`, `nextAction`, or `verifiedFacts` as alternate
87
- facts. These are internal or derived views. A progress estimate, if present in
88
- the evidence supplied to an embedding, is never authoritative.
89
-
90
- ## 3. Evidence discipline
91
-
92
- Use stable IDs shown in the prompt:
93
-
94
- - constraints: `[c-a3f2b1c0]`;
95
- - criteria: `[cr-b5a6c7d8]`;
96
- - sub-goals: `[sg-f1e2d3c4]`.
97
-
98
- Claims should reference a concrete file, check, or provider observation. Do not
99
- mark your own provenance `verified` to force progress. Runtime providers may
100
- replace claimed evidence with `verified`, `contradicted`, or `unavailable`.
101
- Missing provider output is unavailable, not a pass. A rejected attempt and its
102
- claims are not canonical facts.
103
-
104
- ## 4. Retry, backtrack and continuation
105
-
106
- Read the returned `decision` and `enforcementAction`:
107
-
108
- - `accepted`: execute the returned prompt for the next round;
109
- - `rejected`: correct the evidence or work and call `loopforge_retry`; keep the
110
- same logical `roundId` and do not call `next` to bypass rejection;
111
- - `backtracked`: use the returned restore round and requirements, then continue
112
- from the new prompt;
113
- - `stopped` or `terminated`: do not submit another report unless a new loop is
114
- explicitly started.
115
-
116
- Backtrack is advisory and bounded. It never changes workspace files. Follow the
117
- exact paths and checks returned by LoopForge, inspect the resulting workspace,
118
- and report the restoration evidence. Never improvise an unbounded destructive
119
- command such as `git clean -fd` or `git reset --hard`; ask for a User Gate when
120
- the required action is destructive or authorization is unclear.
121
-
122
- ## 5. User Gate and Agent Gate
123
-
124
- For a risky action, call `loopforge_gate_check` with:
120
+ Prompts render stable IDs beside constraints, criteria, and sub-goals:
125
121
 
126
- ```json
127
- {
128
- "description": "Apply the production database migration",
129
- "scope": ["db/migrations/2026-01.sql"],
130
- "effects": ["data_migration", "production"],
131
- "reversibility": "recoverable",
132
- "authorization": "user_required"
133
- }
134
- ```
122
+ - Constraints: `[c-a3f2b1c0] No plaintext passwords`
123
+ - Criteria: `[cr-b5a6c7d8] Unit test coverage >= 90%`
124
+ - Sub-goals: `[sg-f1e2d3c4] Add error handling to login`
135
125
 
136
- User Gate is required for production, credentials, data migration, publishing,
137
- payment, external communication, public API changes, irreversible or unknown
138
- actions, and unknown authorization. Limit the blocked scope and continue only
139
- with allowed read-only investigation or dry runs. Agent Gate is for bounded,
140
- reversible, explicitly `agent_allowed` workspace work or ordinary technical
141
- blockers. Resolve a User Gate with `loopforge_gate_resolve` using the exact same
142
- descriptor; its `actionHash` invalidates an approval if the action changes.
126
+ Prefer IDs for `constraint_violations`, criteria lists, subtask status changes,
127
+ and drift clarifications. Natural-language matching remains a policy-controlled
128
+ fallback when an ID is unavailable.
143
129
 
144
- ## 6. Status, history and audit
130
+ An optional `round_contract` is a proposal for the next round. It becomes
131
+ active only after the declaring round commits. While active, its `done_when`,
132
+ `verification_plan`, and `scope` govern the current task until a committed eval
133
+ completes it or reports `outcome: "blocked"`. A verification plan must be
134
+ observed passing in the closing round.
145
135
 
146
- Use only the current twelve tools:
136
+ ## Backtrack
147
137
 
148
- ```text
149
- loopforge_start loopforge_next loopforge_retry
150
- loopforge_backtrack loopforge_resume loopforge_pause
151
- loopforge_stop loopforge_status loopforge_history
152
- loopforge_gate_check loopforge_gate_resolve loopforge_audit
153
- ```
138
+ R4 or R5 progress stalls can trigger backtrack to the last clean committed
139
+ round. The prompt includes a diagnosis and workspace-restore requirements.
140
+
141
+ When backtrack occurs:
142
+
143
+ 1. Restore the workspace exactly as requested before doing more work.
144
+ 2. Read the restored prompt and derived state.
145
+ 3. Do not repeat the failed approach without addressing the diagnosis.
146
+ 4. Keep valid discoveries from skipped rounds in later evaluations.
147
+
148
+ If the workspace is not restored, the next submission is rejected with
149
+ `backtrack_workspace_not_restored`. A stalled active contract should be closed
150
+ with `outcome: "blocked"` and a blocker while proposing the revision.
151
+
152
+ ## Drift
153
+
154
+ The verification gate compares the previous `next_action` with the current
155
+ work. When intentionally changing direction, provide a substantive
156
+ `drift_clarification` with a concrete constraint, criterion, sub-goal ID, or
157
+ file path. Three consecutive weak clarifications terminate the loop.
158
+
159
+ ## Interpret results
160
+
161
+ - `prompt` is non-null: execute it and submit the next evaluation.
162
+ - `enforcementAction: "reject"`: redo the same logical round. The round ID is
163
+ stable and the attempt increases.
164
+ - `enforcementAction: "backtrack"`: restore the workspace, then continue from
165
+ the restored prompt and round.
166
+ - `prompt` is null: inspect `stopReason`.
167
+
168
+ `completed` means the task ended with success. `failed` means the Agent gave
169
+ up. `blocked` means current constraints prevent progress. `max_rounds` is the
170
+ safety limit. `stalled` means no usable next state was produced.
171
+ `enforcement_terminated` means repeated integrity failures reached a terminal
172
+ ladder. `paused` means the durable session remains available for resume.
173
+
174
+ ## Prompt levels and views
175
+
176
+ L0 is a lean same-round retry, L1 is normal continuation, and L2 is full
177
+ rehydration. They control state density only and never prescribe a reasoning
178
+ technique. Mandatory prompt sections and the token budget remain enforced.
179
+
180
+ Use `loopforge_status` with `view: "session"` for the live round and typed
181
+ projection, `view: "loop"` for alignment and drift, `view: "all"` after a
182
+ restart, and `view: "audit"` for the read-only completeness and evidence audit.
183
+ Use `loopforge_replay` for the committed timeline and round diffs. Replay
184
+ answers what happened; Audit checks whether facts and claims are supported.
185
+
186
+ The optional `.loopforge/state/<loopId>-state.md` file is derived and can be
187
+ regenerated. Read it in L2 pointer mode when the prompt asks for full context,
188
+ but do not treat it as an independent source of truth.
189
+
190
+ ## Control and delegation
191
+
192
+ Use `loopforge_pause` before an intentional interruption,
193
+ `loopforge_resume` to reconstruct a durable session, and `loopforge_stop` only
194
+ for an intentional terminal stop. Use `loopforge_gate_check` and
195
+ `loopforge_gate_resolve` for recorded human or agent gates.
196
+
197
+ Delegation does not create a separate LoopForge mode. Give each worker a
198
+ self-contained subtask and relevant hard constraints, then place its result in
199
+ `worker_results` so discoveries can enter the next Canonical State.
200
+
201
+ ## Rules
154
202
 
155
- - `loopforge_status({scope: "session", sessionId})` shows the live round. Add
156
- `detail: "full"` for cognition projections, prompt diagnostics, metrics and
157
- audit data.
158
- - `loopforge_status({scope: "loop", loopId})` reads loop-level health and
159
- audit. `scope: "all"` lists persisted loop summaries (including stopped
160
- loops for audit/recovery inspection) and accepts no ID.
161
- - `loopforge_history({loopId, view: "round", round})` reads one persisted
162
- round. `view: "timeline"` reads events in `event_sequence` order; use
163
- `fromSequence`, `toSequence` and `limit` (1-200) for pagination.
164
- - `loopforge_audit({loopId})` is read-only and reports criteria coverage,
165
- contradictions, evidence availability, unresolved User Gates, regression
166
- obligations and `sequenceComplete`.
167
-
168
- The old names `loopforge_list`, `loopforge_health`, `loopforge_inspect`, and
169
- `loopforge_replay` are not public tools.
170
-
171
- ## 7. Pause and resume
172
-
173
- Call `loopforge_pause` before an intentional interruption. After a client or
174
- process restart, call `loopforge_resume` with the saved `loopId`; do not start a
175
- new loop just because the in-memory session disappeared. Compare the returned
176
- `stateHash` and `promptHash`, then execute the rebuilt prompt. A loop can be
177
- resumed only from its persisted vault state.
178
-
179
- ## 8. Prompt levels and projections
180
-
181
- - **L0**: compact same-round retry with the rejection gap.
182
- - **L1**: normal continuation with current focus and required evidence.
183
- - **L2**: full rehydration after the first round, a phase boundary, goal or
184
- constraint change, stale or contradictory evidence, drift, recovery, or
185
- repeated low-information rounds.
186
-
187
- L0/L1/L2 control state density, not reasoning strategy. The prompt compiler
188
- reads canonical Goal, RoundEvent, EvidenceEnvelope, Constraint, SubGoal and
189
- GateDecision facts, then derives Phase, Focus, Todo, Handoff, progress and
190
- diagnostics. Mandatory objective, focus, gate, hard constraints and required
191
- fixes remain present under a prompt budget.
192
-
193
- ## 9. Workspace and command safety
194
-
195
- When LoopForge requests verification, run commands in the bound workspace only.
196
- Use executable plus argument arrays, `shell: false`, timeouts, output limits and
197
- path-boundary checks. Do not concatenate user-controlled strings into shell
198
- commands. This is LoopForge's evidence boundary; it does not grant or revoke
199
- the Agent's ordinary tool permissions.
200
-
201
- ## 10. Long-horizon habits
202
-
203
- Keep one loop focused on one user objective. Submit one honest report per
204
- round, preserve criterion and constraint IDs, and include a concrete next
205
- verification when continuing. Inspect the full state on L2 rounds. Use pause
206
- before handoff and audit before claiming final completion. LoopForge supports
207
- long runs through explicit rounds and durable replay, but it does not execute
208
- rounds in the background for you.
209
-
210
- ## 11. Reliability rules
211
-
212
- An invalid report is an input error, not a round fact. The runtime leaves the
213
- current `roundId`, attempt, state and vault unchanged and returns
214
- `invalid_round_report`; submit a corrected report instead of starting a new
215
- loop. A persistence error is not recoverable by pretending success: stop and
216
- retry the operation after the storage boundary is healthy.
217
-
218
- Evidence capture and recovery are asynchronous. `maxRounds` must be a positive
219
- integer no greater than the configured policy limit. Corrupt JSON, an invalid
220
- event format, or a sequence gap returns `storage_corruption`; the runtime never
221
- sorts, fills, or rewrites damaged history. Terminal enforcement rules track
222
- their escalation retry independently; the same rule terminates only after its
223
- guided retry has already been used.
224
-
225
- When intent drift is reported, use `driftClarification` with a concrete
226
- explanation and an anchor that exists in the current criteria, constraints or
227
- observed workspace evidence. Do not send `clarification_accepted: true`.
228
- Runtime verification owns the clarification streak and any escalation.
203
+ 1. Execute the prompt instead of generating another prompt.
204
+ 2. Submit one honest structured evaluation after each attempt.
205
+ 3. Restore the workspace before working after backtrack.
206
+ 4. Treat required command evidence and verification errors as authoritative.
207
+ 5. Keep one loop focused on one user objective.
208
+ 6. Do not advance a paused or stopped session through another process.
209
+ 7. Continue within the same Agent task when possible. LoopForge preserves state
210
+ but does not create a background Agent.
@@ -1,20 +0,0 @@
1
- import type { LoopStore } from "./loop-store.js";
2
- import type { VaultEntry } from "./vault-types.js";
3
- /** Single write boundary for canonical loop events.
4
- *
5
- * Stores may provide their own atomic sequence allocator (FileLoopStore does),
6
- * but the writer also assigns and validates sequences for lightweight test or
7
- * embedding backends. Every runtime event therefore enters the Vault through
8
- * one deterministic path.
9
- */
10
- export declare class CanonicalEventWriter {
11
- private readonly backend;
12
- constructor(backend: LoopStore);
13
- private allEntries;
14
- private replaceExisting;
15
- private existing;
16
- append(entry: VaultEntry): VaultEntry;
17
- appendBatch(entries: VaultEntry[]): VaultEntry[];
18
- private assertSequence;
19
- }
20
- //# sourceMappingURL=canonical-event-writer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"canonical-event-writer.d.ts","sourceRoot":"","sources":["../src/canonical-event-writer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;;GAMG;AACH,qBAAa,oBAAoB;IACnB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,SAAS;IAE/C,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,QAAQ;IAMhB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU;IAkCrC,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE;IAuChD,OAAO,CAAC,cAAc;CAiBvB"}
@@ -1,131 +0,0 @@
1
- import { StorageCorruptionError } from "./loop-store.js";
2
- /** Single write boundary for canonical loop events.
3
- *
4
- * Stores may provide their own atomic sequence allocator (FileLoopStore does),
5
- * but the writer also assigns and validates sequences for lightweight test or
6
- * embedding backends. Every runtime event therefore enters the Vault through
7
- * one deterministic path.
8
- */
9
- export class CanonicalEventWriter {
10
- backend;
11
- constructor(backend) {
12
- this.backend = backend;
13
- }
14
- allEntries() {
15
- // Global replacement needs entries from every loop, including backends
16
- // whose default query excludes canonical `:event` records. Keep this
17
- // fallback centralized here; per-loop runtime reads use queryLoopEvents.
18
- const entries = this.backend.listLoopIds()
19
- .flatMap((loopId) => this.backend.queryLoopEvents(loopId));
20
- const seen = new Set();
21
- return entries.filter((entry) => {
22
- const key = `${entry.task_id ?? entry.id ?? ""}:${entry.event_sequence ?? ""}`;
23
- if (seen.has(key))
24
- return false;
25
- seen.add(key);
26
- return true;
27
- });
28
- }
29
- replaceExisting(loopId, updated) {
30
- const all = this.allEntries();
31
- const filtered = all.filter((candidate) => !(candidate.loop_id === loopId && candidate.task_id === updated.task_id));
32
- const replacement = [...filtered, updated];
33
- this.backend.replaceEntries(replacement);
34
- }
35
- existing(loopId) {
36
- const entries = this.backend.queryLoopEvents(loopId);
37
- this.assertSequence(loopId, entries);
38
- return entries;
39
- }
40
- append(entry) {
41
- const write = () => {
42
- const loopId = entry.loop_id;
43
- if (!loopId)
44
- throw new Error("Canonical events require loop_id");
45
- if (entry.loop_id !== loopId)
46
- throw new StorageCorruptionError("sequence_cross_loop", loopId, loopId);
47
- const existing = this.existing(loopId);
48
- const prior = existing.find((candidate) => candidate.task_id === entry.task_id);
49
- if (prior && Number.isInteger(prior.event_sequence)) {
50
- const updated = { ...entry, event_sequence: prior.event_sequence };
51
- const priorComparable = { ...prior, id: undefined, timestamp: undefined };
52
- const updatedComparable = { ...updated, id: undefined, timestamp: undefined };
53
- if (JSON.stringify(priorComparable) === JSON.stringify(updatedComparable))
54
- return prior;
55
- this.replaceExisting(loopId, updated);
56
- return updated;
57
- }
58
- const max = existing.reduce((value, candidate) => typeof candidate.event_sequence === "number" && Number.isInteger(candidate.event_sequence)
59
- ? Math.max(value, candidate.event_sequence)
60
- : value, 0);
61
- const next = max + 1;
62
- const sequenced = { ...entry, event_sequence: entry.event_sequence ?? next };
63
- if (!Number.isInteger(sequenced.event_sequence) || sequenced.event_sequence < 1 ||
64
- existing.some((candidate) => candidate.event_sequence === sequenced.event_sequence)) {
65
- throw new StorageCorruptionError("sequence_duplicate", loopId, loopId, sequenced.event_sequence);
66
- }
67
- if (sequenced.event_sequence !== next) {
68
- throw new StorageCorruptionError("sequence_gap", loopId, loopId, sequenced.event_sequence);
69
- }
70
- this.backend.appendEntry(sequenced);
71
- return sequenced;
72
- };
73
- return this.backend.withLock(write);
74
- }
75
- appendBatch(entries) {
76
- if (entries.length === 0)
77
- return [];
78
- const write = () => {
79
- const loopIds = new Set(entries.map((entry) => entry.loop_id));
80
- if (loopIds.size !== 1 || loopIds.has(undefined)) {
81
- throw new Error("A canonical event batch must belong to one loop");
82
- }
83
- const loopId = [...loopIds][0];
84
- const existing = this.existing(loopId);
85
- const existingTaskIds = new Set(existing.map((candidate) => candidate.task_id).filter(Boolean));
86
- const batchTaskIds = entries.map((entry) => entry.task_id).filter(Boolean);
87
- if (batchTaskIds.length !== new Set(batchTaskIds).size ||
88
- batchTaskIds.some((taskId) => existingTaskIds.has(taskId))) {
89
- throw new Error(`Duplicate canonical task id in event batch for loop ${loopId}`);
90
- }
91
- const used = new Set(existing
92
- .map((candidate) => candidate.event_sequence)
93
- .filter((value) => typeof value === "number" && Number.isInteger(value)));
94
- let next = existing.reduce((value, candidate) => typeof candidate.event_sequence === "number" && Number.isInteger(candidate.event_sequence)
95
- ? Math.max(value, candidate.event_sequence)
96
- : value, 0) + 1;
97
- const sequenced = entries.map((entry) => ({ ...entry, event_sequence: entry.event_sequence ?? next++ }));
98
- const seen = new Set();
99
- for (const entry of sequenced) {
100
- if (!Number.isInteger(entry.event_sequence) || used.has(entry.event_sequence) || seen.has(entry.event_sequence)) {
101
- throw new StorageCorruptionError("sequence_duplicate", loopId, loopId, entry.event_sequence);
102
- }
103
- if (entry.event_sequence !== (existing.length ? Math.max(...used) : 0) + 1 + seen.size) {
104
- throw new StorageCorruptionError("sequence_gap", loopId, loopId, entry.event_sequence);
105
- }
106
- seen.add(entry.event_sequence);
107
- }
108
- this.backend.appendEntries(sequenced);
109
- return sequenced;
110
- };
111
- return this.backend.withLock(write);
112
- }
113
- assertSequence(loopId, entries) {
114
- const sorted = [...entries].sort((a, b) => (a.event_sequence ?? 0) - (b.event_sequence ?? 0));
115
- const seen = new Set();
116
- for (let index = 0; index < sorted.length; index++) {
117
- const sequence = sorted[index].event_sequence;
118
- if (!Number.isInteger(sequence) || sequence < 1) {
119
- throw new StorageCorruptionError("sequence_invalid", loopId, loopId, sequence);
120
- }
121
- if (seen.has(sequence)) {
122
- throw new StorageCorruptionError("sequence_duplicate", loopId, loopId, sequence);
123
- }
124
- seen.add(sequence);
125
- if (sequence !== index + 1) {
126
- throw new StorageCorruptionError("sequence_gap", loopId, loopId, sequence);
127
- }
128
- }
129
- }
130
- }
131
- //# sourceMappingURL=canonical-event-writer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"canonical-event-writer.js","sourceRoot":"","sources":["../src/canonical-event-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAIzD;;;;;;GAMG;AACH,MAAM,OAAO,oBAAoB;IACF;IAA7B,YAA6B,OAAkB;QAAlB,YAAO,GAAP,OAAO,CAAW;IAAG,CAAC;IAE3C,UAAU;QAChB,uEAAuE;QACvE,qEAAqE;QACrE,yEAAyE;QACzE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;aACvC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,MA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undProjection | null;
4
- /** Derive the complete SubGoal lifecycle from prior entries and this projection. */
5
- export declare function manageSubGoals(loopId: string, currentRound: number, lastRoundResult: CompilerRoundProjection | null, vaultContext: Record<string, unknown> | null, project: EntryProjection): SubGoal[];
6
- export {};
7
- //# sourceMappingURL=compiler-subgoals.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compiler-subgoals.d.ts","sourceRoot":"","sources":["../src/compiler-subgoals.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAItE,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACrC,KAAK,eAAe,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,uBAAuB,GAAG,IAAI,CAAC;AAoBxE,oFAAoF;AACpF,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,uBAAuB,GAAG,IAAI,EAC/C,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EAC5C,OAAO,EAAE,eAAe,GACvB,OAAO,EAAE,CAwDX"}