bareloop 0.52.0 → 0.54.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 +45 -0
- package/bareloop.context.md +29 -16
- package/package.json +2 -2
- package/src/authorflow.js +33 -3
- package/src/authoring.js +30 -2
- package/src/authorjob.js +4 -0
- package/src/carrynote.js +38 -12
- package/src/carrystore.js +78 -31
- package/src/config.js +3 -5
- package/src/declaredclose.js +1 -1
- package/src/job.js +16 -4
- package/src/kinds.js +4 -2
- package/src/pagedropwords.js +5 -2
- package/src/panel/handed.js +92 -0
- package/src/panel/index.html +225 -120
- package/src/panel/jobplan.js +6 -1
- package/src/panel/schedules.js +2 -2
- package/src/panel/server.js +25 -8
- package/src/plan.js +38 -1
- package/src/planrun.js +245 -80
- package/src/ralph.js +2 -0
- package/src/readshim.js +98 -3
- package/src/run.js +2 -5
- package/src/seednote.js +28 -0
- package/src/tools.js +65 -6
- package/src/userrun.js +0 -3
- package/types/authorflow.d.ts +54 -1
- package/types/carrynote.d.ts +19 -2
- package/types/carrystore.d.ts +5 -9
- package/types/config.d.ts +2 -2
- package/types/panel/handed.d.ts +38 -0
- package/types/panel/jobplan.d.ts +2 -1
- package/types/plan.d.ts +19 -1
- package/types/planrun.d.ts +47 -7
- package/types/readshim.d.ts +54 -18
- package/types/run.d.ts +1 -5
- package/types/seednote.d.ts +18 -0
- package/types/tools.d.ts +25 -3
- package/src/handoff.js +0 -100
- package/types/handoff.d.ts +0 -39
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,51 @@ 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.54.0] - 2026-11-03
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **A worker that ends a try in text without writing is nudged once (F282).** When a writeable step's (or the fix loop's) ask finishes with text and the gate audit holds no allowed write or edit for it, the same conversation is continued once with one fixed message (`TEXT_ONLY_NUDGE`: "You ended without writing any file. Make the change now with your write or edit tool; do not reply in text."). The nudge round is inside the same try, metered like every other round, and honours the money cap, the wall clock, Stop and the round limit; read-only steps are never nudged and nothing is forced (no `toolChoice`). A new spine record `worker-text-only` stores the worker's last text (secret-masked, up to 2,000 characters, `truncated`) with `nudged` and `nudgeWrote`; the Audit marks a nudged try "nudged" in its grid header. Test-proven only; not seen live.
|
|
13
|
+
- **An always-on guard can cover a job line (F281).** A drafted close may list `guardLines: [{guard, lines}]` beside its stages, so a job line the mandatory guards fully do (for example "fix the cause in src/, no suppression comments") needs no duplicate stage and no refusal; the validator checks the link names a real guard and real lines, the drafter is told the guards exist and shown a legal example, and the plan card shows "check - always-on: <guard>" under the line. Specs without the field are unchanged.
|
|
14
|
+
- **The Audit shows the memo and the learnings where they were passed (F274).** The `carry-note` spine record now carries the memo text itself (secret-masked, up to 12,000 characters per ask), and the Audit tab shows it as a closed fold "Memory this worker got" under the part and try that received it; the learnings the planner got show as a fold on the drafting/plan part and the first replan part. The bottom "What the planner was told" box is gone (no text shown twice). Runs from before this change read "not saved (older run)". Matched by recorded phase, iteration and spine order, never by timestamp.
|
|
15
|
+
- **bare-agent `^0.59.0` bad-call handling (BA-29; F265, F266, F267).** The worker Loop turns on `checkArgs` (an object where a string was declared is refused before the tool runs, with the corrected hint). A new spine record `worker-bad-calls` names each bad call from bare-agent's structured `badCalls`/`cutOff` (kind, tool, param, expected, got, size, `hasAppend`, round); `worker-malformed-tool-call` is no longer lost on a round cut at the output cap. The next attempt's note says what was cut or refused (write in parts with `append`, decide sooner when reasoning dominates, send JSON as text). Test-proven only; not seen live.
|
|
16
|
+
- **`pairEditGrant` (F271, B2 safety net).** A plan step granting `write` without `edit` is paired with `edit` by code at the draft, replan and resume sites, only when the signed ceiling offers `edit` and never for a rubric step-file step. Internal (not exported). Test-proven, including the three live gutting plans as a fixture; not seen live.
|
|
17
|
+
|
|
18
|
+
- **BA-30 `shrinkGuard` on every worker (F272, F276).** A whole-file `write` that would cut a file tracked at the seed to under half its size (and at least 2 KB) is refused with the file unchanged, and the worker is told to use `edit`, `append:true` or `content:''`. "Tracked at seed" is the files at HEAD at the start of the leg, read from the worker tree for every job (command, declared or rubric close), compared in real-path form (a symlinked parent or root cannot launder a path); a file the worker creates later is not guarded; a resumed leg counts what earlier legs committed as tracked. The authoring scout has no write tool and takes no guard.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- **`seedListing` reads `git ls-tree -z`** so file names with non-ASCII bytes list as themselves, not C-quoted (F276).
|
|
23
|
+
- **Planner and persona wording (F271, B).** `EXIT_EXAMPLE` now teaches the read-only look-around step shape (tools read, grep with an `artifact-written` exit on an existing file); the two persona lines say "the file-changing tool you were given" instead of "the write tool", a tool a look-around step does not hold. Drafter-only POC (prereg `docs/logs/PLANWORDING-PREREG.md`): a leaning, 7 drafts per arm.
|
|
24
|
+
- **Gate audit write/edit rows record `valueType` and UTF-8 `bytes`** (F267): an object content no longer reads as 15 bytes and non-ASCII text is no longer under-counted.
|
|
25
|
+
- **Plain panel words for a stuck refused-argument loop**: the Ended block names what the model did instead of "(code: interpreter-red)"; the terminal outcome is unchanged (the escalation record gains `badCall`).
|
|
26
|
+
- **Panel caption looks, carried from fwdloop (hamr's request).** Chat job card field captions are accent pills (no left bar); the `[n]` numbers are gone from both tab rows; field captions elsewhere (global label, Settings money labels) are 12px bold accent, with checkbox/radio labels unchanged; the Runs tab section captions are colour bars with a count pill (Needs you amber, Running now teal, Scheduled blue, Jobs grey) and a divider between Jobs cards; the Run tab ENDED/NEXT/SCHEDULE labels and the Summary and Map captions are accent bold. Not carried (no such element here): the Ask door/evidence headings, the Result grid headings (the Result tab uses boxes). Look only; checked by screenshot at desktop width, not at phone width.
|
|
27
|
+
- **Run summary row labels are blue bold (hamr, 2026-11-03).** The `model:`, `steps:`, `why:`, `close:`, `tools:`, `calls:`, `checks:` and `cache:` labels in the Run tab SUMMARY box wear the accent colour and bold, like ENDED / NEXT / SCHEDULE; values unchanged. Scoped to the Run summary; the Import box keeps its faint labels. Look only.
|
|
28
|
+
- **Chat New job card pills say what is required (hamr, 2026-11-03; fwdloop 0ae68fb pattern).** A small grey `required` sits inside the caption pill of Job name, The job, Inputs, Destination and Cap $ — the five fields `validateJobCard` refuses when empty; Model, Check type and Time cap carry none. Look only.
|
|
29
|
+
- **Audit tab caption words are blue (hamr, 2026-11-03; fwdloop e637bb8).** In the Audit / logs tab the table header cells (check grid, Flat table, drafting, door and rounds tables), the `errors` and `rounds per try` captions, the `try N` labels in the errors list and the row labels of the schedule and learnings tables wear the accent colour (bold where they were not already). Scoped to `#audit-body`; values, the `[ +N more lines ]` buttons and the red/green marks are unchanged. Look only.
|
|
30
|
+
- **Runs tab search block is a light card (hamr, 2026-11-03; fwdloop V1).** The dashed line above search is gone; the "search also finds Scheduled" note (accent bold, SEARCH caption) and the search box sit together on one tinted card with rounded corners, the box has a 1px accent border and a focus ring. CSS only. Checked by screenshot at 1280 and 390 widths (no horizontal scroll), light and dark.
|
|
31
|
+
- **Audit grid shows what a worker was told as a `told in this run` row, like fwdloop (hamr, 2026-11-03; fwdloop 1574dcb).** In a step's or the fix loop's check grid, a row under the header has one `[ N lines ]` button per try that was handed the carry memo and a dash for a try that was not; a click opens the exact saved text under `errors` (8 lines, then `[ +N more lines ]`), a second click closes it. This replaces the per-try "Memory this worker got" folds in grids. A run with no saved memo text (older run) draws no row. The learnings stay a fold on the planner part (the planner, not a step try, is what gets them), so there is no `told from earlier runs` row. A try outside a grid (single-attempt step, the fix loop's cut-off try) keeps the old fold.
|
|
32
|
+
- bare-agent pin `^0.55.0` to `^0.59.0` (clean-install peers checked: bareguard 0.27.0 deduped).
|
|
33
|
+
|
|
34
|
+
## [0.53.0] - 2026-11-02
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
|
|
38
|
+
- **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).
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- **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).
|
|
43
|
+
- **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).
|
|
44
|
+
|
|
45
|
+
- **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).
|
|
46
|
+
|
|
47
|
+
- **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.
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
- **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.
|
|
52
|
+
|
|
8
53
|
## [0.52.0] - 2026-10-30
|
|
9
54
|
|
|
10
55
|
### Added
|
package/bareloop.context.md
CHANGED
|
@@ -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
|
|
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 |
|
|
@@ -180,7 +182,7 @@ the step plan at run time (gated by `validatePlan`); the human signs only:
|
|
|
180
182
|
| `jobLines`, `inputs` | optional (P7). `jobLines: [{ n, text, rule, rules? }]` — the person's own numbered job lines, `rule` = their `~` lines joined with `'; '` (`''` when none), `rules` = the same `~` lines as an array BESIDE `rule` (present only when the line has any; must join back to `rule` exactly; the Reuse card prefers it so an example's own `; ` is not cut; an older spec lacking it renders by splitting `rule`); `inputs: [{ n, label, value }]` — line 1 the repo (absolute path), lines 2+ tracked files inside it. Exact fields, numbered 1..n in order | what the Job tab and Reuse show back exactly as typed (the signed `goal` stays the model's confirm sentence, which the worker reads). **A spec without them keeps its `jobSpecHash`** (never rewritten); only NEW jobs carry them, so a new job's `workflowKey` differs from an old one's. `inputs` is OPEN on a reuse (`REUSE_OPEN_SPEC_FIELDS`), so `workflowKey` ignores it; `jobSpecHash` covers it. Parsed by `parseJobBlock` / `parseInputs` (`src/jobblock.js`, one owner for the panel and the CLI) |
|
|
181
183
|
| `verdictType` | `green` \| `soft-green` | declared radio, never inferred (`VERDICT_TYPES`, frozen). **AUTHORING offers both (`MENU_CLASSES`).** `soft-green` has its judged floor (`judged-floor`, signed rubric card + calibration gate) and is the forward path for a job needing judgement, paired with the end-of-run review door. Every `request-red` (e.g. for a locked TOOL verb, not a verdict class) also carries `lib` — the territory the demand lands against, stamped at the emit site (`verdictType` → `bareloop`, a locked tool verb → `bare-agent`): the ledger keys and its `suggestedAsk` seed on it, so a bareloop-catalogue refusal never files as an upstream ask |
|
|
182
184
|
| `close` | **an ORDERED LIST of named stages** `[{ name, cmd, expect, judged?, gapKeep?, offer?, needs?, direction? }, ...]` (PRD v1.28), or a close object (table below) | the destination, the only thing hand-authored; the check menu DERIVES from it (below). The plan flow executes a staged close directly and adapts a bare `predicate` object into a one-stage list; an object close names no command to run, so the plan flow refuses one at runtime as `close-unsupported`. The modern route to a judged or human-decided close is a staged `closeDecl` (`judged-floor` / `human-confirms` stage kinds), not this object form |
|
|
183
|
-
| `closeDecl` | **the AUTHORED close** `{ genre: "TYPES", lang: "js"\|"python", stages: [{ name, kind, params, fromLine? }], notes?, refused? }` | the ALTERNATIVE to `close`, and the point of the close-authoring rung: the user answers an interview and an LLM composes a DECLARATION over kinds whose implementations we own — never a script, never a shell fragment, never a new kind. **`close` and `closeDecl` are alternatives**: declaring both reds `close-duplicated` (two closes are two arbiters). It is HARD-class by construction (`CLASS_BY_CLOSE.declared`), so a locked verdict on one reds `close-hierarchy` as well as `request-red`. The declaration is validated by `validateCloseDecl`; the TREE-GROUNDED half of that gate (the path rule, and the scoped-job derivation that arms the F84 one-population law) is DEFERRED at spec-validation time — a job spec is validated with no repository in hand — and the runner re-runs it GROUNDED against the real seed before any stage and before any token. **Job-line coverage (P7, `checkJobLines` in `validateDeclaration`, $0, fed back through the revise loop):** with `jobLines` handed in, every stage the drafter writes carries `fromLine: [N, ...]` — a non-empty, duplicate-free ARRAY of real job lines, so one check (e.g. the one judged stage) may serve several lines, the mandatory guards carry none, and every numbered line has at least one stage OR a `{line, reason}` in `closeDecl.refused` — a note in `notes` does NOT cover a line (`job-line-uncovered`). `validateCloseDecl`/`validateJob` run it when the spec carries `jobLines`. It stores the counting RULE and never a number (D12): there is no seed field, and `baseline: "seed"` is measured at each run's own HEAD |
|
|
185
|
+
| `closeDecl` | **the AUTHORED close** `{ genre: "TYPES", lang: "js"\|"python", stages: [{ name, kind, params, fromLine? }], notes?, refused?, guardLines? }` | the ALTERNATIVE to `close`, and the point of the close-authoring rung: the user answers an interview and an LLM composes a DECLARATION over kinds whose implementations we own — never a script, never a shell fragment, never a new kind. **`close` and `closeDecl` are alternatives**: declaring both reds `close-duplicated` (two closes are two arbiters). It is HARD-class by construction (`CLASS_BY_CLOSE.declared`), so a locked verdict on one reds `close-hierarchy` as well as `request-red`. The declaration is validated by `validateCloseDecl`; the TREE-GROUNDED half of that gate (the path rule, and the scoped-job derivation that arms the F84 one-population law) is DEFERRED at spec-validation time — a job spec is validated with no repository in hand — and the runner re-runs it GROUNDED against the real seed before any stage and before any token. **Job-line coverage (P7, `checkJobLines` in `validateDeclaration`, $0, fed back through the revise loop):** with `jobLines` handed in, every stage the drafter writes carries `fromLine: [N, ...]` — a non-empty, duplicate-free ARRAY of real job lines, so one check (e.g. the one judged stage) may serve several lines, the mandatory guards carry none, and every numbered line has at least one stage OR a `{line, reason}` in `closeDecl.refused` — a note in `notes` does NOT cover a line (`job-line-uncovered`). `validateCloseDecl`/`validateJob` run it when the spec carries `jobLines`. **`guardLines` (F281):** an optional `[{guard, lines: [N, ...]}]` beside `stages` names the job lines a MANDATORY guard already does (a line fully covered by the always-on checks, e.g. "fix the cause in src/" with "no suppression comments"); the guard stage itself stays the genre's own object and still carries no `fromLine`. A listed line counts as covered (no stage, no `refused` entry needed); `guard` must name a mandatory guard of this close, `lines` must be real job lines, a guard is listed once with a duplicate-free non-empty `lines`, else a `$0` `invalid-value` red fed back through the revise loop. It is kept in the signed `closeDecl` (names and numbers only), and the plan card shows `check - always-on: <guard>` under a covered line. Old specs without it behave as before. It stores the counting RULE and never a number (D12): there is no seed field, and `baseline: "seed"` is measured at each run's own HEAD |
|
|
184
186
|
| `checks` | **RETIRED** (PRD v1.28/v1.32) | hand-authored checks are gone, not merely discouraged: declaring `checks` reds `checks-derived` by name. The check menu is DERIVED from the close's own stages instead — see **Staged close** below. The hazard this removes is measured, not theoretical: job #5's three hand-written checks were re-implementations of three stages the close already ran, and a hand-carved copy can drift LENIENT (the worker passes the operator's ruler and fails the real inspection) |
|
|
185
187
|
| `tools` | optional unique subset of `TOOL_MENU` (14 verbs, below) | the CEILING every plan step's grant must fit inside (omitting it means the full menu — and the hash is taken over that RESOLVED form, so a `TOOL_MENU` widening flips an omitted-`tools` spec's hash and forces a re-sign; see `jobSpecHash`, MED-1); `run` is `LOCKED_TOOLS` and reds `request-red` — locked-but-listed, and the red IS the admission evidence the ledger tallies (a typo stays `invalid-value`). A ceiling of write-class and store-class verbs ONLY reds `invalid-value`: the scout surveys read-only, so it would be handed an empty menu and survey blind |
|
|
186
188
|
|
|
@@ -191,7 +193,7 @@ ships with the grant (`COMPONENT_STRATEGIES` — capability without strategy is
|
|
|
191
193
|
|
|
192
194
|
| component | verbs | class |
|
|
193
195
|
|---|---|---|
|
|
194
|
-
| write | `write` · `edit` | tree writes, judged by the signed `writeScope` fence — `edit` (BA-13) is the anchored exact-once replace and goes through that SAME fence, not a weaker one |
|
|
196
|
+
| write | `write` · `edit` | tree writes, judged by the signed `writeScope` fence — `edit` (BA-13) is the anchored exact-once replace and goes through that SAME fence, not a weaker one **A plan step that grants `write` without `edit` is paired with `edit` by code (F271, `pairEditGrant`, `src/plan.js`):** applied to the validated plan at the draft, replan and resume sites, only when the signed ceiling (`tools`; absent = the full menu) offers `edit`, and never to a rubric step-file step (every declared path under `output/steps/`). The agent never asks for it and the ceiling is never passed, so it cannot widen its own menu; `edit` is judged by the same `writeScope` fence as `write`. `plan-accepted` and `step-start` record the paired grant. `pairEditGrant` is internal (not exported from `src/index.js`); `validatePlan` is unchanged. Test-proven; not yet seen live. **A whole-file `write` that would cut a file tracked at the seed to under half its size (2 KB or more) is refused, file unchanged (BA-30 `shrinkGuard`, F272):** "tracked at seed" is HEAD at the start of the leg (a resumed leg counts what earlier legs committed), compared in real-path form; files the worker creates later, `append:true` and `content:''` are not guarded. Test-proven; not yet seen live. |
|
|
195
197
|
| select | `read` · `grep` · `recall` · `get` · `impact` · `related` · `recent` | read-only; every one is judged as a `read` action by that same fence, so the deny list applies through every door. A walking `grep` is judged per path too (F259): the worker's and the authoring scout's shell tools are built with `gatedShellOptions` (`src/tools.js`: bare-agent `canRead` = the gate's own `allows()`, plus `noFollowSymlinks`), so a root grep skips the arbiter's books instead of reading them |
|
|
196
198
|
| compress | `compress` · `peek` | read-only (a signature tier; a stash's head/tail) |
|
|
197
199
|
| isolate | `stash` · `remember` · `forget` | STORE writes (the `.litectx` store, never the tree) — their own gate action types, so a store park can never be counted as a tree write by the F32 `workerWrites` instrument. **Not read-capable** |
|
|
@@ -645,9 +647,16 @@ 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
|
-
**
|
|
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}, text}` (the counts plus the note text itself, secret-masked; the Audit shows `text` under the part and try that received it). 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.
|
|
656
|
+
|
|
657
|
+
**Bad tool calls (bare-agent 0.59, BA-29; F265-F267).** The worker Loop runs with `checkArgs`: a wrong-typed or missing top-level tool argument is refused BEFORE the tool runs, with `<param> must be a <type>, got <type>` (an object where a string was declared adds "to send JSON, encode it as one string") or `<param> is required`; the refusal counts toward bare-agent's identical-error stop. Spine records: `worker-bad-calls {phase, iteration, calls:[{kind: arg-type|arg-missing|cut-off|malformed-json, tool, param?, expected?, got?, argBytes?, parsed?, hasAppend, round}], cutOff?:{outputTokens, reasoningTokens, maxTokensRequested}}` (structured fields only, no arguments and no prose), and `worker-malformed-tool-call` now also fires on a round cut at the output cap. The next attempt's note adds one sentence built from those fields: write in parts with `append:true` for a large cut write (at least 8,000 bytes, `CUT_LARGE_ARG_BYTES`), decide sooner when reasoning tokens are over half of the cut round's output, send JSON as text for an object/array where a string was declared; a cut with nothing known keeps the plain cut-off sentence. A stuck loop of refused arguments is still the terminal `interpreter-red`, but its escalation record carries `badCall {kind, tool, param, expected?, got?}` and the panel's Ended block says what the model did in words. The gate audit's write/edit rows carry `args: {bytes, valueType}`: `bytes` is the UTF-8 byte length (a non-string is measured as the JSON it was sent as), `valueType` the JSON type (`string`, `object`, `array`, `undefined`, ...); before this, an object content read as 15 and bytes were UTF-16 units. Test-proven; not yet seen live.
|
|
658
|
+
|
|
659
|
+
**Text-only ending nudge (F282).** When a writeable step's (or the fix loop's) ask finishes (`end_turn`) with text and the REAL gate audit holds no allowed write or edit for it, the same conversation is continued ONCE with one code-written message (`TEXT_ONLY_NUDGE`, "You ended without writing any file. Make the change now with your write or edit tool; do not reply in text."), same tools, no `toolChoice`, same try and no strike change. It is metered by the same per-round seam and skipped when the attempt is already bounded, the run was stopped, the wall is up or the round limit is reached; read-only steps are never nudged. Spine records: `worker-nudge {phase, iteration, round}` when the nudge is sent, and `worker-text-only {phase, iteration, nudged, nudgeWrote, text, truncated}` once per text-only ending (the last text, secret-masked, cut at 2,000 characters; `truncated` says so); the Audit marks a nudged try. Test-proven; not yet seen live.
|
|
651
660
|
|
|
652
661
|
**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
662
|
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
|
|
@@ -1943,7 +1952,7 @@ hand them to the one `Loop` that drives worker, scout and planner rounds; the ru
|
|
|
1943
1952
|
them once. No price on the row = no `rates` key anywhere = the guesstimate above, byte-identical to
|
|
1944
1953
|
before. bareloop keeps no price list of its own, ever.
|
|
1945
1954
|
|
|
1946
|
-
**The provenance is on the record, per round (`rateSource`).** The pinned bare-agent (`^0.
|
|
1955
|
+
**The provenance is on the record, per round (`rateSource`).** The pinned bare-agent (`^0.59.0`)
|
|
1947
1956
|
carries it on every metering payload, and bareloop forwards it VERBATIM (`rateSourceFields`,
|
|
1948
1957
|
`src/planrun.js`): every API `worker-round` (worker, scout, planner, fix loop) carries it beside
|
|
1949
1958
|
`pricing` today — `'caller'` when a customer price is on the key's row, else `'tier'`/`'default'`
|
|
@@ -2744,19 +2753,23 @@ unreferenced loose objects are left. Gitignored files inside the fence are seen
|
|
|
2744
2753
|
changed nothing in scope emits nothing, and a failed capture emits `gitError` with empty lists: a record,
|
|
2745
2754
|
never a verdict, and it never throws. No prompt carries it; the learnings cards read it ("What changed").
|
|
2746
2755
|
|
|
2747
|
-
#### `handoff-note` —
|
|
2756
|
+
#### `handoff-note` — LEGACY, no longer written (the handoff note was folded into the carry memo)
|
|
2757
|
+
|
|
2758
|
+
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).
|
|
2759
|
+
|
|
2760
|
+
#### `seed-note` — the seed note handed to the planner (the worker side is the carry memo) (`src/seednote.js`, `src/planrun.js`)
|
|
2761
|
+
|
|
2762
|
+
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
|
|
2763
|
+
text it carries. Counts and names only, never the text. No cost fields, no verdict. Written only when the signed spec's
|
|
2764
|
+
`seedNote` is not `false` and a `count-not-worse` stage was red at seed. The prose rules are under "Seed note".
|
|
2765
|
+
|
|
2766
|
+
#### `read-map` and `read-map-skip` — the first-read map (`src/readshim.js`, `src/planrun.js`)
|
|
2748
2767
|
|
|
2749
|
-
|
|
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".
|
|
2768
|
+
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
2769
|
|
|
2757
2770
|
#### `carry-note` — a carry note handed to a worker ask (`src/carrystore.js`, `src/planrun.js`)
|
|
2758
2771
|
|
|
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
|
|
2772
|
+
One report-only spine record per carry note given: `{type:'carry-note', phase, iteration, chars, capped, sections, text}`. `phase` is `step:<id>` or `fix`; `chars` is the length of `text` (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; `text` is the exact note handed to the worker (F274, 2026-11-02), run through the one secret mask (`render` masks the whole text, diff hunks included; the emit masks again, idempotent), so `chars` is the masked length. Size cost: up to 12,000 characters per ask on the spine. Records from before 2026-11-02 have no `text`; the Audit reads them as "not saved (older run)". 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
2773
|
|
|
2761
2774
|
### `replayRun(spineEvents, auditEvents?, { runId? })` / `formatReplay(summary)` / `summarizeForAllLine(summary)` / `formatAllLines(entries)` — `src/replay.js`
|
|
2762
2775
|
|
|
@@ -3968,7 +3981,7 @@ Two files in `~/.config/bareloop/`, outside any repo:
|
|
|
3968
3981
|
real one). The CLI (`run-u`, `interview`, `author`) and the panel both use it.
|
|
3969
3982
|
- **`config.json` — every setting, never a key value.** `readConfig({ home })` /
|
|
3970
3983
|
`updateConfig(patch, { home })` (atomic tmp + rename, mode 600, unknown fields kept).
|
|
3971
|
-
Fields: `learningHints` (true/false; absent = on; see "Cross-run learnings"), `
|
|
3984
|
+
Fields: `learningHints` (true/false; absent = on; see "Cross-run learnings"), `monthlyLimitUsd` (number above 0; absent or `null` = no limit; any other value present
|
|
3972
3985
|
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
3986
|
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
3987
|
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.
|
|
3
|
+
"version": "0.54.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",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"check:lockfile": "node scripts/check-lockfile.mjs"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"bare-agent": "^0.
|
|
30
|
+
"bare-agent": "^0.59.0",
|
|
31
31
|
"barebrowse": "^0.25.0",
|
|
32
32
|
"bareguard": "^0.27.0",
|
|
33
33
|
"litectx": "^0.32.0"
|
package/src/authorflow.js
CHANGED
|
@@ -149,6 +149,9 @@ export function linesNamedByReds(reds, declaration, lineNums) {
|
|
|
149
149
|
if (st && Array.isArray(stages[Number(st[1])]?.fromLine)) {
|
|
150
150
|
for (const n of stages[Number(st[1])].fromLine) if (Number.isInteger(n)) found.add(n);
|
|
151
151
|
}
|
|
152
|
+
const gl = /^guardLines\[(\d+)\]/.exec(String(red?.path ?? ''));
|
|
153
|
+
const guardLines = Array.isArray(declaration?.guardLines) ? declaration.guardLines : [];
|
|
154
|
+
if (gl && Array.isArray(guardLines[Number(gl[1])]?.lines)) for (const n of guardLines[Number(gl[1])].lines) if (Number.isInteger(n)) found.add(n);
|
|
152
155
|
const rf = /^refused\[(\d+)\]/.exec(String(red?.path ?? ''));
|
|
153
156
|
if (rf && Number.isInteger(refused[Number(rf[1])]?.line)) found.add(refused[Number(rf[1])].line);
|
|
154
157
|
}
|
|
@@ -1000,6 +1003,19 @@ export function declarationSchema(catalogue = KIND_CATALOGUE, { verdictType = nu
|
|
|
1000
1003
|
},
|
|
1001
1004
|
description: 'job lines (or single ~ rules of a line) you could not turn into a check, each with a reason in the person\'s words — a note does not cover a line or a rule',
|
|
1002
1005
|
},
|
|
1006
|
+
guardLines: {
|
|
1007
|
+
type: 'array',
|
|
1008
|
+
items: {
|
|
1009
|
+
type: 'object',
|
|
1010
|
+
properties: {
|
|
1011
|
+
guard: { type: 'string', minLength: 1, description: 'the name of a mandatory guard stage' },
|
|
1012
|
+
lines: { type: 'array', minItems: 1, uniqueItems: true, items: { type: 'integer', minimum: 1 }, description: 'the number(s) of the job line(s) that guard already checks' },
|
|
1013
|
+
},
|
|
1014
|
+
required: ['guard', 'lines'],
|
|
1015
|
+
additionalProperties: false,
|
|
1016
|
+
},
|
|
1017
|
+
description: 'optional: which job lines the always-on guards already cover (a line whose every ask a mandatory guard checks needs no stage of its own)',
|
|
1018
|
+
},
|
|
1003
1019
|
...(questions ? {
|
|
1004
1020
|
questions: {
|
|
1005
1021
|
type: 'array',
|
|
@@ -1246,14 +1262,28 @@ export function confirmedBlock(confirmed, { numbered = false } = {}) {
|
|
|
1246
1262
|
* names the ONE numbered job line it serves, or the line is refused with a reason; the mandatory guards serve no line.
|
|
1247
1263
|
* The $0 validator (validateDeclaration, `jobLines`) enforces it and the revise loop feeds a miss back.
|
|
1248
1264
|
* @param {number} count how many numbered job lines the person wrote
|
|
1265
|
+
* @param {string[]} [guardNames] the mandatory guards' names; present = the block also tells how a line they already cover is covered
|
|
1249
1266
|
*/
|
|
1250
|
-
export function jobLineTagBlock(count) {
|
|
1267
|
+
export function jobLineTagBlock(count, guardNames = []) {
|
|
1251
1268
|
return 'EVERY STAGE SERVES ONE JOB LINE\n\n'
|
|
1252
1269
|
+ `The person's job has ${count} numbered line${count === 1 ? '' : 's'} (the interview above). Tag every stage YOU write `
|
|
1253
1270
|
+ 'with "fromLine": [N, ...] — the number(s) of the job line(s) that stage checks (one stage may serve several lines, e.g. a judged stage that reads lines 1-3). A job line that no kind in the catalogue '
|
|
1254
1271
|
+ 'can check is not left out silently: list it in "refused" as {"line": N, "reason": "..."}, with a reason in plain '
|
|
1255
1272
|
+ 'words the person can read. Every numbered line needs at least one stage or one refusal — a note in "notes" does '
|
|
1256
|
-
+ 'NOT cover a line. The mandatory guards serve no job line and carry NO "fromLine".'
|
|
1273
|
+
+ 'NOT cover a line. The mandatory guards serve no job line and carry NO "fromLine".'
|
|
1274
|
+
+ (guardNames.length
|
|
1275
|
+
? '\n\nA job line whose every ask the always-on checks (the mandatory guards) already do needs no stage of its own and no refusal: '
|
|
1276
|
+
+ 'name the guard(s) that do it in "guardLines", beside "stages" — for example {"guardLines": [{"guard": "' + guardNames[0] + '", "lines": [N]}]}. '
|
|
1277
|
+
+ 'Never write a second stage that repeats a guard, and keep "refused" for a line nothing can check.'
|
|
1278
|
+
+ '\n\nTHE ALWAYS-ON CHECKS ALREADY EXIST in this close, in plain words: ' + guardNames.map((n) => n + ' (' + (GUARD_DESCRIPTIONS[n] ?? n) + ')').join('; ')
|
|
1279
|
+
+ '; and the write fence (changes stay inside the write scope). They are already among the guard stages you were given — keep those exactly as given, and NEVER declare any of them again as a stage of your own — '
|
|
1280
|
+
+ 'no second files-changed or scope stage, and no stage that adds scope or params to the suppression guard. A job line they already cover '
|
|
1281
|
+
+ '(for example "Fix the cause in the source code under src/" with the rule "no suppression comments") is linked to them with "guardLines", '
|
|
1282
|
+
+ 'not given a stage and not refused. Legal example for a two-line job whose line 1 is a test run and whose line 2 is covered by the guards: '
|
|
1283
|
+
+ '{"stages": [{"name": "suite-green", "kind": "command-exit", "fromLine": [1], "params": {"cmd": "npm", "args": ["test"], "expectExit": 0}}], '
|
|
1284
|
+
+ '"guardLines": [{"guard": "' + guardNames[0] + '", "lines": [2]}' + (guardNames[1] ? ', {"guard": "' + guardNames[1] + '", "lines": [2]}' : '') + ']} — '
|
|
1285
|
+
+ 'line 2 has no stage of its own and is not refused.'
|
|
1286
|
+
: '');
|
|
1257
1287
|
}
|
|
1258
1288
|
|
|
1259
1289
|
/**
|
|
@@ -1375,7 +1405,7 @@ measure anything.`;
|
|
|
1375
1405
|
`WHAT THE PERSON DECLARED "DONE" TO MEAN — their answer, not yours\n\n${statement}`,
|
|
1376
1406
|
`THE INTERVIEW — the person's own words\n\n${interview}`
|
|
1377
1407
|
+ (inputs && inputs.length ? `\n\n${renderInputs(inputs)}` : ''),
|
|
1378
|
-
...(jobLines && jobLines.length ? [jobLineTagBlock(jobLines.length)] : []),
|
|
1408
|
+
...(jobLines && jobLines.length ? [jobLineTagBlock(jobLines.length, guards.map((g) => g.name))] : []),
|
|
1379
1409
|
// Q2 IS GONE (PRD item 33 M3 piece 3) — what it used to carry (which files
|
|
1380
1410
|
// change, which are read-only) is proven against the machine now, not typed,
|
|
1381
1411
|
// and this is where that proof reaches the composer instead of vanishing.
|
package/src/authoring.js
CHANGED
|
@@ -1537,7 +1537,7 @@ export function validateDeclaration(declaration, opts = {}) {
|
|
|
1537
1537
|
/**
|
|
1538
1538
|
* P7 rules 1-3 of the job block, at $0, in the gate that can still revise: every `fromLine` is a non-empty, duplicate-free array of real job line numbers (one check may serve several lines);
|
|
1539
1539
|
* every numbered job line has at least one stage OR a refusal reason in `refused` (a note in `notes` does NOT cover a
|
|
1540
|
-
* line);
|
|
1540
|
+
* line); a mandatory guard carries no `fromLine` (its object stays the genre's own) and names the lines it already covers in the separate `guardLines`. The SHAPE of `fromLine` / `refused` is checked
|
|
1541
1541
|
* whenever they appear; the coverage half runs only when the person's `jobLines` were handed in.
|
|
1542
1542
|
* @param {{declaration: any, stages: any[], jobLines: {n: number}[]|null|undefined,
|
|
1543
1543
|
* guards: {name: string}[], red: (c: string, p: string, d: string, e?: object) => void}} o
|
|
@@ -1554,7 +1554,7 @@ function checkJobLines({ declaration, stages, jobLines, guards, red }) {
|
|
|
1554
1554
|
const guard = isNonEmptyString(s.name) && guardNames.has(s.name);
|
|
1555
1555
|
if (Object.hasOwn(s, 'fromLine')) {
|
|
1556
1556
|
if (guard) {
|
|
1557
|
-
red('invalid-value', at, `stage "${label}" is a mandatory guard and
|
|
1557
|
+
red('invalid-value', at, `stage "${label}" is a mandatory guard and carries no fromLine — to say it covers a job line, list it in "guardLines" as {"guard": "${label}", "lines": [N]}`);
|
|
1558
1558
|
} else if (!Array.isArray(s.fromLine) || s.fromLine.length === 0 || !s.fromLine.every((/** @type {any} */ x) => Number.isInteger(x) && x >= 1)) {
|
|
1559
1559
|
red('invalid-value', at, `stage "${label}" has fromLine ${JSON.stringify(s.fromLine)} — a non-empty array of job line numbers, e.g. [1] or [1, 3]`);
|
|
1560
1560
|
} else if (new Set(s.fromLine).size !== s.fromLine.length) {
|
|
@@ -1567,6 +1567,34 @@ function checkJobLines({ declaration, stages, jobLines, guards, red }) {
|
|
|
1567
1567
|
+ 'only a mandatory guard carries none');
|
|
1568
1568
|
}
|
|
1569
1569
|
});
|
|
1570
|
+
// a mandatory guard says which job lines its always-on check already covers, beside the stage (the guard's own object stays
|
|
1571
|
+
// byte-identical to the genre's): `guardLines: [{guard, lines: [N, ...]}]`. It counts as coverage for those lines, nothing more.
|
|
1572
|
+
if (declaration.guardLines !== undefined) {
|
|
1573
|
+
if (!Array.isArray(declaration.guardLines)) {
|
|
1574
|
+
red('invalid-value', 'guardLines', 'an array of {guard, lines} — which job lines each always-on guard already covers, e.g. [{"guard": "<a mandatory guard name>", "lines": [2]}]');
|
|
1575
|
+
} else {
|
|
1576
|
+
/** @type {Set<string>} */
|
|
1577
|
+
const seenGuards = new Set();
|
|
1578
|
+
declaration.guardLines.forEach((/** @type {any} */ g, /** @type {number} */ j) => {
|
|
1579
|
+
const at = `guardLines[${j}]`;
|
|
1580
|
+
if (!isObj(g) || !isNonEmptyString(g.guard) || !Array.isArray(g.lines) || g.lines.length === 0
|
|
1581
|
+
|| !g.lines.every((/** @type {any} */ x) => Number.isInteger(x) && x >= 1)) {
|
|
1582
|
+
red('invalid-value', at, '{guard, lines}: the name of a mandatory guard and a non-empty array of job line numbers, e.g. {"guard": "<a mandatory guard name>", "lines": [2]}');
|
|
1583
|
+
} else if (!guardNames.has(g.guard)) {
|
|
1584
|
+
red('invalid-value', `${at}.guard`, `"${g.guard}" is not a mandatory guard${guardNames.size ? ` — the always-on guards are ${[...guardNames].join(', ')}` : ''}`);
|
|
1585
|
+
} else if (seenGuards.has(g.guard)) {
|
|
1586
|
+
red('invalid-value', `${at}.guard`, `guard "${g.guard}" is listed twice in guardLines — give it one entry with all its lines`);
|
|
1587
|
+
} else if (new Set(g.lines).size !== g.lines.length) {
|
|
1588
|
+
red('invalid-value', `${at}.lines`, `guard "${g.guard}" lists a job line twice in ${JSON.stringify(g.lines)}`);
|
|
1589
|
+
} else if (known !== null && g.lines.some((/** @type {number} */ x) => !known.includes(x))) {
|
|
1590
|
+
red('invalid-value', `${at}.lines`, `guard "${g.guard}" has lines ${JSON.stringify(g.lines)}, but the job has lines ${known.join(', ')} only`);
|
|
1591
|
+
} else {
|
|
1592
|
+
seenGuards.add(g.guard);
|
|
1593
|
+
for (const x of g.lines) served.add(x);
|
|
1594
|
+
}
|
|
1595
|
+
});
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1570
1598
|
/** @type {Set<number>} */
|
|
1571
1599
|
const refused = new Set();
|
|
1572
1600
|
if (declaration.refused !== undefined) {
|
package/src/authorjob.js
CHANGED
|
@@ -867,6 +867,10 @@ export async function authorCloseForJob({
|
|
|
867
867
|
...(authored.declaration.refused?.length
|
|
868
868
|
? { refused: authored.declaration.refused.map((/** @type {any} */ r) => ({ line: r.line, ...(Number.isInteger(r.rule) ? { rule: r.rule } : {}), reason: redactSecrets(String(r.reason)) })) }
|
|
869
869
|
: {}),
|
|
870
|
+
// the lines the always-on guards cover (names and numbers only, nothing free-text)
|
|
871
|
+
...(authored.declaration.guardLines?.length
|
|
872
|
+
? { guardLines: authored.declaration.guardLines.map((/** @type {any} */ g) => ({ guard: g.guard, lines: [...g.lines] })) }
|
|
873
|
+
: {}),
|
|
870
874
|
};
|
|
871
875
|
|
|
872
876
|
// ── THE TWO SIGNED ARTIFACTS (softgreen module 4, wired here by module 5) ──
|
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 `
|
|
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 {
|
|
8
|
+
import { isAbsolute } from 'node:path';
|
|
9
|
+
import { isArbiterBook } from './kinds.js';
|
|
9
10
|
|
|
10
|
-
export const CAP =
|
|
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 && !
|
|
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
|
|
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
|
-
|
|
190
|
-
const
|
|
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
|
|
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
|
}
|