Skip to content

feat(cognition): TS bridge for admit-inbox-message + recall-engrams (#1195 PR-1) - #1202

Merged
joelteply merged 1 commit into
canaryfrom
feat/engram-into-chat-recipes-1195
May 14, 2026
Merged

joelteply merged 1 commit into
canaryfrom
feat/engram-into-chat-recipes-1195

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

The Rust IPC handlers cognition/admit-inbox-message (#1121 PR-4) and cognition/recall-engrams (#1121 PR-5) shipped weeks ago but have no TS layer. Recipe pipelines invoke commands via Commands.execute, so without TS scaffolding the recipe JSONs literally cannot reach the admission gate or the engram recall surface. Substrate built and unused.

This PR adds the missing thin bridge per CLAUDE.md "Rust-Backed Commands (IPC Mixin Pattern)" + Joel's "if not UI/UX it is rust" rule.

Changes

  1. RustCoreIPC cognition mixin gains two methods:
    • cognitionAdmitInboxMessage(personaId, message) returns { decision, engram_count, trace_seam_count } typed via the ts-rs generated AdmissionDecision from shared/generated/persona/.
    • cognitionRecallEngrams({ personaId, kind?, limit?, id?, keyword?, origin? }) returns { engrams: Engram[], count } typed via the ts-rs generated Engram.
  2. Two TS server commands at commands/cognition/admit-inbox-message/ and commands/cognition/recall-engrams/, generated via npx tsx generator/cli.ts command <spec>. Each execute() is pure pass-through: validate inbound params (loud-throw on missing required fields) → call mixin → wrap result. Zero business logic in TS.
  3. Spec JSONs under generator/specs/ so future regeneration is one command away.

Out of scope

Wiring these commands into the 11 chat-class recipe JSONs (10 Shape B + 1 Shape C) is PR-2 — see RECIPE-AUDIT-2026-05-14 Gap 1 for the recipe-side plan. This PR exists to unblock that one.

Sidecar issues filed

Test plan

  • npm run build:ts passes clean
  • ESLint count matches baseline (5462)
  • Pre-push hook ran without --no-verify
  • Live smoke (deferred to PR-2 when recipes invoke the commands): send a memorable line in general room, recall it via ./jtag cognition/recall-engrams

Refs #1195. Refs #1121.

🤖 Generated with Claude Code

…1195 PR-1)

The Rust IPC handlers `cognition/admit-inbox-message` (#1121 PR-4) and
`cognition/recall-engrams` (#1121 PR-5) shipped weeks ago but have NO
TS layer. Recipe pipelines invoke commands via `Commands.execute`, so
without TS scaffolding the recipe JSONs literally cannot reach the
admission gate or the engram recall surface — the substrate is built
and unused.

This PR adds the missing thin bridge per CLAUDE.md "Rust-Backed
Commands (IPC Mixin Pattern)" + Joel's "if not UI/UX it is rust" rule:

1. RustCoreIPC cognition mixin gains two methods:
   - `cognitionAdmitInboxMessage(personaId, message)` →
     { decision: AdmissionDecision, engram_count, trace_seam_count }
   - `cognitionRecallEngrams({ personaId, kind?, limit?, id?, keyword?,
     origin? })` → { engrams: Engram[], count }
   Both use the ts-rs generated types verbatim from
   `shared/generated/persona/`. No parallel reimplementation.

2. Two TS server commands generated via `npx tsx generator/cli.ts
   command <spec>`. Each `execute()` body is pure pass-through:
   - validate inbound params (loud-throw on missing required fields)
   - call mixin method
   - wrap mixin result into the Result type

   Zero business logic in TS. The whole "admit / recall" decision
   tree lives in `workers/continuum-core/src/modules/cognition.rs`.

3. Spec JSONs checked in under `generator/specs/` so future
   regeneration is one command away. Spec is the source of truth for
   the scaffolding.

Out of scope (PR-2 follows):
- Wiring these commands into the 11 chat-class recipe JSONs (10
  Shape B + 1 Shape C) per RECIPE-AUDIT-2026-05-14 Gap 1.

Sidecar code-smells filed while shipping this:
- #1196 SystemOrchestrator stub-only class (every method throws)
- #1198 RustBackedCommand<P,R> base class — visually-identical
  envelope every Rust-backed TS command repeats today

Validation: `npm run build:ts` clean + ESLint count matches baseline
(5462). Hooks ran without --no-verify.

Refs #1195. Refs #1121.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@joelteply
joelteply merged commit 47794c5 into canary May 14, 2026
4 checks passed
@joelteply
joelteply deleted the feat/engram-into-chat-recipes-1195 branch May 14, 2026 18:29
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