loopforge 3.9.2 → 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 (285) 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 +152 -40
  7. package/dist/canonical-state.d.ts.map +1 -1
  8. package/dist/canonical-state.js +382 -206
  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 +105 -141
  18. package/dist/committed-round.d.ts.map +1 -1
  19. package/dist/committed-round.js +249 -372
  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 +32 -67
  42. package/dist/enforcement-gate.d.ts.map +1 -1
  43. package/dist/enforcement-gate.js +203 -439
  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 +28 -887
  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 +167 -27
  70. package/dist/explain.d.ts.map +1 -1
  71. package/dist/explain.js +373 -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 +51 -19
  103. package/dist/loop-compiler.d.ts.map +1 -1
  104. package/dist/loop-compiler.js +423 -507
  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 +285 -81
  111. package/dist/mcp/round-lifecycle.d.ts.map +1 -1
  112. package/dist/mcp/round-lifecycle.js +1629 -574
  113. package/dist/mcp/round-lifecycle.js.map +1 -1
  114. package/dist/mcp/server.d.ts +5 -0
  115. package/dist/mcp/server.d.ts.map +1 -1
  116. package/dist/mcp/server.js +61 -19
  117. package/dist/mcp/server.js.map +1 -1
  118. package/dist/mcp/session.d.ts +81 -39
  119. package/dist/mcp/session.d.ts.map +1 -1
  120. package/dist/mcp/session.js +963 -271
  121. package/dist/mcp/session.js.map +1 -1
  122. package/dist/mcp/submission-boundary.d.ts +23 -31
  123. package/dist/mcp/submission-boundary.d.ts.map +1 -1
  124. package/dist/mcp/submission-boundary.js +242 -82
  125. package/dist/mcp/submission-boundary.js.map +1 -1
  126. package/dist/mcp/submission-handle.d.ts +66 -0
  127. package/dist/mcp/submission-handle.d.ts.map +1 -0
  128. package/dist/mcp/submission-handle.js +173 -0
  129. package/dist/mcp/submission-handle.js.map +1 -0
  130. package/dist/mcp/tools.d.ts +17 -7
  131. package/dist/mcp/tools.d.ts.map +1 -1
  132. package/dist/mcp/tools.js +763 -244
  133. package/dist/mcp/tools.js.map +1 -1
  134. package/dist/open-question.d.ts +7 -0
  135. package/dist/open-question.d.ts.map +1 -0
  136. package/dist/open-question.js +14 -0
  137. package/dist/open-question.js.map +1 -0
  138. package/dist/policy-metrics.d.ts +31 -21
  139. package/dist/policy-metrics.d.ts.map +1 -1
  140. package/dist/policy-metrics.js +117 -64
  141. package/dist/policy-metrics.js.map +1 -1
  142. package/dist/policy.d.ts +15 -40
  143. package/dist/policy.d.ts.map +1 -1
  144. package/dist/policy.js +13 -13
  145. package/dist/policy.js.map +1 -1
  146. package/dist/progress.d.ts +45 -0
  147. package/dist/progress.d.ts.map +1 -0
  148. package/dist/progress.js +136 -0
  149. package/dist/progress.js.map +1 -0
  150. package/dist/prompt-assembler.d.ts +28 -9
  151. package/dist/prompt-assembler.d.ts.map +1 -1
  152. package/dist/prompt-assembler.js +592 -603
  153. package/dist/prompt-assembler.js.map +1 -1
  154. package/dist/prompt-coverage.d.ts +39 -0
  155. package/dist/prompt-coverage.d.ts.map +1 -0
  156. package/dist/prompt-coverage.js +80 -0
  157. package/dist/prompt-coverage.js.map +1 -0
  158. package/dist/prompt-freshness.d.ts +25 -0
  159. package/dist/prompt-freshness.d.ts.map +1 -0
  160. package/dist/prompt-freshness.js +88 -0
  161. package/dist/prompt-freshness.js.map +1 -0
  162. package/dist/prompt-policy.d.ts +14 -4
  163. package/dist/prompt-policy.d.ts.map +1 -1
  164. package/dist/prompt-policy.js +29 -10
  165. package/dist/prompt-policy.js.map +1 -1
  166. package/dist/protocol.d.ts +875 -419
  167. package/dist/protocol.d.ts.map +1 -1
  168. package/dist/protocol.js +73 -99
  169. package/dist/protocol.js.map +1 -1
  170. package/dist/recovery-guidance.d.ts +13 -0
  171. package/dist/recovery-guidance.d.ts.map +1 -0
  172. package/dist/recovery-guidance.js +15 -0
  173. package/dist/recovery-guidance.js.map +1 -0
  174. package/dist/recovery.d.ts +68 -0
  175. package/dist/recovery.d.ts.map +1 -0
  176. package/dist/recovery.js +234 -0
  177. package/dist/recovery.js.map +1 -0
  178. package/dist/replay.d.ts +42 -8
  179. package/dist/replay.d.ts.map +1 -1
  180. package/dist/replay.js +311 -84
  181. package/dist/replay.js.map +1 -1
  182. package/dist/result-facts.d.ts +45 -0
  183. package/dist/result-facts.d.ts.map +1 -0
  184. package/dist/result-facts.js +86 -0
  185. package/dist/result-facts.js.map +1 -0
  186. package/dist/round-contract.d.ts +38 -8
  187. package/dist/round-contract.d.ts.map +1 -1
  188. package/dist/round-contract.js +71 -31
  189. package/dist/round-contract.js.map +1 -1
  190. package/dist/round-coordinator.d.ts +45 -91
  191. package/dist/round-coordinator.d.ts.map +1 -1
  192. package/dist/round-coordinator.js +254 -271
  193. package/dist/round-coordinator.js.map +1 -1
  194. package/dist/round-driver.d.ts +56 -16
  195. package/dist/round-driver.d.ts.map +1 -1
  196. package/dist/round-driver.js +225 -39
  197. package/dist/round-driver.js.map +1 -1
  198. package/dist/round-facts.d.ts +33 -52
  199. package/dist/round-facts.d.ts.map +1 -1
  200. package/dist/round-facts.js +54 -157
  201. package/dist/round-facts.js.map +1 -1
  202. package/dist/round-guidance.d.ts +56 -0
  203. package/dist/round-guidance.d.ts.map +1 -0
  204. package/dist/round-guidance.js +161 -0
  205. package/dist/round-guidance.js.map +1 -0
  206. package/dist/round-outcome.d.ts +21 -0
  207. package/dist/round-outcome.d.ts.map +1 -0
  208. package/dist/round-outcome.js +31 -0
  209. package/dist/round-outcome.js.map +1 -0
  210. package/dist/round-transaction.d.ts +168 -21
  211. package/dist/round-transaction.d.ts.map +1 -1
  212. package/dist/round-transaction.js +856 -39
  213. package/dist/round-transaction.js.map +1 -1
  214. package/dist/self-eval.d.ts +40 -60
  215. package/dist/self-eval.d.ts.map +1 -1
  216. package/dist/self-eval.js +455 -384
  217. package/dist/self-eval.js.map +1 -1
  218. package/dist/storage.d.ts +16 -0
  219. package/dist/storage.d.ts.map +1 -1
  220. package/dist/storage.js +54 -4
  221. package/dist/storage.js.map +1 -1
  222. package/dist/subgoal-state.d.ts +2 -3
  223. package/dist/subgoal-state.d.ts.map +1 -1
  224. package/dist/subgoal-state.js +2 -3
  225. package/dist/subgoal-state.js.map +1 -1
  226. package/dist/submission-guidance.d.ts +43 -21
  227. package/dist/submission-guidance.d.ts.map +1 -1
  228. package/dist/submission-guidance.js +368 -262
  229. package/dist/submission-guidance.js.map +1 -1
  230. package/dist/submission-receipt.d.ts +16 -8
  231. package/dist/submission-receipt.d.ts.map +1 -1
  232. package/dist/submission-receipt.js +146 -51
  233. package/dist/submission-receipt.js.map +1 -1
  234. package/dist/token-utils.d.ts +47 -7
  235. package/dist/token-utils.d.ts.map +1 -1
  236. package/dist/token-utils.js +66 -15
  237. package/dist/token-utils.js.map +1 -1
  238. package/dist/transaction-identity.d.ts +9 -0
  239. package/dist/transaction-identity.d.ts.map +1 -0
  240. package/dist/transaction-identity.js +69 -0
  241. package/dist/transaction-identity.js.map +1 -0
  242. package/dist/verification-actions.d.ts +13 -0
  243. package/dist/verification-actions.d.ts.map +1 -0
  244. package/dist/verification-actions.js +44 -0
  245. package/dist/verification-actions.js.map +1 -0
  246. package/dist/verification-gate.d.ts +26 -46
  247. package/dist/verification-gate.d.ts.map +1 -1
  248. package/dist/verification-gate.js +218 -427
  249. package/dist/verification-gate.js.map +1 -1
  250. package/dist/version.d.ts +1 -1
  251. package/dist/version.js +1 -1
  252. package/dist/working-memory.d.ts +187 -0
  253. package/dist/working-memory.d.ts.map +1 -0
  254. package/dist/working-memory.js +767 -0
  255. package/dist/working-memory.js.map +1 -0
  256. package/dist/workspace-checkpoint.d.ts +88 -0
  257. package/dist/workspace-checkpoint.d.ts.map +1 -0
  258. package/dist/workspace-checkpoint.js +326 -0
  259. package/dist/workspace-checkpoint.js.map +1 -0
  260. package/dist/workspace-restore.d.ts +68 -0
  261. package/dist/workspace-restore.d.ts.map +1 -0
  262. package/dist/workspace-restore.js +604 -0
  263. package/dist/workspace-restore.js.map +1 -0
  264. package/dist/workspace.d.ts +0 -9
  265. package/dist/workspace.d.ts.map +1 -1
  266. package/dist/workspace.js +0 -17
  267. package/dist/workspace.js.map +1 -1
  268. package/loop_policy.json +5 -19
  269. package/package.json +2 -2
  270. package/skills/forge/SKILL.md +212 -0
  271. package/skills/forge/references/evidence-and-contracts.md +204 -0
  272. package/skills/forge/references/recovery-and-views.md +188 -0
  273. package/dist/cognitive-facts.d.ts +0 -30
  274. package/dist/cognitive-facts.d.ts.map +0 -1
  275. package/dist/cognitive-facts.js +0 -113
  276. package/dist/cognitive-facts.js.map +0 -1
  277. package/dist/loop-extras-parser.d.ts +0 -81
  278. package/dist/loop-extras-parser.d.ts.map +0 -1
  279. package/dist/loop-extras-parser.js +0 -213
  280. package/dist/loop-extras-parser.js.map +0 -1
  281. package/dist/loop-projection.d.ts +0 -6
  282. package/dist/loop-projection.d.ts.map +0 -1
  283. package/dist/loop-projection.js +0 -28
  284. package/dist/loop-projection.js.map +0 -1
  285. package/skills/perception/SKILL.md +0 -370
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAiC5E;AAED;;;;;;;0CAO0C;AAC1C,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAO7D"}
1
+ {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAiC5E"}
package/dist/workspace.js CHANGED
@@ -58,21 +58,4 @@ export function containInWorkspace(workspace, target) {
58
58
  }
59
59
  return projected;
60
60
  }
