Skip to content

feat(persona): RoomDoctrineSource — ground cognition in the room's operating doctrine - #1651

Merged
joelteply merged 2 commits into
canaryfrom
feat/persona-room-doctrine-grounding
Jun 17, 2026
Merged

joelteply merged 2 commits into
canaryfrom
feat/persona-room-doctrine-grounding

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

What

Slice 2 of the airc-native rebuild (docs/grid/AIRC-NATIVE-IDENTITY-ROOMS-SECURITY.md §5). Slice 1 (#1650) grounded a persona in who is present; this grounds it in what kind of room it is, so it calibrates participation to the activity.

Why

Rooms are the universal activity primitive (chat, dev-coordination, game, academy, help, settings). A coordination room is not a free-for-all chat. The "Ivar" persona's other failure (besides confabulation, fixed in #1650) was over-participating in a dev-coordination room because it had no signal about the room's nature.

How

  • RoomDoctrineSource — a RagSource reading airc Airc::room_doctrine, the room's published operating contract (markdown the airc-core docs say agents should "inject as a system message into agent context"). Persona-scoped, fails-safe-empty, truncates an oversized doctrine rather than dropping it, test stub. Mirrors RoomRosterSource.
  • AircDoctrineReader — 3rd supertrait of AircCitizen (alongside AircTranscriptReader + AircRosterReader); impl'd for PersonaAircRuntime, AircHandleAdapter, StubAircCitizen, airc_lib::Airc, so runtime upcasts.
  • compose_for_turn binds it; rides capture_sink (recorded + replayable); small floorless budget (max 1024) so it never starves airc's recent_history (the lesson from slice 1's review).
  • service_loop projects the delivery into a [Room operating doctrine] system-prompt block in prompt_assembly. None doctrine → no block (backwards-compatible).

Validation

Out of scope (follow-up)

🤖 Generated with Claude Code

…erating doctrine

Slice 2 of the airc-native rebuild. Slice 1 grounded a persona in WHO is
present; this grounds it in WHAT KIND of room it is, so it calibrates
participation to the activity (sparse in a coordination room, conversational
in chat — Ivar's other failure: over-participating in a dev-coordination room).

- RoomDoctrineSource: a RagSource reading airc `Airc::room_doctrine` (the
  room's published operating contract — markdown airc-core says agents should
  inject as a system message). Persona-scoped, fails-safe-empty, truncates an
  oversized doctrine rather than dropping it, with a test stub. Mirrors
  RoomRosterSource.
- AircDoctrineReader: 3rd supertrait of AircCitizen (alongside
  AircTranscriptReader + AircRosterReader); impl'd for PersonaAircRuntime,
  AircHandleAdapter, StubAircCitizen, airc_lib::Airc — the runtime upcasts.
- compose_for_turn binds it; rides capture_sink (recorded + replayable);
  small floorless budget (max 1024) so it never starves airc's recent_history.
- service_loop projects the delivery into a [Room operating doctrine]
  system-prompt block in prompt_assembly. None doctrine → no block.

Tests: 5 source + 1 rendering.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ent-free block

Adversarial review of PR #1651 found fit_body overspent at tiny budgets:
the truncation marker is 24 bytes / 22 chars, so for budget<=6 the char
budget floored to 0 and the result was the marker alone (~6 tokens > budget),
producing a [Room operating doctrine] block with zero actual doctrine —
reachable in production at context windows where the grow pass hands the
doctrine source 1-5 tokens. The old test only checked budget=20 and missed it.

Fix: compute max chars whose estimate stays within budget (4*budget - 4),
subtract the marker's CHAR count (not byte len), and if there's no room for
the marker plus real content, return None (no block) rather than a
token-wasting marker-only one. Test now sweeps budgets {1,2,3,5,6,7,8,20,
100,500} asserting never-overspend AND that any delivered block carries real
content; plus a tiny-budget→no-block test.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@joelteply
joelteply merged commit accff7e into canary Jun 17, 2026
4 checks passed
@joelteply
joelteply deleted the feat/persona-room-doctrine-grounding branch June 17, 2026 02:24
joelteply added a commit that referenced this pull request Jun 17, 2026
…ng in the Workspace brain (#1660)

The gating cutover (#1659) routes the participation Decision through the
WorkspaceCycle. But the cycle only had RecallFaculty + LlmDeliberationFaculty —
so the roster (#1650) and doctrine (#1651) grounding, which are RagSources not
Faculties, silently fell out of the live decision path the moment the switch
flipped. The persona would forget who is present and what the room is for.

This adds ONE generic bridge — RagSourceFaculty — that lifts any RagSource into
a perception-tier Faculty (no second source of truth; reuses the reviewed
sources verbatim). It is the concrete first step of "broadcast == RAG context"
(task #8). Per the grid elegance thread (M5/IntelMac/BigMama, 2026-06-17): the
bridge is migration scaffolding, the end-state is full convergence to native
faculties, and RagSource deletion is gated on observability parity.

Load-bearing guard (BigMama): a flat lift is a latent bug — a high-cosine memory
could evict the doctrine and the persona forgets the room's rules mid-turn. So
the bridge carries a SaliencePolicy: StandingFraming (roster/doctrine — high
floor the top-k arbiter won't truncate) vs Retrieved (engram/conversation —
competes on relevance). The classification lives at the assembly layer
(build_workspace_cycle), never inside RagSource — the source stays salience-free.

Wiring: supervisor passes roster + doctrine as StandingFraming grounding into
PersonaBrainConfig; the same Arc still feeds the legacy compose path during the
transition (one source of truth, two consumers — not a parallel allocator).

Tests: bridge lift, abstain-on-empty, persona-scope passthrough, end-to-end
grounding reaching the decider, salience-policy ordering, and the canary —
standing framing keeps non-zero presence in context_broadcast even when a
retrieved bid out-saliences it (the "forgot the room rules" regression net).

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