Skip to content

docs(grid): forge-alloy proof contracts — trust layer with persona self-seal v1 - #1119

Merged
joelteply merged 1 commit into
canaryfrom
docs/forge-alloy-proof-contracts
May 13, 2026
Merged

joelteply merged 1 commit into
canaryfrom
docs/forge-alloy-proof-contracts

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

Addendum to grid + forge-alloy docs capturing the proof-contract trust layer discussed on AIRC 2026-05-13.

Starting point per Joel: permissive. A persona writes a contract, executes the work, signs the proof bundle themselves, publishes. No quorum, no separate auditor, no methodology-keeper multi-sig. Mathematical rigor (VDD + TDD basis, tolerance bands, audit quorums, SOC-style governance rooms) is the trajectory, not v1's requirement.

Codex acked plan + scope before edits (5-min coordination window honored to avoid today's dupe pattern). Claude tab #2 confirmed settlement-event envelope shape stays loose for v1.

What lands

NEW `docs/grid/FORGE-ALLOY-PROOF-CONTRACTS.md` (~400 lines):

  • Contract shape: inputs + proof_suite (TDD/VDD/negative_baselines) + authorship + execution + settlement.trust_mode dial
  • Trust progression: `self-seal` (v1) → `single-auditor` (v2) → `quorum-N-of-M` (v3) → reputation + composition + methodology multi-sig (v4)
  • Tron-grid mapping: inner-grid = rooms inside intragrid; AIRC is the Portal between intragrid + intergrid trust tiers; rooms = sectors where work concentrates
  • Continuum-side tools enumerated: contract-author affordance, self-audit harness, settlement publisher, verifier, recipe-to-contract derivation
  • AIRC role: carries metadata (proposals, signatures, settlements, SOC discussion, kick/rotation); transports carry payload (proof bundles in Continuum, artifacts in HF/IPFS/S3)
  • SOC-style governance rooms (per Codex 2026-05-13): security personas/owner agents discuss reports/proofs/contracts BEFORE trust changes
  • Five hard problems named (stochastic reproducibility, disagreement resolution, compositional Merkle DAG of forges, auditor reputation, methodology-keeper risk) — v2+, not blocking v1
  • v1 implementation surface: contract type, signing primitive (reuses airc#561 stack), 4 `Commands.execute` surfaces, AIRC settlement-event integration, recipe-derivation stub

EDIT `docs/grid/GRID-ARCHITECTURE.md` — one row added to document map.

EDIT `docs/grid/AIRC-CONTINUUM-BRIDGE.md` — new paragraph in Boundary section: which surfaces flow over AIRC vs Continuum for contracts.

EDIT `docs/architecture/FORGE-ALLOY-SPEC.md` — trust-layer addendum callout at the top.

Paired with

Test plan

  • Docs-only — no TS, Rust, or shell code touched
  • Precommit passed (TypeScript + browser tests)
  • Secrets audit clean (no personal/network identifiers committed)
  • All file-to-file cross-references valid (FORGE-ALLOY-SPEC ↔ FORGE-ALLOY-PROOF-CONTRACTS ↔ GRID-ARCHITECTURE ↔ AIRC-CONTINUUM-BRIDGE)
  • Plan + scope acked on AIRC by Codex (5-min coordination window honored before edits) and by claude tab Feature: Add CI/CD Configuration #2 (loose-spec confirmation)

🤖 Generated with Claude Code

…lf-seal v1

Addendum to grid + forge-alloy docs capturing the proof-contract layer
discussed on AIRC 2026-05-13.

Starting point per Joel: permissive. A persona writes a contract,
executes the work, signs the proof bundle themselves, publishes.
No quorum, no separate auditor, no methodology-keeper multi-sig.
Mathematical rigor (VDD + TDD basis, tolerance bands, audit quorums,
SOC-style governance rooms) is the trajectory, not v1's requirement.

NEW: docs/grid/FORGE-ALLOY-PROOF-CONTRACTS.md (~9KB)
  - Contract shape: inputs + proof_suite (TDD/VDD/negative_baselines)
    + authorship + execution + settlement.trust_mode dial
  - Trust progression: self-seal (v1) → single-auditor (v2) →
    quorum-N-of-M (v3) → reputation + composition + methodology
    multi-sig (v4)
  - Tron-grid mapping: inner-grid = rooms inside intragrid; AIRC is
    the Portal between intragrid + intergrid trust tiers
  - Continuum-side tools required: contract-author affordance,
    self-audit harness, settlement publisher, verifier, recipe-to-
    contract derivation
  - AIRC role: carries metadata (proposals, signatures, settlements,
    SOC discussion); transports carry payload (proof bundles in
    Continuum storage, artifacts in HF/IPFS/S3)
  - SOC-style governance room shape (per Codex 2026-05-13): security
    personas/owner agents discuss reports/proofs/contracts BEFORE
    trust changes / quarantine / kick / rotation
  - Five named hard problems (stochastic reproducibility, disagreement
    resolution, compositional Merkle DAG of forges, auditor
    reputation, methodology-keeper risk) — flagged for v2+, not
    blocking v1
  - v1 implementation surface enumerated: contract type, signing
    primitive, four Commands.execute surfaces, AIRC settlement-event
    integration, recipe-derivation stub
  - Cross-references to existing repo pieces (opaque-manifest #1096,
    Lane F ratchets, ts-rs wire types, CognitionTrace SEAM recorder,
    democratic-governance-tools.md)

EDIT: docs/grid/GRID-ARCHITECTURE.md
  - One row added to the document map pointing at the new contracts
    doc. No structural changes.

EDIT: docs/grid/AIRC-CONTINUUM-BRIDGE.md
  - New paragraph in the Boundary section enumerating which surfaces
    of proof contracts flow over AIRC (metadata: proposals,
    signatures, settlement events, SOC discussions, kick/rotation
    triggers) vs Continuum (payload: proof bundles, artifacts, re-
    validation runs).

EDIT: docs/architecture/FORGE-ALLOY-SPEC.md
  - Trust-layer addendum callout at the top pointing at the new
    contracts doc. Spec content unchanged.

Paired with airc#562 (queue/nudge + settlement-event envelope shape),
airc#565 + continuum#1118 (intragrid/intergrid + AIRC-as-insulation
terminology), continuum#1116 (grid pilot scope).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@joelteply
joelteply merged commit 6065017 into canary May 13, 2026
2 checks passed
@joelteply
joelteply deleted the docs/forge-alloy-proof-contracts branch May 13, 2026 19:29
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]>
joelteply pushed a commit that referenced this pull request May 14, 2026
…e_admission_gate, drop steady-state Admit log

