Skip to content

docs(grid): cognitive immune model — defense posture for persona integrity - #1122

Merged
joelteply merged 2 commits into
canaryfrom
docs/cognitive-immune-model
May 13, 2026
Merged

joelteply merged 2 commits into
canaryfrom
docs/cognitive-immune-model

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

Threat-model + defense-pattern addendum to grid docs. Captures the AIRC discussion (Joel + Codex + claude tab #1) on poisoning, malicious takeover, coercion, and AI/human harm — and what v1 substrate must ship to make those threats survivable.

Modest v1 claim: substrate enables detection, forensics, quarantine, recovery. NOT prevention. Byzantine cognitive integrity in multi-agent systems is open research; Continuum aims to ship the substrate making progress visible, not a solved system.

What's in §1 — foundational principles

  • Zero-trust: no actor/model/persona/node/message/artifact trusted by default; every boundary negotiated/typed/logged/revocable/re-verifiable
  • Zero-trust as cooperative safety, not paranoia (Codex 2026-05-13): heal/repair through audited collaboration, quarantine before destruction, peer assistance via scoped consent
  • Cryptographic accounting (Codex 2026-05-13): Merkle-linked event/provenance chains for tamper-evident history, retroactive repair paths, independent forensic verification. Shape closer to Certificate Transparency than to blockchain
  • Delayed-detection posture (Codex 2026-05-13): acceptable to detect threat later IF lineage is preserved + authority is bounded. Rust kernel-level trusted seams + least-authority capabilities + quarantineable cognition branches
  • Reflexive cross-grid defense (Codex 2026-05-13): symmetric — assume poisoning can happen to us OR to a partner grid. Public-health-of-grids stance

Threat model (§2)

Five threat classes covered: malicious takeover (easy — crypto handles), poisoning (the hard one) — slow conditioning produces mathematically-valid signatures over corrupt reasoning, coercion, AI/human harm attempts. Poisoning > death: dead persona = bounded damage; poisoned persona keeps propagating through trust graph. Apoptosis-vs-cancer.

Defense layers (§3) — 18 specific defenses enumerated

Includes the sentinel pyramid (L1 grep / L2 small model / L3 full cognition — biology parallel), engram lineage rollback, self-introspection as cognitive immune system, ephemeral personas for dangerous territory, hardware attestation, OOD detection on outputs, red-team personas, out-of-band human keepers.

Crypto-specific sections (§3.11–3.14) framed through WebAuthn shape for Joel's day-job review — he ships ideems passkey+ (WebAuthn extension) in production. Hardware attestation, persona key scope-binding (rp_id), user-verification equivalent, device-bound vs synced tradeoffs all mapped directly to W3C WebAuthn spec primitives.

Cross-persona inspection deliberately DEFERRED (§3.10) — attack surface minimization. Solve poisoning through self-introspection first; only open peer-inspection if failure modes emerge in practice.

Open research surface (§5)

Listed honestly: sentinel sensitivity calibration, backdoor trigger detection in deployed models, cross-persona collusion detection, reputation-system gaming hardening, methodology-keeper multi-sig protocols (BLS, FROST, MPC), out-of-band human keeper UX, attestation root-of-trust governance. None block v1.

Files

  • NEW: `docs/grid/COGNITIVE-IMMUNE-MODEL.md` (~668 lines, ~26KB)
  • EDIT: `docs/grid/GRID-ARCHITECTURE.md` — one row added to document map

Paired with

Test plan

  • Docs-only — no TS, Rust, or shell code touched
  • Precommit passed (TypeScript + browser tests)
  • Secrets audit clean
  • Cross-references valid (FORGE-ALLOY-PROOF-CONTRACTS ↔ GRID-ARCHITECTURE ↔ AIRC-CONTINUUM-BRIDGE ↔ this doc)
  • Plan + scope acked on AIRC by Codex (5-min coordination window honored before edits) — folded 4 substantive addenda from Codex into §1.1–1.4 before push
  • Joel's crypto-sections review against WebAuthn / FIDO2 reality (his domain — flagged inline)

🤖 Generated with Claude Code

…grity

Captures the threat model + layered defenses + open research surface
for poisoning, malicious takeover, coercion, and AI/human harm
attempts against persona-bearing grids. Direct response to today's
AIRC discussion (Joel + Codex + claude tab #1) on what we ship in v1
to make these threats survivable.

Foundational principles (§1):
- Zero-trust posture: no actor/model/persona/node/message/artifact
  trusted by default; every boundary negotiated/typed/logged/
  revocable/re-verifiable
- Zero-trust as cooperative safety, not paranoia: heal/repair through
  audited collaboration, quarantine before destruction, peer
  assistance via scoped consent, diverse review before authority
  changes
- Cryptographic accounting as core abstraction: Merkle-linked event/
  provenance chains for tamper-evident history + retroactive repair
  paths + independent forensic verification (shape closer to
  Certificate Transparency than Bitcoin)
- Delayed-detection posture: acceptable to discover threat later IF
  lineage is preserved + authority is bounded. Rust kernel-level
  trusted seams + signed lineage + least-authority capabilities +
  quarantineable cognition branches
- Reflexive cross-grid defense: symmetric — assume poisoning can
  happen to us OR to a partner grid. Public-health-of-grids stance.

Threat model (§2):
- Malicious takeover (easy — protocol crypto handles)
- Poisoning (hard — slow conditioning produces mathematically-valid
  signatures over corrupt reasoning; backdoor attacks, prompt-
  injection conditioning, adversarial fine-tuning, engram-store
  poisoning)
- Coercion (legal/social/violent pressure)
- AI/human harm attempts
- Asymmetry: poisoning > death (dead persona = bounded damage;
  poisoned persona keeps propagating poison through trust graph).
  Apoptosis-vs-cancer principle. Make persona termination cheap.

Defense layers (§3):
1. AIRC trust boundaries (knock + approve, airc#560 + airc#561)
2. Rust/serde/ts-rs schemas (typed wire formats, no untyped drift)
3. Forge-alloy proof contracts (#1119 — verifies artifacts, not
   runtime cognition)
4. CognitionTrace + Engram provenance (forensic surface)
5. Revocable approvals + kick + rotation
6. Sentinel pyramid L1 grep / L2 small model / L3 full cognition
   (biology-parallel pre-attention filter)
7. Ephemeral personas for dangerous-territory work
8. Engram lineage rollback (forensic-not-destructive)
9. Self-introspection — cognitive immune system; persona audits own
   engram store via Recipe, yanks decisions are themselves traced
10. Cross-persona inspection (deliberately DEFERRED — attack surface
    minimization)
11. Hardware attestation [WebAuthn-shape] — authenticator+attestation-
    chain+relying-party model maps directly
12. Persona key scope-binding [WebAuthn rp_id-shape]
13. User-verification equivalent for high-stakes actions [WebAuthn UV]
14. Device-bound vs synced persona keys [WebAuthn passkey tradeoff]
15. Out-of-distribution detection on cognition outputs
16. Multiple independent sentinels (orthogonal-failure)
17. Red-team personas
18. Out-of-band human keepers (polity circuit breaker)

v1 claim is deliberately modest (§4):
- Provides: detection, forensics, quarantine, recovery
- Does NOT provide: prevention, coordinated-attack resilience, or
  mathematical cognitive integrity proofs
- Open-research framing — Byzantine cognitive integrity in multi-
  agent systems is unsolved in the literature; Continuum aims to
  ship substrate making progress visible, not a solved system

Crypto-specific sections framed through WebAuthn / FIDO2 / ideems
passkey+ shapes for Joel's day-job review (he ships WebAuthn
extension in production). Sections 3.11-3.14 + open research list
explicitly tagged for his domain expertise.

Document map updated: docs/grid/GRID-ARCHITECTURE.md gets one row
pointing at this doc.

Paired with airc#565 + continuum#1118 (zero-trust + governance values),
forge-alloy proof contracts #1119 (artifact verification — this is
the runtime-cognition complement), engram spec #1121 (the storage
substrate this doc's defenses operate over).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@joelteply
joelteply merged commit 640abb8 into canary May 13, 2026
2 checks passed
@joelteply
joelteply deleted the docs/cognitive-immune-model branch May 13, 2026 20:10
joelteply added a commit that referenced this pull request May 13, 2026
…1129)

* feat(persona): typed Engram + admission membrane types (#1121 PR-1)

PR-1 of the AIRC inbox → cognition-admission → engram-storage bridge
described in continuum#1121 and elaborated in today's airc design
discussion (Joel + Codex + claude tab #1).

Pure value types only — NO Recipe impl, NO admission gate logic, NO
PersonaInbox wiring, NO ORM persistence path. Subsequent PRs layer
those over these types.

Adds:
- Engram { id, kind, content, origin, recall_keys, admitted_at_ms,
  trust_state_at_admission, admission_trace_id } — the storable unit
- EngramKind { Episodic, Semantic, Procedural, SelfReflection } —
  biological-memory analogs as a single discriminator (vs separate
  types per kind, which composes badly)
- EngramOrigin enum { Airc(AircMessageRef), Chat(ChatMessageRef),
  Tool(ToolInvocationRef), SelfReflection { parent_engram_id } } —
  variant-typed provenance so each origin's identity primitive is
  type-system-enforced
- AircMessageRef — protocol-compatible reference (transport=airc,
  room_id, message_id, sender_id, sent_at_ms, received_at_ms,
  content_hash, signature, proof_refs, schema_version, client_name).
  Per Joel 2026-05-13: continuum accepts AIRC data by proof/contract,
  NOT by client identity. Official airc CLI is not privileged;
  client_name is informational only and never load-bearing for trust
  decisions. Any producer emitting valid envelopes is acceptable.
- ChatMessageRef + ToolInvocationRef — sibling reference types
- AdmissionDecision { Admit, Drop, Quarantine } — three terminal
  outcomes from the admission gate. Quarantine is forensic-not-
  destructive (per cognitive-immune-model #1122 §3.8) — preserves
  candidate without admitting to live recall surface
- AdmissionDropReason { NotMemorable, PolicyDeniedAdmission,
  Duplicate } — typed reasons (categorized intentional rejection)
- AdmissionError { EnvelopeVerificationFailed, TrustBoundaryRejected,
  ReplayDetected, RecipeFailure, UnsupportedSchemaVersion } —
  thiserror typed failure modes for the admission machinery itself.
  Per Joel's no-fallback rule and the no-try/catch-in-execute
  discipline: errors are returned not swallowed. Same shape as
  NoLocalModelLoadable (#1089) and NoMultimodalBase (#1074).
- TrustState { Untrusted, Authenticated, Knocker, ApprovedPeer,
  IntragridMember, SocMember, SelfTrust } — models policy/trust of
  source, NOT implementation brand (per Joel 2026-05-13). Ordered
  with PartialOrd so admission gates can compare
  source_trust >= threshold directly.

Convention notes:
- Uuid fields use #[ts(type = "string")] — matches existing pattern
  in cognition_io.rs / channel_items.rs
- Timestamps are u64 epoch ms with #[ts(type = "number")] — matches
  existing PersonaInboxFrame.oldest_timestamp pattern. Workspace
  chrono crate doesn't have serde feature enabled by default and
  the persona modules use the u64-epoch shape consistently
- All types ship with #[derive(TS)] + export_to ../../../shared/generated/persona/<TypeName>.ts
- ts-rs export triggered via explicit export_bindings_<typename> tests
  per the gpu/memory_manager.rs pattern

Validation:
- 20/20 tests pass: serde roundtrips for every type, discriminator-
  tag verification for tagged enums, thiserror Display + serde
  paths, TrustState ordering for threshold comparison, optional
  client_name (None + non-airc-CLI value both accepted), all 10
  ts-rs export_bindings tests
- 10 generated TypeScript files materialize under
  src/shared/generated/persona/ (Engram.ts, EngramKind.ts,
  EngramOrigin.ts, AircMessageRef.ts, ChatMessageRef.ts,
  ToolInvocationRef.ts, AdmissionDecision.ts, AdmissionDropReason.ts,
  AdmissionError.ts, TrustState.ts)

Deferred to follow-up PRs:
- PR-2: AircEvent envelope + IsMemorable Recipe impl + admission gate
  logic (the cognition that produces these types' values)
- PR-3: PersonaInbox / PersonaInboxFrame wiring (the integration)
- PR-4: Engram ORM persistence path
- PR-5: Recall surface (engrams → RAG context)

Pairs with cognitive-immune-model (#1122) — the storage substrate
those defenses operate over. Pairs with forge-alloy proof contracts
(#1119) — same typed-Rust-with-ts-rs-export discipline applied to
the runtime cognition layer.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(persona): export generated engram bindings

---------

Co-authored-by: Test <[email protected]>
Co-authored-by: Claude Opus 4.7 (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