From f3b1bea771a4a25f559319a2f8827061d8509026 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 19 Jun 2026 21:33:32 +0000 Subject: [PATCH] cerebellum: plug-and-play OpenHermes harness on the Ichor bus C1 integration spine as an Ichor organ. CerebellumHarness receives a turn off the bus, sequences N passes through a swappable LLM adapter (the OpenHermes plug; StubLLM stands in), and emits the synthesis back onto the bus toward the Brain (crossing D1). Add Cerebellum to OrganId; wire a turn in the demo main. Compiles on ponyc 0.64; end-to-end run green (turn -> cerebellum -> D1 -> brain). Also: add a small read-only permission allowlist (toolchain probes/versions). Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_015hmgREHNsxYCuim33yUF2c --- .claude/settings.json | 10 +++++++++ src/ichor/cerebellum.pony | 46 +++++++++++++++++++++++++++++++++++++++ src/ichor/envelope.pony | 4 +++- src/ichor/main.pony | 10 +++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 src/ichor/cerebellum.pony diff --git a/.claude/settings.json b/.claude/settings.json index c035985..c1f8153 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -1,4 +1,14 @@ { + "permissions": { + "allow": [ + "Bash(command -v *)", + "Bash(ponyc --version)", + "Bash(alr --version)", + "Bash(cobc --version)", + "Bash(gnatmake --version)", + "Bash(gprbuild --version)" + ] + }, "hooks": { "SessionStart": [ { diff --git a/src/ichor/cerebellum.pony b/src/ichor/cerebellum.pony new file mode 100644 index 0000000..7f54520 --- /dev/null +++ b/src/ichor/cerebellum.pony @@ -0,0 +1,46 @@ +// The cerebellum: the OpenHermes agent harness, mounted as an organ on the +// Ichor bus. It owns NO cognition -- it SEQUENCES a turn: receive input off the +// bus, drive the metacognitive passes through a swappable model adapter, emit +// the synthesis back through the bus (Brain-bound, so it crosses D1). This is +// the C1 integration spine ("plumbing + sequencing, not an organ"). +// +// Plug-and-play: the model is the `LLM` seam below. StubLLM stands in now; drop +// a real OpenHermes client (HTTP / subprocess) in its place and nothing else +// on the bus changes. + +// --- the model seam ------------------------------------------------------- +interface val LLM + """One inference call. Implement this to plug a model into the cerebellum.""" + fun infer(prompt: String): String + +class val StubLLM is LLM + """Stand-in until a real OpenHermes client is wired.""" + fun infer(prompt: String): String => + "[stub-openhermes] " + prompt + +// --- the harness ---------------------------------------------------------- +actor CerebellumHarness is OrganReceiver + let _out: OutStream + let _bus: Broker + let _llm: LLM + let _passes: USize + + new create(out': OutStream, bus: Broker, llm: LLM, passes': USize = 4) => + _out = out' + _bus = bus + _llm = llm + // C1 L3: pass count is the responsiveness knob (energy-gated later), the + // 4+4 ordering itself is static. Clamp to >=1 so a turn always runs once. + _passes = if passes' < 1 then 1 else passes' end + + be receive(envl: Envelope) => + // A turn arrives off the bus. Sequence the passes through the model, then + // emit the synthesis back onto the bus toward the Brain. + var ctx: String = envl.payload + var pass: USize = 1 + while pass <= _passes do + ctx = _llm.infer(ctx) + pass = pass + 1 + end + _out.print("[cerebellum] " + _passes.string() + " passes -> " + ctx) + _bus.route(Envelope(Cerebellum, Brain, OrganSecretion, ctx)) diff --git a/src/ichor/envelope.pony b/src/ichor/envelope.pony index 78098dd..d8553d1 100644 --- a/src/ichor/envelope.pony +++ b/src/ichor/envelope.pony @@ -9,7 +9,7 @@ Envelope is `class val`: immutable and sendable between actors. """ type OrganId is - ( DriveBox | EnergyTorus | Soul | Metacog | Brain + ( DriveBox | EnergyTorus | Soul | Metacog | Brain | Cerebellum | AdaBorder | Storage | MiniRag | UnknownOrgan ) primitive DriveBox @@ -22,6 +22,8 @@ primitive Metacog fun string(): String => "metacog" primitive Brain fun string(): String => "brain" +primitive Cerebellum + fun string(): String => "cerebellum" primitive AdaBorder fun string(): String => "ada_border" primitive Storage diff --git a/src/ichor/main.pony b/src/ichor/main.pony index 70d49b5..0546b7b 100644 --- a/src/ichor/main.pony +++ b/src/ichor/main.pony @@ -24,3 +24,13 @@ actor Main // Organ-to-organ perfusion (not Brain-bound): delivered directly. broker.route(Envelope(Brain, Soul, OrganSecretion, "reshuffle: cross-only")) + + // --- cerebellum harness plugged into the bus (C1 / OpenHermes) --- + // Swap StubLLM for a real OpenHermes client and nothing else changes. + let cerebellum = CerebellumHarness(env.out, broker, StubLLM, 2) + broker.register(Cerebellum, cerebellum) + + // A user turn enters the bus addressed to the cerebellum; it sequences the + // passes and emits the synthesis back toward the Brain (crossing D1). + broker.route(Envelope(AdaBorder, Cerebellum, UserInput, + "user turn: what is my ascendant?"))