loopforge 2.7.0 → 3.0.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.
- package/README.md +136 -182
- package/dist/canonical-event-writer.d.ts +20 -0
- package/dist/canonical-event-writer.d.ts.map +1 -0
- package/dist/canonical-event-writer.js +131 -0
- package/dist/canonical-event-writer.js.map +1 -0
- package/dist/canonical-state.d.ts +20 -16
- package/dist/canonical-state.d.ts.map +1 -1
- package/dist/canonical-state.js +211 -64
- package/dist/canonical-state.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +11 -10
- package/dist/cli.js.map +1 -1
- package/dist/cognitive-governance.d.ts +48 -0
- package/dist/cognitive-governance.d.ts.map +1 -0
- package/dist/cognitive-governance.js +226 -0
- package/dist/cognitive-governance.js.map +1 -0
- package/dist/compiler-subgoals.d.ts +7 -0
- package/dist/compiler-subgoals.d.ts.map +1 -0
- package/dist/compiler-subgoals.js +93 -0
- package/dist/compiler-subgoals.js.map +1 -0
- package/dist/derive-id.d.ts +12 -0
- package/dist/derive-id.d.ts.map +1 -0
- package/dist/derive-id.js +31 -0
- package/dist/derive-id.js.map +1 -0
- package/dist/evidence-provider.d.ts +26 -26
- package/dist/evidence-provider.d.ts.map +1 -1
- package/dist/evidence-provider.js +45 -71
- package/dist/evidence-provider.js.map +1 -1
- package/dist/generate-schema.js +90 -2
- package/dist/generate-schema.js.map +1 -1
- package/dist/index.d.ts +23 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -26
- package/dist/index.js.map +1 -1
- package/dist/loop-compiler.d.ts +2 -2
- package/dist/loop-compiler.d.ts.map +1 -1
- package/dist/loop-compiler.js +321 -315
- package/dist/loop-compiler.js.map +1 -1
- package/dist/loop-extras-parser.d.ts +2 -2
- package/dist/loop-extras-parser.d.ts.map +1 -1
- package/dist/loop-extras-parser.js +2 -2
- package/dist/loop-extras-parser.js.map +1 -1
- package/dist/loop-store.d.ts +20 -58
- package/dist/loop-store.d.ts.map +1 -1
- package/dist/loop-store.js +232 -311
- package/dist/loop-store.js.map +1 -1
- package/dist/mcp/server.d.ts +3 -3
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +123 -19
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session-projection.d.ts +5 -0
- package/dist/mcp/session-projection.d.ts.map +1 -0
- package/dist/mcp/session-projection.js +18 -0
- package/dist/mcp/session-projection.js.map +1 -0
- package/dist/mcp/session-queue.d.ts +3 -0
- package/dist/mcp/session-queue.d.ts.map +1 -0
- package/dist/mcp/session-queue.js +18 -0
- package/dist/mcp/session-queue.js.map +1 -0
- package/dist/mcp/session-types.d.ts +72 -0
- package/dist/mcp/session-types.d.ts.map +1 -0
- package/dist/mcp/session-types.js +2 -0
- package/dist/mcp/session-types.js.map +1 -0
- package/dist/mcp/session.d.ts +65 -84
- package/dist/mcp/session.d.ts.map +1 -1
- package/dist/mcp/session.js +667 -224
- package/dist/mcp/session.js.map +1 -1
- package/dist/mcp/tools.d.ts +26 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +401 -254
- package/dist/mcp/tools.js.map +1 -1
- package/dist/policy-metrics.d.ts +24 -0
- package/dist/policy-metrics.d.ts.map +1 -1
- package/dist/policy-metrics.js +174 -0
- package/dist/policy-metrics.js.map +1 -1
- package/dist/policy.d.ts +74 -12
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +124 -19
- package/dist/policy.js.map +1 -1
- package/dist/prompt-assembler.d.ts +8 -4
- package/dist/prompt-assembler.d.ts.map +1 -1
- package/dist/prompt-assembler.js +533 -86
- package/dist/prompt-assembler.js.map +1 -1
- package/dist/prompt-policy.d.ts +8 -1
- package/dist/prompt-policy.d.ts.map +1 -1
- package/dist/prompt-policy.js +26 -8
- package/dist/prompt-policy.js.map +1 -1
- package/dist/protocol.d.ts +259 -173
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +17 -96
- package/dist/protocol.js.map +1 -1
- package/dist/replay.d.ts +11 -3
- package/dist/replay.d.ts.map +1 -1
- package/dist/replay.js +51 -14
- package/dist/replay.js.map +1 -1
- package/dist/round-commit-store.d.ts +12 -0
- package/dist/round-commit-store.d.ts.map +1 -0
- package/dist/round-commit-store.js +13 -0
- package/dist/round-commit-store.js.map +1 -0
- package/dist/round-coordinator.d.ts +53 -22
- package/dist/round-coordinator.d.ts.map +1 -1
- package/dist/round-coordinator.js +140 -44
- package/dist/round-coordinator.js.map +1 -1
- package/dist/round-driver.d.ts +18 -10
- package/dist/round-driver.d.ts.map +1 -1
- package/dist/round-driver.js +11 -13
- package/dist/round-driver.js.map +1 -1
- package/dist/round-gate.d.ts +31 -0
- package/dist/round-gate.d.ts.map +1 -0
- package/dist/round-gate.js +259 -0
- package/dist/round-gate.js.map +1 -0
- package/dist/round-recovery.d.ts +17 -0
- package/dist/round-recovery.d.ts.map +1 -0
- package/dist/round-recovery.js +117 -0
- package/dist/round-recovery.js.map +1 -0
- package/dist/round-report.d.ts +16 -0
- package/dist/round-report.d.ts.map +1 -0
- package/dist/round-report.js +401 -0
- package/dist/round-report.js.map +1 -0
- package/dist/round-transaction.d.ts +23 -12
- package/dist/round-transaction.d.ts.map +1 -1
- package/dist/round-transaction.js +104 -91
- package/dist/round-transaction.js.map +1 -1
- package/dist/runtime-services.d.ts +59 -0
- package/dist/runtime-services.d.ts.map +1 -0
- package/dist/{engine.js → runtime-services.js} +157 -275
- package/dist/runtime-services.js.map +1 -0
- package/dist/storage.d.ts +3 -9
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +6 -17
- package/dist/storage.js.map +1 -1
- package/dist/token-utils.d.ts +12 -8
- package/dist/token-utils.d.ts.map +1 -1
- package/dist/token-utils.js +56 -10
- package/dist/token-utils.js.map +1 -1
- package/dist/vault-format.d.ts +4 -0
- package/dist/vault-format.d.ts.map +1 -0
- package/dist/vault-format.js +4 -0
- package/dist/vault-format.js.map +1 -0
- package/dist/vault-types.d.ts +24 -0
- package/dist/vault-types.d.ts.map +1 -0
- package/dist/vault-types.js +2 -0
- package/dist/vault-types.js.map +1 -0
- package/loop_policy.json +10 -12
- package/loopforge-policy.json +340 -0
- package/package.json +13 -7
- package/skills/perception/SKILL.md +200 -90
- package/dist/backends/interface.d.ts +0 -39
- package/dist/backends/interface.d.ts.map +0 -1
- package/dist/backends/interface.js +0 -6
- package/dist/backends/interface.js.map +0 -1
- package/dist/enforcement-gate.d.ts +0 -50
- package/dist/enforcement-gate.d.ts.map +0 -1
- package/dist/enforcement-gate.js +0 -501
- package/dist/enforcement-gate.js.map +0 -1
- package/dist/engine.d.ts +0 -59
- package/dist/engine.d.ts.map +0 -1
- package/dist/engine.js.map +0 -1
- package/dist/interop.d.ts +0 -35
- package/dist/interop.d.ts.map +0 -1
- package/dist/interop.js +0 -34
- package/dist/interop.js.map +0 -1
- package/dist/run.d.ts +0 -51
- package/dist/run.d.ts.map +0 -1
- package/dist/run.js +0 -200
- package/dist/run.js.map +0 -1
- package/dist/self-eval.d.ts +0 -23
- package/dist/self-eval.d.ts.map +0 -1
- package/dist/self-eval.js +0 -151
- package/dist/self-eval.js.map +0 -1
- package/dist/verification-gate.d.ts +0 -52
- package/dist/verification-gate.d.ts.map +0 -1
- package/dist/verification-gate.js +0 -527
- package/dist/verification-gate.js.map +0 -1
|
@@ -1,118 +1,228 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: perception
|
|
3
|
-
description: Drive a recoverable multi-round
|
|
3
|
+
description: Drive a recoverable multi-round task through the LoopForge MCP runtime while the Agent remains the execution owner.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Perception
|
|
7
7
|
|
|
8
|
-
Use LoopForge
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
Use LoopForge for work that spans multiple context windows, needs an auditable
|
|
9
|
+
record, or must survive a process restart. LoopForge stores canonical facts and
|
|
10
|
+
compiles prompts; you remain responsible for inspecting the repository,
|
|
11
|
+
editing files, running tools, and making technical decisions.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
There is one public execution path. Do not create a second plan scheduler,
|
|
14
|
+
background Agent, MCP Task, or local shadow state machine.
|
|
14
15
|
|
|
15
|
-
## Start
|
|
16
|
+
## 1. Start one loop
|
|
16
17
|
|
|
17
18
|
Call `loopforge_start` with:
|
|
18
19
|
|
|
19
|
-
- `task`: the complete user objective
|
|
20
|
-
- `constraints`: hard boundaries that must survive every round
|
|
21
|
-
- `
|
|
22
|
-
|
|
20
|
+
- `task`: the complete user objective, not a short reminder;
|
|
21
|
+
- `constraints`: hard boundaries that must survive every round;
|
|
22
|
+
- `successCriteria`: explicit verifiable completion criteria when the task has
|
|
23
|
+
more than the default objective-level criterion;
|
|
24
|
+
- `maxRounds`: an explicit safety limit when the default (100) is unsuitable;
|
|
25
|
+
- `domain`: an optional technology or repository hint;
|
|
26
|
+
- `planSource`: an optional path to a user-provided plan (reference only).
|
|
23
27
|
|
|
24
|
-
Keep the returned `sessionId`, `roundId`, prompt, and
|
|
28
|
+
Keep the returned `sessionId`, `loopId`, `roundId`, prompt, and hashes. Execute
|
|
29
|
+
the returned prompt in the bound workspace before submitting a report.
|
|
25
30
|
|
|
26
|
-
##
|
|
31
|
+
## 2. Submit `RoundReport`
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
4. Call `loopforge_next` with `sessionId` and a structured `evaluation`.
|
|
32
|
-
|
|
33
|
-
Minimal evaluation:
|
|
33
|
+
Call `loopforge_next` after an accepted round. Call `loopforge_retry` only when
|
|
34
|
+
the previous logical round was rejected. Both calls require `sessionId` and a
|
|
35
|
+
canonical report; free-form text and the old `status` report are invalid.
|
|
34
36
|
|
|
35
37
|
```json
|
|
36
38
|
{
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
39
|
+
"format": "loopforge.round-report",
|
|
40
|
+
"outcome": "partial",
|
|
41
|
+
"continuation": "continue",
|
|
42
|
+
"summary": "Implemented the parser and ran focused tests.",
|
|
43
|
+
"violations": [],
|
|
44
|
+
"evidence": {
|
|
45
|
+
"files": ["src/parser.ts", "test/parser.test.ts"],
|
|
46
|
+
"checks": [{"name": "npm test -- parser", "status": "passed", "counts": {"passed": 8, "failed": 0, "skipped": 0}}],
|
|
47
|
+
"claims": [{"id": "claim-0123456789ab", "targetId": "cr-abcdef12", "evidenceRefs": ["command:npm test -- parser"]}],
|
|
48
|
+
"provenance": {}
|
|
49
|
+
},
|
|
50
|
+
"agentIntent": "Add parser regression coverage next"
|
|
41
51
|
}
|
|
42
52
|
```
|
|
43
53
|
|
|
44
|
-
|
|
54
|
+
### Outcome versus continuation
|
|
55
|
+
|
|
56
|
+
- `outcome` is only this round's result: `success`, `partial`, `failed`, or
|
|
57
|
+
`blocked`.
|
|
58
|
+
- `continuation` is only the request to start another round: `continue` or
|
|
59
|
+
`stop`.
|
|
60
|
+
- `success` does not prove the total objective is complete. Completion requires
|
|
61
|
+
runtime-verified claims for every remaining criterion, no contradictory
|
|
62
|
+
checks, and no unresolved User Gate.
|
|
63
|
+
- `blocked` requires a `blocker` object. Use `continuation: "stop"` for a
|
|
64
|
+
user decision, external dependency, or side effect that must not be guessed.
|
|
65
|
+
An Agent-resolvable blocker may use `continue`, but state the required
|
|
66
|
+
evidence and resolution.
|
|
67
|
+
|
|
68
|
+
### Report fields
|
|
45
69
|
|
|
46
|
-
| Field |
|
|
70
|
+
| Field | How to use it |
|
|
47
71
|
| --- | --- |
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
72
|
+
| `summary` | Describe concrete work and observations from this round. |
|
|
73
|
+
| `violations` | List every actual hard-constraint violation; do not hide one to obtain acceptance. Prefer `c-XXXXXXXX` IDs. |
|
|
74
|
+
| `evidence` | Report files, checks, claims and references. Agent provenance is only a claim until a runtime provider observes it. |
|
|
75
|
+
| `discoveries` | Record wrong assumptions, emerged work, durable facts and newly discovered constraints. |
|
|
76
|
+
| `subGoalEvents` | Report completed, blocked or canceled existing sub-goals. Do not invent a second sub-goal lifecycle. Prefer `sg-XXXXXXXX` IDs. |
|
|
77
|
+
| `constraintEvents` | Retire a constraint only when repository evidence shows it is no longer valid. |
|
|
78
|
+
| `criterionRevisions` | Propose an old-to-new criterion change; never silently replace the user's objective. |
|
|
79
|
+
| `objectiveRefinement` | Add a safe clarification when evidence changes the interpretation; it is validated by the runtime. |
|
|
80
|
+
| `phaseBoundaryProposal` | Suggest a phase label and reason. The runtime decides whether the boundary is real. |
|
|
81
|
+
| `contextRequest` | Per-round emphasis, expansion or confusion requests. It is consumed once and is not durable state. |
|
|
82
|
+
| `agentIntent` | Optional Agent suggestion used only for audit and drift comparison. Runtime-derived Focus, Todo and Suggested Next Action take precedence. |
|
|
83
|
+
| `driftClarification` | When drift is detected, provide a concrete explanation and a criterion/constraint ID or observed file path. Runtime validates it; do not submit a waiver boolean. |
|
|
84
|
+
|
|
85
|
+
Do not submit derived `currentFocus`, `todoProjection`, `handoff`,
|
|
86
|
+
`progress`, `failedPatterns`, `nextAction`, or `verifiedFacts` as alternate
|
|
87
|
+
facts. These are internal or derived views. A progress estimate, if present in
|
|
88
|
+
the evidence supplied to an embedding, is never authoritative.
|
|
89
|
+
|
|
90
|
+
## 3. Evidence discipline
|
|
91
|
+
|
|
92
|
+
Use stable IDs shown in the prompt:
|
|
93
|
+
|
|
94
|
+
- constraints: `[c-a3f2b1c0]`;
|
|
95
|
+
- criteria: `[cr-b5a6c7d8]`;
|
|
96
|
+
- sub-goals: `[sg-f1e2d3c4]`.
|
|
97
|
+
|
|
98
|
+
Claims should reference a concrete file, check, or provider observation. Do not
|
|
99
|
+
mark your own provenance `verified` to force progress. Runtime providers may
|
|
100
|
+
replace claimed evidence with `verified`, `contradicted`, or `unavailable`.
|
|
101
|
+
Missing provider output is unavailable, not a pass. A rejected attempt and its
|
|
102
|
+
claims are not canonical facts.
|
|
103
|
+
|
|
104
|
+
## 4. Retry, backtrack and continuation
|
|
105
|
+
|
|
106
|
+
Read the returned `decision` and `enforcementAction`:
|
|
107
|
+
|
|
108
|
+
- `accepted`: execute the returned prompt for the next round;
|
|
109
|
+
- `rejected`: correct the evidence or work and call `loopforge_retry`; keep the
|
|
110
|
+
same logical `roundId` and do not call `next` to bypass rejection;
|
|
111
|
+
- `backtracked`: use the returned restore round and requirements, then continue
|
|
112
|
+
from the new prompt;
|
|
113
|
+
- `stopped` or `terminated`: do not submit another report unless a new loop is
|
|
114
|
+
explicitly started.
|
|
115
|
+
|
|
116
|
+
Backtrack is advisory and bounded. It never changes workspace files. Follow the
|
|
117
|
+
exact paths and checks returned by LoopForge, inspect the resulting workspace,
|
|
118
|
+
and report the restoration evidence. Never improvise an unbounded destructive
|
|
119
|
+
command such as `git clean -fd` or `git reset --hard`; ask for a User Gate when
|
|
120
|
+
the required action is destructive or authorization is unclear.
|
|
121
|
+
|
|
122
|
+
## 5. User Gate and Agent Gate
|
|
123
|
+
|
|
124
|
+
For a risky action, call `loopforge_gate_check` with:
|
|
57
125
|
|
|
58
|
-
|
|
59
|
-
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"description": "Apply the production database migration",
|
|
129
|
+
"scope": ["db/migrations/2026-01.sql"],
|
|
130
|
+
"effects": ["data_migration", "production"],
|
|
131
|
+
"reversibility": "recoverable",
|
|
132
|
+
"authorization": "user_required"
|
|
133
|
+
}
|
|
134
|
+
```
|
|
60
135
|
|
|
61
|
-
|
|
136
|
+
User Gate is required for production, credentials, data migration, publishing,
|
|
137
|
+
payment, external communication, public API changes, irreversible or unknown
|
|
138
|
+
actions, and unknown authorization. Limit the blocked scope and continue only
|
|
139
|
+
with allowed read-only investigation or dry runs. Agent Gate is for bounded,
|
|
140
|
+
reversible, explicitly `agent_allowed` workspace work or ordinary technical
|
|
141
|
+
blockers. Resolve a User Gate with `loopforge_gate_resolve` using the exact same
|
|
142
|
+
descriptor; its `actionHash` invalidates an approval if the action changes.
|
|
62
143
|
|
|
63
|
-
|
|
144
|
+
## 6. Status, history and audit
|
|
64
145
|
|
|
65
|
-
|
|
66
|
-
stays stable and the attempt number increases. Follow the retry requirements;
|
|
67
|
-
the rejected attempt has not been committed.
|
|
146
|
+
Use only the current twelve tools:
|
|
68
147
|
|
|
69
|
-
|
|
148
|
+
```text
|
|
149
|
+
loopforge_start loopforge_next loopforge_retry
|
|
150
|
+
loopforge_backtrack loopforge_resume loopforge_pause
|
|
151
|
+
loopforge_stop loopforge_status loopforge_history
|
|
152
|
+
loopforge_gate_check loopforge_gate_resolve loopforge_audit
|
|
153
|
+
```
|
|
70
154
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
155
|
+
- `loopforge_status({scope: "session", sessionId})` shows the live round. Add
|
|
156
|
+
`detail: "full"` for cognition projections, prompt diagnostics, metrics and
|
|
157
|
+
audit data.
|
|
158
|
+
- `loopforge_status({scope: "loop", loopId})` reads loop-level health and
|
|
159
|
+
audit. `scope: "all"` lists persisted loop summaries (including stopped
|
|
160
|
+
loops for audit/recovery inspection) and accepts no ID.
|
|
161
|
+
- `loopforge_history({loopId, view: "round", round})` reads one persisted
|
|
162
|
+
round. `view: "timeline"` reads events in `event_sequence` order; use
|
|
163
|
+
`fromSequence`, `toSequence` and `limit` (1-200) for pagination.
|
|
164
|
+
- `loopforge_audit({loopId})` is read-only and reports criteria coverage,
|
|
165
|
+
contradictions, evidence availability, unresolved User Gates, regression
|
|
166
|
+
obligations and `sequenceComplete`.
|
|
167
|
+
|
|
168
|
+
The old names `loopforge_list`, `loopforge_health`, `loopforge_inspect`, and
|
|
169
|
+
`loopforge_replay` are not public tools.
|
|
170
|
+
|
|
171
|
+
## 7. Pause and resume
|
|
172
|
+
|
|
173
|
+
Call `loopforge_pause` before an intentional interruption. After a client or
|
|
174
|
+
process restart, call `loopforge_resume` with the saved `loopId`; do not start a
|
|
175
|
+
new loop just because the in-memory session disappeared. Compare the returned
|
|
176
|
+
`stateHash` and `promptHash`, then execute the rebuilt prompt. A loop can be
|
|
177
|
+
resumed only from its persisted vault state.
|
|
178
|
+
|
|
179
|
+
## 8. Prompt levels and projections
|
|
180
|
+
|
|
181
|
+
- **L0**: compact same-round retry with the rejection gap.
|
|
182
|
+
- **L1**: normal continuation with current focus and required evidence.
|
|
183
|
+
- **L2**: full rehydration after the first round, a phase boundary, goal or
|
|
184
|
+
constraint change, stale or contradictory evidence, drift, recovery, or
|
|
185
|
+
repeated low-information rounds.
|
|
186
|
+
|
|
187
|
+
L0/L1/L2 control state density, not reasoning strategy. The prompt compiler
|
|
188
|
+
reads canonical Goal, RoundEvent, EvidenceEnvelope, Constraint, SubGoal and
|
|
189
|
+
GateDecision facts, then derives Phase, Focus, Todo, Handoff, progress and
|
|
190
|
+
diagnostics. Mandatory objective, focus, gate, hard constraints and required
|
|
191
|
+
fixes remain present under a prompt budget.
|
|
192
|
+
|
|
193
|
+
## 9. Workspace and command safety
|
|
194
|
+
|
|
195
|
+
When LoopForge requests verification, run commands in the bound workspace only.
|
|
196
|
+
Use executable plus argument arrays, `shell: false`, timeouts, output limits and
|
|
197
|
+
path-boundary checks. Do not concatenate user-controlled strings into shell
|
|
198
|
+
commands. This is LoopForge's evidence boundary; it does not grant or revoke
|
|
199
|
+
the Agent's ordinary tool permissions.
|
|
200
|
+
|
|
201
|
+
## 10. Long-horizon habits
|
|
202
|
+
|
|
203
|
+
Keep one loop focused on one user objective. Submit one honest report per
|
|
204
|
+
round, preserve criterion and constraint IDs, and include a concrete next
|
|
205
|
+
verification when continuing. Inspect the full state on L2 rounds. Use pause
|
|
206
|
+
before handoff and audit before claiming final completion. LoopForge supports
|
|
207
|
+
long runs through explicit rounds and durable replay, but it does not execute
|
|
208
|
+
rounds in the background for you.
|
|
209
|
+
|
|
210
|
+
## 11. Reliability rules
|
|
211
|
+
|
|
212
|
+
An invalid report is an input error, not a round fact. The runtime leaves the
|
|
213
|
+
current `roundId`, attempt, state and vault unchanged and returns
|
|
214
|
+
`invalid_round_report`; submit a corrected report instead of starting a new
|
|
215
|
+
loop. A persistence error is not recoverable by pretending success: stop and
|
|
216
|
+
retry the operation after the storage boundary is healthy.
|
|
217
|
+
|
|
218
|
+
Evidence capture and recovery are asynchronous. `maxRounds` must be a positive
|
|
219
|
+
integer no greater than the configured policy limit. Corrupt JSON, an invalid
|
|
220
|
+
event format, or a sequence gap returns `storage_corruption`; the runtime never
|
|
221
|
+
sorts, fills, or rewrites damaged history. Terminal enforcement rules track
|
|
222
|
+
their escalation retry independently; the same rule terminates only after its
|
|
223
|
+
guided retry has already been used.
|
|
224
|
+
|
|
225
|
+
When intent drift is reported, use `driftClarification` with a concrete
|
|
226
|
+
explanation and an anchor that exists in the current criteria, constraints or
|
|
227
|
+
observed workspace evidence. Do not send `clarification_accepted: true`.
|
|
228
|
+
Runtime verification owns the clarification streak and any escalation.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/** @deprecated Use LoopStore from loop-store.js directly.
|
|
2
|
-
*
|
|
3
|
-
* Kept for backward compatibility with modules that still reference
|
|
4
|
-
* VaultBackend as a parameter type. New code should depend on LoopStore. */
|
|
5
|
-
export interface VaultEntry {
|
|
6
|
-
id?: string;
|
|
7
|
-
task_id?: string;
|
|
8
|
-
version_tag?: string;
|
|
9
|
-
is_active?: boolean;
|
|
10
|
-
timestamp?: string;
|
|
11
|
-
user_intent?: string;
|
|
12
|
-
task_type?: string;
|
|
13
|
-
/** @deprecated Use `success` field instead. Kept for reading old vault data. */
|
|
14
|
-
quality_score?: number;
|
|
15
|
-
success?: boolean;
|
|
16
|
-
skill_used?: string;
|
|
17
|
-
loop_id?: string;
|
|
18
|
-
loop_lineage?: Record<string, unknown>;
|
|
19
|
-
loop_objective?: Record<string, unknown> | null;
|
|
20
|
-
execution_feedback?: string;
|
|
21
|
-
task?: string;
|
|
22
|
-
output_summary?: string;
|
|
23
|
-
constraint_violations?: string[];
|
|
24
|
-
tags?: string[];
|
|
25
|
-
full_prompt?: string;
|
|
26
|
-
[key: string]: unknown;
|
|
27
|
-
}
|
|
28
|
-
export interface VaultBackend {
|
|
29
|
-
/** Optional atomic critical section used by storage adapters. */
|
|
30
|
-
withLock?<T>(fn: () => T): T;
|
|
31
|
-
queryEntries(opts?: {
|
|
32
|
-
prefix?: string;
|
|
33
|
-
taskIdPattern?: string;
|
|
34
|
-
feedbackOnly?: boolean;
|
|
35
|
-
}): VaultEntry[];
|
|
36
|
-
appendEntry(entry: VaultEntry): void;
|
|
37
|
-
appendEntries(entries: VaultEntry[]): number;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/backends/interface.ts"],"names":[],"mappings":"AAAA;;;6EAG6E;AAE7E,MAAM,WAAW,UAAU;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAChD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,iEAAiE;IACjE,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAG7B,YAAY,CAAC,IAAI,CAAC,EAAE;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,GAAG,UAAU,EAAE,CAAC;IAEjB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACrC,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;CAE9C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/backends/interface.ts"],"names":[],"mappings":"AAAA;;;6EAG6E"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/** Enforcement Gate — Layer 2 round-boundary runtime enforcement (v1.13).
|
|
2
|
-
*
|
|
3
|
-
* Pure-function module. Receives the verification gate's findings plus
|
|
4
|
-
* round-level context and decides whether to accept the round, reject it
|
|
5
|
-
* (force the agent to redo), or terminate the loop.
|
|
6
|
-
*
|
|
7
|
-
* This is the "runtime" that prompt-only constraint systems lack.
|
|
8
|
-
* Verification gate detects WHAT is wrong; enforcement gate decides
|
|
9
|
-
* what to DO about it.
|
|
10
|
-
*
|
|
11
|
-
* Decision semantics:
|
|
12
|
-
* - accept: round passes all checks; advance to next round as normal.
|
|
13
|
-
* - reject: agent's self-evaluation or round output is invalid; the
|
|
14
|
-
* agent receives a rejection prompt and must redo the SAME
|
|
15
|
-
* round. Round counter does NOT increment.
|
|
16
|
-
* - terminate: loop has reached an unrecoverable state; stop immediately
|
|
17
|
-
* with stopReason "enforcement_terminated".
|
|
18
|
-
*/
|
|
19
|
-
import type { VaultEntry } from "./backends/interface.js";
|
|
20
|
-
import type { EnforcementResult, SelfEvaluation, VerificationFlag, VerificationResult } from "./protocol.js";
|
|
21
|
-
/** Enforce round-boundary rules based on the verification gate's findings
|
|
22
|
-
* and the agent's self-evaluation integrity.
|
|
23
|
-
*
|
|
24
|
-
* Rules run in priority order (R1 → R5). The first rule that fires wins.
|
|
25
|
-
*
|
|
26
|
-
* @param selfEval The agent's self-evaluation for the current round.
|
|
27
|
-
* @param verifyResult The verification gate's output (from verifySelfEvaluation).
|
|
28
|
-
* @param currentRound Current round number (1-based, BEFORE increment).
|
|
29
|
-
* @param vaultEntries Vault entries for this loop (used for progress tracking).
|
|
30
|
-
* @param consecutiveRejections How many consecutive rounds have already been rejected.
|
|
31
|
-
* Starts at 0; increments on each reject; resets on accept.
|
|
32
|
-
*/
|
|
33
|
-
export declare function enforceRound(selfEval: SelfEvaluation, verifyResult: VerificationResult, currentRound: number, vaultEntries: VaultEntry[], consecutiveRejections?: number, skipEvidenceRules?: boolean): EnforcementResult;
|
|
34
|
-
/** Build a rejection prompt for the agent.
|
|
35
|
-
*
|
|
36
|
-
* The prompt clearly states the round was rejected, why, what the agent
|
|
37
|
-
* must fix, and that the agent must redo the SAME round (not advance).
|
|
38
|
-
*
|
|
39
|
-
* v2.7: Accepts verificationFlags to render a diagnostic "Evidence Gap"
|
|
40
|
-
* section. Each error/warn flag becomes a concrete claim-vs-evidence
|
|
41
|
-
* mismatch statement so the agent knows exactly what to correct rather
|
|
42
|
-
* than retrying blindly.
|
|
43
|
-
*
|
|
44
|
-
* @param currentRound The round number that was rejected (NOT incremented).
|
|
45
|
-
* @param task The original loop task description.
|
|
46
|
-
* @param enforceResult The enforcement decision with reason and fix instructions.
|
|
47
|
-
* @param verificationFlags The verification gate's findings for this round.
|
|
48
|
-
* Used to build the Evidence Gap section. */
|
|
49
|
-
export declare function buildRejectionPrompt(currentRound: number, task: string, enforceResult: EnforcementResult, verificationFlags?: VerificationFlag[]): string;
|
|
50
|
-
//# sourceMappingURL=enforcement-gate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enforcement-gate.d.ts","sourceRoot":"","sources":["../src/enforcement-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAmevB;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,cAAc,EACxB,YAAY,EAAE,kBAAkB,EAChC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,UAAU,EAAE,EAC1B,qBAAqB,GAAE,MAAU,EACjC,iBAAiB,UAAQ,GACxB,iBAAiB,CA0BnB;AAED;;;;;;;;;;;;;;sEAcsE;AACtE,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,iBAAiB,EAChC,iBAAiB,GAAE,gBAAgB,EAAO,GACzC,MAAM,CA6CR"}
|