Repository navigation
Collapse depth from her measured re-read cost: a turnover collapses what she won't need again - #5806
Merged
Merged
Conversation
joelteply
force-pushed
the
fable/collapse-depth
branch
from
November 6, 2026 23:19
af67275 to
a449511
Compare
…er measured re-read cost Her view now measures how often she asks again for what she already observed (continuum-context rereads.rs, kept in Motion with the per-source stats #5803/#5805 keep): at every act each observing occurrence is exposed at its age in acts, and an arrival with the same request fingerprint and outcome hash is a re-request at that age, tallied over every level and over collapsed ones separately, halved at each start. depth.rs chooses each instrumented growing source's start: walking its items newest first, an item stays whole only while hazard x whole x (1 + (S-C)/(W-S)) exceeds the turnover miss it saves, miss(S) = g (S-C)/(W-S). An age nobody was exposed at, a source whose items carry no act, or no measured growth is Unmeasured and keeps the half rule. start_grants (cognition) applies the chosen shares and probes delib.view.depth. Replay (--append-tail 144 --measured-depth, 15 captures, deliberation + act): 8,478,327 -> 8,395,003 prefill tokens (-0.98%), 3 fewer turnovers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
force-pushed
the
fable/collapse-log-placement
branch
from
November 7, 2026 03:28
f35ab53 to
4fcde58
Compare
joelteply
force-pushed
the
fable/collapse-depth
branch
from
November 7, 2026 03:28
a449511 to
f8d5aaa
Compare
… what its lowered grants hold The depth prices each growing source's base (her floor with her newest item whole) in rounded tokens; #5807's StartSource::newest prices her newest item ceiled. Lowering a grant to the depth's share, and sizing the start to the depth's own sum, could leave her one token under her newest item: the failure #5807 fixed (her newest turn collapsed by a char), reached again through the measured depth. - depth_grant (epoch.rs): THE rule for how a measured depth lowers a grant: to the chosen share, never below the floor or her newest item, never above the plan's grant. - The growing start is the sum of the lowered grants, never chosen.start (probed beside it as chosen_tokens on delib.view.depth). Test (prompt/epoch/tests.rs, the file's one test mod): a_measured_depth_never_starts_her_under_her_newest_item. A 501-char newest item at 0.01 tokens per char (6 ceiled) whose depth base rounds to 5: - the guard on the grant alone (the previous head): granted 500 of 501 chars, FAILED; - the start from the lowered grants without .max(source.newest): 500 of 501, FAILED; - both: passed; continuum-cognition --lib 954 passed, 1 ignored. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… first held it Codex on #5806: depth::collapsible aged an item by how many newer items its source held while Rereads bucketed its hazard by acts since birth, and prime reconstructed that birth as acts minus the newer-item count. A source idle for eight acts priced a 9-act-old item at age 1; a source that appended three items in one act read them as three ages. Now Rereads records each occurrence's birth act where it enters (an arrival at act(), what a start finds at prime), keeps the births with her view (serialized; drained at each start to what the sources still offer), and answers Rereads::age(id) from them. depth reads that age, so both read one clock; prime rebuilds the index from recorded births, never from position, and the first act after a restart ticks the clock like every other. The seen set is gone: the births map is it. depth::collapsible takes the measurement by reference (a view-less claims() passes a fresh clock), so no Option stands in for a missing clock. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Motion.epoch_acts counted every act beside Rereads' clock, and always equalled the acts since the last start on it. Deleted with its writer (Motion::act, View::advance's call); the current epoch's length is Rereads::epoch_acts (acts - acts_at_start), read where a start closes the epoch and where a change rate is extrapolated over her epoch. last_epoch_acts stays: it is the closed epoch's length, a different fact, now u64 like the clock. No shim for saves with the old field: serde ignores it, and the current epoch's length comes from the clock. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
that referenced
this pull request
Nov 7, 2026
…sources by measured change; one canonical tool head (replay: -20% prefill) (#5805) * Her collapsed history is a log laid down byte for byte; a start places sources by measured change; tool lists share one canonical head Every recorded turnover on the M5 (core ed142f1, 2026-11-06) re-decided her collapse from scratch and resumed from the system head. - continuum-context view/log.rs: an item collapses ONCE. A start writes her oldest collapsed run (summaries, handles, fold blocks) to a log and lays that log down again byte for byte at every later start, appending what collapses now; a logged item still rises with room (rendered whole at its source's front, its entry kept). The log folds only when a source's logged history outgrows its grant (Start::log_folded, log_kept_chars on delib.view.turnover). - motion: per-act change rate per source (decayed to her last epoch) blended with what her starts measured; a start ranks units by the exchange argument over the shared prefix (s(1-q)/q + k, the log by what it keeps), Unmeasured to the tail, hysteresis by measurement error. Only at a start; within an epoch the view only appends. - tool_surface: one canonical order, how widely held then by name (Always, Core, OnDemand, Withheld), so a smaller tool set is the head of a larger one (Benchy's 30 vs 39 diverged at 18). Replay (the codec's replay example, real View code, all captures, 144 tok/s): prefill 6,269,985 -> 5,010,840 tokens (-20.1%). Score on the 13 recorded starts: shared 255,515 (#5803) -> 306,970 tokens (+1+2), ceiling 370,142. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * An absent source's logged history leaves with it: a start never lays down log it did not charge Codex on #5805: `arrange` charged logged chars only to the sources a start was given, but `begin` re-emitted the whole retained log, so the entries of a source absent from the start (shed for want of its floor in `fit_view`, a stream that ended, a room she left) were laid down charged to no one, survived a zero-source start, and kept the source's items marked collapsed, so its return showed her stale pointers. Nothing in the caller contract forbids the absence: `fit_view` sheds sources at a start by design ("A later act's advance offers it again"). Now `log::arrange` decides, per entry, whether this start charges it (its source is supplied), and `begin` keeps exactly those: the charge and the emission are one decision. The dropped chars are receipted (`Start::log_dropped_chars`, probed on delib.view.turnover). Reproduced first: a zero-source start rendered "head" + s1..s3's three pointers (960 chars uncharged). Tests: an absent source's log leaves and its items come back whole; a zero-source start lays down no log; a zero-grant start folds the log to the floor. Replay (--append-tail 144, stable prev captures): Aiko and Atlas unchanged; Aris prev 1,100,314 -> 1,110,400 tokens (+0.9%), the cost of no longer re-emitting an absent source's log uncharged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * Collapse depth from her measured re-read cost: a turnover collapses what she won't need again (#5806) * A turnover collapses what she won't need again: collapse depth from her measured re-read cost Her view now measures how often she asks again for what she already observed (continuum-context rereads.rs, kept in Motion with the per-source stats #5803/#5805 keep): at every act each observing occurrence is exposed at its age in acts, and an arrival with the same request fingerprint and outcome hash is a re-request at that age, tallied over every level and over collapsed ones separately, halved at each start. depth.rs chooses each instrumented growing source's start: walking its items newest first, an item stays whole only while hazard x whole x (1 + (S-C)/(W-S)) exceeds the turnover miss it saves, miss(S) = g (S-C)/(W-S). An age nobody was exposed at, a source whose items carry no act, or no measured growth is Unmeasured and keeps the half rule. start_grants (cognition) applies the chosen shares and probes delib.view.depth. Replay (--append-tail 144 --measured-depth, 15 captures, deliberation + act): 8,478,327 -> 8,395,003 prefill tokens (-0.98%), 3 fewer turnovers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * A measured depth never starts her under her newest item: the start is what its lowered grants hold The depth prices each growing source's base (her floor with her newest item whole) in rounded tokens; #5807's StartSource::newest prices her newest item ceiled. Lowering a grant to the depth's share, and sizing the start to the depth's own sum, could leave her one token under her newest item: the failure #5807 fixed (her newest turn collapsed by a char), reached again through the measured depth. - depth_grant (epoch.rs): THE rule for how a measured depth lowers a grant: to the chosen share, never below the floor or her newest item, never above the plan's grant. - The growing start is the sum of the lowered grants, never chosen.start (probed beside it as chosen_tokens on delib.view.depth). Test (prompt/epoch/tests.rs, the file's one test mod): a_measured_depth_never_starts_her_under_her_newest_item. A 501-char newest item at 0.01 tokens per char (6 ceiled) whose depth base rounds to 5: - the guard on the grant alone (the previous head): granted 500 of 501 chars, FAILED; - the start from the lowered grants without .max(source.newest): 500 of 501, FAILED; - both: passed; continuum-cognition --lib 954 passed, 1 ignored. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * One clock ages her items: each occurrence's birth is the act her view first held it Codex on #5806: depth::collapsible aged an item by how many newer items its source held while Rereads bucketed its hazard by acts since birth, and prime reconstructed that birth as acts minus the newer-item count. A source idle for eight acts priced a 9-act-old item at age 1; a source that appended three items in one act read them as three ages. Now Rereads records each occurrence's birth act where it enters (an arrival at act(), what a start finds at prime), keeps the births with her view (serialized; drained at each start to what the sources still offer), and answers Rereads::age(id) from them. depth reads that age, so both read one clock; prime rebuilds the index from recorded births, never from position, and the first act after a restart ticks the clock like every other. The seen set is gone: the births map is it. depth::collapsible takes the measurement by reference (a view-less claims() passes a fresh clock), so no Option stands in for a missing clock. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * Her epoch length is read off her one clock: Motion no longer counts acts Motion.epoch_acts counted every act beside Rereads' clock, and always equalled the acts since the last start on it. Deleted with its writer (Motion::act, View::advance's call); the current epoch's length is Rereads::epoch_acts (acts - acts_at_start), read where a start closes the epoch and where a change rate is extrapolated over her epoch. last_epoch_acts stays: it is the closed epoch's length, a different fact, now u64 like the clock. No shim for saves with the old field: serde ignores it, and the current epoch's length comes from the clock. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #5805 (fable/collapse-log-placement, now f35ab53 with the absent-source fix), which is stacked on #5803 and #5802.
This serves path step 1 (Fast) and order-of-work line 2 (a mind's context as an epoch). It closes #5805's open item, collapse depth: how much of her history a turnover collapses. That decides how small the new epoch's start is, and the start is the bulk of what each turnover re-prefills.
The problem #5805 left
Measured before building
Data: prompt captures for Aiko, Aris, Atlas and Benchy (
.prev.jsonl+.jsonl, M5 core ed142f1, 2026-11-06), all purposes. Script:scratchpad/cdepth/final_curve.py.What exists to measure with:
tool/output. It is not in her native tool surface, so the "expand with tool/output" handle is not something she can call directly.Re-read hazard: re-reads / exposures (item-acts), by age in acts since she last asked for it
code/readof a file and 5 are read-only shell commands. No search was re-issued.Built, through the owners
1. The measurement (
continuum-contextrereads.rs, kept inMotionbeside #5803/#5805's per-source stats):Observesand whose outcome is hashed.Fingerprintand the sameContentHashis a re-request at the earlier occurrence's age. The same request with a changed outcome (an edited file) only becomes her latest occurrence.2. The choice (
depth.rs, a pure function):miss(S) = g (S - C) / (W - S)per act.hazard x whole x (1 + (S - C)/(W - S)) > miss(S + saves) - miss(S), and(events + 1) / (exposure + 1). Adding one event to what was seen means a small sample errs toward keeping her history.Unmeasured, and the source keeps the half rule:3. The caller (
continuum-cognitionstart_grants):start_sharesarithmetic. The plan is not allocated a second time.delib.view.depthwith the start, the half, items kept and collapsed, predicted miss per act, and predicted re-reads per act.4. The replay:
--measured-depthadds aTABLEline with:Measured (the replay, on the real View code)
examples/replay.rs --append-tail 144 --measured-depthover each capture, once as deliberation (as #5805 ran it) and once as--purpose act. "#5805" is theappend-tailline of the same run. The prev files reproduce #5805's numbers exactly; the current files have grown since.At 144 tok/s that is 59,488 s -> 58,904 s. Rebased on #5805's absent-source fix (f35ab53); both columns come from the same run.
What the numbers say:
Tests (each with a
what this catches:note)rereads:depth:view/tests/depth.rs, end to end throughView:Validation
Crate-scoped builds at
nice -n 19, own target dir (cargo-target-cdepth), no workspace build, no reboot.continuum-context: lib + example testscontinuum-cognition --features metal --libcontinuum-contextorigin/fable/collapse-log-placementoversized-edits.shmodules_in_cycles(26 -> 28) becausedepthimportedviewandviewimporteddepth. Fixed:depthtakesGrowingvalues,Claim::growingbuilds them, and the end-to-end test lives underview/tests/.view.rs827,view/tests.rs962,epoch.rs792 lines.Still not instrumented
tool/outputis not in her native tool surface, so she cannot expand a handle directly; a re-read can only be a repeated call.tool/outputin her surface withToolEffect::Reopensand record the element it reopens (Actwould carry the targetElementId), or probe each expand.chat/history, or a saved thought reopened, is not linked to the item. Those sources stay Unmeasured and keep the half.persona.act.pace.Post-deploy check (owner: Fable)
delib.view.depthper start: the start against the half, and predicted re-reads per act.🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo