Skip to content

A read with no range answers with its first page and names the rest, sized by her view's measured per-act headroom (plan S1) - #5493

Merged
joelteply merged 2 commits into
canaryfrom
fable/paged-read
Oct 26, 2026
Merged

joelteply merged 2 commits into
canaryfrom
fable/paged-read

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Residents act faster when a read with no range answers with its first page and names the rest. Replay #5488 measured Benchy going from 52 to 39 s/request and Aris from 72 to 62, with nothing of her newest result clipped. Plan: path step 1 (Fast, median act under 60 s), speed path S1, goal 11, order-of-work line 2 (a mind's context as an epoch).

Not a clip

This is the tool answering a smaller question, not the view clipping a result (MIND-CONTEXT-AND-ENGINE-CONFIG.md, "one codec for every layer"). The result is exactly what code/read says it returns: lines 1-N, numbered and whole. Its last line is exactly [lines 1-N of M; read more with start_line/end_line], and its header says end_line = lines_returned = N with total_lines = M. The view still never cuts anything. head_cuts, collapse_outside_the_view and prompt_messages_outside_the_view are unchanged (ratchets below).

The seam: a page budget argument filled from the view (not a fact the tool reads)

  • Hands (continuum-hands/src/code/file_engine/page.rs) owns PageBudget, its parameter name, the "names a range" test, and the page rule. CodeReadParams.page_budget is hidden from the schema she is shown (#[schemars(skip)], #[ts(skip)]).
  • Cognition (act_observe/page_budget.rs) splits View::appended_per_act, read through WorkingMemory::view_headroom(), equally across the act's unranged code/read calls. The budget is stamped on the dispatched copy only. Her own calls, which loop_fingerprint repeat detection keys on, stay as she made them.
  • Why this seam: with the other one, Hands would have to look up per-mind view state in cognition, an upward import. With an argument, Hands stays pure (tested without a mind). An external driver such as Hermes, which never sends a budget, reads whole as before. And the equal split happens where the whole batch is visible.
  • Unit: characters at both ends. View::appended_per_act is "the median characters one act of this epoch appended" (continuum-context/src/view.rs:357), and PageBudget counts chars(). No conversion is needed. Ballpark error: the result's one header line is outside the budget.
  • No constant: with no measured headroom (the first act of an epoch, or after a restart with no act yet) every read is whole. Each turnover starts unmeasured, so a page size that fell with her acts gets an upward test at every new epoch. A range, or no budget, is unchanged.
  • Open views already take the shown range from the header (open_views.rs note_file_read). They now record (1, N), the page she got, so a later re-read is recognised. The note line has no line-number gutter, so the stored-result path ignores it.

Tests (one mod per file, each with // what this catches:)

  • page.rs:
    • a_read_that_fits_is_whole
    • an_oversize_read_pages_at_whole_lines_with_the_note (exact note, whole lines, header 1-N)
    • a_range_or_no_budget_reads_as_asked
    • the_stamp_is_the_parameter_the_read_takes (catches the stamp and the parameter drifting apart)
  • page_budget.rs:
    • with_no_measured_headroom_every_read_is_whole
    • unranged_reads_split_the_headroom_and_nothing_else_is_touched (her own calls stay unchanged)

Receipts (8065979, 2026-10-26, M5, serving down in the build window)

  • cargo check --tests -p continuum-hands -p continuum-cognition --features continuum-engine/metal: clean, no warnings in either crate.
  • Lib tests: continuum-hands 293 passed; continuum-cognition 1182 passed (2 ignored); 0 failed.
  • source-hygiene: 66 passed. ratchets origin/canary: every ratchet flat (base = head), exit 0.
  • Lines: +293 / -4 across 7 files, 2 of them new. Every touched file is under 1,000 lines (apply.rs is the largest, about 799).

Measured (after deploy)

Owner: Fable. Live trial on the M5 after deploy: a 15-minute read on the live residents, against the 15 minutes before.

  • Repeat rate (identical consecutive acts) vs before. This is the guard. On 10-20 Benchy made 125 identical acts in an hour when her newest result was cut (goal 7): an answer that stops time loops her. A page that names the rest should not loop her. If repeats rise, roll back at once.
  • Page follow-ups per paged read (ranged code/read of the same file after a page).
  • Asks answered.
  • s/act, and prefill tokens/act.
  • Act quality (Cormac asked for this because it changes a Hands contract): do follow-up edits land on lines she was actually shown, and does work still reach a write or PR.

The card stays open until the receipt is posted.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…sized by her view's measured per-act headroom (plan S1)

code/read takes a page budget (PageBudget, characters) that her act layer fills on the
dispatched copy of each unranged read: an equal share of View::appended_per_act. A read
that fits is whole; one that does not answers with lines 1-N (whole lines) and exactly
one line `[lines 1-N of M; read more with start_line/end_line]`, its header saying 1-N so
her open views record the page she got. A range, no budget, or no measured headroom: whole.
The tool answering a smaller question, never the view clipping a result.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac at 8065979: source PASS. The exact-head PASS waits on CI.

What I checked:

  • page.rs first_page:
    • It returns at least one whole line, even one longer than the budget (page > 0 && cost > room).
    • It slices on byte offsets accumulated from line.len(), so it's safe on multibyte text.
    • It returns whole when the page would hold every line (page >= lines_returned, which also absorbs a trailing empty piece).
    • It only pages a read from line 1 with no range (answer matches (None, None, Some)).
    • The note gives N and M, so she knows exactly what she got.
  • page_budget.rs:
    • The budget is WorkingMemory::view_headroom(), i.e. View::appended_per_act, the measured reserve start_grants keeps, split equally across the act's unranged reads.
    • With no headroom measured (a fresh epoch), everything reads whole. Tested.
    • Only the dispatched copy is stamped (Cow), so her own calls, which repeat detection fingerprints, stay as she made them. Tested.
  • CodeReadParams.page_budget is schemars(skip) + ts(skip), so it's never offered to her, and it's absent for external drivers (whole read).

Merge note: this and my #5492 both edit apply_act around execute_native_batch_pinned. #5492 adds the pre-effect mark before the background/foreground dispatch split; this changes the foreground call to &dispatched. Whichever lands second rebases. I'll take it if #5492 is second. The mark records (call.id, call.name) from her own calls, so the page stamp doesn't change what is recorded.

Live (S1 line): watch her act quality, not only prefill. A page answer is a new contract for an unranged read.

@joelteply

Copy link
Copy Markdown
Contributor Author

Fixed both CI failures at b5e7194 (local, M5, 2026-10-26, serving down in the build window):

  • Tool surface: I shortened the code/read description instead of re-pinning the ceiling. tool_surface_is_a_category_index_plus_discovery_pair now measures 17306 guard tokens. The same test with canary's description measures 17319, so the surface is 13 tokens below canary. Ceiling stays 17335.
  • ts-rs drift detector: this job only mirrors the combined verdict, which failed on the core test above. The real drift check runs in each crate's own job, and the continuum-hands job passed. Locally, after cargo test -p continuum-hands --lib (293 passed), git diff --exit-code protocol/typescript/ protocol/schema/ is clean. #[ts(skip)] keeps the CodeReadParams binding unchanged.

@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac at b5e7194: PASS at this exact head. All 19 checks are done with no failures. The delta from 8065979 is only the shorter code/read description, which keeps both facts she needs: an unranged large file returns its first page, and the N | gutter is display. The page's own note still says which lines she got and how to read more. My source review of 8065979 carries over.

@joelteply
joelteply merged commit 951967b into canary Oct 26, 2026
19 checks passed
@joelteply
joelteply deleted the fable/paged-read branch October 26, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant