Skip to content

Layer Model

Extracted from: docs-original/ARCHITECTURE.md Purpose: Understanding Manifesto's layered architecture


Overview

Manifesto is structured as a layered computation architecture where each layer has a single responsibility. This layering enforces separation of concerns and prevents category errors in system design.


The Six Layers

┌─────────────────────────────────────────────────────────────────┐
│                           React / UI                             │
│  Responsibility: Present state to users, capture interactions   │
│  Owns: Component rendering, local UI state                       │
│  Never: Directly mutate domain state, execute business logic    │
└─────────────────────────────┬───────────────────────────────────┘
                              │ Hooks (useValue, useActions)

┌─────────────────────────────────────────────────────────────────┐
│                           Bridge                                 │
│  Responsibility: Two-way binding, event routing                 │
│  Owns: Subscriptions, projections, SnapshotView                 │
│  Never: Execute effects, make authority decisions               │
└─────────────────────────────┬───────────────────────────────────┘
                              │ dispatchEvent / dispatch

┌─────────────────────────────────────────────────────────────────┐
│                           World                                  │
│  Responsibility: Governance, authority, lineage                 │
│  Owns: Proposals, decisions, actor registry, world DAG          │
│  Never: Execute effects, compute state transitions              │
└─────────────────────────────┬───────────────────────────────────┘
                              │ submitProposal (via Host)

┌─────────────────────────────────────────────────────────────────┐
│                           Host                                   │
│  Responsibility: Effect execution, patch application            │
│  Owns: Effect handlers, snapshot persistence, compute loop      │
│  Never: Define business logic, make authority decisions         │
└─────────────────────────────┬───────────────────────────────────┘
                              │ compute / apply

┌─────────────────────────────────────────────────────────────────┐
│                           Core                                   │
│  Responsibility: Pure semantic computation                      │
│  Owns: Expression evaluation, flow execution, patch generation  │
│  Never: Execute IO, persist data, access network                │
└─────────────────────────────────────────────────────────────────┘

Layer Responsibilities Matrix

LayerDoesDoes NOT
ReactRender UI, capture events, manage local stateExecute effects, define domain logic
BridgeRoute events, manage subscriptions, transform SourceEventsExecute effects, make decisions
WorldManage actors, evaluate authority, track lineageExecute effects, compute state
HostExecute effects, apply patches, run compute loopDefine domain logic, make decisions
CoreCompute transitions, evaluate expressions, generate patchesExecute IO, persist data
BuilderDefine domains, provide type safety, generate schemasExecute anything

Guiding Principles

PrincipleWhy It Matters
Core computes, Host executesSeparating computation from execution enables deterministic testing, time-travel debugging, and crash recovery
Snapshot is the sole mediumAll communication happens through Snapshot—no hidden state, no suspended context
Effects as declarationsEffects are data describing IO, not executed code—enables auditing and replay
Immutable WorldsEvery committed state is a World with governance metadata—enables accountability and lineage

Boundaries & Contracts

Boundary: Core ↔ Host

DirectionAllowedForbidden
Host → CoreDomainSchema, Snapshot, IntentSide effects, async operations
Core → HostComputeResult (patches, requirements)Direct IO, network calls

Contract:

  • Core MUST be pure (same input → same output)
  • Host MUST execute all requirements before re-computing
  • Host MUST NOT modify requirements before execution

Boundary: World ↔ Host

DirectionAllowedForbidden
World → HostApproved intentsRejected proposals
Host → WorldExecution results, new snapshotAuthority decisions

Contract:

  • World MUST evaluate authority before delegating to Host
  • Host MUST report execution results back to World
  • World MUST create DecisionRecord for all authority decisions

Boundary: Bridge ↔ World

DirectionAllowedForbidden
Bridge → WorldIntentBodies, SourceEventsDirect effect execution
World → BridgeProposalResults, SnapshotViewsInternal governance state

Contract:

  • Bridge MUST route all intents through World
  • Bridge MUST NOT bypass governance
  • World MUST notify Bridge of snapshot changes

Why Not [Alternative Approach]?

AlternativeWhy Not
Event SourcingWe store intents + worlds, not events. Worlds are the source of truth, not event logs.
Redux/FluxToo coupled to UI. Our architecture separates UI binding (Bridge) from state management (Core+Host+World).
Actor ModelActors have hidden state. Our Snapshot is fully visible and serializable.
Traditional ORMORMs hide persistence. Our Host explicitly handles IO through effect handlers.