corpora-kernel
A small, supervised Elixir kernel where every state change is an event, every event is replayable, and a Coggy-style symbolic AtomSpace lives next to the evolving log — not bolted on after.
what it's for
An LLM platform accumulates state in middleware: agents, sessions, derived facts, partial conclusions. Most stacks let that state live in databases and hope. corpora-kernel takes the BEAM seriously — every state change is an event, every event is replayable, the supervision tree governs the agents that produce them, and a Coggy-style symbolic AtomSpace sits next to the log so derived facts and their provenance are first-class.
The three labs below are projections of the same kernel running in your browser, against a single scenario: tracking an account through ordinary events, with derived facts about it appearing automatically in the AtomSpace. Click to drive the whole scenario at once.
shape · three subsystems, one tree
EventStore appends · Projector folds · Coggy.AtomSpace asserts derived. The supervision tree below is the actual structure; the labs that follow each project one face of it.
1 · supervision tree · click a worker to crash it
click a worker box to crash it. supervisor runs the chosen restart strategy.
2 · event sourcing · the state is a fold
The kernel does not store state; it stores events, and projects them on demand. Append-only on the left; a fresh fold on the right after each append. The bottom slider rewinds the projection to any prefix of the log — time travel for free.
event log (append-only)
projected state
3 · atomspace · truth, confidence, and inference
A typed hypergraph of concepts. Every atom carries a truth value {strength, confidence}. Modus ponens turns (is-a cat pet) + (is-a pet animal) into the derived atom (is-a cat animal) — confidence degrading along the chain. Click an atom to retract it; dependents cascade.
solid border = asserted · dashed = derived · click to retract
putting it together
The three labs above are not separate stories. They are three views of the same running kernel:
user opens an account ▶ EventStore appends {:account_opened, "alice", 0} ▶ Projector folds it into the live state ▶ Coggy.AtomSpace asserts (has-account alice) user deposits 100, then 30 ▶ EventStore appends two more events, total seq = 3 ▶ Projector now reports balance = 130 ▶ Coggy.AtomSpace asserts (has-balance alice 130) EventStore process crashes mid-write ▶ Supervisor (one_for_one) restarts it ▶ Pending event re-tries against the new pid ▶ Projector picks up where it left off — same seq number ▶ AtomSpace state unchanged · the kernel is partition-tolerant PLN runs over the Coggy AtomSpace ▶ Existing: (has-account alice) + (is-a account asset) ▶ Derives: (has-asset alice) · confidence degraded by 0.92 ▶ Retract (has-account alice) · derived fact disappears with it
Time-travel is free: any prefix of the event log re-projects the entire state. Crashes are local: one_for_one restarts only what failed. Inference is honest: every derived atom carries a confidence that traces back to its parents. None of this requires a new language; it's what BEAM has always offered, taken seriously.