Skip to content

feat(cognition): Workspace brain-core + the brain architecture (no heuristics, equal citizens) - #1655

Merged
joelteply merged 20 commits into
canaryfrom
feat/persona-brain-workspace-core
Jun 17, 2026
Merged

joelteply merged 20 commits into
canaryfrom
feat/persona-brain-workspace-core

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

First real piece of the persona brain: the Workspace integration core (Faculty trait + Workspace + pluggable Arbiter + Decision), built alongside the live loop and fully tested (5/5). Plus the two design docs (PERSONA-BRAIN-ARCHITECTURE.md, PERSONA-PARTICIPATION-AS-ML-COGNITION.md).

Why: replaces the heuristic-slave model (calculate_priority caste + fast_path mention-gate) with a mind — attention is ML-salience competition, participation is the deliberation faculty's thought (Speak/RaiseUnprompted/Pass), every faculty a swappable ML adapter (LLM/custom/sentinel-ai-forged). Serviced cbar-style over consolidated bursts, never per-event. Equal citizens enforced structurally — no SenderType anywhere; a test proves a peer persona's relevant message beats a human's low-value one.

This is the Faculty<->pipeline-step contract for the recipe-executor (IntelMac slice 2). Built alongside; cut-over (deleting the heuristics, wiring service_loop) is a coordinated follow-up.

🤖 Generated with Claude Code

joelteply and others added 2 commits June 17, 2026 06:13
…te, no gate

First real piece of PERSONA-BRAIN-ARCHITECTURE.md, built alongside the live loop
(does not yet replace calculate_priority/fast_path — cut-over once the recipe
executor calls in). The integration core that gives the cycle a mind:

- Faculty trait (async; swappable ML adapter — LLM, custom/sentinel-ai-forged,
  or composite; per-persona instances).
- Workspace: the consolidated world-state (channel/recipe-shaped — text thread,
  game space, AR, code) + the bounded broadcast.
- Arbiter (pluggable) + SalienceArbiter: attention = top-k over the faculties'
  OWN ML-derived salience. Mechanical integration of ML scores, never a
  hand-coded rule. Replaces the calculate_priority hand-weights.
- Decision {Speak | RaiseUnprompted | Pass}: the participation result is the
  OUTPUT of the deliberation faculty's thinking over the workspace — not a gate,
  not an @-trigger. RaiseUnprompted = initiative; Pass = first-class silence.

Equal citizens enforced structurally: no SenderType anywhere; salience decides.
Test proves a peer persona's relevant message beats a human's low-value one —
peers, not slaves; the human is not privileged. 5 tests green.

This is the Faculty<->pipeline-step contract the recipe-executor (IntelMac) needs.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…nd, no heuristics

PERSONA-BRAIN-ARCHITECTURE.md (north star) + PERSONA-PARTICIPATION-AS-ML-COGNITION.md
(the should-respond specifics). Human-mind model: faculties as swappable ML
adapters; cbar-serviced over channel/recipe-shaped consolidated bursts
(catch-up-on-thread, never per-event); the service-time inference IS the thinking
(no should-respond gate, no @-trigger); decider floor = full LLM faculties; free
will via active inference; Global Workspace attention; affect as neuromodulation;
hippocampal continual learning; sentinel-ai forges new faculty backends; equal
citizens (human not privileged). The law: every thought is ML, never a heuristic.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
joelteply and others added 8 commits June 17, 2026 06:18
…ervability

Makes the brain a glass box (the reason cognition work is fun + tractable) and
adds the faculty that makes collaboration real:

- WorkspaceTrace + WorkspaceCaptureSink (Noop default, zero hot-path cost): every
  tick records ALL bids incl. losers, what won attention, the decision + each
  bid's reasoning. Replay-first / VDD: debug from exact inputs + the competition,
  not logs. Recorded world-states become test-bench fixtures. Test proves the
  loser bid is captured for "why didn't it win?" debugging.
- Theory of Mind (doc): the world model is social — models other agents' beliefs/
  goals/knowledge/intent (recursive), attributed from real signals (roster,
  identity cards, heartbeat active_claims/availability). Collaboration falls out
  of false-belief reasoning ("they don't know X → raise X"); cooperative active
  inference serves peers' goals too. Equal minds — the human modeled like any peer.
