loopforge 3.2.1 → 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 (112) hide show
  1. package/README.md +67 -67
  2. package/dist/audit.d.ts.map +1 -1
  3. package/dist/audit.js +7 -34
  4. package/dist/audit.js.map +1 -1
  5. package/dist/canonical-state.d.ts +71 -4
  6. package/dist/canonical-state.d.ts.map +1 -1
  7. package/dist/canonical-state.js +176 -9
  8. package/dist/canonical-state.js.map +1 -1
  9. package/dist/cli.d.ts.map +1 -1
  10. package/dist/cli.js +16 -18
  11. package/dist/cli.js.map +1 -1
  12. package/dist/cognitive-facts.d.ts +17 -0
  13. package/dist/cognitive-facts.d.ts.map +1 -0
  14. package/dist/cognitive-facts.js +99 -0
  15. package/dist/cognitive-facts.js.map +1 -0
  16. package/dist/committed-round.d.ts +59 -0
  17. package/dist/committed-round.d.ts.map +1 -0
  18. package/dist/committed-round.js +222 -0
  19. package/dist/committed-round.js.map +1 -0
  20. package/dist/enforcement-gate.d.ts +4 -2
  21. package/dist/enforcement-gate.d.ts.map +1 -1
  22. package/dist/enforcement-gate.js +339 -301
  23. package/dist/enforcement-gate.js.map +1 -1
  24. package/dist/engine.d.ts +16 -4
  25. package/dist/engine.d.ts.map +1 -1
  26. package/dist/engine.js +63 -15
  27. package/dist/engine.js.map +1 -1
  28. package/dist/evidence-claims.d.ts.map +1 -1
  29. package/dist/evidence-claims.js +21 -39
  30. package/dist/evidence-claims.js.map +1 -1
  31. package/dist/evidence-provider.d.ts +29 -0
  32. package/dist/evidence-provider.d.ts.map +1 -1
  33. package/dist/evidence-provider.js +93 -16
  34. package/dist/evidence-provider.js.map +1 -1
  35. package/dist/index.d.ts +3 -3
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +3 -3
  38. package/dist/index.js.map +1 -1
  39. package/dist/loop-compiler.d.ts +21 -4
  40. package/dist/loop-compiler.d.ts.map +1 -1
  41. package/dist/loop-compiler.js +244 -66
  42. package/dist/loop-compiler.js.map +1 -1
  43. package/dist/loop-projection.d.ts +5 -25
  44. package/dist/loop-projection.d.ts.map +1 -1
  45. package/dist/loop-projection.js +18 -134
  46. package/dist/loop-projection.js.map +1 -1
  47. package/dist/loop-store.d.ts +5 -2
  48. package/dist/loop-store.d.ts.map +1 -1
  49. package/dist/loop-store.js.map +1 -1
  50. package/dist/mcp/round-lifecycle.d.ts +6 -8
  51. package/dist/mcp/round-lifecycle.d.ts.map +1 -1
  52. package/dist/mcp/round-lifecycle.js +61 -52
  53. package/dist/mcp/round-lifecycle.js.map +1 -1
  54. package/dist/mcp/server.js +3 -3
  55. package/dist/mcp/server.js.map +1 -1
  56. package/dist/mcp/session.d.ts +14 -3
  57. package/dist/mcp/session.d.ts.map +1 -1
  58. package/dist/mcp/session.js +174 -52
  59. package/dist/mcp/session.js.map +1 -1
  60. package/dist/mcp/tools.d.ts +12 -0
  61. package/dist/mcp/tools.d.ts.map +1 -1
  62. package/dist/mcp/tools.js +160 -52
  63. package/dist/mcp/tools.js.map +1 -1
  64. package/dist/policy-metrics.d.ts +0 -7
  65. package/dist/policy-metrics.d.ts.map +1 -1
  66. package/dist/policy-metrics.js +15 -55
  67. package/dist/policy-metrics.js.map +1 -1
  68. package/dist/policy.d.ts +22 -20
  69. package/dist/policy.d.ts.map +1 -1
  70. package/dist/policy.js +24 -38
  71. package/dist/policy.js.map +1 -1
  72. package/dist/prompt-assembler.d.ts.map +1 -1
  73. package/dist/prompt-assembler.js +120 -140
  74. package/dist/prompt-assembler.js.map +1 -1
  75. package/dist/protocol.d.ts +57 -23
  76. package/dist/protocol.d.ts.map +1 -1
  77. package/dist/protocol.js +10 -4
  78. package/dist/protocol.js.map +1 -1
  79. package/dist/replay.d.ts.map +1 -1
  80. package/dist/replay.js +21 -22
  81. package/dist/replay.js.map +1 -1
  82. package/dist/round-contract.d.ts +64 -0
  83. package/dist/round-contract.d.ts.map +1 -0
  84. package/dist/round-contract.js +80 -0
  85. package/dist/round-contract.js.map +1 -0
  86. package/dist/round-coordinator.d.ts +5 -3
  87. package/dist/round-coordinator.d.ts.map +1 -1
  88. package/dist/round-coordinator.js +33 -29
  89. package/dist/round-coordinator.js.map +1 -1
  90. package/dist/round-driver.d.ts +0 -1
  91. package/dist/round-driver.d.ts.map +1 -1
  92. package/dist/round-driver.js +0 -1
  93. package/dist/round-driver.js.map +1 -1
  94. package/dist/round-transaction.d.ts +0 -1
  95. package/dist/round-transaction.d.ts.map +1 -1
  96. package/dist/round-transaction.js +0 -1
  97. package/dist/round-transaction.js.map +1 -1
  98. package/dist/self-eval.d.ts +29 -34
  99. package/dist/self-eval.d.ts.map +1 -1
  100. package/dist/self-eval.js +112 -148
  101. package/dist/self-eval.js.map +1 -1
  102. package/dist/verification-gate.d.ts +53 -12
  103. package/dist/verification-gate.d.ts.map +1 -1
  104. package/dist/verification-gate.js +462 -90
  105. package/dist/verification-gate.js.map +1 -1
  106. package/dist/workspace.d.ts +29 -0
  107. package/dist/workspace.d.ts.map +1 -0
  108. package/dist/workspace.js +61 -0
  109. package/dist/workspace.js.map +1 -0
  110. package/loop_policy.json +5 -13
  111. package/package.json +1 -1
  112. package/skills/perception/SKILL.md +135 -136
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: perception
3
- description: Drive a recoverable multi-round coding task through LoopForge MCP 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
@@ -9,8 +9,10 @@ Use LoopForge when a coding task needs several rounds, must survive context
9
9
  compression or process restart, or benefits from an auditable record of goals,
10
10
  constraints, evidence, and decisions.
11
11
 
12
- LoopForge maintains cognitive state. You remain the Agent that reads files,
13
- edits code, runs commands, delegates work, and decides how to reason.
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.
14
16
 
15
17
  ## Start
16
18
 
@@ -18,54 +20,75 @@ Call `loopforge_start` with:
18
20
 
19
21
  - `task`: the complete user objective.
20
22
  - `constraints`: hard boundaries that must survive every round.
21
- - `maxRounds`: optional safety limit. The default is 20.
23
+ - `maxRounds`: optional positive safety limit. The default is 20.
22
24
  - `domain`: optional context label.
23
25
 
24
- Keep the returned `sessionId`, `roundId`, prompt, and level. The `roundId`
25
- anchors your next submission to the exact round it reports on — always pass it
26
- back with `loopforge_next`.
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.
27
63
 
28
64
  ## Execute a round
29
65
 
30
- 1. Execute the returned prompt. Do real repository work.
31
- 2. Use the available tools and reasoning approach that best fit the task.
66
+ 1. Execute the returned prompt and do real repository work.
67
+ 2. Use the tools and reasoning approach that fit the task.
32
68
  3. Check actual evidence before claiming success.
33
- 4. Call `loopforge_next` with `sessionId`, the `roundId` from the most recent
34
- response, and a structured `evaluation`.
69
+ 4. Submit one structured `evaluation` with `loopforge_next`.
35
70
 
