mirror of
https://github.com/SHOGGOTH-SECTOR/sica-fondt.git
synced 2026-11-29 08:25:10 +00:00
Reorg step 1: consolidate repo under core/, drop the mafiabot label
Mechanical structure-only pass (no document/guide content edits): - Move src/ichor, src/endocrine, and docs/ into core/; the old top-level mafiabot_core/ becomes core/. Everything now lives under a single core/ root. - Drop the "mafiabot" label from the Ada/Alire crate: core.gpr (project Core), alire.toml name = "core"; the generated *_config.* regenerate as core_config.*. - Repoint build-critical wiring only: - .claude/skills/run-sica-fondt/smoke.sh (ponyc + Ada + COBOL paths) - core/src/endocrine R source()/runner paths and the test glob - .github/workflows/ci.yml (working-directory + gpr name) Verified green: smoke ALL GREEN (Pony Ichor, Ada core crate + tests, COBOL E1 vault); R endocrine 14/0; Octave ETR 26/0/1. Deferred (reserved for a less-ephemeral doc/guide pass): docmap.yaml, the guide files and nested AGENTS.md/README prose + now-stale relative links, SOUL.md, and the deeper ring/storage restructure. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015hmgREHNsxYCuim33yUF2c
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
# AGENTS.md — Ichor bus (Pony)
|
||||
|
||||
Local guide for `src/ichor`. Repo-wide map and rules: [`../../AGENTS.md`](../../AGENTS.md);
|
||||
working agreements: [`../../CLAUDE.md`](../../CLAUDE.md).
|
||||
|
||||
## What this is
|
||||
|
||||
The **Ichor perfusion bus** — the outer transport that perfuses organs with
|
||||
messages. Pony. This is where inbound external traffic is first screened before
|
||||
anything reaches the Ada border (D1).
|
||||
|
||||
## Build & run
|
||||
|
||||
Run from the **repo root** (ponyc resolves the path from there):
|
||||
|
||||
```bash
|
||||
export PATH=/root/.local/share/ponyup/bin:$PATH # if ponyc not found
|
||||
ponyc src/ichor -o build && ./build/ichor
|
||||
```
|
||||
|
||||
Or via the smoke driver: `.claude/skills/run-sica-fondt/smoke.sh`.
|
||||
|
||||
## Local invariants
|
||||
|
||||
- **S1 lives here.** The bus must `D1 REJECT` unscreened external payloads —
|
||||
external traffic only reaches an organ via the Ada border. Never add a path
|
||||
that perfuses an inner organ directly from `world`.
|
||||
- **S2:** never reclassify a message's provenance as it crosses the bus.
|
||||
@@ -0,0 +1,44 @@
|
||||
# Ichor — the OUTER perfusion bus (D2)
|
||||
|
||||
Ichor is the **outer** bus — "the skin". It carries the **outer organs**
|
||||
(stomach/economy, microagents, SAE, MoRAG/GoDAGRAG) and delivers inbound traffic
|
||||
to **Ada (D1)**, the membrane. See `docs/bus-topology.md` for the full topology.
|
||||
|
||||
**What Ichor is NOT** (do not violate):
|
||||
- It is **not** the inner-brain bus. The inner bus is **Ada-routed (Jorvik)**.
|
||||
- It does **not** carry inner organs — soul, metacog, drive-box, mini-rag,
|
||||
**Hermes**, or the E1 invariant laws. Wiring any of those onto Ichor is
|
||||
"plugging the brain onto the skin". Don't.
|
||||
- Hermes is an **inner** organ; it was never approved on Pony/Ichor.
|
||||
|
||||
Perfusion laws: organs never wire to each other directly (**L1**) — they emit a
|
||||
typed `Envelope` to the `Broker`; anything crossing **into Ada** is screened by
|
||||
the `Barrier` first (**L2**); every envelope carries **provenance** (**L3**).
|
||||
|
||||
## Files
|
||||
- `envelope.pony` — `Envelope {source, dest, provenance, payload}` + `OrganId`
|
||||
(OUTER organs only) / `Provenance`. Mirrors the Ada `Border_Message` shape.
|
||||
- `barrier.pony` — `Barrier.admit`: the membrane screen. **STUB** — a pure-Pony
|
||||
stand-in for the provenance law; the real screen is Ada `Trust_Guard`
|
||||
(blocklist + provenance + rate) plus the **E1 invariant laws**.
|
||||
- `broker.pony` — the outer `Broker` (register + route; forces Ada-bound traffic
|
||||
through the barrier).
|
||||
- `organ.pony` — `OrganReceiver` interface + a `StubOrgan` for tests.
|
||||
- `main.pony` — smoke wiring: stomach digests → inbound to Ada (admitted); raw
|
||||
external → Ada (rejected); outer organ→organ (direct).
|
||||
- `ichor_ada_shim.c` — **STUB** C/Fortran seam to the Ada border (not yet wired).
|
||||
|
||||
## Build / run
|
||||
```
|
||||
ponyc src/ichor -o build # built clean on ponyc 0.64.0
|
||||
./build/ichor
|
||||
```
|
||||
Expected: stomach→ada_border admitted, world→ada_border rejected at D1,
|
||||
stomach→morag delivered directly. Install ponyc via `ponyup` if absent (the env
|
||||
is ephemeral; toolchain is per-session, reinstalled by the SessionStart hook).
|
||||
|
||||
## Status
|
||||
Provisional **outer-bus** scaffold — compiles and runs. The `Barrier` is a
|
||||
**stand-in**, not the real safety screen; the real screen is Ada `Trust_Guard`
|
||||
+ the E1 invariant laws, reached over the seam (transport TBD — IPC vs in-proc
|
||||
is an open decision). Nothing here reaches the inner brain directly.
|
||||
@@ -0,0 +1,39 @@
|
||||
// The membrane (D1). `Barrier.admit` is the screening decision every envelope
|
||||
// crossing INTO Ada (inbound toward the inner brain) must pass — perfusion law
|
||||
// L2: nothing reaches the inner brain without crossing Ada first.
|
||||
//
|
||||
// STUB NOTE: this `admit` is a pure-Pony STAND-IN that only mirrors the
|
||||
// provenance law. The real decision lives in Ada's `Trust_Guard` (blocklist +
|
||||
// provenance + rate) and, above that, the E1 invariant laws. This stand-in must
|
||||
// be replaced by the real Ada call — see the Ada seam below — before anything
|
||||
// ships. Do not mistake this for the actual safety screen.
|
||||
//
|
||||
// To switch to the Ada border, add `use "lib:ichor_ada"` and replace the body of
|
||||
// `admit` with the FFI call sketched below.
|
||||
|
||||
primitive Barrier
|
||||
fun admit(envl: Envelope): Bool =>
|
||||
// Pony-side mirror of D1's provenance law (stand-in for Trust_Guard).
|
||||
match envl.provenance
|
||||
| SystemInternal => true
|
||||
| External => false // external never free-passes the barrier; D1 must screen
|
||||
else
|
||||
true
|
||||
end
|
||||
|
||||
// --- Ada seam (enable once the C shim + ponyc are present) -----------------
|
||||
// use "lib:ichor_ada"
|
||||
//
|
||||
// fun admit_via_ada(envl: Envelope): Bool =>
|
||||
// @ichor_ada_admit[Bool](
|
||||
// _provenance_code(envl.provenance),
|
||||
// envl.payload.cpointer(),
|
||||
// envl.payload.size())
|
||||
//
|
||||
// fun _provenance_code(p: Provenance): U8 =>
|
||||
// match p
|
||||
// | SystemInternal => 0
|
||||
// | UserInput => 1
|
||||
// | OrganSecretion => 2
|
||||
// | External => 3
|
||||
// end
|
||||
@@ -0,0 +1,37 @@
|
||||
// The perfusion broker for the OUTER bus. Outer organs register, then emit
|
||||
// envelopes by `route` — the broker delivers to the destination organ. Traffic
|
||||
// bound for Ada (AdaBorder) — i.e. inbound across the membrane toward the inner
|
||||
// brain — is forced through the D1 Barrier first (law L2). No organ holds
|
||||
// another's reference (law L1); the broker is the only shared point.
|
||||
//
|
||||
// This is the OUTER bus only. It does not carry inner organs and does not reach
|
||||
// the inner brain directly — it hands off to Ada, which routes the inner bus.
|
||||
// In full deployment this actor backs a socket broker hosted on the Ada border;
|
||||
// here it routes in-process so the wiring is exercisable without sockets.
|
||||
|
||||
use "collections"
|
||||
|
||||
actor Broker
|
||||
let _out: OutStream
|
||||
let _organs: Map[String, OrganReceiver tag] = Map[String, OrganReceiver tag]
|
||||
|
||||
new create(out': OutStream) =>
|
||||
_out = out'
|
||||
|
||||
be register(id: OrganId, organ: OrganReceiver tag) =>
|
||||
_organs(id.string()) = organ
|
||||
_out.print("[ichor] register " + id.string())
|
||||
|
||||
be route(envl: Envelope) =>
|
||||
// L2: anything inbound across the membrane (bound for Ada) is screened first.
|
||||
if (envl.dest is AdaBorder) and (not Barrier.admit(envl)) then
|
||||
_out.print("[ichor] D1 REJECT " + envl.string())
|
||||
return
|
||||
end
|
||||
|
||||
try
|
||||
_organs(envl.dest.string())?.receive(envl)
|
||||
_out.print("[ichor] perfuse " + envl.string())
|
||||
else
|
||||
_out.print("[ichor] no organ registered at " + envl.dest.string())
|
||||
end
|
||||
@@ -0,0 +1,70 @@
|
||||
"""
|
||||
Ichor — the perfusion medium ("the blood"). D2.
|
||||
|
||||
The one envelope every organ emits and consumes. Mirrors the Ada D1
|
||||
`Organ_Message {Source, Destination, Provenance, Payload}` so the Pony broker
|
||||
and the Ada border (Trust_Boundary) speak the same shape across the seam.
|
||||
|
||||
Envelope is `class val`: immutable and sendable between actors.
|
||||
"""
|
||||
|
||||
// OUTER organs only. Ichor is the OUTER bus (the "skin") -- it carries the outer
|
||||
// organs up to Ada (D1). The INNER organs -- soul, metacog, drive-box, mini-rag,
|
||||
// Hermes, the E1 invariant laws -- do NOT belong here; they ride the Ada-routed
|
||||
// (Jorvik) inner bus. NEVER add a brain/inner organ to this enum: that is
|
||||
// "plugging the brain onto the skin". See docs/bus-topology.md.
|
||||
type OrganId is
|
||||
( Stomach | Microagents | SAE | MoRAG
|
||||
| AdaBorder | World | UnknownOrgan )
|
||||
|
||||
primitive Stomach
|
||||
// economy organ (small-model): digests external input into context
|
||||
fun string(): String => "stomach"
|
||||
primitive Microagents
|
||||
fun string(): String => "microagents"
|
||||
primitive SAE
|
||||
// sparse autoencoder
|
||||
fun string(): String => "sae"
|
||||
primitive MoRAG
|
||||
// = GoDAGRAG: graph of DAGs of RAGs; reads the world
|
||||
fun string(): String => "morag"
|
||||
primitive AdaBorder
|
||||
// the membrane (D1): the outer bus delivers inbound traffic here to be screened
|
||||
fun string(): String => "ada_border"
|
||||
primitive World
|
||||
// the external world (user / network)
|
||||
fun string(): String => "world"
|
||||
primitive UnknownOrgan
|
||||
fun string(): String => "unknown"
|
||||
|
||||
type Provenance is ( SystemInternal | UserInput | OrganSecretion | External )
|
||||
|
||||
primitive SystemInternal
|
||||
fun string(): String => "system_internal"
|
||||
primitive UserInput
|
||||
fun string(): String => "user_input"
|
||||
primitive OrganSecretion
|
||||
fun string(): String => "organ_secretion"
|
||||
primitive External
|
||||
fun string(): String => "external"
|
||||
|
||||
class val Envelope
|
||||
let source: OrganId
|
||||
let dest: OrganId
|
||||
let provenance: Provenance
|
||||
let payload: String
|
||||
|
||||
new val create(
|
||||
source': OrganId,
|
||||
dest': OrganId,
|
||||
provenance': Provenance,
|
||||
payload': String)
|
||||
=>
|
||||
source = source'
|
||||
dest = dest'
|
||||
provenance = provenance'
|
||||
payload = payload'
|
||||
|
||||
fun string(): String =>
|
||||
source.string() + " -> " + dest.string()
|
||||
+ " [" + provenance.string() + "] " + payload
|
||||
@@ -0,0 +1,30 @@
|
||||
/* ichor_ada_shim.c
|
||||
*
|
||||
* The C/Fortran binding seam between Ichor (Pony) and the Ada D1 border
|
||||
* (Trust_Boundary.Trust_Guard). Pony's FFI calls `ichor_ada_admit`; this shim
|
||||
* is where the call crosses into Ada.
|
||||
*
|
||||
* Stub: returns admit=true. Replace the body with a call into an Ada export of
|
||||
* Trust_Guard.Screen_Inbound (provenance + blocklist + rate), e.g. via a
|
||||
* `pragma Export (C, ...)` wrapper on the Ada side.
|
||||
*
|
||||
* Build into a lib so Pony's `use "lib:ichor_ada"` can link it.
|
||||
*/
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/* provenance codes mirror Ichor's Provenance:
|
||||
* 0 system_internal, 1 user_input, 2 organ_secretion, 3 external */
|
||||
bool ichor_ada_admit(unsigned char provenance,
|
||||
const char *payload,
|
||||
size_t len)
|
||||
{
|
||||
(void)payload;
|
||||
(void)len;
|
||||
|
||||
/* TODO: cross into Ada Trust_Guard.Screen_Inbound and return its verdict. */
|
||||
if (provenance == 3 /* external */) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Ichor smoke wiring — exercises the OUTER bus + the D1 membrane only.
|
||||
//
|
||||
// SCOPE / STUB NOTE (read before extending):
|
||||
// * Ichor is the OUTER bus ("the skin"). It carries OUTER organs
|
||||
// (stomach/economy, microagents, SAE, MoRAG) and delivers inbound traffic
|
||||
// to Ada (the membrane). See docs/bus-topology.md.
|
||||
// * It is NOT the inner-brain bus (that is Ada-routed, Jorvik) and NOT where
|
||||
// Hermes, metacog, soul, drive-box, mini-rag, or the E1 laws live. Never
|
||||
// wire an inner organ onto this bus — that is plugging the brain onto the
|
||||
// skin.
|
||||
// * This is a provisional scaffold proving the broker + membrane mechanics,
|
||||
// not the final routing.
|
||||
//
|
||||
// Build: ponyc src/ichor -o build Run: ./build/ichor
|
||||
|
||||
actor Main
|
||||
new create(env: Env) =>
|
||||
let broker = Broker(env.out)
|
||||
|
||||
// Outer-bus endpoints. AdaBorder is the membrane: inbound traffic is screened
|
||||
// there before it can cross into the inner brain. MoRAG is an outer organ.
|
||||
let ada = StubOrgan(AdaBorder, env.out)
|
||||
let morag = StubOrgan(MoRAG, env.out)
|
||||
broker.register(AdaBorder, ada)
|
||||
broker.register(MoRAG, morag)
|
||||
|
||||
// The stomach digests external input into context and sends it inbound to
|
||||
// Ada; system-origin context is admitted across the membrane.
|
||||
broker.route(Envelope(Stomach, AdaBorder, OrganSecretion,
|
||||
"digested context: <pre-chewed user turn>"))
|
||||
|
||||
// A raw external payload aimed straight at the membrane: D1 rejects it.
|
||||
broker.route(Envelope(World, AdaBorder, External,
|
||||
"unscreened external payload"))
|
||||
|
||||
// Outer organ-to-organ (not membrane-bound): delivered directly, no screen.
|
||||
broker.route(Envelope(Stomach, MoRAG, OrganSecretion,
|
||||
"retrieve: world context for the next turn"))
|
||||
@@ -0,0 +1,17 @@
|
||||
// What an organ is, to Ichor: anything that can receive a perfused envelope.
|
||||
// Organs hold no hard reference to each other (perfusion law L1) — they only know
|
||||
// the Broker. `StubOrgan` is a canned receiver for standalone tests.
|
||||
|
||||
interface tag OrganReceiver
|
||||
be receive(envl: Envelope)
|
||||
|
||||
actor StubOrgan is OrganReceiver
|
||||
let _id: OrganId
|
||||
let _out: OutStream
|
||||
|
||||
new create(id': OrganId, out': OutStream) =>
|
||||
_id = id'
|
||||
_out = out'
|
||||
|
||||
be receive(envl: Envelope) =>
|
||||
_out.print(" [" + _id.string() + "] received: " + envl.payload)
|
||||
Reference in New Issue
Block a user