@enderfga/claw-orchestrator 3.5.6 → 3.7.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 +64 -2
- package/configs/autoloop-planner-prompt.md +11 -9
- package/configs/autoloop-reviewer-prompt.md +6 -2
- package/dist/bin/mcp-server.d.ts +2 -0
- package/dist/bin/mcp-server.js +147 -0
- package/dist/bin/mcp-server.js.map +1 -0
- package/dist/src/autoloop/dispatcher.d.ts +15 -1
- package/dist/src/autoloop/dispatcher.js +172 -12
- package/dist/src/autoloop/dispatcher.js.map +1 -1
- package/dist/src/autoloop/messages.d.ts +15 -1
- package/dist/src/autoloop/messages.js +4 -0
- package/dist/src/autoloop/messages.js.map +1 -1
- package/dist/src/autoloop/notify.js +16 -19
- package/dist/src/autoloop/notify.js.map +1 -1
- package/dist/src/autoloop/runner.d.ts +10 -0
- package/dist/src/autoloop/runner.js +112 -2
- package/dist/src/autoloop/runner.js.map +1 -1
- package/dist/src/autoloop/types.d.ts +38 -0
- package/dist/src/autoloop/types.js +4 -0
- package/dist/src/autoloop/types.js.map +1 -1
- package/dist/src/index.js +11 -3
- package/dist/src/index.js.map +1 -1
- package/package.json +25 -5
- package/skills/SKILL.md +1 -1
- package/skills/references/autoloop.md +78 -9
- package/skills/references/mcp.md +294 -0
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ It's a TypeScript runtime for orchestrating Claude Code, OpenAI Codex, Gemini, C
|
|
|
12
12
|
|
|
13
13
|
> Claude Code, Codex, Gemini, Cursor Agent, OpenCode, or your own custom CLI — orchestrated as one runtime.
|
|
14
14
|
>
|
|
15
|
-
> **Runs standalone,
|
|
15
|
+
> **Runs standalone, as an OpenClaw plugin, or as a Model Context Protocol (MCP) server — drop it into Hermes Agent, Claude Desktop, Cursor, Cline, Continue, Zed, Windsurf, Goose, or any MCP-compatible host.**
|
|
16
16
|
|
|
17
17
|
[](https://www.npmjs.com/package/@enderfga/claw-orchestrator)
|
|
18
18
|
[](https://github.com/Enderfga/claw-orchestrator/actions/workflows/ci.yml)
|
|
@@ -41,7 +41,8 @@ Claw Orchestrator is the control layer for that.
|
|
|
41
41
|
- Run Claude Code or Codex as a headless coding agent
|
|
42
42
|
- Keep persistent AI coding sessions alive across requests
|
|
43
43
|
- Build multi-agent coding teams with isolated git worktrees
|
|
44
|
-
- Expose coding agents as tools
|
|
44
|
+
- Expose coding agents as MCP tools so Hermes Agent, Claude Desktop, Cursor, Cline, Continue, Zed, Windsurf, Goose, and other MCP-capable hosts can drive them
|
|
45
|
+
- Use the same toolset from OpenClaw, bots, dashboards, or custom runtimes
|
|
45
46
|
- Route tasks across Claude Code, Codex, Gemini, Cursor Agent, OpenCode, and custom CLIs
|
|
46
47
|
|
|
47
48
|
---
|
|
@@ -156,6 +157,67 @@ curl -fsSL https://raw.githubusercontent.com/Enderfga/claw-orchestrator/main/ins
|
|
|
156
157
|
|
|
157
158
|
This installs via npm, registers the plugin in `~/.openclaw/openclaw.json`, and restarts the gateway. See [`skills/references/getting-started.md`](./skills/references/getting-started.md) for the full setup.
|
|
158
159
|
|
|
160
|
+
### As an MCP server (Hermes Agent, Claude Desktop, Cursor, Cline, Continue, Zed, Windsurf, Goose)
|
|
161
|
+
|
|
162
|
+
Every host that speaks the [Model Context Protocol](https://modelcontextprotocol.io) can pick up the orchestrator's full toolset (41 tools — sessions, council, ultraplan, ultrareview, autoloop, codex, inbox) over stdio.
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
npm install -g @enderfga/claw-orchestrator
|
|
166
|
+
# now `clawo-mcp` is on PATH
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Register it with your host:
|
|
170
|
+
|
|
171
|
+
<details>
|
|
172
|
+
<summary><strong>Hermes Agent</strong> — <code>~/.hermes/config.yaml</code></summary>
|
|
173
|
+
|
|
174
|
+
```yaml
|
|
175
|
+
mcp_servers:
|
|
176
|
+
clawo:
|
|
177
|
+
command: clawo-mcp
|
|
178
|
+
env:
|
|
179
|
+
ANTHROPIC_API_KEY: "..."
|
|
180
|
+
OPENAI_API_KEY: "..."
|
|
181
|
+
GEMINI_API_KEY: "..."
|
|
182
|
+
# Optional: keep the model focused — Hermes will surface only these
|
|
183
|
+
tools:
|
|
184
|
+
include: [mcp_clawo_session_start, mcp_clawo_session_send, mcp_clawo_council_start]
|
|
185
|
+
```
|
|
186
|
+
</details>
|
|
187
|
+
|
|
188
|
+
<details>
|
|
189
|
+
<summary><strong>Claude Desktop / Claude Code</strong> — <code>claude_desktop_config.json</code></summary>
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"mcpServers": {
|
|
194
|
+
"clawo": {
|
|
195
|
+
"command": "clawo-mcp",
|
|
196
|
+
"env": {
|
|
197
|
+
"ANTHROPIC_API_KEY": "...",
|
|
198
|
+
"OPENAI_API_KEY": "...",
|
|
199
|
+
"CLAWO_MCP_TOOLS": "session_start,session_send,council_start,council_status,ultrareview_start"
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
</details>
|
|
206
|
+
|
|
207
|
+
<details>
|
|
208
|
+
<summary><strong>Cursor / Cline / Continue / Zed / Windsurf / Goose</strong></summary>
|
|
209
|
+
|
|
210
|
+
Every one of these hosts speaks the standard MCP stdio config. Add `clawo-mcp` as a server with the same `command + args + env` shape — refer to your host's MCP documentation for the exact file path.
|
|
211
|
+
</details>
|
|
212
|
+
|
|
213
|
+
**Notes**
|
|
214
|
+
|
|
215
|
+
- Hosts prefix MCP tool names with the server slug (e.g. `mcp_clawo_session_start` in Hermes). The model sees the prefixed name; you don't need to call it manually.
|
|
216
|
+
- `CLAWO_MCP_TOOLS` (comma-separated allowlist) keeps the exposed surface tight when the host has a tight tool budget. Without it, all 41 tools are advertised.
|
|
217
|
+
- Hosts do not forward arbitrary shell env vars to MCP servers — list every API key your engines need (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, etc.) explicitly under `env`.
|
|
218
|
+
|
|
219
|
+
Full reference: [`skills/references/mcp.md`](./skills/references/mcp.md).
|
|
220
|
+
|
|
159
221
|
---
|
|
160
222
|
|
|
161
223
|
## Engine Compatibility
|
|
@@ -49,7 +49,7 @@ turn. Anything outside the blocks is shown to the user as your chat reply.
|
|
|
49
49
|
|
|
50
50
|
**Rules:**
|
|
51
51
|
- **Never call `spawn_subagents` without explicit user approval** in the chat. Even if the plan looks done, ask "ready to spawn subagents?" first and wait for "go" / "ok" / "开干" / similar. Exception: if `plan.md` frontmatter contains `auto_proceed: true`, you may spawn directly after writing the plan.
|
|
52
|
-
- **Sanity-check the plan before spawning.** `plan.md` must have a Goal section, ≥1 gate, and a Constraints block. `goal.json` must
|
|
52
|
+
- **Sanity-check the plan before spawning.** `plan.md` must have a Goal section, ≥1 gate, and a Constraints block. `goal.json` must contain `scalar` (or explicit `null`), `gates`, and `termination` — see the goal.json shape example in `skills/references/autoloop.md` (§ `goal.json` shape).
|
|
53
53
|
- **Do not emit raw JSON outside an `autoloop` fence.** Anything outside is shown to the user verbatim.
|
|
54
54
|
- The user CAN see your reply — including questions, summaries, file references — but **cannot** see the autoloop blocks you emit. Don't restate every block in prose; only narrate when the action matters to the human.
|
|
55
55
|
|
|
@@ -96,9 +96,10 @@ turn. Anything outside the blocks is shown to the user as your chat reply.
|
|
|
96
96
|
eval set unchanged, flag", "no new flags toggled silently">
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
4. **Write goal.json** as the machine-readable mirror of the success criteria
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
4. **Write goal.json** as the machine-readable mirror of the success criteria.
|
|
100
|
+
The shape is `{ scalar: { name, direction, extract_cmd, target } | null,
|
|
101
|
+
gates: [{ name, cmd, must }], termination: { max_iters, scalar_target_hit? } }`
|
|
102
|
+
— see the worked example in `skills/references/autoloop.md`.
|
|
102
103
|
|
|
103
104
|
5. **Confirm with the user.** When you believe the plan is solid, say so
|
|
104
105
|
plainly and ask "ready to spawn subagents?". Do **not** spawn them
|
|
@@ -120,14 +121,15 @@ turn. Anything outside the blocks is shown to the user as your chat reply.
|
|
|
120
121
|
- ❌ Run the evaluator yourself. The Coder runs eval, the Reviewer audits it.
|
|
121
122
|
- ❌ Promise outcomes ("this will get loss to 0.1"). State assumptions and
|
|
122
123
|
gates instead.
|
|
123
|
-
- ❌
|
|
124
|
-
|
|
124
|
+
- ❌ Spam the user out-of-band. `notify_user` works, but the 5-minute dedup
|
|
125
|
+
doesn't make spam OK. Use it when something needs the user's attention
|
|
126
|
+
(decision, regression, stall, target hit), not for routine progress.
|
|
125
127
|
|
|
126
128
|
## Format
|
|
127
129
|
|
|
128
|
-
Free-form chat is fine.
|
|
129
|
-
|
|
130
|
-
|
|
130
|
+
Free-form chat is fine. Autoloop control tools are parsed out of your reply
|
|
131
|
+
as fenced ` ```autoloop ` JSON blocks (see the tool table above). Anything
|
|
132
|
+
outside those blocks is shown to the user verbatim.
|
|
131
133
|
|
|
132
134
|
---
|
|
133
135
|
|
|
@@ -9,8 +9,12 @@ independently verify whether each iteration actually moved toward the goal.
|
|
|
9
9
|
that contains only the artifacts the orchestrator hands you for the iter
|
|
10
10
|
under review — not the live workspace, not unrelated history.
|
|
11
11
|
- You persist across iterations. Your accumulating mental model of "how
|
|
12
|
-
Coder cheats / cuts corners" is your most valuable asset.
|
|
13
|
-
|
|
12
|
+
Coder cheats / cuts corners" is your most valuable asset. **The current
|
|
13
|
+
contents of `reviewer_memory.md` are injected as a frozen snapshot in
|
|
14
|
+
your system prompt at the start of this session**, so you do not need to
|
|
15
|
+
re-read the file each iter. Append fresh observations to it during
|
|
16
|
+
reviews; those edits become visible on the next Reviewer reset, not
|
|
17
|
+
mid-session.
|
|
14
18
|
- You report only to the runner (which forwards your verdict to Planner).
|
|
15
19
|
You do **not** chat with the user or with the Coder.
|
|
16
20
|
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* claw-orchestrator MCP server
|
|
4
|
+
*
|
|
5
|
+
* Exposes the orchestrator's tool surface over the Model Context Protocol
|
|
6
|
+
* (stdio transport). Drop into any MCP-compatible host (Hermes Agent, Claude
|
|
7
|
+
* Desktop, Cursor, Cline, Continue, Zed, Windsurf, Goose, …) by adding it
|
|
8
|
+
* to that host's MCP server config.
|
|
9
|
+
*
|
|
10
|
+
* Implementation: feed `plugin.register()` a capturing PluginAPI shim, then
|
|
11
|
+
* translate each captured tool into MCP `tools/list` + `tools/call`. This
|
|
12
|
+
* keeps a single tool definition site (`src/index.ts`) shared between the
|
|
13
|
+
* OpenClaw plugin entry and the MCP entry — no schema drift between them.
|
|
14
|
+
*
|
|
15
|
+
* Stdout is reserved for the MCP protocol — every log line goes to stderr.
|
|
16
|
+
*
|
|
17
|
+
* Environment variables read at startup:
|
|
18
|
+
* CLAWO_MCP_TOOLS comma-separated allowlist of tool names. Unlisted
|
|
19
|
+
* tools are not exposed. Useful when the host has a
|
|
20
|
+
* tight tool budget (default: expose everything).
|
|
21
|
+
* CLAWO_NO_EMBEDDED_SERVER set automatically; suppresses the plugin's HTTP
|
|
22
|
+
* control-plane (port 18796) which is dead weight
|
|
23
|
+
* for MCP-only deployments.
|
|
24
|
+
*/
|
|
25
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
26
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
27
|
+
import { ListToolsRequestSchema, CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
28
|
+
// The plugin lazily starts EmbeddedServer on first tool call unless this is
|
|
29
|
+
// set. Set before importing so the env is seen on the very first invocation.
|
|
30
|
+
process.env.CLAWO_NO_EMBEDDED_SERVER ??= '1';
|
|
31
|
+
const { default: plugin } = await import('../src/index.js');
|
|
32
|
+
// Hand-curated hints. MCP hosts surface these to the model so it can pick
|
|
33
|
+
// safer tools first (Hermes / Cursor / Claude Desktop all read them).
|
|
34
|
+
//
|
|
35
|
+
// readOnly — does not mutate workspace, sessions, files, or branches
|
|
36
|
+
// destructive — irreversible side-effects (delete worktree, drop branch, kill process)
|
|
37
|
+
// openWorld — touches things outside the local machine (model APIs)
|
|
38
|
+
const ANNOTATIONS = {
|
|
39
|
+
// pure reads
|
|
40
|
+
session_list: { readOnlyHint: true, idempotentHint: true },
|
|
41
|
+
sessions_overview: { readOnlyHint: true, idempotentHint: true },
|
|
42
|
+
coding_session_status: { readOnlyHint: true, idempotentHint: true },
|
|
43
|
+
session_grep: { readOnlyHint: true, idempotentHint: true },
|
|
44
|
+
session_inbox: { readOnlyHint: true, idempotentHint: true },
|
|
45
|
+
coding_agents_list: { readOnlyHint: true, idempotentHint: true },
|
|
46
|
+
team_list: { readOnlyHint: true, idempotentHint: true },
|
|
47
|
+
council_status: { readOnlyHint: true, idempotentHint: true },
|
|
48
|
+
council_review: { readOnlyHint: true, idempotentHint: true },
|
|
49
|
+
ultraplan_status: { readOnlyHint: true, idempotentHint: true },
|
|
50
|
+
ultrareview_status: { readOnlyHint: true, idempotentHint: true },
|
|
51
|
+
autoloop_status: { readOnlyHint: true, idempotentHint: true },
|
|
52
|
+
autoloop_list: { readOnlyHint: true, idempotentHint: true },
|
|
53
|
+
codex_goal_get: { readOnlyHint: true, idempotentHint: true },
|
|
54
|
+
// destructive
|
|
55
|
+
session_stop: { destructiveHint: true },
|
|
56
|
+
council_abort: { destructiveHint: true },
|
|
57
|
+
council_accept: { destructiveHint: true },
|
|
58
|
+
council_reject: { destructiveHint: true },
|
|
59
|
+
autoloop_stop: { destructiveHint: true },
|
|
60
|
+
project_purge: { destructiveHint: true },
|
|
61
|
+
// mutating + open-world (call external model APIs)
|
|
62
|
+
session_start: { openWorldHint: true },
|
|
63
|
+
session_send: { openWorldHint: true },
|
|
64
|
+
team_send: { openWorldHint: true },
|
|
65
|
+
session_send_to: { openWorldHint: true },
|
|
66
|
+
session_deliver_inbox: { openWorldHint: true },
|
|
67
|
+
council_start: { openWorldHint: true },
|
|
68
|
+
council_inject: { openWorldHint: true },
|
|
69
|
+
ultraplan_start: { openWorldHint: true },
|
|
70
|
+
ultrareview_start: { openWorldHint: true },
|
|
71
|
+
autoloop_start: { openWorldHint: true },
|
|
72
|
+
autoloop_chat: { openWorldHint: true },
|
|
73
|
+
autoloop_reset_agent: {},
|
|
74
|
+
codex_resume: { openWorldHint: true },
|
|
75
|
+
codex_review: { openWorldHint: true },
|
|
76
|
+
codex_goal_set: { openWorldHint: true },
|
|
77
|
+
codex_goal_pause: {},
|
|
78
|
+
codex_goal_resume: { openWorldHint: true },
|
|
79
|
+
codex_goal_clear: {},
|
|
80
|
+
session_compact: { openWorldHint: true },
|
|
81
|
+
session_update_tools: {},
|
|
82
|
+
session_switch_model: {},
|
|
83
|
+
};
|
|
84
|
+
const log = {
|
|
85
|
+
info: (...args) => console.error('[clawo-mcp]', ...args),
|
|
86
|
+
warn: (...args) => console.error('[clawo-mcp]', ...args),
|
|
87
|
+
error: (...args) => console.error('[clawo-mcp]', ...args),
|
|
88
|
+
};
|
|
89
|
+
const captured = [];
|
|
90
|
+
const shim = {
|
|
91
|
+
pluginConfig: {},
|
|
92
|
+
logger: log,
|
|
93
|
+
registerTool: (def) => {
|
|
94
|
+
captured.push(def);
|
|
95
|
+
},
|
|
96
|
+
on: () => { },
|
|
97
|
+
registerHttpRoute: () => { },
|
|
98
|
+
registerService: () => { },
|
|
99
|
+
};
|
|
100
|
+
plugin.register(shim);
|
|
101
|
+
const allowlist = (process.env.CLAWO_MCP_TOOLS ?? '').trim();
|
|
102
|
+
const allowed = allowlist
|
|
103
|
+
? new Set(allowlist
|
|
104
|
+
.split(',')
|
|
105
|
+
.map((s) => s.trim())
|
|
106
|
+
.filter(Boolean))
|
|
107
|
+
: null;
|
|
108
|
+
const tools = allowed ? captured.filter((t) => allowed.has(t.name)) : captured;
|
|
109
|
+
if (allowed && tools.length === 0) {
|
|
110
|
+
log.warn(`CLAWO_MCP_TOOLS filter matched 0 tools. Captured: ${captured.map((t) => t.name).join(', ')}`);
|
|
111
|
+
}
|
|
112
|
+
const PKG_VERSION = process.env.npm_package_version ?? '3.7.0';
|
|
113
|
+
const server = new Server({ name: 'claw-orchestrator', version: PKG_VERSION }, { capabilities: { tools: {} } });
|
|
114
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
115
|
+
tools: tools.map((t) => ({
|
|
116
|
+
name: t.name,
|
|
117
|
+
description: t.description,
|
|
118
|
+
inputSchema: t.parameters,
|
|
119
|
+
...(ANNOTATIONS[t.name] ? { annotations: ANNOTATIONS[t.name] } : {}),
|
|
120
|
+
})),
|
|
121
|
+
}));
|
|
122
|
+
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
123
|
+
const tool = tools.find((t) => t.name === req.params.name);
|
|
124
|
+
if (!tool) {
|
|
125
|
+
return {
|
|
126
|
+
isError: true,
|
|
127
|
+
content: [{ type: 'text', text: `Unknown tool: ${req.params.name}` }],
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
const result = await tool.execute(`mcp-${Date.now()}`, (req.params.arguments ?? {}));
|
|
132
|
+
return {
|
|
133
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
138
|
+
return {
|
|
139
|
+
isError: true,
|
|
140
|
+
content: [{ type: 'text', text: msg }],
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
const transport = new StdioServerTransport();
|
|
145
|
+
await server.connect(transport);
|
|
146
|
+
log.info(`mcp server ready — exposing ${tools.length} of ${captured.length} tools over stdio`);
|
|
147
|
+
//# sourceMappingURL=mcp-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../../bin/mcp-server.ts"],"names":[],"mappings":";AAC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C;AAEH,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAEhC,GAAG,CAAC,IAAI,CAAC,+BAA+B,KAAK,CAAC,MAAM,OAAO,QAAQ,CAAC,MAAM,mBAAmB,CAAC,CAAC"}
|
|
@@ -22,7 +22,7 @@ import { EventEmitter } from 'node:events';
|
|
|
22
22
|
import type { SessionManager } from '../session-manager.js';
|
|
23
23
|
import type { Logger } from '../logger.js';
|
|
24
24
|
import { type AnyAutoloopMessage } from './messages.js';
|
|
25
|
-
import type
|
|
25
|
+
import { type AgentDispatcher, type AutoloopState, type PushPolicy } from './types.js';
|
|
26
26
|
import { type SpawnSubagentsArgs } from './planner-tools.js';
|
|
27
27
|
export interface ClaudeAgentDispatcherConfig {
|
|
28
28
|
manager: SessionManager;
|
|
@@ -115,6 +115,13 @@ export declare class ClaudeAgentDispatcher extends EventEmitter implements Agent
|
|
|
115
115
|
* deliverToCoder / deliverToReviewer to recover from subprocess deaths.
|
|
116
116
|
*/
|
|
117
117
|
private sendWithRecovery;
|
|
118
|
+
/**
|
|
119
|
+
* Append a structured audit row to `<ledger>/decisions.jsonl`. Best-effort:
|
|
120
|
+
* any I/O failure is logged but never thrown. Captures terminate, reset,
|
|
121
|
+
* push-policy mutations, compact triggers, subagent spawns, phase-error
|
|
122
|
+
* passes, and policy-silence attempts that we rejected.
|
|
123
|
+
*/
|
|
124
|
+
private appendDecisionLog;
|
|
118
125
|
private lastCompactAt;
|
|
119
126
|
private compactSummaryFor;
|
|
120
127
|
private maybeCompact;
|
|
@@ -122,6 +129,13 @@ export declare class ClaudeAgentDispatcher extends EventEmitter implements Agent
|
|
|
122
129
|
private deliverToPlanner;
|
|
123
130
|
private ensureCoder;
|
|
124
131
|
private deliverToCoder;
|
|
132
|
+
/**
|
|
133
|
+
* Compose the Reviewer's system prompt with a frozen snapshot of
|
|
134
|
+
* `reviewer_memory.md` appended. Read once at session start; mid-session
|
|
135
|
+
* edits to the file do NOT take effect until the next Reviewer reset. This
|
|
136
|
+
* keeps the per-iter prompt prefix stable so Claude's prefix cache hits.
|
|
137
|
+
*/
|
|
138
|
+
private buildReviewerSystemPrompt;
|
|
125
139
|
private ensureReviewer;
|
|
126
140
|
/**
|
|
127
141
|
* Stage the iter's artifacts into the Reviewer sandbox cwd. Reviewer is a
|