36
- If a submission comes back with a warning that its `roundId` does not match the
37
- current round, the round it reported on has already committed — the returned
38
- prompt is the one you missed (e.g. a lost response). Work from it and resubmit
39
- with its `roundId`.
40
-
41
- ### Evaluation fields
71
+ The four core evaluation fields are strict:
42
72
 
43
73
  | Field | Rule |
44
74
  | --- | --- |
45
- | `success` | `true` only when the whole objective and every hard constraint are satisfied. |
46
- | `output_summary` | State what changed and what was verified this round. |
47
- | `constraint_violations` | Report real violations. Use constraint IDs (`c-XXXXXXXX`) for exact matching. Do not hide violations to force progress. |
48
- | `should_continue` | `false` only when the entire task is complete. |
49
- | `execution_evidence` | `files_changed`, `test_results`, `success_criteria_met`, `success_criteria_remaining`, `progress_estimate`. Use criterion IDs (`cr-XXXXXXXX`) in `success_criteria_met`/`_remaining`. |
50
- | `discovered_constraints` | New guardrails found this round. Will be assigned stable IDs by the compiler. |
51
- | `objective_refinement` | Refine the objective when repository evidence changes its meaning. |
52
- | `emerged_subtasks` | New sub-problems that surfaced. Use clear, distinct descriptions. |
53
- | `completed_subtasks` | Sub-goal IDs (`sg-XXXXXXXX`) or descriptions you finished this round. |
54
- | `blocked_subtasks` | Sub-goal IDs or descriptions that cannot proceed. |
55
- | `canceled_subtasks` | Sub-goal IDs or descriptions that are no longer needed. |
56
- | `retracted_constraints` | Constraints the agent now believes are wrong or irrelevant. |
57
- | `revised_success_criteria` | Old → new revisions for criteria discovered to be incorrect. |
58
- | `wrong_assumptions` | Assumptions disproved this round. |
59
- | `next_action` | What you plan to do in the next round. Be specific — the verification gate compares this against your actual output. |
60
- | `compression_checkpoint` | Set `true` and include `checkpoint_label` when you complete a major phase. |
61
- | `drift_clarification` | Required when you pivot from your declared `next_action`. Must include specific constraint/criterion/sub-goal IDs or file paths. Filler text without concrete references will be rejected. |
62
- | `prompt_requests` | `emphasize` (what to highlight next round), `expand` (sections to expand), `confusion_points` (what you're confused about). |
63
- | `stop_reason` | When `should_continue=false` and `success=false`: `"gave_up"`, `"blocked"`, or `"needs_human_input"`. |
64
- | `outcome` | Optional v2.12 tri-state: `"success" | "partial" | "failed" | "blocked"`. Derived from `success` when absent; `partial`/`blocked` are explicit-only. Declare `blocked` + `blocker` instead of fighting the success checks. |
65
- | `blocker` | Flat description, required when `outcome="blocked"`. High-risk blockers feed the user/agent gate classification. |
66
- | `retroactiveClaims` | Optional: `[{"round": 3, "claim": "fixed src/a.ts in round 3"}]` — claims that a PRIOR round satisfied a criterion; verified against that round's git evidence. |
67
- | `no_change_reason` | When claiming `success` with no machine-verifiable evidence (e.g. docs-only round), declare why — downgrades the evidence check from error to info. |
68
- | `worker_results` | Record delegated subtask results and discoveries from sub-agents. Each entry may carry `outcome: "success" | "partial" | "failed"`. |
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.
69
92
 
70
93
  Minimal evaluation:
71
94
 
@@ -85,127 +108,103 @@ Minimal evaluation:
85
108
  }