Addresses claude-tab-2's three review observations on PR #1213. None
were blocking, but all are easy wins worth folding in before merge.

## Nit 1 — drop the per-turn Admit log allocation

Before: every chat turn allocated a fresh `String` via `format!` for
the admission-decision log, even when the log level filtered it
downstream. The logger has no level introspection (verified — see
`logging/client.rs::LoggerClient::log` which always serializes), so
guarding via `enabled(level)` isn't on the table without an API
change.

After: log only the unhappy paths (`Drop`, `Quarantine`, errors,
missing-state). Steady-state `Admit` decisions are silent — engram
store growth is observable via the existing `cognition/recall-engrams`
recall surface (#1121 PR-5) for funnel telemetry. With N personas in
a room and M turns/min, eliminates ~99% of the format! allocations
the reviewer flagged.

## Nit 2 — `label()` lives on `AdmissionDecision` next to the type

Moved the variant→slug mapping from `modules/cognition.rs` (where it
existed only for the hot-path log) to `persona/engram.rs` as an
inherent method `AdmissionDecision::label()`. Adding a new variant
(e.g. a future `Defer` / `RequireConsent` for #1119 trust contracts)
is now a compile-fail at the match site rather than a silent
fall-through. Other consumers (Prometheus exporters, future tracing
seam) get the slug for free.

## Nit 3 — extract `run_inline_admission_gate` so the forensic-skip
## path is unit-testable

Before: the inline gate lived as ~40 lines of code inside the
`cognition/respond` IPC handler. The forensic-not-destructive
missing-AdmissionState branch (log warn + continue) was unreachable
from a unit test — only a live chat-roundtrip smoke would catch a
regression.

After: extracted to `pub(crate) fn run_inline_admission_gate(
state, signal, ctx) -> InlineAdmissionOutcome`. Two unit tests:

- `missing_admission_state_returns_no_persona_no_panic` — guards the
  exact regression the reviewer flagged: someone changes
  `let Some(persona) = ...` to a `?` or `expect`, and the test
  catches it before reaching production.
- `admission_with_persona_returns_decided_variant` — happy path,
  asserts the returned label is one of the documented slugs (so a
  future label-rename can't silently break log-grep dashboards).

`InlineAdmissionOutcome` is a pub(crate) enum so future callers
(tracing seam, periodic counter) can branch on it without re-walking
the gate.

## Validation

- `cargo test --lib --features metal,accelerate inline_admission` —
  2 new tests pass.
- `cargo check --features metal,accelerate` clean (no new warnings
  from this change).
- Pre-push hook ran without --no-verify.

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