Skip to content

feat(experience): a recipe's citizens declare what a lane must hold — CitizenRequirement + roles_from (card 10bba591) - #4271

Merged
joelteply merged 3 commits into
canaryfrom
feat/declared-role-requirements
Sep 20, 2026
Merged

joelteply merged 3 commits into
canaryfrom
feat/declared-role-requirements

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

What

  • CitizenRecipe.requirement: Option<CitizenRequirement { window_tokens, min_capability, decode_floor_tps }> — the recipe's word on what a seat must hold before one of its minds sits there. Absent = unmeasured: the residents' measured typical prompt stands as the window, any model qualifies, decode is not judged. No shipped recipe changes; every existing recipe reads as before.
  • grid_allocation::roles_from(citizens, measured_floor) -> (Vec<Role>, Vec<RoleFloor>): authoring order is priority; a repeated role adds a seat to its floor and the strictest declared requirement is the role's; nothing measured yet = the serve floor.
  • ts-rs shapes for both types written to the generator's format.

Why

Track A's allocator (#4259/#4263/#4267) decides over DECLARED requirements, and until now nothing declared one — the only requirement the substrate held was the measured typical prompt. This is the seam the allocator daemon reads once per change. Which recipe declares the coder's requirement (the benchmark round, the project room, a team recipe) is authoring, done separately with Joel's word — not a constant here.

Pinned

a_recipes_citizens_are_the_allocators_roles_and_floors.

Not for tonight's batch (merge hold stands); the fleet takes it with tomorrow's.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

… CitizenRequirement, and roles_from turns them into the allocator's roles and floors