86
109
  ```
87
110
 
88
- **Declared outcomes win.** With `outcome: "partial"`, the success-class
89
- checks stay silent even if `success` is left `true` — declare the truth,
90
- don't fight the gates.
91
-
92
- ## Using stable IDs
93
-
94
- The prompt renders stable IDs beside every constraint, criterion, and sub-goal:
95
-
96
- - **Constraints:** `[c-a3f2b1c0] No plaintext passwords`
97
- - **Criteria:** `[cr-b5a6c7d8] Unit test coverage ≥ 90%`
98
- - **Sub-goals:** `[sg-f1e2d3c4] Add error handling to login`
111
+ Do not put a guessed evaluation in free text. The structured object is the
112
+ authoritative submission; `output` is optional supporting context.
99
113
 
100
- **Prefer IDs over descriptions** in `constraint_violations`, `success_criteria_met`/`_remaining`, `completed_subtasks`, `blocked_subtasks`, `canceled_subtasks`, and `drift_clarification`. Exact ID matching eliminates ambiguity — Jaccard similarity is a fallback, not the primary path.
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.
101
117
 
102
- ## Backtrack — when the loop rewinds
118
+ ## Stable IDs and contracts
103
119
 
104
- When progress stalls for multiple rounds, LoopForge triggers a **backtrack**:
105
- the round counter rolls back to the last clean round, failed work is discarded,
106
- and a diagnosis is injected into the prompt.
120
+ Prompts render stable IDs beside constraints, criteria, and sub-goals:
107
121
 
108
- **When you receive a backtrack prompt:**
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`
109
125
 
110
- 1. **Restore your workspace first.** The prompt includes a "Workspace Restore
111
- Required" section with exact `git checkout -- . && git clean -fd` commands.
112
- Your working directory still contains changes from the failed rounds —
113
- you MUST discard them before working.
114
- 2. **Read the restored state.** The prompt reflects the clean round's vault
115
- state. The state file shows the correct full picture.
116
- 3. **Do NOT repeat the failed approach.** The diagnosis explains why the
117
- previous path failed. Choose a different technique or decomposition.
118
- 4. **Preserved discoveries** from skipped rounds are merged into the active
119
- constraints — they remain valid even though the rounds were discarded.
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.
120
129
 
121
- If you skip the workspace restore and work on dirty files, the verification
122
- gate will **reject** your next submission with a `backtrack_workspace_not_restored`
123
- flag.
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.
124
135
 
125
- ## Drift — when you change direction
136
+ ## Backtrack
126
137
 
127
- The verification gate compares your `next_action` from the previous round
128
- against your actual `output_summary` this round. A mismatch triggers an
129
- `intent_drift` flag.
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.
130
140
 
131
- **If you intentionally pivoted**, set `drift_clarification` with:
132
- - A specific reason for the pivot.
133
- - At least one concrete reference: a constraint ID (`c-XXXXXXXX`),
134
- criterion ID (`cr-XXXXXXXX`), sub-goal ID (`sg-XXXXXXXX`), or changed
135
- file path.
141
+ When backtrack occurs:
136
142
 
137
- ✅ Good: `"Pivoted because constraint c-a3f2b1c0 was already satisfied by src/auth.ts. The CSS fix was higher priority."`
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.
138
147
 
139
- ❌ Rejected: `"I changed direction because I felt this approach was better."`
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.
140
151
 
141
- Three consecutive weak clarifications (no concrete references) will
142
- **terminate the loop**.
152
+ ## Drift
143
153
 
144
- ## Interpret the result
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.
145
158
 
146
- If `prompt` is non-null, execute it and submit the next evaluation.
159
+ ## Interpret results
147
160
 