61
- /** v3.8.1: the Contract scope-entry check, in the module that owns workspace
62
- * containment.
63
- *
64
- * It lives here rather than in the MCP transport because it is a filesystem
65
- * fact about the running process, not a property of the payload: the strict
66
- * contract boundary injects it so a declared scope entry that escapes the
67
- * workspace is rejected pre-advance. Returns the reason when the entry
68
- * escapes, null when it is contained. */
69
- export function scopeEntryDetail(entry) {
70
- try {
71
- containInWorkspace(process.cwd(), entry);
72
- return null;
73
- }
74
- catch (error) {
75
- return error instanceof Error ? error.message : "leaves the workspace";
76
- }
77
- }
78
61
  //# sourceMappingURL=workspace.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE/D;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAAiB,EAAE,MAAc;IAClE,MAAM,aAAa,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IAC/C,MAAM,eAAe,GAAG,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACzD,IACE,eAAe,KAAK,IAAI,IAAI,eAAe,CAAC,UAAU,CAAC,KAAK,GAAG,EAAE,CAAC;QAClE,UAAU,CAAC,eAAe,CAAC,EAC3B,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IACD,qEAAqE;IACrE,yE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AAC;IACxD,IACE,YAAY,KAAK,IAAI,IAAI,YAAY,CAAC,UAAU,CAAC,KAAK,GAAG,EAAE,CAAC;QAC5D,UAAU,CAAC,YAAY,CAAC,EACxB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
