@enderfga/claw-orchestrator 3.5.5 → 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.
@@ -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 validate against v1 GoalSpec (see `src/autoloop/v1/types.ts`).
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
- — the same shape as v1's GoalSpec (see `src/autoloop/v1/types.ts`). The
101
- runner will validate this when subagents are spawned.
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
- - ❌ Push the user out-of-band. In S2 there is no `notify_user` tool. Speak
124
- through chat only.
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. If you need to emit something machine-readable for
129
- later phases, fence it as JSON in a labeled code block — but in S2 nothing
130
- parses your output for structured signals, so prefer prose.
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. Save what you
13
- learn into `reviewer_memory.md` after each review.
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
 
package/dist/bin/cli.js CHANGED
@@ -9,9 +9,34 @@
9
9
  */
10
10
  import { Command } from 'commander';
11
11
  import { createRequire } from 'node:module';
12
+ import * as fs from 'node:fs';
13
+ import * as path from 'node:path';
14
+ import * as os from 'node:os';
12
15
  function getBaseUrl() {
13
16
  return process.env.CLAWO_API_URL || process.env.CLAUDE_CODE_API_URL || 'http://127.0.0.1:18796';
14
17
  }
18
+ /**
19
+ * Locate the auth token the embedded server requires (3.5.6+):
20
+ * 1. CLAWO_AUTH_TOKEN env (explicit override)
21
+ * 2. OPENCLAW_SERVER_TOKEN env (same env the server reads — handy when both
22
+ * processes share the same shell)
23
+ * 3. ~/.openclaw/server-token file (the server writes this at startup)
24
+ * Returns null if nothing is found — caller falls through to an unauthenticated
25
+ * request, which the server will reject with 401 unless `OPENCLAW_SERVER_TOKEN=disabled`.
26
+ */
27
+ function getAuthToken() {
28
+ const envToken = process.env.CLAWO_AUTH_TOKEN || process.env.OPENCLAW_SERVER_TOKEN;
29
+ if (envToken && envToken !== 'disabled')
30
+ return envToken;
31
+ try {
32
+ const filePath = path.join(os.homedir(), '.openclaw', 'server-token');
33
+ const t = fs.readFileSync(filePath, 'utf-8').trim();
34
+ return t || null;
35
+ }
36
+ catch {
37
+ return null;
38
+ }
39
+ }
15
40
  function getCliVersion() {
16
41
  try {
17
42
  const _require = createRequire(import.meta.url);
@@ -25,10 +50,11 @@ function getCliVersion() {
25
50
  }
26
51
  // ─── HTTP Client ─────────────────────────────────────────────────────────────
27
52
  async function api(path, method = 'GET', body) {
28
- const opts = {
29
- method,
30
- headers: { 'Content-Type': 'application/json' },
31
- };
53
+ const headers = { 'Content-Type': 'application/json' };
54
+ const token = getAuthToken();
55
+ if (token)
56
+ headers.Authorization = `Bearer ${token}`;
57
+ const opts = { method, headers };
32
58
  if (body)
33
59
  opts.body = JSON.stringify(body);
34
60
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../bin/cli.ts"],"names":[],"mappings":";AACA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,SAAS,UAAU;IACjB,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,wBAAwB,CAAC;AAClG,C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AM,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;IACxC,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,oBAAoB,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IAC/E,IAAI,CAAC,CAAC,EAAE;QAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC;;QACrC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;AAC3C,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,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 { AgentDispatcher, AutoloopState, PushPolicy } from './types.js';
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
@@ -25,8 +25,22 @@ import { fileURLToPath } from 'node:url';
25
25
  import { nullLogger } from '../logger.js';
26
26
  import { spawn } from 'node:child_process';
27
27
  import { Msg } from './messages.js';
28
+ import { LEDGER_SCHEMA_VERSION } from './types.js';
28
29
  import { applyPlannerToolCalls, parsePlannerReply, } from './planner-tools.js';
29
30
  import { extractIterComplete, extractReviewComplete, parseAgentReply } from './agent-tools.js';
31
+ /**
32
+ * Files inside <ledger>/reviewer_sandbox/ that survive `stageReviewSandbox`.
33
+ * Anything not listed is wiped between iters. `reviewer_memory.md` is also
34
+ * frozen-injected into the Reviewer system prompt at session start, so
35
+ * mid-session edits won't be reread until the next reset.
36
+ */
37
+ const REVIEWER_SANDBOX_PERSIST = new Set(['reviewer_memory.md', 'reviewer_log.jsonl']);
38
+ /**
39
+ * Push-policy keys that callers MUST NOT be able to silence at runtime.
40
+ * Prompt-injection could otherwise let a confused/malicious Planner mute the
41
+ * channels we use to surface phase errors and decision points.
42
+ */
43
+ const UNSILENCEABLE_POLICY_KEYS = new Set(['on_phase_error', 'on_decision_needed']);
30
44
  function resolveConfigByName(filename) {
31
45
  const filePath = fileURLToPath(import.meta.url);
32
46
  let dir = path.dirname(filePath);
@@ -85,7 +99,11 @@ export class ClaudeAgentDispatcher extends EventEmitter {
85
99
  await this.ensurePlanner();
86
100
  }
87
101
  async shutdown(reason) {
88
- void reason;
102
+ this.appendDecisionLog({
103
+ kind: 'terminate',
104
+ actor: reason === 'phase_error_circuit' ? 'runner' : 'planner',
105
+ payload: { reason },
106
+ });
89
107
  // Best-effort cleanup. Stopping a non-existent session is a no-op.
90
108
  for (const name of [this.plannerName, this.coderName, this.reviewerName]) {
91
109
  try {
@@ -135,6 +153,11 @@ export class ClaudeAgentDispatcher extends EventEmitter {
135
153
  throw new Error('Refusing to reset Planner without force=true (would discard chat context)');
136
154
  }
137
155
  const name = agent === 'planner' ? this.plannerName : agent === 'coder' ? this.coderName : this.reviewerName;
156
+ this.appendDecisionLog({
157
+ kind: 'reset_agent',
158
+ actor: 'dispatcher',
159
+ payload: { agent, force: !!opts.force, eagerRestart: !!opts.eagerRestart },
160
+ });
138
161
  try {
139
162
  await this.config.manager.stopSession(name);
140
163
  }
@@ -177,10 +200,26 @@ export class ClaudeAgentDispatcher extends EventEmitter {
177
200
  }
178
201
  catch (err2) {
179
202
  this.logger.error?.(`[autoloop] ${agent} second attempt failed after reset: ${err2.message}`);
180
- return { output: '', error: err2.message };
203
+ return { output: '', error: err2.message, fatal: true };
181
204
  }
182
205
  }
183
206
  }
207
+ /**
208
+ * Append a structured audit row to `<ledger>/decisions.jsonl`. Best-effort:
209
+ * any I/O failure is logged but never thrown. Captures terminate, reset,
210
+ * push-policy mutations, compact triggers, subagent spawns, phase-error
211
+ * passes, and policy-silence attempts that we rejected.
212
+ */
213
+ appendDecisionLog(entry) {
214
+ try {
215
+ fs.mkdirSync(this.ledgerDir, { recursive: true });
216
+ const line = JSON.stringify({ ts: new Date().toISOString(), ...entry }) + '\n';
217
+ fs.appendFileSync(path.join(this.ledgerDir, 'decisions.jsonl'), line);
218
+ }
219
+ catch (err) {
220
+ this.logger.warn?.(`[autoloop] decisions.jsonl append failed: ${err.message}`);
221
+ }
222
+ }
184
223
  // ─── Auto-compact ────────────────────────────────────────────────────────
185
224
  //
186
225
  // After each agent turn we check getStats().contextPercent. When it crosses
@@ -236,6 +275,11 @@ export class ClaudeAgentDispatcher extends EventEmitter {
236
275
  this.lastCompactAt[agent] = Date.now();
237
276
  this.logger.info?.(`[autoloop/${this.config.runId}] ${agent} context ${pct.toFixed(0)}% ≥ ${threshold}% — auto-compact`);
238
277
  this.emit('compact', { agent, percent: pct, threshold });
278
+ this.appendDecisionLog({
279
+ kind: 'compact',
280
+ actor: 'dispatcher',
281
+ payload: { agent, percent: pct, threshold },
282
+ });
239
283
  try {
240
284
  await this.config.manager.compactSession(name, this.compactSummaryFor(agent));
241
285
  }
@@ -293,6 +337,11 @@ export class ClaudeAgentDispatcher extends EventEmitter {
293
337
  }
294
338
  const effects = {
295
339
  spawnSubagents: async (args) => {
340
+ this.appendDecisionLog({
341
+ kind: 'spawn_subagents',
342
+ actor: 'planner',
343
+ payload: { args },
344
+ });
296
345
  if (this.config.onSpawnSubagents) {
297
346
  await this.config.onSpawnSubagents(args);
298
347
  }
@@ -314,17 +363,46 @@ export class ClaudeAgentDispatcher extends EventEmitter {
314
363
  'on_stall_30min',
315
364
  'on_decision_needed',
316
365
  ]);
366
+ const applied = {};
367
+ const silenced_blocked = [];
317
368
  for (const [k, v] of Object.entries(delta)) {
318
369
  if (!policyKeys.has(k) || typeof v !== 'object' || v === null)
319
370
  continue;
320
- this.config.pushPolicyRef[k] = v;
371
+ // B2: refuse to silence the channels that surface phase errors and
372
+ // user decisions. Other fields on the same rule still apply, so the
373
+ // operator can re-target level/channel without going dark.
374
+ const rule = { ...v };
375
+ if (UNSILENCEABLE_POLICY_KEYS.has(k) && rule.silent === true) {
376
+ silenced_blocked.push(k);
377
+ this.logger.warn?.(`[autoloop] refused to set silent=true on critical policy key ${k}`);
378
+ delete rule.silent;
379
+ }
380
+ this.config.pushPolicyRef[k] = rule;
381
+ applied[k] = rule;
382
+ }
383
+ if (silenced_blocked.length > 0) {
384
+ this.appendDecisionLog({
385
+ kind: 'policy_silence_blocked',
386
+ actor: 'planner',
387
+ payload: { keys: silenced_blocked },
388
+ });
389
+ }
390
+ if (Object.keys(applied).length > 0) {
391
+ this.appendDecisionLog({
392
+ kind: 'update_push_policy',
393
+ actor: 'planner',
394
+ payload: { applied },
395
+ });
321
396
  }
322
397
  },
323
398
  commitPlanFile: async (file, message) => {
324
399
  await this.gitCommit(file, message ?? `autoloop: planner commits ${file}`);
325
400
  },
326
401
  };
327
- const handlerResult = await applyPlannerToolCalls(parsed.calls, effects, env.iter);
402
+ // After iter_done(N) the run has advanced to iter N+1 in runner state;
403
+ // any directive Planner emits in response targets the new iter.
404
+ const nextIter = env.type === 'iter_done' ? env.iter + 1 : env.iter;
405
+ const handlerResult = await applyPlannerToolCalls(parsed.calls, effects, nextIter);
328
406
  for (const errEntry of handlerResult.errors) {
329
407
  this.logger.warn?.(`[autoloop] tool '${errEntry.tool}' failed: ${errEntry.error}`);
330
408
  }
@@ -359,6 +437,7 @@ export class ClaudeAgentDispatcher extends EventEmitter {
359
437
  const iterDir = path.join(this.ledgerDir, 'iter', String(env.iter));
360
438
  fs.mkdirSync(iterDir, { recursive: true });
361
439
  fs.writeFileSync(path.join(iterDir, 'directive.json'), JSON.stringify({
440
+ schema_version: LEDGER_SCHEMA_VERSION,
362
441
  iter: env.iter,
363
442
  ts: env.ts,
364
443
  ...env.payload,
@@ -387,13 +466,30 @@ export class ClaudeAgentDispatcher extends EventEmitter {
387
466
  .filter(Boolean)
388
467
  .join('\n');
389
468
  const result = await this.sendWithRecovery('coder', this.coderName, promptText);
469
+ // A3: subprocess died (recovery retry exhausted). Surface as phase_error
470
+ // rather than silently masquerading as a "clarification request"; the
471
+ // runner's circuit breaker can then trip after enough consecutive failures.
472
+ if (result.fatal) {
473
+ this.appendDecisionLog({
474
+ kind: 'phase_error',
475
+ actor: 'dispatcher',
476
+ payload: { agent: 'coder', phase: 'send', error: result.error ?? 'unknown' },
477
+ });
478
+ return [
479
+ Msg.phaseError(env.iter, {
480
+ agent: 'coder',
481
+ phase: 'send',
482
+ error: result.error ?? 'unknown send failure',
483
+ }),
484
+ ];
485
+ }
390
486
  const replyText = (result.output ?? '').trim();
391
487
  const parsed = parseAgentReply(replyText);
392
488
  this.emit('coder_reply', parsed.cleaned_reply);
393
489
  const ic = extractIterComplete(parsed.calls);
394
490
  if (!ic) {
395
- // No iter_complete emitted — could be a clarification request, or the
396
- // Coder bailed. Return a directive_ack so Planner sees it next turn.
491
+ // No iter_complete emitted — could be a clarification request. Return a
492
+ // directive_ack so Planner sees it next turn.
397
493
  await this.maybeCompact('coder', this.coderName);
398
494
  return [
399
495
  Msg.directiveAck(env.iter, {
@@ -403,7 +499,7 @@ export class ClaudeAgentDispatcher extends EventEmitter {
403
499
  ];
404
500
  }
405
501
  // Persist eval output to ledger.
406
- fs.writeFileSync(path.join(iterDir, 'eval_output.json'), JSON.stringify(ic.eval_output, null, 2));
502
+ fs.writeFileSync(path.join(iterDir, 'eval_output.json'), JSON.stringify({ schema_version: LEDGER_SCHEMA_VERSION, iter: env.iter, eval_output: ic.eval_output }, null, 2));
407
503
  fs.writeFileSync(path.join(iterDir, 'coder_summary.txt'), `${ic.summary}\n\n--- coder cleaned reply ---\n${parsed.cleaned_reply}\n`);
408
504
  // Compute diff + files_changed via git so we don't trust Coder's claim.
409
505
  const diffOut = await this.runGit(['git', 'diff', '--unified=3']);
@@ -419,7 +515,23 @@ export class ClaudeAgentDispatcher extends EventEmitter {
419
515
  // Commit the iteration so Reviewer's git view is clean for the next iter.
420
516
  await this.runGit(['git', 'add', '-A']);
421
517
  const commitMsg = `autoloop/iter-${env.iter}: ${ic.summary}`.slice(0, 200);
422
- await this.runGit(['git', 'commit', '-m', commitMsg]);
518
+ const commitRes = await this.runGit(['git', 'commit', '-m', commitMsg]);
519
+ // A6: a non-"nothing to commit" failure (hook reject, signing missing,
520
+ // index lock) means the next iter's diff would be wrong. Bail to runner.
521
+ if (commitRes.code !== 0 && !/nothing to commit/i.test(commitRes.out + commitRes.err)) {
522
+ this.appendDecisionLog({
523
+ kind: 'phase_error',
524
+ actor: 'dispatcher',
525
+ payload: { agent: 'coder', phase: 'git_commit', error: commitRes.err.slice(0, 500) },
526
+ });
527
+ return [
528
+ Msg.phaseError(env.iter, {
529
+ agent: 'coder',
530
+ phase: 'git_commit',
531
+ error: `git commit failed (code=${commitRes.code}): ${commitRes.err.slice(0, 300)}`,
532
+ }),
533
+ ];
534
+ }
423
535
  await this.maybeCompact('coder', this.coderName);
424
536
  return [
425
537
  Msg.iterArtifacts(env.iter, {
@@ -430,6 +542,38 @@ export class ClaudeAgentDispatcher extends EventEmitter {
430
542
  ];
431
543
  }
432
544
  // ─── Reviewer ───────────────────────────────────────────────────────────
545
+ /**
546
+ * Compose the Reviewer's system prompt with a frozen snapshot of
547
+ * `reviewer_memory.md` appended. Read once at session start; mid-session
548
+ * edits to the file do NOT take effect until the next Reviewer reset. This
549
+ * keeps the per-iter prompt prefix stable so Claude's prefix cache hits.
550
+ */
551
+ buildReviewerSystemPrompt() {
552
+ const memoryPath = path.join(this.reviewerSandboxDir, 'reviewer_memory.md');
553
+ let memory = '';
554
+ try {
555
+ if (fs.existsSync(memoryPath)) {
556
+ memory = fs.readFileSync(memoryPath, 'utf-8').trim();
557
+ }
558
+ }
559
+ catch (err) {
560
+ this.logger.warn?.(`[autoloop] failed to read reviewer_memory.md: ${err.message}`);
561
+ }
562
+ if (!memory)
563
+ return this.reviewerSystemPrompt;
564
+ return [
565
+ this.reviewerSystemPrompt.trimEnd(),
566
+ '',
567
+ '<frozen_memory_snapshot>',
568
+ memory,
569
+ '</frozen_memory_snapshot>',
570
+ '',
571
+ 'The snapshot above was injected into your system prompt at session start',
572
+ 'and is frozen for this Reviewer session. Append new fakery patterns or',
573
+ 'observations to reviewer_memory.md on disk; they will be re-injected on',
574
+ 'the next Reviewer reset, not mid-session.',
575
+ ].join('\n');
576
+ }
433
577
  async ensureReviewer() {
434
578
  if (this.reviewerStarted)
435
579
  return;
@@ -440,7 +584,7 @@ export class ClaudeAgentDispatcher extends EventEmitter {
440
584
  engine: 'claude',
441
585
  model: this.reviewerModel,
442
586
  permissionMode: 'bypassPermissions',
443
- systemPrompt: this.reviewerSystemPrompt,
587
+ systemPrompt: this.buildReviewerSystemPrompt(),
444
588
  });
445
589
  this.reviewerStarted = true;
446
590
  }
@@ -451,9 +595,11 @@ export class ClaudeAgentDispatcher extends EventEmitter {
451
595
  */
452
596
  stageReviewSandbox(iter) {
453
597
  fs.mkdirSync(this.reviewerSandboxDir, { recursive: true });
454
- // Wipe top-level files (keep reviewer_memory.md if present).
598
+ // Wipe top-level files but preserve the Reviewer's cross-iter memory and
599
+ // append-only audit log (see REVIEWER_SANDBOX_PERSIST). The Reviewer prompt
600
+ // promises both survive across iters; the wipe used to break the log.
455
601
  for (const ent of fs.readdirSync(this.reviewerSandboxDir)) {
456
- if (ent === 'reviewer_memory.md')
602
+ if (REVIEWER_SANDBOX_PERSIST.has(ent))
457
603
  continue;
458
604
  const full = path.join(this.reviewerSandboxDir, ent);
459
605
  try {
@@ -500,6 +646,20 @@ export class ClaudeAgentDispatcher extends EventEmitter {
500
646
  'Audit and emit `review_complete`.',
501
647
  ].join('\n');
502
648
  const result = await this.sendWithRecovery('reviewer', this.reviewerName, promptText);
649
+ if (result.fatal) {
650
+ this.appendDecisionLog({
651
+ kind: 'phase_error',
652
+ actor: 'dispatcher',
653
+ payload: { agent: 'reviewer', phase: 'send', error: result.error ?? 'unknown' },
654
+ });
655
+ return [
656
+ Msg.phaseError(env.payload.iter, {
657
+ agent: 'reviewer',
658
+ phase: 'send',
659
+ error: result.error ?? 'unknown send failure',
660
+ }),
661
+ ];
662
+ }
503
663
  const replyText = (result.output ?? '').trim();
504
664
  const parsed = parseAgentReply(replyText);
505
665
  this.emit('reviewer_reply', parsed.cleaned_reply);
@@ -527,7 +687,7 @@ export class ClaudeAgentDispatcher extends EventEmitter {
527
687
  persistVerdict(iter, payload) {
528
688
  const iterDir = path.join(this.ledgerDir, 'iter', String(iter));
529
689
  fs.mkdirSync(iterDir, { recursive: true });
530
- fs.writeFileSync(path.join(iterDir, 'verdict.json'), JSON.stringify({ iter, ts: new Date().toISOString(), ...payload }, null, 2));
690
+ fs.writeFileSync(path.join(iterDir, 'verdict.json'), JSON.stringify({ schema_version: LEDGER_SCHEMA_VERSION, iter, ts: new Date().toISOString(), ...payload }, null, 2));
531
691
  }
532
692
  /** Run a git command in the workspace; returns combined output. Used by Coder commits. */
533
693
  async runGit(argv) {