Skip to content

One budget, enforced: self_sized / private_probes / writes_outside_a_class with no exemption marker, and a touched file ends clean (ONE-BUDGET slice 0) - #5609

Merged
joelteply merged 5 commits into
canaryfrom
fable/budget-discipline
Oct 31, 2026
Merged

joelteply merged 5 commits into
canaryfrom
fable/budget-discipline

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

It serves the minds by stopping any new private budget from landing (a cap, KEEP, share, private probe or self-chosen write path) while slices 1–6 migrate the existing ones. Goal 7, One budget. Contract: docs/architecture/ONE-BUDGET.md (#5607).

Invariant: no budget decision exists outside the authority and the allocator, and no file a change touches keeps one.

Change:

  • New: source-hygiene::budget_discipline, with three rules: self_sized, private_probes and writes_outside_a_class.
    • Owners are allowed only by repository path. There are no comment exemptions.
  • New: ratchet::touched_clean. The driver passes the change's files, and every touched file must end clean. This drives the counts to zero instead of holding them.
  • Replaced rather than wrapped:
    • head_cuts: deleted.
    • prompt_self_sizing: moved into self_sized.
    • derived_bounds: narrowed to durations as time_bounds, sharing one is_duration_name with self_sized.
    • continuum-core's context_budget guard: deleted. It prescribed window fractions, which is the pattern itself.
  • Consolidated: one lexer module, one sites, one fixture constructor. Each SourceFile carries its repository path.

Measured

Counts on canary 365f70f, from this rule set run over both trees:

Rule Count
self_sized 607
writes_outside_a_class 217
private_probes 81
underived_durations 33

Local results (M5, serving-down window, 2026-10-30 19:04Z):

  • cargo test -p source-hygiene --lib: 71 passed.
  • The ratchets driver against origin/canary passes, on counts and on touched files.
  • cargo check --profile test --lib -p continuum-core -p continuum-kernel passes.

Still remaining, and owned: the dead size markers (head-cut-ok, context-budget-exempt, derived-or-floor on size constants) leave with their constants in slices 3–6. Touching any of those files forces it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

joelteply added a commit that referenced this pull request Oct 30, 2026
…ies in every crate (modules/, airc/, genome/, experience/, recipe/, positron/, rag/), with a regression case per directory (Codex on #5609)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Oct 30, 2026
…central verb enum; kernel dispatches a typed CommandUri by registration); the ratchet counts exactly on #5609's site machinery; id rendering in a floor crate below airc and continuum; ts-rs for every client-facing type; T4/T6 ownership

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply and others added 3 commits October 30, 2026 18:10
…sized consumer, private probe and unclassed write, with no exemption marker, and a touched file ends with none (ONE-BUDGET slice 0)

Invariant: no budget decision outside the authority and the allocator; no file a change
touches keeps one.

- source-hygiene `budget_discipline` (self_sized, private_probes, writes_outside_a_class):
  owners allowed by repository path only (the allocator, the turn's allocation, the
  authority's probes, the ORM and disk classes); no comment exemption.
- `ratchet::touched_clean`: the ratchets driver lists the change's files
  (SOURCE_HYGIENE_TOUCHED); a touched file must end with none. This is what moves the
  counts to zero instead of holding them.
- Replaced, not wrapped: head_cuts (deleted; both halves are self_sized shapes),
  prompt_self_sizing (moved out of context_codec), the size half of derived_bounds (the
  rest is time_bounds: durations only, one shared is_duration_name), and continuum-core's
  context_budget guard (it prescribed window FRACTIONS, the pattern itself).
- One lexer module (production split, comment split, brace depth, constant parsing),
  one shared `sites`, one SourceFile fixture constructor; each file carries its
  repository path (collect_files(checkout, dir)), so a change's files match exactly.

Counts on canary 365f70f (measured by this rule set on both trees): self_sized 607,
writes_outside_a_class 217, private_probes 81, underived_durations 33.
Tests: source-hygiene 71 passed; ratchets driver vs origin/canary passed (counts and
touched files); continuum-core and continuum-kernel lib test profile check passed.

Known remaining, owned: the dead head-cut-ok / context-budget-exempt / derived-or-floor
size markers leave with the constants they sit on (slices 3-6; touching a file forces it).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ies in every crate (modules/, airc/, genome/, experience/, recipe/, positron/, rag/), with a regression case per directory (Codex on #5609)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the fable/budget-discipline branch from 5b6eabe to 12689fc Compare October 30, 2026 23:10
joelteply added a commit that referenced this pull request Oct 30, 2026
… disk and a mind's context (design) (#5607)

* One Budget: one authority, one algorithm, one contract for VRAM, RAM, disk and a mind's context (design)

Rewrites MEMORY-AUTHORITY-DAEMON.md (VRAM-only, 2026-07-20) as ONE-BUDGET.md and
repoints the six code comments that cited it. Design only: the contract, the
ratchets that drive one-offs to zero, and the crate-sized rewrite with owners.
Built from four read-only inventories of canary 365f70f (VRAM, RAM, disk, prompt).

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

* One Budget: slice 0, enforcement first (consolidated budget_discipline, touched-file-is-clean, no exemption markers)

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

* One Budget: slice 6 in detail — a mind's context on every machine (the 10-30 live defect, the contract, deletions, two-node-class validation)

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

* One Budget slice 6: validation on the RTX 3090 and the M4 32 GB (Joel), plus the M5

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

* One Budget slice 6: validation sweeps measured node profiles, so an unknown machine is covered by its own profile (not a list of boxes)

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

* One Budget slice 6: first PR's deletions; the pending cut peak kept (a measurement); the window knee replaced by a measured prefill-cost term next, not deleted bare

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

* One Budget: the five safety contracts from Codex's review (grant shrink is a request with generation-bound leases; atomic multi-resource admission; missing/stale/failed resize are typed states; durable is not cache; demand vs feasibility vs allocation)

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

* Mind context: causality in the type (items carry cause + content; the view enforces causal closure, whole chain heads, fold-not-break, cycles rendered as repeats, misses raise claims); chains are the flexbox's claim units

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

* Mind context causality, per Cormac's review: repeat identity = (normalized request fingerprint, outcome content hash); overflow folds finished chains whole, live skeletons over the grant are contract 5's typed refusal; typed stable causes + CauseNotHeld; Root counted; hash at spill; miss = the one expand verb; owners

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

* Mind context causality, per Codex's review: same output is not the same effect (occurrences kept with receipts; 'unchanged' only on producer evidence); CauseNotHeld is a durable handle, not demonstrated closure; the validator proves visible progression, live work proves behavior; three fixtures

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

* Typed boundaries: strings are the enemy (inventory, contract, ratchet, slices with owners)

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

* Typed boundaries, per Cormac's review: commands typed per module (no central verb enum; kernel dispatches a typed CommandUri by registration); the ratchet counts exactly on #5609's site machinery; id rendering in a floor crate below airc and continuum; ts-rs for every client-facing type; T4/T6 ownership

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

* One Budget slice 6: max_tokens is the reply's measured grant (the whole-window bound was tried and removed; the refusal protocol assumes a fixed bound)

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

* One Budget: acceptance test for the user's own load (a game or Photoshop starting and quitting): grants shrink as requests, the engine pages KV live with no relaunch, windows follow at epoch starts, and grow back

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

* SERVING-ENGINE S2 in detail: reconfigure grows or shrinks live, its own module (server-reconfigure, one slot-page mover shared with save/restore, one rebuild_context), typed outcome, never truncates, validator

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

* S2: the split is weights vs contexts (load_weights / build_contexts), fused today in common_init_result, the speculative init and load_model; the page is the existing prompt-cache state

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

* S2: reconfigure is a task in the task phase (the fork's own SLOT_SAVE safe point); mid-turn slots continue; stable slot ids; a busy slot past a smaller n_seq is refused by name

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

* Requirements: how a mind gets what she needs. Closed loops, not open-loop rules: the contention (space and time, many minds, many activities), twelve requirements, the adaptive systems each loop borrows from (traffic signals, PFF working sets, BBR, MLFQ, codec rate control, foveation), seven loops by timescale, fifteen scenarios with measured pass criteria

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

* How a mind gets what she needs: plugged into the grid governance (nested market, placement first, adapt within); her context is one claim among her output, genes, hands, senses, dreaming and memory; R4 cleared by price; L0 placement loop; the value-unit question

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

* How a mind gets what she needs: Cormac's review folded in (faults vs repeats, typed outcomes never graded, L7 by controlled probes, reversal counter, the live gap from #5610 and the two steps to L1, section 10 decided)

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

* How a mind gets what she needs: decode seconds are a cost; output is bounded by space and the lane-time price (Cormac's approval condition)

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

* The proving ground: a system that proves the system, one mind to the grid. Only the world is simulated (calibrated from measurements); the policy code is production; workloads from captures; fidelity tiers T0-T3; a known-bad suite of every incident we shipped; the prover must predict live within published error; build order joins the existing dyno, contend, flow sim, serving-replay, capacity sim and grid tests

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

* The proving ground: Cormac's review folded in (P9 content-free reductions on the node; clock and RNG seams with a ratchet; the behaviour model declares its support and out of support requires T2; section 10 decided: no fixed error bound, the hardware classes, known-bad blocks merge)

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

* S2: the safe point is between batched decode steps (unfinished generations page out and continue); a slot that does not fit is paged out now and L4 chooses; reconfigure reports pause seconds vs tokens held; per-backend footprint (Cormac's review)

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

* S2: a busy slot past a smaller n_seq is paged out now with its unfinished generation, not refused (one rule with contract 2; Cormac)

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

* MIND-CONTEXT causality: the render receipt (what was actually sent, per item: level, sent content hash, Resident/Loaded/LoadFailed), one per render from the view; task wakes discharge only on a whole result actually sent (Codex)

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

* The multi-persona tuning campaign: three nodes on their own (M5, 5090, IntelMac), one latest everywhere, the prover first, each fix predicted then live, rounds per node until the plan's goal-2 gates and the design's invariants hold for a day

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

* Campaign: what live teaches goes into the simulation first; design merged for everyone, then fix for one another and merge as we go (Joel)

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@joelteply

Copy link
Copy Markdown
Contributor Author

Request changes at exact12689fc62da2f3a5f41d810823b5ca9a3052d3e7.

P1: shared sites() calls without_signature(), which finds "fn " anywhere in executable source (lib.rs167-171), including literal arguments. For example std::fs::write(path, "fn main() {}")?; is reduced to the tail after the literal opening brace, hiding fs::write from writes_outside_a_class. This lets an ordinary code-generation write evade touched-file-clean. Recognize declaration syntax with the shared lexer respecting literals, and retain the entire executable statement otherwise. Add this regression alongside the one-line-function-body case.

Head-cut coverage restoration looks correct. Source review/reproduction only; no builds performed.

…teral-aware walk (outside_literals) owns the skipping that brace_delta and without_signature share; without_signature moves into the lexer; a fn inside a string is text, so write(path, "fn main() {}") stays a visible write (Codex on #5609)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…", r#"..."# with any number of #, br forms), so a fn or a brace inside a raw string with embedded quotes is text (Codex on #5609); tests in the lexer and the writes rule

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

Copy link
Copy Markdown
Contributor Author

APPROVE the reviewed enforcement change at bacf077. The reported ordinary/raw/byte-raw string write-hiding cases are handled by the shared literal walker with regression coverage; function bodies and restored head-cut coverage remain checked. No remaining blocker in this scoped re-review. Broader syntax-aware scanner replacement stays in #5619. Source review only; merge still requires exact-head CI.

@joelteply
joelteply merged commit a8f4d12 into canary Oct 31, 2026
36 checks passed
@joelteply
joelteply deleted the fable/budget-discipline branch October 31, 2026 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant