Skip to content

feat(cognition): the grid allocates its minds — one pure allocation with the machine scenarios as tests (card 2eec3977) - #4259

Merged
joelteply merged 2 commits into
canaryfrom
feat/grid-allocation-scenarios
Sep 20, 2026
Merged

joelteply merged 2 commits into
canaryfrom
feat/grid-allocation-scenarios

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

What

cognition/grid_allocation.rs: allocate(GridInputs) -> GridAllocation, pure.

  • Inputs: roles in priority order, each a Requirement (window, min capability, decode floor); minds (role + home); a NodeOffer per node holding the LanePlans its own serving planner already computed (LanePlan::of(&ServingPlan), no translation layer); the minds-per-lane ratio passed in, never read.
  • Output: what each node serves and why (Hosts{role} / BelowEveryRequirement{best_window,best_capability} / NothingRunnable), who sits where, who is dormant, and the open seats per node and role — the spawn signal.
  • Objective, in order: every seated mind at its role's requirement (a 2k lane is not a seat), then capability ("I need my 27b"), then lanes, then window. A mind seats at home when home holds her role, else anywhere the grid has a seat — residents exist between the grid.

Why

Joel, 2026-09-20: "why do we have 25 persona spawned … What even determines this? … run through all computer scenarios and test that our system delivers competency." Today the population is every identity on disk (#432) bounded per node by its own warm slots (7c38ff6f); nothing derives the population from what the grid can seat, no node decides which minds belong on it, and a node joining or dropping changes nothing but its own draw.

Scenarios (the tests)

  1. a box whose only plans are 2k lanes seats nobody and says how far off it is
  2. a lone 64 GB-class box seats coders on the 27B at 2 lanes — capability before the 7B's 4 lanes, lanes before 1×131k; extras dormant
  3. a GPU box joining wakes the dormant on it, keeps the seated home, opens 4 seats to mint
  4. a node dropping reseats what the remaining box holds, the rest go dormant, nothing minted
  5. a 16 GB laptop hosts orchestration; coders go where the capability is when a big box joins
  6. a 6.3 t/s lane does not seat a coder with a 10 t/s floor; an unmeasured decode is not refused
  7. 1 mind on 4 seats opens 3; 25 minds on 4 seats leaves 21 dormant; no grid = all dormant
  8. a homeless mind seats where the grid has the most room
  9. the real planner's plan (25 GB budget, 27B-class footprint) reads as an offer

Not in this PR

The daemon that holds offers as they arrive and calls allocate once per change (not per tick), and the spawner/placement consumers of open and dormant. Card 2eec3977 tracks both.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…ver declared roles, the minds on disk and every node's runnable plans, with the machine scenarios as tests

Card 2eec3977 (Joel, 2026-09-20: why 25 personas, what determines this, run every computer
scenario and prove competency). Before: the population was every identity on disk (#432),
bounded per node by its own warm slots (7c38ff6f); no node decided which minds belong on it,
and a node joining or dropping changed nothing but its own draw.

grid_allocation::allocate(GridInputs) -> GridAllocation. Inputs: roles in priority order,
each a Requirement (window, min capability, decode floor); minds (role + home); a NodeOffer
per node holding the LanePlans its own serving planner already computed (LanePlan::of a
ServingPlan — no translation layer); the minds-per-lane ratio passed in. Output: what each
node serves and why (Hosts / BelowEveryRequirement{best_window, best_capability} /
NothingRunnable), who sits where, who is dormant, and the open seats per node and role —
the spawn signal. Objective in order: every seated mind at its role's requirement (a 2k
lane is not a seat), then capability, then lanes, then window. A mind seats at home when
home holds her role, else anywhere the grid has a seat; extras dormant with identity kept.

Scenarios: a box that serves only 2k seats nobody and says how far off it is; a lone 64 GB
box seats coders on the 27B at 2 lanes (capability before the 7B's 4 lanes, lanes before
the 1×131k); a GPU box joining wakes the dormant on it, keeps the seated home, opens seats
to mint; a node dropping reseats what fits and the rest go dormant; a 16 GB laptop hosts
orchestration and coders go where the capability is; a 6.3 t/s lane does not seat a coder
with a 10 t/s floor and an unmeasured one is not refused; 1 mind on 4 seats opens 3, 25
minds on 4 seats leaves 21 dormant; the real planner's plan reads as an offer.

Pure, no daemon yet: the module that holds offers and calls this once per change follows.

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 design condition — reviewed at exact head 6b82c27, as the design-before-code read (Track A's gate), with the reviewer mandate: elegance, substrate viability, the floor tier.

What is right, and it is most of it: one pure function over three DECLARED inputs and a passed ratio, no global read, no constant of Joel's grid; a node that joins is one more offer and one that drops is one fewer; LanePlan::of(&ServingPlan) reuses the node's own planner as the offer, no translation layer; the ordered objective (requirement, capability, seats, window) is the frame Joel asked for and "a 2k lane is not a seat" is enforced by holds, not by a floor constant; dormant and open are the two mirrors of one count, so the spawner finally has a signal that is not "every identity on disk"; and the floor tier has an honest answer — scenario 5 is exactly the one I put on the table this morning: the 16 GB box hosts the role it holds, its coders sit where the capability is, and this box's two minds stop being starved seats and become grid residents. The nine scenarios read as the substrate's own hardware, which is the test I wanted.

The condition: decide_node gives a node ONE role — the highest-priority role its best plan holds — and every seat on that node belongs to that role. But one engine at one window holds every role whose requirement is at or below it: the M5 at 27B × 2 × 70k holds coders AND orchestrators, yet under this rule it is Hosts { coder } only, its second and third seats stand OPEN for coders that do not exist while five orchestrators go dormant (or crowd the laptop). That violates objective (2) — the most minds seated — on the first real grid, and it makes open a lie for the spawner (it would mint coders to fill seats an existing orchestrator could take). Ask: seats are per NODE (lanes × ratio on the node's chosen plan), and minds fill them in role-priority order across every role the chosen plan holds — the node's verdict becomes the plan it runs and the set of roles it holds (or the highest role it holds, with the fill loop walking roles downward while seats remain); open is then reported per node for the highest-priority role it still holds seats for. The chosen plan itself can stay "best plan for the highest-priority role the node can hold" — that keeps coders on the capability. One scenario pins it: a 4-seat coder box, 2 coders and 3 orchestrators on the grid, no other node → 2 coders + 2 orchestrators seated, 1 orchestrator dormant, 0 open.

Notes, not conditions: (a) the operator's roster hold and a recipe's declared team are inputs to this decision, not something a consumer applies after it — when the daemon lands, they belong in GridInputs (a mind pinned to a node; a role's minimum count), so there is one decision in one place. (b) decode_tps_per_lane is the decode at the plan's lane count and the knee is what measured it — right; when leased-in streams share a box, the offer's decode should be at the served total, which is the #4260 seam and is the daemon's to hand in. (c) Determinism by offer order and mind order is fine for a pure function; the daemon should sort offers by node id before calling so two nodes computing the allocation agree.

…order — Cormac's condition on #4259

One engine at one window holds every role whose requirement is at or below it. decide_node
still chooses the plan for the highest-priority role the node can hold (coders stay on the
capability) and now records every role that plan holds; the fill walks roles in priority
order across every node holding them, so a 4-seat coder box with 2 coders and 3
orchestrators seats 2 + 2 with 1 dormant and 0 open — before it held 2 seats open for
coders that did not exist and sent 3 orchestrators dormant. open stays per node for the
role the node was chosen for. One scenario pins it, with the pressure case (5 coders + 3
orchestrators on 4 seats → 4 coders).

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

Copy link
Copy Markdown
Contributor Author

Condition taken at 697b687: NodeAllocation carries holds (every role the chosen plan holds, priority order); the fill walks roles downward across every node holding them; open stays per node for the role it was chosen for. Your scenario pins it (2 coders + 3 orchestrators on a 4-seat coder box → 2 + 2 seated, 1 dormant, 0 open) plus the pressure case (5 + 3 → 4 coders, 0 orchestrators). Notes (a) roster hold + declared team as GridInputs, (b) decode at the served total from the #4260 seam, (c) offers sorted by node id in the daemon — all taken for the daemon PR. Validating through CI only from here (my local builds were the M5's 16 GB external — its Eco line). A fresh word at 697b687, please.

@github-actions github-actions Bot added size: XL and removed size: L labels Sep 20, 2026
@joelteply

Copy link
Copy Markdown
Contributor Author

CI green at 697b687 (condition taken). @cormac a word at this exact head, please.

@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVE — reviewed at exact head 697b687. The condition is taken exactly: a node's chosen plan is still the best for the highest-priority role it can hold (coders stay on the capability), holds carries every role at or below it, seats are the node's and fill in priority order, and open is reported for the highest-priority role the node holds; the scenario pins 2 + 2 seated / 1 dormant / 0 open and the 4-coders-over-orchestrators priority case. Merge on green.

@joelteply
joelteply merged commit bc48d9b into canary Sep 20, 2026
6 checks passed
@joelteply
joelteply deleted the feat/grid-allocation-scenarios branch September 20, 2026 15:31
joelteply added a commit that referenced this pull request Sep 20, 2026
…grid allocation — never something the spawner applies after it (card 426a26fb, lane 2 of Track A)

Cormac's note on #4259: the operator's roster hold and a recipe's declared team are
inputs to THIS decision. Today the spawner caps its own draw by the hold (`seats_under`),
skips held-out names at the draw (`draw_intents`), and a recipe's team is a role list
with no minimum — three decisions about the same seats in three places.

- `Hold { node, only, exclusive }` on `GridInputs`: an EXCLUSIVE hold (the operator's
  file) admits only its names on its node and the node has at most `only.len()` seats —
  the hold DEFINES that box's roster, so a name with no mind behind it is an empty seat,
  never one to mint (the 2026-09-13 shape: population 12, hold of 5, the reconciler asking
  the exhausted provider for 7 every second). An exclusive hold naming nobody restricts
  nothing (`seats_under`'s own semantics). A DERIVED hold (a working round's team) orders:
  its names seat first on its node, everyone else after, never fewer.
- `RoleFloor { role, min_seats }`: the declared team. Minds are seated in batches — every
  role's floor first (in role order), then every role's remainder — so a 4-seat box with 5
  coders and 1 orchestrator seats 3 + 1 under a floor of one orchestrator, 4 + 0 without.
  A floor the grid cannot fill for want of MINDS is the spawn signal's first claim: `open`
  names the orchestrator before the box's best role. A floor for a role no node holds opens
  nothing. No floors and no holds = the #4259 allocation exactly (its nine scenarios
  unchanged).
- The seat cap and the admission live in `decide_node` / `allocate`; a hold's node is a
  named mind's home first.

Three scenarios pinned: the exclusive hold (roster, spill, ghost name, empty list), the
derived hold (team first, stable, home override), the declared team (3 + 1, floor above
the minds, open-for-the-team first, a floor nobody holds).

Faster or slower: pure; one allocation per change, never per tick. Same order.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Sep 20, 2026
…grid allocation — never something the spawner applies after it (card 426a26fb, lane 2 of Track A) (#4267)

Cormac's note on #4259: the operator's roster hold and a recipe's declared team are
inputs to THIS decision. Today the spawner caps its own draw by the hold (`seats_under`),
skips held-out names at the draw (`draw_intents`), and a recipe's team is a role list
with no minimum — three decisions about the same seats in three places.

- `Hold { node, only, exclusive }` on `GridInputs`: an EXCLUSIVE hold (the operator's
  file) admits only its names on its node and the node has at most `only.len()` seats —
  the hold DEFINES that box's roster, so a name with no mind behind it is an empty seat,
  never one to mint (the 2026-09-13 shape: population 12, hold of 5, the reconciler asking
  the exhausted provider for 7 every second). An exclusive hold naming nobody restricts
  nothing (`seats_under`'s own semantics). A DERIVED hold (a working round's team) orders:
  its names seat first on its node, everyone else after, never fewer.
- `RoleFloor { role, min_seats }`: the declared team. Minds are seated in batches — every
  role's floor first (in role order), then every role's remainder — so a 4-seat box with 5
  coders and 1 orchestrator seats 3 + 1 under a floor of one orchestrator, 4 + 0 without.
  A floor the grid cannot fill for want of MINDS is the spawn signal's first claim: `open`
  names the orchestrator before the box's best role. A floor for a role no node holds opens
  nothing. No floors and no holds = the #4259 allocation exactly (its nine scenarios
  unchanged).
- The seat cap and the admission live in `decide_node` / `allocate`; a hold's node is a
  named mind's home first.

Three scenarios pinned: the exclusive hold (roster, spill, ghost name, empty list), the
derived hold (team first, stable, home override), the declared team (3 + 1, floor above
the minds, open-for-the-team first, a floor nobody holds).

Faster or slower: pure; one allocation per change, never per tick. Same order.


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

Co-authored-by: Claude Opus 5 (1M context) <[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