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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,25 @@ All notable changes to bareloop are documented here. Format:
5
5
  [SemVer](https://semver.org/spec/v2.0.0.html). Pre-1.0: **minor** = a ladder rung or
6
6
  feature lands, **patch** = docs, fixes, scaffolding.
7
7
 
8
+ ## [0.53.0] - 2026-11-02
9
+
10
+ ### Added
11
+
12
+ - **EXPERIMENTAL, default off: a first-read map (`readMap`, docs/logs/MAP-PREREG.md).** With the signed spec field `readMap: true`, the first `shell_read` of a 200+ line non-test file in an ask returns a map of its named parts (`symbol start-end`, openable with `ctx_get`) instead of file bytes; the second read of that path is today's read, and the file is never marked delivered by the map. No `ctx_get` in the step's grant, no index or no named chunk: today's read plus a report-only `read-map-skip` record. One report-only `read-map` spine record per map. Absent = off and byte-identical; the switch enters the signed hash only when present. Not proven: the pre-registered battery decides. Tested 2026-10-31: FAIL, stays off (F263).
13
+
14
+ ### Changed
15
+
16
+ - **The carry memo is always on: no switch (hamr 2026-11-01).** The `carryNote` key in `config.json` is retired (ignored on read, dropped on any config write), a job spec's `handoffNote` is still accepted and hashed (old signed specs verify) but has no effect, and `runJob`/`runPlan` no longer take a `carryNote` option. A live OLD-vs-NEW check of the fold on one job found no regression (F264).
17
+ - **The handoff note is folded into the carry memo.** One block (the memo's files-read lines now carry the function line ranges, dropped first at the cap) (the switch this fold left behind, `carryNote`, was removed the next day: see above); a job spec's `handoffNote` is legacy; the `handoff-note` spine record is no longer written (old spines replay unchanged).
18
+
19
+ - **Seed note ON by default, part of the carry-over memory (`seedNote`, F262, docs/logs/SEEDGAP-PREREG.md).** The planner's first draft (its own block) and, through the carry memo's "Earlier failures (folded):" section labelled `at start`, every step and fix worker are told, read-only, what the job's own `count-not-worse` check said on the untouched tree ("At start, the job's own check said:" plus that stage's text, secret-masked). Absent = on; `seedNote: false` turns it off and is byte-identical to before; the switch enters the signed hash only when present, so old signed jobs get it with no re-sign. Result: on the big-file job 3 of 3 ON runs wrote to the culprit file vs 1 of 3 OFF (n=3, one job, one patient; carry note on in all six). The battery tested planner + first worker of step 1; the shipped delivery to workers is the memo (every worker; seen live once, run u-mvwok8nk, all 4 memos carried it).
20
+
21
+ - **The carry note is bigger and says more about failures (F261).** Its cap rises from 3,000 to 12,000 characters (7 of 8 notes in a live run were capped). Each try line now says how the try ended and what its check said ("Ran out of calls (24 of 24). Its check failed."; "Check not run." when no check ran). A new "Earlier failures (folded):" section, after "Earlier tries (folded):", carries each failed check's whole text (secrets masked, kept in `state.json` so a resume has it), folded by the learnings rule with the newest member shown; the last try's failure is left out only when that try failed (its retry prompt already carries it); a failure from a try that was later passed stays. Over the cap the order is files, searches, earlier tries, earlier failures (oldest group first), then diff hunks. The `carry-note` spine record's `sections` gains a `failures` count.
22
+
23
+ ### Fixed
24
+
25
+ - **The carry note no longer says an earlier try's check passed when it failed or never ran.** A try's outcome was guessed from whether the NEXT prompt carried the retry marker, so a step's last red try followed by a replan or a new step (no marker) read "Its check passed." The engine now hands the store the check result it already knows (green, red, or unknown on an instrument fault) as each try is judged; a try with no result says "No check result was recorded for it." Note shape and the OFF path are unchanged.
26
+
8
27
  ## [0.52.0] - 2026-10-30
9
28
 
10
29
  ### Added
@@ -159,7 +159,9 @@ minting claim, or the shell-owned retry cap — all unknown-field reds.
159
159
  | `closeTimeoutMs` | optional integer ms `>= CLOSE_TIMEOUT_FLOOR_MS` (120,000 — hamr's arbiter floor, 2026-09-07) | PRD item 27/M3's SIGNED override for the close's own per-stage wall-clock cap. Absent (the normal case): the run autosets it from a $0 seed timing pass — `max(FLOOR, K × slowest measured stage)`, `K = 5` (hamr, 2026-09-07: "2 and 5 are fine"). Present: the operator's own number wins outright and may legally sit ABOVE *or below* the autoset estimate (the rates-passthrough shape, F113 — never tighten-only). Arbiter territory exactly like `budgetUsd`/`maxWallMs`/`close[].sha256`: the authoring pipeline's `assembleSpec` refuses a draft carrying it |
160
160
  | `model` | optional non-empty string, the exact model id of a line ticked in Settings > Providers | the WORKER's model. A job carries its own model (P8: bareloop has no default); a spec signed before that (no `model`, perhaps no `baseUrl`) runs on the line `--model <id>` names (plus `--provider <KEY>` when two keys tick it) — the signed hash is untouched. Present, it wins over a `--model` flag outright, and a flag naming a different id is refused (`resolveWorkerModel`, `src/job.js`) rather than silently overridden. Part of the signed hash like every other field. Worker only — the JUDGE's model comes from the `judge` row below, which DEFAULTS to this same worker model |
161
161
  | `thinking` | optional boolean | the job's "Thinking on" tick (P8): absent = off, and an old spec keeps the hash it always had; present it is signed like `model`. Covers DRAFTING and the rubric JUDGE, and makes every WORKER call think (see "Thinking on" below) |
162
- | `handoffNote` | optional boolean | the handoff note switch: absent = ON, only an explicit `false` turns it off; an old spec keeps the hash it always had, and a present value is signed (the switch enters `jobSpecHash` and `workflowKey`; the note's text never does). Not shown in the panel. See "Handoff note" below |
162
+ | `handoffNote` | optional boolean | LEGACY and IGNORED (the handoff note was folded into the carry memo, which is always on): either value has no effect. Still accepted and signed so an old spec keeps its hash; new drafts never write it. Not shown in the panel. See "Carry note" below |
163
+ | `seedNote` | optional boolean | Default ON (part of the carry-over memory): absent = on, only `false` turns it off; on, it hands the planner's first draft (its own block) and, through the carry memo's "Earlier failures (folded):" section labelled `at start`, every step/fix worker what the job's own `count-not-worse` check said on the untouched tree (see "Seed note" below). An old spec keeps the hash it always had; a present value is signed (the switch enters `jobSpecHash` and `workflowKey`; the text never does). Not shown in the panel |
164
+ | `readMap` | optional boolean | EXPERIMENTAL, default OFF: absent = off, `true` makes the FIRST `shell_read` of a file of 200+ lines (not a test file) in an ask return a map of the file's named parts instead of its bytes; the second read of that path in the ask is today's read (see "First-read map" below). Only `true`/`false` are legal (anything else is an `invalid-value` red). An old spec keeps the hash it always had; a present value is signed. Not shown in the panel |
163
165
  | `judge` | optional `{provider, model}`, both non-empty; `provider` from the `PROVIDERS` menu | the signed JUDGE override (PRD item 32). Absent, the judge resolves to this job's own `provider`/`model` (`resolveJudge`) — which is what lets a non-Anthropic job judge without a second account. Present, it pins a judge deliberately different from the worker (an independent reader). Both halves are required together: a judge with a provider and no model is an identity nobody signed. Part of the signed hash, so changing it kills the signature and forces recalibration. Unknown nested keys red — no smuggling level exists in a signed spec. The drafting agent cannot express it: naming your own examiner is arbiter territory |
164
166
  | `writeScope` | array of contained globs | the operator's outer fence; the plan's own scopes must fit inside it, same containment code |
165
167
  | `steps` | RETIRED | operator-authored `steps[]` was deleted (PRD v1.32); a spec carrying it reds `shape-retired:steps` by name rather than half-running |
@@ -645,9 +647,12 @@ plan with the first leg's spend carried as prior spend and `offerQuestions: fals
645
647
  plan's open questions) are a separate, unchanged mechanism: they are asked before drafting, about the plan; try-3 questions
646
648
  are asked after two failed drafts, about a job line.
647
649
 
648
- **Handoff note (per job; hamr 2026-10-28, F253).** When a worker's ask ends, code records the files it READ (the allowed `shell_read` and `ctx_get` calls; scout, step and fix asks all feed it). The NEXT step or fix ask of the same run, a retry of the same step included, gets a note appended to its first user prompt under the fixed heading `== Files earlier workers in this run read (a map only; contents are not included; line ranges as ctx_recall prints them) ==`, one line per file: `- <path> (<N> lines): <symbol> <a>-<b>, ...`. Code writes it, never a model; it names files and carries no content. The symbol map is the LiteCtx index's named chunks, refreshed before the note is built when the worker holds a retrieval verb, and dropped for a plain line count when the index is missing (LiteCtx indexes git-tracked files only) or older than the file. The scout and the drafter are never handed a note. Capped at 8,000 characters (`HANDOFF_CAP`, src/handoff.js): the oldest paths go first with a `[trimmed: N older path(s)]` marker. The arbiter's books (`.smoke`, `.litectx`, the gate audit), `.git`, `.bareloop` and anything outside the job root are never named. The store lives in memory for one leg: a resumed leg starts empty, so its first ask gets no note and later ones do. Each note given is one report-only spine record `{type:'handoff-note', phase, iteration, chars, paths}` (a path COUNT, never a name; catalogue entry `handoff-note` under the spine records). Switch: the signed spec's optional boolean `handoffNote`, absent = on, `false` = off (no note, no record).
649
650
 
650
- **Carry note (hamr 2026-10-30, M1, F258).** A second note, written by code from the run's own record and appended AFTER the handoff note to the first prompt of every step and fix ask that has something to say (never the scout or the drafter, and not the first ask of a run). It carries facts only, never file content and never a worker's own words, and secrets are masked by the one secret-shape inventory. Under the fixed heading `== What earlier workers in this run did (facts from the record, written by code) ==`: how the last try ended and what it changed; where earlier workers looked (path, line count, times read, line ranges; listings, manifests, docs and config reads are counted in one line, not shown; a file read 3 or more times in a try that ended red with no change carries ` · looked here, no fix made`); searches and what they matched; the edits made in the run (per file, changed-line count and diff hunks, taken from the working tree against the run's start commit, never from the spine); earlier tries folded to one line each. Repeats fold by the learnings Jaccard rule or a shared 6-character prefix. Capped at 3,000 characters, cut in this order: file lines (edited files last), search lines, earlier tries, then diff hunks one edit at a time, oldest edit first (to 12 lines, then to none), the newest edit's hunk last. The state lives in `<workdir>/.smoke/carry/state.json` (an arbiter book the worker's `fs.deny` covers) and a resumed leg loads it. Each note given is one report-only spine record `{type:'carry-note', phase, iteration, chars, capped, sections:{reads,searches,edits,earlier}}` (counts only). Switch: `carryNote` in `config.json`, read once per run exactly like `learningHints`: absent = on, only an explicit `false` turns it off, an unreadable config reads off; off builds no store, writes no state and emits no record, and the worker prompt is the handoff-note-only prompt byte for byte. Library callers of `runJob`/`runPlan` get it only with `carryNote: true` (default off); the shared engine (`src/userrun.js`: panel, CLI and bundle runner) reads the config switch.
651
+ **Seed note (default ON; docs/logs/SEEDGAP-PREREG.md).** Code writes, from the preflight's own stage results (no extra close run, no model call, no verdict change), a block headed `At start, the job's own check said:` followed by the gap text of each close stage that was red at seed AND is a `count-not-worse` stage (the stage's declared kind, never its name; a command close has none). `command-exit` text (capped, cannot carry the failure) and `changed-from-seed` text are never used. The text is passed as the stage rendered it, run through the one secret mask. It goes to the planner's first draft (after the hints, before the survey) as its own block, and to EVERY step and fix worker as the oldest entry of the carry memo's "Earlier failures (folded):" section, labelled `at start` (persisted in the carry state, so a resume keeps it; the memo's "leave out the last try's failure" rule never applies to it because it is never in a prompt gap; it folds with a later identical failure by the usual rule, labelled `at start` only when it is the newest member). Never the scout. **Delivery changed AFTER the battery:** the pre-registered battery tested planner + first worker of step 1 (hand-delivered block); what ships is planner + the memo to every worker; the memo form was seen live once (F262, run u-mvwok8nk, 2026-10-31: all four workers carried the `at start` entry). No qualifying stage red at seed = no block, no record. Switch: the signed spec's optional boolean `seedNote`, absent = on, `false` = off; OFF is byte-identical to a build without the feature. The planner use is one report-only spine record (catalogue entry `seed-note`); the worker side is counted in the `carry-note` record's `sections.failures`. The planted-marker (culprit-leak) scan of the prereg is an experiment-side check, not product code.
652
+
653
+ **First-read map (EXPERIMENTAL, default off; docs/logs/MAP-PREREG.md).** With `readMap: true` the read shim answers the FIRST `shell_read` of a file in an ask with a map, not the file: header `<path> (<N> lines) — map, not the file:`, one line per named chunk of the LiteCtx index as `symbol start-end` (0-based inclusive, the space `ctx_get` takes; a chunk that contains another named chunk is left out), and a footer saying how to open a part with `ctx_get` or read again for the whole file. Capped at 4,000 characters with a `+N more` line. Only files of 200+ lines that are not test files (`test/`, `tests/`, `__tests__/` segment or `*.test.*`/`*.spec.*` name). The map delivers nothing, so the shim never marks the file delivered; the second read of the same path in the same ask (a new ask resets) is today's read, paged as before. No map, today's read plus a report-only `read-map-skip` record, when: the worker's step lacks `ctx_get` (`no-ctx_get`), the read shim is off (`shim-off`), the file has no index node (`no-index`) or no named chunk (`no-named-chunks`), or the index is older than the file (`stale-index`). The index is built at run start when the switch is on. Off is byte-identical to a build without it.
654
+
655
+ **Carry note (hamr 2026-10-30, M1, F258).** The one note (the former separate handoff note is folded in, 2026-10-31), written by code from the run's own record and appended to the first prompt of every step and fix ask that has something to say (never the scout or the drafter; the first step ask of a run has something to say only when the seed note found a start failure, which rides in as the `at start` entry). It carries facts only, never file content and never a worker's own words, and secrets are masked by the one secret-shape inventory. Under the fixed heading `== What earlier workers in this run did (facts from the record, written by code) ==`: how the last try ended (the bound, if any, then its check result: "Its check failed.", "Its check passed.", "Check not run.") and what it changed; where earlier workers looked (path, line count, times read, line ranges, and ` · functions: <name> <a>-<b>, ...` from the LiteCtx index's named chunks, kept only while the index is fresh for that file, refreshed before each note; 500 characters per file; listings, manifests, docs and config reads are counted in one line, not shown; a file read 3 or more times in a try that ended red with no change carries ` · looked here, no fix made`); searches and what they matched; the edits made in the run (per file, changed-line count and diff hunks, taken from the working tree against the run's start commit, never from the spine); earlier tries folded to one line each, then `Earlier failures (folded):` (each earlier failed check's whole text, masked, indented 4 spaces under `- step "x" try 1 · N similar:`; the last try's failure is left out only when that try failed, since its retry prompt carries it; a failure from a try that was later passed stays). Repeats fold by the learnings Jaccard rule or a shared 6-character prefix. Capped at 12,000 characters (`CAP`, src/carrynote.js), cut in this order: the function ranges on every file line first, then file lines (edited files last), search lines, earlier tries, earlier failures (oldest group first, whole group), then diff hunks one edit at a time, oldest edit first (to 12 lines, then to none), the newest edit's hunk last. The state lives in `<workdir>/.smoke/carry/state.json` (an arbiter book the worker's `fs.deny` covers) and a resumed leg loads it. Each note given is one report-only spine record `{type:'carry-note', phase, iteration, chars, capped, sections:{reads,searches,edits,earlier,failures}}` (counts only). Always on, no switch (hamr 2026-11-01): the `carryNote` key in `config.json` is retired (ignored on read, dropped on any config write), a job spec's `handoffNote` is accepted and hashed but has no effect, and `runJob`/`runPlan` take no `carryNote` option; every run builds the store, writes its state and emits its records.
651
656
 
652
657
  **Thinking on (per job; hamr 2026-10-11).** The New job card has a "Thinking on" tick under Model, unticked by default, saved in the SIGNED job as the optional
653
658
  boolean `thinking` (absent = off; an old spec and any unticked job keep the hash they would have had; a ticked job's `jobSpecHash` and `workflowKey` differ). It
@@ -2744,19 +2749,23 @@ unreferenced loose objects are left. Gitignored files inside the fence are seen
2744
2749
  changed nothing in scope emits nothing, and a failed capture emits `gitError` with empty lists: a record,
2745
2750
  never a verdict, and it never throws. No prompt carries it; the learnings cards read it ("What changed").
2746
2751
 
2747
- #### `handoff-note` — a note handed to a worker ask (`src/handoff.js`, `src/planrun.js`)
2752
+ #### `handoff-note` — LEGACY, no longer written (the handoff note was folded into the carry memo)
2753
+
2754
+ Old spines carry `{type:'handoff-note', phase, iteration, chars, paths}` records; nothing in the library reads them (replay, the Audit and the analysis ignore the type), so old runs replay unchanged. A new run writes a `carry-note` record instead (below).
2755
+
2756
+ #### `seed-note` — the seed note handed to the planner (the worker side is the carry memo) (`src/seednote.js`, `src/planrun.js`)
2757
+
2758
+ One report-only spine record per use: `{type:'seed-note', to, chars, stages}`. `to` is `'planner'` (the first draft, once; the worker side is the `carry-note` record's `sections.failures`); `chars` is the block's length; `stages` is the list of stage NAMES whose
2759
+ text it carries. Counts and names only, never the text. No cost fields, no verdict. Written only when the signed spec's
2760
+ `seedNote` is not `false` and a `count-not-worse` stage was red at seed. The prose rules are under "Seed note".
2761
+
2762
+ #### `read-map` and `read-map-skip` — the first-read map (`src/readshim.js`, `src/planrun.js`)
2748
2763
 
2749
- One report-only spine record per handoff note given: `{type:'handoff-note', phase, iteration, chars, paths}`.
2750
- `phase` is `step:<id>` or `fix`; `iteration` is the round iteration at the ask; `chars` is the note's length in
2751
- characters (at most 8,000); `paths` is a COUNT of the files the note lists after any trimming, never a name.
2752
- `runPlan` writes it right before the ask runs, once per step or close-fix ask that actually receives a note: an
2753
- ask with nothing yet read gets no note and no record, and the scout and the drafter are never handed one. It
2754
- carries no cost fields (not a spend record) and no verdict. The switch is the signed spec's optional boolean
2755
- `handoffNote`: absent = on, `false` = off (no note, no record). The prose rules are under "Handoff note".
2764
+ Report-only, counts and a reason, never text, no cost fields, not rounds (spend and analysis readers ignore them). `{type:'read-map', path, lines, symbols, chars}` is one per map served; `{type:'read-map-skip', path, reason}` is one per fallback (`reason` as listed under "First-read map"; the run-level `shim-off` skip carries no `path`). Written only when the signed spec's `readMap` is `true`.
2756
2765
 
2757
2766
  #### `carry-note` — a carry note handed to a worker ask (`src/carrystore.js`, `src/planrun.js`)
2758
2767
 
2759
- One report-only spine record per carry note given: `{type:'carry-note', phase, iteration, chars, capped, sections}`. `phase` is `step:<id>` or `fix`; `chars` is the note's length (at most 3,000); `capped` is true when the cap cut anything; `sections` is `{reads, searches, edits, earlier}`, the COUNT of entries shown in each part, never a name or any text. Written right before the ask runs, only for an ask that receives a note; no cost fields, no verdict. Absent entirely when `carryNote` is `false` in `config.json`. The prose rules are under "Carry note".
2768
+ One report-only spine record per carry note given: `{type:'carry-note', phase, iteration, chars, capped, sections}`. `phase` is `step:<id>` or `fix`; `chars` is the note's length (at most 12,000); `capped` is true when the cap cut anything; `sections` is `{reads, searches, edits, earlier, failures}`, the COUNT of entries shown in each part, never a name or any text. Written right before the ask runs, only for an ask that receives a note; no cost fields, no verdict. Absent only for an ask that has no note to give; there is no switch (the carry memo is always on). The prose rules are under "Carry note".
2760
2769
 
2761
2770
  ### `replayRun(spineEvents, auditEvents?, { runId? })` / `formatReplay(summary)` / `summarizeForAllLine(summary)` / `formatAllLines(entries)` — `src/replay.js`
2762
2771
 
@@ -3968,7 +3977,7 @@ Two files in `~/.config/bareloop/`, outside any repo:
3968
3977
  real one). The CLI (`run-u`, `interview`, `author`) and the panel both use it.
3969
3978
  - **`config.json` — every setting, never a key value.** `readConfig({ home })` /
3970
3979
  `updateConfig(patch, { home })` (atomic tmp + rename, mode 600, unknown fields kept).
3971
- Fields: `learningHints` (true/false; absent = on; see "Cross-run learnings"), `carryNote` (true/false; absent = on; see "Carry note"), `monthlyLimitUsd` (number above 0; absent or `null` = no limit; any other value present
3980
+ Fields: `learningHints` (true/false; absent = on; see "Cross-run learnings"), `monthlyLimitUsd` (number above 0; absent or `null` = no limit; any other value present
3972
3981
  is a `ConfigError`, refused like an unreadable file), `keys.<ENV NAME>` = `{ shape, baseUrl, legacyMaxTokens }` (the Providers rows' settings: an API shape id, the typed Base URL,
3973
3982
  the "old max_tokens" tick), `models.<ENV NAME>` = a list of `{ model, use, inPerM?, outPerM? }` lines (replaced WHOLE on every save; the customer's own price below). Nothing is built
3974
3983
  in: a row with nothing saved is shape `openai-api`, no address, no lines. A secret-shaped
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bareloop",
3
- "version": "0.52.0",
3
+ "version": "0.53.0",
4
4
  "description": "Workflows that earn their own design, with receipts — agent-authored workflows for repeated, long, verifiable jobs that improve across runs under an un-gameable gate.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/carrynote.js CHANGED
@@ -2,12 +2,24 @@
2
2
  // It says where earlier workers looked, what they searched, what they changed (with the diff hunks) and how earlier tries
3
3
  // ended. Never file content, never a worker's own words. PURE render: no I/O; the store that feeds it is src/carrystore.js.
4
4
  // Reuses `jaccard` (src/learn.js, the learnings fold rule), `redactSecrets` (src/validate.js, the one secret-shape
5
- // inventory) and `isHandoffExcluded` (src/handoff.js: arbiter books, .git, .bareloop, outside the root).
5
+ // inventory) and `isCarryExcluded` (below: arbiter books, .git, .bareloop, outside the root).
6
6
  import { jaccard, JACCARD_MIN } from './learn.js';
7
7
  import { redactSecrets } from './validate.js';
8
- import { isHandoffExcluded } from './handoff.js';
8
+ import { isAbsolute } from 'node:path';
9
+ import { isArbiterBook } from './kinds.js';
9
10
 
10
- export const CAP = 3000;
11
+ export const CAP = 12000;
12
+
13
+ /**
14
+ * Is this repo-relative path off limits to the memo: outside the job root, an arbiter book (the one list,
15
+ * `isArbiterBook`: .smoke — spine, attempt-diff, bridges — .litectx, the gate audit), or inside `.git` / `.bareloop`.
16
+ * @param {string} rel
17
+ */
18
+ export function isCarryExcluded(rel) {
19
+ if (rel === '' || rel === '..' || rel.startsWith('../') || isAbsolute(rel)) return true;
20
+ if (isArbiterBook(rel) !== null) return true;
21
+ return rel.split('/').some((seg) => seg === '.git' || seg === '.bareloop');
22
+ }
11
23
  export const HUNK_LINES = 40;
12
24
  export const HUNK_SHOW = 12;
13
25
  export const GAP_LINES = 8;
@@ -88,7 +100,7 @@ export function fold(items, keyOf, near) {
88
100
  }
89
101
 
90
102
  const q = (v) => (v === undefined || v === null ? '?' : String(v));
91
- const ok = (p) => p != null && !isHandoffExcluded(p);
103
+ const ok = (p) => p != null && !isCarryExcluded(p);
92
104
 
93
105
  /** merge overlapping / adjacent [a,b] line ranges, ascending; returns 'a-b' strings */
94
106
  export function mergeRanges(rs) {
@@ -105,10 +117,11 @@ export function mergeRanges(rs) {
105
117
  * @property {0|1|2} tier 0 = last try's own fact, 1 = edited file, 2 = the rest
106
118
  * @property {number} count times read / searched
107
119
  * @property {number} recency index of the newest call
120
+ * @property {string} [fn] the file's function line ranges (` · functions: a 1-5, b 7-9`), the FIRST thing the cap drops
108
121
  */
109
122
 
110
- /** @param {Ev[]} events @param {Set<string>} editedPaths @param {number|undefined} lastAsk */
111
- function filesSection(events, editedPaths, lastAsk) {
123
+ /** @param {Ev[]} events @param {Set<string>} editedPaths @param {number|undefined} lastAsk @param {Record<string, string>} fnRanges */
124
+ function filesSection(events, editedPaths, lastAsk, fnRanges) {
112
125
  /** @type {Map<string, {es: Ev[], last: number}>} */
113
126
  const byPath = new Map();
114
127
  let dropped = 0;
@@ -131,7 +144,7 @@ function filesSection(events, editedPaths, lastAsk) {
131
144
  const noFix = !edited && es.length >= NO_FIX_MIN_READS && es.some((e) => e.noFix); // hamr: only a file read 3+ times
132
145
  const text = `- ${p}${lc} · read ${es.length}x${ranges.length ? ` · lines ${ranges.join(', ')}` : ''}${noFix ? NO_FIX : ''}`;
133
146
  const inLast = lastAsk !== undefined && es.some((e) => e.ask === lastAsk);
134
- entries.push({ text, keys: [`F\0${p}`], tier: inLast ? 0 : edited ? 1 : 2, count: es.length, recency: last });
147
+ entries.push({ text, keys: [`F\0${p}`], tier: inLast ? 0 : edited ? 1 : 2, count: es.length, recency: last, ...(fnRanges[p] ? { fn: fnRanges[p] } : {}) });
135
148
  }
136
149
  entries.sort(rank);
137
150
  return { entries, dropped, summarized };
@@ -174,20 +187,25 @@ function editLines(e, hunkCap) {
174
187
  * Render the carry note. PURE.
175
188
  * @param {{lastTry?: {step:string|null, kind:'step'|'fix', n:number|string|undefined, of?:number, ended:string, changed:string[]}|null,
176
189
  * lastCheck?: string|null, events: Ev[], edits?: {path:string, lines:number, hunks:string[]}[],
177
- * earlier?: string[], lastAsk?: number}} notes
190
+ * earlier?: string[], failures?: {label:string, text:string}[], lastAsk?: number,
191
+ * 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
178
192
  * @param {number} [cap]
179
193
  */
180
194
  export function render(notes, cap = CAP) {
181
195
  const events = (notes.events ?? []).filter((e) => e);
182
196
  const edits = (notes.edits ?? []).filter((e) => ok(e.path)).slice().reverse(); // newest first
183
197
  const editedPaths = new Set(edits.map((e) => e.path));
184
- const { entries: files, dropped, summarized } = filesSection(events, editedPaths, notes.lastAsk);
198
+ const { entries: files, dropped, summarized } = filesSection(events, editedPaths, notes.lastAsk, notes.fnRanges ?? {});
185
199
  const searches = searchSection(events, notes.lastAsk);
186
200
  const earlierG = fold((notes.earlier ?? []).slice().reverse(), (s) => s);
187
201
  /** @type {Entry[]} */
188
202
  const earlier = earlierG.map((g, i) => ({ text: '- ' + g.rep + (g.members.length > 1 ? ` · ${g.members.length - 1} similar` : ''), keys: [], tier: 2, count: 0, recency: -i }));
189
- const rawEntries = events.filter((e) => ['read', 'get', 'grep', 'recall'].includes(e.tool)).length + edits.length + (notes.earlier ?? []).length;
190
- const foldedEntries = files.length + searches.length + edits.length + earlier.length + (dropped ? 1 : 0);
203
+ // failed checks' whole texts, oldest first in; folded newest first with the SAME rule, the newest member represents its group
204
+ const failG = fold((notes.failures ?? []).slice().reverse(), (f) => f.text);
205
+ /** @type {Entry[]} */
206
+ const failures = failG.map((g, i) => ({ text: `- ${g.rep.label}${g.members.length > 1 ? ` · ${g.members.length - 1} similar` : ''}:\n` + String(g.rep.text).split('\n').map((l) => ' ' + l).join('\n'), keys: [], tier: 2, count: 0, recency: -i }));
207
+ const rawEntries = events.filter((e) => ['read', 'get', 'grep', 'recall'].includes(e.tool)).length + edits.length + (notes.earlier ?? []).length + (notes.failures ?? []).length;
208
+ const foldedEntries = files.length + searches.length + edits.length + earlier.length + failures.length + (dropped ? 1 : 0);
191
209
 
192
210
  const lt = notes.lastTry;
193
211
  const head = [HEADING];
@@ -196,8 +214,10 @@ export function render(notes, cap = CAP) {
196
214
 
197
215
  // Cap order (hamr, 2026-10-30): diffs matter most, so they are cut LAST.
198
216
  // 1 file lines (edited files protected, dropped last in the section), 2 search lines, 3 earlier tries oldest first,
217
+ // 3b earlier failures, the OLDEST group first (whole group), then
199
218
  // 4 diff hunks, one edit at a time oldest first: to HUNK_SHOW lines each, then to 0 each (newest edit's hunk is the last thing cut).
200
219
  // `notes.edits` must be ordered oldest to newest (the store does this: orderEditsByRecency in carrystore.js).
220
+ // 0 (before all of those, hamr 2026-10-31): the function line ranges on the file lines.
201
221
  // The last-try line and the heading are never dropped.
202
222
  const dropOrder = (/** @type {Entry[]} */ arr, /** @type {(e: Entry) => boolean} */ protect = () => false) =>
203
223
  arr.slice().sort((a, b) => Number(protect(a)) - Number(protect(b)) || b.tier - a.tier || a.count - b.count || a.recency - b.recency);
@@ -205,6 +225,8 @@ export function render(notes, cap = CAP) {
205
225
  /** @type {Set<Entry>} */
206
226
  const gone = new Set();
207
227
  const goneEdits = new Set();
228
+ let showFns = true;
229
+ const tx = (/** @type {Entry} */ x) => (showFns && x.fn ? `${x.text} · functions: ${x.fn}` : x.text);
208
230
  const hunkCaps = edits.map(() => HUNK_LINES); let gapCap = GAP_CHARS;
209
231
  const gapText = () => (gapFull ? 'Last check said: ' + (gapFull.length > gapCap ? gapFull.slice(0, gapCap) + '…' : gapFull) : null);
210
232
  const build = () => {
@@ -214,7 +236,7 @@ export function render(notes, cap = CAP) {
214
236
  const sec = (/** @type {string} */ title, /** @type {Entry[]} */ arr, /** @type {string[]} */ extra = []) => {
215
237
  const k = kept(arr);
216
238
  if (!k.length && !extra.length) return;
217
- L.push(title); k.forEach((x) => L.push(x.text)); extra.forEach((x) => L.push(x));
239
+ L.push(title); k.forEach((x) => L.push(tx(x))); extra.forEach((x) => L.push(x));
218
240
  if (k.length < arr.length) L.push(`- (+${arr.length - k.length} lower-ranked not shown)`);
219
241
  };
220
242
  sec(`Where earlier workers looked (${files.length} file${files.length === 1 ? '' : 's'}):`, files, dropped ? [`- +${dropped} listings/config reads not shown`] : []);
@@ -222,6 +244,7 @@ export function render(notes, cap = CAP) {
222
244
  const ke = edits.filter((_, i) => !goneEdits.has(i));
223
245
  if (edits.length) { L.push('Edits made in this run:'); edits.forEach((e, i) => { if (!goneEdits.has(i)) L.push(editLines(e, hunkCaps[i])); }); if (ke.length < edits.length) L.push(`- (+${edits.length - ke.length} older not shown)`); } else L.push('Edits made in this run: none');
224
246
  sec('Earlier tries (folded):', earlier);
247
+ sec('Earlier failures (folded):', failures);
225
248
  return L.join('\n');
226
249
  };
227
250
  let text = build();
@@ -229,9 +252,11 @@ export function render(notes, cap = CAP) {
229
252
  let capped = false;
230
253
  /** @type {(() => void)[]} */
231
254
  const steps = [
255
+ () => { showFns = false; },
232
256
  ...dropOrder(files, isEditedFile).map((e) => () => { gone.add(e); }),
233
257
  ...dropOrder(searches).map((e) => () => { gone.add(e); }),
234
258
  ...dropOrder(earlier).map((e) => () => { gone.add(e); }),
259
+ ...dropOrder(failures).map((e) => () => { gone.add(e); }),
235
260
  // 4: one edit at a time, oldest first (edits[] is newest first, so walk from the end): to HUNK_SHOW, then every edit to 0
236
261
  ...edits.map((_, i) => i).reverse().map((i) => () => { hunkCaps[i] = Math.min(hunkCaps[i], HUNK_SHOW); }),
237
262
  ...edits.map((_, i) => i).reverse().map((i) => () => { hunkCaps[i] = 0; }), // oldest edit first, newest last
@@ -257,6 +282,7 @@ export function render(notes, cap = CAP) {
257
282
  searches: searches.filter((x) => !gone.has(x)).length,
258
283
  edits: edits.length - goneEdits.size,
259
284
  earlier: earlier.filter((x) => !gone.has(x)).length,
285
+ failures: failures.filter((x) => !gone.has(x)).length,
260
286
  };
261
287
  return { text, capped, rawChars, rawEntries, foldedEntries, named, summarized, sections };
262
288
  }
package/src/carrystore.js CHANGED
@@ -1,35 +1,22 @@
1
1
  // The carry note's store (M1, F258): the run-level record behind src/carrynote.js. It captures the worker's read-class tool
2
- // calls AT THE SOURCE (the same seam the handoff note uses: the worker's tool objects, result SUMMARIES only, never file
3
- // content), reads the run's edits from the WORKING TREE (git diff against the run's start commit, never the spine), renders
2
+ // calls AT THE SOURCE (the worker's tool objects, result SUMMARIES only, never file
3
+ // content), reads the run's edits from the WORKING TREE (git diff against the run's start commit, never the spine), renders
4
4
  // the note and persists its state under `<workdir>/.smoke/carry/state.json` (an arbiter book: the worker's fs.deny covers
5
- // `.smoke`, so it cannot read it; the gate audit, spine and bridges live there too). The switch is `carryNote` in
6
- // config.json (absent = on; only `false` turns it off), read once per run by the engine's caller.
5
+ // `.smoke`, so it cannot read it; the gate audit, spine and bridges live there too). There is no switch: the memo is
6
+ // always on (hamr 2026-11-01).
7
7
  import { execFile } from 'node:child_process';
8
8
  import { promisify } from 'node:util';
9
9
  import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
10
10
  import { isAbsolute, join, relative, resolve } from 'node:path';
11
11
  import { SMOKE_STORE } from './kinds.js';
12
- import { isHandoffExcluded } from './handoff.js';
13
12
  import { redactSecrets } from './validate.js';
14
- import { render, HUNK_LINES } from './carrynote.js';
15
- import { readConfig } from './config.js';
13
+ import { render, isCarryExcluded, HUNK_LINES } from './carrynote.js';
16
14
 
17
15
  const exec = promisify(execFile);
18
16
  export const CARRY_DIR = 'carry';
19
- /** the next prompt of a retried step / fix try carries this when the previous ask's check failed */
17
+ /** 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 */
20
18
  export const RED_MARKER = /Previous attempt failed (this step's checks|the verification):/;
21
19
 
22
- /**
23
- * The ONE setting: `carryNote` in config.json, read exactly like `learningHints` (src/learnstore.js `learningHintsOn`).
24
- * Absent = on; only an explicit `false` turns it off. An unreadable config reads as OFF (the safe side).
25
- * @param {string} [home]
26
- * @returns {boolean}
27
- */
28
- export function carryNoteOn(home) {
29
- const c = readConfig({ home });
30
- return c.problem === null && c.config.carryNote !== false;
31
- }
32
-
33
20
  const lineCount = (/** @type {string} */ s) => (s === '' ? 0 : s.split('\n').length - (s.endsWith('\n') ? 1 : 0));
34
21
  const clip = (/** @type {unknown} */ s, n = 200) => redactSecrets(String(s ?? '')).slice(0, n);
35
22
 
@@ -46,7 +33,7 @@ export async function workingEdits(workdir, base) {
46
33
  try {
47
34
  const { stdout: names } = await g(['diff', '--name-only', '-z', base]);
48
35
  for (const p of names.split('\0').filter(Boolean)) {
49
- if (isHandoffExcluded(p)) continue;
36
+ if (isCarryExcluded(p)) continue;
50
37
  const { stdout } = await g(['diff', '-U1', '--no-color', '--no-ext-diff', base, '--', `:(literal)${p}`]);
51
38
  if (/^(Binary files .* differ|GIT binary patch)$/m.test(stdout)) { out.push({ path: p, lines: 0, hunks: ['(binary file changed)'] }); continue; }
52
39
  const body = stdout.split('\n').filter((l) => !/^(diff --git|index |--- |\+\+\+ |new file mode|deleted file mode)/.test(l));
@@ -54,7 +41,7 @@ export async function workingEdits(workdir, base) {
54
41
  }
55
42
  const { stdout: un } = await g(['ls-files', '--others', '--exclude-standard', '-z']);
56
43
  for (const p of un.split('\0').filter(Boolean)) {
57
- if (isHandoffExcluded(p)) continue;
44
+ if (isCarryExcluded(p)) continue;
58
45
  try {
59
46
  const abs = resolve(workdir, p);
60
47
  if (!statSync(abs).isFile() || statSync(abs).size > 262144) continue;
@@ -93,11 +80,13 @@ export function createCarryStore({ workdir, emit, strikeLimit, resume = false })
93
80
  /** @type {any[]} one per WORK ask (step/fix): {n, kind, step, iteration, bounded, red, changed, startSnap} */
94
81
  let asks = [];
95
82
  let loaded = false;
83
+ /** @type {string|null} the job's own count-check text at start (the seed note's body), the oldest entry of the memo's earlier failures */
84
+ let startFailure = null;
96
85
  if (resume && existsSync(stateFile)) {
97
- try { const s = JSON.parse(readFileSync(stateFile, 'utf8')); n = s.n ?? 0; events = s.events ?? []; asks = s.asks ?? []; base = s.base ?? null; loaded = true; } catch { /* a bad file starts empty */ }
86
+ try { const s = JSON.parse(readFileSync(stateFile, 'utf8')); n = s.n ?? 0; events = s.events ?? []; asks = s.asks ?? []; base = s.base ?? null; startFailure = s.startFailure ?? null; loaded = true; } catch { /* a bad file starts empty */ }
98
87
  }
99
88
  const save = () => {
100
- try { mkdirSync(dir, { recursive: true }); writeFileSync(stateFile, JSON.stringify({ n, base, events, asks })); } catch { /* a record, never a verdict: a failed save never breaks a run */ }
89
+ try { mkdirSync(dir, { recursive: true }); writeFileSync(stateFile, JSON.stringify({ n, base, events, asks, startFailure })); } catch { /* a record, never a verdict: a failed save never breaks a run */ }
101
90
  };
102
91
  const rel = (/** @type {string} */ p) => (isAbsolute(p) ? relative(workdir, p) : p).split('\\').join('/') || '.';
103
92
  const diskLines = (/** @type {string} */ r, /** @type {string|undefined} */ fallback) => { try { return lineCount(readFileSync(resolve(workdir, r), 'utf8')); } catch { return fallback === undefined ? null : lineCount(fallback); } };
@@ -161,24 +150,57 @@ export function createCarryStore({ workdir, emit, strikeLimit, resume = false })
161
150
  }
162
151
  };
163
152
 
153
+ /** the per-entry cap on one file's function ranges, so one huge file cannot eat the memo */
154
+ const FN_CAP = 500;
155
+ /**
156
+ * Function line ranges per read file, from the LiteCtx index's named chunks (`name a-b, ...`). Fresh index only: a node whose
157
+ * last chunk ends past the file's current end is stale, and that file gets no ranges. Never throws.
158
+ * @param {any[]} evs @param {(rel: string) => any} getNode @returns {Record<string, string>}
159
+ */
160
+ const fnRangesOf = (evs, getNode) => {
161
+ /** @type {Record<string, string>} */ const out = {};
162
+ for (const p of new Set(evs.filter((e) => (e.tool === 'read' || e.tool === 'get') && !e.dir && e.path && !isCarryExcluded(e.path)).map((e) => e.path))) {
163
+ let node = null;
164
+ try { node = getNode(p); } catch { node = null; }
165
+ const n = diskLines(p, undefined);
166
+ const named = (node?.chunks ?? []).filter((/** @type {any} */ c) => c.symbol);
167
+ if (n === null || !named.length || !named.every((/** @type {any} */ c) => c.endLine <= n)) continue;
168
+ let map = ''; let more = 0;
169
+ for (let i = 0; i < named.length; i++) {
170
+ const piece = `${named[i].symbol} ${named[i].startLine}-${named[i].endLine}`;
171
+ if ((map ? map.length + 2 : 0) + piece.length > FN_CAP) { more = named.length - i; break; }
172
+ map += (map ? ', ' : '') + piece;
173
+ }
174
+ out[p] = map + (more ? `, +${more} more` : '');
175
+ }
176
+ return out;
177
+ };
178
+
164
179
  const snapOf = (/** @type {{path: string, lines: number}[]} */ edits) => Object.fromEntries(edits.map((e) => [e.path, e.lines]));
165
180
  const tryLabel = (/** @type {any} */ a) => (a.kind === 'fix' ? `fix loop try ${a.iteration}` : `step "${a.step}" try ${a.iteration}`);
166
- const endedOf = (/** @type {any} */ a) => a.boundedText || (a.red ? 'Its check failed.' : 'Its check passed.');
181
+ // how the try ended AND what its check said: a bounded try says both (the bound hides nothing)
182
+ const endedOf = (/** @type {any} */ a) => {
183
+ const res = a.result === 'red' ? 'Its check failed.' : a.result === 'green' ? 'Its check passed.' : null;
184
+ if (a.boundedText) return `${a.boundedText} ${res ?? 'Check not run.'}`;
185
+ return res ?? 'No check result was recorded for it.';
186
+ };
167
187
 
168
188
  /**
169
189
  * Called at the start of EVERY ask (scout and drafter included, so their finds feed the store).
170
190
  * Returns the note text for step/fix asks, '' otherwise.
171
- * @param {{phase: string, iteration: number|string|undefined, prompt: string}} o
191
+ * `getNode`: the LiteCtx index's node for a path (its `chunks`), for the function ranges; absent = no ranges.
192
+ * @param {{phase: string, iteration: number|string|undefined, prompt: string, getNode?: (rel: string) => any}} o
172
193
  */
173
- const beginAsk = async ({ phase, iteration, prompt }) => {
194
+ const beginAsk = async ({ phase, iteration, prompt, getNode }) => {
174
195
  n++;
175
196
  const work = phase === 'fix' || phase.startsWith('step:');
176
197
  if (!work) { save(); return ''; }
177
198
  const edits = await workingEdits(workdir, base);
178
199
  const prev = asks[asks.length - 1];
179
200
  if (prev && prev.red === undefined) {
180
- // settle the previous work ask: red = this prompt says the last attempt failed; changed = files whose changed-line count moved
181
- prev.red = RED_MARKER.test(prompt);
201
+ // settle the previous work ask: red = the check result the engine handed to settleAsk (never this prompt's wording);
202
+ // changed = files whose changed-line count moved
203
+ prev.red = prev.result === 'red';
182
204
  const now = snapOf(edits);
183
205
  prev.changed = [...new Set([...Object.keys(now), ...Object.keys(prev.startSnap)])].filter((p) => now[p] !== prev.startSnap[p]).sort();
184
206
  for (const e of events) if (e.ask === prev.n) e.noFix = prev.changed.length === 0 && prev.red;
@@ -192,11 +214,16 @@ export function createCarryStore({ workdir, emit, strikeLimit, resume = false })
192
214
  lastCheck: null, // the failed check's text is already in the prompt today; one copy
193
215
  events: events.map((e) => ({ ...e })),
194
216
  edits: orderEditsByRecency(edits, settled),
217
+ // every failed check's whole text, oldest first; the newest is left out only when it belongs to the last settled try
218
+ // (a red try being retried: the prompt carries it, one copy). A failure from a try that was later passed is in no prompt.
219
+ // plus the start failure, oldest of all: it is never in a prompt gap, so it is never the one left out
220
+ failures: [...(startFailure ? [{ label: 'at start', text: startFailure }] : []), ...settled.filter((a) => a.failure && a !== lt).map((a) => ({ label: tryLabel(a), text: a.failure }))],
195
221
  earlier: settled.slice(0, -1).map((a) => `${tryLabel(a)}: ${endedOf(a)} ${a.changed.length ? `Changed ${a.changed.join(', ')}.` : 'Changed nothing.'}`),
196
222
  lastAsk: lt ? lt.n : undefined,
223
+ fnRanges: getNode ? fnRangesOf(events, getNode) : {},
197
224
  };
198
225
  asks.push({ n, kind, step, iteration, startSnap: snapOf(edits) });
199
- const hasAny = notes.events.length || edits.length || notes.earlier.length || notes.lastTry;
226
+ const hasAny = notes.events.length || edits.length || notes.earlier.length || notes.failures.length || notes.lastTry;
200
227
  if (!hasAny) { save(); return ''; }
201
228
  const r = render(/** @type {any} */ (notes));
202
229
  emit('carry-note', { phase, iteration, chars: r.text.length, capped: r.capped, sections: r.sections }); // counts only
@@ -216,5 +243,22 @@ export function createCarryStore({ workdir, emit, strikeLimit, resume = false })
216
243
  save();
217
244
  };
218
245
 
219
- return { wrapTools, beginAsk, endAsk, setBase: (/** @type {string|null|undefined} */ b) => { if (!base && b) base = b; }, loaded: () => loaded, _state: () => ({ n, events, asks, base }) };
246
+ /**
247
+ * The engine's own check result for the ask that just returned: 'green' (every check passed), 'red' (one failed) or
248
+ * 'unknown' (the check hit an instrument fault, so no honest answer). Only the first result per ask counts.
249
+ * A red also hands over the check's WHOLE failing text (the gap the next prompt carries); it is stored masked, never clipped.
250
+ * @param {'green'|'red'|'unknown'} result @param {string} [text]
251
+ */
252
+ const settleAsk = (result, text) => {
253
+ const a = asks[asks.length - 1];
254
+ if (!a || a.n !== n || a.result !== undefined) return;
255
+ a.result = result;
256
+ if (result === 'red' && typeof text === 'string' && text !== '') a.failure = redactSecrets(text);
257
+ save();
258
+ };
259
+
260
+ /** The seed note's body (already secret-masked), set once per run; a resume keeps the one it persisted. @param {string} text */
261
+ const setStartFailure = (text) => { if (!startFailure && text) { startFailure = text; save(); } };
262
+
263
+ return { wrapTools, beginAsk, setStartFailure, endAsk, settleAsk, setBase: (/** @type {string|null|undefined} */ b) => { if (!base && b) base = b; }, loaded: () => loaded, _state: () => ({ n, events, asks, base }) };
220
264
  }
package/src/config.js CHANGED
@@ -10,7 +10,6 @@
10
10
  // Shape (unknown fields are kept, never dropped):
11
11
  // { "monthlyLimitUsd": <number > 0>, // absent = no limit, no check
12
12
  // "learningHints": true|false, // absent = true (ON by default; only false turns it off): the planner is handed cross-run learnings (src/learn.js); the tally is kept either way
13
- // "carryNote": true|false, // absent = true (ON by default; only false turns it off): a step/fix worker is handed a code-written, facts-only note of what earlier workers of the same run looked at, searched and changed (src/carrynote.js); off = the worker prompt is exactly as before
14
13
  // "keys": { "<ENV NAME>": { "shape": "<shape id>", "baseUrl": "http(s)://…", "legacyMaxTokens": true|false } },
15
14
  // "models": { "<ENV NAME>": [ { "model": "<id>", "use": true|false, "inPerM": n, "outPerM": n } ] } }
16
15
  // An older file's `keys.<ENV>.{name,priceInPerM,priceOutPerM}` is tolerated and read as ONE model
@@ -131,7 +130,6 @@ export function modelsProblem(list) {
131
130
  function docProblem(doc) {
132
131
  // monthlyLimitUsd is NOT judged here: `monthlyLimitOf` (src/monthly.js) owns its read-time sentence
133
132
  if (doc.learningHints !== undefined && typeof doc.learningHints !== 'boolean') return 'learningHints must be true or false';
134
- if (doc.carryNote !== undefined && typeof doc.carryNote !== 'boolean') return 'carryNote must be true or false';
135
133
  if (doc.keys !== undefined) {
136
134
  if (doc.keys === null || typeof doc.keys !== 'object' || Array.isArray(doc.keys)) return 'keys must be an object of key variable names';
137
135
  for (const [env, row] of Object.entries(doc.keys)) {
@@ -160,10 +158,10 @@ function docProblem(doc) {
160
158
  * `keys` merges per key variable name, then per field; `models.<ENV>` is REPLACED WHOLE (`null`
161
159
  * clears it). Validated before anything is written; nothing is written on a refusal.
162
160
  *
163
- * Patch fields understood: `monthlyLimitUsd` (finite > 0), `learningHints` (true | false), `carryNote` (true | false), `keys.<ENV>.{shape,baseUrl,legacyMaxTokens}`,
161
+ * Patch fields understood: `monthlyLimitUsd` (finite > 0), `learningHints` (true | false), `keys.<ENV>.{shape,baseUrl,legacyMaxTokens}`,
164
162
  * `models.<ENV>` (a list judged by {@link modelsProblem}). The first write of a row's `models` list
165
163
  * removes that row's older `name` / `priceInPerM` / `priceOutPerM` in the SAME write (never two
166
- * sources); a retired top-level `anthropicBalanceNote` is dropped on any write. Any other field is
164
+ * 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
167
165
  * kept, but the whole document is swept for secret-shaped strings first.
168
166
  * @param {Record<string, any>} patch
169
167
  * @param {{ home?: string }} [opts]
@@ -181,10 +179,10 @@ export function updateConfig(patch, opts = {}) {
181
179
  throw new ConfigError('monthlyLimitUsd must be a number above 0 (remove the limit to have none)');
182
180
  }
183
181
  if (k === 'learningHints' && typeof v !== 'boolean') throw new ConfigError('learningHints must be true or false');
184
- if (k === 'carryNote' && typeof v !== 'boolean') throw new ConfigError('carryNote must be true or false');
185
182
  next[k] = v;
186
183
  }
187
184
  delete next.anthropicBalanceNote;
185
+ delete next.carryNote;
188
186
  if (patch.keys !== undefined) {
189
187
  if (patch.keys === null || typeof patch.keys !== 'object' || Array.isArray(patch.keys)) {
190
188
  throw new ConfigError('keys must be an object of key variable names');
package/src/job.js CHANGED
@@ -170,7 +170,7 @@ export const CONDITION_KEYS = Object.freeze(['providerPath', 'closeVerbosity', '
170
170
  // `steps` stays in the field list ONLY so a retired spec reds by name
171
171
  // (`shape-retired`) instead of falling through to a generic unknown-field —
172
172
  // the operator gets told what happened, not just that something is wrong.
173
- const JOB_FIELDS = ['schema', 'job', 'description', 'provider', 'baseUrl', 'conditions', 'cadence', 'trigger', 'budgetUsd', 'maxWallMs', 'closeTimeoutMs', 'model', 'thinking', 'handoffNote', 'judge', 'writeScope', 'steps', 'escalation', 'goal', 'verdictType', 'close', 'closeDecl', 'checks', 'tools', 'jobLines', 'inputs'];
173
+ const JOB_FIELDS = ['schema', 'job', 'description', 'provider', 'baseUrl', 'conditions', 'cadence', 'trigger', 'budgetUsd', 'maxWallMs', 'closeTimeoutMs', 'model', 'thinking', 'handoffNote', 'seedNote', 'readMap', 'judge', 'writeScope', 'steps', 'escalation', 'goal', 'verdictType', 'close', 'closeDecl', 'checks', 'tools', 'jobLines', 'inputs'];
174
174
  /** the exact fields of a signed `judge` override — nested objects red unknown
175
175
  * keys too, because no smuggling level exists in a signed spec */
176
176
  const JUDGE_FIELDS = ['provider', 'model'];
@@ -349,10 +349,22 @@ export function validateJob(input, { shellCapUsd = 2 } = {}) {
349
349
  if (spec.thinking !== undefined && typeof spec.thinking !== 'boolean') {
350
350
  red('invalid-value', 'thinking', 'true or false — the job\'s "Thinking on" tick (absent = off)');
351
351
  }
352
- // THE HANDOFF NOTE (src/handoff.js): a declared job condition, signed like `thinking`. A boolean; ABSENT = on (an old spec keeps its
353
- // bytes, so its hash), only an explicit `false` turns the note off. The switch is hashed; the note's text never is.
352
+ // LEGACY `handoffNote` (the handoff note was folded into the carry memo, 2026-10-31): still accepted and hashed so an old signed spec
353
+ // verifies; it has NO effect since 2026-11-01 (the carry memo is always on). A boolean if present. New specs and drafts never write it.
354
354
  if (spec.handoffNote !== undefined && typeof spec.handoffNote !== 'boolean') {
355
- red('invalid-value', 'handoffNote', 'true or false (absent = on): whether the next step/fix worker is handed a map of the files earlier workers read');
355
+ red('invalid-value', 'handoffNote', 'true or false (legacy, ignored: the carry memo is always on)');
356
+ }
357
+
358
+ // THE SEED NOTE (src/seednote.js): a declared job condition, signed like `thinking`. A boolean; ABSENT = on (an old spec keeps its
359
+ // bytes, so its hash), only an explicit `false` turns off handing the planner and the first worker what the job's own check said at start. The switch is hashed; the text never is.
360
+ if (spec.seedNote !== undefined && typeof spec.seedNote !== 'boolean') {
361
+ red('invalid-value', 'seedNote', 'true or false (absent = on): whether the planner and the first worker are told what the job\'s own count check said on the untouched tree');
362
+ }
363
+
364
+ // THE FIRST-READ MAP (src/readshim.js, EXPERIMENTAL): a declared job condition, signed like `thinking`. A boolean; ABSENT = off (an old spec keeps
365
+ // its bytes, so its hash), `true` makes the first shell_read of a big non-test file in an ask return a map of its parts. The switch is hashed.
366
+ if (spec.readMap !== undefined && typeof spec.readMap !== 'boolean') {
367
+ red('invalid-value', 'readMap', 'true or false (absent = off, experimental): whether the first read of a big file in an ask returns a map of its parts instead of the file');
356
368
  }
357
369
 
358
370
  // JUDGE — PRD item 32.1 (hamr, 2026-09-10: the judge "defaults to whatever
@@ -7,6 +7,9 @@ import { FACT_LANGS } from './facts.js';
7
7
 
8
8
  /** @typedef {import('./pagerules.js').Dropped} Dropped */
9
9
 
10
+ /** the two ways a sign listed twice can be used once; the sentence below and the read-note probes (SENTENCE_RE) both read this one list */
11
+ const SIGN_TWICE_AS = ['currency', 'unit'];
12
+
10
13
  /** reason code -> the plain sentence (`d.word` = the page's word, `d.fact` = the fact's name, `d.other` = what it was compared to) */
11
14
  const WORDS = /** @type {Record<string, (d: Dropped) => string>} */ ({
12
15
  'not-on-page': (d) => `"${d.word}" is not written on the page.`,
@@ -14,7 +17,7 @@ const WORDS = /** @type {Record<string, (d: Dropped) => string>} */ ({
14
17
  'reads-no-amount': (d) => `The page never shows an amount next to "${d.word}", so it was not used to write the price.`,
15
18
  'n2': (d) => `"${d.word}" is written more than once inside one line of the page, so one result cannot show it once.`,
16
19
  'r1': (d) => `"${d.word}" does not show the same values as "${d.other}", so it was not used as a second way to read it.`,
17
- 'sign-twice': (d) => `"${d.word}" was listed twice, as a unit and as a currency; it is used once, as the ${d.other === 'unit' ? 'unit' : 'currency'}.`,
20
+ 'sign-twice': (d) => `"${d.word}" was listed twice, as a unit and as a currency; it is used once, as the ${SIGN_TWICE_AS.find((kind) => kind === d.other) ?? 'currency'}.`,
18
21
  'r1l': (d) => d.word === d.other
19
22
  ? `"${d.word}" was listed twice, as a unit and as a currency; it is used once, as the first way to write the price.`
20
23
  : `"${d.word}" does not show the same amounts as "${d.other}", so it was not used as a second way to write the price.`,
@@ -81,7 +84,7 @@ const SENTENCE_RE = (() => {
81
84
  /** @type {string[]} */
82
85
  const alts = [];
83
86
  for (const reason of WORD_REASONS) {
84
- const probes = reason === 'r1l' ? [{ word: W, other: W }, { word: W, other: O }] : reason === 'sign-twice' ? [{ word: W, other: 'currency' }, { word: W, other: 'unit' }] : [{ word: W, other: O }];
87
+ const probes = reason === 'r1l' ? [{ word: W, other: W }, { word: W, other: O }] : reason === 'sign-twice' ? SIGN_TWICE_AS.map((other) => ({ word: W, other })) : [{ word: W, other: O }];
85
88
  for (const p of probes) alts.push(esc(WORDS[reason](/** @type {any} */ ({ ...p, reason, line: 0, fact: 'f' }))).split(esc(W)).join('[^"]+').split(esc(O)).join('[^"]+'));
86
89
  }
87
90
  return new RegExp(`^(?:(?:${alts.join('|')})(?: |$))+$`);