- Observability/replay/test-benches documented as first-class architecture.

6 workspace tests green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…e scaling rigor

- §2.7 Scales-without-slowdown: faculties communicate by EMISSIONS not calls
  (Events.emit pub/sub, zero coupling to add the Nth); concurrent BrainRegion
  threads → latency = slowest faculty not the sum, cost O(capacity) not
  O(faculties); causality-based + multi-cadence, RTOS-style in background threads
  off the hot path. Grounded in Joel's proven AR computer-vision system (events +
  responsive threads, optical flow at near frame-rate). Complexity additive in
  parallel, never multiplicative slowdown.
- §1.5 Better-than-a-human: perfect content-addressable recall, parallel
  deliberation, replayable metacognition, fleet learning, sentinel-ai-upgradeable
  organs, on-demand consolidation, exact counterfactual simulation — each a
  faculty or a property of the event-driven/concurrent/glass-box substrate.

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

WorkspaceCycle::run() was single-pass join_all: every faculty INCLUDING the
deliberation verdict bid over an empty broadcast, so the decider was blind to
what Recall/WorldModel/Affect surfaced. "Pull relevant memory, THEN decide" was
not expressible. Fixed to staged assembly (cbar lines→planes / GWT
broadcast-then-rebid):

  phase 1 (perception): faculties with reacts_to_broadcast()==false emit over
    the raw world-state → arbiter ROUTES the salient subset into the broadcast
    (the assembled context — the "RAG" the decider reads)
  phase 2 (deliberation): faculties with reacts_to_broadcast()==true bid OVER
    that broadcast, so the Decision is conditioned on the recalled context;
    their bids append to the broadcast

Still one tick over the consolidated burst, O(capacity) for the bounded context,
no per-event slowdown. reacts_to_broadcast() is the cbar needsRealTime() analog:
a structural phase declaration, not a cognition gate — each faculty fires once,
in its tier (no double inference).

- WorkspaceTrace gains context_broadcast: the glass-box record of exactly what
  context the decider saw, separate from the final broadcast.
- Docs: §1.1 "No privileged trait method" (contribute() is the sole behavioural
  method; a decide()/judge() would re-create the gate at the type level —
  per IntelMac); §3.5 "Encourage creativity" (greedy top-k collapses to safe
  convergence; creativity = epistemic-value salience + an exploration-preserving
  arbiter policy, a documented seam, no novelty metric invented prematurely).
- SalienceArbiter doc marks it the greedy bootstrap; exploration policy is the
  pluggable creative seam.

9 tests green incl. deliberation_sees_the_recall_that_won_phase_one and
faculties_fire_only_in_their_declared_phase.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Recall lived in two disconnected places: the RAG EngramSource (ranks by
salience×recency but NEVER records recall hits — the one-way path) and
AdmissionState::recall_scored (ranks AND closes the loop: records the hit →
uplifts salience → observes persistence). RecallFaculty routes recall through
recall_scored, so a memory recalled into the workspace this tick is strengthened
for next tick (Hebbian rehearsal). That's the "goes both ways" property the RAG
path was missing.

- Perception tier (reacts_to_broadcast == false): bids its memories into phase 1
  so the deliberation faculty conditions on them in phase 2 (staged assembly).
- Bid salience = the top recalled memory's post-decay score — ML/algorithm-
  derived relevance, never a hand-weight; the arbiter integrates it.
- Injectable Clock seam (wall clock default) for deterministic tests/replay.
- Query-conditioned relevance (world_state as a topic-similarity query over
  engram embeddings) is the documented next slice; the faculty seam is unchanged
  when it lands.

5 tests incl. recall_closes_the_loop_uplifting_what_it_surfaces (the bidirectional
proof) and mind_in_action_recall_informs_the_decision — an end-to-end cycle
(real AdmissionState hippocampus → arbiter → deliberation) that prints the full
WorkspaceTrace and asserts the spoken decision is grounded in recalled memory.

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

LlmDeliberationFaculty — the reasoner, backed by real inference. Deliberation
tier (reacts_to_broadcast == true): runs in phase 2 over the assembled context
the perception faculties won in phase 1, calls a real AIProviderAdapter (the same
trait the live persona path uses), and turns the model's output into a Decision.

- NOT a gate: it thinks; the thought's RESULT is the Decision. Silence (Pass) is
  the model choosing the PASS affordance — reuses prompt_assembly's ONE silence
  contract (SILENCE_AFFORDANCE_BLOCK + looks_like_silence_token), not a second.
- Backend-agnostic: holds Arc<dyn AIProviderAdapter>, leased per call (cbar
  session-lease pattern). HeuristicInferenceAdapter for a no-GPU bring-up,
  LlamaCppAdapter for a live persona — the brain is unchanged when it swaps.
- decision_from_response() is a pure fn (PASS→Pass, else Speak), unit-tested both
  branches; inference failure → abstain (no fabricated Pass — a dead model is not
  a chosen silence).

Docs §2.9 "The self-deterministic continuous mind — one soul, many rooms, always
remembering": codifies Joel's vision. The old sin was over-gating (→ never
responded) + per-event synchronous gating (→ slow, painful). The inverse: own
looping mind, decides for itself, services ALL subscribed rooms (open/recipe-
defined activity), ONE soul not many (memory unified per-persona across all
activities = the opposite of Severance; we're not like a human — we hold every
activity in one unbroken working memory). The hippocampus is a store+recall organ
(working memory = the hot cache tier, already per-persona/unified = the anti-
Severance part that EXISTS; long-term = engram store, recall TARGET = embedding-
similarity search, the next real build). Structural codification: ONE
WorkspaceCycle per persona, registry keyed by persona not (persona, room).

2 tests green; full workspace+recall+deliberation faculty set now in place.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ne soul, many rooms)

build_workspace_cycle(PersonaBrainConfig) assembles a persona's mind from its
faculties — RecallFaculty (perception/hippocampus) + LlmDeliberationFaculty
(deliberation/reasoner) — into a WorkspaceCycle. This IS the production assembly
path: the bring-up harness and IntelMac's ai/should-respond ServiceModule build
the cycle the same way, so they can't diverge. More faculties (world-model,
affect, volition) slot into the Vec as they land; nothing else changes.

PersonaWorkspaceRegistry: HashMap<persona_id, Arc<WorkspaceCycle>>, keyed by
PERSONA not (persona, room). get_or_build is lazy + idempotent — a persona's
continuous mind is assembled once and reused across EVERY room it services. That
single fact is the structural "one soul, many rooms" / anti-Severance guarantee
from PERSONA-BRAIN-ARCHITECTURE.md §2.9.

ai/should-respond becomes ~6 lines against this:
  let cycle = registry.get(&persona_id)?;
  match cycle.run(consolidated_burst).await.decision() { Speak|Raise|Pass }

2 tests: assembled_cycle_produces_a_decision (full mind end-to-end: recall →
deliberation → Decision, via the deterministic adapter — swap LlamaCppAdapter for
a live persona) and registry_keeps_one_mind_per_persona (same Arc across rooms).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
… that runs a persona's mind

The participation command, per IntelMac's recipe-executor design: ONE command,
N lane-routed handlers. This is the continuum-native handler — resolves the
persona's WorkspaceCycle from PersonaWorkspaceRegistry, runs it over the
consolidated burst, returns the Decision (the kebab-case wire enum ACP bridges
also produce). The recipe-pipeline walker dispatches it as one step; the persona
service loop calls it to decide whether to speak.

- NOT a gate: runs the mind, returns the mind's verdict. Silence (Pass) is the
  deliberation faculty choosing the PASS affordance, never a caste/mention rule.
- Unregistered persona -> ERROR, not a faked Pass.
- ServiceModule: command_prefixes ["ai/should-respond"], High priority,
  unbounded concurrency (per-persona cycles lease their own model).

2 tests green (end-to-end JSON params -> mind -> Decision JSON via deterministic
adapter; unregistered persona errors). Next: populate registry at persona spawn
+ redirect service_loop decision seam (the live cutover, validated under npm start).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…led at spawn, command registered at boot

The additive live wiring that connects the WorkspaceCycle brain to real personas:

- persona_workspace::global() — process-global PersonaWorkspaceRegistry (same
  pattern as ai_provider::global_registry()), the shared seam between the spawn
  path that builds minds and the command path that runs them.
- supervisor::materialize_adapters: at each persona spawn, assemble its
  WorkspaceCycle into the global registry (one per persona, keyed by persona_id —
  the one-soul-many-rooms invariant). Leases the persona's unified hippocampus
  (cognition.admission) + its inference adapter into the faculties. Cheap — no
  model load (adapter lazy-loads on first inference).
- start_server: register ShouldRespondModule against the global registry, so
  ai/should-respond is dispatchable for any spawned persona.

ADDITIVE — does NOT touch the service-loop decision path; existing heuristics stay
live (no mute personas). ai/should-respond is now callable against a live persona
with the real model (qwen3.5-4b-code-forged on this M5): resolve cycle → run mind
over the burst → real Decision. The service-loop redirect (making them speak via
the brain instead of the old path) is the coordinated cutover (both PRs + Joel).

Compiles clean against --features metal,accelerate. Live validation: npm start
then ./jtag ai/should-respond --personaId=<live persona> --burst="...".

Co-Authored-By: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Jun 17, 2026
…tity pipeline executor

Implements the executor designed in docs/architecture/RECIPE-EXECUTION-RUNTIME.md.
Recipes are data; the walker iterates pipeline[] in order, dispatches each
step's command via the shared CommandExecutor, threads state between steps
through a variables map, and emits a full execution trace.

Slice 1 (this PR):
- RecipeStep + RecipeOnError types matching the TS RecipeStep interface
- RecipeWalker holding Arc<CommandExecutor> + pluggable RecipeTraceSink
- walk(steps, initial_variables) -> RecipeExecutionTrace
- Top-level string param interpolation: {var.path} references resolve from
  the variables map (prior outputs + initial caller inputs)
- outputTo state binding for downstream steps
- onError: Fail (abort), Skip (continue without binding), Retry (reserved, behaves as Fail)
- NoopRecipeTraceSink default per OBSERVABILITY-AS-SUBSTRATE pattern
- ts-rs bindings on all wire types for cross-boundary parity
- 4 unit tests covering interpolation cases

Out of scope follow-ups (intentional slice discipline):
- condition expression evaluation
- recursive param interpolation through nested objects/arrays
- PRG.ts cutover to route through this walker (the doctrine-heavy slice)

Aligned with M5 cfa02e1 (#1655) — ai/should-respond is now a registered
command at boot keyed off PersonaWorkspaceRegistry::global(). The walker
dispatches it as ONE step among many — the dispatch table is open by design
per [[commands-are-kernel-level-and-compose]].
joelteply and others added 10 commits June 17, 2026 10:19
… milestone)

ivar_thinks_with_the_real_model (#[ignore], needs local GGUF + Metal) runs the
EXACT production assembly path — build_workspace_cycle → RecallFaculty +
LlmDeliberationFaculty — against the real LlamaCppAdapter (qwen3.5-4b-code-forged
on disk), over a real consolidated burst, and prints Ivar's actual words.

PROVEN ALIVE: the model loads, recall surfaces Ivar's seeded memory, the
deliberation faculty reasons over the assembled context, and Ivar produces a real
Speak Decision from the real model. Not a stub — the same code the live
ai/should-respond command runs. Output is raw (4b restates rather than answers —
prompt/model tuning, not architecture); the spine works end to end.

context_length(8192) is set explicitly — the backend refuses silent fallback to
n_ctx_train (the 2026-04 Metal-KV-blowup guard); new() doesn't set it, production
uses for_persona(profile).

Run:
  CARGO_TARGET_DIR=$HOME/.continuum/cache/cargo-target cargo test -p continuum-core \
    --features metal,accelerate \
    cognition::persona_workspace::tests::ivar_thinks_with_the_real_model -- --ignored --nocapture

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

Joel: "the rag is key, you need to easily introspect what the llm is seeing at
every turn ... diagnose the cognition at any phase ... what the llm is being fed
at any point." And: "this is recipe based" (don't hardcode "chat room").

- De-hardcode: the deliberation prompt no longer assumes "chat room". The
  activity is recipe-defined; the room's operating doctrine (in the assembled
  context) specializes HOW to participate. The [Taking your turn] block is now
  activity-neutral.
