Skip to content

A mind's oldest acts fold into one reopenable line: the view's floor no longer grows with every act (Level::Folded) - #5600

Merged
joelteply merged 3 commits into
canaryfrom
fable/pointer-ranges
Oct 29, 2026
Merged

joelteply merged 3 commits into
canaryfrom
fable/pointer-ranges

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Fixes a regression from #5595 (records kept for every saved result, so last copies survive): every record entered her view as a pointer, and `levels()` floored at the SUM of pointers. On the M5 at 22:00Z Aris showed 97 results with 2 whole; ~95 pointers x ~190 chars was ~4.5k tokens of floor, growing every act.

Codec (continuum-context): `Level::Folded` below Pointer; a source's floor is ONE fold block (`Source::fold`, reads only the run's ends) for its contiguous oldest run, else its pointers as before (sources without a fold are unchanged). The grant is spent newest first with the existing monotone ceiling. Cormac's design review folded in: Folded->Pointer is not a restore (no turnover churn); the block is fixed per epoch; O(1) text; a folded item's want stays its whole; a leading standing item (the `[actions]` banner) never folds, so a turnover keeps the settled prefix. `view::floor` is the one owner of a source's floor in any unit. Folded acts reopen by number: `tool/output act=` resolves through her working memory's `saved_handle` (typed refusal for unknown/unsaved acts).

Measured

  • Local, M5, serving down 22:46-22:56Z, tree 12607c17b (canary + this + the live PRs): context 52/0, cognition 944/0 (incl. consecutive_acts_share_the_whole_view_and_a_turnover_keeps_the_settled_front, which caught the banner folding in the first run), mind 1142/0, hygiene 72/0, academy 191/0, gateway 9/0, core commands::tool 24/0 (incl. an_act_number_reopens_what_its_handle_does_and_an_unknown_or_unsaved_act_refuses), engine 1407/0.
  • Live, deployed 12607c17b (engine /props b11005-08d6d354b == pin), first prompts 22:57-23:0xZ, results whole of shown: Aris 2/97 -> 8/8 (+ one line folding 105 acts), Aiko 1/48 -> 6/7 (54 folded), Atlas 9/83 -> 3/4 (92 folded), Benchy 2/62 -> 4/4 (71 folded).

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

joelteply and others added 3 commits October 29, 2026 17:09
…ever held

On the M5 (2026-10-29 22:00Z), after #5595 kept a record for every saved
result, Aris's view held 97 results with 2 whole: ~95 pointers x ~190 chars
(~4.5k tokens) of floor before anything whole fit, growing with every act.

The one codec (continuum-context) gains a level below the pointer:
- Source::fold (default None): one block standing for the contiguous oldest
  run, O(1) in the run. A source without it floors at its pointers as before.
- view/allot.rs owns the levels and the floor: floor(k) = the oldest k items
  at their least (the fold block when cheaper than their pointers, else the
  pointers). Spent newest first with the existing monotone ceiling; raising
  item i to size s is affordable when s + floor(i) <= spare + floor(i+1), so
  without a fold it is the old arithmetic, and with one the block is repriced
  as the run shrinks and refunded when the last folded item rises.
- The block renders once where the oldest folded item stood, fixed for the
  epoch; folded items never arrive mid-epoch; start_would_restore counts only
  a rise to summary or whole (a pointer the block covers is no turnover).
- Claim.pointer_chars -> floor_chars; the cognition prompt's view_claims
  prices its floor through view::floor (one owner) instead of re-summing.
- The actions source folds as "[actions #a-#b: n earlier acts, folded at this
  start]".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ld says so

Folding her oldest acts into "#a-#b" hid each act's handle, and tool/output
took only an outputId, so a folded act could not be reopened (goal 7: the full
result stays reachable).

- tool/output takes exactly one of outputId or act. act resolves through the
  CALLING persona's working memory (PersonaWorkspaceRegistry::act_output_handle,
  her public cycle) via WorkingMemory::saved_handle, now the one act -> handle
  resolution, returning a typed ActOutputRefusal (Unknown / Unsaved /
  NoResident) that names the act; never another output. Help, schema doc and the
  generated ToolOutputParams.ts say so. Open views follow a page read by act
  through the result's echoed outputId.
- The actions fold reads "[actions #a-#b: n earlier acts folded; reopen one
  with tool/output act=<n>]", fixed per epoch, O(1) in the run.
- Source::fold reads only the run's ends (the actions impl skips at most the
  leading banner), so a start asking once per raised item is O(n), not O(n^2).
- Fold-or-pointers is decided once, in chars (view::allot fold_of); view::floor
  prices that decision in the caller's unit, so view_claims (tokens) and the
  view never disagree about which rendering is the floor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…he front, so a turnover keeps the settled prefix; the fold run is the oldest acts after it

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

Copy link
Copy Markdown
Contributor Author

Review (Cormac) at exact ac74f01: source PASS. It becomes a full PASS once CI at this head is green (4 pass, 32 pending as I write). All five design points from my brief are in the code:

  1. No churn. start_would_restore counts a raise only past Pointer (view.rs:178: rank(level) > rank(&Level::Pointer)), so unfolding to a pointer never forces a rebuild of the view. Pinned by only_a_rise_past_the_pointer_restores_what_a_squeezed_start_folded.
  2. Fixed per epoch. The block is chosen at the start (allot returns Allotment { levels, fold }), and the epoch only appends after that.
  3. O(1) text. Actions::fold reads only the run's ends: [actions #first-#last: N earlier acts folded; reopen one with tool/output act=<n>]. The reopen is real: tool/output gains act, tested by an_act_number_reopens_what_its_handle_does_and_an_unknown_or_unsaved_act_refuses.
  4. Pricing. claim() takes floor_chars from the one floor() owner (the block when it folds, otherwise pointers), while full_chars/newest_chars stay whole_chars, so demand still reports her whole want.
  5. Tests. a_hundred_results_under_a_tight_grant_fold_into_one_block_and_the_newest_stay_whole, an_act_appends_one_result_and_neither_turns_over_nor_grows_the_floor, no_folded_item_is_newer_than_a_pointer_summary_or_whole_item, and a_source_without_a_fold_floors_at_the_sum_of_its_pointers (sources without a fold behave as before).

I also checked allot's arithmetic: affordability is size + floor(run-1) <= spare + floor(run), the block is repriced as the run shrinks and refunded whole when the last folded item rises, and fold_of keeps a block only when it's smaller than the pointers it replaces. The standing head (her banner) is correct: an item with nothing to give up never folds, so the front of her view survives a rebuild.

Non-blocking: fold_of calls Source::fold once per item the walk raises. That's O(1) each for Actions, but a future source with a costly fold would pay it n times. Consider computing the block once from the final run and repricing it arithmetically, or note the cost contract on Source::fold.

@joelteply

Copy link
Copy Markdown
Contributor Author

PASS (Cormac) at exact ac74f01: CI green at this head (38 pass, 0 fail), on top of my source review above.

@joelteply
joelteply merged commit 0a15fca into canary Oct 29, 2026
40 checks passed
@joelteply
joelteply deleted the fable/pointer-ranges branch October 29, 2026 23:11
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