148
- If `enforcementAction` is `reject`, redo the same logical round. The round ID
149
- stays stable and the attempt number increases. Follow the retry requirements;
150
- the rejected attempt has not been committed.
151
-
152
- If `enforcementAction` is `backtrack`, the loop has been rolled back. Restore
153
- your workspace (see Backtrack section above), then work from the restored
154
- prompt at the new round number.
155
-
156
- If `prompt` is null, inspect `stopReason`:
157
-
158
- | Reason | Meaning |
159
- | --- | --- |
160
- | `completed` | The complete objective was reported finished. |
161
- | `failed` | The agent gave up (`should_continue=false`, `success=false`). |
162
- | `blocked` | Work cannot proceed under current constraints. Human input may be needed. |
163
- | `max_rounds` | The safety limit was reached. Summarize remaining work. |
164
- | `stalled` | Evaluation or execution did not produce a usable next state. |
165
- | `enforcement_terminated` | Repeated invalid claims, stalled progress, or weak clarifications terminated the loop. |
166
- | `paused` | The durable session remains available for resume. |
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
167
 
168
- ## Prompt levels
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.
169
173
 
170
- - **L0** — Same-round retry with the rejection reason and changed evidence. ~3K chars.
171
- - **L1** — Normal compact continuation. ~7K chars.
172
- - **L2** — Full rehydration: first round, checkpoint, goal change, or recovery. In L2 pointer mode (default), the prompt shows a structured dashboard; the full state lives in `.loopforge/state/<loopId>-state.md`. Read it before acting.
174
+ ## Prompt levels and views
173
175
 
174
- These levels control state density only. LoopForge does not choose a reasoning
175
- technique for you.
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.
176
179
 
177
- ## Recovery and control
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.
178
185
 
179
- - Use `loopforge_status` with `view: "session"` (default) to inspect the live round, trajectory, and the typed projection (focus/todo/phase/delegation/handoff facts).
180
- - Use `loopforge_status` with `view: "all"` after a client restart to find recoverable sessions.
181
- - Use `loopforge_status` with `view: "loop"` to inspect goal alignment and drift.
182
- - Use `loopforge_status` with `view: "audit"` for the read-only end-of-loop verification audit (claims, gates, verdict, sequence integrity).
183
- - Use `loopforge_pause` before an intentional interruption.
184
- - Use `loopforge_resume` with the loop ID to reconstruct a durable session.
185
- - Use `loopforge_replay` for the committed timeline.
186
- - Use `loopforge_gate_check` / `loopforge_gate_resolve` to classify and record human decisions for high-risk actions.
187
- - Use `loopforge_stop` only for an intentional terminal stop.
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.
188
189
 
189
- The `.loopforge/state/<loopId>-state.md` file is the authoritative full-state
190
- view in L2 pointer mode. Read it at the start of each L2 round — the prompt
191
- dashboard is a summary, not the complete picture.
190
+ ## Control and delegation
192
191
 
193
- ## Delegation
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.
194
196
 
195
197
  Delegation does not create a separate LoopForge mode. Give each worker a
196
- self-contained subtask and relevant hard constraints. Add the returned result to
197
- `worker_results` so discoveries can enter the next canonical state.
198
+ self-contained subtask and relevant hard constraints, then place its result in
199
+ `worker_results` so discoveries can enter the next Canonical State.
198
200
 
199
201
  ## Rules
200
202
 
201
203
  1. Execute the prompt instead of generating another prompt.
202
204
  2. Submit one honest structured evaluation after each attempt.
203
- 3. Use stable IDs (`c-`/`cr-`/`sg-XXXXXXXX`) for exact matching whenever possible.
204
- 4. When backtrack occurs, restore the workspace before working.
205
- 5. When you pivot from your `next_action`, explain with concrete references in `drift_clarification`.
206
- 6. Treat required command evidence and verification errors as authoritative.
207
- 7. Keep one loop focused on one user objective.
208
- 8. Read the state file at the start of L2 rounds — it holds the complete picture.
209
- 9. Do not advance a paused or stopped session through another process.
210
- 10. Continue within the same Agent task when possible; LoopForge preserves state,
211
- but it does not create a background Agent.
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.