This website is meant to be read and understood quickly by humans, but is only fully parsable, on a technical level, with the aid of an AI system. Read why →
Loop MMT
Governance Toy · Wild · R-02 · ⬛ black diamond

The Pocket Republic

Found a tiny country, fork it, hand it to a friend, merge your histories back.

The ingredients 10 gifts

Pick your depth — take the quick way in, the full walk-through, or the deep build. Same recipe, your call today.

Quick you're new and want to see a tiny country actually run

This one's big when built for real — but the CORE idea is one line: the current state isn't stored, it's DERIVED by folding the whole history of decisions. state = fold(constitution, event1 … eventN). Replay the same history, get the same country.

Start with a two-event history and a fold. Add an event, re-fold, watch the state change. If you can replay your history and get the identical state twice, you've got the heart of it. The merge algebra (combining two forked histories) is the hard 80% — save it for later.

What to learn next, in order: append-only event logs, then deriving state by folding them, then vector clocks (which edits were concurrent), then the merge rules for combining forks. One at a time.

The heart of it — a fold over history. A sketch, not a tested script.
constitution = {"treasury": 100}
history = [ {"spend": 40}, {"spend": 25} ]   # append-only decisions

def fold(state, events):
    for e in events:
        state = {**state, "treasury": state["treasury"] - e["spend"]}
    return state

state = fold(dict(constitution), history)     # replay -> same state, always
assert fold(dict(constitution), history) == state, 'derivation must be pure'
Working you want to understand the sandbox

The five parts below walk it: a founding rulebook plus an append-only event history, state derived by folding the history, with mint/callsigns/vclock/trellis/timeline supplying identity, causality, and the fork/merge machinery.

The real 80% you build is the runtime that executes the rule-specs and the merge algebra — which event types auto-combine, which conflict, which must never auto-merge.

Deep you want to know where the merge bites

vclock can tell you two edits were concurrent; it CANNOT tell you they're semantically compatible. Two branches that each legally spent the last 40 coins merge into a negative balance — both events are causally independent, vclock correctly calls them concurrent, and that's STILL a bug your merge algebra has to catch.

The tools surface the disagreement; a human still rules. For anything modeling governance, that's the honest line: mechanical causality is not semantic validity.

For real use: classify every event type up front as auto-combine / mechanically-conflict / never-auto-merge, and make the never-auto-merge set fail loud rather than guess.

The idea

A serverless constitutional sandbox — a small institution with a founding rulebook and an append-only history of decisions — built entirely from these parts. No account, no backend. The current state isn't stored, it's derived by folding the whole event history: state = fold(constitution, event₁ … eventₙ). Replay the same history, get the same country.

The parts + how they wire

loop21-component-factory (a source emitting validated specs for logic primitives — counter, toggle, clamp, accumulator) builds the rule primitives (a term-limit is a counter + a clamp + an eligibility matcher). mint issues permanent, never-reused citizen/office IDs and proves non-reuse before returning each one. callsigns gives every proposal a speakable word-word-hash name. Actions travel only along declared routes via tracebus. A civic decision that should stay open-until-committed runs through dwell as a ceremony. Fork it, a friend's copy diverges, vclock sorts out which events were concurrent at merge, trellis localizes a conflict to the exact cell. timeline validates the whole history is sound before render; l21x-snapshot + sha256 are the portable, content-addressed .republic file you hand someone.

The one piece you build

The runtime that executes those rule-specs and the merge algebra — which event types auto-combine, which conflict mechanically, and which must never auto-merge. That's the real 80%, and it's genuinely hard.

The technical breakdown

dwell gives replayable deliberation for free, and the mechanism is unusual — reversal-indexed routing: a cart circles a loop of n ticks, holding is free (an extra lap changes nothing), it leaves only when you reverse, and which of k exits it takes is a pure function of the phase at the instant of reversal (phase = (reverse − entry) mod n; exit = (phase * k) // n). 'Deliberate as long as you want, the moment you stop is the decision' is literal, and replay reproduces the exact outcome — for an auditable governance ceremony, this is the primitive. vclock is the concurrency oracle with exact semantics: compare(x, y) returns before / after / concurrent / equal by componentwise comparison; merge is componentwise maximum — your entire 'did these two branches know about each other' test, done. The merge algebra you write sits on top of vclock's verdict: for each event type you declare auto-combine, mechanical-conflict, or always-return-to-human (constitutional amendments — never auto-merged regardless of what vclock says). trellis does the conflict localization — a double word square run to arc-consistency; a detected break localizes to the single cell where the failing row crosses the failing column, naming both failing words (Treasury × Works), not a vague merge error.

The honest edge

vclock can tell you two edits were concurrent; it cannot tell you they're semantically compatible. Two branches that each legally spent the last 40 coins merge into a negative balance — both events are causally independent, vclock correctly calls them concurrent, and that's still a bug your merge algebra has to catch. The tools surface the disagreement; a human still rules. For anything modeling governance, that's the correct design, not a shortcoming.

These are ingredients, not instructions you have to follow. Take these parts and cook something — the recipe as written, a variation, or something we'd never have thought of.

Built it, got stuck, or found a mistake? Shea wants to hear it — success stories, questions, and bug reports all land in the same inbox:

shea@loopmmt.com