package/loop_policy.json CHANGED
@@ -1,16 +1,10 @@
1
1
  {
2
- "version": "5",
3
- "constraints": {
4
- "retire_window": 3
5
- },
6
- "summary": {
7
- "window": 5,
8
- "milestone_interval": 20
9
- },
2
+ "version": "10",
10
3
  "engine": {
11
4
  "stall_lookback_rounds": 3,
12
5
  "max_rounds": 200,
13
6
  "enforcement_escalation_enabled": true,
7
+ "agent_recovery_enabled": true,
14
8
  "backtrack_enabled": true,
15
9
  "backtrack_max_depth": 3,
16
10
  "backtrack_preserve_discoveries": true,
@@ -18,25 +12,17 @@
18
12
  },
19
13
  "prompt": {
20
14
  "l0_max_chars": 5000,
21
- "l1_max_chars": 10000,
22
- "l2_max_chars": 18000,
23
- "l2_pointer_enabled": true,
24
- "max_emphasize_l2": 5,
25
- "max_emphasize_l1": 3,
26
- "max_confusion_points": 3
15
+ "l1_max_chars": 50000,
16
+ "l2_max_chars": 100000
27
17
  },
28
18
  "backend": {
29
19
  "root_dir": ".loopforge"
30
20
  },
31
21
  "evolution": {
32
22
  "max_discovered_constraints_per_round": 5,
33
- "max_active_constraints": 15,
34
- "max_objective_versions": 10,
23
+ "max_start_criteria": 12,
35
24
  "max_active_subgoals": 12
36
25
  },
37
- "checkpoint": {
38
- "outcome_max_chars": 200
39
- },
40
26
  "state_file": {
41
27
  "enabled": true,
42
28
  "directory": ".loopforge/state"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "loopforge",
3
- "version": "3.9.2",
4
- "description": "External cognitive infrastructure for AI coding agents — breaks the summary cascade, provides independent verification, and enables model-directed prompt prioritization for 100+ round agent loops.",
3
+ "version": "4.0.7",
4
+ "description": "Durable round runtime for coding agents with committed history, machine evidence, and agent-directed recovery.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -0,0 +1,212 @@
1
+ ---
2
+ name: forge
3
+ description: "LoopForge user manual: 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. Not for one-pass edits."
4
+ when_to_use: "多轮任务, 长任务, 上下文压缩, 上下文丢失, 断点续跑, 会话恢复, 可审计过程, 机器验证, 漂移, 回滚, LoopForge, long-running coding task, multi-round, context loss, resume, machine-verified, auditable evidence, backtrack, drift"
5
+ dispatch_intent: "Drive long-running coding work through LoopForge so it survives restarts and is machine-verified round by round"
6
+ ---
7
+
8
+ # Forge
9
+
10
+ Use this skill when work needs more than one verified boundary. It is the
11
+ operating guide for LoopForge MCP; it does not replace the MCP server instructions,
12
+ the prompt's `## Round Boundary`, or live `submission_guidance`.
13
+
14
+ ## When to use
15
+
16
+ Use Forge when the task needs several meaningful slices, must survive a restart
17
+ or context loss, carries constraints or acceptance criteria across rounds, or
18
+ needs machine-backed observations and an auditable record of rejection,
19
+ recovery, drift, or approval. Do not use it for a one-pass edit, a question, or
20
+ a task that finishes in one verified pass.
21
+
22
+ LoopForge has one factual source: committed typed round documents in the Vault.
23
+ Canonical State is compiled from those documents and is the cognitive source.
24
+ Prompts, receipts, state files, replay, audit, and explain are projections; do
25
+ not treat them as a second ledger. The Agent still owns meaning, planning,
26
+ tool use, edits, tests, and the choice to request recovery.
27
+
28
+ ## Round lifecycle
29
+
30
+ Keep these boundaries separate:
31
+
32
+ - A **logical round** is one coherent work slice with one before/after evidence
33
+ boundary.
34
+ - An **attempt** is a submission for that round. An enforcement rejection
35
+ increases the attempt but does not create round history; an invalid payload
36
+ has no lifecycle side effects.
37
+ - A **Round Contract** is an optional proposal for the next bounded,
38
+ machine-checkable slice. It is not a second plan ledger and does not decide
39
+ the current round boundary. With an enabled after-capable command, a
40
+ continuing round with a successor available must leave an active contract.
41
+ - A **workspace checkpoint** is recovery material: an automatic before-image or
42
+ an explicit `loopforge_checkpoint` savepoint. It is not progress or history.
43
+
44
+ ```text
45
+ prepared prompt -> Agent works -> loopforge_next(handle, evaluation | recovery)
46
+ |-- invalid payload: same handle, no state change
47
+ |-- reject: same round, new attempt and handle
48
+ |-- accept/continue: commit and prepare next round
49
+ |-- stop: commit the final round/evidence
50
+ |-- recovery/backtrack: restore and verify, then redo
51
+ ```
52
+
53
+ LoopForge owns persistence, evidence collection, validation, and disposition.
54
+ The Agent owns the work and the semantic decisions.
55
+
56
+ ## Context and continuity
57
+
58
+ Every prompt that holds a round declares `contextMode`, `contextReason`, and a
59
+ human-readable strategy label. Follow those values together:
60
+
61
+ ```text
62
+ Context: clean context — next round (fresh_invocation; workspace continues)
63
+ Context: clean context repair (fresh_invocation; rejection_escalation; same logical round; rejected posture is attempt-time only)
64
+ Context: clean context repair + invocation recovery (fresh_invocation; invocation_recovery; same logical round; retry lessons carried)
65
+ Context: in-context repair (same_round_retry; enforcement_retry; continue original invocation if alive; lessons injected)
66
+ Context: clean context after restore (fresh_invocation; recovery_redo; lessons carried)
67
+ ```
68
+
69
+ - `fresh_invocation` starts a new model conversation without the prior
70
+ transcript, tool outputs, or uncommitted reasoning. It does not restart the
71
+ host — it is not a host-runtime restart requirement — or reset the workspace:
72
+ the same loop/session identity and modified workspace continue. Continuity
73
+ comes from the prompt's committed projection and any explicitly carried retry
74
+ or recovery lessons.
75
+ - `same_round_retry` is in-context repair below the repeated same-check
76
+ rejection threshold. Continue the original invocation if it exists; the
77
+ rejection notice and findings are already provided. If it is gone, call
78
+ `loopforge_resume(loopId, invocationLost: true)` and use the resulting
79
+ `fresh_invocation / invocation_recovery` prompt for the same round and
80
+ attempt.
81
+
82
+ Rejection escalation, recovery redo, and invocation recovery use a new model
83
+ conversation. Prompt density (`L0`, `L1`, `L2`) is independent of this
84
+ boundary. Stable MCP material (`initialize` instructions, `tools/list` schemas,
85
+ and installed skill files) may stay warm; LoopForge does not manage provider
86
+ caches or implicit model habits. Read the prompt and
87
+ `references/recovery-and-views.md` when the distinction matters.
88
+
89
+ Working Memory is bounded, derived from committed branch history and rollback
90
+ directives, and report-only. Machine Evidence is a separate protected
91
+ projection. Neither is an independent history; Agent reports never become
92
+ machine evidence.
93
+
94
+ ## Start or resume
95
+
96
+ 1. Call `loopforge_status` with `view: "all"`.
97
+ 2. If an existing loop covers the objective, resume it; do not start a second
98
+ loop for the same objective.
99
+ 3. Otherwise call `loopforge_start` with the complete `task`, initial
100
+ `criteria`, hard `constraints`, and any applicable `maxRounds`, `loopId`, or
101
+ `planSource`. The live tool schema is authoritative.
102
+
103
+ Keep the returned identifiers:
104
+
105
+ | ID | Lifetime | Use |
106
+ | --- | --- | --- |
107
+ | `loopId` | Durable Vault identity | `loopforge_resume`, durable status views, replay, explain |
108
+ | `sessionId` | Live process session | stop, pause, and live session controls |
109
+ | `submissionHandle` | Exact held round/attempt | `loopforge_next`, `loopforge_checkpoint`, `loopforge_gate_check` |
110
+
111
+ Pass `submissionHandle` unchanged. A rejection returns a new handle; an invalid
112
+ evaluation keeps the same one. A stale handle has no side effects. If only the
113
+ handle is lost, re-anchor it with `loopforge_status`; if the prompt or live
114
+ session is gone, use `loopforge_resume` with the durable `loopId`. A paused or
115
+ stalled session must be resumed before submission.
116
+ Stopped and legacy loops are read-only; status and replay do not reopen them.
117
+
118
+ `currentUserInstruction` on `loopforge_next` or `loopforge_resume` is input for
119
+ that invocation only. It never rewrites the task, objective, criteria,
120
+ constraints, Round Contract, or goal identity. Never infer it from an older
121
+ transcript.
122
+
123
+ ## Execute a round
124
+
125
+ 1. Execute the returned prompt and do the work in the workspace.
126
+ 2. Check actual workspace and configured command evidence before claiming
127
+ success.
128
+ 3. Submit exactly one evaluation or one Agent-requested recovery with the
129
+ current handle. They are mutually exclusive.
130
+
131
+ The required evaluation fields are:
132
+
133
+ | Field | Meaning |
134
+ | --- | --- |
135
+ | `outcome` | `success`, `partial`, `failed`, or `blocked`; `success` and `blocked` require `should_continue=false`, and `blocked` requires a non-empty `blocker`. |
136
+ | `output_summary` | What changed and what was verified this round. |
137
+ | `constraint_violations` | Real violations, preferably using rendered `c-*` ids. |
138
+ | `should_continue` | Whether the Agent requests a successor round; false only when the objective is complete or the Agent must stop. |
139
+
140
+ A completed slice does not necessarily complete the whole task.
141
+
142
+ Optional fields are event-driven reports, not a checklist. Read the current
143
+ `submission_guidance` for applicability, real ids, legal shapes, and usable
144
+ commands. Omit fields for events that did not happen. In particular:
145
+
146
+ - `execution_report.files_changed` is the net workspace change from round
147
+ preparation, including deletions; a commit alone is not a file change.
148
+ - There is no Agent-reported test count. Configured command observations are
149
+ the test facts.
150
+ - `execution_report.claims` is the single claims channel. Claims cite rendered
151
+ criterion or active contract-item ids, but a claim alone verifies nothing.
152
+ - Never invent ids; use only ids rendered in the prompt or guidance. Unknown or
153
+ unavailable observations stay unknown, never a pass or an empty change set.
154
+ - `no_change_reason` is allowed only when no verification command is configured;
155
+ it does not create evidence. Agent reports and receipts are not evidence.
156
+
157
+ Use the evidence and contract reference before proposing or redirecting a Round
158
+ Contract. Use the recovery reference before requesting recovery, interpreting
159
+ backtrack, or relying on prompt-level details. A recovery request is an action,
160
+ not an evaluation; LoopForge restores and verifies the target before issuing
161
+ the redo prompt. Never restore the workspace yourself after backtrack.
162
+
163
+ ## Interpret results
164
+
165
+ - A non-null `prompt` is the next held work slice; execute it and submit with
166
+ the returned handle.
167
+ - `enforcementAction: "reject"` keeps the logical round and returns a new
168
+ handle. Follow its context strategy; never resubmit the old handle.
169
+ - `enforcementAction: "backtrack"` or Agent `recovery` with a non-null `prompt`
170
+ means LoopForge restored and verified the workspace; continue only from the
171
+ new redo prompt. A failed restore returns no prompt, keeps the directive
172
+ pending, and is retried with `loopforge_resume`.
173
+ - A stalled result with no prompt is handled with `loopforge_resume`; use
174
+ `loopforge_status` only to re-anchor a handle when the prompt is still live.
175
+ - When `prompt` is null, read `stopReason`, `sessionStatus`, and the Agent's
176
+ stop facts. `completed` is a lifecycle result of the Agent's stop declaration
177
+ passing the configured gates; it is not machine-verified task success.
178
+
179
+ Read `submission_receipt.verification.evidence_posture` for the persisted
180
+ Machine Evidence and `machineBackedSuccess` for the verification gate's single
181
+ machine-backed success fact. Keep it separate from `agentOutcome`,
182
+ `agentSuccessClaim`, and `agentShouldContinue`.
183
+
184
+ Errors are structured. Branch on `error.code`, not message prose. Correct
185
+ retryable `evaluation_invalid`, `contract_invalid`, `policy_invalid`, or handle
186
+ errors with the current handle. Do not blindly resubmit for
187
+ `session_not_found`, `state_unavailable`, or `gate_disabled`.
188
+
189
+ ## Rules to keep
190
+
191
+ - Keep one loop focused on one user objective; do not create a round for every
192
+ file, command, test, commit, or elapsed interval.
193
+ - Use the handle returned for the current attempt and never edit or reconstruct
194
+ it.
195
+ - Report only events that happened; do not fill optional fields for coverage.
196
+ - Do not invent a contract when no configured command can verify it.
197
+ - Do not treat a receipt, state file, or Agent report as committed evidence.
198
+ - Restore the verified boundary before continuing after backtrack.
199
+ - Do not continue after `prompt: null` without interpreting the stop facts.
200
+
201
+ ## References
202
+
203
+ Read these only when the current slice needs the detail. The live
204
+ `submission_guidance` remains authoritative for field applicability, legal
205
+ shapes, real ids, and usable commands.
206
+
207
+ - [`references/evidence-and-contracts.md`](references/evidence-and-contracts.md):
208
+ Round Contracts, item closure, evidence commands, ids, and Agent/operator
209
+ judgment boundaries.
210
+ - [`references/recovery-and-views.md`](references/recovery-and-views.md):
211
+ recovery and backtrack, checkpoint authority, prompt levels, read-only views,
212
+ gates, delegation, and the derived state file.
@@ -0,0 +1,204 @@
1
+ # Evidence and Round Contracts
2
+
3
+ This reference explains concepts and lifecycle rules. The live
4
+ `submission_guidance` remains the only source for field applicability, legal
5
+ shapes, real ids, and usable commands.
6
+
7
+ ## Optional evaluation field groups (conceptual)
8
+
9
+ - **Reports:** `execution_report`, `discovered_constraints`,
10
+ `wrong_assumptions`, `open_questions`, and `worker_results` (the minimal audit
11
+ shape: `agentId`, `subTask`, `resultSummary`, `outcome`).
12
+ - **State transitions:** `emerged_subtasks`, `subgoal_updates`,
13
+ `retracted_constraints` (Agent-discovered constraints only; operator
14
+ criteria/hard constraints are immutable).
15
+ - **Claims and verification proposals:** one `execution_report.claims` channel
16
+ (`cr-` criterion claims are advisory, `rci-` active-contract item claims are
17
+ strict) and `round_contract` (with optional `supersedes`).
18
+ - **Lifecycle controls:** `subtask_boundary` / `subtask_boundary_label`,
19
+ `outcome`, `blocker`, `objective_refinement`, `no_change_reason`, and
20
+ `gate_ids`. `outcome` is the ONE round conclusion; `success` must stop,
21
+ `blocked` must stop and carry a non-empty `blocker`.
22
+
23
+ A field is included only when its event actually happened. The live guidance
24
+ decides current applicability and the exact legal shape.
25
+
26
+ `wrong_assumptions` and `open_questions` are strictly report-only. They feed
27
+ bounded Working Memory, replay and explain, never the verification gate,
28
+ success, contract closure or machine evidence. `open_questions` is a list of
29
+ unresolved questions that still affect later slices (at most 3, 300 chars
30
+ each), not a todo list and not a completion checklist.
31
+
32
+ ## What a Round Contract is
33
+
34
+ A Round Contract is the Agent's proposal for a bounded, machine-checkable
35
+ slice. It is not a round or a second plan ledger, and it is not unconditionally
36
+ required. A proposal becomes active only after its declaring round commits,
37
+ and it activates on the next round. With an enabled after-capable verification
38
+ command, a continuing round that has a successor available must leave an active
39
+ contract for that next round. An open active contract can continue without a
40
+ new proposal; a closed contract needs a successor. A final configured round
41
+ has no successor consumer.
42
+
43
+ Declare a contract only when:
44
+
45
+ - the next slice has one bounded deliverable;
46
+ - each acceptance item can be checked by an available, enabled,
47
+ after-capable verification command;
48
+ - the Agent can state what "done" means without asking the runtime to judge
49
+ semantics.
50
+
51
+ If no configured command can verify the slice, do not invent a contract.
52
+ Continue with Agent-directed work and report the evidence honestly.
53
+
54
+ ## Proposal shape and binding
55
+
56
+ Use the current `submission_guidance` for the exact legal shape. Conceptually:
57
+
58
+ - `work_item` is the bounded deliverable this slice produces — an outcome, not
59
+ an activity.
60
+ - `items[]` are acceptance conditions inside that slice, not a task checklist.
61
+ - Each item binds its own `verify_with` command ids. One condition may use
62
+ several commands; one command may back several conditions. The binding never
63
+ moves to the contract/work_item level.
64
+ - `scope` is an optional, report-only declaration of intended files or
65
+ directories. It grants no permission, is never containment-checked, and
66
+ changes outside it are an info fact only.
67
+ - `criterion_refs` is optional and must cite real `cr-*` ids from the active
68
+ criterion set the current prompt rendered. `scope` and `supersedes` are
69
+ report-only modifiers and never change `rc-*` identity.
70
+ - Sub-goals remain an Agent plan report. Contract items do not link to them;
71
+ their closure depends only on the item, its bound commands and machine
72
+ evidence.
73
+
74
+ Unknown fields, free text where an id is required, duplicate refs, duplicate
75
+ normalized items, unconfigured/disabled/not-after commands, and a missing
76
+ `work_item` are `contract_invalid`. Correct the payload and resubmit with the
77
+ same `submissionHandle`.
78
+
79
+ Contract and item ids are content-addressed (`rc-*`, `rci-*`) from `work_item`
80
+ and the acceptance items only. Restating an unchanged proposal preserves
81
+ identity; changing only `scope` or adding `supersedes` does not change it. While
82
+ a contract is open, omitting `round_contract` continues it; you do not need to
83
+ restate it.
84
+
85
+ With an after-capable command, a continuing round with a successor available
86
+ MUST leave an active contract for the next round. The final configured round
87
+ has no successor consumer, so it does not require a proposal and LoopForge
88
+ stops at the configured round limit. A closed contract with no successor is
89
+ `contract_required`;
90
+ a successor that repeats the closed acceptance items is
91
+ `contract_successor_unchanged`. A different proposal while the active contract
92
+ is open is rejected as `contract_premature` unless it explicitly supersedes the
93
+ active contract.
94
+
95
+ ## Redirecting an active contract
96
+
97
+ If investigation shows the active slice is the wrong route, do not report it as
98
+ blocked and do not quietly propose another contract. Put the redirect modifier
99
+ on the ONE contract channel in the same evaluation:
100
+
101
+ ```json
102
+ {
103
+ "round_contract": {
104
+ "work_item": "<the successor deliverable>",
105
+ "items": [{
106
+ "description": "<a different acceptance condition>",
107
+ "criterion_refs": [],
108
+ "verify_with": ["verify"]
109
+ }],
110
+ "supersedes": {
111
+ "contract_id": "<the active rc-XXXXXXXX id rendered in this prompt>",
112
+ "reason": "why the active slice is no longer the right route"
113
+ }
114
+ }
115
+ }
116
+ ```
117
+
118
+ The successor is the same proposal, its acceptance items must differ from the
119
+ active contract's, and `should_continue` must stay true. The old contract closes as
120
+ `superseded` — not `verified`, not `blocked` — its item statuses stay in the
121
+ audit record, the workspace is not restored, and the redirect round cannot be
122
+ reported as `completed`. The successor activates next round.
123
+
124
+ A stale or mismatched `contract_id`, unchanged acceptance items, a blocked
125
+ outcome, or `should_continue=false` returns `contract_invalid`; fix the payload
126
+ and resubmit the same handle. Stop and blocked rounds cannot leave any
127
+ proposal (`contract_on_stop`).
128
+
129
+ ## Item status and closure
130
+
131
+ Item status is machine-derived:
132
+
133
+ - `pending`: not claimed as met;
134
+ - `insufficient`: claimed as met but not backed by all required observations;
135
+ - `contradicted`: a bound observation fails, or its entrypoint/configuration is
136
+ no longer trustworthy;
137
+ - `verified`: the Agent claims `met`, every bound command passes in the closing
138
+ round's after phase, and the declaration binding remains intact.
139
+
140
+ Closure priority is `blocked > superseded > verified > open`:
141
+
142
+ - every item `verified` closes the contract as verified;
143
+ - a round reporting `outcome: "blocked"` closes it as blocked;
144
+ - an explicit `round_contract.supersedes` closes it as superseded;
145
+ - otherwise it remains open.
146
+
147
+ A superseded contract keeps every item status for audit and never restores the
148
+ workspace. Its redirect round cannot be `completed`.
149
+
150
+ A claimed-but-unbacked item is verification debt. Repeated claims escalate at
151
+ `engine.unverified_claim_streak_limit` on the same check's streak. An honest
152
+ supersede with no `met` claim retires the old debt finding; a supersede that
153
+ still claims an old item `met` keeps it.
154
+
155
+ ## Evidence commands
156
+
157
+ Contract items are backed by commands the **operator** configures in
158
+ `loop_policy.json` under `evidence.commands`. The Agent never declares one and
159
+ does not discover project scripts to invent one.
160
+
161
+ Commands:
162
+
163
+ - run with an explicit executable and argument list, without a shell;
164
+ - are confined to the workspace;
165
+ - run in the after phase (or both);
166
+ - have their own timeout and output cap;
167
+ - determine pass/fail from the configured success exit codes;
168
+ - have a content-addressed configuration hash bound into the contract item.
169
+
170
+ `loopforge doctor` statically checks every configured command and never
171
+ executes one. When no command is available, no configured command can back a
172
+ contract item; run without a contract rather than declaring items that cannot
173
+ close.
174
+
175
+ A command's **entrypoint** is the file it names plus `package.json` when a
176
+ package manager runs it. It must already be part of the workspace when the
177
+ round starts, and it must not change during the round that runs it. The runtime
178
+ records those files at round start and compares them afterwards, whether or not
179
+ git can see them. A changed entrypoint makes the observation untrustworthy:
180
+ restore it to its round-start content. Do not author the verification script
181
+ inside the round you expect it to verify.
182
+
183
+ To keep a script that must survive a rollback, make it part of the committed
184
+ workspace before the round that depends on it. Restoring to an earlier
185
+ checkpoint discards work the target boundary did not already carry.
186
+
187
+ ## IDs and Agent judgment
188
+
189
+ Prompts render stable IDs beside constraints (`c-*`), criteria (`cr-*`),
190
+ sub-goals (`sg-*`), contracts (`rc-*`), and contract items (`rci-*`). Use those
191
+ ids where a field asks for a reference. Never invent one; when an id is absent,
192
+ omit the field rather than guessing.
193
+
194
+ LoopForge validates structure, configured/enabled/after-capable command
195
+ bindings, and references. It does not judge whether:
196
+
197
+ - a `work_item` sounds like a deliverable;
198
+ - an item semantically matches a command;
199
+ - a command is the "right" acceptance test;
200
+ - the declared `scope` is the right route.
201
+
202
+ Those remain Agent and operator judgment. `round_scope_drift` is an info fact
203
+ only; it never rejects, terminates, backtracks, stalls, or reaches the rejection
204
+ counter.