bareloop 0.52.0 → 0.53.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.
@@ -260,7 +260,7 @@ export function createScheduleDoor(deps) {
260
260
  if (workflowKey(spec) !== green.key) return reply(400, { refused: 'bad-spec', say: 'The job this would sign is not the one that had the good run. Nothing was changed.' });
261
261
  let monthlyNote = null;
262
262
  try {
263
- const room = checkMonthlyRoom({ capUsd: spec.budgetUsd, home: deps.home, sessionsRoot: deps.sessionsRoot });
263
+ const room = checkMonthlyRoom({ capUsd: spec.budgetUsd, home: deps.home, sessionsRoot: deps.sessionsRoot, now });
264
264
  const refusal = monthlyRefusalText(room);
265
265
  if (refusal) monthlyNote = `${refusal}. Each run is checked against the monthly limit when it starts.`;
266
266
  } catch (e) {
@@ -421,7 +421,7 @@ export function createScheduleDoor(deps) {
421
421
  if (paused(job)) return { outcome: 'refused', why: 'This schedule gave up and is waiting for you. Nothing started.', told: false };
422
422
  if (hooks.busy ?? busy(job)) return told('busy', 'A run of this job is still going. This one starts when it is done.');
423
423
  try {
424
- const room = checkMonthlyRoom({ capUsd: schedule.spec.budgetUsd, home: deps.home, sessionsRoot: deps.sessionsRoot });
424
+ const room = checkMonthlyRoom({ capUsd: schedule.spec.budgetUsd, home: deps.home, sessionsRoot: deps.sessionsRoot, now });
425
425
  if (!room.ok) {
426
426
  return told('monthly-exhausted', 'Not enough money left this month for this run.', { leftUsd: room.leftUsd, needUsd: schedule.spec.budgetUsd, atLeast: room.atLeast === true });
427
427
  }
package/src/planrun.js CHANGED
@@ -38,8 +38,8 @@ import { TOOL_MENU, STORE_VERBS, checkMenu } from './job.js';
38
38
  import { TOOL_BY_VERB, CTX_TOOLS, createCtxTools, toolAction, gatedShellOptions, PERSONA_TOOLS, strategyFor } from './tools.js';
39
39
  import { anySuppressionWarning } from './authoring.js';
40
40
  import { createReadShim, readShimArm, readShimStrategy } from './readshim.js';
41
- import { createHandoffStore, trackReads } from './handoff.js';
42
41
  import { createCarryStore } from './carrystore.js';
42
+ import { buildSeedNote } from './seednote.js';
43
43
  import { globToPrefix, redactSecrets, SECRET_PATTERNS } from './validate.js';
44
44
  import { startAttemptDiff } from './attemptdiff.js';
45
45
  import { validateBridge, loadGate, newestEligibleVersion, reuseEligibility, quarantinesCredit, QUARANTINED_CODE } from './bridges.js';
@@ -352,6 +352,12 @@ function hintsBlock(text) {
352
352
  return `\n${text}\n`;
353
353
  }
354
354
 
355
+ /** The seed note (src/seednote.js), verbatim, in the planner's first-draft prompt; absent or empty renders '' (byte-identical to the prompt without it). */
356
+ function seedNoteBlock(text) {
357
+ if (typeof text !== 'string' || !text.trim()) return '';
358
+ return `\n${text}\n`;
359
+ }
360
+
355
361
  /**
356
362
  * MODULE 8 — the signer's words, when this leg is a RERUN taken at a previous run's
357
363
  * review door (PRD v1.71 §3.4: *"redo/rerun comes with new authoring"*).
@@ -648,8 +654,9 @@ export function boundedNote(bounded, rounds) {
648
654
  * byte-identically to the pre-shim prompt.
649
655
  * @param {string|null} [hints] the cross-run learnings block (src/learn.js `renderHints`), verbatim; null/empty
650
656
  * renders byte-identically to the prompt without it. Only ever passed for the draft and the first replan.
657
+ * @param {string|null} [seedNote] the seed note (src/seednote.js), verbatim, after the hints; null/empty renders byte-identically to the prompt without it. First draft only.
651
658
  */
652
- export function planPrompt(job, scoutBlob, reds, maxStepRounds, failure, scopes, materials, startingDraft = null, checkFacts = {}, doorNote = null, readShim = false, hints = null) {
659
+ export function planPrompt(job, scoutBlob, reds, maxStepRounds, failure, scopes, materials, startingDraft = null, checkFacts = {}, doorNote = null, readShim = false, hints = null, seedNote = null) {
653
660
  const scopeMenu = Array.isArray(scopes) && scopes.length ? scopes : legalScopes(job.writeScope ?? []);
654
661
  const ceiling = Array.isArray(job.tools) ? job.tools : [...TOOL_MENU];
655
662
  // The shape-lottery laws, stated where the check menu is offered (the mailbox
@@ -740,7 +747,7 @@ ${scopeMenu.map((s) => ` ${JSON.stringify(s)}`).join('\n')}
740
747
 
741
748
  Goal:
742
749
  ${job.goal}
743
- ${doorNoteBlock(doorNote)}${materialsBlock(materials)}${hintsBlock(hints)}
750
+ ${doorNoteBlock(doorNote)}${materialsBlock(materials)}${hintsBlock(hints)}${seedNoteBlock(seedNote)}
744
751
  Repository survey (from a read-only scout):
745
752
  ${scoutBlob || '(no scout notes)'}`;
746
753
  let p = doc;
@@ -1003,15 +1010,12 @@ ${scoutBlob || '(no scout notes)'}`;
1003
1010
  * run start from the ledger as it stood). Handed to the PLANNER only: the first draft and the FIRST replan. No worker ever
1004
1011
  * receives it, and a later replan gets nothing. Each injection is recorded on the spine as a `learnings` record (the exact
1005
1012
  * text) so the Audit can show it and the byte check can compare it with a fresh render. `null` = no hints (the default).
1006
- * @param {boolean} [opts.carryNote=false] THE CARRY NOTE (src/carrynote.js): the step/fix worker is handed a facts-only note of what earlier
1007
- * workers of this run looked at, searched and changed, after the handoff note. The caller reads the switch once; `false` builds no store
1008
- * and leaves the worker prompt byte-identical. One `carry-note` spine record (counts only) per note handed.
1009
1013
  * @returns {Promise<string>} 'green' | 'already-green' | 'escalated' | 'plan-red' |
1010
1014
  * 'check-red' | 'close-red' | 'close-unsupported' | 'recipe-stale' | 'pricing-red' |
1011
1015
  * 'branch-red' | 'cap-halt' | 'wall-halt' | 'stopped' | 'provider-red' | 'interpreter-red' |
1012
1016
  * 'step-stalled' | 'hitl-pause' | 'hitl-decision-red' | `step-red:<id>`
1013
1017
  */
1014
- export async function runPlan(job, { workdir, provider, nativeProvider, providerFor, judgeProvider = null, judgeModel = null, rates = null, judgeRates = null, emit, remainingUsd, isUnpriced = () => false, spendComplete = () => true, capRuns = 3, strikeLimit = STRIKE_LIMIT, closeTimeoutMs, closeDir = null, maxStepRounds = 40, layerRoot = false, readShim = false, scout = true, scoutRounds = SCOUT_ROUNDS, bridge = null, now, priorWallMs = 0, resumeSeed = null, resumeGrades = [], resumeReplans = null, resumeBranch = null, humanRuling = null, heldRuling = null, priorSpentUsd = 0, reviewDoor = null, doorRerun = null, resumable = true, stopFile = null, learnHints = null, carryNote = false }) {
1018
+ export async function runPlan(job, { workdir, provider, nativeProvider, providerFor, judgeProvider = null, judgeModel = null, rates = null, judgeRates = null, emit, remainingUsd, isUnpriced = () => false, spendComplete = () => true, capRuns = 3, strikeLimit = STRIKE_LIMIT, closeTimeoutMs, closeDir = null, maxStepRounds = 40, layerRoot = false, readShim = false, scout = true, scoutRounds = SCOUT_ROUNDS, bridge = null, now, priorWallMs = 0, resumeSeed = null, resumeGrades = [], resumeReplans = null, resumeBranch = null, humanRuling = null, heldRuling = null, priorSpentUsd = 0, reviewDoor = null, doorRerun = null, resumable = true, stopFile = null, learnHints = null }) {
1015
1019
  // MEMORY-CACHE: what the read shim (src/readshim.js) saved THIS run, summed across
1016
1020
  // every mkWorker's own shim instance (scout, drafter, each step's worker, the fix
1017
1021
  // worker) — one accumulator closed over by all of them, because the shim's ledger
@@ -1028,13 +1032,17 @@ export async function runPlan(job, { workdir, provider, nativeProvider, provider
1028
1032
  // would be wrong and would look fine). Only the guard runs here; the flag itself
1029
1033
  // is still threaded onward as written.
1030
1034
  readShimArm(readShim);
1031
- // THE HANDOFF NOTE (src/handoff.js): the paths earlier asks of THIS run read. In memory only, so a resumed leg starts empty.
1032
- // The switch is the signed spec's `handoffNote` (absent = on, only `false` turns it off).
1033
- const handoffOn = job.handoffNote !== false;
1034
- const handoff = createHandoffStore({ workdir });
1035
- // THE CARRY NOTE (src/carrynote.js, src/carrystore.js): facts the earlier asks of THIS run produced, handed after the handoff note.
1036
- // The caller reads the one switch (`carryNote` in config.json) once; off builds no store, writes no state, emits nothing.
1037
- const carry = carryNote === true ? createCarryStore({ workdir, emit, strikeLimit, resume: resumeBranch !== null && resumeBranch !== undefined }) : null;
1035
+ // THE SEED NOTE (src/seednote.js): the signed spec's `seedNote`; absent = ON, only `false` turns it off (like the legacy `handoffNote`).
1036
+ const seedNoteOn = job.seedNote !== false;
1037
+ // THE FIRST-READ MAP (src/readshim.js, EXPERIMENTAL): the signed spec's `readMap`; absent = OFF, only `true` turns it on. Needs the read shim on and `ctx_get` in the worker's grant.
1038
+ const readMapOn = job.readMap === true;
1039
+ if (readMapOn && !readShimArm(readShim).on) emit('read-map-skip', { reason: 'shim-off' });
1040
+ /** @type {{ text: string, body: string, stages: string[] }|null} built once, after the preflight loop */
1041
+ let seedNote = null;
1042
+ // THE CARRY NOTE (src/carrynote.js, src/carrystore.js): facts the earlier asks of THIS run produced, files read with their function
1043
+ // line ranges included (the old separate handoff note is folded in). ALWAYS ON, no switch (hamr 2026-11-01); a legacy spec's
1044
+ // `handoffNote` and the retired `carryNote` config key have no effect. One `carry-note` spine record (counts only) per note handed.
1045
+ const carry = createCarryStore({ workdir, emit, strikeLimit, resume: resumeBranch !== null && resumeBranch !== undefined });
1038
1046
  // The scout switch's guard, same class and same door: a mis-typed value
1039
1047
  // coerced by truthiness would run the scout under an "off" label (or skip it
1040
1048
  // under an "on" one) and no reading of the results afterwards could recover
@@ -2163,6 +2171,10 @@ export async function runPlan(job, { workdir, provider, nativeProvider, provider
2163
2171
  * is still the goal the plan exists to flip).
2164
2172
  * @type {string[]} */
2165
2173
  const seedRed = [];
2174
+ // THE SEED NOTE (experimental, default off): the red-at-seed verdicts, with their stage's declared kind, for src/seednote.js.
2175
+ // The kind is read off the signed close's own stage (a command close has none), never matched on a stage name.
2176
+ /** @type {{stage: string|null|undefined, kind: string|null|undefined, gap: string|null|undefined}[]} */
2177
+ const seedReds = [];
2166
2178
  emit('check-menu', {
2167
2179
  offered: menu.map((m) => m.name),
2168
2180
  ...(menu.length < stagedClose.length
@@ -2173,6 +2185,7 @@ export async function runPlan(job, { workdir, provider, nativeProvider, provider
2173
2185
  const v = await runCloseStages(m.run);
2174
2186
  if (v.verdict === 'needs_revision') {
2175
2187
  seedRed.push(m.name);
2188
+ if (seedNoteOn) seedReds.push({ stage: v.stage, kind: stagedClose.find((/** @type {any} */ s2) => s2?.name === v.stage)?.kind, gap: v.gap });
2176
2189
  // …and the preflight grade is a READING, for the same reason the precheck one
2177
2190
  // above is: it is the seed the run's work is measured against. The precheck
2178
2191
  // only ever reds at the close's FIRST failing stage (first-red-wins), so on
@@ -2198,6 +2211,10 @@ export async function runPlan(job, { workdir, provider, nativeProvider, provider
2198
2211
  }
2199
2212
  }
2200
2213
 
2214
+ if (seedNoteOn) seedNote = buildSeedNote(seedReds, scrub);
2215
+ // every step/fix worker gets it through the carry memo (earlier failures, `at start`); the planner has its own block
2216
+ if (seedNote) carry?.setStartFailure(seedNote.body);
2217
+
2201
2218
  // ── 0c, COLD. The seam and both halves of its placement ruling are stated
2202
2219
  // above, where a RESUME reaches it; this is where a run that is NOT resuming
2203
2220
  // does — after the $0 precheck and preflight, so an already-green tree has
@@ -2537,6 +2554,8 @@ export async function runPlan(job, { workdir, provider, nativeProvider, provider
2537
2554
  else memoryCacheCounts.capped++;
2538
2555
  memoryCacheCounts.bytesWithheld += bytes;
2539
2556
  },
2557
+ // The first-read map (experimental, off unless the spec says `readMap: true`): this worker's index, and whether it holds ctx_get.
2558
+ readMap: readMapOn ? { root: workdir, hasGet: grantedNames.has(TOOL_BY_VERB.get), getNode: (/** @type {string} */ rel) => lc.getNode(rel), refresh: () => lc.index({ yield: true }), emit: emitCtx } : null,
2540
2559
  });
2541
2560
  const rdTool = shell.find((/** @type {{name: string}} */ t) => t.name === TOOL_BY_VERB.read);
2542
2561
  // F48: on native, bound shell_read below the CLI's tool-result display cap and hand back a
@@ -2579,34 +2598,17 @@ export async function runPlan(job, { workdir, provider, nativeProvider, provider
2579
2598
  // sampler all live here) for its full duration: measured 4.4s at 4.5% liveness on a
2580
2599
  // 155-file force pass. With yield:true the worst single block measured 189–252ms (n=4),
2581
2600
  // below anything a second/minute-scale timer can perceive. Store output is byte-identical.
2582
- if (ctx.length) await lc.index({ yield: true });
2601
+ // …and with the first-read map on the index is built at run start too, so the map never waits on a ctx tool being granted.
2602
+ if (ctx.length || readMapOn) await lc.index({ yield: true });
2583
2603
  const toolDefs = [...shell, ...ctx];
2584
- // The handoff note: record what each ask READS (the allowed read-class calls), hand the next step/fix ask the map.
2585
- // Scout and drafter asks feed the store but are never given a note.
2586
- /** @type {Set<string>} */
2587
- let askReads = new Set();
2588
- if (handoffOn) trackReads(toolDefs, [TOOL_BY_VERB.read, TOOL_BY_VERB.get], (a) => askReads.add(a), workdir);
2589
- /** @param {(prompt: string, defs?: any) => Promise<any>} inner */
2590
- const withHandoff = (inner) => (!handoffOn ? inner : async (/** @type {string} */ prompt, /** @type {any} */ defs) => {
2591
- askReads = new Set();
2592
- let p = prompt;
2593
- if (phase === 'fix' || phase.startsWith('step:')) {
2594
- // The index is incremental: refreshing it here is what keeps the symbol ranges true to the files as they now are.
2595
- try { if (ctx.length) await lc.index({ yield: true }); } catch { /* the map falls back to line counts */ }
2596
- const note = handoff.render({ getNode: (rel) => lc.getNode(rel) });
2597
- if (note.text) {
2598
- p = `${prompt}\n\n${note.text}`;
2599
- emit('handoff-note', { phase, iteration: roundIteration, chars: note.text.length, paths: note.paths });
2600
- }
2601
- }
2602
- try { return await inner(p, defs); } finally { handoff.absorb(askReads); }
2603
- });
2604
- // The carry note: the same seam, one layer in. It records what each ask's read-class tools returned (a summary, never
2605
- // content) and hands the next step/fix ask the facts. It is the INNER wrapper, so its note lands after the handoff note.
2604
+ // The carry note: records what each ask's read-class tools returned (a summary, never content) and hands the next
2605
+ // step/fix ask the facts. Scout and drafter asks feed the store but are never given a note.
2606
2606
  if (carry) carry.wrapTools(toolDefs);
2607
2607
  /** @param {(prompt: string, defs?: any) => Promise<any>} inner */
2608
2608
  const withCarry = (inner) => (!carry ? inner : async (/** @type {string} */ prompt, /** @type {any} */ defs) => {
2609
- const text = await carry.beginAsk({ phase, iteration: roundIteration, prompt });
2609
+ // The index is incremental: refreshing it here keeps the function ranges true to the files as they now are.
2610
+ if (phase === 'fix' || phase.startsWith('step:')) { try { if (ctx.length) await lc.index({ yield: true }); } catch { /* ranges are left out */ } }
2611
+ const text = await carry.beginAsk({ phase, iteration: roundIteration, prompt, getNode: (rel) => lc.getNode(rel) });
2610
2612
  try { return await inner(text ? `${prompt}\n\n${text}` : prompt, defs); } finally { carry.endAsk({ bounded: attemptBounded, iteration: roundIteration, rounds: attemptRounds }); }
2611
2613
  });
2612
2614
  // F19 per VERB (P, corrected 2026-07-31): a strategy SENTENCE rides only with
@@ -2706,7 +2708,7 @@ export async function runPlan(job, { workdir, provider, nativeProvider, provider
2706
2708
  }
2707
2709
  return r;
2708
2710
  };
2709
- return { ask: withHandoff(withCarry(ask)), askFrom, workerWrites, writeCount, setIteration, wasBounded: () => attemptBounded };
2711
+ return { ask: withCarry(ask), askFrom, workerWrites, writeCount, setIteration, wasBounded: () => attemptBounded };
2710
2712
  }
2711
2713
 
2712
2714
  // ── LOOP path: the injected provider (anthropic-api and every other
@@ -2980,7 +2982,7 @@ export async function runPlan(job, { workdir, provider, nativeProvider, provider
2980
2982
  }
2981
2983
  return r;
2982
2984
  };
2983
- return { ask: withHandoff(withCarry(ask)), askFrom, workerWrites, writeCount, setIteration, wasBounded: () => attemptBounded };
2985
+ return { ask: withCarry(ask), askFrom, workerWrites, writeCount, setIteration, wasBounded: () => attemptBounded };
2984
2986
  }
2985
2987
 
2986
2988
  /** relay a throw from OUTSIDE ralph (scout/plan drafting/fix) as its honest
@@ -3137,6 +3139,9 @@ export async function runPlan(job, { workdir, provider, nativeProvider, provider
3137
3139
  // handed (a record, never a verdict), so the Audit can show it and the byte check can compare it with a fresh render.
3138
3140
  const hints = learnHints && learnHints.text && (phase === 'draft' || (phase === 'replan' && replans === 1)) ? learnHints : null;
3139
3141
  if (hints) emit('learnings', { phase, text: hints.text, ids: hints.ids, chars: hints.text.length });
3142
+ // The seed note: the planner's FIRST draft only (and its redrafts). A record of counts and names, never the text.
3143
+ const seedNoteForPlanner = seedNote && phase === 'draft' ? seedNote : null;
3144
+ if (seedNoteForPlanner) emit('seed-note', { to: 'planner', chars: seedNoteForPlanner.text.length, stages: seedNoteForPlanner.stages });
3140
3145
  // D5 — the bridge rides into the FIRST draft phase ONLY. A replan drafts from the
3141
3146
  // RUN'S OWN STATE (what failed, what is left): re-handing the recipe there would
3142
3147
  // answer the replan's question with the material the run just demonstrated does not
@@ -3161,7 +3166,7 @@ export async function runPlan(job, { workdir, provider, nativeProvider, provider
3161
3166
  const draftPlan = async (/** @type {any[]|null} */ reds) => {
3162
3167
  drafter.setIteration(reds ? 'redraft' : 'draft');
3163
3168
  replanCut = false;
3164
- const r = await drafter.ask(planPrompt(job, scoutBlob, reds, maxStepRounds, failure, scopeMenu, materials, starting, checkFacts, doorWords?.text ?? null, readShim, hints?.text ?? null), []);
3169
+ const r = await drafter.ask(planPrompt(job, scoutBlob, reds, maxStepRounds, failure, scopeMenu, materials, starting, checkFacts, doorWords?.text ?? null, readShim, hints?.text ?? null, seedNoteForPlanner?.text ?? null), []);
3165
3170
  if (phase === 'replan' && typeof r.error === 'string' && r.error.startsWith('truncated:')) {
3166
3171
  replanCut = true;
3167
3172
  return '';
@@ -3536,6 +3541,8 @@ export async function runPlan(job, { workdir, provider, nativeProvider, provider
3536
3541
  // results makes the leak inexpressible; scrubbing each consumer makes it
3537
3542
  // something the next consumer has to remember.
3538
3543
  const results = raw.map((r) => (typeof r.detail === 'string' ? { ...r, detail: scrub(r.detail) } : r));
3544
+ // the carry note's outcome for this try, from the check itself; a red also hands over the whole failing text, the SAME text the next prompt's gap carries (lastGap below)
3545
+ carry?.settleAsk(results.some((r) => r.fault) ? 'unknown' : pass ? 'green' : 'red', results.filter((r) => !r.pass).map((r) => r.detail).join('\n'));
3539
3546
  // PRD v1.106 Part 5: what the check just read (path, size, sha256 — never the content), recorded BEFORE the exit-eval because the next try
3540
3547
  // overwrites the file. The worker is idle between its turn and this judge, so these are the bytes the check read.
3541
3548
  for (const o of await outputJudgedRecords(job.closeDecl, workdir, step.exit)) emit('output-judged', { step: step.id, iteration: iterationNow, ...o });
@@ -4271,7 +4278,11 @@ export async function runPlan(job, { workdir, provider, nativeProvider, provider
4271
4278
  // two exhaustion rules are alternatives and never both at once, so the count
4272
4279
  // is not passed — it survives only inside the governor, as the bound for the
4273
4280
  // case the trend instrument is blind.
4274
- middle, judge: async () => judgeClose(), ladder: fixGovernor, emit: emitL, redact: scrub,
4281
+ middle, judge: async () => {
4282
+ const v = await judgeClose();
4283
+ carry?.settleAsk(v.verdict === 'satisfied' ? 'green' : v.verdict === 'needs_revision' ? 'red' : 'unknown', v.verdict === 'needs_revision' ? v.gap : undefined); // the fix try's outcome and its whole failing text (the gap the next prompt carries), from the close itself
4284
+ return v;
4285
+ }, ladder: fixGovernor, emit: emitL, redact: scrub,
4275
4286
  closeTimeoutMs, cwd: workdir, workerWrites: w.workerWrites, closeDir, phase: 'fix',
4276
4287
  });
4277
4288
  } catch (e) {
package/src/readshim.js CHANGED
@@ -40,6 +40,7 @@
40
40
 
41
41
  import { createHash } from 'node:crypto';
42
42
  import { readFileSync } from 'node:fs';
43
+ import { relative, resolve, sep } from 'node:path';
43
44
 
44
45
  /** The delivery cap, in bytes. Equal to `NATIVE_READ_CAP` by construction — the
45
46
  * native path's CLI display bound and this cap bound the SAME seam, so one
@@ -324,6 +325,58 @@ const stalePastEofNotice = (path, startLine, endLine, lines, detail) =>
324
325
  /** @typedef {{file: string, path: string, startLine: number, endLine: number, detail: string}} StaleReq */
325
326
  /** @typedef {{text: string, outcome: 'stale-served'|'stale-absent'|'stale-past-eof'}} StaleServe */
326
327
 
328
+ // ── THE FIRST-READ MAP (EXPERIMENTAL, default off; docs/logs/MAP-PREREG.md) ─────────────────────────────────────────
329
+ // With the signed spec field `readMap: true`, the FIRST shell_read of a big non-test file in an ask returns a map (one line
330
+ // per named part: symbol and line range) instead of the file's bytes, so the worker can copy exact `ctx_get` handles instead
331
+ // of computing a range ($0 archive read: 41% of ctx_get calls on a big-file job came back no-chunk). It delivers nothing, so
332
+ // it never touches the delivery ledger: the SECOND read of the same path in the same ask is today's read, whole.
333
+
334
+ /** a file this long (in lines) or longer gets a map on its first read in an ask */
335
+ export const READ_MAP_MIN_LINES = 200;
336
+ /** the map's size bound, in characters (header, parts, `+N more` line and footer together) */
337
+ export const READ_MAP_CAP = 4000;
338
+
339
+ /** a test file: a `test/`, `tests/` or `__tests__/` path segment, or a name `*.test.*` / `*.spec.*` */
340
+ const isTestPath = (/** @type {string} */ rel) => rel.split('/').some((seg, i, a) => (i < a.length - 1 && (seg === 'test' || seg === 'tests' || seg === '__tests__')) || (i === a.length - 1 && /\.(test|spec)\./.test(seg)));
341
+
342
+ /**
343
+ * The map text for one file, from the index's chunks. Pure. A chunk that CONTAINS another named chunk is left out (a class
344
+ * chunk would hand the whole class to `ctx_get`); the rest are listed by start line as `symbol start-end` in the index's own
345
+ * 0-based inclusive line space, the one `ctx_get` takes. Cut to READ_MAP_CAP characters with a `+N more` line.
346
+ * @param {{rel: string, lines: number, chunks: {symbol?: string|null, startLine: number, endLine: number}[]}} o
347
+ * @returns {{text: string, symbols: number}|null} null when the file has no named part
348
+ */
349
+ export function buildReadMap({ rel, lines, chunks }) {
350
+ const named = chunks.filter((c) => typeof c.symbol === 'string' && c.symbol !== '' && Number.isInteger(c.startLine) && Number.isInteger(c.endLine));
351
+ const kept = named
352
+ .filter((c) => !named.some((d) => d !== c && c.startLine <= d.startLine && d.endLine <= c.endLine && (c.startLine !== d.startLine || c.endLine !== d.endLine)))
353
+ .sort((a, b) => a.startLine - b.startLine || a.endLine - b.endLine);
354
+ if (kept.length === 0) return null;
355
+ const head = `${rel} (${lines} lines) — map, not the file:`;
356
+ const foot = `Line numbers are 0-based, as ctx_recall prints them; copy them as printed. Open one part with ctx_get(path="${rel}", startLine=<start>, endLine=<end>) using a range from this list, or read the file again to get the whole file.`;
357
+ const rows = kept.map((c) => `${c.symbol} ${c.startLine}-${c.endLine}`);
358
+ const moreLine = (/** @type {number} */ n) => `+${n} more`;
359
+ let used = head.length + 1 + foot.length;
360
+ const shown = [];
361
+ for (let i = 0; i < rows.length; i++) {
362
+ // room for the `+N more` line is reserved while parts remain after this one
363
+ const reserve = i < rows.length - 1 ? moreLine(rows.length).length + 1 : 0;
364
+ if (used + rows[i].length + 1 + reserve > READ_MAP_CAP) break;
365
+ shown.push(rows[i]);
366
+ used += rows[i].length + 1;
367
+ }
368
+ const cut = rows.length - shown.length;
369
+ const text = [head, ...shown, ...(cut > 0 ? [moreLine(cut)] : []), foot].join('\n');
370
+ return { text, symbols: shown.length };
371
+ }
372
+
373
+ /**
374
+ * @typedef {{root: string, hasGet: boolean, getNode: (rel: string) => any, refresh?: (() => Promise<unknown>)|null, emit: (type: string, data: object) => void}} ReadMapOpts
375
+ * `root`: the job root (paths are made relative to it); `hasGet`: this worker holds `ctx_get` (a map hands out handles only that tool opens);
376
+ * `getNode`: the LiteCtx index's node for a path (its `chunks`); `refresh`: re-index first so the ranges are true to the file as it now is;
377
+ * `emit`: the spine channel, for the report-only `read-map` / `read-map-skip` records (counts and a reason, never text).
378
+ */
379
+
327
380
  /**
328
381
  * Create the shim: one delivery ledger, and the two seams that speak for it.
329
382
  *
@@ -332,7 +385,7 @@ const stalePastEofNotice = (path, startLine, endLine, lines, detail) =>
332
385
  * reference to the ledger — see its own note. Both live in one object because
333
386
  * they are one worker's shim: the read seam and the retrieval seam the cap
334
387
  * steers a capped worker towards.
335
- * @param {{cap?: number, arm?: ReadShimArm, onCount?: ((kind: 'pointered'|'capped', bytesWithheld: number) => void)|null}} [opts]
388
+ * @param {{cap?: number, arm?: ReadShimArm, onCount?: ((kind: 'pointered'|'capped', bytesWithheld: number) => void)|null, readMap?: ReadMapOpts|null}} [opts]
336
389
  * `cap`: delivery bound in bytes (the shipped value is `READ_SHIM_CAP`; the option
337
390
  * exists so the native path can pin the two bounds to one number rather than two
338
391
  * constants drifting apart). `arm`: which levers are live (`readShimArm`). Defaults to
@@ -343,7 +396,10 @@ const stalePastEofNotice = (path, startLine, endLine, lines, detail) =>
343
396
  * for a diff response (L2 is its own lever, uncounted here) or a first read under the
344
397
  * cap (nothing was withheld).
345
398
  */
346
- export function createReadShim({ cap = READ_SHIM_CAP, arm = ARM_ALL, onCount = null } = {}) {
399
+ export function createReadShim({ cap = READ_SHIM_CAP, arm = ARM_ALL, onCount = null, readMap = null } = {}) {
400
+ /** the paths (absolute) this ask has had its map decision for: the second read of one is today's read
401
+ * @type {Set<string>} */
402
+ const mapTried = new Set();
347
403
  /** path → what the worker has been handed of the CURRENT content. `full` is
348
404
  * the delivered text itself, kept ONLY while the worker holds the whole file
349
405
  * (null otherwise) because that is the only state a diff is legal from.
@@ -456,6 +512,38 @@ export function createReadShim({ cap = READ_SHIM_CAP, arm = ARM_ALL, onCount = n
456
512
  * @param {{name: string, execute: (args: any) => Promise<any>}} tool the read tool
457
513
  * @returns {{name: string, execute: (args: any) => Promise<any>}} the same tool
458
514
  */
515
+ /** @param {string} path the path as the worker spelled it @returns {Promise<string|null>} the map text, or null for today's read */
516
+ const firstReadMap = async (path) => {
517
+ const o = /** @type {ReadMapOpts} */ (readMap);
518
+ const abs = resolve(o.root, path);
519
+ if (mapTried.has(abs)) return null;
520
+ mapTried.add(abs);
521
+ const rel = relative(resolve(o.root), abs).split(sep).join('/');
522
+ if (rel === '' || rel.startsWith('..') || isTestPath(rel)) return null;
523
+ let lines;
524
+ try {
525
+ const text = readFileSync(abs, 'utf8');
526
+ lines = text.split('\n').length - (text.endsWith('\n') ? 1 : 0);
527
+ } catch { return null; }
528
+ if (lines < READ_MAP_MIN_LINES) return null;
529
+ /** @param {string} reason */
530
+ const skip = (reason) => { o.emit('read-map-skip', { path: rel, reason }); return null; };
531
+ if (!o.hasGet) return skip('no-ctx_get');
532
+ let chunks;
533
+ try {
534
+ if (o.refresh) await o.refresh();
535
+ chunks = o.getNode(rel)?.chunks;
536
+ } catch { return skip('no-index'); }
537
+ if (!Array.isArray(chunks)) return skip('no-index');
538
+ if (!chunks.some((/** @type {any} */ c) => c?.symbol)) return skip('no-named-chunks');
539
+ // an index older than the file: a named chunk ending past the file's last line
540
+ if (chunks.some((/** @type {any} */ c) => c?.symbol && c.endLine >= lines)) return skip('stale-index');
541
+ const built = buildReadMap({ rel, lines, chunks });
542
+ if (!built) return skip('no-named-chunks');
543
+ o.emit('read-map', { path: rel, lines, symbols: built.symbols, chars: built.text.length });
544
+ return built.text;
545
+ };
546
+
459
547
  const wrapRead = (tool) => {
460
548
  // An OFF arm wraps nothing at all — not a wrapper that passes through, which
461
549
  // would still be a `tool.execute` this module owns. A0 has to be the seam
@@ -471,6 +559,13 @@ export function createReadShim({ cap = READ_SHIM_CAP, arm = ARM_ALL, onCount = n
471
559
  // path nobody ever received bytes for.
472
560
  if (path === null || typeof r !== 'string') return r;
473
561
 
562
+ // THE FIRST-READ MAP (experimental): the first read of a big non-test file in this ask returns the map, delivers nothing, and
563
+ // leaves the ledger untouched; every other read falls through to the code below unchanged.
564
+ if (readMap) {
565
+ const m = await firstReadMap(path);
566
+ if (m !== null) return m;
567
+ }
568
+
474
569
  const buf = Buffer.from(r, 'utf8');
475
570
  const total = buf.length;
476
571
  const hash = createHash('sha256').update(buf).digest('hex');
@@ -569,7 +664,7 @@ export function createReadShim({ cap = READ_SHIM_CAP, arm = ARM_ALL, onCount = n
569
664
  * Not called for a continuation (`askFrom` re-runs the SAME transcript — the model still
570
665
  * holds everything, so its ledger stays true).
571
666
  */
572
- const reset = () => { ledger.clear(); };
667
+ const reset = () => { ledger.clear(); mapTried.clear(); };
573
668
 
574
669
  return { arm, cap, wrapRead, serveStale, summary, reset };
575
670
  }
package/src/run.js CHANGED
@@ -261,9 +261,6 @@ async function primitiveSmoke(workdir) {
261
261
  * round-boundary seam (where the money cap binds) and ends the leg `stopped`. `null` = no stop surface.
262
262
  * @param {{text: string, ids: string[]}|null} [opts.learnHints=null] cross-run learnings for the PLANNER only (the draft and the
263
263
  * first replan); forwarded verbatim to the plan flow, which records what it handed over as a `learnings` spine record.
264
- * @param {boolean} [opts.carryNote=false] THE CARRY NOTE (src/carrynote.js): hand each step/fix worker a facts-only note of what earlier
265
- * workers of this run looked at, searched and changed. The caller reads the one switch (`carryNote` in config.json, src/carrystore.js
266
- * `carryNoteOn`) once; the library default is off, exactly like `learnHints`. Forwarded verbatim to the plan flow.
267
264
  * @returns {Promise<string>} outcome: 'green' | 'already-green' | 'escalated' |
268
265
  * 'unapproved-spec' | 'job-red' | 'smoke-red' | 'plan-red' | 'check-red' |
269
266
  * 'close-red' | 'close-unsupported' | 'recipe-stale' | 'branch-red' | 'pricing-red' | 'provider-red' |
@@ -278,7 +275,7 @@ async function primitiveSmoke(workdir) {
278
275
  * deliberately NOT in the resumable/checkpoint set (`src/reuse.js`) — an
279
276
  * unknown in-flight state is not a known-safe resume point.
280
277
  */
281
- export async function runJob(rawSpec, { approvals, workdir, provider, nativeProvider, providerFor, judgeProvider = null, judgeModel = null, rates = null, judgeRates = null, emit, capRuns = 3, strikeLimit, shellCapUsd = 2, closeTimeoutMs, closeDir = null, layerRoot = false, readShim = false, scout = true, bridge = null, draftSpentUsd = 0, draftSpendComplete = true, priorSpentUsd = 0, priorSpendComplete = true, priorWallMs = 0, resumeSeed = null, resumeGrades = [], resumeReplans = null, resumeBranch = null, humanRuling = null, heldRuling = null, reviewDoor = null, doorRerun = null, resumable = true, stopFile = null, learnHints = null, carryNote = false }) {
278
+ export async function runJob(rawSpec, { approvals, workdir, provider, nativeProvider, providerFor, judgeProvider = null, judgeModel = null, rates = null, judgeRates = null, emit, capRuns = 3, strikeLimit, shellCapUsd = 2, closeTimeoutMs, closeDir = null, layerRoot = false, readShim = false, scout = true, bridge = null, draftSpentUsd = 0, draftSpendComplete = true, priorSpentUsd = 0, priorSpendComplete = true, priorWallMs = 0, resumeSeed = null, resumeGrades = [], resumeReplans = null, resumeBranch = null, humanRuling = null, heldRuling = null, reviewDoor = null, doorRerun = null, resumable = true, stopFile = null, learnHints = null }) {
282
279
  // THE READ SHIM's ARM, resolved at the door — the FIRST thing this entry does,
283
280
  // before the ledger, before the approval gate, before a byte of the spec is read.
284
281
  // An unrecognised spelling throws here at zero cost instead of being coerced by
@@ -545,7 +542,7 @@ export async function runJob(rawSpec, { approvals, workdir, provider, nativeProv
545
542
  // accounts it natively (F12) and the job-end money contract is unchanged.
546
543
  {
547
544
  const outcome = await runPlan(job, {
548
- workdir, provider, nativeProvider, providerFor, judgeProvider, judgeModel, rates, judgeRates, emit: meter, capRuns, ...(strikeLimit !== undefined ? { strikeLimit } : {}), closeTimeoutMs, closeDir, layerRoot, readShim, scout, bridge, priorWallMs: chainWallMs, resumeSeed, resumeGrades, resumeReplans, resumeBranch, humanRuling, heldRuling, reviewDoor, doorRerun, priorSpentUsd: chainFoldUsd, resumable, stopFile, learnHints, carryNote,
545
+ workdir, provider, nativeProvider, providerFor, judgeProvider, judgeModel, rates, judgeRates, emit: meter, capRuns, ...(strikeLimit !== undefined ? { strikeLimit } : {}), closeTimeoutMs, closeDir, layerRoot, readShim, scout, bridge, priorWallMs: chainWallMs, resumeSeed, resumeGrades, resumeReplans, resumeBranch, humanRuling, heldRuling, reviewDoor, doorRerun, priorSpentUsd: chainFoldUsd, resumable, stopFile, learnHints,
549
546
  // hamr's ruling 2026-09-28 — ONE cap covers drafting + run: the run's
550
547
  // enforced ceiling is the signed `budgetUsd` (unchanged, still in the
551
548
  // spec hash) MINUS whatever drafting already spent on this job before
@@ -0,0 +1,28 @@
1
+ // THE SEED NOTE (default ON; docs/logs/SEEDGAP-PREREG.md): what the job's own check said on the untouched tree.
2
+ // Built by code from the preflight's own stage results — no extra close run, no model call, no verdict change. Read-only text for the
3
+ // planner's first draft; every step/fix worker gets it through the carry memo's "Earlier failures (folded):" section, labelled `at start`
4
+ // (src/carrystore.js `setStartFailure`). The switch is the signed spec's `seedNote` (absent = on, only `false` turns it off).
5
+ // Only a count-not-worse stage red at seed qualifies: a command-exit gap is capped noise that cannot carry the failure, and
6
+ // changed-from-seed is the "nothing changed yet" fact every run starts with. The stage text is passed as the stage rendered it, masked.
7
+
8
+ export const SEED_NOTE_HEADING = "At start, the job's own check said:";
9
+ /** the one stage kind whose text qualifies */
10
+ export const SEED_NOTE_KIND = 'count-not-worse';
11
+
12
+ /**
13
+ * @param {{stage: string|null|undefined, kind: string|null|undefined, gap: string|null|undefined}[]} reds one entry per preflight verdict
14
+ * that was RED at seed (stage = the stage that rendered it, kind = that stage's declared kind, gap = the verdict's gap text)
15
+ * @param {(s: string) => string} scrub the run's secret mask
16
+ * @returns {{ text: string, body: string, stages: string[] }|null} null when no qualifying stage was red (nothing to say)
17
+ */
18
+ export function buildSeedNote(reds, scrub) {
19
+ /** @type {Map<string, string>} */
20
+ const kept = new Map();
21
+ for (const r of reds) {
22
+ if (r.kind !== SEED_NOTE_KIND || typeof r.stage !== 'string' || typeof r.gap !== 'string' || !r.gap.trim()) continue;
23
+ if (!kept.has(r.stage)) kept.set(r.stage, scrub(r.gap));
24
+ }
25
+ if (kept.size === 0) return null;
26
+ const body = [...kept.values()].join('\n');
27
+ return { text: `${SEED_NOTE_HEADING}\n${body}`, body, stages: [...kept.keys()] };
28
+ }
package/src/userrun.js CHANGED
@@ -83,7 +83,6 @@ import { parseJsonl } from './replayio.js';
83
83
  import { claimRun, monthlyRefusalText, legSpend, chainSpend } from './monthly.js';
84
84
  import { ConfigError } from './config.js';
85
85
  import { learnAtRunEnd, handedHints, releaseRun } from './learnstore.js';
86
- import { carryNoteOn } from './carrystore.js';
87
86
  import { commandFor } from './invoke.js';
88
87
  import { judgeRatesFor, keyNameFor, keyValueOf, priceReadout, ratesFor, ratesOfLine, resolveWorker, judgeRowFor, rowsForHome, REFUSE_NAME_MODEL } from './providerrows.js';
89
88
  // the banner's wall arithmetic, extracted so it is reachable by a test (F83): the
@@ -1917,8 +1916,6 @@ async function execute(ctx) {
1917
1916
  outcome = await runJob(spec, {
1918
1917
  stopFile,
1919
1918
  ...(learnHints === null ? {} : { learnHints }),
1920
- // the carry note's one switch, read once here exactly like `learningHints` above (absent = on, only `false` turns it off)
1921
- carryNote: cfgOn && carryNoteOn(cfgHome),
1922
1919
  // PRD item 27/M3 — the SAME `emit` the pre-run close-timing reading above
1923
1920
  // used (never a second `makeSpine(spineFile)` here: two independent
1924
1921
  // emitters against one file would both start their seq counter at 0 and
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Is this repo-relative path off limits to the memo: outside the job root, an arbiter book (the one list,
3
+ * `isArbiterBook`: .smoke — spine, attempt-diff, bridges — .litectx, the gate audit), or inside `.git` / `.bareloop`.
4
+ * @param {string} rel
5
+ */
6
+ export function isCarryExcluded(rel: string): boolean;
1
7
  /**
2
8
  * One record per tool call (no content, no worker words).
3
9
  * @typedef {object} Ev
@@ -46,7 +52,8 @@ export function mergeRanges(rs: any): string[];
46
52
  * Render the carry note. PURE.
47
53
  * @param {{lastTry?: {step:string|null, kind:'step'|'fix', n:number|string|undefined, of?:number, ended:string, changed:string[]}|null,
48
54
  * lastCheck?: string|null, events: Ev[], edits?: {path:string, lines:number, hunks:string[]}[],
49
- * earlier?: string[], lastAsk?: number}} notes
55
+ * earlier?: string[], failures?: {label:string, text:string}[], lastAsk?: number,
56
+ * fnRanges?: Record<string, string>}} notes `fnRanges`: path to its function line ranges (`a 1-5, b 7-9`), made by the store from the index
50
57
  * @param {number} [cap]
51
58
  */
52
59
  export function render(notes: {
@@ -66,7 +73,12 @@ export function render(notes: {
66
73
  hunks: string[];
67
74
  }[];
68
75
  earlier?: string[];
76
+ failures?: {
77
+ label: string;
78
+ text: string;
79
+ }[];
69
80
  lastAsk?: number;
81
+ fnRanges?: Record<string, string>;
70
82
  }, cap?: number): {
71
83
  text: string;
72
84
  capped: boolean;
@@ -80,9 +92,10 @@ export function render(notes: {
80
92
  searches: number;
81
93
  edits: number;
82
94
  earlier: number;
95
+ failures: number;
83
96
  };
84
97
  };
85
- export const CAP: 3000;
98
+ export const CAP: 12000;
86
99
  export const HUNK_LINES: 40;
87
100
  export const HUNK_SHOW: 12;
88
101
  export const GAP_LINES: 8;
@@ -131,4 +144,8 @@ export type Entry = {
131
144
  * index of the newest call
132
145
  */
133
146
  recency: number;
147
+ /**
148
+ * the file's function line ranges (` · functions: a 1-5, b 7-9`), the FIRST thing the cap drops
149
+ */
150
+ fn?: string | undefined;
134
151
  };
@@ -1,10 +1,3 @@
1
- /**
2
- * The ONE setting: `carryNote` in config.json, read exactly like `learningHints` (src/learnstore.js `learningHintsOn`).
3
- * Absent = on; only an explicit `false` turns it off. An unreadable config reads as OFF (the safe side).
4
- * @param {string} [home]
5
- * @returns {boolean}
6
- */
7
- export function carryNoteOn(home?: string): boolean;
8
1
  /**
9
2
  * The run's edits from the working tree against the start commit: tracked (git diff) plus untracked (no diff exists).
10
3
  * Arbiter books / .git / .bareloop are excluded. Never throws; [] on any git failure.
@@ -42,11 +35,13 @@ export function createCarryStore({ workdir, emit, strikeLimit, resume }: {
42
35
  name: string;
43
36
  execute: Function;
44
37
  }[]) => void;
45
- beginAsk: ({ phase, iteration, prompt }: {
38
+ beginAsk: ({ phase, iteration, prompt, getNode }: {
46
39
  phase: string;
47
40
  iteration: number | string | undefined;
48
41
  prompt: string;
42
+ getNode?: (rel: string) => any;
49
43
  }) => Promise<string>;
44
+ setStartFailure: (text: string) => void;
50
45
  endAsk: ({ bounded, iteration, rounds }: {
51
46
  bounded?: {
52
47
  iteration: any;
@@ -55,6 +50,7 @@ export function createCarryStore({ workdir, emit, strikeLimit, resume }: {
55
50
  iteration: any;
56
51
  rounds: number;
57
52
  }) => void;
53
+ settleAsk: (result: "green" | "red" | "unknown", text?: string) => void;
58
54
  setBase: (b: string | null | undefined) => void;
59
55
  loaded: () => boolean;
60
56
  _state: () => {
@@ -65,5 +61,5 @@ export function createCarryStore({ workdir, emit, strikeLimit, resume }: {
65
61
  };
66
62
  };
67
63
  export const CARRY_DIR: "carry";
68
- /** the next prompt of a retried step / fix try carries this when the previous ask's check failed */
64
+ /** the retry marker the next prompt of a retried step / fix try carries; kept as a pinned fact about the prompts, no longer read to decide an outcome */
69
65
  export const RED_MARKER: RegExp;
package/types/config.d.ts CHANGED
@@ -36,10 +36,10 @@ export function modelsProblem(list: unknown): string | null;
36
36
  * `keys` merges per key variable name, then per field; `models.<ENV>` is REPLACED WHOLE (`null`
37
37
  * clears it). Validated before anything is written; nothing is written on a refusal.
38
38
  *
39
- * Patch fields understood: `monthlyLimitUsd` (finite > 0), `learningHints` (true | false), `carryNote` (true | false), `keys.<ENV>.{shape,baseUrl,legacyMaxTokens}`,
39
+ * Patch fields understood: `monthlyLimitUsd` (finite > 0), `learningHints` (true | false), `keys.<ENV>.{shape,baseUrl,legacyMaxTokens}`,
40
40
  * `models.<ENV>` (a list judged by {@link modelsProblem}). The first write of a row's `models` list
41
41
  * removes that row's older `name` / `priceInPerM` / `priceOutPerM` in the SAME write (never two
42
- * sources); a retired top-level `anthropicBalanceNote` is dropped on any write. Any other field is
42
+ * sources); the retired top-level `anthropicBalanceNote` and `carryNote` (the carry memo is always on, 2026-11-01) are dropped on any write. Any other field is
43
43
  * kept, but the whole document is swept for secret-shaped strings first.
44
44
  * @param {Record<string, any>} patch
45
45
  * @param {{ home?: string }} [opts]
@@ -151,6 +151,7 @@ export function boundedNote(bounded: {
151
151
  * byte-identically to the pre-shim prompt.
152
152
  * @param {string|null} [hints] the cross-run learnings block (src/learn.js `renderHints`), verbatim; null/empty
153
153
  * renders byte-identically to the prompt without it. Only ever passed for the draft and the first replan.
154
+ * @param {string|null} [seedNote] the seed note (src/seednote.js), verbatim, after the hints; null/empty renders byte-identically to the prompt without it. First draft only.
154
155
  */
155
156
  export function planPrompt(job: any, scoutBlob: string, reds: any[] | null, maxStepRounds: number, failure: string | null, scopes: string[] | undefined, materials?: {
156
157
  balanceUsd?: number | null;
@@ -159,7 +160,7 @@ export function planPrompt(job: any, scoutBlob: string, reds: any[] | null, maxS
159
160
  }, startingDraft?: object | null, checkFacts?: {
160
161
  seedRed?: string[];
161
162
  priorChecks?: string[];
162
- }, doorNote?: string | null, readShim?: boolean | "cap" | "diff", hints?: string | null): string;
163
+ }, doorNote?: string | null, readShim?: boolean | "cap" | "diff", hints?: string | null, seedNote?: string | null): string;
163
164
  /**
164
165
  * Execute a validateJob-GREEN plan-shape job (goal/verdictType/close).
165
166
  * Called by runJob after the approval gate, validation, and the smoke — this
@@ -408,15 +409,12 @@ export function planPrompt(job: any, scoutBlob: string, reds: any[] | null, maxS
408
409
  * run start from the ledger as it stood). Handed to the PLANNER only: the first draft and the FIRST replan. No worker ever
409
410
  * receives it, and a later replan gets nothing. Each injection is recorded on the spine as a `learnings` record (the exact
410
411
  * text) so the Audit can show it and the byte check can compare it with a fresh render. `null` = no hints (the default).
411
- * @param {boolean} [opts.carryNote=false] THE CARRY NOTE (src/carrynote.js): the step/fix worker is handed a facts-only note of what earlier
412
- * workers of this run looked at, searched and changed, after the handoff note. The caller reads the switch once; `false` builds no store
413
- * and leaves the worker prompt byte-identical. One `carry-note` spine record (counts only) per note handed.
414
412
  * @returns {Promise<string>} 'green' | 'already-green' | 'escalated' | 'plan-red' |
415
413
  * 'check-red' | 'close-red' | 'close-unsupported' | 'recipe-stale' | 'pricing-red' |
416
414
  * 'branch-red' | 'cap-halt' | 'wall-halt' | 'stopped' | 'provider-red' | 'interpreter-red' |
417
415
  * 'step-stalled' | 'hitl-pause' | 'hitl-decision-red' | `step-red:<id>`
418
416
  */
419
- export function runPlan(job: any, { workdir, provider, nativeProvider, providerFor, judgeProvider, judgeModel, rates, judgeRates, emit, remainingUsd, isUnpriced, spendComplete, capRuns, strikeLimit, closeTimeoutMs, closeDir, maxStepRounds, layerRoot, readShim, scout, scoutRounds, bridge, now, priorWallMs, resumeSeed, resumeGrades, resumeReplans, resumeBranch, humanRuling, heldRuling, priorSpentUsd, reviewDoor, doorRerun, resumable, stopFile, learnHints, carryNote }: {
417
+ export function runPlan(job: any, { workdir, provider, nativeProvider, providerFor, judgeProvider, judgeModel, rates, judgeRates, emit, remainingUsd, isUnpriced, spendComplete, capRuns, strikeLimit, closeTimeoutMs, closeDir, maxStepRounds, layerRoot, readShim, scout, scoutRounds, bridge, now, priorWallMs, resumeSeed, resumeGrades, resumeReplans, resumeBranch, humanRuling, heldRuling, priorSpentUsd, reviewDoor, doorRerun, resumable, stopFile, learnHints }: {
420
418
  workdir: string;
421
419
  provider: any;
422
420
  nativeProvider?: ((o: {
@@ -484,7 +482,6 @@ export function runPlan(job: any, { workdir, provider, nativeProvider, providerF
484
482
  text: string;
485
483
  ids: string[];
486
484
  } | null | undefined;
487
- carryNote?: boolean | undefined;
488
485
  }): Promise<string>;
489
486
  export { rateSourceFields };
490
487
  /**