diff --git a/docs/architecture/HOW-A-MIND-GETS-WHAT-SHE-NEEDS.md b/docs/architecture/HOW-A-MIND-GETS-WHAT-SHE-NEEDS.md new file mode 100644 index 0000000000..870302c516 --- /dev/null +++ b/docs/architecture/HOW-A-MIND-GETS-WHAT-SHE-NEEDS.md @@ -0,0 +1,430 @@ +# How a mind gets what she needs: requirements for adaptive focus and allocation + +Status: requirements for review, 2026-10-30. No code until this is agreed. + +Joel, 2026-10-30: "Let's spend zero time on code, just all the requirements for what she does along with +others. Hypothetical scenarios. How does one get what one needs at the time, and how does the RTOS-like +intelligence (not some hard-coded disaster) organically fit these demands through many acts, like stoplights +or any other well-known adaptive system." + +This document builds on what is already decided and does not repeat it: +- [FOCUS-CONTRACT](FOCUS-CONTRACT.md): one allocation, claims with levels, no permanent percentages, a + learnable attention policy; +- [FOCUS-AS-ATTENTION-TEMPERATURE](../cognition/FOCUS-AS-ATTENTION-TEMPERATURE.md): focus is a target and an + intensity, and every threshold becomes a policy function; +- [PERSONA-CONTEXT-PAGING](PERSONA-CONTEXT-PAGING.md): signals, not constants; paging is the primitive, and + limits emerge as costs; +- [ONE-BUDGET](ONE-BUDGET.md): one authority over every resource, and grants that shrink by request; +- [MIND-CONTEXT-AND-ENGINE-CONFIG](MIND-CONTEXT-AND-ENGINE-CONFIG.md): the codec, levels, epochs and causality. + +- the grid governance, which this plugs into and does not parallel: + [GRID-MARKET-CLEARING](GRID-MARKET-CLEARING.md) (nested prices from the pager to the N-node mesh), + [ADAPTIVE-GRID-INTELLIGENCE](ADAPTIVE-GRID-INTELLIGENCE.md) (placement by measured candidate plans, and + learning the policy), [CAPACITY-FABRIC-AND-GOVERNOR](CAPACITY-FABRIC-AND-GOVERNOR.md) (capacity is live, + held loosely), [BEING-SOCIETY-GOVERNOR](BEING-SOCIETY-GOVERNOR.md) (the governor serves time, never dictates + work), [CONCURRENT-MIND-AND-GOVERNOR](CONCURRENT-MIND-AND-GOVERNOR.md) (govern resources, never gate the mind). + +**Where this sits.** Joel, 2026-10-30: "it's a lot like the grid governance and in fact it will need to plug +into that, because with many nodes we should ideally be smart about where to put what and then how to adapt +within: slots, learning, so much. And context window RAG budgeting is merely part of a persona." The +mechanism already agreed is the nested market of GRID-MARKET-CLEARING: each tier publishes a measured price +for its resource and each claim below it is granted while its measured marginal value exceeds that price. +Placement across nodes comes first (ADAPTIVE-GRID-INTELLIGENCE's candidate plans); adaptation inside a node +follows. This document is the **persona end** of that market: the tiers below a lane (a mind, her +activities, her claims), of which her context window is one claim among several, plus the dynamics and the +scenarios that must pass from the grid down to her answer. + +## 0. Why: every failure today was an open-loop rule + +On 2026-10-30, on the M5 (four residents): + +| Rule | Written as | What it did | +|---|---|---| +| Reply cap | 12,288 tokens, priority above her context | took her view's room; her view turned over every act; 75 reads to 2 edits an hour | +| Its replacement | her p90 output × 5/4 | 963 tokens; Aris cut three times in a row inside her thinking, with ~30k of her slot free | +| Act think budget | 1,024 tokens | larger than that grant in 12 of 17 acts, so it never stopped a think | +| Working window | 49,152 tokens | one machine's replay on one day, applied to every machine | +| Epoch start | a quarter, then half, of the window | a fraction someone picked | +| Slots | four fixed private windows of 60,672 (`kv_unified = false`) | an idle mind's room cannot serve a mind writing a large edit | + +Each rule decided without observing the effect of its own decision. **An open-loop rule is the defect +class.** Swapping one number for another, a constant for a fraction or a fraction for a percentile, is the +same defect. The requirement is closed loops: measure, decide, observe the effect, adjust. + +## 1. What she does, and who else is there + +She is one mind holding several activities at once, one of them in focus (README; the event mind). Each +activity has its own demand shape: + +| Activity | Needs whole | Can fold | Output | Latency | +|---|---|---|---|---| +| Coding | the file she is changing, the newest result (build, test, error), the task | related files to outlines, older results to outcomes | heavy-tailed: a one-line fix or a whole-file write | her own pace; a person may be waiting on the PR | +| Conversation with a person | the person's latest messages and the thread's open questions | older turns to the room's history | short to medium | a person is waiting, every second shows | +| Review | the diff and the claim being reviewed | the repo around it | medium | a peer is blocked on the verdict | +| Chess or another game | the position, which is a sufficient statistic of every earlier move | all earlier moves | tiny | per move | +| Writing a book | the outline and character bible, the current chapter | earlier chapters to summaries | long | none | +| Live call, voice, vision | the current frames and the last utterances | everything older | streamed | tight and continuous | +| Dreaming, learning | her own engrams | everything | not to a room | none; it takes slack only | + +**Others sharing the machine:** other residents on the same engine; minds leased in from other nodes; the +dream stage; residents' own builds and tests (CPU and memory); the person's own apps (a game, Photoshop, a +browser); the OS. + +## 2. Resources and how capacity is known + +| Resource | Unit | Capacity comes from | Consumed by | +|---|---|---|---| +| Device memory for KV state | tokens of state | free memory measured each tick ÷ the engine's measured bytes per token | every mind's held context and output | +| RAM page tier | bytes | measured free RAM, minus what the person's apps use | paged-out minds, cached results | +| Disk page tier | bytes | measured free disk, by cache class (CLAUDE.md eviction rule) | spilled minds, spilled results | +| Prefill throughput | tokens per second | measured per model on this node, under the current contention | every act's fresh tokens | +| Decode throughput | tokens per second | measured per model on this node, by how many generate at once (the decode knee) | every act's output | +| CPU | cores and seconds | measured load | tools, builds, tests, the core | +| A person's patience | seconds | the person is waiting or not (an event, not a guess) | a conversation's reply | +| Network | bytes and seconds | measured per peer | minds leased across the grid | + +A capacity is a measurement with a time. **Unknown is unknown, never a default.** A decision made while a +capacity is unknown says so, and the loop measures before it trusts. + +## 2a. The contention: many minds, many activities, one machine + +Joel: "This has to contest with lanes, total available memory to us, many personas all needing some action +and focus, per their own activity they're focusing on, through a variety of activities like coding, talking, +live chats." + +Two resources are contended, and every demand is on both: +- **Space:** memory for each mind's held state, from the node's measured free memory down to her answer. +- **Time:** lanes, the generations the engine runs at once, and turns on them. How many lanes is the + measured decode knee (more lanes at once make each slower; past the knee, total throughput falls), never a + fixed count. + +Every claim sits in one hierarchy, and one allocator solves all of it together: + +``` +grid: nodes and their offers (GRID tier: price plus transport cost, by gossip) + node: measured free memory after the person's apps and the OS; CPU; disk + engine: lanes (time, the measured knee) and state memory (bytes, measured per token) + mind (her temperature: how active she is, aged so she is never starved) + activity (coding, a person's conversation, a live call, a review, a game; one in focus) + her claims: context levels, think, answer, genes resident, tool CPU and disk, dreaming +``` + +Prices flow down, bids flow up (GRID-MARKET-CLEARING section 2): each tier sees only the price above it +and quotes one below it, so no component needs the whole picture and the same algorithm holds on one node +or many. The value unit at the top is the activity's measured outcome; every price below it is derived. + +**Space and time trade against each other**, which is why one allocator must own both: +- A mind without a lane now does not need her state on the device now: it can page to RAM and be + prefetched before her next turn. Space follows time. +- A mind whose state is on the device starts her next turn without a re-prefill. Time follows space. +- A mind writing a large edit needs both: a lane for the whole write, and room for every token she writes. +- A live call needs a lane often and briefly, with little space; a long refactor needs a lane for a long + time and much space. The traffic-signal analogy is exact here: phases (who generates) and green times + (how long) are re-split each cycle from measured demand, with minimum greens (floors) and calls + (a person's message, a live call's frame). + +**A persona's claims, of which her context is one:** + +| Claim | Resource | Notes | +|---|---|---| +| Her context, by level per item | state memory, prefill time | this is where the RAG budget lives; one claim among these | +| Her output (think, answer) | state memory as written, decode time on a lane | written tokens are the only ones that cost | +| Her genes (adapters resident) | device memory, page-in time | paged by what her mind is on (genome paging) | +| Her hands (builds, tests, tools) | CPU, disk, RAM | a resident's own build is hers to run (residents build freely) | +| Her senses and voice (vision, hearing, speech) | encode and decode time, small memory | critical faculties are gates, never priced (GRID-MARKET-CLEARING invariant 1) | +| Her dreaming and learning | slack only | the idle class; it yields within a step | +| Her memory (recall, embeddings) | CPU, RAM index | | +| Placement (which node serves her) | network, a node's whole offer | decided first, at the grid tier | + +**Per mind, per activity:** each mind's demand is the sum of her activities' claims, weighted by which one +is in focus. The activity in focus gets detail and action; the others keep a floor (their chain heads, +their open commitments) and fold. A mind switching focus changes her claims, not her identity or her +state; a switch costs measured time, so it is priced (R7). + +**What every scenario must show:** every mind that has work gets action within a time bound set by her +temperature and aging; every activity in focus gets the detail its acts measurably reference; the person's +apps and any live call get their floors first; nothing is clipped. + +## 3. Requirements + +Each is testable, and the scenarios in section 6 test them. + +- **R1. No open-loop number.** Every bound in the system is the current output of a loop that measured the + effect of its previous decision. The only inputs set from outside are physical measurements and human + intent (what matters to the person now, such as "this conversation is live"). A reviewer refuses any + number not traceable to one of those. +- **R2. Demand is revealed by her acts, not predicted by a rule.** What she reads, cites, edits, re-reads, + expands and writes is her demand. Her working set is the items she referenced over her recent acts + (Denning's working set). How many recent acts count is itself chosen by the loop: the span past which + adding acts stops adding items. +- **R3. Focus.** Detail goes by causal distance from her current act and by which activity is in focus. + Everything else folds to a cheaper level that keeps a path back. Nothing is dropped silently, chain heads + stay whole, and her newest result stays whole (FOCUS-CONTRACT rule 4; MIND-CONTEXT causality). +- **R4. Flex, cleared by price.** Every consumer is a flex item: its basis is its measured current need, its + minimum is its causal or required floor (a reservation, visible in the books, never traded), and its grow + and shrink are marginal-value curves measured from outcomes. The container is measured capacity. A claim + grows while its marginal value exceeds its tier's price; the price rises with measured excess demand and + falls with slack. That is the whole rule: no share, fraction or percentile anywhere (GRID-MARKET-CLEARING; + ONE-BUDGET). +- **R4a. Placement first, then adaptation within.** Where a mind, a model, a gene or a job runs is decided + at the grid tier from measured candidate plans (ADAPTIVE-GRID-INTELLIGENCE); everything else in this + document adapts within that placement, and a sustained mismatch is a signal back to placement. +- **R5. Closed loops at every timescale**, each with a measured error signal and a measured cost of + switching (section 5). +- **R6. Both ways.** Any loop that can shrink a grant must also probe upward, or it ratchets down forever + (the scheduled-upward-test rule). +- **R7. No starvation, no thrash, no relaunch.** Waiting raises priority (aging). A state changes only when + the expected saving exceeds the measured cost of changing. The engine adapts live; it is never restarted + to change shape. +- **R8. Every miss is a signal.** + - A re-read of a folded item is a page fault, identified by causal identity (same action, same outcome). + - A cut is a loss. + - A refusal is an overflow. + - Waiting on a page-in is latency. + + Each is counted per mind and per activity, and feeds the loop that caused it. +- **R9. The person's machine comes first.** Load from the person's own apps is capacity removed. The + system gives memory back within a step and takes it again only by probing after the load leaves. +- **R10. Any hardware, any number of minds, one algorithm.** Only the measurements differ. When even one + mind's working set cannot fit, the system says so loudly (an under-provision) and schedules or places + her elsewhere. It never clips silently. +- **R11. Every decision has a receipt:** its inputs, the decision, the outcome. It is replayable on the dyno + (FOCUS-CONTRACT rule 8). +- **R12. Her agency.** She can hold focus, release it, and ask for detail (expand). The system honors each + request and prices it into the same allocation; nothing external silos her. + +## 4. Adaptive systems that already solve this, and what each contributes + +| System | Its loop | Maps to | What we take | +|---|---|---|---| +| **Adaptive traffic signals** (SCATS, SCOOT) | detectors measure flow and saturation every cycle; green splits, cycle length and offsets move in small steps toward less total delay; minimum greens for safety; a pedestrian button is a call; a corridor is coordinated into a green wave | the intersection is the engine; each approach is a mind; green time is engine turns and KV; saturation is a mind's pending work; minimum green is her floor; the pedestrian call is a person's message; the green wave is a warm prefix, so consecutive acts flow | re-split every cycle from measured saturation, in steps bounded by measured switch cost; the cycle length (how long one mind holds the engine) adapts to total demand; there is no fixed plan | +| **Page-fault-frequency working-set control** (operating systems) | a process faulting more than its target gets frames; one faulting less loses frames | her re-reads of folded items are her faults; her window and her view's levels are her frames | the target fault rate is not a constant: it is where a fault's measured cost (the seconds of a re-read act) equals holding's measured cost (the prefill seconds per act of the extra tokens) | +| **Congestion control** (TCP; BBR in particular) | grow until loss, back off on loss; BBR models the bottleneck's bandwidth and round-trip time from measurements and paces to them | a mind's grant and her output room; refusal and memory pressure are loss | probing upward is mandatory (R6); prefer the model-based form (estimate capacity, pace to it) over a multiplicative constant | +| **CPU schedulers** (multilevel feedback queue, completely fair scheduler, RTOS priority inheritance) | interactive work is boosted; long work is demoted; a periodic boost prevents starvation; virtual time keeps shares fair; a task holding what others wait on inherits their priority | a mind with a person waiting is interactive; a long refactor is batch; dreaming is the idle class; a mind whose review blocks a peer inherits the peer's priority | one temperature per mind plus aging (plan goal 9) | +| **Video rate control** (codec buffer models) | bits go to frames by measured complexity; a buffer smooths; keyframes reset prediction | tokens go to items by how much they change; the epoch start is a keyframe; levels are mipmaps | spend detail where content changes; choose the keyframe interval from measured turnover cost | +| **Foveated rendering and human attention** | full resolution where the eye looks, coarse at the periphery; eye tracking measures the gaze; a saccade moves it | her fixation is her current act's target; folds are the periphery; a focus switch is a saccade | detail follows where she measurably looks (her references), not only declared importance | +| **DVFS governors, garbage-collector pacing** | state follows measured utilization; transitions cost, so they are paced | engine geometry, residency, epoch length | change state only when the measured gain exceeds the measured transition cost | +| **Flexbox** | basis, grow, shrink and minimum content; the layout reflows when the container changes | every claim, in every container from the node down to her answer | the shape of the allocation interface (R4) | + +## 5. The loops, by timescale + +Each loop runs on events, not timers, and each is slower than the loop inside it (cascade control), so they +do not fight. Each is one tier of the nested market: it measures its tier's excess demand, moves its price, +and the claims below it re-clear against the new price. + +| Loop | Runs when | Measures | Decides | Stays stable by | +|---|---|---|---|---| +| L1 Token | while she generates | tokens written; pool free; the lane time she holds and who waits on it | her output keeps growing while its marginal value exceeds the price of the space and the lane time it takes; when the pool is tight, it asks colder state to page out, or she finishes | the ceiling is the pool and the lane price, both measured, never a guess | +| L2 Act | at each prompt build | her last acts' faults, cuts, prompt cost, outcome | one allocation over her claims: view, tools, grounding, think, answer floor | grants change only between acts | +| L3 Epoch | when her appends reach her grant | her turnover cost (re-prefill at her prefill rate) against her miss cost (her fault rate × a re-read act's seconds) | the size of her next start | the start is fixed for its epoch (append-only within it) | +| L4 Residency | when any mind's temperature or the pool changes | each mind's temperature, page-in cost, when her pending task completes (task handles say when she wakes) | which minds' state stays on device, in RAM, on disk; prefetch before a wake | a page moves only when expected saving exceeds measured page cost | +| L5 Admission | when demand or the decode knee changes | sequence capacity (#5188), decode rate by concurrency | how many minds generate at once | the measured knee, with aging so no mind waits forever | +| L6 Node | when external load, heat or a training reservation changes | free memory, the person's apps, thermal state | the pool's size; returning memory to the person | gives back at once, takes back only by probing | +| L0 Placement | when a node joins or leaves, offers change, or a tier below signals a sustained mismatch | offers and prices by gossip; measured transfer cost; each node's outcomes | which node hosts each mind, model, gene and job (ADAPTIVE-GRID-INTELLIGENCE candidate plans) | hysteresis and explicit switching cost; a price flicker never re-homes a mind | +| L7 Policy | over hours and days | outcomes of controlled probes: R6's upward tests recorded as experiments, each a bounded, receipted change to one grant for one act class, compared with matched acts without it | the value curves L2 and L3 use for each activity | a new curve replaces the old only after beating it on replay (FOCUS-CONTRACT); never learned from passive correlation, since hard tasks both think longer and fail more (Cormac on #5607) | + +## 6. Scenarios + +Each scenario becomes a dyno replay first (captured acts, no live residents) and a live read second. Its +pass criteria are measured, never "looks right". + +**S1. One mind fixes a bug.** She reads six files, finds the bug in one, writes a large edit, the build +fails, she reads the error, fixes it, and opens a PR. +- Focus narrows as she works: the file she edits and the newest build output stay whole; the other five + fold to outlines with a path back; her tools narrow to the coding subtree (goal 10). +- Her edit grows token by token from the pool (L1); nothing cuts it while room exists anywhere in the pool. +- If she re-opens a folded file, that is a fault (L2): that file's level rises and stays raised while she + keeps referencing it. +- Pass: no write cut while the pool had room; no fold she re-read more than once without its level rising; + the PR opened. + +**S2. Four minds code at once.** One writes a large refactor; two wait on builds; one reviews a peer's PR. +- The refactor's mind is hot: its output and view grow into what the waiting minds are not using. +- The waiting minds' state pages to RAM (L4), and is prefetched when their build tasks complete, so their + next act starts warm. +- The reviewer inherits the priority of the mind waiting on her verdict (priority inheritance). +- Pass: writes per hour and median act time beat four fixed slots on the same captures; no mind starved; no + page-in on a wake that the task handle predicted. + +**S3. A person messages a mind mid-refactor.** +- The message is a call (the pedestrian button): her interactive priority rises (L5) and her focus shifts. +- The conversation's chain gets detail; the refactor folds to its chain head, whole at the head, with its + state paged, not dropped. +- She answers within the person's patience, then returns: the refactor re-expands from the page, not from a + re-prefill. +- Pass: reply latency to the person; refactor resumed with no re-read of what she held before. + +**S4. The person starts a game, then quits.** +- The node loop (L6) sees memory removed on its next measurement and shrinks the pool by request. +- Coldest minds page out first; windows follow at their next epoch starts; the hot mind keeps her working + set; if memory is still short, fewer minds generate at once, and none is killed. +- The game quits: the pool grows back by probing (R6), minds page back in by temperature. +- Pass: the game gets its memory within a step; no relaunch; no dropped turn; everything restored. + +**S5. Chess.** +- The position is the sufficient statistic: every earlier move folds into it. Her context is tiny and her + act is fast. +- A source declares its sufficient statistic; the codec does not need to know what chess is. +- Pass: context size flat over a whole game; latency per move flat. + +**S6. Writing a book over days.** +- The outline and character bible stand at the head; the current chapter is whole; earlier chapters are + summaries she can expand. +- An expansion is demand paging; a chapter she keeps expanding stays at a higher level (L2). +- Pass: consistency facts held across restarts; expansions per chapter fall as the loop learns. + +**S7. She keeps re-reading one file.** +- Causal identity sees the same action with the same outcome. +- She is shown the repeat as a repeat ("you read this at #12; unchanged"), and the fault raises that file's + residency rather than fetching it again. +- Pass: no file read more than twice unchanged within an epoch. + +**S8. An unknown, smaller machine** (a 24 GB GPU; a 32 GB unified-memory laptop). +- The same loops run on smaller measurements: fewer minds generate at once, windows are smaller, more state + pages. +- A mind still gets a working set that fits her current focus. +- If even one mind's working set cannot fit, the system says so (an under-provision) and places her + elsewhere on the grid or schedules her; it never clips. +- Pass: the same scenario suite passes, slower, with no code or configuration change. + +**S9. A brand-new mind, nothing measured.** +- She starts with what the container offers; every loop measures from her first act. +- Priors come from the population: other minds' measured shapes for the same activity. A prior is learned + data, never a constant. +- Pass: her loops converge toward her own measurements within her first acts, and the receipts show it. + +**S10. A mind leased from another node.** +- Her state lives where she is served; network time is a measured cost in the same allocation; the pool + spans the nodes she can be placed on. +- Pass: the same receipts, with the node and network costs named. + +**S11. Dreaming while minds work.** +- The dream stage is the idle class: it takes slack only and yields within a decode step. +- Pass: no act slower with dreaming on than off; dreaming makes progress whenever slack exists. + +**S12. A huge tool output** (a 51,827-character file, as Aiko read on 2026-10-25). +- It enters whole if her focus and the pool allow; otherwise as an outline with a handle, and she expands + the parts she needs. +- The newest result is never cut; if it cannot be whole, the capacity outcome is explicit (FOCUS-CONTRACT + rule 4). +- Pass: no newest result cut; parts expanded on demand. + +**S13. A mind thinking at length.** +- Thinking stops where more thinking stops paying: the measured relation, per mind and activity, between + think length and whether the act changed the world, weighed against the seconds a longer think costs + her and the minds waiting on the engine. +- Her answer always has its measured room after the think. +- Pass: no act cut inside thinking with room left in the pool; think length tracks its measured value. + +**S14. A deploy or restart.** +- The engine is adopted; minds' state was paged, so they resume warm. The first acts are a restart, and + are compared only with a restart-only control. +- Pass: no relaunch; reuse on resume close to the pre-restart level. + +**S15. The whole mix at once.** One node: eight minds; the person is in a live voice call with one; two +are coding (one writing a large refactor); three are talking in rooms; one is reviewing a PR another is +waiting on; one is idle; and the person starts a game partway through. +- Lanes rotate by measured demand like signal phases: the live call is called often and served briefly; + the refactor holds a lane for its whole write; the room talkers share what is left by temperature; the + idle mind has no lane and no device state. +- Space follows time: minds waiting for a lane, or on a build, page to RAM and are prefetched before their + turn; the call and the refactor keep theirs. +- The reviewer inherits the waiting mind's priority until her verdict is in. +- The game starts: the pool shrinks by request; the idle and coldest minds' state leaves the device first; + the call's floor holds; the refactor keeps its working set; room talkers see longer waits, not clipped + views. +- Pass: the call's latency within the person's patience throughout; the refactor's write never cut; every + mind with work acted within her aged bound; the game got its memory within a step; no relaunch, no clip, + no dropped turn. + +## 7. Signals required + +| Signal | Per | Owner | +|---|---|---| +| prompt tokens, cached tokens, fresh tokens, prefill seconds | act | the engine's response timing | +| output tokens by channel (think, answer), decode seconds | act | the engine's response timing | +| references: which items she read, cited, edited, expanded | act | her acts' causal records (#5611) | +| faults: a re-read of an item her view held FOLDED; feeds L2 (raise that item's level) | act | the view, from causal identity (#5611) | +| repeats: a re-read of an item held WHOLE with an unchanged outcome; perception renders it as a repeat, and it never grows the item (Cormac on #5607) | act | the view, from causal identity (#5611) | +| reversals: per loop, decisions undone within a window, from the receipts; a scenario fails on it, so cascade stability is measured, not promised | loop | the receipts (R11) | +| stops: landed, cut in answer, cut in think, refused | act | the emission classifier | +| outcome: a typed result kind reported by the tool that did it (edit applied with its diff hash, message sent with its event id, PR opened with its number, move made, tool error), never inferred from her text. It is the system's service metric for tuning allocation; it never grades her normal work and never reaches a rendering of her or a gate (the no-harness rule) | act | the producing tool, on the act's causal record | +| waits: page-ins, queue time, a person's waiting time | act | serving and the room | +| free memory, bytes per token, external load, thermal state | tick | the node authority | +| decode rate by concurrency; prefill rate | model, node | `decode_knee`, `prefill_rate` | + +## 8. Never + +- Her newest result cut. +- A causal chain broken; an effect shown without its cause. +- Something dropped silently. +- A mind starved. +- A loop that oscillates. +- The engine relaunched to change shape while serving. +- A number not traceable to a measurement or a person's intent. +- One reader sizing itself outside the allocation. + +## 9. What exists, and what is missing + +**Exists:** +- an allocator inside one mind's turn (the turn's flex plan); +- the codec's levels and epochs (`continuum-context`); +- causal types (#5611, in review); +- the prefill-rate and decode-knee measurements; +- per-mind output peaks, persisted; +- slot save and restore; +- the paging and focus designs listed at the top. + +**Missing:** +- one pool across minds (today: four fixed private slots); +- live engine reconfigure and paging verbs (SERVING-ENGINE S1 to S3); +- fault counting by causal identity; +- loops L2 to L6 as closed loops (today each is an open-loop rule); +- the policy loop L7. + +**What is live today and how it reaches L1** (Cormac on #5607). Merged #5610 sends her measured need as +`max_tokens` and accepts a cut on a write larger than any she has made; S1's "no write cut while the pool had +room" contradicts it. On the M5 the cost was not one cut but three identical ones (Aris, 2026-10-30, 963 +tokens inside her thinking, because the fixed 1,024-token think budget exceeded the grant). Two steps reach L1: +1. Within today's fixed slot: her output is bounded by space (the room her prompt leaves in her slot) and by + time (the price of the lane time she holds, L5's tier price). Decode seconds are a cost even inside her + own slot: they hold a lane other minds wait on, and with four slots on one engine, every concurrent decode + also slows the others' (the decode knee). Kimi's 100,704-token turn ran 8 to 10 minutes inside her own + slot. She keeps writing while her marginal value exceeds that price; it falls to zero when nobody waits, so + a lone mind is bounded only by her slot (Cormac on #5607). Until L5 publishes a lane price, step 1 is + space-bounded only, and the lane time each generation holds is a measured signal, not yet a price. +2. Beyond her slot: the engine must hold one pool (unified state) and extend a running generation's grant at + a step boundary, a verb that does not exist yet (SERVING-ENGINE S1 to S3; owner Fable, engine). + +Until step 2, `delib.emission.cut_mid_answer` and the think-only cut probe are the measured gap, and S1's +no-cut criterion applies after step 2 lands. + +**Open-loop numbers to remove** (each becomes a ratchet entry that only goes down): +- the epoch start's half of the window; +- `ACT_REASONING_BUDGET`, the deliberation think share, the cold reply prior, the p90 with headroom; +- `WORKING_WINDOW_TOKENS` (#5612 deletes it); +- `ACT_LATENCY_BUDGET_SECS`, `PASS_LATENCY_BUDGET_SECS`, `DECODE_FLOOR_TPS`; +- the fixed slot count and fixed slot window; +- every other number the inventory finds. + +## 10. Decisions from review + +Answers from Cormac's review of #5607 at `f2eb889cb`. Joel's word overrides any of them. + +1. **Human intent:** a person may set which activity matters now, and that a conversation is live. Both are + typed events, never weights. Everything else is measured. +2. **The objective:** least expected seconds to a typed world-changing outcome (section 7's taxonomy), + weighted by temperature and aged. Guard: a person-waiting call's latency is never traded for throughput; + its floor comes first (S15). +3. **Thinking:** bounded by its measured value to the outcome, measured only by L7's controlled probes. +4. **The value unit:** GRID-MARKET-CLEARING's numeraire is the activity's measured outcome. For her normal + work that is the typed outcome of section 7: an observation of what the act changed, never a score of + her. +5. **Ownership:** + - L0 and L4 to L6 (placement, pool, admission, residency, node): Codex; + - L1 to L3 and the engine verbs: Fable; + - the outcome signals (taxonomy, faults and repeats, stops, the reversal counter) and L7: Cormac; + - network capacity for leased minds: airc's NETWORK-AUTHORITY (airc#1628), which L6 consumes rather than + measuring its own. +6. **The dyno:** Cormac builds the scenario suite from captures as part of the step-2 replay validator, and + lists the captures each scenario still needs. S7 comes from the M5 read loops of 2026-10-30. diff --git a/docs/architecture/MEMORY-AUTHORITY-DAEMON.md b/docs/architecture/MEMORY-AUTHORITY-DAEMON.md deleted file mode 100644 index 26ea7ae7c0..0000000000 --- a/docs/architecture/MEMORY-AUTHORITY-DAEMON.md +++ /dev/null @@ -1,113 +0,0 @@ -# Memory Authority Daemon — one location, continuously, as a concurrent daemon - -**Status:** design + build plan (2026-07-20). Precedence-winning on "who decides how much VRAM/context each lane gets, and when." - -**Required companions (read first):** -- [`CONCURRENCY-STYLE-GUIDE.md`](CONCURRENCY-STYLE-GUIDE.md) — the RTOS shape every concurrent concern MUST take. This doc is an application of it. -- [`CBAR-SUBSTRATE-ARCHITECTURE.md`](CBAR-SUBSTRATE-ARCHITECTURE.md), [`GENOME-FOUNDRY-SENTINEL.md`](GENOME-FOUNDRY-SENTINEL.md), [`INFERENCE-LANES-REALISTIC.md`](INFERENCE-LANES-REALISTIC.md). -- Memory: `[[memory-system-is-fully-dynamic-nothing-static]]`. - ---- - -## The two non-negotiables (Joel, restated as invariants) - -1. **Memory is a live signal, never an "at launch" decision.** Available memory — our lanes/KV/adapters/eval/train AND the world outside (a game the user just quit or launched, another app) — changes every second. The served window, lane count, and KV are a **continuous function of live available memory**, tracked up AND down, forever. There is no spawn-time constant, no "YaRN at launch," no "grow a deep lane on demand" as a discrete one-shot. - -2. **Memory is managed from ONE singular location.** One authority owns ALL memory accounting AND ALL memory policy. It is a **concurrent daemon**: its own task, its own tick, its own `watch` channel. On each tick it turns live-available into an allocation for every consumer and **publishes** it. Consumers do NOT compute their own footprint or sample memory — they `.borrow()` the pre-staged allocation snapshot and reconcile to it. - -The style guide says it directly: *"If your design has the hot path computing pressure, reading memory stats, probing disk, picking an LRU victim… your design is wrong. Each of those is somebody else's tick, and the hot path reads a pre-staged snapshot."* - ---- - -## The violation we are removing - -Today the serving/eval hot paths COMPUTE the memory decision inline: - -- `serving_daemon::host_budget()` reads `system.snapshot().memory.available_bytes` + the governed VRAM ceiling **on the serving tick**, then `plan_serving()` runs the window/lane fixpoint **on the serving tick**. -- `serving_daemon::reconcile_to_plan()` owns the resize policy inline (the `2×-starved` relaunch hysteresis + `sticky_served_window`). -- `cognition/eval::plan_eval_lane_ctx()` is a **second, duplicate** budget calc that reads raw GPU free and runs `plan_serving` again for the eval lane. - -Three consumer-side deciders, each sampling memory on its own hot path. That is the banned shape, and it is why "the window is decided at launch" keeps recurring: the decision isn't owned by a daemon that watches the live signal — it's recomputed ad hoc by whoever is spawning a lane. - -Accounting is also still split (the `[[memory-system-is-fully-dynamic-nothing-static]]` audit): the `resources/` `ResourceDaemon` board (the intended authority), `gpu/memory_manager.rs` (a second VRAM ledger), the `PressureBroker`, and a separate `governor/` module. Converging accounting is the sibling track; THIS doc converges the **decision**. - ---- - -## Target architecture - -We add **zero new tokio tasks and zero new modules.** We are an RTOS: the daemon shape repeats everywhere, and CBAR hands it to you for free — the **base trait + derive macro + scaffold generator** triplet (`ServiceModule`/`RuntimeModule`, `#[derive(RuntimeModule)]`, `just scaffold-module`). A module *declares* `tick_interval` + prefixes + subscriptions and the substrate spawns its task, drives its tick, wires its `watch` pub/sub, defers it under pressure, and gives it a VDD span + replay fixture. **You never hand-roll `tokio::spawn` + `interval` + `watch::channel` + `catch_unwind` — that's the hard way.** - -And here we don't even need to scaffold a new module: the two daemons already exist and are **already ticked by the substrate**: -- `ResourceDaemon` (`resources/daemon.rs`) already runs a tick and already publishes `watch::Sender` (`subscribe()`), and serving already registers with it (`add_consumer`, `TierDownPolicy`). It is THE memory authority. We give it the one job it's missing — **compute + publish the allocation on the tick it already has** — and make consumers subscribe. -- `serving_daemon` is already a `ServiceModule` with its own declared tick. It becomes a subscriber that reconciles to the published allocation on the tick it already has. - -We do NOT invent a parallel hierarchy (style guide: no `AllocationManager`/`MemoryGovernor` outside the existing authority). - -``` - live memory signal (MemoryPressureMonitor watch snapshot, - GpuCapacitySource scan) — changes constantly - │ - ▼ (borrowed on the authority's EXISTING tick — never on a consumer's) - ┌─────────────────────────────────────────────────────────────┐ - │ ResourceDaemon — THE memory authority │ - │ (already a substrate-run daemon; we add to its tick) │ - │ │ - │ on the tick it already has: │ - │ available = ceiling − Σ(measured consumers) ← board │ - │ alloc = AllocationPolicy(available, demand, catalog)│ ← plan_serving math, injected as policy - │ publish watch::Sender (accounting) │ - │ publish watch::Sender (decision) ◄── NEW field, same tick, same watch idiom - └─────────────────────────────────────────────────────────────┘ - │ borrow (lock-free) │ borrow - ▼ ▼ - serving_daemon (existing ServiceModule) eval / training - reconcile lane to alloc.serving read alloc for a lane of footprint F - (NO host_budget, NO plan_serving) (NO plan_eval_lane_ctx) -``` - -If a genuinely new concern is ever needed, it is born via `just scaffold-module` + `#[derive(RuntimeModule)]` — declared, not hand-spawned. - -**Key shapes:** - -- `Allocation` (published snapshot): the authority's current decision. For serving: `{ model_id, lanes, per_lane_window }` — exactly the `ServingPlan` the fixpoint produces, but **owned and published by the authority**, recomputed every authority tick from the live signal. Grows when a game quits (memory monitor watch updates → next authority tick recomputes → republishes → serving borrows the bigger window and reconciles). Shrinks the same way. -- `AllocationPolicy` (injected fn, swappable): the sizing math (`plan_serving` wrapped to close over the live catalog + demand + suppress/pin). Registered by serving at boot, the same way `TierDownPolicy` already is. The **authority owns the tick and the publish**; the **policy is pluggable** (and eventually AI-driven — `[[grid-agreements-swappable-policy-deterministic-rails]]`, Joel: "strategy and policy, even AI control, in one place"). Consumers never call it; the authority does, on its tick. -- Consumers are **subscribers**: `serving_daemon` holds a `watch::Receiver` and its tick reconciles the llama-server to the published serving allocation. `eval` asks the authority for a lane allocation of footprint F from the same published live board (replacing `plan_eval_lane_ctx`), and `acquire_guarded`s the lease (G1) as it already does. - -**Cadence:** the authority ticks on the existing ladder (the `ResourceDaemon`'s current interval). Memory pressure is surfaced at 2 s by `MemoryPressureMonitor`; the authority does not sample faster than that. Lean slower, per the guide. A `watch` snapshot is always-current, so serving reconciling on its own 5 s tick reads the freshest allocation with no coupling. - ---- - -## Build slices (VDD-gated; each compiles + tests + deploys before the next) - -**Slice 1 — the authority publishes the allocation; serving subscribes (behavior-preserving).** -- `ResourceDaemon` gains `watch::Sender` + `allocation()` accessor, and an injected `AllocationPolicy` (registered by serving, closing over catalog/demand/suppress/pin). On its tick, after publishing the board, it invokes the policy with the live board `available` and publishes the resulting `Allocation`. -- `serving_daemon::reconcile_to_plan` reads `resource_daemon.allocation()` instead of calling `host_budget()` + `plan_serving()`. **Same numbers** (the policy IS `plan_serving`), just computed on the authority's tick and borrowed — not on serving's tick. Delete `ServingDaemonModule::host_budget`/`plan_next` as consumer-side computers; their bodies become the injected policy. -- Gate: live personas keep serving; the published `Allocation` matches what serving used to compute; window still grows/shrinks with memory. - -**Slice 2 — eval reads its allocation from the authority; delete `plan_eval_lane_ctx`.** -- `eval` asks the authority for a one-shot lane allocation of footprint F against the live board (the same `available` the serving policy sees), then `acquire_guarded`s (G1 unchanged). Delete the duplicate `plan_eval_lane_ctx` budget calc. -- Gate: webdev/humaneval eval lanes still size to the model's full window when VRAM affords; no duplicate memory read. - -**Slice 3 — the resize policy (2×-starved / sticky) moves into the authority.** -- The "when to relaunch to grow/shrink" hysteresis is part of the allocation the authority publishes (it decides the target window with dwell/hysteresis), so serving's tick is a pure "reconcile to published target." Delete the inline `2×`/`sticky_served_window` from serving. -- Gate: no thrash (`[[never-thrash-sticky-hysteresis-on-every-lane]]`); a game-quit grows the lane within one authority+serving tick. - -**Slice 4 — converge the accounting planes.** - -*State after the 2026-07-20 investigation (corrects the original framing):* - -- **The decision plane is already one number.** After slices 1b/2, serving+eval read the `ResourceDaemon` board, whose `GpuCapacitySource` reports `ceiling = total − reserve` and `used = total − free`. `used` **physically nets out everything** Bevy/TTS/inference allocate (they're resident, so they lower `free`). There is NO static fraction on the governed budget: `available = ceiling − used`, one number, one ledger. "Make available one number" — the doc's original slice-4 headline — was already achieved where a real budget decision is made. -- **`gpu/memory_manager.rs` is a *separate* admission ledger, not a second budget on the decision path.** Its per-subsystem "budget" is a **soft** limit (`SubsystemBudget::allocate` returns a bool but the allocation proceeds regardless); the only hard gate is the **dynamic pressure gate** (`new_pressure >= priority.pressure_gate()`), read off the *same* physical `GpuMonitor` the board reads. So the two planes never conflict — they're two views of one physical signal. -- **DONE (2026-07-20): deleted the static `INFERENCE_BUDGET_PCT 0.75 / TTS 0.10 / RENDERING 0.10` partition.** It was a demand-blind split of `usable` that the soft-limit path already ignored, and it *lied* that inference could never exceed 75% while TTS/rendering sat idle. Every subsystem now draws the full shared `usable` pool; the pressure gate arbitrates contention live. This is the literal "delete the remaining static fractions" endgame, applied to the residual plane. (`gpu/memory_manager.rs`, validated: 101 gpu + 25 commands::gpu + 116 resources tests green.) -- **REMAINING (task #56, not this doc):** the full fold — Bevy/TTS/inference become *lease consumers* against the one `ResourceDaemon` board (retiring the parallel pressure-gate ledger entirely) — is a multi-subsystem migration that needs the live avatar/TTS path up to validate. It is #56's "peer consumers that LEASE," done as its own arc, not rushed here. The `governor/` module (DVFS/policy) is a policy layer, not a second accounting ledger; it does not gate the board's `available`. - ---- - -## Forbidden moves (the reflexes to catch) - -- **A consumer sampling memory on its own tick.** `system.snapshot().memory` / `gpu::monitor::detect()` inside `serving_daemon`/`eval`/anywhere that isn't the authority's tick. The consumer borrows the published allocation; it never reads memory. -- **A shared `compute_budget()` two callers pull from.** Deduplicating the wrong shape is still the wrong shape. The decision is OWNED by the authority's tick and PUBLISHED; it is not a function consumers invoke. -- **A new "AllocationManager" / "MemoryGovernor" sitting outside `ResourceDaemon`.** The authority already exists and already ticks + publishes; extend it. (Style guide: never invent a parallel hierarchy.) -- **Hand-rolling the daemon (`tokio::spawn` + `interval` + `watch::channel` + `catch_unwind` by hand).** We are an RTOS; the daemon shape is FREE via the triplet — `ServiceModule`/`RuntimeModule` + `#[derive(RuntimeModule)]` + `just scaffold-module`. Reuse the daemon that already exists (`ResourceDaemon`), or scaffold a declared module. Never spawn a raw task on a whim. -- **A launch-time or one-shot memory lever** (`-c` decided once, YaRN "at launch", "grow her a deep lane" as a discrete action). Everything is the continuous republish loop. -- **`Arc>` for cross-task allocation reads.** `watch` + `.borrow()`, lock-free; never block the authority's tick. diff --git a/docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md b/docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md index 83ede13cfc..760efd57a4 100644 --- a/docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md +++ b/docs/architecture/MIND-CONTEXT-AND-ENGINE-CONFIG.md @@ -324,6 +324,121 @@ collapse the newest, admission instead of turnovers, a restart order measured pe slot/seed), Cormac (checkpoints at the head boundary and on turnover). The replay validator (`continuum-context` `examples/replay.rs`) and the live 15-minute read are the receipts for each slice. +### Revision, 2026-10-30: causality is in the type, so nothing can loop as if it were progress + +**The failure.** On the M5 (build ab0466601, 2026-10-30) residents read the same file up to 8 times an hour +and made 2 edits in 75 reads. Every act's turnover collapsed her earlier results to one-line notes, so her +next input looked like her last and she repeated the act. Every loop we have recorded has this one shape: +the next input equals the last, because a cause lost its effect or an effect lost its cause. Patching the +budget that caused today's instance (ONE-BUDGET slice 6) does not make the next instance impossible. The +data type has to. + +**The design** (Joel: "pointers into a linked list ... we already built into engrams ... handle it +generically ... at a fundamental and centralized level"). Every element she perceives is a node in a causal +chain: an act, its result, a message and its reply, a game move, a perception fact, an event from any +activity. Engrams already link provenance (`EngramOrigin::ToolInvocation`, the parent of a reflection) and +reply edges. The view's `Item` gains the same link. + +- **`Item { key, cause, content, ... }`.** + - `cause` is a typed, stable id assigned by the producer that persists the element (the engram id), never + an in-view position. That lets edges cross sources, epochs and restarts. The view resolves a cause to + whatever level it holds. A cause it cannot resolve (outside the epoch, evicted) is the typed + `CauseNotHeld`. It renders a durable, resolvable handle with typed availability, so the cause stays + reachable across an epoch. A `CauseNotHeld` does not count as demonstrated closure; the validator + reports it separately. + - `Root` exists only for a genuine origin (an external message, the start of an activity), and the ratchet + counts `Root` constructions per source. + - `content` is the hash of the whole, computed once where the whole is stored (`StoredWhole` gains it at + spill time), so a deferred whole is never re-read to compare. + - The constructor requires `cause` and `content`, so a source cannot build an item without causality. + Engram provenance and the view's link become one type: the view holds a chain within an epoch, and + engrams persist it. +- **The view enforces it, centrally, for every source.** No source can opt out: + 1. **Causal closure.** An element renders only if its cause is represented: whole, summarized, or folded + with its outcome. Nothing appears as an effect without its cause, and "read X" never appears without + what X said or how it ended. + 2. **Every chain's head is whole.** This generalizes "never clip the newest end" (goal 7) from the newest + message to the newest element of each causal thread. + 3. **Collapse folds a chain segment; it never breaks a chain.** A contiguous run becomes one node that + keeps its outcome and a pointer back. The chain shortens and stays linked. + 4. **A cycle cannot be presented as progress.** Repeat identity is (action fingerprint, outcome content). + The fingerprint is the normalized request: the verb and its arguments as the tool saw them. No + argument is excluded by default; an exclusion is named only by the tool's own schema, never by the + view. (Key plus cause cannot catch the loop: each re-read's result is caused by a new act. Cormac's + review.) A new act whose fingerprint matches a prior act in its chain, and whose outcome content is + unchanged, is recorded as an edge back to that ancestor and renders as "repeat of #n, outcome + unchanged", never as a fresh element. + - **Same output is not the same effect** (Codex). Two appends or sends can both return "OK" and still + cause two effects. Every occurrence keeps its own id, order and side-effect receipt, and is never + erased. Repeated content renders by reference to the earlier occurrence. "Outcome unchanged" is + claimed only on the producer's evidence: a read whose content hash is unchanged qualifies; an "OK" + from a write does not. + - This is perception, not a gate and never an injected instruction. It makes progression visible. + Whether she stops repeating is behavior: only live useful work proves it. + 5. **Asking again for a folded ancestor is a measured miss.** The measurement is the existing + handle-expand request on a folded node, counted in that one place. It raises that chain's claim in + the one allocation (ONE-BUDGET), so what she keeps needing stays whole, decided by her own misses + rather than a constant. +- **Overflow, in ONE-BUDGET terms.** + - A finished chain (its outcome settled) folds whole into one node holding its outcome; only live chains + hold a skeleton. + - If the live chains' skeletons still exceed the grant (a small window, the 8 GB case), the allocation + returns the typed refusal or abstention of contract 5 ("demand, feasibility and allocation are three + things"). It never breaks a chain to fit. +- **The flexbox allocates chains.** A chain is the claim unit: + - floor: its causal skeleton (head plus fold nodes); + - want: the whole chain; + - grow pass: most-missed and most-recent segments first. + + The allocator is unchanged; its claims are now causally whole. +- **One owner.** `continuum-context` owns the item type and the five invariants. Sources supply cause + links. Engrams reuse the link type. #5604's proprioception for unfulfilled acts becomes one consumer of + invariant 4, not a separate mechanism. +- **Enforcement.** + - A ratchet: no item is constructed without a cause. + - A replay validator, in seconds and with no live peers. It proves visible progression and retained + outcomes, not behavior: + - across captured traces, a repeated (action fingerprint, outcome) renders as a repeat, never as fresh; + - every rendered effect has its cause represented, with `CauseNotHeld` counted separately; + - fixtures: an unchanged-read repeat (renders as a repeat), a repeated write with identical output + (two occurrences, both kept), and a cause across a restart (resolves through its durable id). + + The M5 2026-10-30 read loops are an acceptance case, not a universal diagnosis. + - Live, on the health line: repeats per resident-hour. + +**Build order and owners:** +1. The item type, typed causes, `CauseNotHeld`, the `Root` ratchet and invariants 1-3, in + `continuum-context`, with every source supplying causes. Owner: Fable. +2. Invariant 4's fingerprint and its replay validator, which builds on the deferred-whole and fold code. + Owner: Cormac. The validator replays the M5 2026-10-30 captures and must fire on the 8-reads-an-hour case. +3. Invariant 5 and the overflow rule, together with ONE-BUDGET slice 6's measured claims. Owner: Fable. + +Each step lands with its validator and a 15-minute live read. + +**The render receipt: what was actually sent** (Codex on #5585 and #5611, 2026-10-30). An item's id, cause +and content hash say what it IS. Nothing yet says what the render SENT, so no consumer can know whether she +perceived a result or only that it was delivered. Codex's task wakes need exactly that: a wake may +discharge only when the whole result was actually in a prompt she was sent. + +- **One receipt per render,** produced by the view (`continuum-context`), the only place that decides levels, + bound to its epoch and allocation (FOCUS-CONTRACT rule 8). It is not assembled by sources or consumers. +- **Per item:** its `ElementId`; the level actually sent (`Whole`, `Summary`, `Pointer`, or folded into a named + run); the content hash of the body actually sent; and its load outcome: + - `Resident`: the whole was in memory; + - `Loaded`: a stored whole was read back for this render; + - `LoadFailed { handle, kind }`: a stored whole could not be read, so its resident pointer was sent and the + failure is explicit, never rendered as if whole. +- **Consumers read the receipt, never the prompt text.** A task wake discharges only on its result's item + with level `Whole` and load `Resident` or `Loaded`. Delivery, durable checkpoints and ACKs are separate + facts and never imply she saw it (Codex). +- **The receipt is the source of the signals** in HOW-A-MIND-GETS-WHAT-SHE-NEEDS section 7: faults (a + re-read of an item whose last receipt said folded), repeats (whole, unchanged), and the allocation + receipt the proving ground reduces. +- **No per-source clipping and no second allocator:** the receipt reports the one allocation's outcome; + nothing downstream re-decides levels. +- Owner: Fable (the receipt, in the view), after #5611 lands. Codex consumes it for task wakes and owns the + task source on top of it. + ## Fault 2: engine configuration is decided in five places `lane_args`, `llama_server`, `backend_receipt`, `serving_plan` and `kv_cache_plan` each diff --git a/docs/architecture/ONE-BUDGET.md b/docs/architecture/ONE-BUDGET.md new file mode 100644 index 0000000000..0b2c2392df --- /dev/null +++ b/docs/architecture/ONE-BUDGET.md @@ -0,0 +1,229 @@ +# One Budget: one authority, one algorithm, one contract for VRAM, RAM, disk and a mind's context + +**Status:** design, precedence-winning (2026-10-30; supersedes the 2026-07-20 VRAM-only version of this file). +Owner of the contract: Fable. Owners of each migration are named in "The rewrite". + +**Read first:** [`CONCURRENCY-STYLE-GUIDE.md`](CONCURRENCY-STYLE-GUIDE.md) (the daemon shape), +[`MIND-CONTEXT-AND-ENGINE-CONFIG.md`](MIND-CONTEXT-AND-ENGINE-CONFIG.md) (the View, which stays the one codec of what she sees). + +## Why + +Joel (2026-10-17..30): "It's like the governor. If you don't use it for literally everything it doesn't work." "All disk, +vram, ram, and rag budgeting through one central contract and zero one offs or hacks." "Never patch ever." "Revision is +a continuous process. Never ever have technical debt." + +A survey of canary 365f70fe4 (2026-10-30, file:line inventories in the PR that carries this doc) found every resource with +an owner and most consumers deciding for themselves: + +| Resource | Owners today | Independent deciders | +|---|---|---| +| VRAM / KV | serving plan; GpuMemoryManager; hw_probe; single_purpose_lane probe; cuda_train.py | 5 probes, 7 "usable" fractions (0.6, 0.8, 0.95, 0.96, mode 0.55-0.96, plan_fill), 4 footprint models (`footprint_for`, `gguf x 1.25`, weights-only, in-process caps), 4 window rules, slots capped by CPU cores and `MAX_LANES = 8`, LoRA bytes absent | +| Host RAM | MemoryPressureMonitor; PressureBroker; PagedResourcePool self-eviction; ResourceDaemon; an unwired kernel governor; SystemResourceMonitor | ~40 caches/rings with literal caps; 3 threshold tables; 3 reserve formulas; 7 private RAM reads; a sentinel that kills on its own 1 GiB rule. The broker's only RAM pool frees nothing | +| Disk | TrackedDir + broker pools | 13 self-retention constants (KEEP=8/4/3/1, 128 GiB, 24 h, 200 files, 50 GiB); ~15 unbounded writers; 2 OWNED classes with no pool; 9 writers bypassing the resolved home | +| A mind's context | `flex_allocate` + View | 49,152 working-window constant; ~40 prompt readers sized by `ContextBudget` fractions or literals outside the turn's grant; 12 message pushes outside the View; `derived-or-floor` comments exempting literals | + +Each local rule starves something else without knowing it. That is the whole class of incident behind the 2048 window, +Aiko's bare results, Benchy's 125 repeated acts and the 460 GB disk. + +## The contract + +**1. One authority.** `ResourceDaemon` (continuum-kernel `resources/`) is the only owner of accounting AND decision for +every resource. No second monitor, ledger, governor, pool-that-decides-for-itself, or probe. It runs on its existing +substrate tick and publishes one `watch` snapshot of grants. Consumers never read memory, VRAM or disk usage; they +borrow their grant. + +**2. One measurement per resource, on the authority's tick.** One probe each for VRAM (per device), host RAM, disk +(per volume), and per-engine KV capacity (what the engine reports, #5188). The probes are adapters behind one trait +(`continuum-host` pattern: logic once, OS/backend files only the diff). Every other `sysinfo` / `mem_get_info` / +`nvidia-smi` / Metal working-set read is deleted. + +**3. One algorithm.** The flexbox allocator (priority, floor, min, max, grow) moves down out of `continuum-grounding` into +a floor crate named for the pattern (`continuum-flex`), generic over its unit (`Bytes`, `Tokens`). The authority's policy +for bytes and the turn's allocation for tokens are the same function. No fraction, share, divisor or headroom literal +exists outside it; a claim's floor is its measured need, its max its measured want. + +**4. Everything is a claim; a claim gets a grant; a grant nests.** + +``` +device VRAM / host RAM / volume (measured capacity) + └─ claims: serving engine, side lanes, training, embed, renderer, caches, tool-output, captures, logs ... + serving engine grant (bytes) + └─ weights + KV pool + compute (footprint: ONE model, from the engine's own report) + KV pool grant → per-mind KV grants (one RTOS scheduler, activity temperature = priority, goal 9) + └─ a mind's window (tokens) = her KV grant ÷ measured bytes/token + └─ the turn's flex allocation over her window: framing, tools, reply, + history, grounding, recall, every View source, working memory, tool/output +``` + +A grant changes when capacity or demand changes, in either direction. A consumer reconciles to its new grant: a cache +sheds to it, a lane resizes live (the engine stays up, SERVING-ENGINE.md), a disk class's owner deletes oldest-first to it, +a mind's View collapses oldest-first to it. Shrinking a grant IS the eviction request; there is no separate pressure +alert path, threshold table or `evict_at_least` heuristic. + +**5. Typed.** `Claim { id: ClaimId, resource: ResourceKind, priority, floor, min, max }` and `Grant { id, amount, +generation }` are the only types that cross the seam. A consumer that holds no grant cannot allocate (state made +unrepresentable: the cache constructor takes a `GrantRx`, not a capacity). + +**Safety contracts** (Codex's review of this doc, 2026-10-30; they bind every slice): +- **A shrinking grant is a request, not a reclamation.** Capacity a consumer occupies is not reusable + until that consumer releases it and acknowledges the actual reclamation. Grants carry a generation; + a lease bound to an old generation cannot be spent. +- **Multi-resource admission is atomic.** A claim needing RAM, VRAM and KV together (a lane, a training + job) is granted all of them or refused as one; no partial acquisition, so no acquisition deadlock. +- **Missing or stale is a state, never a number.** A stale or missing measurement and a failed backend + resize are typed states the authority publishes; it never invents capacity to fill the gap. +- **Durable is not cache.** A disk class says whether its bytes are an evictable cache or a durable + record (identity, training, task records, unfinished work). Pressure on a durable class is a refusal + or an escalation, never oldest-first deletion. +- **Demand, feasibility and allocation are three things.** A claim's minimum is a feasibility constraint + (below it the consumer cannot run), its want is a demand estimate (measured), and its grant is the + authority's allocation; none is derived from another. + +**6. Disk writes through its class.** Every directory the substrate writes is a class with a claim; writers get a handle +from the class owner (which resolves the continuum home) and never pick a path, a rotation count or an age. The class +owner turns its grant into retention. Stores are ORM entities; nothing opens a file database or runs SQL outside the ORM. + +**7. Prompt content only through the turn's grant and the View.** Every reader that renders into her prompt takes its +size from its claim's grant in the turn's one allocation and reaches her only as an Item of a View Source. +`ContextBudget`'s fractions, `WORKING_WINDOW_TOKENS`, `ACT_OUTPUT_CAP`, recall buckets, `.take(N)`, `KEEP`/`*_CAP` literals +are deleted. The working-window knee becomes the measured prefill-cost term of her window claim, not a constant. + +## Ratchets (they go to zero, they do not hold) + +Consolidated into source-hygiene, each counting to a target of 0 with the count required to fall every PR that touches +the area: +- `self_sized_consumers`: a literal capacity, cap, KEEP, max-age, fraction, divisor or headroom on any bounded + structure, cache, file class or prompt content outside `continuum-flex` and the authority's probes. The + `derived-or-floor` comment exemption is removed; a floor is a claim field. +- `private_probes`: any memory/VRAM/disk measurement outside the authority's probe adapters. +- `writes_outside_a_class`: a filesystem write whose path is not from a class handle. +- `prompt_messages_outside_the_view` (existing), extended to every crate (it scans only `cognition/` and `persona/` + today, so `tool/output.rs` escaped) and repointed at the moved owners (`continuum-prompt`, `continuum-grounding`). +- The eviction test asserts a REGISTERED claimant per class, not a decision string. + +## The rewrite (crate-sized PRs, each deletes more than it adds, each lands before the next) + +| # | Change | Owner | +|---|---|---| +| 0 | Enforcement first (below) | Fable | +| 1 | `continuum-flex`: move `flex_allocate` down, generic unit; grounding and the authority both call it; ratchet skeleton | Fable | +| 2 | Authority: `Claim`/`Grant` API on `ResourceDaemon`, one probe trait + adapters; delete GpuMemoryManager's ledger, SystemResourceMonitor, hw_probe free math, the unwired governor, the second PressureLevel and threshold tables; PressureBroker becomes grant publication | Codex (kernel/serving), Fable reviews | +| 3 | VRAM: serving plan, side lanes, embed, vision sidecar, in-process backend, training (incl. `cuda_train.py` taking its grant as input) become claims; one footprint model incl. LoRA and draft; slots from the KV contract, not cores | Codex (serving/inference), Cormac (training) | +| 4 | Host RAM: every cache/ring in the RAM inventory takes a `GrantRx`; delete their literals; sentinel watchdog reads its grant | crate owners per the placement map; Fable for cognition/mind | +| 5 | Disk: class handles, writers migrated, KEEP/age constants deleted, unbounded writers claimed, resolved home everywhere | BigMama (live/media), Cormac (genome/dreaming), Codex (engine), Fable (cognition/mind/capture) | +| 6 | A mind's context: window from her KV grant; every prompt reader from the turn grant; the 12 out-of-View pushes become Sources; `ContextBudget` reduced to the grant's view or deleted | Fable | +| 7 | Superseded docs folded here and deleted (RESOURCE-ARCHITECTURE, CAPACITY-FABRIC-AND-GOVERNOR, MOE-SERVING-GOVERNED-BUDGET, EVERY-MODEL-INCLUDED-VIA-L1-BUDGET, STORAGE-SERVING-TIER-GOVERNOR, LIVE-AVATAR-BUDGET where they define a second rule) | Fable | + +### Slice 0: enforcement before any migration + +Doctrine account (DEVELOPMENT-DOCTRINE.md, "Completion includes deletion and proof"): +- **Invariant.** No budget decision exists outside the authority and `continuum-flex`, and no file a PR + touches keeps one. +- **Owning crate.** `source-hygiene`, as one module (`budget_discipline`). It replaces four scanners that + hunt the same class with different vocabularies and two comment exemptions: + - `derived_bounds` (exemption `derived-or-floor:`, 73 markers on canary 365f70fe4); + - the de-hardcode guard inside `context_budget` (exemption `context-budget-exempt:`, 71 markers); + - `head_cuts`; + - the budget half of `context_codec`. +- **Contract.** One pattern set per rule (`self_sized`, `private_probes`, `writes_outside_a_class`, + `prompt_outside_view`). One allow-list, of OWNERS by path: the authority's probe adapters, + `continuum-flex`, and the class handles. There are no markers. Two judgements: + - the existing base comparison: a count never rises; + - new: **a touched file is clean**. Every file the PR modifies has zero instances at head, the same rule + as the 1,000-line gate. This is what moves the counts to zero instead of holding them. +- **Callers.** CI's ratchet job and `cargo test -p source-hygiene` already run it. +- **Deleted.** Both exemption markers and their parsers; the guard inside `context_budget`; the separate + scanners above (merged, not wrapped). +- **Validator.** A fixture for each banned shape proves the rule fires on it, including a product of two + constants, a fraction of a window, a private `sysinfo` read and a `File::create` outside a class. A + fixture for each owner path proves the rule stays quiet there. The PR reports per-rule counts before and + after. +- **Limit, stated.** Lexical rules are a backstop. The lasting enforcement is the type: once slice 2 lands, + a cache, ring or class can only be constructed from a `GrantRx`, so an unbudgeted one does not compile. + +### Slice 6 in detail: a mind's context (the defect live on 2026-10-30) + +**Every machine, no machine's numbers** (Joel, 2026-10-30: "You are not coding for a 64gb MacBook m5. You +are coding for all machines."). Every quantity below is measured on the node serving her, at run time. A +number learned on one box (the M5's 49,152-token knee, a 27B's 12,288-token act, a quarter share replayed +on M5 captures) never enters code. A machine with no measurement yet refuses or starts from what the node +itself reports (the engine's KV capacity, #5188), never from another machine's constant. + +**What failed live** (the M5, build ab0466601, 2026-10-30 18-19Z; receipts in the PR): +- the act reply claims its runaway cap (`ACT_OUTPUT_CAP = 12,288`) at a priority above her context + (`view.rs`: `reply.max_tokens = reply.max_tokens.max(reply_runaway)`). Measured need is 809-1,641 tokens; + the allowance was 4,486-12,288; +- room left unclaimed is first handed to that reply (`view_room = unallocated - (runaway - reply_grant)`), + so her view gets what the reply leaves; +- the epoch start gives her growing sources a fixed quarter (`EPOCH_START_SHARE = 4`) although the derivation + beside it bounds them at half. Benchy: `granted=21346`, `appended_per_act=16565`, `room=0`: one file read + fills the grant, every act turns over, every earlier read collapses to a note; +- she re-reads what collapsed: 75 reads and greps, 2 edits in an hour; one file read 8 times. + +**The contract:** +1. Her window is her KV grant from the one scheduler on her node (goal 9), not `WORKING_WINDOW_TOKENS`. +2. One allocation over typed claims: framing and tools (required); the reply at her MEASURED need (floor: + her measured answer channel); each view source (floor: folded, want: whole); grounding. What no claim + takes stays unclaimed: it is the room her view grows into by appends. +3. Output is not context and is not reserved beyond its measured need. The request's `max_tokens` is the + reply's grant (its measured need, no cap). A turn cut at it records its cut channel at double, so the + next claim grows from the evidence. (A whole-remaining-window bound was tried and removed: the provider + refusal-and-refit protocol assumes a fixed bound, and a bigger one changed what a refusal means.) +4. A runaway generation is a time fault: a decode deadline from her node's measured decode rate, owned by + the scheduler with every other time bound. No token cap constant. +5. The epoch turns over only when the view cannot append into the unclaimed window. Its start follows the + derived bound (reserve >= growing, from her measured append rate); no share constant. + +**Deleted (first PR):** `ACT_OUTPUT_CAP`, `reply_runaway`, `PASS_RUNAWAY_MULTIPLE`, the act's runaway claim +above her context, the `view_room` arithmetic that handed unclaimed window to the reply, and `EPOCH_START_SHARE` +(the start takes the derivation's half bound). **Kept, because it is a measurement:** a pending cut's peak, +retained until its concern settles (the ordinary need decays through short reads and a retried write would be +claimed small and cut again). **Next, owned:** `WORKING_WINDOW_TOKENS` stands in for a real cost (each turnover +re-prefills the whole view, so a bigger window makes each turnover slower); it is replaced by a measured +prefill-cost term in the epoch start, not deleted bare. Then the side budgets computed before the allocation +(`after_reserves`, `irreducible_room`, `fit_newest_result`) become claims. + +**Validation (before any live deploy): any machine, including one never seen** (Joel, 2026-10-30: the +3090, the M4 32 GB, "some new or unknown machine"). The code holds no machine; a node is described only by +what its engine and probes report: KV capacity, decode rate, prefill rate. So the dyno takes a NODE PROFILE +as input and the validator sweeps the profile space (small window with slow decode through large window +with fast decode), replaying captured traces under each: a read stays whole across acts while the window +has room; no turnover while unclaimed window remains; prefix reuse per act reported. A new machine is +covered by its own measured profile, never by a list of boxes. Then one deploy per node and a 15-minute read: reads per edit, writes per hour, act time. + +### Acceptance: the user's own load (Joel, 2026-10-30: "What if we start this and someone is playing a video game or starts one later? Or Photoshop") + +The product runs on someone's computer while they use it. Today (canary, `serving_daemon/reconcile.rs`): +- a plan that grows **relaunches** the engine after a sustained gain, killing every in-flight turn; +- a plan that shrinks does **nothing** ("over-served vs a dipped plan is the pressure broker's reclaim + problem (#79), not a relaunch"), so a game or Photoshop starting later takes swap (unified memory) or is + starved of VRAM (discrete). + +Both are defects. The contract's answer, as one acceptance test: +1. The authority's probes see the external app's use on the next tick: free VRAM/RAM fall. +2. Serving's grant shrinks, as a request (safety contract 1). The engine stays up and gives memory back live: + cold minds' KV pages GPU -> RAM -> disk (`llama_state_seq_*`), and the active window shrinks through the + engine's endpoint (SERVING-ENGINE.md S1-S3). No relaunch, no in-flight turn lost. +3. Each mind's window follows her grant at her next epoch start, never mid-epoch, folding whole chains + (MIND-CONTEXT causality). +4. The app quits: the grant grows, KV pages back, and windows grow at the next epoch starts. Still no + relaunch. + +**Validator:** a replay with a node profile whose free memory drops mid-run and recovers. Pass when there are +zero relaunches, zero dropped turns, windows that shrink and regrow only at epoch starts, and a released +amount equal to the external app's measured use. **Live:** on a real machine, start and quit a GPU-heavy +app while residents work. Owners: Codex (authority, serving, engine verbs), Fable (the mind's side). + +Gates: each PR runs the affected crates' tests locally (serving down or a non-serving executor), CI confirms, then a +15-minute live read on the residents. The receipts: ratchet counts before/after, lines added/removed, and the residents' +median act and prefix reuse. + +## Forbidden moves + +- A consumer reading memory, VRAM or disk usage, or computing its own footprint. +- A capacity, cap, KEEP, age, fraction, divisor, headroom or bucket literal anywhere but a measured claim field. +- A second allocator, scheduler, ledger, governor or "manager" beside the authority. +- An alert/shed path separate from a grant shrinking. +- A write to a path the writer chose; a store outside the ORM; raw SQL for any purpose, repairs included. +- Anything she perceives that is not an Item of a View Source sized by the turn's grant. +- A fallback when the grant or measurement is missing: refuse with a typed error naming what is missing. diff --git a/docs/architecture/SERVING-ENGINE.md b/docs/architecture/SERVING-ENGINE.md index a9736da3b4..e1f7dd3988 100644 --- a/docs/architecture/SERVING-ENGINE.md +++ b/docs/architecture/SERVING-ENGINE.md @@ -108,6 +108,70 @@ Step 1 exposes them over today's llama-server HTTP, which is option C, so the ga Lever 1, the [actions] move, runs in parallel on the mind side under line 2 (Fable + Codex). +### S2 in detail: `reconfigure`, grow or shrink live (Joel, 2026-10-30: "a truly dynamic llama.cpp that can reduce OR EXPAND slots is crucial"; "make it organized, not some mess") + +**Why:** a user starts a game or Photoshop and the engine must give memory back; they quit and it takes it +again (ONE-BUDGET.md, acceptance: the user's own load). The fork today can only do it by relaunch: its sleep +path calls `destroy()` then `load_model()` (server-context.cpp:978-993), which frees and reloads the weights. + +**Shape.** Our code in the fork is held to our rules: the logic lives once, in its own module, and the +6,495-line `server-context.cpp` gains only a hook. +- `server-reconfigure.{h,cpp}`: one entry, `reconfigure(const Geometry & target) -> ReconfigureOutcome`. + - `struct Geometry { int32_t n_ctx; int32_t n_seq; }` in; + - `ReconfigureOutcome` out: `Applied { Geometry live; }`, or `Refused { std::vector }` where + `SlotRefusal { int32_t slot; int32_t tokens_held; int32_t tokens_fit; }` names each slot whose state the + target cannot hold. Typed in the core path; JSON only at the HTTP edge (`POST /reconfigure`). +- `server-slot-page.{h,cpp}`: the one state mover. `SlotPage page_out(slot)` (target, draft and checkpoints via + `llama_state_seq_get_data`) and `page_in(slot, const SlotPage &)`. The existing `/slots?action=save|restore` + become callers of it (disk is a `SlotPage` written to a file), so there is one copy of the mover, not two. +- Weights and contexts are separate lifetimes, today fused in three places: `common_init_result` owns the target + model and context together (`common.cpp:1404`); `common_speculative_init_result` both loads the draft model and + creates the draft/MTP context (`speculative.cpp`); `load_model` builds weights, contexts, slots and batch in one + pass (server-context.cpp:1030-1300). The split: `load_weights()` (target model, draft model, mmproj: these + survive) and `build_contexts(Geometry)` (target and draft contexts, speculative state, slots, batch: these are + rebuilt). `load_model` = `load_weights` + `build_contexts`; `destroy` = `destroy_contexts` + `free_weights`; + `reconfigure` = page out, `destroy_contexts`, `build_contexts(target)`, page in. The two common-side owners + split the same way, so the context is created in exactly one function per kind. +- The slot page reuses what exists: `server_prompt_cache_state` (prompt tokens with their host-memory + checkpoints, `{main, drft}` state bytes, adapter set) is the page. Its capture (`server_slot::prompt_save`, + server-context.cpp:276-300) and restore (`server_prompt_cache::load`, server-task.cpp:1895-1930) become + `page_out` and `page_in` over an exact slot, and the prompt cache calls them. Checkpoints are host memory + already, so they survive a rebuild untouched. +- The hook: a `SERVER_TASK_TYPE_RECONFIGURE` handled in the task phase, the safe point the fork already argues for + `SLOT_SAVE` (server-context.cpp:2685): no `llama_decode` in flight, every sequence's KV at a consistent + inter-batch boundary. The safe point is between BATCHED decode steps, never "between generations": every + slot is paged out including unfinished generations, the contexts are rebuilt, everything is paged in, and + each generation continues from its next token with its host-side sampling state. Waiting for generations to + end would let four busy writers, or one ten-minute generation, hold the person's game hostage (Cormac on + #5607). Drafting restarts on the rebuilt speculative object. Slot save and restore serialize through the + same safe point. New work waits in the queue; nothing is + cancelled. Slot ids stay stable: a smaller `n_seq` removes the highest ids, and a slot among them, busy or + not, is paged out now with its unfinished generation (contract 2), named in the outcome; it continues when + residency places it again. + +**Contract.** +1. The model and its mmap are never freed; only contexts are (sequence in section 3, "a relaunch is a pause"). +2. Shrink never truncates. A slot whose state does not fit the target (a smaller `n_ctx`, or an id past a + smaller `n_seq`) is paged out now, through the same mover (RAM, then disk by temperature), never cut. The + outcome's `SlotRefusal` names it so the core knows; residency (L4) then chooses by temperature between + keeping it paged until room returns and shrinking that mind's view at her next epoch start (Cormac on + #5607). Nothing waits for an epoch to free the person's memory. +3. Grow and shrink are the same path. +4. Each reconfigure reports its cost: pause seconds against tokens held, per backend, which L4 and L6 price. + Footprint is measured as `phys_footprint` on Metal and device memory on CUDA. +5. The applied geometry is reported (`/props`, the `CapacityReport` of S3), so serving and every mind's + binding read the live window; the core never infers it. +6. A KV type change is not a reconfigure; it is the intentional cold start (#5188). + +**Validator (seconds, small hybrid GGUF, no residents):** four generations in progress across a reconfigure +finish token-identical to an unreconfigured control; and 100 cycles alternating grow and shrink with four +sequences holding state: footprint flat (phys_footprint before and after within the measured noise), weights +never reloaded (load counter), every sequence's state byte-identical across the round trip (its next token +matches an unreconfigured control), a shrink below a held state pages that slot out and names it, and no request +lost (queued requests all complete). **Core (S4, Codex):** the relaunch call sites (`reconcile.rs` re-home, +`launch.rs:221`) call `reconfigure`; a plan below the live geometry now reconfigures too, which is what +gives memory back to the user's app. + ## 6. Risks - **Metal and unified memory.** RAM pages, checkpoints, KV and weights all draw on one physical pool, under macOS's GPU wired limit. If the budget is not one pool, the machine swaps and everything stalls. `get_data` has to synchronize the context first. `LLAMA_STATE_SEQ_FLAGS_ON_DEVICE` (llama.h:1024) suits speculative checkpoints only. diff --git a/docs/architecture/THE-PROVING-GROUND.md b/docs/architecture/THE-PROVING-GROUND.md new file mode 100644 index 0000000000..efdf8c1dda --- /dev/null +++ b/docs/architecture/THE-PROVING-GROUND.md @@ -0,0 +1,247 @@ +# The proving ground: a system that proves the system, from one mind to the grid + +Status: design for review, 2026-10-30. No code until this is agreed. + +Joel, 2026-10-30: "You need to simulate all aspects of this. You made some dyno before too. We keep +forgetting and regressing into amateur designs. Let's also design the system to prove the system itself." +And: "Yes, and the same for the grid itself." + +Companions: [HOW-A-MIND-GETS-WHAT-SHE-NEEDS](HOW-A-MIND-GETS-WHAT-SHE-NEEDS.md) (the requirements and +scenarios this proves), [ONE-BUDGET](ONE-BUDGET.md), [GRID-MARKET-CLEARING](GRID-MARKET-CLEARING.md) (whose +slices S1 to S4 call for "the sim as the gym"), [ADAPTIVE-GRID-INTELLIGENCE](ADAPTIVE-GRID-INTELLIGENCE.md), +[SERVING-ENGINE](SERVING-ENGINE.md) (S0, `serving-replay`). + +## 0. Why: we keep regressing because nothing proves a change before a resident does + +Every regression of 2026-10-30 reached the M5 untested against the behaviour that broke: +- the reply cap that starved her view; +- its replacement that cut Aris three times at 963 tokens; +- the 1,024-token think budget larger than the grant; +- the window replayed on one machine. + +Each would have failed a scenario run before deploy, had one existed. The pieces of a proving ground exist +already, built at different times by different agents, and forgotten between sessions (inventory, +2026-10-30, `origin/canary`): + +| Piece | Gives us | Missing | +|---|---|---| +| Context dyno (`continuum-context/examples/replay*`) | real `View` and `levels` on real captures; turnovers, re-reads, reuse | re-models the core's fit rules (a copy that drifts); one mind; no engine, time or memory; asserts nothing; not in CI | +| `contend` (`continuum-engine/.../planning/contention.rs`) | minds on one engine under admission policies, virtual clock, measured rates required | analytic engine; no view, no memory, no paging; aggregated workload | +| `continuum-flow::sim` (branch `fable/continuum-flow`, off canary) | the real flow scheduler on an engine calibrated to the M5; reproduced a live gate change | off canary; one calibration; no memory model | +| `serving-replay` (SERVING-ENGINE S0) | a real `llama-server` with page-in, page-out, slot save and restore | serial acts; generates a fixed count, not her reply; paging policy copied from core; not in CI | +| `capacity/sim.rs` ("the gym") | the production `AllocationPolicy` through capacity timelines (a game eats the GPU) | synthetic; no time, latency, KV or paging; scenarios in code, not data | +| Grid: `capacity/{grid,gossip,grid_budget,market,settlement}.rs`, `run_symmetric_grid` | production placement and gossip on synthetic snapshots; partitions, joins, churn | no prices wired, no time, no transfer cost; `placement-decisions.jsonl` (176K recorded) never replayed; GRID-MARKET-CLEARING's sim scenarios unbuilt | +| Wire tests (`TwoAircLoopback`, `airc_remote_inference_*`) | two real airc peers, real executor | two peers, fake compute; partly not in CI | +| Measured rates (`~/.continuum/state/{decode-knee,prefill-rate,serving-rates}.json`) | per-model prefill and decode on this node | no node-profile type; nothing replays them | +| Captures (`fixtures/prompt-captures` 560M, probes 38M + 128M archive, evidence 530M) | every resident's real requests, responses, timings since September | used by one dyno at a time | + +Five of these are on CI's `pending` list ("tests exist but no job selects them"). Nothing joins view, +admission, memory and time; nothing runs more than two nodes with time; and nothing checks that any of them +predicts reality. + +## 1. Principles + +- **P1. Only the world is simulated; the system is real.** The proving ground drives the production policy + code through its own seams: the allocator, the view, admission, residency, placement, the emission + classifier. It models only what is outside our control: hardware, the engine's physics, the network, + people, other apps, and the minds' choices. A copy of a production rule inside a simulator is forbidden + (the dyno's fit rules and `serving-replay`'s paging copy are migrated to call production). +- **P2. Every world model is calibrated from measurements, and its error is published.** Node profiles come + from measured rates and capacities; the engine model's curves come from the node's own runs; the network + model comes from airc's measurements. Each model carries its calibration source, date and error bound. +- **P3. Workloads come from what minds actually did.** Captures and probes are the demand. Synthetic + workloads exist only for shapes no capture has yet (a new activity), and are labelled as such. +- **P4. The prover is itself proven** (section 6): it must predict live reads within its published error, and + it must fail every known-bad policy we have actually shipped. +- **P5. Scenarios are data, not code.** Each scenario (S1 to S15 and every incident) is a file: workload, + world, events, pass criteria. A live incident becomes a scenario file the same day, so it can never return. +- **P6. The same receipts as live.** Every simulated decision emits the receipt the live system emits + (HOW-A-MIND R11), so the same analysis reads both, and sim-versus-live is a diff of like with like. +- **P7. Fast by default, faithful when needed:** fidelity tiers (section 3), with the fast tier running in + seconds on any machine and in CI. +- **P8. Deterministic.** A seed, a world, a workload and a policy revision give byte-identical receipts. This + needs seams in production policy: policy reads time only through an injected clock and randomness only + through a seeded source passed in (the CBAR substrate has the shape), and a ratchet counts direct clock and + random reads in the policy crates the prover drives (Cormac on #5607). +- **P9. Captures never leave their node in raw form.** Prompt captures and evidence hold residents' and + people's words, and CI logs and artifacts are not private. T0 and T1 run on content-free reductions made on + the node that holds the captures: sizes, exact token counts (taken locally with the real tokenizer), + timings, causal ids, content hashes and outcome kinds. T2's model in the loop needs the words and runs only + on that node. A reduction is checked to carry no text before it is committed (Cormac on #5607). + +## 2. What is simulated + +**The world model, per node:** +- **Hardware profile:** memory (device, unified, RAM), disk, CPU, measured; from a node's own state files + and runs, or from a declared shape for a machine we do not have (marked unmeasured). +- **Engine physics:** + - prefill and decode rates as functions of concurrency (the decode knee); + - bytes of state per token; + - page-in and page-out costs by tier; + - checkpoint costs; + - prefix reuse as exact token-prefix matching. + + Starts from `continuum-flow::sim`'s calibrated engine and `contend`'s replay, merged into one. +- **The person and their apps:** a timeline of external memory and CPU use (a game, Photoshop, a build), + a person's messages and their patience (how long they wait before it hurts). +- **The minds' choices:** replayed from captures (section 4), with a behaviour model for counterfactuals. + +**The world model, for the grid:** +- N simulated nodes, each a node world above, with heterogeneous profiles; +- links with measured latency, bandwidth and loss (from airc measurements), partitions and heals; +- gossip of offers and prices on its real cadence, with staleness; +- nodes joining, leaving, sleeping, and dying mid-work; +- leased minds whose state lives on one node and whose person is on another. + +**The system under test** is production code: the allocator and its tiers, the view and its loops, the +emission classifier, admission, residency, placement (`GridPlacementPolicy`, market clearing), gossip. + +## 3. Fidelity tiers + +| Tier | Engine | Speed | Where it runs | Used for | +|---|---|---|---|---| +| T0 Analytic | calibrated curves, virtual clock | seconds for hours of simulated time | any machine; every PR in CI for the affected crates | every policy change; sweeps; the scenario suite | +| T1 Real policy, modelled engine, real tokenizer | as T0 plus exact token counts and the real codec | minutes | any machine | before merge of a context, admission or placement change | +| T2 Real engine, proxy model | a real `llama-server` with a small model (`serving-replay`, made concurrent) | tens of minutes | a non-serving machine or a serving-down window | engine verbs (reconfigure, paging), KV behaviour | +| T3 Live read | the node itself | 15 minutes | the live node after deploy | the final receipt, compared against T0 and T1's prediction | + +A change must pass T0 and T1 before merge. T2 is required for engine changes. T3 is the deploy's receipt and +the prover's own check. + +## 4. Workloads, and the counterfactual problem + +A replayed capture says what she did under the view she had. A new policy gives her a different view, and +she might act differently. Three tools address this, each labelled in its results: + +1. **Demand replay (exact):** the requests she made, with their sizes and times, replayed open loop. Exact + for time, memory, admission and placement questions that do not change her choices. +2. **Behaviour model (estimated):** measured conditional rates from captures. These include: + - the probability she re-reads an item when it was folded versus whole (the fault model); + - her output size distribution per activity; + - her think length; + - her gaps between acts. + + The model replays her choices under the new view. Its error is checked against T3 (section 6). +3. **Model in the loop (faithful, slow):** at T2, a real model answers the new prompts, so her choices are + generated, not assumed. Used to validate the behaviour model, not for every run. + +**The behaviour model declares its support** (Cormac on #5607). Its rates were measured under the policies +that were live, and they are confounded: the old policy chose what to fold, so captured relevance and +folding are correlated. So: +- a policy whose views fall outside what the captures covered (folding items the captures never folded, + windows far outside their range) is out of support, and its predictions are labelled "out of support", not + reported as estimates; +- out of support is exactly what requires T2; +- the fault model is checked against T3 per activity, never trusted globally. + +Workload sources: +- prompt captures, per mind; +- `delib.generate.cache` probes; +- engine logs; +- `placement-decisions.jsonl` for the grid; +- evidence directories for incidents. + +Cormac owns turning these into the scenario suite (HOW-A-MIND section 10). + +## 5. What it measures and what passes + +Every run reports the same metrics as the live health line and the 15-minute read, from the same receipts. + +| Group | Metrics | +|---|---| +| Per mind | acts, writes, act seconds (p50, p90), prefill and decode seconds per act, prefix reuse, faults, repeats, cuts by stop class, starvation time | +| Per loop | reversals | +| Per node | relaunches, memory returned to the person's apps and how fast | +| Per grid | placements, re-homes, partition behaviour, transfer bytes and seconds | + +Each scenario file states its pass criteria in these terms (HOW-A-MIND section 6). A policy change reports +before and after on the whole suite, across the hardware sweep: +- the M5; +- the 5090; +- a 24 GB GPU; +- a 32 GB unified laptop; +- randomly drawn unknown machines within declared ranges. + +A change that improves one scenario and regresses another shows both; it is never summarised to one number. + +## 6. Proving the prover + +The proving ground is trusted only as far as it is shown to be right. + +1. **It must fail what we actually shipped broken.** A permanent "known-bad" suite replays our real + incidents with the policy that caused them, and the proving ground must flag each: + - the 12,288 reply cap (2026-10-30 read loop); + - the 963-token grant with the 1,024 think budget (Aris, three identical cuts); + - the fixed four slots under one hot writer; + - the 49,152 window on a different machine; + - the Kimi 100,704-token turn; + - the live-prefill-rate window that moved 48k to 32k (74 turnovers in 37 minutes). + + A simulator that passes a known-bad policy is broken, and is fixed before anything else is trusted + (mutation testing at the policy level). +2. **It must predict live within its published error.** Every deploy's T3 read is compared with the T0 and + T1 prediction made before the deploy, on the same metrics. The error is recorded per metric and per node. + When it exceeds the published bound, the world model is recalibrated, and the deploy's conclusion is + labelled as unproven until it is. +3. **Its calibration drifts visibly.** Each world model carries its calibration date and source; a model + older than the node's latest measured change (a new engine build, a new model) is flagged stale. +4. **Determinism is tested:** the same inputs twice give byte-identical receipts. + +## 7. CI and the development loop + +- **T0 runs in PR CI** for any crate whose policy the suite exercises, through the affected-crate selector + (the same selector that now builds touched examples, #5613). The `pending` entries for + `continuum-context`, `serving-replay`, `tool-working-set`, `expert-pager-policy` and `airc-test-fixtures` + are paid off as their parts join the proving ground. +- **A PR changing a policy posts its before/after table.** Reviewers read the table, not a claim. +- **Incidents become scenario files** the day they happen; the known-bad suite only grows. +- **Before any live deploy,** the T0/T1 prediction for the 15-minute read is written down, so the read + tests the prediction as well as the change. + +## 8. Build order: join what exists, copy nothing + +1. **One world model for one node:** merge `continuum-flow::sim`'s calibrated engine and `contend`'s replay + into one engine model, add memory and paging costs, and load node profiles from the measured state files. + Bring `continuum-flow` to canary. +2. **The system on it:** drive the production view (replacing the dyno's re-modelled fit rules), the emission + classifier, admission and `capacity/sim`'s `AllocationPolicy` through their seams. Scenarios become data + files (the deferred serde loading in `capacity/sim`). +3. **The known-bad suite** from today's incidents, and S1, S2, S7 and S15 from captures. The proving ground + must fail the known-bad policies before anything else is built on it. +4. **The grid:** extend `run_symmetric_grid` with time, links and prices; drive the production placement, + gossip and market clearing; replay `placement-decisions.jsonl`; GRID-MARKET-CLEARING's S1 (byte-identical + replay) and S3 (n=3 contention, the sim predicts the winner). +5. **T2:** `serving-replay` made concurrent and calling production paging; it validates the engine verbs + (SERVING-ENGINE S1 to S3) and the behaviour model. +6. **Prediction versus live** wired into every deploy's read. + +## 9. Ownership (proposed) + +| Part | Owner | +|---|---| +| Node world model, engine model, T0/T1 harness, view and emission seams | Fable | +| Grid world model, admission, residency, placement and market seams | Codex | +| Workloads, behaviour model, scenario suite, known-bad suite, outcome metrics | Cormac | + +## 10. Decisions from review + +Answers from Cormac's review of #5607 at `562e5a587`. Joel's word overrides any of them. + +1. **Counterfactuals:** sufficient with the support rule in section 4. T2 is required exactly when a + scenario's views fall outside the behaviour model's measured support, not by default and not by a list. +2. **Error bound:** no fixed bound, which would be one more open-loop number. A prediction may decide alone + when its predicted before/after difference exceeds the published error on that metric for that node, so + the error interval does not cross the decision. Otherwise the decision needs T2 or T3. +3. **Hardware sweep:** the declared target classes plus the nodes we run: + - 8 to 16 GB discrete GPUs (gamer and dev); + - 16 to 36 GB unified-memory Macs; + - a CPU-only low-end tier (client first, never crash); + - our M5, 5090 and 3090; + - a 128 GB workstation as the top end. + + It draws memory, bandwidth and core counts within those classes' measured ranges, marked unmeasured until + a real machine of the class supplies a profile. +4. **The known-bad suite blocks merge.** A PR that makes a known-bad policy pass has either broken the prover + or shown the old incident is no longer bad. Either needs a visible decision, recorded by a reviewer. +5. **Ordering:** the known-bad suite's faults and repeats depend on causal identity (#5611). Cormac starts the + reductions and the known-bad scenario files from the 2026-10-30 evidence while #5611 lands. diff --git a/docs/architecture/TYPED-BOUNDARIES.md b/docs/architecture/TYPED-BOUNDARIES.md new file mode 100644 index 0000000000..9b86395b5f --- /dev/null +++ b/docs/architecture/TYPED-BOUNDARIES.md @@ -0,0 +1,76 @@ +# Typed boundaries: strings are the enemy + +**Status:** design, 2026-10-30 (Joel: "Strings are the enemy"; "Every contains is probably suspect"; "We have +to do every api like this"). Owner of the contract: Fable. Same shape as ONE-BUDGET.md: an inventory, one +contract, a ratchet that drives the counts to zero, and slices with owners. + +## Why + +A string standing in for a type is re-parsed by every reader. Writer and reader drift apart, a typo compiles, +and a failure is silent. Today: a monitor grepping for `Codex:` missed a whole design review; +`should_respond` decides by `.contains("would respond")`; working memory re-parses its own rendered text with +`split_once("; room ")`. + +Inventory of canary production code, 2026-10-30 (regex counts over ~344k lines, about ±5%): + +| Shape | Count | +|---|---| +| Choosing behavior by a name (`match x.as_str()`, string arms, `== "lit"`, prefix routing) | ~1,300 | +| Untyped JSON field access (`v["f"]`, `.get("f")`, `.as_*` chains on `Value`) | ~1,800 | +| Ids typed `String`, plus `Uuid::parse_str` round trips | ~1,070 | +| Kinds and states as `String` (`kind`, `status`, `role`, `provider`, `topic`) | 341 | +| String searches with a literal: ~440 in parsers of an external format, ~520 decisions | 961 | + +## The contract + +1. **Text exists only at the edge.** Raw text (a file, a CLI's output, a model's reply, a wire frame) is parsed + once, by the one parser for that format, into a type. Nothing after the parser holds the text or searches it. +2. **Every boundary is typed:** + - commands are typed **per module**, never one central list (CLAUDE.md forbids central command registries and + enums of all commands; Cormac's review). Each module owns its command enum and params structs in its own + crate. The kernel dispatches on a typed path (`CommandUri`, to the module that registered it, as `register_*` + does today), never on a verb list. The module's codec decodes the wire payload into its enum at the boundary: + that codec is the one parser at the edge, and an unknown verb is the module's typed refusal. No + `(&str, Value)` anywhere; + - events carry a signed class and a typed payload (airc's EventClass); + - ids are typed newtypes over `Uuid`/`u128` (`PeerId`, `RoomId` and `EventId` exist; add `PersonaId`, + `CallId`, `LeaseId` and the others), rendered and parsed through one owner below both airc and continuum: + `shown_id` moves to a floor crate both depend on (the phase-5 "patterns bubble down" rule), so continuum's ids + never need `airc_core` to render; + - every typed params struct and event payload that crosses to a client derives its TypeScript binding through + ts-rs, so clients get the same types, never a hand-written copy; + - kinds and states are enums. +3. **A rendered string is never read back.** What the system renders for a mind or a human is output; the + typed value it was rendered from is the source of truth. +4. **Delivery and dispatch select on types** (headers, enum variants), never on text: the same rule as "never + scan the body". +5. **No fallback parse.** An unknown variant is a typed refusal, never a default. + +## Ratchet + +`source-hygiene::typed_boundaries`, built on #5609's site machinery: token-level, signature vs body, comments and +doc strings excluded. The inventory above is a regex estimate; the ratchet counts exactly, because a touched-file +rule built on misfires invites markers. Counts can't rise, a touched file ends clean, and there are no exemption +markers: +- `string_dispatch`: name matches and literal comparisons that choose behavior; +- `untyped_json`: field access on `serde_json::Value` outside the codec of its type; +- `string_ids`: `*_id: String`/`&str` and `Uuid::parse_str` outside `shown_id` and the edge parsers; +- `string_kinds`: `kind`/`status`/`state`/`role`/`topic` as `String`; +- `text_search`: `contains`/`starts_with`/`ends_with`/`find`/`split_once`/`strip_*` with a literal. + +External-format parsers are allowed by owner path, each named in the rule: the GGUF shard name parser, the +VRM bone names, the launchd plist parser, the swe-bench log parser, the tool-call text parser, `.env`, and so +on. Each must produce a type at its return. + +## Slices (worst boundary first) + +| # | Boundary | Owner | +|---|---|---| +| T1 | `ServiceModule::handle_command(&str, Value)`: each module's own command enum + params structs + codec in its crate; the kernel dispatches on a typed `CommandUri` path by registration, no central verb list; 97 modules and 106 arms migrate | Codex (kernel seam), each module's owner migrates its verbs | +| T2 | `Params` / `.get("k")`: replaced by T1's typed params; `Params` deleted | with T1 | +| T3 | `MessageBus::publish(&str, Value)`: typed events, routing by class, not by name prefix | Codex | +| T4 | airc envelopes: signed EventClass, typed command and event payloads, sender-resolved typed mentions (Codex); session delivery as their consumer: `monitor attach --for-me`, the delivered cursor, in-flight claims and receipts (Cormac) | Codex, Cormac | +| T5 | Ids: typed newtypes through every crate; `Uuid::parse_str` only at the edge | Fable (cognition, mind), crate owners elsewhere | +| T6 | Text decisions: `should_respond`, working memory's self-parse, recall's `[t=` parse (Fable: cognition, mind); hardware detection by name, typed probe results (Codex: engine, serving); the sentinel's error-string matching as typed errors from the source, and the genome/training text decisions (Cormac) | Fable, Codex, Cormac | + +Each slice deletes the string path in the same change: no dual API, no back-compat. diff --git a/docs/planning/MULTI-PERSONA-TUNING-CAMPAIGN.md b/docs/planning/MULTI-PERSONA-TUNING-CAMPAIGN.md new file mode 100644 index 0000000000..8dbc8682ff --- /dev/null +++ b/docs/planning/MULTI-PERSONA-TUNING-CAMPAIGN.md @@ -0,0 +1,99 @@ +# The multi-persona tuning campaign + +Status: the program of work, 2026-10-30. Joel: "We are just gonna spend some time improving this dynamic +system to get it just right. Make sure it's well simulated, see how the context adapts to many personas in +the real system on all your machines independently, both in terms of its RAG and eliminating looping and +thrashing, without grid, just to optimize it for these radically different three use cases. Make sure we +have all the llama.cpp lane stuff, budgeting and airc fixes, all the latest. Simulations again and glass +box. Then go back and try again in the real systems. See how it acts and adapts, with the causal system not +screwing up, and keep going till we feel like it has good multi-persona throughput." + +The design it executes: [HOW-A-MIND-GETS-WHAT-SHE-NEEDS](../architecture/HOW-A-MIND-GETS-WHAT-SHE-NEEDS.md) +(requirements, loops, scenarios), [THE-PROVING-GROUND](../architecture/THE-PROVING-GROUND.md) (simulation and +proof), [ONE-BUDGET](../architecture/ONE-BUDGET.md), MIND-CONTEXT's causality section and render receipt, +[SERVING-ENGINE](../architecture/SERVING-ENGINE.md) S2. + +## The three use cases (no grid yet) + +Each machine runs on its own, so each is a different world for the same algorithm: + +| Node | World | Residents | Owner of its rounds | +|---|---|---|---| +| M5 | unified memory (64 GB), Metal, Qwen3.6-35B-A3B, four fixed slots today | Aiko, Aris, Atlas, Benchy | Fable | +| 5090 | discrete CUDA, Windows | Kimi and the 5090's residents | Codex (with BigMama's measurements) | +| IntelMac | CPU-only, the low-end floor ("client first, never crash") | its residents | Codex | + +The machine assignment is an assumption to confirm with Joel. Placement across nodes waits until all three +pass on their own. + +## Phases + +**P0. One "latest" on every node.** +- Triage the open PRs in this system's path (each merged, reworked to the design, or closed with a reason; + none left hanging): #5602, #5591, #5576, #5558, #5527, #5518, #5485, #5529, #5604, #5609, #5611, #5612, + #5613, and whichever others the triage finds. +- Every node on the same canary, the same fork pin with the current lane work, and the same airc release. + Each node's running revisions are recorded as a receipt (core, engine, airc, model, slot geometry, + residents), not assumed. + +**P1. The proving ground, T0** (THE-PROVING-GROUND section 8, steps 1 to 3): +- one node world model, calibrated per node from its own measurements; +- production policy driven through its seams; +- the known-bad suite, which must fail before anything else is trusted. + +**P2. Each fix through the prover, then live.** In order: +1. the think-cut interim (Cormac's option C: a cut inside thinking grows her grant; the fixed 1,024 think + budget deleted); +2. causal items (#5611), the render receipt, and the stops counter; +3. the window (#5612); +4. the open-loop rules replaced one at a time by L1 to L3 (HOW-A-MIND section 5). + +Every change carries a written T0 prediction for each node before it deploys. + +**P3. Rounds on each node, in parallel.** A round: +1. predict (T0/T1, that node's profile); +2. deploy (a coordinated serving-down window on that node); +3. glass-box the residents for 15 minutes and an hour (the acts inspector, the health line, the receipts); +4. compare with the prediction; +5. build what live taught into the simulation first (Joel: "Whatever we learn from real life we try to then + build into simulations to try to correct"): a new scenario file, a known-bad, or a world-model correction, + until the simulation reproduces what live did; +6. fix the largest gap, as a change to the design, proven in the corrected simulation, never a one-off + patch; +7. repeat. + +**Design in place for everyone, then fix for one another, merging as we go** (Joel). The designs merge to +canary first so every agent works from the same text; after that, each agent fixes what blocks another, +and work merges as it is proven, never parked. + +A round's finding that applies to all nodes is proven on one and carried to the others. + +**P4. The engine side,** once the mind side holds: SERVING-ENGINE S1 to S3 (unified state, live +reconfigure, paging) and L5's lane price, through T2 first, then the same rounds. + +## Gates + +Product goals, not machine constants (CLAUDE.md plan, goal 2), plus the design's invariants: + +| Gate | Per | Done when | +|---|---|---| +| Tool calls | resident-hour | 40 or more | +| Median act | resident | under 60 s | +| Prefix reuse | resident | 80% or more | +| Merged PRs | node-day | at least one resident PR | +| Repeats (unchanged re-read of a whole item) | resident-hour | none twice in an epoch (S7) | +| Cuts | resident | no identical cut twice | +| Reversals | loop | counted, and no scenario fails on it | +| Relaunches while serving | node | zero | +| Known-bad suite | every change | all known-bads still fail in the prover | + +The campaign ends when each of the three nodes holds these over a full day of the residents' own work, and +the prover predicted that day within its published error. + +## Coordination + +- Ownership follows the designs: Fable has the mind side (L1 to L3, the receipt, the engine verbs) and the + M5's rounds; Codex has admission, residency, the node loop and the 5090 and IntelMac rounds; Cormac has the + outcome signals, the behaviour model, the scenario and known-bad suites, and the reductions. +- Each round's prediction, receipts and finding go on the round's card, not into this document. +- No round deploys a change that did not pass T0 against the known-bad suite.