loopforge 3.9.4 → 4.0.7

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 (283) hide show
  1. package/README.md +236 -112
  2. package/dist/audit.d.ts +73 -15
  3. package/dist/audit.d.ts.map +1 -1
  4. package/dist/audit.js +131 -61
  5. package/dist/audit.js.map +1 -1
  6. package/dist/canonical-state.d.ts +114 -40
  7. package/dist/canonical-state.d.ts.map +1 -1
  8. package/dist/canonical-state.js +276 -182
  9. package/dist/canonical-state.js.map +1 -1
  10. package/dist/cli.d.ts.map +1 -1
  11. package/dist/cli.js +41 -12
  12. package/dist/cli.js.map +1 -1
  13. package/dist/cognitive-governance.d.ts +0 -2
  14. package/dist/cognitive-governance.d.ts.map +1 -1
  15. package/dist/cognitive-governance.js +0 -4
  16. package/dist/cognitive-governance.js.map +1 -1
  17. package/dist/committed-round.d.ts +97 -156
  18. package/dist/committed-round.d.ts.map +1 -1
  19. package/dist/committed-round.js +223 -419
  20. package/dist/committed-round.js.map +1 -1
  21. package/dist/constraint-lifecycle.d.ts +73 -0
  22. package/dist/constraint-lifecycle.d.ts.map +1 -0
  23. package/dist/constraint-lifecycle.js +174 -0
  24. package/dist/constraint-lifecycle.js.map +1 -0
  25. package/dist/context-boundary.d.ts +83 -0
  26. package/dist/context-boundary.d.ts.map +1 -0
  27. package/dist/context-boundary.js +101 -0
  28. package/dist/context-boundary.js.map +1 -0
  29. package/dist/contract-items.d.ts +12 -8
  30. package/dist/contract-items.d.ts.map +1 -1
  31. package/dist/contract-items.js +31 -26
  32. package/dist/contract-items.js.map +1 -1
  33. package/dist/contract-requirement.d.ts +47 -0
  34. package/dist/contract-requirement.d.ts.map +1 -0
  35. package/dist/contract-requirement.js +51 -0
  36. package/dist/contract-requirement.js.map +1 -0
  37. package/dist/criterion-status.d.ts +35 -0
  38. package/dist/criterion-status.d.ts.map +1 -0
  39. package/dist/criterion-status.js +89 -0
  40. package/dist/criterion-status.js.map +1 -0
  41. package/dist/enforcement-gate.d.ts +26 -38
  42. package/dist/enforcement-gate.d.ts.map +1 -1
  43. package/dist/enforcement-gate.js +196 -319
  44. package/dist/enforcement-gate.js.map +1 -1
  45. package/dist/engine.d.ts +9 -103
  46. package/dist/engine.d.ts.map +1 -1
  47. package/dist/engine.js +27 -897
  48. package/dist/engine.js.map +1 -1
  49. package/dist/errors.d.ts +41 -0
  50. package/dist/errors.d.ts.map +1 -0
  51. package/dist/errors.js +69 -0
  52. package/dist/errors.js.map +1 -0
  53. package/dist/evidence-claims.d.ts +33 -31
  54. package/dist/evidence-claims.d.ts.map +1 -1
  55. package/dist/evidence-claims.js +58 -72
  56. package/dist/evidence-claims.js.map +1 -1
  57. package/dist/evidence-posture-view.d.ts +19 -0
  58. package/dist/evidence-posture-view.d.ts.map +1 -0
  59. package/dist/evidence-posture-view.js +116 -0
  60. package/dist/evidence-posture-view.js.map +1 -0
  61. package/dist/evidence-posture.d.ts +73 -0
  62. package/dist/evidence-posture.d.ts.map +1 -0
  63. package/dist/evidence-posture.js +281 -0
  64. package/dist/evidence-posture.js.map +1 -0
  65. package/dist/evidence-provider.d.ts +55 -37
  66. package/dist/evidence-provider.d.ts.map +1 -1
  67. package/dist/evidence-provider.js +182 -332
  68. package/dist/evidence-provider.js.map +1 -1
  69. package/dist/explain.d.ts +166 -27
  70. package/dist/explain.d.ts.map +1 -1
  71. package/dist/explain.js +372 -58
  72. package/dist/explain.js.map +1 -1
  73. package/dist/field-accounting.d.ts.map +1 -1
  74. package/dist/field-accounting.js +3 -22
  75. package/dist/field-accounting.js.map +1 -1
  76. package/dist/generate-schema.js +13 -8
  77. package/dist/generate-schema.js.map +1 -1
  78. package/dist/git-boundary.d.ts +128 -0
  79. package/dist/git-boundary.d.ts.map +1 -0
  80. package/dist/git-boundary.js +625 -0
  81. package/dist/git-boundary.js.map +1 -0
  82. package/dist/git-facts.d.ts +22 -0
  83. package/dist/git-facts.d.ts.map +1 -0
  84. package/dist/git-facts.js +29 -0
  85. package/dist/git-facts.js.map +1 -0
  86. package/dist/git-motion.d.ts +37 -0
  87. package/dist/git-motion.d.ts.map +1 -0
  88. package/dist/git-motion.js +59 -0
  89. package/dist/git-motion.js.map +1 -0
  90. package/dist/history.d.ts +44 -0
  91. package/dist/history.d.ts.map +1 -0
  92. package/dist/history.js +77 -0
  93. package/dist/history.js.map +1 -0
  94. package/dist/index.d.ts +19 -9
  95. package/dist/index.d.ts.map +1 -1
  96. package/dist/index.js +12 -4
  97. package/dist/index.js.map +1 -1
  98. package/dist/init.d.ts +16 -0
  99. package/dist/init.d.ts.map +1 -1
  100. package/dist/init.js +80 -14
  101. package/dist/init.js.map +1 -1
  102. package/dist/loop-compiler.d.ts +39 -23
  103. package/dist/loop-compiler.d.ts.map +1 -1
  104. package/dist/loop-compiler.js +368 -565
  105. package/dist/loop-compiler.js.map +1 -1
  106. package/dist/loop-store.d.ts +6 -5
  107. package/dist/loop-store.d.ts.map +1 -1
  108. package/dist/loop-store.js +153 -35
  109. package/dist/loop-store.js.map +1 -1
  110. package/dist/mcp/round-lifecycle.d.ts +255 -81
  111. package/dist/mcp/round-lifecycle.d.ts.map +1 -1
  112. package/dist/mcp/round-lifecycle.js +1552 -539
  113. package/dist/mcp/round-lifecycle.js.map +1 -1
  114. package/dist/mcp/server.d.ts.map +1 -1
  115. package/dist/mcp/server.js +42 -18
  116. package/dist/mcp/server.js.map +1 -1
  117. package/dist/mcp/session.d.ts +81 -39
  118. package/dist/mcp/session.d.ts.map +1 -1
  119. package/dist/mcp/session.js +956 -282
  120. package/dist/mcp/session.js.map +1 -1
  121. package/dist/mcp/submission-boundary.d.ts +23 -31
  122. package/dist/mcp/submission-boundary.d.ts.map +1 -1
  123. package/dist/mcp/submission-boundary.js +242 -92
  124. package/dist/mcp/submission-boundary.js.map +1 -1
  125. package/dist/mcp/submission-handle.d.ts +66 -0
  126. package/dist/mcp/submission-handle.d.ts.map +1 -0
  127. package/dist/mcp/submission-handle.js +173 -0
  128. package/dist/mcp/submission-handle.js.map +1 -0
  129. package/dist/mcp/tools.d.ts +17 -7
  130. package/dist/mcp/tools.d.ts.map +1 -1
  131. package/dist/mcp/tools.js +707 -244
  132. package/dist/mcp/tools.js.map +1 -1
  133. package/dist/open-question.d.ts +7 -0
  134. package/dist/open-question.d.ts.map +1 -0
  135. package/dist/open-question.js +14 -0
  136. package/dist/open-question.js.map +1 -0
  137. package/dist/policy-metrics.d.ts +31 -21
  138. package/dist/policy-metrics.d.ts.map +1 -1
  139. package/dist/policy-metrics.js +117 -64
  140. package/dist/policy-metrics.js.map +1 -1
  141. package/dist/policy.d.ts +11 -39
  142. package/dist/policy.d.ts.map +1 -1
  143. package/dist/policy.js +12 -12
  144. package/dist/policy.js.map +1 -1
  145. package/dist/progress.d.ts +45 -0
  146. package/dist/progress.d.ts.map +1 -0
  147. package/dist/progress.js +136 -0
  148. package/dist/progress.js.map +1 -0
  149. package/dist/prompt-assembler.d.ts +20 -6
  150. package/dist/prompt-assembler.d.ts.map +1 -1
  151. package/dist/prompt-assembler.js +475 -479
  152. package/dist/prompt-assembler.js.map +1 -1
  153. package/dist/prompt-coverage.d.ts +0 -6
  154. package/dist/prompt-coverage.d.ts.map +1 -1
  155. package/dist/prompt-coverage.js +4 -8
  156. package/dist/prompt-coverage.js.map +1 -1
  157. package/dist/prompt-freshness.d.ts +6 -17
  158. package/dist/prompt-freshness.d.ts.map +1 -1
  159. package/dist/prompt-freshness.js +27 -22
  160. package/dist/prompt-freshness.js.map +1 -1
  161. package/dist/prompt-policy.d.ts +14 -7
  162. package/dist/prompt-policy.d.ts.map +1 -1
  163. package/dist/prompt-policy.js +21 -5
  164. package/dist/prompt-policy.js.map +1 -1
  165. package/dist/protocol.d.ts +843 -424
  166. package/dist/protocol.d.ts.map +1 -1
  167. package/dist/protocol.js +73 -102
  168. package/dist/protocol.js.map +1 -1
  169. package/dist/recovery-guidance.d.ts +13 -0
  170. package/dist/recovery-guidance.d.ts.map +1 -0
  171. package/dist/recovery-guidance.js +15 -0
  172. package/dist/recovery-guidance.js.map +1 -0
  173. package/dist/recovery.d.ts +68 -0
  174. package/dist/recovery.d.ts.map +1 -0
  175. package/dist/recovery.js +234 -0
  176. package/dist/recovery.js.map +1 -0
  177. package/dist/replay.d.ts +42 -8
  178. package/dist/replay.d.ts.map +1 -1
  179. package/dist/replay.js +311 -84
  180. package/dist/replay.js.map +1 -1
  181. package/dist/result-facts.d.ts +45 -0
  182. package/dist/result-facts.d.ts.map +1 -0
  183. package/dist/result-facts.js +86 -0
  184. package/dist/result-facts.js.map +1 -0
  185. package/dist/round-contract.d.ts +38 -8
  186. package/dist/round-contract.d.ts.map +1 -1
  187. package/dist/round-contract.js +71 -31
  188. package/dist/round-contract.js.map +1 -1
  189. package/dist/round-coordinator.d.ts +41 -89
  190. package/dist/round-coordinator.d.ts.map +1 -1
  191. package/dist/round-coordinator.js +250 -267
  192. package/dist/round-coordinator.js.map +1 -1
  193. package/dist/round-driver.d.ts +56 -16
  194. package/dist/round-driver.d.ts.map +1 -1
  195. package/dist/round-driver.js +225 -39
  196. package/dist/round-driver.js.map +1 -1
  197. package/dist/round-facts.d.ts +33 -52
  198. package/dist/round-facts.d.ts.map +1 -1
  199. package/dist/round-facts.js +51 -160
  200. package/dist/round-facts.js.map +1 -1
  201. package/dist/round-guidance.d.ts +56 -0
  202. package/dist/round-guidance.d.ts.map +1 -0
  203. package/dist/round-guidance.js +161 -0
  204. package/dist/round-guidance.js.map +1 -0
  205. package/dist/round-outcome.d.ts +21 -0
  206. package/dist/round-outcome.d.ts.map +1 -0
  207. package/dist/round-outcome.js +31 -0
  208. package/dist/round-outcome.js.map +1 -0
  209. package/dist/round-transaction.d.ts +168 -21
  210. package/dist/round-transaction.d.ts.map +1 -1
  211. package/dist/round-transaction.js +837 -38
  212. package/dist/round-transaction.js.map +1 -1
  213. package/dist/self-eval.d.ts +37 -61
  214. package/dist/self-eval.d.ts.map +1 -1
  215. package/dist/self-eval.js +413 -392
  216. package/dist/self-eval.js.map +1 -1
  217. package/dist/storage.d.ts +16 -0
  218. package/dist/storage.d.ts.map +1 -1
  219. package/dist/storage.js +54 -4
  220. package/dist/storage.js.map +1 -1
  221. package/dist/subgoal-state.d.ts +2 -3
  222. package/dist/subgoal-state.d.ts.map +1 -1
  223. package/dist/subgoal-state.js +2 -3
  224. package/dist/subgoal-state.js.map +1 -1
  225. package/dist/submission-guidance.d.ts +29 -21
  226. package/dist/submission-guidance.d.ts.map +1 -1
  227. package/dist/submission-guidance.js +308 -260
  228. package/dist/submission-guidance.js.map +1 -1
  229. package/dist/submission-receipt.d.ts +16 -8
  230. package/dist/submission-receipt.d.ts.map +1 -1
  231. package/dist/submission-receipt.js +145 -51
  232. package/dist/submission-receipt.js.map +1 -1
  233. package/dist/token-utils.d.ts +28 -7
  234. package/dist/token-utils.d.ts.map +1 -1
  235. package/dist/token-utils.js +27 -11
  236. package/dist/token-utils.js.map +1 -1
  237. package/dist/transaction-identity.d.ts +9 -0
  238. package/dist/transaction-identity.d.ts.map +1 -0
  239. package/dist/transaction-identity.js +69 -0
  240. package/dist/transaction-identity.js.map +1 -0
  241. package/dist/verification-actions.d.ts.map +1 -1
  242. package/dist/verification-actions.js +10 -11
  243. package/dist/verification-actions.js.map +1 -1
  244. package/dist/verification-gate.d.ts +23 -47
  245. package/dist/verification-gate.d.ts.map +1 -1
  246. package/dist/verification-gate.js +202 -423
  247. package/dist/verification-gate.js.map +1 -1
  248. package/dist/version.d.ts +1 -1
  249. package/dist/version.js +1 -1
  250. package/dist/working-memory.d.ts +187 -0
  251. package/dist/working-memory.d.ts.map +1 -0
  252. package/dist/working-memory.js +767 -0
  253. package/dist/working-memory.js.map +1 -0
  254. package/dist/workspace-checkpoint.d.ts +88 -0
  255. package/dist/workspace-checkpoint.d.ts.map +1 -0
  256. package/dist/workspace-checkpoint.js +326 -0
  257. package/dist/workspace-checkpoint.js.map +1 -0
  258. package/dist/workspace-restore.d.ts +68 -0
  259. package/dist/workspace-restore.d.ts.map +1 -0
  260. package/dist/workspace-restore.js +604 -0
  261. package/dist/workspace-restore.js.map +1 -0
  262. package/dist/workspace.d.ts +0 -9
  263. package/dist/workspace.d.ts.map +1 -1
  264. package/dist/workspace.js +0 -17
  265. package/dist/workspace.js.map +1 -1
  266. package/loop_policy.json +4 -18
  267. package/package.json +68 -68
  268. package/skills/forge/SKILL.md +212 -0
  269. package/skills/forge/references/evidence-and-contracts.md +204 -0
  270. package/skills/forge/references/recovery-and-views.md +188 -0
  271. package/dist/cognitive-facts.d.ts +0 -30
  272. package/dist/cognitive-facts.d.ts.map +0 -1
  273. package/dist/cognitive-facts.js +0 -113
  274. package/dist/cognitive-facts.js.map +0 -1
  275. package/dist/loop-extras-parser.d.ts +0 -81
  276. package/dist/loop-extras-parser.d.ts.map +0 -1
  277. package/dist/loop-extras-parser.js +0 -213
  278. package/dist/loop-extras-parser.js.map +0 -1
  279. package/dist/loop-projection.d.ts +0 -6
  280. package/dist/loop-projection.d.ts.map +0 -1
  281. package/dist/loop-projection.js +0 -28
  282. package/dist/loop-projection.js.map +0 -1
  283. package/skills/perception/SKILL.md +0 -389
@@ -1 +0,0 @@
1
- {"version":3,"file":"loop-extras-parser.js","sourceRoot":"","sources":["../src/loop-extras-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAYH,8EAA8E;AAE9E,MAAM,OAAO,iBAAiB;IAC5B;;iFAE6E;IACpE,MAAM,GAAiB,EAAE,CAAC;IAElB,MAAM,CAA0B;IAEjD,YAAY,MAA+B;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,0EAA0E;IAE1E;2DACuD;IACvD,MAAM,CAAC,GAAW,EAAE,QAAQ,GAAG,EAAE;QAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,QAAQ,CAAC;QACvD,IAAI,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IAAgC,CAAC,QAAQ,KAAK,QAAQ;YAC9D,OAAQ,IAAgC,CAAC,KAAK,KAAK,QAAQ;YAC3D,OAAQ,IAAgC,CAAC,KAAK,KAAK,QAAQ;YAC3D,OAAQ,IAAgC,CAAC,MAAM,KAAK,QAAQ,EAC5D,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,IAAmC,CAAC,CAAC;QAClD,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;gBACd,KAAK,EAAE,sBAAsB,CAAC,GAAG;gBACjC,OAAO,EAAE,kCAAkC;gBAC3C,QAAQ,EAAE,IAAI;aACf,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,6 +0,0 @@
1
- /** Typed adapter over cognitive facts. It performs no vault traversal or
2
- * independent state derivation. */
3
- import type { DerivedCognitiveFacts } from "./cognitive-facts.js";
4
- import type { LoopProjection } from "./protocol.js";
5
- export declare function buildLoopProjection(facts: DerivedCognitiveFacts): LoopProjection | null;
6
- //# sourceMappingURL=loop-projection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loop-projection.d.ts","sourceRoot":"","sources":["../src/loop-projection.ts"],"names":[],"mappings":"AAAA;mCACmC;AAEnC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGpD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,qBAAqB,GAC3B,cAAc,GAAG,IAAI,CAuBvB"}
@@ -1,28 +0,0 @@
1
- /** Typed adapter over cognitive facts. It performs no vault traversal or
2
- * independent state derivation. */
3
- import { makeLoopProjection } from "./protocol.js";
4
- export function buildLoopProjection(facts) {
5
- const projection = makeLoopProjection({
6
- focus: facts.focus,
7
- todo: [...facts.todo],
8
- phase: facts.phase,
9
- delegation: {
10
- pending: facts.delegation.pending,
11
- last_results: [...facts.delegation.last_results],
12
- },
13
- handoff: {
14
- summary: facts.handoff.summary,
15
- verified: [...facts.handoff.verified],
16
- open_risks: [...facts.handoff.open_risks],
17
- },
18
- verified_subgoals: [...facts.verified_subgoals],
19
- });
20
- const empty = projection.focus === null && projection.todo.length === 0 &&
21
- projection.phase === null && projection.delegation.last_results.length === 0 &&
22
- projection.handoff.summary.length === 0 &&
23
- projection.handoff.verified.length === 0 &&
24
- projection.handoff.open_risks.length === 0 &&
25
- projection.verified_subgoals.length === 0;
26
- return empty ? null : projection;
27
- }
28
- //# sourceMappingURL=loop-projection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loop-projection.js","sourceRoot":"","sources":["../src/loop-projection.ts"],"names":[],"mappings":"AAAA;mCACmC;AAInC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,UAAU,mBAAmB,CACjC,KAA4B;IAE5B,MAAM,UAAU,GAAG,kBAAkB,CAAC;QACpC,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;QACrB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,UAAU,EAAE;YACV,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO;YACjC,YAAY,EAAE,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC;SACjD;QACD,OAAO,EAAE;YACP,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO;YAC9B,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;YACrC,UAAU,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;SAC1C;QACD,iBAAiB,EAAE,CAAC,GAAG,KAAK,CAAC,iBAAiB,CAAC;KAChD,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,KAAK,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;QACrE,UAAU,CAAC,KAAK,KAAK,IAAI,IAAI,UAAU,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC;QAC5E,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;QACvC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;QACxC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;QAC1C,UAAU,CAAC,iBAAiB,CAAC,MAAM,KAAK,CAAC,CAAC;IAC5C,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;AACnC,CAAC"}
@@ -1,389 +0,0 @@
1
- ---
2
- name: perception
3
- description: Drive multi-round coding tasks through LoopForge MCP so objectives, constraints, evidence, and decisions survive context loss and restarts. The external Agent remains responsible for planning, file changes, tools, and execution.
4
- ---
5
-
6
- # Perception
7
-
8
- Use LoopForge when a task spans several meaningful work slices, must survive a
9
- restart or context loss, or needs an auditable distinction between Agent claims
10
- and machine-verified facts.
11
-
12
- LoopForge has one factual source, committed typed round documents in the Vault,
13
- and one cognitive source, Canonical State compiled from those documents. The
14
- Agent still decides what to do and how to reason.
15
-
16
- ## Start
17
-
18
- Call `loopforge_status` with `view: "all"` before starting. Reuse an existing
19
- session for the same objective instead of opening a second loop.
20
-
21
- Call `loopforge_start` with:
22
-
23
- - `task`: the complete user objective;
24
- - `criteria`: the initial success criteria, each becoming a stable `cr-*`
25
- anchor rendered in every prompt (omit to keep the default criterion);
26
- - `constraints`: hard boundaries that must survive every round;
27
- - optional `maxRounds`, `domain`, `loopId`, and `planSource`.
28
-
29
- Keep the returned `sessionId`, `roundId`, prompt, and level. Pass the latest
30
- `roundId` to every `loopforge_next`; it anchors the submission to the exact
31
- round being reported.
32
-
33
- ## What is a round?
34
-
35
- A round is one coherent work slice that can be described, checked, and
36
- disposed of at the next boundary. It is not a fixed number of files, tokens,
37
- commits, or minutes. A capable Agent may complete a large change in one round
38
- when the change shares one objective, one evidence story, and one recovery
39
- path. Split it when those boundaries diverge.
40
-
41
- Before choosing the slice, ask:
42
-
43
- 1. **Coherence:** does the work serve one immediate objective rather than
44
- several unrelated goals?
45
- 2. **Verifiability:** can the result and its hard constraints be checked with
46
- the available tests, commands, or other machine observations?
47
- 3. **Disposition:** will the boundary produce a clear continuation, stop,
48
- blocker, rejection, or recovery decision?
49
- 4. **Recovery:** can the slice be safely retried or rolled back without
50
- invalidating unrelated work?
51
-
52
- Make a round larger when changes are tightly coupled and can be verified
53
- together. Make it smaller when uncertainty, external effects, evidence gaps,
54
- or rollback risk is high. Do not combine independent objectives merely because
55
- the Agent can edit them in one context. Do not split a single atomic change
56
- only to create more round records.
57
-
58
- At the end of a round, inspect the actual diff, relevant tests, hard
59
- constraints, and remaining work. A completed slice is not the same as a
60
- completed task.
61
-
62
- ## Plan the next slice
63
-
64
- For work that spans rounds, submit `round_contract` as a proposal for the next
65
- slice. Size the slice by what one machine-checkable outcome covers — a
66
- requirements list is not a round list, and coupled changes that share one
67
- objective, one evidence story, and one recovery path belong in the same round.
68
- Bind each item to a configured evidence command with `verify_with`, and limit
69
- `scope` to files or directories that slice may touch. `criterion_refs` must
70
- cite real `cr-*` ids rendered in the current prompt; `subgoal_refs` may cite
71
- only active `sg-*` ids shown in it — a sub-goal declared in this same
72
- submission becomes referenceable next round. Free text, unknown ids, duplicate
73
- refs, and duplicate normalized items are rejected as `contract_invalid`. The
74
- proposal becomes active only after its declaring round commits.
75
- While it is open, you do **not** need to restate it: omitting `round_contract`
76
- continues the active contract. A different proposal is ignored as
77
- `contract_premature`. If this round closes the contract and another slice
78
- follows, declare the successor in this same submission. If the slice is
79
- blocked, report `outcome: "blocked"` with a concrete `blocker` instead of
80
- silently replacing the active contract.
81
-
82
- This is a planning aid, not a second gate. LoopForge learns the plan only from
83
- committed evaluation fields, contract proposals, observations, and changes.
84
-
85
- ## Execute a round
86
-
87
- 1. Execute the returned prompt and do the repository work.
88
- 2. Use the tools and reasoning approach that fit the slice.
89
- 3. Check actual evidence before claiming success.
90
- 4. Submit exactly one structured evaluation with `loopforge_next`.
91
-
92
- After the strict boundary accepts the payload, LoopForge collects before/after
93
- evidence, runs the **verification gate**, then runs the **enforcement gate**.
94
- The verification gate checks evaluation consistency, evidence integrity, plan
95
- and contract conformance, and progress and recovery. The enforcement gate
96
- turns those findings into one disposition: accept, reject, backtrack, or
97
- terminate.
98
-
99
- The four core evaluation fields are strict:
100
-
101
- | Field | Requirement |
102
- | --- | --- |
103
- | `success` | Boolean. `true` only when the whole objective and hard constraints are satisfied. |
104
- | `output_summary` | String describing what changed and what was verified. |
105
- | `constraint_violations` | Array of real violations, preferably using `c-XXXXXXXX` IDs. |
106
- | `should_continue` | Boolean. `false` only when the whole task is complete. |
107
-
108
- Before submitting, check whether any of these events actually happened. Fill the
109
- matching field only when it did; omit it otherwise.
110
-
111
- | Event | Field | What LoopForge does with it |
112
- | --- | --- | --- |
113
- | The round changed files or ran tests | `execution_report.files_changed`, `execution_report.tests_reported` | Compares the report with machine observations; test counts stay self-reported |
114
- | You found a constraint later rounds must respect | `discovered_constraints` | The compiler merges it into the active set |
115
- | Evidence falsified an earlier assumption | `wrong_assumptions` | Feeds corrected-assumption state and recovery facts |
116
- | A sub-problem surfaced | `emerged_subtasks` | The only sub-goal creation channel |
117
- | An active sub-goal moved status | `subgoal_updates` | Applies an explicit transition |
118
- | You delegated work | `worker_results` | Saves the report and delegation journal entry; does **not** promote worker discoveries |
119
- | You are planning the next slice | `round_contract` | Becomes active only after this round commits |
120
- | A contract item progressed | `execution_report.contract_item_claims` | Starts machine evaluation; the item is verified only when its bound commands pass |
121
- | A success criterion moved | `execution_report.criterion_claims` | Advisory; cite the real `cr-` id/text from the prompt. Unknown references are dropped with a diagnostic; machine evidence still decides |
122
- | You need context emphasized | `prompt_requests` | Exact-match reorder or confusion alerts in the next prompt; never long-term knowledge |
123
- | You reached a meaningful boundary | `compression_checkpoint`, `checkpoint_label` | Creates a recoverable milestone |
124
- | You are blocked or stopping | `outcome`, `blocker`, `stop_reason`, `no_change_reason` | Runs the corresponding stop/lifecycle rule |
125
- | You understand the objective better | `objective_refinement` | Appends to the objective; never replaces it |
126
- | A constraint or criterion is wrong | `retracted_constraints`, `revised_success_criteria` | Updates derived state within existing boundaries |
127
- | You need a prior approval checked | `gate_ids`; `retroactiveClaims` | Checks existing gate references or prior-round evidence |
128
-
129
- `execution_report.files_changed` is the **boundary net change**: paths whose
130
- content or file type differs between round preparation and this submission,
131
- including deletions. A commit alone adds no entry when content is unchanged.
132
- Do not list gitignored paths merely to look complete. The receipt's
133
- `files_reconciliation` block compares your report with the machine change set
134
- and reports match/mismatch/unknown/not_applicable; an unobservable Git boundary
135
- is `unknown`, never an empty diff.
136
-
137
- `emerged_subtasks` is the only sub-goal creation channel. It contains plain
138
- descriptions, never `sg-` IDs. `subgoal_updates` changes existing active IDs;
139
- done and canceled are terminal and cannot be reopened. The prompt or
140
- `submission_guidance` renders the real active IDs; never invent one.
141
-
142
- `outcome` may be `success`, `partial`, `failed`, or `blocked`. A blocked
143
- outcome needs a concrete `blocker`; `stop_reason` of `blocked` or
144
- `needs_human_input` also stops without claiming success.
145
-
146
- Optional malformed values are normalized or dropped. The strict exceptions are
147
- `subgoal_updates`, `round_contract`, and
148
- `execution_report.contract_item_claims`. Shape, reference, duplicate, command,
149
- and workspace-containment errors return `evaluation_invalid` or
150
- `contract_invalid` before advance. Correct the payload and resubmit the same
151
- `roundId`; nothing is committed and no rejection counter moves.
152
-
153
- A successful round should include an `execution_report`. An empty or missing
154
- report is a reporting gap (a `warn`), not by itself a rejection: acceptance is
155
- decided by machine evidence and contract rules, never by how many optional
156
- fields were filled. `no_change_reason` is an escape only when no enabled
157
- verification command exists. It never creates evidence and never excuses an
158
- open contract.
159
-
160
- Agent reports are claims quoted for audit. They never become verified facts.
161
- Do not infer a missing field from natural language, do not fill a field to
162
- satisfy a coverage check, and do not put a guessed evaluation in free text.
163
- When no event occurred, omit the field.
164
-
165
- Each prepared response carries `submission_guidance` with the real contract
166
- item ids/statuses, active sub-goal ids, real criterion ids/text, usable
167
- commands and the fields that apply now. Each submission returns
168
- `submission_receipt`, which separates: reports that were saved, derived state
169
- that actually changed, and machine verification results, plus the structured
170
- `files_reconciliation` block. A report marked `saved` is not a verified fact.
171
-
172
- ## IDs and contracts
173
-
174
- Prompts render stable IDs beside constraints, criteria, sub-goals, and contract
175
- items. Prefer those IDs for `constraint_violations`, criterion claims, status
176
- updates, and item claims.
177
-
178
- Every level renders the same protected normative set — criteria, active
179
- constraints, the active contract and all items, active sub-goal ids, current
180
- findings, and (when present) the recovery brief. Display caps may shorten
181
- descriptions but never remove ids. `prompt_artifact.coverage` records the
182
- proof; a missing active id fails closed with `projection_incomplete` rather
183
- than delivering a partial prompt. A redo prompt carries the restore HEAD and
184
- failed-round file facts in its protected Recovery Brief.
185
-
186
- A sub-goal ID belongs to its declaration event. Re-declaring the same text in a
187
- later round creates a new sub-goal. Status changes require the exact active
188
- `sg-` ID; description matching is not a fallback.
189
-
190
- A Round Contract is a set of evidence-bound items, not prose. Each item must
191
- bind at least one configured, enabled, after-capable command. The runtime
192
- derives content-addressed `rc-XXXXXXXX` and `rci-XXXXXXXX` IDs, so restating an
193
- unchanged proposal keeps its identity. `subgoal_refs` belongs on the item; a
194
- machine-verified item backs exactly the sub-goals it names, without changing
195
- their declared `SubGoal.status`.
196
-
197
- Item status is machine-derived:
198
-
199
- - `pending`: not claimed as met;
200
- - `insufficient`: claimed as met but not backed by all required observations;
201
- - `contradicted`: a bound observation fails, or its entrypoint/configuration is
202
- no longer trustworthy;
203
- - `verified`: the Agent claims `met`, every bound command passes in the closing
204
- round's after phase, and the declaration binding remains intact.
205
-
206
- The contract closes only when every item is `verified` or a round reports
207
- `outcome: "blocked"`. Repeated unbacked claims create bounded verification
208
- debt. The same-check streak escalates at
209
- `engine.unverified_claim_streak_limit` (default 3) instead of retrying forever.
210
-
211
- Sub-goals may evolve during execution. LoopForge does not use fuzzy intent or
212
- similarity to judge drift. The enforced boundary is contract `scope`: work
213
- outside it is `round_scope_drift`, a machine fact no explanation waives. Revert
214
- the out-of-scope change, or close the contract as blocked and declare the
215
- expanded scope in a new proposal whose `scope` covers **every** file this round
216
- changed outside the current one — a partial expansion is still drift.
217
-
218
- ## Evidence commands
219
-
220
- Contract items are backed by commands the OPERATOR configures. The Agent never
221
- declares one, and does not discover or run project scripts to invent one. They
222
- live in `loop_policy.json` under `evidence.commands`, in the workspace the
223
- server was started in:
224
-
225
- ```json
226
- {
227
- "version": "5",
228
- "evidence": {
229
- "commands": [{
230
- "name": "verify",
231
- "enabled": true,
232
- "executable": "node",
233
- "args": ["scripts/verify.mjs"],
234
- "cwd": ".",
235
- "phase": "after",
236
- "required": true,
237
- "timeout_ms": 120000,
238
- "max_output_chars": 8000,
239
- "success_exit_codes": [0]
240
- }]
241
- }
242
- }
243
- ```
244
-
245
- `executable` and `args` are spawned without a shell and confined to the
246
- workspace. `loopforge doctor` statically checks every configured command —
247
- its name, executable, arguments, timeouts, and workspace containment — and
248
- never executes one.
249
-
250
- Every prepared response carries `submission_guidance.contract_commands` and
251
- `submission_guidance.contract_verification_available`; `loopforge_status`
252
- `view=session` also returns the full `capability` object. When verification is
253
- unavailable, no configured command can back a contract item: run rounds without
254
- a contract instead of declaring items that cannot close. The `warnings` list
255
- states the same thing in words.
256
-
257
- A command's ENTRYPOINT is the file it names plus `package.json` when a package
258
- manager runs it. It must already be part of the workspace when the round
259
- starts, and it must not change during the round that runs it — the runtime
260
- records those files at round start and compares them afterwards, whether or not
261
- git can see them. A changed entrypoint makes the observation untrustworthy:
262
- restore it to its round-start content. Do not author the verification script
263
- inside the round you expect it to verify — that round cannot be closed by it.
264
-
265
- To keep a script that must survive a rollback, it has to be part of the
266
- committed workspace rather than an uncommitted change: the post-backtrack
267
- restore check rejects a skipped file that is still byte-identical to its state
268
- at the rollback, so a script left sitting in the working tree blocks the redo.
269
- Prepare it before the round that depends on it.
270
-
271
- ## Backtrack and recovery
272
-
273
- A progress stall requires observable Git history over the lookback window.
274
- Committed work counts as motion through the Git HEAD change, even when the
275
- closing worktree is clean, and the round you are submitting counts too: if it
276
- moved files or committed, it cancels the verdict. If machine history cannot be
277
- read, no stall verdict is made. A machine-backed success round is finishing,
278
- even if its closing round changes no files.
279
-
280
- Backtrack records a rollback directive and restores the round counter to the
281
- last clean committed round. Rejected attempts are never history. The next
282
- submission is the redo of `restorePoint + 1` and must reuse the prompt's round
283
- ID. A successful redo retires the rollback record.
284
-
285
- The Recovery Brief identifies the trigger, restore point, redo ID, failed
286
- approaches, falsified assumptions, valid discoveries, files to revert, and
287
- target HEAD. It states restoration facts, not a prescribed command.
288
-
289
- When backtrack occurs:
290
-
291
- 1. Restore the workspace exactly as requested before doing more work: the
292
- restore point's HEAD, with none of the failed rounds' changes left behind.
293
- Work in progress the restore point already carried may stay.
294
- 2. Submit one recovery evaluation from the restored state, so LoopForge can
295
- verify the restore before the redo's own work — and any commit — follows.
296
- 3. Read the Recovery Brief, restored prompt, and derived state.
297
- 4. Do not repeat a failed approach without addressing its cause.
298
- 5. Carry valid discoveries into later evaluations.
299
-
300
- If the rolled-back work used an active contract, close the stalled contract in
301
- the redo with `outcome: "blocked"` and declare the revised contract in that
302
- same submission. Restating the stalled contract commits more of the same.
303
-
304
- ## Interpret results
305
-
306
- - Non-null `prompt`: execute it and submit the next evaluation.
307
- - `enforcementAction: "reject"`: retry the same logical round and ID; the
308
- attempt increases.
309
- - `enforcementAction: "backtrack"`: restore the workspace, submit one recovery
310
- evaluation from the restored state, then redo the round from its restored
311
- prompt and round ID.
312
- - Null `prompt`: inspect `stopReason`.
313
-
314
- Read `submission_guidance` before composing the next evaluation, and read
315
- `verificationStatus`, `roundSuccess`, `level`, `warnings`, and
316
- `enforcementReason` before planning the next slice. In
317
- `submission_receipt.verification`, `contract_status` is the contract-item
318
- posture and `evidence_status` is the round-level machine evidence posture; do
319
- not read "no active contract" as "verified". `submission_receipt.reports`
320
- distinguishes a saved report from derived state that changed and from a machine
321
- verification result; `not_applied` means the submission did not become history.
322
- These are evidence postures, not subjective quality scores.
323
-
324
- Errors use `{ok: false, error: {code, message, retryable, ...}}`. Branch on the
325
- stable `code`, not the prose in `message`. Payload errors such as
326
- `evaluation_invalid`, `contract_invalid`, `policy_invalid`, and round-ID
327
- errors are retryable with the same ID. `session_not_found`, `state_unavailable`,
328
- and `gate_disabled` describe state or policy; do not blindly resubmit.
329
-
330
- `completed` means success plus every active contract item is `verified`, or
331
- there is no active contract. Explicit `blocked` always wins over success.
332
- `incomplete` means completion was not machine-verified. Other terminal reasons
333
- include `failed`, `max_rounds`, `stalled`, `enforcement_terminated`, `paused`,
334
- and `cancelled`.
335
-
336
- ## Prompt levels and views
337
-
338
- L0 is a lean same-round retry (or a committed failed round with proven no
339
- activity), L1 normal continuation, and L2 full rehydration. They control state
340
- density only, never a reasoning technique or the set of evaluation fields you
341
- may use: L0/L1/L2 offer the same applicable trigger checklist, including real
342
- `cr-`/`rci-`/`sg-` ids. If this prompt is L0, it does not apply the previous
343
- round's `prompt_requests`; the field you submit in this round can still be
344
- applied to the next prompt. L2 comes from round facts such as the first round,
345
- a plan or checkpoint boundary, recovery, contradiction, or repeated rejection.
346
- It is not a round-count timer.
347
-
348
- Use `loopforge_status` with `view: "session"` for the live round,
349
- `view: "loop"` for committed health, `view: "all"` after a restart,
350
- `view: "audit"` for completeness and evidence, and `view: "explain"` for a
351
- round's active contract, observations, flags, and decision. Use
352
- `loopforge_replay` for the committed timeline and diffs.
353
-
354
- The optional `.loopforge/state/<loopId>-state.md` is derived and regenerable.
355
- Read it when an L2 prompt points to it, but never treat it as a second source
356
- of truth.
357
-
358
- ## Gates and delegation
359
-
360
- Use `loopforge_pause` for an intentional interruption,
361
- `loopforge_resume` to reconstruct a durable session, and `loopforge_stop` only
362
- for an intentional terminal stop.
363
-
364
- The two gate tools are opt-in through `policy.gate.enabled`. When enabled,
365
- `loopforge_gate_check` preflights a structured action with its description,
366
- scope, effects, reversibility, and authorization. Classification is
367
- conservative: anything not provably safe becomes `user_required`. Present the
368
- approval question, record the decision with `loopforge_gate_resolve`, and cite
369
- the approved gate ID in `evaluation.gate_ids`. LoopForge records the process,
370
- but cannot prove that a human was present because the Agent submits the resolve
371
- call. Safe investigation and dry-runs need no gate.
372
-
373
- Delegation does not create another LoopForge mode. Give each worker a
374
- self-contained subtask and hard constraints, then place the result in
375
- `worker_results`. A worker result is a report with its source: its
376
- `discoveredConstraints` does **not** enter the global constraint set by itself.
377
- If you accept a worker's finding, state it in top-level
378
- `discovered_constraints` — that is the only promotion channel.
379
-
380
- ## Rules
381
-
382
- 1. Execute the prompt instead of generating another prompt.
383
- 2. Submit one honest structured evaluation after each attempt.
384
- 3. Treat required command evidence and verification findings as authoritative.
385
- 4. Restore the workspace before working after backtrack.
386
- 5. Keep one loop focused on one user objective.
387
- 6. Do not advance a paused or stopped session through another process.
388
- 7. Continue in the same Agent task when possible. LoopForge preserves state but
389
- does not create a background Agent.