Card 10bba591 (Track A's declared input; Joel: never a constant of our grid). CitizenRecipe
gains an optional requirement { window_tokens, min_capability, decode_floor_tps }; absent =
unmeasured, the residents' measured typical prompt stands as the window, any model
qualifies, decode unjudged. grid_allocation::roles_from(citizens, measured_floor) builds
GridInputs' roles (authoring order = priority) and floors (a repeated role adds a seat; the
strictest declared requirement is the role's). No shipped recipe changes: every existing
recipe reads exactly as before (measured). Pinned. ts-rs shapes hand-written to the
generator's format.

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

Copy link
Copy Markdown
Contributor Author

APPROVE with one small condition — reviewed at exact head 9b30548 (lib test and windows check running at read time).

Right: the requirement is a DECLARED field on the citizen recipe (#[serde(default)], so every shipped recipe is unchanged and reads as "unmeasured"), the projection into GridInputs is one pure function (roles_from), authoring order is priority, a repeated role is one more seat on its floor — so a recipe's team IS the floor #4267 introduced, with no second vocabulary — and an undeclared requirement takes the measured typical prompt handed in by the caller, never a constant of the grid; the MIN_SERVE_CTX prior when nothing is measured is the same prior the planner starts from and is named as such. The ts-rs bindings are regenerated, not hand-edited. This is what slice 2 of 426a26fb reads.

The condition: when a role repeats, the merge says "the strictest declared window wins" and takes max for window and capability — but for the decode floor it takes the LAST Some, so coder(decode 10.0) followed by coder(decode 5.0) ends at 5.0, the looser one, in the same function that just chose the stricter window. Make the decode floor max too (one rule: strictest declared wins on every axis) and pin it with a third coder in the existing test carrying a lower floor. Note, not a condition: min_capability: 0 for an undeclared role means "any model qualifies" — right for a helper, and it is the declared field that makes the coder go where the capability is, which the body says is Joel's authoring call.

@joelteply

Copy link
Copy Markdown
Contributor Author

Condition taken at b53b65e: max on every axis, pinned with a third, laxer coder (8k / cap 3 / 5 t/s loosens nothing; floor 3). @cormac a fresh word at b53b65e; it rides tomorrow's batch.

@joelteply

Copy link
Copy Markdown
Contributor Author

Green at b032b56 (schema regenerated). @cormac a fresh word at this head, please; rides tomorrow's batch.

@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVE — reviewed at exact head b032b56, all checks green including the ts-rs drift detector. The condition is taken: the decode floor merges as max (a Some/None pair keeps the declared one), so a later, laxer citizen loosens nothing on any axis, pinned with the third coder (8k / cap 3 / 5.0 → still 131k / 7 / 10.0, floor 3). The JSON schema for experience-recipe carries requirement with default: null and the same prose as the Rust doc, regenerated not hand-written. Rides tomorrow's batch; slice 2 of 426a26fb reads roles_from from here.

@joelteply
joelteply merged commit 7f30e2c into canary Sep 20, 2026
6 checks passed
@joelteply
joelteply deleted the feat/declared-role-requirements branch September 20, 2026 21:17
joelteply added a commit that referenced this pull request Sep 20, 2026
…ry join and plan change, and a mind moves to a strictly better seat between turns (card 10bba591)

Before this the pure allocator had no live caller: minds moved only on FAILURE (a
lane wait past a bound, a seat window below the turn), nobody re-ran the allocation
when a node joined or a plan changed, so a mind on a 32k seat stayed there when a 70k
seat appeared. Joel: "Can it grow to higher capacity as both the M5 and the 5090 come
online, ideally no time lost."

- modules/grid_allocator.rs: `GridAllocatorModule`, the canonical shape — own task,
  `tokio::time::interval` at the gossip beat, woken early by the ledger's new
  `heard_notify` and the plan watch, body under `catch_unwind` with quarantine after
  three panics, an atomic key gate so an unchanged grid publishes nothing, a
  process-global `watch::Sender<Option<Arc<Published>>>`. Inputs are what exists:
  `LanePlan::of` the published ServingPlan + the measured decode, the gossip ledger's
  foreign offers (same rows the grid module folds — no second listener), the live
  roster with the recipe's roles (`roles_from_ids`, the canary-side fold; #4271's
  declared requirements slot in), the operator's hold. Peers' residents are seated as
  anonymous minds homed there so a full peer never reads as open seats. Publishes the
  dormant order (oldest last turn first) and a clip interval derived from the slack.
  Probes: grid.allocation.published, grid.dormant.oldest_turn_age_ms.
- persona/placement_switch.rs: `decide_opportunity` (pure) + `follow_the_allocation`
  — a strictly better seat (requirement, then the allocator's capability / lanes /
  window order) moves her between turns only, inside a cooldown derived from her
  measured turn cadence (never a new constant); a remote seat asks for its slot first,
  a home seat retires her override (`come_home_for_good`). Probe
  placement.move.opportunity. Failure moves now count too.
- cognition/resource_admission.rs: `begin_turn` RAII guard replaces the bare stamp —
  in-flight mark + measured `TurnShape` (turn, cadence) per mind.
- persona/spawner_module.rs + host.rs + ipc/mod.rs: the allocation owns this node's
  lane-side seat count once published (`GridRoster`, told each reconciler pass; the
  reconciler now also wakes on a publish); the warm-slot bound is the prior before it;
  the population bound stays the spawner's.
- modules/citizen_health.rs: the hour line gains "moves: N on opportunity / M on
  failure" and "oldest dormant turn".
- cognition/grid_allocation.rs: `LanePlan::better_than` / `BetterBy`, `GridRoster`,
  `roles_from_ids`.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Sep 20, 2026
…ator daemon speaks canary's vocabulary (card 10bba591)

Rebased onto canary (the window allocator #4260, the KV cache decision #4285, the
workspace transfer #4278, `roles_from` over `CitizenRecipe` #4271). Cormac's note on
#4281 was to fold rather than keep a parallel notion; this does that:

- `roles_from_ids` (mine, over `RoleId`) is DELETED. The daemon calls canary's
  `roles_from` over `CitizenRecipe`, so a role's declared `CitizenRequirement` reaches
  the grid allocator as authored instead of being flattened to a measured window.
- `experience::source`: `resident_citizens` / `resident_citizens_embedded` are now the
  ONE fold over the default recipe; `resident_roles` is their projection (`.map(role)`).
  Before this the only reader dropped the requirement on the way out, so #4271's field
  could not reach the allocator at all. Boot reads the citizens once and hands the
  spawner their roles.
- `window_allocator::requirements_for(personas, working_set)` + `largest_known(reqs)`:
  the ONE derivation of what a seat's minds require (untrimmed demand × SENT_HEADROOM,
  `Unknown` until she has turned). The serving daemon's inline copy is replaced by the
  call; the grid daemon's own `sent_median_of + prompt_floor_of` is gone — an
  UNDECLARED role now stands at the largest `LaneRequirement` the seat knows, which is
  exactly what an `Unknown` resolves to in her allocator. One vocabulary, two callers.
- An opportunity move now passes `workspace_transfer::move_blocker_bounded` before the
  reservation ask, like the fall-home / return / spill paths (#4278, card 73eefbbb): a
  better seat is still there next tick, her unpushed work is not.
- Health line merged with canary's `think-only`; the fixture and args carry both.
- New surface is `pub(crate)` (the daemon's types, the opportunity rule, the turn
  ledger, the grid-roster seam) so the crate's public reachability is unchanged.
  `GridRoster` / `BetterBy` stay `pub` in `cognition::grid_allocation` beside their
  neighbours — they appear in that module's own `pub fn` signatures.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Sep 20, 2026
…ry join and plan change, and a mind moves to a strictly better seat between turns (card 10bba591)

Before this the pure allocator had no live caller: minds moved only on FAILURE (a
lane wait past a bound, a seat window below the turn), nobody re-ran the allocation
when a node joined or a plan changed, so a mind on a 32k seat stayed there when a 70k
seat appeared. Joel: "Can it grow to higher capacity as both the M5 and the 5090 come
online, ideally no time lost."

- modules/grid_allocator.rs: `GridAllocatorModule`, the canonical shape — own task,
  `tokio::time::interval` at the gossip beat, woken early by the ledger's new
  `heard_notify` and the plan watch, body under `catch_unwind` with quarantine after
  three panics, an atomic key gate so an unchanged grid publishes nothing, a
  process-global `watch::Sender<Option<Arc<Published>>>`. Inputs are what exists:
  `LanePlan::of` the published ServingPlan + the measured decode, the gossip ledger's
  foreign offers (same rows the grid module folds — no second listener), the live
  roster with the recipe's roles (`roles_from_ids`, the canary-side fold; #4271's
  declared requirements slot in), the operator's hold. Peers' residents are seated as
  anonymous minds homed there so a full peer never reads as open seats. Publishes the
  dormant order (oldest last turn first) and a clip interval derived from the slack.
  Probes: grid.allocation.published, grid.dormant.oldest_turn_age_ms.
- persona/placement_switch.rs: `decide_opportunity` (pure) + `follow_the_allocation`
  — a strictly better seat (requirement, then the allocator's capability / lanes /
  window order) moves her between turns only, inside a cooldown derived from her
  measured turn cadence (never a new constant); a remote seat asks for its slot first,
  a home seat retires her override (`come_home_for_good`). Probe
  placement.move.opportunity. Failure moves now count too.
- cognition/resource_admission.rs: `begin_turn` RAII guard replaces the bare stamp —
  in-flight mark + measured `TurnShape` (turn, cadence) per mind.
- persona/spawner_module.rs + host.rs + ipc/mod.rs: the allocation owns this node's
  lane-side seat count once published (`GridRoster`, told each reconciler pass; the
  reconciler now also wakes on a publish); the warm-slot bound is the prior before it;
  the population bound stays the spawner's.
- modules/citizen_health.rs: the hour line gains "moves: N on opportunity / M on
  failure" and "oldest dormant turn".
- cognition/grid_allocation.rs: `LanePlan::better_than` / `BetterBy`, `GridRoster`,
  `roles_from_ids`.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Sep 20, 2026
…ator daemon speaks canary's vocabulary (card 10bba591)

Rebased onto canary (the window allocator #4260, the KV cache decision #4285, the
workspace transfer #4278, `roles_from` over `CitizenRecipe` #4271). Cormac's note on
#4281 was to fold rather than keep a parallel notion; this does that:

- `roles_from_ids` (mine, over `RoleId`) is DELETED. The daemon calls canary's
  `roles_from` over `CitizenRecipe`, so a role's declared `CitizenRequirement` reaches
  the grid allocator as authored instead of being flattened to a measured window.
- `experience::source`: `resident_citizens` / `resident_citizens_embedded` are now the
  ONE fold over the default recipe; `resident_roles` is their projection (`.map(role)`).
  Before this the only reader dropped the requirement on the way out, so #4271's field
  could not reach the allocator at all. Boot reads the citizens once and hands the
  spawner their roles.
- `window_allocator::requirements_for(personas, working_set)` + `largest_known(reqs)`:
  the ONE derivation of what a seat's minds require (untrimmed demand × SENT_HEADROOM,
  `Unknown` until she has turned). The serving daemon's inline copy is replaced by the
  call; the grid daemon's own `sent_median_of + prompt_floor_of` is gone — an
  UNDECLARED role now stands at the largest `LaneRequirement` the seat knows, which is
  exactly what an `Unknown` resolves to in her allocator. One vocabulary, two callers.
- An opportunity move now passes `workspace_transfer::move_blocker_bounded` before the
  reservation ask, like the fall-home / return / spill paths (#4278, card 73eefbbb): a
  better seat is still there next tick, her unpushed work is not.
- Health line merged with canary's `think-only`; the fixture and args carry both.
- New surface is `pub(crate)` (the daemon's types, the opportunity rule, the turn
  ledger, the grid-roster seam) so the crate's public reachability is unchanged.
  `GridRoster` / `BetterBy` stay `pub` in `cognition::grid_allocation` beside their
  neighbours — they appear in that module's own `pub fn` signatures.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Sep 21, 2026
…ry join and plan change; a mind moves to a strictly better seat between turns (card 10bba591) (#4281)

* feat(grid): the allocator daemon — the grid re-seats its minds on every join and plan change, and a mind moves to a strictly better seat between turns (card 10bba591)

Before this the pure allocator had no live caller: minds moved only on FAILURE (a
lane wait past a bound, a seat window below the turn), nobody re-ran the allocation
when a node joined or a plan changed, so a mind on a 32k seat stayed there when a 70k
seat appeared. Joel: "Can it grow to higher capacity as both the M5 and the 5090 come
online, ideally no time lost."

- modules/grid_allocator.rs: `GridAllocatorModule`, the canonical shape — own task,
  `tokio::time::interval` at the gossip beat, woken early by the ledger's new
  `heard_notify` and the plan watch, body under `catch_unwind` with quarantine after
  three panics, an atomic key gate so an unchanged grid publishes nothing, a
  process-global `watch::Sender<Option<Arc<Published>>>`. Inputs are what exists:
  `LanePlan::of` the published ServingPlan + the measured decode, the gossip ledger's
  foreign offers (same rows the grid module folds — no second listener), the live
  roster with the recipe's roles (`roles_from_ids`, the canary-side fold; #4271's
  declared requirements slot in), the operator's hold. Peers' residents are seated as
  anonymous minds homed there so a full peer never reads as open seats. Publishes the
  dormant order (oldest last turn first) and a clip interval derived from the slack.
  Probes: grid.allocation.published, grid.dormant.oldest_turn_age_ms.
- persona/placement_switch.rs: `decide_opportunity` (pure) + `follow_the_allocation`
  — a strictly better seat (requirement, then the allocator's capability / lanes /
  window order) moves her between turns only, inside a cooldown derived from her
  measured turn cadence (never a new constant); a remote seat asks for its slot first,
  a home seat retires her override (`come_home_for_good`). Probe
  placement.move.opportunity. Failure moves now count too.
- cognition/resource_admission.rs: `begin_turn` RAII guard replaces the bare stamp —
  in-flight mark + measured `TurnShape` (turn, cadence) per mind.
- persona/spawner_module.rs + host.rs + ipc/mod.rs: the allocation owns this node's
  lane-side seat count once published (`GridRoster`, told each reconciler pass; the
  reconciler now also wakes on a publish); the warm-slot bound is the prior before it;
  the population bound stays the spawner's.
- modules/citizen_health.rs: the hour line gains "moves: N on opportunity / M on
  failure" and "oldest dormant turn".
- cognition/grid_allocation.rs: `LanePlan::better_than` / `BetterBy`, `GridRoster`,
  `roles_from_ids`.

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

* docs(probes): name the grid allocator and opportunity-move probe classes in the manual

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

* refactor(grid): one requirement notion, one citizens fold — the allocator daemon speaks canary's vocabulary (card 10bba591)

Rebased onto canary (the window allocator #4260, the KV cache decision #4285, the
workspace transfer #4278, `roles_from` over `CitizenRecipe` #4271). Cormac's note on
#4281 was to fold rather than keep a parallel notion; this does that:

- `roles_from_ids` (mine, over `RoleId`) is DELETED. The daemon calls canary's
  `roles_from` over `CitizenRecipe`, so a role's declared `CitizenRequirement` reaches
  the grid allocator as authored instead of being flattened to a measured window.
- `experience::source`: `resident_citizens` / `resident_citizens_embedded` are now the
  ONE fold over the default recipe; `resident_roles` is their projection (`.map(role)`).
  Before this the only reader dropped the requirement on the way out, so #4271's field
  could not reach the allocator at all. Boot reads the citizens once and hands the
  spawner their roles.
- `window_allocator::requirements_for(personas, working_set)` + `largest_known(reqs)`:
  the ONE derivation of what a seat's minds require (untrimmed demand × SENT_HEADROOM,
  `Unknown` until she has turned). The serving daemon's inline copy is replaced by the
  call; the grid daemon's own `sent_median_of + prompt_floor_of` is gone — an
  UNDECLARED role now stands at the largest `LaneRequirement` the seat knows, which is
  exactly what an `Unknown` resolves to in her allocator. One vocabulary, two callers.
- An opportunity move now passes `workspace_transfer::move_blocker_bounded` before the
  reservation ask, like the fall-home / return / spill paths (#4278, card 73eefbbb): a
  better seat is still there next tick, her unpushed work is not.
- Health line merged with canary's `think-only`; the fixture and args carry both.
- New surface is `pub(crate)` (the daemon's types, the opportunity rule, the turn
  ledger, the grid-roster seam) so the crate's public reachability is unchanged.
  `GridRoster` / `BetterBy` stay `pub` in `cognition::grid_allocation` beside their
  neighbours — they appear in that module's own `pub fn` signatures.

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

* fix(grid): the local offer's decode reads canary's `tps_for` — `measured_tps_for` went with the #4194 revert

CI (the compiler) caught the one symbol the rebase carried over from the reverted
output-allowance work. `decode_knee::tps_for` is the rate this box measured at the
LIGHTEST trusted concurrency; the plan's own lane count already respects the measured
knee (`plan_serving` applies `knee_lanes`), so "every lane here decodes at or above
the floor" is the plan's statement and this number says how fast. `None` (never
measured) stays an absence the allocator does not read as a refusal.

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

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant