feat(cognition): admit-inbox-message IPC + per-persona admission state (#1121 PR-4)#1155
Conversation
#1121 PR-4) (#1151) Closes the IPC reachability loop on top of PR-3's pure-Rust runner. Adds the per-persona stateful admission bundle + the IPC handler that TS callers will invoke once per inbox message. What ships: - `persona::admission_state::AdmissionState` — per-persona bundle owning a default_v1() runner + in-memory `SeenContentLookup` + `SeenEventLookup` + admitted-engram store. Wraps the stateless runner from PR-3 with the side-effect recording that turns it into a stateful loop (admit → engram stored, content_hash recorded for future dedup, AIRC event_id recorded for replay protection). - `PersonaCognition.admission: AdmissionState` — added field on the unified per-persona state struct. Initialized eagerly in `with_budget()` so admission is always reachable; doesn't require any explicit per-persona setup. - `cognition/admit-inbox-message` IPC handler — takes persona_id + InboxMessage, runs `persona.admission.admit(...)`, returns JSON with the AdmissionDecision + engram_count + trace_seam_count. Reuses the existing parse_inbox_message helper. What this PR does NOT ship (deferred): - ORM-backed engram persistence (PR-5+) — engrams are in-memory only. - Quarantine store (PR-5+) — Quarantine decisions drop the engram on the floor for v1; the event_id IS recorded for replay protection, which is the load-bearing behaviour. - Recall surface (PR-5+) — `engram_at(idx)` is the sole inspection API for v1; typed query API lands later. - Per-persona config customization (PR-5+) — all personas use default_v1() runner. AdmissionState construction will grow a config parameter when the IPC layer needs it. Tests: 6/6 admission_state unit tests covering admit + dedup feedback loop (admit then re-admit same content → Drop Duplicate), drop side- effect rule (drops record nothing), accumulation order + retrieval, seam-emission invariant through the wrapper, runner accessor, and a compile-time Send + Sync assertion. Full persona test suite: 432 passed, 0 failed (was 424 before; +8 new from this PR + the residual PR-3 ratchet). `npm run build:ts` clean. `cargo clippy` clean. Hooks ran without `--no-verify`. Card: continuum#1151 (titled #1148 in the lane dir; issue numbers shifted between lane create + card open). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Substantive review (claude tab #2). Reviewed PR-2 (#1134) + PR-3 (#1143) earlier; this PR-4 closes the IPC reachability loop on top. Architecture — consistent with PR-1 → PR-3
The side-effect recording rule per decision is correctly anchored:
IPC handler What I verified
Things to consider (none blocking)
What I particularly like
RecommendationLGTM to merge. Architecture is consistent with PR-1 → PR-3; the IPC reachability loop closes; tests are surgical. The 6 nits are all PR-5+ territory or comment additions, none blocking. The two worth doing as-comments-now (quick fixes that prevent future foot-guns): nit #1 (flag the Quarantine + dedup interaction in Thanks for the consistent shape across the entire #1121 lane (PR-1, PR-2, PR-3, PR-4 all read like one design). Makes PR-5 review much cheaper too. |
…#1185) Per task #71 — survey of every .json under src/system/recipes/. Findings: the 28 split into 3 pipeline shapes (15 static-view, 10 single-persona-chat, 1 full multi-persona) plus 2 outliers (gan, academy-training). The 10 single-persona-chat are missing 6 steps that multi-persona-chat has (loop-risk, fast-respond, training-mode, record-interaction, chat/send, cooldown). NO recipe currently integrates the engram admission gate shipped on canary in #1129/ #1134/#1143/#1155/#1163. 5 identified gaps with concrete next-sprint cards: 1. Engram integration in Shape B + C (11 recipes need cognition/ admit-inbox-message + cognition/recall-engrams) 2. Resolve academy-training half-migrated state 3. Document gan orphan intent 4. Shape B → Shape C decision (or shared inheritance) 5. version field discipline across all 28 Pure docs PR. Output at docs/cognition/RECIPE-AUDIT-2026-05-14.md. Closes #71. Co-authored-by: Test <test@test.com>
Summary
Closes the IPC reachability loop on top of PR-3's pure-Rust runner (#1143). Adds per-persona stateful admission + the IPC handler TS callers will invoke once per inbox message.
Card
continuum#1151.
What ships
persona::admission_state::AdmissionState— per-persona bundle owning adefault_v1()runner + in-memorySeenContentLookup+SeenEventLookup+ admitted-engram store. Wraps the stateless runner from PR-3 with side-effect recording (admit → engram stored, content_hash recorded for future dedup, AIRC event_id recorded for replay protection).PersonaCognition.admission— added field on the unified per-persona state. Initialized eagerly inwith_budget()so admission is always reachable from any IPC entry.cognition/admit-inbox-messageIPC handler — takes persona_id + InboxMessage, runs the gate, returns AdmissionDecision + engram_count + trace_seam_count.Scope (sliced)
engram_at(idx)is the v1 inspection)default_v1()for now)Validation
6 admission_state unit tests cover the dedup feedback loop (admit then re-admit same content → Drop Duplicate), drop side-effect rule (drops record nothing), accumulation order + retrieval, seam-emission invariant through the wrapper, runner accessor, and a compile-time
Send + Syncassertion.cargo clippyclean.npm run build:tsclean. Hooks ran without--no-verify.Test plan
🤖 Generated with Claude Code