@fractalsynapse/dsh-chapters 0.2.33 → 0.2.35

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.
@@ -489,6 +489,12 @@ note may blow through before any work happens, and the plugin would refuse every
489
489
  the small-context hardware it targets. The header is a fixed cost to subtract, not a competitor for the
490
490
  index. Measure it once per generation and cache it.
491
491
 
492
+ The header bound is the last real request's **billed input**, not just its uncached part: the host reports
493
+ `inputTokens`, `cacheReadTokens` and `cacheWriteTokens` as DISJOINT arms whose sum is the prompt
494
+ (`@deepseek-ai/dsh-llm` `TokenUsage` contract), so admission subtracts all three (#395). Reading two of
495
+ three under-counts the header on exactly the turns that extend the prompt cache — the bound would stop
496
+ being conservative where conservatism matters most.
497
+
492
498
  The budget is enforced as a **preflight**: measure, then refuse with concrete numbers
493
499
  (`TOC 4,120 + note 2,800 = 6,920 > budget 5,750 (0.25 × (32,000 − 9,000))`) *before* creating any
494
500
  session. Never truncate to fit — a clipped handoff note is the lossy behaviour this plugin exists to
@@ -540,6 +546,44 @@ Two structural consequences:
540
546
  - **Append-only has no exceptions.** Nothing derived is written back into the store; the registry is the
541
547
  only mutable state, and it is a domain table designed for it.
542
548
 
549
+ ## The Goal Across a Renewal (#349)
550
+
551
+ An active goal is the one continuing intention a session has, and a child born at a renewal boundary does
552
+ not inherit it: `create_goal` requires a direct-human turn, and the child's first turn is
553
+ `plugin:dsh-chapters`. Before this, the objective stopped driving the work exactly where the plugin's own
554
+ promise begins, and AGENTS' rule to "carry the authorized outcome" was left to the model's prose.
555
+
556
+ **The rule now: carry the goal as text, and state aloud that it is not armed.** One selector
557
+ (`foldGoalFromLog`) folds the parent's durable `goal/change` events — operations `create`, `edit`, `pause`,
558
+ `resume`, `block`, `complete`, `clear`, with `{id, revision, objective, phase, maxGoalRounds, blockedReason}`
559
+ — and one renderer (`renderGoalCarriage`) emits the child's `## Goal (carried from the parent session)`
560
+ block: objective whole, revision, round cap, phase, the seq it came from, and the sentence that only a human
561
+ can re-arm. It sits with the plans block, **above** the fold, because an objective is the fact a child must
562
+ not reconstruct from recall.
563
+
564
+ Invariants this respects:
565
+
566
+ - **No goal, zero bytes.** Sessions that never used a goal get a byte-identical notice, which is also what
567
+ keeps recorded tapes unmoved. An empty section is treated as absent, not as an empty heading.
568
+ - **`clear` ends it; `complete` is reported as finished** and receives no re-arm instruction. A child must
569
+ not pick up a purpose the human closed, and must not be told to resume one that succeeded.
570
+ - **Unknown operations are ignored, not guessed.** If the host adds one, the fold keeps the last state it
571
+ understands rather than letting an unrecognized event rewrite the child's sense of its own objective.
572
+ - **The budget bounds display, never the instruction.** `goalNoticeChars` (default 600, host-declared and
573
+ defaulted on the plugin config — the #354 discipline) truncates the objective with the length stated;
574
+ the "only the human can re-arm" lines are never cut, because a truncated permission notice is worse than
575
+ none.
576
+ - **`phase` is foldable; `activation` is not.** The host keeps armed/disarmed process-local and the plugin
577
+ reads it from the live service for its own driver decisions, so the notice says who CAN change the driver
578
+ and never claims what the driver currently IS. Recovering armedness from history would be a guess in a
579
+ record's clothing.
580
+
581
+ **Deliberately not done, pending a maintainer decision (#349):** the underlying goal *service* has no
582
+ direct-human gate, so the plugin could arm a goal on the child unilaterally. Reaching a seam is not having
583
+ authority to use it; silently routing around a gate because the tool wrapper is the only thing enforcing it
584
+ is the kind of unexamined authority widening this whole release was a study in. If the answer is yes, it
585
+ becomes an explicit, documented, configurable step — not a side effect of the birth path.
586
+
543
587
  ## Storage
544
588
 
545
589
  Two stores because they have opposite requirements.
package/docs/backlog.md CHANGED
@@ -1,5 +1,15 @@
1
- # Open items — 2026-10-23 (host 0.2.0-rc.2)
2
-
1
+ # Open items — 2026-11-17 (host 0.2.0-rc.2)
2
+
3
+ - **0.2.34 SHIPPED (2026-11-17, main 2eee0b3, tag 0.2.34; tarball + provenance verified — see project-state). Follow-waves for 0.2.35 (2026-11-17 audit):** the composed checkpoint has never been OBSERVED on a live
4
+ host — the heavy leg's first sight, tracked as `docs/verify.md` C3, in the same family as #143's
5
+ convergence bound. The deprecated live reads (`eventAt`/`snapshotEvents`/`ownEvents` — the host says
6
+ "new calls are prohibited") are inventoried by `tests/unit/host-composer-shape.test.ts`; the migration
7
+ to `deriveMessages`/`requestHeader` (live) and `SessionQuery.readSession` (durable) is the first gate to
8
+ re-run before any host bump. #397 (`meta.parentSession` for continuation children) awaits a maintainer
9
+ decision on amending `docs/contract.md` § Lineage. #383 (#379) LANDED post-0.2.34 (PR #383, replay-green at current trunk — the held
10
+ re-record turned out to belong to the old base). #368 (#340) moved to **0.2.36** by maintainer decision of
11
+ 2026-11-17 with the `prompt`-leg re-record, which is gated on a rig that truly serves the pinned model
12
+ (see #406 — this box was measured silently aliasing it).
3
13
  - **#355 — the 2026-11-14 correctness audit: 24 issues filed for this audit (25 counting #386), 22 fixed across 24 PRs, released in 0.2.33.**
4
14
  Every finding was reproduced against real bytes before it was changed, and the shape they share is the
5
15
  release's subject: **a check that cannot fail**. Concretely: the preset-row health witness compared a
package/docs/contract.md CHANGED
@@ -1048,9 +1048,38 @@ gone.
1048
1048
  that removes the megabytes, not the milliseconds-squared, and it is a policy change to the director's
1049
1049
  input, so it is tracked separately rather than folded into a performance PR.
1050
1050
 
1051
- **Acceptance note, stated rather than quietly missed:** #350 asked for "< 50 ms at 800 chapters / 36 MB".
1052
- These changes deliver 136 ms, not 50 — and the gap is cause 3, not the search. Quoting the target as met
1053
- would make the number mean nothing.
1051
+ **Acceptance note, updated after #379 landed the cap:** #350 asked for "< 50 ms at 800 chapters / 36 MB".
1052
+ #350 alone delivered 136 ms; the same fixture measured **0.29 ms** once the chapter block was bounded
1053
+ (#379), because the remaining cost was constructing a document the cap now prevents. Both numbers are kept
1054
+ here rather than overwritten — the second only means anything against the first.
1055
+
1056
+ ### The chapter block is bounded, and the bound is not a recency ratio (#379)
1057
+
1058
+ The director's budget was `contextChars = floor(window × promptContextRatio × 4)`, so a 1M-token route
1059
+ allowed ~2,000,000 characters of auxiliary input to produce one sentence, with the newest human turn at
1060
+ roughly one character in two million — #7's third mechanism, the other two being #340 and #343.
1061
+
1062
+ `buildSuggestInput` now caps the chapter block at **both** a share of the budget
1063
+ (`DEFAULT_CHAPTERS_SHARE`, 25%) and an absolute ceiling (`DEFAULT_CHAPTERS_CAP_CHARS`, 200,000 chars
1064
+ ≈ 50K tokens). The joint constraint stays monotone in `drop`, so the #350 search still applies unchanged.
1065
+
1066
+ **Why an absolute ceiling and not a share of the document.** My first attempt bounded history *relative to
1067
+ the protected content*, which is the only frame in which "not crowded out" looks structural — and it
1068
+ measured the result: **the director's entire input collapsed to 2 KB.** The protected set is mostly fixed
1069
+ reply rules, so "25% of everything else" allowed about one chapter line: a perfect recency ratio obtained
1070
+ by deleting the context the director exists to weigh. The regression is now pinned by a row asserting the
1071
+ input still shows a real trajectory, so a future tightening that trades content for a ratio fails loudly.
1072
+
1073
+ Recency is instead protected by what genuinely protects it: the last turn enters **whole and is never
1074
+ sliced** (#188), every drop is **announced in the input**, and the block cannot exceed either bound.
1075
+
1076
+ **What is NOT done:** the share and ceiling are documented constants threaded as a parameter, not yet
1077
+ profile config keys. Surfacing them needs the #354 discipline (declare on the row, validate, print in
1078
+ `/chapters-status` which values are in force) — a knob nobody can see is how #354 drifted for months.
1079
+ Tracked on #379; the cap itself is enforced today.
1080
+
1081
+ Tape status: this changes the director's **request bytes** by design — one of the two items (with #340)
1082
+ that genuinely need the `prompt`-leg re-anchor before merging.
1054
1083
 
1055
1084
  ## Seeded-continuation load deadlock — the fold rule vs the header recorder (measured 2026-11-05, #314)
1056
1085
 
@@ -127,6 +127,19 @@ answers the question in exactly one place; two consumers use it:
127
127
  - `tests/e2e/boot.ts` **refuses replay by name** when `host` ≠ the pinned version, quoting the
128
128
  recorded `reason` and the tracking issue. `E2E_MODEL=record` is deliberately exempt — re-distilling
129
129
  is the way out, and a gate that blocked it would strand itself.
130
+ - **Model identity is proven before any mode that WRITES tape** (#406). `MODE=record` and `MODE=heal`
131
+ now assert, before boot: the upstream's `/v1/models` lists the pinned rig model id, **and** a chat
132
+ probe requested by that name comes back with the same id in the RESPONSE's `model` field. (Live mode
133
+ is deliberately outside the proof: boot never resolves an upstream for it — the host routes it — so a
134
+ guard would probe an endpoint live does not use. Live-class runs on an aliasing endpoint still observe
135
+ the wrong model; the defense there is this rig's own honesty, not a fetch.) The measured
136
+ incident: this box's vLLM silently answers `qwen3.8-flash-next` with `qwen3-4b-instruct` — sessions
137
+ ran, specs ran, and the run wrote fifteen tape entries shaped by the wrong model (raw `think` traces
138
+ as content) before two prompt-bar assertions caught it. An aliasing endpoint makes every recorded run
139
+ NOT evidence for the pinned rig model, so the refusal names what IS served instead of recording over
140
+ the corpus. `MODE=replay` never probes — CI runners have no 8080, and replay writes nothing.
141
+ The predicate lives once in `tests/support/model-parity.ts`; `E2E_UPSTREAM_MODEL` remains the
142
+ deliberate remap, honored only when that id is itself listed and proven.
130
143
  - `.github/workflows/ci.yml`'s `host-capability` job sets `corpus-anchored`, the `e2e-replay` job
131
144
  requires it, and the run log gets a step summary plus a `::warning::` naming the issue. Skipped,
132
145
  visibly — the same discipline as the preset-row refusal it sits beside: never silently green,
@@ -267,3 +267,27 @@ set read out of the affected production log (not an imagined shape), covering al
267
267
  `-degraded`, mixed, never-compacted, and no-provider-field; with an anti-vacuity control pinning that
268
268
  `scanChaptersSummaries` still sees only our own, so the two questions cannot be merged by someone
269
269
  "fixing" the silence in the wrong place.
270
+
271
+ ## The composer must speak the host's shape (#399, measured 2026-11-16)
272
+
273
+ Pressure compaction topic-splits the shadowed span only when `reconstructShadowedSeqs` maps the prepared
274
+ summarize region back onto durable seqs. Two host facts bind that mapping, both pinned against the installed
275
+ bundle (`@deepseek-ai/dsh-session` 0.2.0-rc.2):
276
+
277
+ - `SessionSurface.nodes` is a **plain seq array** (`readonly SessionSeq[]`, `lib/types/surface.d.ts:120`) —
278
+ numbers, not `{seq}` records. The `tokenMeter` measurement nodes have `.seq`; the surface nodes do not.
279
+ - `Session#deriveEventMessage` is a **class method** that resolves projections through `this`
280
+ (`lib/index.js:1576`) — captured into a local and called bare, it throws. Reading it as a value and
281
+ invoking `derive(ev)` is the same r28 defect wearing a different hat.
282
+
283
+ When either is violated the function returns "no match" and the engine falls to the legacy single-chapter
284
+ path — silently at first, because nothing throws. The mapping result is therefore **discriminated**
285
+ (`{ok:true,seqs} | {ok:false,reason}`) and the engine names the reason on every fallback:
286
+ `no-surface-api` and `ambiguous` are honest degradations (note level); **`no-match` is a drift alarm** (warn:
287
+ the region was present and nothing mapped). The composed checkpoint carries the same lead sections in the
288
+ same order as the legacy one — plan, rules, plot — so activating the composed path cannot silently drop the
289
+ plot the plugin just paid its bounded elicited call to produce.
290
+
291
+ Corpus consequence: the composed arm has never run against a real host, so recording it changes composed
292
+ checkpoint bytes for the first time when it activates. That is an activation, not a regression; the
293
+ legacy-only legs stay byte-identical by construction.
@@ -173,6 +173,12 @@ minus the text), `modeActive`, and `livePlans` — plans whose `seq > archiveCei
173
173
  precisely the mid-review case), explicitly labelled *not archived, parent log only*. Ranges stay the
174
174
  model's call and chapter text stays the plugin's (invariant 4); the model never guesses a verdict again.
175
175
 
176
+ **The ceiling is a fact about the CALLER's own log, in the caller's own seq space** (#396). Continuation
177
+ children restart their event numbering at 0, so a maximum taken across the ancestor path can exceed the
178
+ caller's live tail and silently reclassify a still-open plan as archived. The continuation notice applies
179
+ the same rule: its live/archived split is the caller's watermark (committed rows plus what this door is
180
+ about to commit), never an ancestry max.
181
+
176
182
  ### 6. Composition and titles
177
183
 
178
184
  - Forced split points: an `exit_plan_mode` call seq is a topic boundary — feed them to
@@ -11,6 +11,41 @@ history of a decision, not before every task.** The rules that lived inside it a
11
11
  ---
12
12
 
13
13
  ## Start Here
14
+ ## 2026-11-15 (later) — 0.2.33 is on npm: the release steps, and what they proved
15
+
16
+ **Executed:** PR #385 merged to `main` (`42d66c7`) -> annotated tag `0.2.33` pushed -> tag-triggered release run
17
+ `43753268463` green end to end -> `main` merged back into `staging` (`c7de7c0`).
18
+
19
+ **What the release job proved, in its own words rather than mine:**
20
+ - `version / tag consistency` passed — the tag string equals `package.json.version`.
21
+ - The deterministic suite ran under the **85/85/85/85 coverage gate on pinned Node 24** — the DoD line this
22
+ audit could never evidence locally (Node 22.22.1) is satisfied by CI, at the shipping commit.
23
+ - Publish carried a **sigstore provenance attestation** (logIndex 3909060018), so the documented 409
24
+ publish-without-attestation fallback was not needed this time. Worth stating because the fallback exists
25
+ precisely so that a transport collision cannot hold a release hostage — and a silent success would not
26
+ tell us whether it fired.
27
+ - **The published tarball was re-downloaded and unpacked: its `package.json` and `package/lib/version.js`
28
+ both read `0.2.33`.** That is the 0.2.20 class caught at the only point it can be caught — after
29
+ publication, from the registry, not from the working tree.
30
+
31
+ **Census after release, read back from GitHub rather than totalled by hand: 23 findings closed, 7 issues
32
+ open** — #335 (maintainer decision), #340 and #379 (built and green except the tape chain, held for one
33
+ `prompt`-leg re-record; the runbook is on #340), #349 (fallback merged post-cut, so 0.2.34; the rest needs a
34
+ live host and an authority decision), #372 (browser rig), #389 (the deferred corpus gate), and the umbrella
35
+ #355.
36
+
37
+ **Landed after the cut, therefore shipping in 0.2.34:** #391 (goal carried into the child's notice as text,
38
+ with the sentence that only a human can arm it), #392 (item Z's host-shape contract gate), #394 (#393's
39
+ tag-protection mis-attribution). None of them changes what 0.2.33 does; #394 in particular only corrects
40
+ comments in the release tooling plus adds a test that pins the real semver gate.
41
+
42
+ **One thing this release did not do, and should not be mistaken for having done:** the audit's own headline
43
+ finding — a check that cannot fail — was found **twice more in the release machinery itself** while cutting
44
+ this version (#386: the manual trigger published by default; #393: a claimed tag-protection rule that does
45
+ not exist on this repo). Both were fixed, one inside the release and one after it. The standing lesson is that
46
+ verifying "did the release run green" is not the same as verifying "does the guard it relies on exist", which
47
+ is the same distinction as testing a metric versus checking the mechanism behind it.
48
+
14
49
  ## 2026-11-15 — #355: the audit worked end to end, and shipped as 0.2.33
15
50
 
16
51
  **What was asked.** Deep-analyze the implementation, file the findings, fix them one at a time with tests
@@ -851,3 +886,114 @@ and that is stated wherever the claim is made. What the tape leg keeps is everyt
851
886
 
852
887
  Full chronology, measurements and which round proved what: **`docs/project-state.md`**.
853
888
  Next things to pick up: **`docs/backlog.md`**. Verification checklist: **`docs/verify.md`**.
889
+
890
+ ## 2026-11-16 — external context-handling audit: findings, two corrections, and what shipped
891
+
892
+ A full read of the plugin against the pinned harness (`node_modules/@deepseek-ai/*` 0.2.0-rc.2) and
893
+ `examples/cordis` produced five findings; four became issues and PRs, one died against a governing record:
894
+
895
+ - **#399 (the headliner, PR pending)** — `reconstructShadowedSeqs` assumed a host shape that does not exist
896
+ (`surface.nodes` read as `{seq}[]`; `deriveEventMessage` called unbound), so pressure compaction archived
897
+ ONE legacy chapter on every real host while unit rows stayed green against a stub of the invented shape —
898
+ the r28 lesson re-run inside the composer. The composed arm also dropped the plot section.
899
+ - **#395 (PR #400)** — the continuation budget's header bound read two of the three DISJOINT usage arms,
900
+ under-counting on cache-writing turns; now `input + cacheRead + cacheWrite`.
901
+ - **#396 (PR #401)** — two watermark derivations still used forms #336 retired (`tools.ts` two-clause,
902
+ `auto-save.ts` hand-rolled max), and the notice's live-plan ceiling took an ancestry-wide max over mixed
903
+ per-session seq spaces, silently dropping a pending live-tail plan. One predicate everywhere; scan-gated.
904
+ - **#398 (PR #402)** — the prompt bar's `planOf` read `row.planDocs`, a field that exists only on chapter
905
+ RECORDS (and without the full text `carryActivePlan` folds): the documented plan input was dead wiring.
906
+ Now folds `detectPlans(session.events)` exactly like the engine's checkpoint carry.
907
+ - **#397 — closed, NOT implemented.** The proposal (pass `meta.parentSession` at `agents.create`) collided
908
+ with `docs/contract.md` § "Lineage: Kernel Fields We Must Not Lean On": the header field is seed lineage
909
+ and the registry is the sole ancestry authority by recorded decision. Amending that is a maintainer call;
910
+ the issue carries the one-line change if the decision flips.
911
+
912
+ **Correction to the audit's own claims, measured after the fact:** it reported the e2e plane as "red — the
913
+ harness that could catch these bugs cannot compile." Wrong gate model: `scripts/e2e-typecheck-ratchet.sh`
914
+ baselines tests/e2e at 58 type errors by explicit decision (#83) and CI enforces NO-GROWTH; Playwright
915
+ transpiles specs without type-checking, and the tape-replay acceptance job runs ten real-host legs in CI
916
+ regardless. The debt is real and ratcheted; the claim that no real-host coverage exists was withdrawn.
917
+ Node-24 note for rigs: this box's system node is 22; the repo-vendored `var/toolchain/node-v24.22.0` is
918
+ what CI and the ratchet use, and the deterministic ledger (1,625+/1,631 with the five credential-gated
919
+ `live:` TreeDX rows the only non-passes) was run on it.
920
+
921
+ ## 2026-11-17 — 0.2.34 cut prepared from staging `9bab463`
922
+
923
+ The 2026-11-15/16 context-handling audit lands as **0.2.34**: #395, #396, #398, #399 (merged PRs #400–#403),
924
+ plus the corpus re-stamp #404 and the post-0.2.33 tail of the previous wave (#390, #391→partial #349, #392,
925
+ #394). Versions: `package.json` / `package-lock.json` root / `package-lock.json` `packages[""]` /
926
+ `src/version.ts` — all four at **0.2.34**, the agreement row in `tests/unit/release-gate.test.ts` green.
927
+
928
+ Verified at the integrated base `9bab463` before this branch: deterministic ledger 1,632/1,638 (5
929
+ credential-gated `live:` TreeDX rows, 1 `#314 WISH` todo); **full 11-leg tape-replay chain green on the
930
+ merged staging tree**, each leg under its own boot; `typecheck`/`typecheck:client` clean; ratchet 58=58;
931
+ `corpus:stamp` re-stamped on that green replay with `promptAnchor` unchanged — no re-record required by
932
+ anything in this range. The acceptance gate for the candidate itself remains this release PR's own
933
+ `acceptance — ten tape-replay legs` run: `ci.yml` triggers on `pull_request` and `push: [main]` only.
934
+
935
+ Open and named: `docs/verify.md` **C3** — no live-class run has yet OBSERVED a composed checkpoint (the
936
+ heavy leg owns that first sight, same family as #143's bound). #349 remains open (goal-carriage partial
937
+ landed via #391; the rig-dependent rest stands). The five `live:` TreeDX rows require credentials.
938
+ **#397 was closed by decision, not code**: passing `meta.parentSession` at `agents.create` collides with
939
+ `docs/contract.md` § Lineage ("seed lineage; the registry is the sole ancestry authority"); amendment is a
940
+ maintainer call and the issue carries the one-line change if it flips.
941
+
942
+ Maintainer direction recorded on 2026-11-17: **#383 (#379) and #368 (#340) are NOT in this cut** — they
943
+ roll into **0.2.35** along with the `prompt`-leg re-record that gates them.
944
+
945
+ The audit self-correction stays recorded above rather than edited away: the claim that "the e2e harness
946
+ cannot compile so no real-host coverage exists" was wrong — the ratchet baselines 58 errors by design and
947
+ the replay chain runs real boots regardless. Withdrawn where the findings are written.
948
+
949
+ ## 2026-11-17 — 0.2.34 SHIPPED
950
+
951
+ Released from `main` `2eee0b3` (merge of PR #405, verified head `e01282c`, tree-identical), tag **`0.2.34`**
952
+ (annotated, immutable, matching the manifest at all four version sites).
953
+
954
+ The release job's own gates (run `44051111647`, success): build → coverage-gated deterministic suite →
955
+ publish with `NPM_TOKEN` (Production) and OIDC provenance — the log carries `publish Provenance statement
956
+ published to transparency log` (sigstore logIndex 3944683270), the no-attestation fallback did not fire.
957
+ CI on the `main` push (run `44051010483`) — including the ten-leg tape-replay acceptance chain — success,
958
+ so the published content itself was replayed green.
959
+
960
+ Registry tarball check (the 0.2.20 dead-version class): `npm view @fractalsynapse/dsh-chapters@0.2.34`
961
+ resolves, `latest` points at it; unpacking the shipped tarball, `package.json` says **0.2.34** and
962
+ `lib/version.js` carries `PLUGIN_VERSION = '0.2.34'` — manifest and bundled bytes agree. The registry
963
+ attestation endpoint returns the publish bundle.
964
+
965
+ Closed at this cut: **#395, #396, #398, #399** (the 2026-11-15/16 context-handling audit fixes).
966
+
967
+ **Post-cut items heading for 0.2.35:**
968
+ - **#383 (#379 director-budget cap)** and **#368 (#340 suggestion freshness)** — the two held PRs, together
969
+ with the **`prompt`-leg re-record** that gates them (maintainer direction of 2026-11-17).
970
+ - **C3** (`docs/verify.md`) — the first live-host OBSERVATION of a composed checkpoint (heavy leg; same
971
+ family as #143's convergence bound). Deterministic + replayed evidence says the composer maps on the
972
+ real kernel class; the live sight is still owed.
973
+ - **#349** remains open past its shipped half (#391).
974
+ - **#397** awaits a maintainer decision on amending `docs/contract.md` § Lineage.
975
+ - The deprecated live reads (`eventAt`/`snapshotEvents`/`ownEvents`) — inventory pinned by
976
+ `tests/unit/host-composer-shape.test.ts` — are the first gate to re-run against any host bump;
977
+ `contract.md` is the measuring document.
978
+
979
+ ## 2026-11-17 — 0.2.35 cut prepared from staging `669d59d`; scope decided
980
+
981
+ Maintainer direction of 2026-11-17: cut 0.2.35 **early** with the two landed items — #379 (director
982
+ chapter-block cap, PR #383) and #406 (tape-writing model-identity guard, PR #407) — and move #340
983
+ (PR #368) to **0.2.36**. Recorded as a decision: #368 passes everything except its one gated item, the
984
+ `prompt`-leg re-record, which is blocked on an endpoint that truly serves the pinned rig model — the
985
+ defect #406 now refuses loudly instead of recording over it.
986
+
987
+ What the re-record attempt turned up is the release's real content: this box's endpoint was proven by
988
+ direct probe to SILENTLY ALIAS the pinned model name (requests for `qwen3.8-flash-next` answered by
989
+ `qwen3-4b-instruct`, raw `think` traces as content; fifteen tape entries contaminated and discarded,
990
+ corpus untouched). The guard, the single-source `RIG_MODEL_ID`, the field demo (refuse before boot, zero
991
+ bytes written), and the replay-inert proof (CI chain green with the guard present) all landed before
992
+ the cut.
993
+
994
+ Versions: all four sites at **0.2.35**; release-gate 6/6. Evidence at the pre-release base `669d59d`
995
+ was carried by #407's own four green CI jobs (including the ten-leg replay); this candidate re-runs
996
+ the full chain locally before its stamp commit. Named open, unchanged from 0.2.34: verify C3 (first
997
+ live observation of a composed checkpoint), #349 remainder, #397 contract decision, five credential-
998
+ gated TreeDX live rows, and #340 (its home is now 0.2.36, with this box's endpoint defect the thing to
999
+ fix or route around).
package/docs/verify.md CHANGED
@@ -77,6 +77,68 @@ result only for a live `Session`, so pin such claims in the leg or on a pure fun
77
77
  (b) a field printed from a config key the realm does not carry reads `?` forever — measure the shape you *read*
78
78
  (#153's `window=?`).
79
79
 
80
+ ### A quoted sample is a contract (#389)
81
+
82
+ When a page shows output and tells the reader to compare against it — `operations/install.md` does exactly
83
+ this, and adds that anything else is a named problem — the quoted string stops being prose and becomes an
84
+ interface. It then has two failure modes, and the second is worse: the code changes and the sample goes
85
+ stale (a correct install looks broken, which happened for the roster line's trailing clause, fixed in #388),
86
+ or **the check built to catch that cannot fail.**
87
+
88
+ So the standing rule, and `tests/unit/doc-line-contract.test.ts` enforces all of it:
89
+
90
+ - **Derive, or compare to the derived value.** The strongest form is what #388 did — export the function
91
+ that builds the line and have the test compose the documented sample from it. A general matcher is a
92
+ backstop, not a substitute.
93
+ - **Whole-line anchored, always.** Prefix matching structurally cannot see truncation, which is the exact
94
+ defect class.
95
+ - **Exclude vacuous patterns and say so out loud.** `dsh-chapters: ${m}` is a log wrapper, not a message;
96
+ as a matcher it accepts every line. The first version of this audit reported a clean zero-findings that
97
+ way, and the tell was a match attributed to the wrong file — a suspicious *attribution*, not a suspicious
98
+ count. The gate asserts the excluded set is non-empty and prints it on every run.
99
+ - **Plant the failure.** The gate must reject a fabricated line AND accept the real one; without both, a
100
+ zero means nothing.
101
+ - **Discover the corpus, do not list it.** A hand-written list of ten pages here contained two paths that
102
+ never existed, and its own completeness check caught that — walking the tree found 37 real pages instead.
103
+ A list narrows silently whenever anyone renames something.
104
+ - **Exclude history on purpose.** Changelog, project-state and backlog quote what older builds printed.
105
+ "Fixing" them would erase the record, which is why they are filtered by an explicit pattern rather than
106
+ omitted by silence.
107
+
108
+ Honest scope note: measured across those 37 current-state pages there are exactly **two** quoted
109
+ `dsh-chapters:` lines today, both in `install.md`, both matching. The value of the gate is prospective —
110
+ it is cheap insurance that the next quoted sample cannot drift the way this one did, and it is only trusted
111
+ because it demonstrably rejects a line that was never emitted.
112
+
113
+ ### Host-shaped readers are checked against the installed dist (#355 item Z)
114
+
115
+ AGENTS has the rule — *"Inspect actual host payload fields and use fixtures of the real shape"* — and this
116
+ release proved the rule right and the enforcement missing: a fixture hand-written in the shape the code
117
+ *expected* passes against a reader that cannot work on real bytes. Three separate findings were that bug
118
+ (#339's `fiberState` stubs, #345's block-level `isError`, #355's item Z list), and every fix so far was
119
+ case-by-case. The mechanical form of the rule is now `tests/unit/host-shape-contract.test.ts`, which parses
120
+ the **installed** packages and asserts both directions:
121
+
122
+ - **What the host declares.** `@deepseek-ai/dsh-llm`'s `ToolResultMessage` carries `isError?: boolean` at
123
+ **message** level, and the type surface contains **no block-level `isError` at all** — the fact that made
124
+ the old reader return false for 13 of 13 real failures. `cordis`'s `FiberState` is a **numeric
125
+ `const enum`** (`PENDING=0 … ACTIVE=2 … UNLOADING=5`), which is why comparing it to `'active'` is always
126
+ false — the #339 defect.
127
+ - **What our code does with it.** `src/log-shape.ts` must read the message-level field; `src/preset.ts` must
128
+ not compare `fiberState` to a string literal. A reader that silently stops matching the declared shape
129
+ fails here rather than in production.
130
+
131
+ Every assertion is **non-vacuous by construction**: the test requires the interface it searched for to have
132
+ been found (`throw` if absent), so a renamed type or a moved declaration fails the run instead of quietly
133
+ producing an empty match set — the failure mode that made this release's first version of the corpus gate
134
+ report a false all-clear. Versions are printed on each run, so a dependency bump shows up as changed facts
135
+ rather than a green suite.
136
+
137
+ What this does **not** claim: that every fixture is dist-derived. It pins the two host shapes this audit
138
+ actually got wrong, and the mechanism by which new ones can be added. The residual gap (a fixture for some
139
+ other host field, unverified) stays open on #355 item Z rather than being ticked by the existence of this
140
+ file.
141
+
80
142
  ### Correctness Checks
81
143
 
82
144
  | # | Check | Procedure | Passes when |
@@ -565,3 +627,11 @@ which 483 `test-litter` and 143 `empty-artifact`. Registry backups sit at
565
627
  | # | Claim | How it is verified | Result |
566
628
  |---|---|---|---|
567
629
  | B1 | A `persisted off` cannot strand the bar across a reload (#272/#276) | Browser leg `tests/e2e/prompt-off-revival.spec.ts`, its own boot (`prompt-revival`, port 41743 — measured reason in rig-pins: as the fifth session on the prompt boot it destabilized new-session creation for every spec): carry a session to a ready offer, seed a stale `off` mirror via `addInitScript` so it pre-dates all app JS, reload, and require (a) the bar visible and (b) the dock's `__dshPromptReply` seam showing the wire answered `suggested next step: …` — a veto never pulls, so an empty seam or missing bar fails the leg | **PASS** — recorded on the scripted stub (3 entries, own boot 41743), `prompt`+`prompt-off`+`prompt-revival` replay green model-free each under its own boot; mutation-proof: restoring the pre-#272 `off`-veto reddens EXACTLY this leg (`expect(locator).toBeVisible` — the veto never pulls), the canonical runner restores green. Local record needs `CHOKIDAR_USEPOLLING=1` on this box: 128 inotify instances are machine-exhausted (real ENOSPC, unrelated to the leg; CI runners never hit it) |
630
+
631
+ ## The compaction composer on the real host's shape (#399, measured 2026-11-16)
632
+
633
+ | # | Claim | Class | How it is verified | Result |
634
+ |---|---|---|---|---|
635
+ | C1 | `reconstructShadowedSeqs` maps the summarize region against the ACTUAL host surface shape (plain-seq nodes, bound `deriveEventMessage`) | deterministic + pinned-host replay | `tests/unit/host-composer-shape.test.ts` row 1 hands the composer a session built by the INSTALLED `dsh-session` class (`Session.create`, RUN/SKIP-guarded); row 2 pins the host `.d.ts` source text; `tests/unit/engine-core.test.ts` fakes now wear the host shape (unbound `derive` throws); `engine-lifecycle` drives the real `summarize()` over two stored topics and demands a ≥2-chapter manifest + carried plot | **PASS** — red before the fix (proven at the test commit), green after; full deterministic ledger 1,627/1,633 with only the five credential-gated `live:` TreeDX rows non-passing |
636
+ | C2 | Activating the composed path churns NO committed tape | pinned-host tape replay | Full chain: `E2E_MODEL=replay bash scripts/ci-replay.sh` (11 legs, own boot each); durable-log sweep: all 25 session logs in the run's homes grepped for `compaction/summary` | **PASS** — chain green; **zero** compaction events exist in ANY replayed durable log (the compaction-heavy `heavy` project is the live class, never replayed), so no recorded bytes can depend on the composer; `npm run corpus:check`: corpus matches the build (promptAnchor unchanged); e2e typecheck ratchet 58=58 |
637
+ | C3 | A real-host pressure compaction now COMPOSES (multi-chapter checkpoints converging on the 32K window) | live provider | The `heavy` live leg (its bound is #143's open row, and it was already failing its own bound BEFORE this change) | **OPEN** — deliberately unclaimed: this change makes the composed arm reachable and gives operators a named `reason=` line per fallback, but no live run has yet observed it. The claim stands unverified until the heavy leg is next run on a live model. |
package/lib/auto-save.js CHANGED
@@ -29,6 +29,7 @@ import { CHAPTERS_PRESET_ID } from "./preset.js";
29
29
  import { diagnosticWarn } from "./diag.js";
30
30
  import { formatWarnings } from "./warnings.js";
31
31
  import { isActiveChapter } from "./registry.js";
32
+ import { nextUnarchivedSeq } from "./render.js";
32
33
  import { saveSession } from "./save-core.js";
33
34
  import { lineageOf } from "./types.js";
34
35
  const hasCompletedTurn = (events) => events.some((e) => e.type === 'turn/end');
@@ -230,7 +231,9 @@ export function makeChildArchiveListener(deps) {
230
231
  // live turn boundary.
231
232
  const store = await deps.store();
232
233
  const state0 = await store.get(id);
233
- const lastArchived = state0.chapters.reduce((m, c) => Math.max(m, c.endSeq), -1);
234
+ // #396: the ONE watermark predicate. (This line used to hand-roll the max, seeded -1 —
235
+ // equal in value, second in count, and exactly how #336's two derivations drifted.)
236
+ const lastArchived = nextUnarchivedSeq(state0.chapters) - 1;
234
237
  const completed = events.filter((e) => e.type === 'turn/end' && e.seq > lastArchived && e.seq <= anchor).length;
235
238
  const gate = shouldForceChildArchive({
236
239
  header,
@@ -1 +1 @@
1
- {"version":3,"file":"auto-save.js","sourceRoot":"","sources":["../src/auto-save.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,WAAW,EAA0B,MAAM,gBAAgB,CAAA;AACpE,OAAO,EAAE,SAAS,EAAyB,MAAM,YAAY,CAAA;AAuC7D,MAAM,gBAAgB,GAAG,CAAC,MAAmC,EAAW,EAAE,CACxE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,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AG,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,0BAA0B,EAAE,cAAc,OAAO,EAAE,CAAC,CAAA,CAAC,CAAC;KACxG,CAAC,CAAA;AACJ,CAAC"}
@@ -66,6 +66,10 @@ export interface ContinueConfig extends RenderConfig {
66
66
  * this existed — which is what keeps the model tapes matching.
67
67
  */
68
68
  plansInNotice?: boolean | undefined;
69
+ /** #349: carry the parent's goal into the child's notice (default on). */
70
+ goalInNotice?: boolean | undefined;
71
+ /** #349: budget for the objective text in the notice; the instruction lines are never cut. */
72
+ goalNoticeChars?: number | undefined;
69
73
  /**
70
74
  * Teach a child HOW to look things up, not only what was archived (findability
71
75
  * audit, 2026-10-11). The index answers questions about every kind — chapters,
@@ -184,6 +188,17 @@ export declare function assembleNotice(input: {
184
188
  * approved or re-plans from recall. Absent/empty => zero injected bytes.
185
189
  */
186
190
  plansSection?: string;
191
+ /**
192
+ * #349 (conservative slice): the parent session's GOAL, folded from its durable `goal/change` events
193
+ * by `foldGoalFromLog`, rendered by `renderGoalCarriage`. Placed with the plans block, above the fold,
194
+ * because an objective is the fact a continuation must not re-derive from recall.
195
+ *
196
+ * This STATES the goal; it does not create or arm one in the child. The host requires a direct human
197
+ * turn for `create_goal` (`requireDirectHuman`), and #349 reserves plugin-authored goal creation as a
198
+ * maintainer decision — so the block says plainly that only the human can re-arm. Absent/empty => zero
199
+ * injected bytes, which is what keeps ordinary sessions' notices and recorded tapes untouched.
200
+ */
201
+ goalSection?: string;
187
202
  retrievalHints?: boolean | undefined;
188
203
  }): string;
189
204
  /** The budget formula with its refusal numbers, kept apart for direct testing. */
@@ -232,10 +247,10 @@ export declare function archivedPlanRows(records: readonly ChapterRecord[], entr
232
247
  * unfinished turn, and the archive ceiling is completed turns only, so it is in no
233
248
  * chapter and no artifact (docs/plans-carriage.md § 5). The child must still be
234
249
  * told it exists, and told plainly that it was never approved.
250
+ * #396: `callerCeiling` is the CALLER's own archive boundary in the caller's seq
251
+ * space — never a max taken across the ancestry path.
235
252
  */
236
- export declare function livePlanRows(events: readonly SessionEventLike[], watermark: number): NoticePlan[];
237
- /** The highest seq any cited chapter covers — the boundary between stored and live. */
238
- export declare const archiveWatermark: (records: readonly ChapterRecord[]) => number;
253
+ export declare function livePlanRows(events: readonly SessionEventLike[], callerCeiling: number): NoticePlan[];
239
254
  /** Fields both continue and fork need to create the child. */
240
255
  export type FinishArgs = Pick<ContinueArgs, 'callerSessionId' | 'callerPreset' | 'title' | 'handoffNote' | 'projectLine' | 'rulesSection' | 'intent'>;
241
256
  /**
@@ -4,7 +4,10 @@ import { attemptKey, coverage, verifyChapter, writeArchive } from "./archive.js"
4
4
  import { appendChapters, freshSession, isActiveChapter, linkChild, reserve, reservePlan as reservePlanNumber } from "./registry.js";
5
5
  import { buildTocNotice, noticeAuthoredText } from "./notice.js";
6
6
  import { deriveIdentity } from "./engine-core.js";
7
- import { buildPlansSection, detectPlans, PLAN_MODE_EVENT } from "./plans.js";
7
+ import { PLAN_MODE_EVENT, buildPlansSection, detectPlans } from "./plans.js";
8
+ // #349: the goal fold and its notice block live in their own module (goal-carriage.ts), so the
9
+ // one-selector-one-renderer rule is checkable in one file rather than spread across plans.ts.
10
+ import { foldGoalFromLog, renderGoalCarriage } from "./goal-carriage.js";
8
11
  export class Refusal extends Error {
9
12
  result;
10
13
  constructor(result) {
@@ -19,6 +22,7 @@ export function assembleNotice(input) {
19
22
  ...(input.projectLine !== undefined && input.projectLine !== '' ? ['', input.projectLine] : []),
20
23
  ...(input.rulesSection !== undefined && input.rulesSection !== '' ? ['', input.rulesSection] : []),
21
24
  ...(input.plansSection !== undefined && input.plansSection !== '' ? ['', input.plansSection] : []),
25
+ ...(input.goalSection !== undefined && input.goalSection !== '' ? ['', input.goalSection] : []),
22
26
  '',
23
27
  'This session continues an archived conversation. Chapters are verbatim Markdown in the workspace;',
24
28
  'every byte remains retrievable — inline, or at artifact paths cited inside a chapter. Read a chapter',
@@ -306,21 +310,26 @@ export function archivedPlanRows(records, entries) {
306
310
  * unfinished turn, and the archive ceiling is completed turns only, so it is in no
307
311
  * chapter and no artifact (docs/plans-carriage.md § 5). The child must still be
308
312
  * told it exists, and told plainly that it was never approved.
313
+ * #396: `callerCeiling` is the CALLER's own archive boundary in the caller's seq
314
+ * space — never a max taken across the ancestry path.
309
315
  */
310
- export function livePlanRows(events, watermark) {
311
- return detectPlans(events, { ceiling: watermark }).plans
316
+ export function livePlanRows(events, callerCeiling) {
317
+ return detectPlans(events, { ceiling: callerCeiling }).plans
312
318
  .filter((p) => !p.archived)
313
319
  .map((p) => ({ title: p.title, status: p.status, seq: p.seq }));
314
320
  }
315
- /** The highest seq any cited chapter covers — the boundary between stored and live. */
316
- export const archiveWatermark = (records) => records.reduce((m, r) => Math.max(m, r.endSeq), 0);
317
321
  /** Shared tail of both flows: notice -> budget gate -> create (invariant 2) -> commit. */
318
322
  async function finishChild(ports, config, args, callerState, bundle, warnings, commitRecords) {
319
323
  // ---- The plans block: stored facts + whatever the caller's live tail holds.
320
324
  // Empty list ⇒ '' ⇒ zero injected bytes (the tape-safety property, verify.md P8).
321
325
  const intent = args.intent ?? 'continue';
322
- const watermark = archiveWatermark(bundle.records);
326
+ // #396: the live/archived split is a statement about the CALLER's log, in the CALLER's seq space.
327
+ // Continuation children restart event numbering, so an ancestry-wide max (the retired
328
+ // archiveWatermark) can sit above the caller's live tail and silently reclassify an open-tail plan
329
+ // as archived (plans-carriage § 5). The ceiling is the caller's own watermark — its committed rows
330
+ // plus the records this door is about to commit, all author-tagged in the caller's space.
323
331
  const callerEvents = await ports.readCallerEvents();
332
+ const ownCeiling = Math.max(nextUnarchivedSeq(callerState.chapters) - 1, ...commitRecords.map((r) => r.endSeq));
324
333
  // The parent's CURRENT mode, folded last-value-wins exactly like the host
325
334
  // projection does. Measured against the installed kernel (docs/plans-carriage.md
326
335
  // § 10): the host's plan projection folds a seeded `plan/mode` to `active: true`, so the
@@ -336,7 +345,13 @@ async function finishChild(ports, config, args, callerState, bundle, warnings, c
336
345
  : [];
337
346
  let plansSection = '';
338
347
  if (config.plansInNotice !== false) {
339
- plansSection = buildPlansSection([...archivedPlanRows(bundle.records, bundle.entries), ...livePlanRows(callerEvents, watermark)], { modeActive, intent, seeded: seedMode });
348
+ plansSection = buildPlansSection([...archivedPlanRows(bundle.records, bundle.entries), ...livePlanRows(callerEvents, ownCeiling)], { modeActive, intent, seeded: seedMode });
349
+ }
350
+ // #349: the goal is folded from the CALLER's durable events, not read from a goal service — the realm
351
+ // has no such service and, per #360's lesson, a module-level cache would not cross the plane anyway.
352
+ let goalSection = '';
353
+ if (config.goalInNotice !== false) {
354
+ goalSection = renderGoalCarriage(foldGoalFromLog(callerEvents), config.goalNoticeChars ?? 600);
340
355
  }
341
356
  // ---- Notice text, then the budget gate (measure the WHOLE notice).
342
357
  const noticeText = assembleNotice({
@@ -349,6 +364,7 @@ async function finishChild(ports, config, args, callerState, bundle, warnings, c
349
364
  ...(args.projectLine !== undefined ? { projectLine: args.projectLine } : {}),
350
365
  ...(args.rulesSection !== undefined ? { rulesSection: args.rulesSection } : {}),
351
366
  ...(plansSection !== '' ? { plansSection } : {}),
367
+ ...(goalSection !== '' ? { goalSection } : {}),
352
368
  retrievalHints: config.retrievalHints !== false,
353
369
  });
354
370
  // Built-then-measured, as above: the budget gate sees the authored bytes, not a draft.