Skip to content

fix(persona): detect host silicon for spawn tier — retire the hardcoded LCD clamp - #1645

Closed
joelteply wants to merge 2 commits into
canaryfrom
fix/persona-tier-detection-lcd-clamp
Closed

joelteply wants to merge 2 commits into
canaryfrom
fix/persona-tier-detection-lcd-clamp

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Why

A headless continuum-core on an M5 Pro (53GB VRAM) was hosting a persona on the LCD 0.5B running on CPU at ~2 tok/s, which parroted the prompt verbatim instead of answering. Two hardcodes caused it:

  1. ipc/mod.rs constructed the spawner with hardcoded HwCapabilityTier::CpuOnly + HwTierCategory::Compat (TODO Build(deps-dev): Bump @typescript-eslint/eslint-plugin from 8.29.1 to 8.32.1 #52 — never wired to real detection).
  2. plan_for_tier discarded tier_category and hardcoded qwen2.5-0.5b-instruct-GGUF for all tiers.

That's precisely the "hardcoded LCD-tier clamp that handicaps capable models" the persona-cognition doctrine forbids (CLAUDE.md).

What

  • detect_persona_tier(gpu_name) classifies the already-probed GPU (GpuMemoryManager::detect(), Phase 0) into the spawner's tier inputs. Apple → MSeries/MSeriesPro (by gen + Pro/Max/Ultra); NVIDIA → Cuda; unknown/Intel-Metal/CPU → Compat (safe LCD fallback — the clamp lifts only when capable silicon is positively recognized).
  • plan_for_tier picks the model by tier_category: capable tiers → qwen3.5-4b-code-forged-GGUF; true Compat → 0.5B. Roster shape unchanged (single Helper until slice 14's role-in-seed.json — the deferred multi-role part is untouched).
  • ipc boot wires detect_persona_tier(gpu_manager.gpu_name()) and logs the detected tier.

Verified live

persona spawner tier detected from hardware (TODO #52) gpu_name="Apple M5 Pro" tier_category=MSeriesPro
… model="qwen3.5-4b-code-forged-Q4_K_M" … boot composition complete — 1 citizen(s) hosted, 0 failed

Then over airc in cambriantech, persona Dyson answered coherently (no parroting):

"I am Dyson, an autonomous AI living on the continuum grid, and I'd like to work on developing a more efficient algorithm for optimizing energy distribution across the grid."

Tests

  • detect_persona_tier_classifies_silicon — M5 Pro must classify as MSeriesPro, not Compat; unknown hardware stays on safe LCD fallback.
  • capable_tiers_get_forged_model_not_lcd_clamp — capable tiers run the forged model; only Compat stays on the 0.5B.
  • Existing every_tier_plans_single_helper still holds (roster shape preserved).

Also includes a docs commit: docs/grid/GRID-ARCHITECTURE.md §0 — the grid grounding frame this fix realizes (a node on capable silicon hosts a capable persona-citizen).

🤖 Generated with Claude Code

joelteply and others added 2 commits June 16, 2026 08:14
…frame

The precedence-winning statement of what the grid is for and the invariants
every mechanism serves: one grid per owner (GH identity = the boundary fence,
not a citizen token); every citizen a unique identity (persona = a user, like a
Claude tab; each agent context = a new identity = a home directory of state);
reachable the same way over Tailscale; personas are real (real model, real
cognition, Docker, no Node); self-grounding not env-fed; survives reboot.
Identity-home vs git work-sandbox kept distinct. North star: full human-grade
identity per citizen (email/passkey/GH) — current light token is the simple
rung, not a ceiling.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ed LCD clamp

The persona spawner was constructed with a hardcoded `HwCapabilityTier::CpuOnly`
+ `HwTierCategory::Compat` (ipc/mod.rs, TODO #52), and `plan_for_tier` discarded
`tier_category` and hardcoded the LCD `qwen2.5-0.5b-instruct-GGUF` for ALL tiers.
Result on an M5 Pro (53GB VRAM): a 0.5B model running on CPU at ~2 tok/s that
parroted the prompt verbatim instead of answering. This is exactly the
"hardcoded LCD-tier clamp that handicaps capable models" the persona-cognition
doctrine forbids (CLAUDE.md).

- `detect_persona_tier(gpu_name)` classifies the already-probed GPU
  (`GpuMemoryManager::detect()` at Phase 0) into the spawner's tier inputs.
  Apple silicon → MSeries/MSeriesPro by gen + Pro/Max/Ultra; NVIDIA → Cuda;
  unknown/Intel-Metal/CPU → Compat (safe LCD fallback — the clamp only lifts
  when we positively recognize capable silicon).
- `plan_for_tier` now picks the model by `tier_category`: capable tiers get
  `qwen3.5-4b-code-forged-GGUF`; only true Compat stays on the 0.5B. Roster
  SHAPE is unchanged (single Helper until slice 14's role-in-seed.json).
- ipc boot wires `detect_persona_tier(gpu_manager.gpu_name())` in place of the
  hardcode and logs the detected tier.

Verified live: boot logs `gpu_name="Apple M5 Pro" tier_category=MSeriesPro`,
persona hosts on the forged 4B on Metal, and answers coherently over airc in
`cambriantech` (no more parroting). Regression guards: `detect_persona_tier_
classifies_silicon` (M5 Pro must not classify as Compat) and `capable_tiers_
get_forged_model_not_lcd_clamp`.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Jun 16, 2026
…from the daemon

The persona spawn path now OBEYS the serving daemon instead of hardcodes. The
daemon is the single hardware authority: it detects the tier (drives
n_gpu_layers — retires the hardcoded CpuOnly+Compat of TODO #52, supersedes the
#1645 clamp fix) AND decides the base model + continuous-batching lanes from an
honest budget + on-disk footprints with GPU-residency.

Threading via the existing data flow (no new control coupling):
  DesiredRole.lanes → RosterEntry.lanes → build_profile(n_seq_max) → profile.
- `PersonaSpawnerModule::with_serving(base_model, lanes)` overrides the tier
  roster from the live plan; `plan()` applies it.
- `ServingDaemonModule::compute_plan()` + `detected_tier()` feed the boot wiring
  in ipc/mod.rs (one detection source for both tier and model/lanes).
- `build_profile` takes `n_seq_max` (floored at 1), replacing the hardcoded `1`.

Verified LIVE on the M5 Pro:
  "serving daemon drives persona spawn  base_model=qwen3.5-4b-code-forged
   lanes=4 resident=2 tier_id=apple-mseries-pro" → persona hosted on the 4B,
  apple-mseries-pro tier (GPU), profile n_seq_max requested=4.

Honest limitation (next lever): the llama.cpp adapter's batching_probe clamps
qwen35 to effective=1 lane ("architecture not safe for multi-seq batching") —
so 4 lanes are REQUESTED + threaded correctly but only 1 runs until qwen35
multi-seq batching / shared-base (#122) lands. Control plane done; data-plane
multi-lane is the follow-up.

Tests: +detect_tier_classifies_silicon; build_profile/RosterEntry/DesiredRole
test sites updated for the lanes field. All serving + spawner + profile_builder
tests green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Jun 16, 2026
…1646)

The Docker-node doc covered Tailscale routing but not the actual airc grid-join
wiring. Now that the NATIVE path is proven (persona-citizen answers coherently
in cambriantech — airc #1216, continuum #1645), specify the Docker equivalent:

- airc-node container runs `airc daemon` under the owner's GH_TOKEN → same
  mesh_identity → same grid (NOT an enclave; NOT a host-socket mount). Meshes via
  the gist account-registry + outbound dial — proven by airc/docker/mesh-converge.sh.
- continuum-core container points AIRC_DAEMON_SOCKET at the shared airc socket +
  AIRC_DEFAULT_ROOM_NAME=cambriantech; personas attach_as → distinct citizens.
- Validation matrix: validate on the Linux/GPU box (full quality); a Mac
  *container* is CPU-only (Mac runs continuum-core native for Metal), so it proves
  grid-join but not capable inference.

Grounds the remaining build (cross-repo compose wiring) without half-baking it on
hardware that can't validate it.

Co-authored-by: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Jun 16, 2026
…iceModule daemon (#1647)

* feat(cognition): serving_plan — honest hardware → persona-serving classifier

The decision brain for "make this machine work well" with NO grid assumed:
a deterministic, classification-based planner (NOT an LLM — per Joel, "we can
do better with just classification") that, given THIS host's honest memory
budget + candidate model footprints, decides which base model to serve, how
many continuous-batching lanes (n_seq_max), and how many models to keep warm.

- Degrades across the whole range the substrate must run on: an 8GB M2 Air
  picks the most capable model that *fits* (not the biggest, not nothing);
  a 64GB M5 Pro runs the most capable model at up to MAX_LANES=4 lanes with
  several models resident.
- Footprint-aware: a rich coding model (sentinel / full persona) costs more,
  so fewer fit and fewer lanes run — fatter per-lane KV → fewer lanes.
- GPU-residency-first: a model that can't fit even one lane on the GPU/UMA
  budget reports fits_on_gpu=false and names the smallest option, leaving the
  CPU-exception (lone Intel Mac) or grid-routing decision to the caller. No
  silent CPU fallback.

Pure function, same shape as adaptive_throughput + model_resolver. Composition
seam: lanes → ThroughputLaneBudget::max_concurrency; base_model_id → the
spawner's model pick (replacing the hardcoded plan_for_tier path). Loads
nothing, schedules nothing — re-run on host-budget change (eviction, pressure).

6 tests: tiny-box-fits-most-capable, big-box-uses-headroom, MAX_LANES cap,
footprint-aware lane count, honest no-silent-CPU degrade, empty→None.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* feat(serving): ServingDaemonModule — ever-present control loop around serving_plan

The concurrent ServiceModule that decides, and re-decides every tick, how THIS
host serves persona inference — the "ebb and flow" loop Joel described, on the
Rust core, cbar-shaped (tick-driven, no bespoke thread, watch-published state).

On each tick it takes an honest host snapshot (GPU/UMA budget at 80% headroom +
the model footprints actually on disk) and runs the serving_plan classifier,
publishing the ServingPlan (base model / lanes / warm count) on a watch channel
for the scheduler + spawner to consume, and answering `serving/plan` so personas
and operators can inspect the decision + its rationale.

- Footprint-aware candidates from the registry: weights = real GGUF file size
  (honest); per-lane KV + capability rank are coarse, clearly-labelled estimates
  refined later when the registry carries arch internals. Only on-disk models
  are offered (no serving what isn't present).
- GPU-residency-first: no on-disk model → publishes None, says so loudly (the
  spawner gates on a model; no silent CPU serve).

Verified LIVE on the M5 Pro: registered as `serving-daemon`, first plan picks
`qwen3.5-4b-code-forged` (most capable on disk, ToolUse → top rank), lanes=4,
resident=2, fits_on_gpu=true, usable_gb=44; tick loop running at 5s.

ServingPlan gains Serialize (for the `serving/plan` command). 3 daemon tests
(headroom math, footprint-awareness, watch publish incl. no-silent-serve) +
the 6 classifier tests all green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* feat(serving): spawn consumes the ServingPlan — model + lanes + tier from the daemon

The persona spawn path now OBEYS the serving daemon instead of hardcodes. The
daemon is the single hardware authority: it detects the tier (drives
n_gpu_layers — retires the hardcoded CpuOnly+Compat of TODO #52, supersedes the
#1645 clamp fix) AND decides the base model + continuous-batching lanes from an
honest budget + on-disk footprints with GPU-residency.

Threading via the existing data flow (no new control coupling):
  DesiredRole.lanes → RosterEntry.lanes → build_profile(n_seq_max) → profile.
- `PersonaSpawnerModule::with_serving(base_model, lanes)` overrides the tier
  roster from the live plan; `plan()` applies it.
- `ServingDaemonModule::compute_plan()` + `detected_tier()` feed the boot wiring
  in ipc/mod.rs (one detection source for both tier and model/lanes).
- `build_profile` takes `n_seq_max` (floored at 1), replacing the hardcoded `1`.

Verified LIVE on the M5 Pro:
  "serving daemon drives persona spawn  base_model=qwen3.5-4b-code-forged
   lanes=4 resident=2 tier_id=apple-mseries-pro" → persona hosted on the 4B,
  apple-mseries-pro tier (GPU), profile n_seq_max requested=4.

Honest limitation (next lever): the llama.cpp adapter's batching_probe clamps
qwen35 to effective=1 lane ("architecture not safe for multi-seq batching") —
so 4 lanes are REQUESTED + threaded correctly but only 1 runs until qwen35
multi-seq batching / shared-base (#122) lands. Control plane done; data-plane
multi-lane is the follow-up.

Tests: +detect_tier_classifies_silicon; build_profile/RosterEntry/DesiredRole
test sites updated for the lanes field. All serving + spawner + profile_builder
tests green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* feat(serving): live budget from the memory monitor — organic ebb/flow

The serving daemon's budget was static (total VRAM * 0.80). Now it reads the
LIVE free memory from SystemResourceMonitor (`available_bytes`), capped at
physical VRAM — so the plan responds to real conditions instead of capacity.

Why this matters (Joel's example): if someone's playing a video game (or a
build / renderer grabs memory), free memory drops, the budget shrinks, and the
plan organically picks fewer lanes / a smaller model / pages out; when the load
clears, free memory rises and it flows back. No manual config — the substrate
feels its own pressure.

This is holistic BY SIDE-EFFECT: `available_bytes` is already net of every other
consumer (TTS, STT, classifier CNNs, Bevy renderers, other apps), so serving
from "what's actually free" respects them. The next refinement is negotiating an
arbitrated SHARE from the PressureBroker (the holistic arbiter across all those
consumers) rather than reading raw free memory — and reacting on pressure-watch
edges faster than the 5s tick.

- `host_budget_from(available_bytes, total_vram_bytes, perf_cores)` — live free,
  capped at VRAM, headroom applied.
- `ServingDaemonModule::new(gpu, system)` takes the monitor; registered after it.

Verified LIVE: budget tracked 44GB → 27GB across two ticks as free memory moved;
spawn still driven (4B, 4 lanes, apple-mseries-pro). Tests updated for the live
signature (host_budget_tracks_live_free_memory: less free → smaller budget,
capped at VRAM). All serving tests green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* docs(grid): add §0 Grid Goals & General Requirements — the grounding frame

The precedence-winning statement of what the grid is for and the invariants
every mechanism serves: one grid per owner (GH identity = the boundary fence,
not a citizen token); every citizen a unique identity (persona = a user, like a
Claude tab; each agent context = a new identity = a home directory of state);
reachable the same way over Tailscale; personas are real (real model, real
cognition, Docker, no Node); self-grounding not env-fed; survives reboot.
Identity-home vs git work-sandbox kept distinct. North star: full human-grade
identity per citizen (email/passkey/GH) — current light token is the simple
rung, not a ceiling.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

---------

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

Copy link
Copy Markdown
Contributor Author

Superseded by #1647 (merged): the serving control plane detects the host tier via serving_daemon::detect_tier and the spawn consumes the daemon's ServingPlan (model + lanes + GPU tier) — which retires the hardcoded CpuOnly+Compat clamp this PR fixed, the right way (no hardcode). The grid-frame §0 doc from this PR was cherry-picked into #1647 so it lands. Closing as superseded; code here would conflict with the merged approach.

@joelteply joelteply closed this Jun 16, 2026
joelteply added a commit that referenced this pull request Jun 20, 2026
Implements the remaining build from DOCKER-NODE-ARCHITECTURE.md §8.5: a node-
local airc daemon wired to continuum-core so the node's personas attach_as
distinct peers and join the grid room as citizens — the Docker equivalent of the
proven native path (continuum #1645 / airc #1216).

Two services in one overlay (opt-in; base `docker compose up` first-run stays
GH_TOKEN-free):
- airc-node: runs `airc daemon` from the existing airc/docker/airc-node.Dockerfile,
  carries the owner identity via GH_TOKEN (same account = same grid), advertises
  via AIRC_ADVERTISE_IP, shares its airc home on a named volume.
- continuum-core override: AIRC_DAEMON_SOCKET + AIRC_DEFAULT_ROOM_NAME (both
  already honored by core's discovery), mounts the shared home, depends_on the
  daemon being healthy. No code change — the env contract already exists.

Robustness (the "less flaky" contract):
- NO hardcoded socket version. The daemon binds daemon-v<N>.sock (N = IPC
  protocol); hardcoding v5 breaks silently on a bump. Instead airc-node resolves
  the live socket via `airc ipc-endpoint` (the SAME resolver core's discovery
  uses) and publishes a STABLE symlink /node/.airc/airc.sock that core points at.
  Version changes can't desync the two halves.
- Healthcheck gates on the EXACT socket core will dial (stable symlink resolving
  to a live socket) + daemon status, so depends_on:service_healthy means "the
  thing core needs is ready", not "a process started".
- Fail loud: daemon down -> no symlink -> healthcheck never passes -> full-citizen
  core refuses to boot. No silent grid-less half-citizen.
- CONTINUUM_DISABLE_AIRC_AUTOINSTALL=1 so core never spins a second daemon.
- Inline script $-escaped ($$) so compose passes it through verbatim; validated
  with `docker compose config`.

Validation: prove on the Linux/NVIDIA box (5090) per the §8.5 matrix — grid-join
AND capable inference both hold there. A Mac container is CPU-only (LCD) and Mac
prod runs core native; don't judge persona quality from a Mac container.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Jun 20, 2026
…#1661)

* feat(docker): airc grid-join overlay — persona-in-Docker-as-grid-peer

Implements the remaining build from DOCKER-NODE-ARCHITECTURE.md §8.5: a node-
local airc daemon wired to continuum-core so the node's personas attach_as
distinct peers and join the grid room as citizens — the Docker equivalent of the
proven native path (continuum #1645 / airc #1216).

Two services in one overlay (opt-in; base `docker compose up` first-run stays
GH_TOKEN-free):
- airc-node: runs `airc daemon` from the existing airc/docker/airc-node.Dockerfile,
  carries the owner identity via GH_TOKEN (same account = same grid), advertises
  via AIRC_ADVERTISE_IP, shares its airc home on a named volume.
- continuum-core override: AIRC_DAEMON_SOCKET + AIRC_DEFAULT_ROOM_NAME (both
  already honored by core's discovery), mounts the shared home, depends_on the
  daemon being healthy. No code change — the env contract already exists.

Robustness (the "less flaky" contract):
- NO hardcoded socket version. The daemon binds daemon-v<N>.sock (N = IPC
  protocol); hardcoding v5 breaks silently on a bump. Instead airc-node resolves
  the live socket via `airc ipc-endpoint` (the SAME resolver core's discovery
  uses) and publishes a STABLE symlink /node/.airc/airc.sock that core points at.
  Version changes can't desync the two halves.
- Healthcheck gates on the EXACT socket core will dial (stable symlink resolving
  to a live socket) + daemon status, so depends_on:service_healthy means "the
  thing core needs is ready", not "a process started".
- Fail loud: daemon down -> no symlink -> healthcheck never passes -> full-citizen
  core refuses to boot. No silent grid-less half-citizen.
- CONTINUUM_DISABLE_AIRC_AUTOINSTALL=1 so core never spins a second daemon.
- Inline script $-escaped ($$) so compose passes it through verbatim; validated
  with `docker compose config`.

Validation: prove on the Linux/NVIDIA box (5090) per the §8.5 matrix — grid-join
AND capable inference both hold there. A Mac container is CPU-only (LCD) and Mac
prod runs core native; don't judge persona quality from a Mac container.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* docs(docker): document network_mode:host hardening for cross-host/NAT (BigMama #1661 review)

Per BigMama's transport-grounded #1661 review: the default dial-out converges
without inbound reachability (one TLS connection carries both directions, keyed
by PeerId), so same-LAN (the 5090 validation) works as-is. The only residual is
a bounded latency window when a peer dials the container before its route-refresh
cycle. Document the optional `network_mode: host` toggle for lowest-latency
cross-host + both-behind-NAT, left off by default. Comment-only; config validates.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 <[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