Skip to content

Her prompt only appends: facts and tool switches are keyed items, her previous turn renders identically (M5: ~6,000 prefill-seconds in 3 h) - #5802

Merged
joelteply merged 1 commit into
canaryfrom
fable/prompt-stability
Nov 6, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fable/prompt-stability

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Serves the residents' pace (the path's step 1, Fast; order of work line 2, a mind's context as an epoch): on the hybrid Qwen3.6-35B-A3B her sequence resumes only at its end or at a checkpoint, so any change inside her previous prompt re-prefills from the last checkpoint before it. Three of the four measured classes were her prompt changing where it had already been sent. Every fix goes through the one owner, continuum-context's View (MIND-CONTEXT invariant 1: within an epoch the prompt only appends).

What changed, by owner

A. Her act's tail joins her view as sent (continuum-context View::append_sent; cognition epoch.rs view_served, called once in contribute.rs when the engine serves the request)

  • Before: every prompt ended [facts] [now …] her words, her call, its result. The next act dropped the facts and re-rendered the result as a [result #n] item of her actions, in other bytes, at the same position. The previous prompt was never the next prompt's prefix past her view, so every act re-prefilled the previous act's tail.
  • Now, once a prompt is served, its tail joins her view exactly as it was sent: text, or native protocol (context_streams::native).
    • What the tail showed (her newest act, the ask) is covered: it never arrives again from its source this epoch.
    • A start re-renders everything from the sources and drops the tail.
    • The next act's prompt is the previous prompt plus what is new. Its tail drops pieces the epoch already holds byte for byte (the same ask, the same clock line, the same words).
    • view_messages (the fork's checkpoint hint, kept in her page) now points at her prompt's end, so the engine resumes there.
    • A tail carrying pixels or audio is not held as sent (delib.view.tail_not_kept) and re-renders as before.
  • Facts are keyed items of her view (context_streams::facts, a Source of states).
    • Each fact is keyed by its id (render_facts now returns (id, text)); a perception the system spoke into her room is keyed by its event.
    • An unchanged fact appends nothing. A changed fact appends its new version. A fact that stops holding is ended once (Source::states / Source::ended, which is new in the codec). Events are never ended.
    • Placement for each fact class: every fact class describes her situation as of the act it is appended in, so all of them are states placed where they fired and ended when they stop. The bounds fact changes only when the room's turn count does. The clock is the one line that is true only for the current act. It rides the tail, and the tail now persists, so nothing that was sent is ever dropped. The "ephemeral after her newest result" placement is therefore not needed for any class.
    • The prompt_messages_outside_the_view ratchet goes from 9 to 8.

B. Her tool set is stable within an epoch (prompt/tools_epoch.rs)

  • The template forces tools into the head. I read the chat template from the served GGUF (Qwen3.6-35B-A3B-Q4_K_M.gguf, tokenizer.chat_template). It renders <|im_start|>system\n# Tools … <tools>{schemas}</tools> … {system text}: the tools come first, before the system text. Any change to the set rewrites the head.
  • Before: a held card's transition (held.moves != moves, the old line 95-97) re-selected the set immediately, mid-epoch.
  • Now:
    • The epoch keeps its set.
    • The verbs the new moves add ride tail_tools, after the messages and outside the prefix, so they are callable at once.
    • The budget reserves the larger of the two sets.
    • The set is adopted at the next act that starts an epoch of her view.
    • The probe fires once per change.
  • About the matched 1,668 s act: it was not a flip inside Atlas's prompts. Request 072fdaf6 (18:31:35Z) landed on slot 3 while slot 3 held Benchy's 57846445 (18:09:41Z, 30 tools, core set). Atlas's previous captured request (bb34289b, 16:32Z) sent the same 39 tools. The 3,550-token LCP is the tools prefix two minds share. The earlier classifier missed Benchy because his captures for that window sit in the rotated .prev.jsonl. That act is a slot-placement miss: her page was not restored onto a slot another mind held. Follow-up: Codex (placement/paging).
  • The in-epoch flip this PR fixes does happen. Probes show epoch_moves_changed for Aiko at 17:04Z, 17:15Z and 19:04Z and for Benchy at 19:03Z. Aiko's captured list went from 39 to 30 verbs at 19:21Z.

D. Her previous turn renders canonically (prompt/messages.rs, working_memory::statement_of_act)

  • The difference: her words and her call went out as two assistant messages. The template wrote an <|im_end|> and a second assistant header between them that she never generated.
  • Before this PR her turn also never rendered twice. It was in act N+1's tail and absent from N+2, because nothing persisted it.
  • Now her words and the native calls she made with them form one assistant message (words\n\n<tool_call>…, as she wrote it), and the tail persistence keeps it byte-identical on every later act.
  • Checked and not a cause: the template's <think> wrapper depends on the message's position relative to the last user query. In our flow a user message always follows her turn: the result label, or [continuation] from close_trailing_assistant. So the wrapper never flips between acts.
  • Left as is:
    • Her reasoning is dropped. It lives in her thoughts stream; sending it back with preserve_thinking would duplicate it.
    • Her reply is not placed directly after her prompt, because the next prompt puts the world's updates first.
    • So the ~150-400 tokens of her canonical turn are prefilled once. Most of the classifier's D bucket (positions after the previous prompt's end) is new content, not waste.

C. Turnovers were required; the trigger is unchanged

  • All 13 delib.view.turnover in the window followed the epoch's own rules:
    • 8 overflowed (view_tokens > granted + room, for example Aiko 17:19Z with 106,653 > 104,434).
    • 5 were restores taken because the next act's measured appends would overflow (turnover_due). For example, Aris 18:47Z had a 55,060 / 61,246 view with a median of 37,925 chars appended per act.
  • What is avoidable is what a start shares with the prompt before it. Every captured turnover resumed only from the head (cached 11,198 / 9,078 tokens), because the start's front changed:
    • the kanban's count in its first line, at message 2-4;
    • open-view lines, at messages 8-16;
    • motion swapping [my work]/[room-kanban] and notices/[tasks].
  • On the hybrid model a start resumes only at a checkpoint (--checkpoint-min-step 5637). Follow-up: Fable (start order) and Cormac (checkpoints at the head boundary and on turnover).

Measured

  • Window: the M5, core ed142f1, 2026-11-06 16:13-19:17Z, 124 acts. Engine log + probes + prompt captures.
  • Engine classes (receipts handed to this PR):
Class Cost
A: perception tail re-rendered 2,822 s over 78 acts, of 5,072 s in "changed inside her previous prompt"
B: matched act 1,668 s on one act (63,695 fresh tokens, 1,818 s act), plus ~3,895 s on two earlier acts (unverified; see B above)
C: view turnover 3,485 s / 424,792 tokens / 13 acts
D: previous reply re-rendered 1,250 s / 44,704 tokens / 105 acts
  • Dyno on the recorded pairs: 158 consecutive same-persona pairs from the window's prompt captures (Aiko 73, Aris 50, Benchy 34, Atlas 5 requests). Characters, priced at 3.05 billed chars/token and the measured 144 prefill tok/s.
  • Before = as captured. After = this PR's rule on the same captures: a pair that diverged at the previous tail shares all of it, and fresh = the new messages less the covered ring item and the re-sent ask and facts. Turnovers, room switches and head changes are left as they were.
Class Pairs Prefix share of the previous prompt Fresh tokens Prefill s
tail re-rendered (A) 119 0.978 -> 1.000 558,070 -> 383,079 3,875 -> 2,660
view rewrite (turnover / restart) 10 0.206 -> 0.206 373,262 2,592
contracts at head (turnover) 3 0.162 -> 0.162 137,499 955
room switch 15 0.910 -> 0.910 87,930 611
all 158 0.897 -> 0.914 1,156,761 -> 981,770 8,033 -> 6,818
  • The dyno on the real render (a_served_prompt_is_the_whole_head_of_her_next_act) puts three consecutive acts through prompt_view + view_served:
    • every message of act N is byte-identical at the head of act N+1;
    • the ask and the facts are sent once;
    • no served result comes back as a ring item;
    • view_messages sits at her prompt's end.
  • Validation at 28df5d2 (crate-scoped, nice -n 19, own target dir, no workspace build, no reboot):
    • continuum-context: 72 lib tests pass.
    • continuum-cognition --features metal: 938 lib tests pass.
    • continuum-core --features metal,accelerate mind-integration tests (test_env::mind_integration): 96 pass.
    • Ratchets pass against origin/canary (prompt_messages_outside_the_view 9 -> 8, every other ratchet unchanged).
    • oversized-edits.sh: contribute.rs ends at 999 lines.
    • No new clippy findings in the touched files.

Post-deploy check (owner: Fable, the 15-minute read plus 3 h, same classes)

  • Fresh tokens per act by class, before and after, with the same classifier over the engine log and probes. Join each act's slot predecessor across .prev.jsonl and .jsonl.
    • "changed inside her previous prompt" should fall to near zero outside turnovers.
    • Per act, the engine's resume: should show lcp at about the previous n_prompt, with a checkpoint at its end.
  • Probes:
    • delib.view.tail_kept once per served act;
    • delib.view.tail_not_kept only on media acts;
    • delib.tools.epoch_moves_changed followed by no tool-list change until delib.view.turnover.
  • Watch: the tail now persists her clock line and her words (~300 chars an act) in the epoch. Compare turnovers per hour before and after.
  • Worse than canary on median act time means the node goes back to canary at once.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…d states, tool switches wait for a start, her turn is one message

On the hybrid Qwen3.6-35B-A3B any change inside her previous prompt re-prefills from the last
checkpoint before it. Measured on the M5 (core ed142f1, 2026-11-06 16:13-19:17Z, 124 acts):
2,822 s over 78 acts re-prefilled her previous tail, 1,250 s her previous reply.

- continuum-context: View::append_sent appends a served prompt's tail in the bytes it was sent;
  what it showed (her newest act, the ask) is covered and never arrives again from its source
  this epoch; a start re-renders from the sources. Source::states/ended: a source of states
  ends an item it no longer offers once, so a state that returns appends at the newest end.
- cognition: perception facts are a keyed Source of states (context_streams::facts); the act's
  tail joins her view when served (epoch.rs view_served, once in contribute.rs), and the next
  tail drops what her view already holds; view_messages points at her prompt's end; native
  protocol is a ContextMessage (context_streams::native).
- tools_epoch: the template renders tools first (read from the served GGUF), so a held card's
  moves change no longer re-selects her set mid-epoch: her head holds, the new verbs ride
  tail_tools, the budget reserves the larger set, the next start of her view adopts it.
- messages: her words and the native calls she made with them are one assistant message
  (working_memory::statement_of_act), as she wrote them.

Dyno over 158 recorded pairs: the tail class shares 0.978 -> 1.000 of the previous prompt, fresh
558,070 -> 383,079 tokens; all pairs 0.897 -> 0.914. Turnovers (13) were required by the epoch's
rules and are unchanged. prompt_messages_outside_the_view 9 -> 8.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply merged commit b4026c2 into canary Nov 6, 2026
18 checks passed
@joelteply
joelteply deleted the fable/prompt-stability branch November 6, 2026 23:41
joelteply added a commit that referenced this pull request Nov 6, 2026
…nchanged blocks, orders sources most stable first, and keeps tallies behind what holds

On the M5 (core ed142f1, 2026-11-06 16:13-19:17Z) all 13 turnovers resumed only from the
system+tools head (11,198 / 9,078 tokens): the start's front moved.

- continuum-context View::begin lays a start's blocks out to share the longest prefix with the
  epoch it replaces (lead_with_what_held): that epoch's blocks in its order while each renders
  byte for byte, the first changed one laid where it stood (its unchanged front is reused too),
  then the rest; a source's items never pass one another.
- motion: sources order by measured stability (how often each rendered as at the start before),
  most stable first; a tie keeps the order the last start laid them in. The old
  kept / (1 - p) ratio moved with each start's sizes and swapped neighbours.
- Tallies leave the head: RagItem::as_tally marks units that state moving counts; a block's
  tallies become their own `<faculty> counts` block (Grounding::split_tally). The board marks its
  headline, available-work lead and history; its cards list oldest first, so a new card appends.
  Her [investigation] distribution is a tally pin, listed after every notice that holds.

Replay of the 13 recorded starts: shared prefix 219,682 -> 255,515 tokens (+35,833, ~249 s at
144 tok/s); all 158 pairs, prefill 8,033 s as captured, 6,818 s with #5802, 6,569 s with this.

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 6, 2026
…nchanged blocks, orders sources most stable first, and keeps tallies behind what holds (#5803)

On the M5 (core ed142f1, 2026-11-06 16:13-19:17Z) all 13 turnovers resumed only from the
system+tools head (11,198 / 9,078 tokens): the start's front moved.

- continuum-context View::begin lays a start's blocks out to share the longest prefix with the
  epoch it replaces (lead_with_what_held): that epoch's blocks in its order while each renders
  byte for byte, the first changed one laid where it stood (its unchanged front is reused too),
  then the rest; a source's items never pass one another.
- motion: sources order by measured stability (how often each rendered as at the start before),
  most stable first; a tie keeps the order the last start laid them in. The old
  kept / (1 - p) ratio moved with each start's sizes and swapped neighbours.
- Tallies leave the head: RagItem::as_tally marks units that state moving counts; a block's
  tallies become their own `<faculty> counts` block (Grounding::split_tally). The board marks its
  headline, available-work lead and history; its cards list oldest first, so a new card appends.
  Her [investigation] distribution is a tally pin, listed after every notice that holds.

Replay of the 13 recorded starts: shared prefix 219,682 -> 255,515 tokens (+35,833, ~249 s at
144 tok/s); all 158 pairs, prefill 8,033 s as captured, 6,818 s with #5802, 6,569 s with this.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Opus 5.5 <[email protected]>
joelteply added a commit that referenced this pull request Nov 7, 2026
… the rest, so the reply's priority never collapses her newest turn

#5807's CI (merged with canary #5802/#5803): reply_priority_grows_the_reply_not_at_history_or_required_input
failed, history 1 on the pass and 0 on the act. Receipts (16,384 window, d601074):

- start_room is the same on both turns (979: view grants 3,570 + room 0 - reply short 2,591 on the pass;
  2,376 + 0 - 1,397 on the act), and start_grants raised the growing start to cover her newest turn
  (newest 570, start 766 on both).
- start_shares then split the growing room in proportion to what each source lacks of its GRANT, and the
  grants are the act's: the reply's priority moved her conversation's grant (3,197 on the pass, 2,003 on the
  act). Conversation share 449 on the pass, 437 on the act: 1,331 chars vs 1,295, her newest turn 1,296.
  The act collapsed it by one char.
- The same split on canary alone: conversation grant 3,461 / 2,161 (tools 8,240), the same leak with more
  slack; it passed by margin. tool/output's +474 tokens in this fixture (tools 8,714) removed the margin
  and exposed it. The reply WAS reaching her history through the split; the fixture window is not stale.

Fix: StartSource carries `newest` (its newest item's cost); start_shares gives each growing source its
newest item, capped by its grant and the start, before the proportional share. start_grants passes it.
After: pass and act render byte-identical history (segments equal, est 10,754 both).

Test: continuum-context allocation::tests::a_growing_source_holds_its_newest_item_whatever_the_grants_divide
(the receipt's numbers: both grants hold the newest turn).

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
…and a marker can only name a verb she holds (#5807)

* Every handle she's shown is one she can open: tool/output is native, and a marker can only name a verb she holds

tool/output was catalog-only (NATIVE defaulted false), so a native-call model
could not emit it, while every folded act, repeat, saved result, thought
handle, collapsed receipt and too-large note named it (2026-11-06, the M5: no
act called it). And the slash name the text used is not the name her tool
list offers (the first alias, read_output), so the prose never matched her
function list even for native verbs.

- tool/output moves beside the spill it reads (continuum-cognition), declares
  native: true, disclosure Always (the only tier a room's narrowed surface
  keeps, and a handle can appear in any surface), effect Reopens, and projects
  its outcome: a read that brought nothing back is Failed, like grep exit 1.
  Its description and param docs are cut to a few words (it rides every act).
- VerbRef<C> (kernel sdk_codegen): a reference to a command by TYPE, built only
  in a const from a native command in her hands (VerbRef::in_hands) or in every
  surface (VerbRef::always); a non-native or narrowed verb fails const
  evaluation (compile_fail doctests). It renders through wire_name, the one
  function her offered tool list is named by (OfferStyle/offer_style_for moved
  down beside it; tool_dialect re-exports them and routes to_wire_spec_with
  through it).
- Reopen (tool_output.rs): THE reopen affordance, one verb, one call form, the
  command's own params serialized: read_output({"act":3}),
  read_output({"outputId":"h"}). Migrated: actions fold + repeat, saved-result
  recall, thought pointers, newest-result too-large note, result attribution,
  collapsed pointers, open-views banner, spill byte-offset refusal, web/fetch
  filter note.
- CollapsedReceipt: one type renders the collapsed line and reads it back
  (accepted only when its fields re-render to the exact text); replaces the
  recogniser that accepted a form the index never emitted.
- tool_dialect::offered_name_of_stored: a verb name stored before a rename
  resolves through its kept alias and renders as offered today.

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

* tool/output lives in the mind's ring beside its spill, and never sizes what she sees

The ratchets on the first commit: cognition files naming crate::commands rose
upward_imports 33 -> 48 and closed module cycles; moving the command made its
file touched, so its self-sized sites had to go (ONE-BUDGET: a touched file
leaves with none).

- tool_output.rs moves to cognition/tool_executor/ (beside spill.rs), so every
  reopen site imports within the mind ring; core's web/fetch note and the core
  -> cognition dependency are reverted (web/mod.rs carries self-sized sites
  this slice does not own; its "page it with tool/output" note is a follow-up).
- The read no longer sizes itself: render_slice_chars (a fraction of the
  window, a second budget the turn's allocation never saw) and the grep
  defaults (2 context lines, 50 matches) are gone. spill::Allowance::{Whole,
  Chars} types the read's bound: tool/output reads Whole (bounded by the saved
  file, which was held in memory once), a reopen with no selection is the whole
  output (ToolEffect::Reopens), and her view sizes it. The tail header names
  "the newest N of M lines", never a budget.
- Reopen's argument serialization names its boundary (her tool-call wire).
- Agentic surface re-pinned at the measured 17927 (+441: tool/output's ten
  params, the reach itself).

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

* A view start holds each growing source's newest item before it shares the rest, so the reply's priority never collapses her newest turn

#5807's CI (merged with canary #5802/#5803): reply_priority_grows_the_reply_not_at_history_or_required_input
failed, history 1 on the pass and 0 on the act. Receipts (16,384 window, d601074):

- start_room is the same on both turns (979: view grants 3,570 + room 0 - reply short 2,591 on the pass;
  2,376 + 0 - 1,397 on the act), and start_grants raised the growing start to cover her newest turn
  (newest 570, start 766 on both).
- start_shares then split the growing room in proportion to what each source lacks of its GRANT, and the
  grants are the act's: the reply's priority moved her conversation's grant (3,197 on the pass, 2,003 on the
  act). Conversation share 449 on the pass, 437 on the act: 1,331 chars vs 1,295, her newest turn 1,296.
  The act collapsed it by one char.
- The same split on canary alone: conversation grant 3,461 / 2,161 (tools 8,240), the same leak with more
  slack; it passed by margin. tool/output's +474 tokens in this fixture (tools 8,714) removed the margin
  and exposed it. The reply WAS reaching her history through the split; the fixture window is not stale.

Fix: StartSource carries `newest` (its newest item's cost); start_shares gives each growing source its
newest item, capped by its grant and the start, before the proportional share. start_grants passes it.
After: pass and act render byte-identical history (segments equal, est 10,754 both).

Test: continuum-context allocation::tests::a_growing_source_holds_its_newest_item_whatever_the_grants_divide
(the receipt's numbers: both grants hold the newest turn).

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]>
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