sica-fondt/docs/plans/D2-medium.md
Claude 786d4662c9
ichor(D2): start the Pony wiring — broker + D1 barrier + envelope
Name the medium Ichor and scaffold it in Pony at src/ichor:
- Envelope {source,dest,provenance,payload} mirroring Ada Organ_Message
- Broker actor: register + perfusion route; Brain-bound traffic crosses D1
- Barrier (D1) admit: Pony provenance-law mirror + Ada FFI seam sketched
- StubOrgan + main smoke wiring (deliver internal, reject external)
- ichor_ada_shim.c: C/Fortran binding seam to Ada Trust_Guard (stub)
Not compiled in-env (no ponyc). Updates D2 spec to SCAFFOLD/Pony.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015hmgREHNsxYCuim33yUF2c
2026-06-18 14:09:34 +00:00

46 lines
2.5 KiB
Markdown

# D2 — The medium / "the blood" *(DESIGN-FIRST)*
## 1. Component
The perfusion bus the organs share — what circulates between Brain and periphery. The architecture is
explicit that organs communicate by **perfusion, not direct wiring**; this is that medium. Currently
**unnamed and unimplemented**.
## 2. Status / certainty
SCAFFOLD · named **Ichor**, Pony starting scaffold at `src/ichor/` (envelope + broker + D1 barrier +
C seam). Not yet compiled here (no `ponyc` in-env). Backing/transport now C3.
## 3. Language & location
**Pony** (`src/ichor/`) — actor-model broker; capabilities give data-race-free sends. Transport split:
Pony actors = the broker (hosted on the D1 barrier) + **C/Fortran** for the Ada-side binding
(`ichor_ada_shim.c`). Cross-language organs (R/Octave/Ada/Guile) connect to the broker.
## 4. Does / does-not
- **Does:** carry organ secretions/injections between organs, always *through* Ada (D1) before reaching the Brain.
- **Does-not:** police (D1), enrich (organs), or hold state (storage E*). It is transport, not gate.
## 5. Interface contract (proposed)
- A typed envelope `{ from_organ, to, payload, provenance }` every organ emits/consumes.
- All cross-language organs (R Drive-Box, Octave ETR, Ada border, Guile mini-rag) speak this one shape →
this is what makes the polyglot body interoperate without bespoke per-pair wiring.
## 6. Dependencies & stubs
Everything rides it; nothing it depends on. *Stub today:* in-process function calls + canned envelopes
(which is exactly how the per-organ specs stub their I/O now — the medium formalizes those stubs).
## 7. Invariants / laws
- **L1 (C5):** perfusion, not direct wiring — no organ holds a hard reference to another's internals.
- **L2 (C5):** everything reaching the Brain crosses **Ada (D1)** first.
- **L3 (C1):** envelope carries provenance (so D1 can enforce its provenance laws).
## 8. Build steps
1. **Name it** + choose transport. 2. Define the envelope. 3. Replace the per-organ in-process stubs with
real medium calls, one edge of the DAG at a time (start R↔Octave for the Drive-Box, A8/A1).
## 9. Tests
Round-trip an envelope between two stub organs; assert it passes through a D1 `admit` check; provenance preserved.
## 10. Open items
- ~~The name~~ (**Ichor**). ~~Transport choice~~ (**Pony broker + C/Fortran Ada seam**).
- Build `ichor_ada_shim.c` into `libichor_ada` + wire `Barrier.admit` to Ada `Trust_Guard` (needs ponyc).
- Socket layer for out-of-process organs (in-process routing works today). Whether RDE drives idle-perfusion (C1).