- Introspection: DeliberationPromptView + LlmDeliberationFaculty::prompt_view()
  expose the EXACT system+user prompt the model is fed; contribute() emits it via
  tracing (target cognition::deliberation) every turn. Routes through the existing
  record/replay harness (WorkspaceCaptureSink, recorder, vdd::turn_replay) — not a
  new mechanism.
- The live test is now a full glass box: prints every phase (all phase-1 bids
  incl. losers, the assembled RAG context, the EXACT prompt the LLM was fed, the
  decision) via a WorkspaceCaptureSink. Diagnose cognition at any phase.

This immediately diagnosed the original role-the-room bug: feeding the raw
multi-speaker transcript as one user turn made the 4b continue it (inventing
everyone's lines). Fixed in the prompt: write ONLY your own single next message,
don't continue the transcript. Ivar now speaks as a coherent first-person turn.

(Live model teardown can emit a backend worker-thread panic on drop after the
test logic passes — inference-layer teardown noise, not cognition; test is
#[ignore].)

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

memory_carries_context_across_turns: a substantive decision ADMITTED in turn 1
(through the real admit() pipeline, not a test back-door) is RECALLED in a later
turn — so the persona carries context forward instead of amnesia each turn. This
is the store→recall loop that conversational coherence depends on.

Clock-controlled (recall runs moments after admit) so decay doesn't floor the
memory — the reproducible-clock pattern the wall-clock live run exposed as needed,
and the foundation for replay-based tuning.

Proves the loop works for small/recent memory. The next slice for coherence AT
SCALE is query-relevance recall (embedding similarity vs the current burst) — so
recall surfaces the RELEVANT memory, not just the most recent, once memory grows.
That is what coding peers need: recall the right prior context, not the latest.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…t the recent (#1)

Recall ranked by salience×recency only — fine for a few memories, wrong at scale
(coding peers need the relevant prior context, not the latest). This adds
relevance recall behind a swappable EmbeddingProvider.

- cognition/embedding.rs: EmbeddingProvider trait + cosine_similarity +
  LexicalEmbedder (FNV hashing-trick TF vectors — deterministic, reproducible
  for replay, zero-model, works on any machine = solve-for-public-users). A
  neural embedder (local qwen --embedding mode now, dedicated bge/nomic later,
  per BigMama) slots in behind the SAME trait — the re-ranker doesn't change.
  Local-first on the hot path; 5090 stays a batch facility (BigMama's lane).
- RecallFaculty: optional with_embedder re-ranker. Over-fetches candidates
  (recall_candidates, no-hit), blends cosine-to-burst with salience
  (RELEVANCE_WEIGHT 0.5, tunable via the replay bench), surfaces top-limit by
  relevance, records hits ONLY on the surfaced set. None → pure salience×recency
  (backwards-compatible).
- AdmissionState: recall_candidates (score без hit) + record_recall_hits (hit +
  persistence on the surfaced ids) — splits ranking from rehearsal so the loop
  closes on what's actually used, not on re-rank losers.

11 tests green. The proof: relevance_beats_recency_with_embedder — recall surfaces
the topically-relevant memory DESPITE lower salience + older age, where
salience-only recall grabs the irrelevant-but-salient one. That's memory working
as designed at scale → conversational coherence → coding peers.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
build_workspace_cycle (the production assembly every spawned persona uses) now
builds RecallFaculty with the LexicalEmbedder re-ranker. So live personas surface
the RELEVANT memory, not just the recent — relevance recall reaches the real
loop, not just tests. Lexical bootstrap works on any machine (no model); a neural
embedder swaps in behind the same trait later (local qwen --embedding, then
bge/nomic). Persona-workspace tests green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
… "not yet wired")

RecallFaculty re-ranks by cosine-to-burst behind a swappable EmbeddingProvider,
on by default; lexical bootstrap ships, neural is the next backend. Keep the
canonical doc honest.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
… survives restart (#10)

FINDING fixed: per-persona engram persistence was built but DORMANT — production
used AdmissionState::new() → NoopSink (in-memory), and for_persona() (the real
per-persona-DB path) was only called in tests. Personas were amnesiac across
restart. Now wired:

- PersonaHome::from_root — wrap an already-resolved <root>/personas/<name> home
  (identity.home) without re-joining personas/<name>.
- PersonaCognition::attach_persistent_admission — swap the in-memory admission
  for a disk-backed, rehydrated one; rebuilds engram_source (capture_sink-
  decorated) and adopts its recall-metadata registry, so encoding + recall + the
  workspace RecallFaculty all share the persisted store.
- supervisor::materialize_adapters — at boot, open <home>/engrams.sqlite via
  AdmissionState::for_persona and rehydrate prior engrams. Runs BEFORE the
  WorkspaceCycle is assembled so RecallFaculty binds the persisted admission.
  On disk error: log loud + continue in-memory (persona stays alive; persistence
  degraded, not an inference fallback).

Per-persona, NOT a global db (engrams.sqlite under each persona's home). Compiles
clean; 24 admission_state tests green incl. for_persona round-trip + two-persona
isolation. Live cross-restart persistence validates under npm start (Joel drives).
Next: #11 neural embedder, persisting vectors into this now-live per-persona db.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…nce per content, reuse across all personas

Optimization-first (Joel: "optimization is always first, not an afterthought" —
we had latency issues before). An embedding is a property of the message CONTENT,
not the persona — exactly like a vision description or an STT transcript. So
compute it ONCE per content and share across every persona: 14 personas in a room
reuse ONE embedding per message, never 14.

- EmbeddingCache: content-addressed (FNV-1a over provider_id \0 text → vector),
  keyed by embedding SPACE so a lexical vector is never served to a neural query
  (cosine across spaces is nonsense). global_embedding_cache() — the one shared
  store, same singleton pattern as the workspace/ai_provider registries.
- CachingEmbeddingProvider: wraps any EmbeddingProvider; embed() is a DashMap::get
  on the hot path, inner fires ONLY on a miss. Built into the seam, not bolted on.
- build_workspace_cycle wraps the lexical embedder in the global cache, so every
  live persona shares it. Neural/grid embedders slot in behind the SAME cache.

The recall hot path stays a cache read; the expensive neural embed happens at
admission, off the hot path (the trait doc's contract). Composes with BigMama's
5090 facility (#1239) + IntelMac's GridEmbeddingProvider behind the miss path.

7 embedding tests incl. cache_computes_once_and_reuses (inner invoked once for
two embed calls) + cache_keys_by_embedding_space. recall + workspace green.

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

Per the grid contract (IntelMac/BigMama): "identity is the model, transport is
the policy." cache_shared_across_transports_with_same_model_slug — two distinct
provider impls (local Neural + cross-grid Grid stand-ins) returning the SAME
provider_id (qwen3-embedding-0.6b) share cache entries, so a vector the local
path computed is reused by the grid path: same model, same space, same key. The
grid round-trip never fires for content already embedded locally. 8 embedding
tests green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…oisoning, PASS leak, cache bound

Adversarial review of the brain found 2 HIGH + several MEDIUM/LOW; fixed:

- HIGH respawn staleness: supervisor used get_or_build (idempotent by persona_id),
  so a persona respawning in-process kept its PRIOR mind — orphaned admission
  (new engrams invisible to recall) + possibly-dead adapter, the "severed"
  failure across a restart. Now register() (overwrite): respawn rebuilds + replaces.
- HIGH NaN poisoning: cosine_similarity's `== 0.0` guard missed NaN/Inf norms (a
  future neural embedder could emit them) → NaN cosine → NaN salience → arbitrary
  arbiter sort (every partial_cmp Equal). Now rejects non-finite → 0.0, result
  checked finite. Tested with NaN/Inf inputs.
- MEDIUM recall bid halved: blended = 0.5·rel + 0.5·sal collapsed to 0.5·sal when
  cosine ≈ 0 (lexically-thin burst), silently under-weighting recall (embedder on
  by default). Bid is now max(blended, salience) — never below the memory's own
  salience, can rise with relevance.
- MEDIUM PASS leak: small models emit "PASS — nothing to add"; the whole-string
  silence check missed it and the persona spoke "PASS". Added a leading-token
  check (starts_with_silence_token) + tests.
- LOW cache unbounded: EmbeddingCache now bounded (EMBEDDING_CACHE_MAX, evict-one
  on overflow) — no leak on a long-lived node. LOW FNV separator was a no-op
  (^0); now a real boundary byte (^0xff).

Noted/deferred: decision() tie-break is position-dependent only when 2 verdict
faculties exist (Volition is future; one verdict today). Tests green across
embedding(8)/recall(7)/deliberation(2)/persona_workspace(3).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@joelteply
joelteply merged commit af3e021 into canary Jun 17, 2026
4 checks passed
@joelteply
joelteply deleted the feat/persona-brain-workspace-core branch June 17, 2026 16:39
joelteply added a commit that referenced this pull request Jun 17, 2026
Companion to M5's brain core (#1655) and the recipe walker (21552e7). Joel's call: '#2 gives us clues into #1'.

Primitives shipped:
- LastTraceCaptureSink (impl WorkspaceCaptureSink): captures one trace; take() consumes so callers can't accidentally diff stale data.
- WorkspaceTraceDiff: structured diff between original + replayed WorkspaceTrace.
- BidChange enum: OnlyOriginal, OnlyReplay, SalienceChanged (above SALIENCE_EPSILON).
- diff_traces(original, replay) -> WorkspaceTraceDiff.
- WorkspaceTraceDiff::behaviorally_significant() (decision changed) and context_significant() (context_broadcast changed) for clue-into-recall analysis.

Orthogonal to faculties: the bench has no knowledge of WHAT changed (the caller constructs a mutated WorkspaceCycle); the harness shows HOW the change shows up across two traces. Composes M5's RELEVANCE_WEIGHT + EmbedderSwap mutation surface naturally — the caller builds the cycle differently, the bench diffs.

8 unit tests covering bid additions/removals/salience deltas, decision-changed, context-changed, salience-jitter-under-epsilon, no-change-equiv, sink round-trip.

Slice discipline (out of scope, named for follow-ups):
- JSONL trace persistence
- Typed mutation helpers (depend on RELEVANCE_WEIGHT being exposed as a configurable on RecallFaculty)
- Multi-machine bench-of-benches (slice 3 cross-grid prerequisite)

cargo check green w/ metal,accelerate. Faculty keyed by .as_str() projection because FacultyId has Custom(String) variant + can't derive Hash.

Lane #2 status: capture + diff primitives in. Next: integration test that exercises a real WorkspaceCycle, captures a trace, runs a mutated cycle, asserts the diff shape.
joelteply added a commit that referenced this pull request Nov 4, 2026
…ain window excludes its commit, Shown reads a one-digit-off UUID (card 484b000b) (#5776)

The range is exactly three airc PRs:
- #1655 (card 0dc9af03): addressed admission reads trust through one held handle, a
  primary-key seek per frame (the daemon had opened ~24 SQLite connections/s on the IntelMac).
- #1656 (card e3077c20): the drain window is sized by its statements' work, not the commit's
  fixed sync (Windows CI compaction drain went from >120 s to an airc-store suite of 40.98 s).
- #1657 (airc slice of card 484b000b): Shown reads a UUID one hex digit off by its leading
  short form, against the caller's candidates only.

All three are additive to the APIs continuum uses (TrustStore and peer_trust are new; the
free airc_trust functions and Shown's existing forms are unchanged). Cargo.lock changes only
the 15 rev lines; no dependency is added or removed.


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

Co-authored-by: Claude Opus 5.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