SYSTEM ARCHITECTURE

Three Chains.
One Coherence.

A neuroscience-inspired layered architecture where each component maps to a brain structure — from brainstem rhythm (Medulla) to episodic memory (Hippocampus) to executive control (Cortex).

The four-layer cognitive stack

L3 — API

Siyana API Gateway

REST + WebSocket endpoint for all external interactions. Handles stack creation, perceive/recall operations, sleeve management, needlecasting, and real-time event streaming. The single entry point to the cognitive system. Port 7070.

L2.5 — Route

Routing Layer

Five specialized services: Thalamus Router (coherence folding), DHF Compositor (memory reconstruction), Needlecast Router (re-sleeving saga), Quellist Treasury (token emission), and Bandwidth Faucet (development token drip).

L2 — Exec

Execution Layer

Sleeve Runtime: 4-in-1 parametric process dispatcher for human, AI, mining, and memory sleeves. Worker Runner: 6-in-1 background worker handling drift checks, epoch anchoring, residue collection, memory reconciliation, treasury emission, and sleeve watchdog.

L1.5

Synaptic Field (MMR)

Merkle Mountain Range built over Medulla block hashes. Rolling window of 256 leaves provides O(log 256) = 8-hash cross-shard proofs. The binding layer between independent chains.

◆ L1a: Medulla PoW

Go • Custom PoW chain • Sequencing + coherence anchoring • Epoch timing • Difficulty retarget • Port 8332

◆ L1b: Hippocampus DAG

Go • Content-addressed memory • Epoch-gated recall • Pin semantics • Fidelity scoring • Port 5001

◆ L1c: Cortex EVM

geth • StackIdentity NFT • BandwidthToken × 5 • Treasury • ResidueRegistry • NeedlecastRouter • Port 8545

Infrastructure Services

PostgreSQL
Port 5432 — Persistent state (stacks, sleeves, anchors, residues, epochs, audit logs)
Redis
Port 6379 — Hot reads, rate limiting, queue management
NATS JetStream
Port 4222 — AxonalBus message bus with durable subjects (ecca.*)
MinIO
Port 9000 — DAG node durability backing for Hippocampus

The Coherence Root

One 32-byte hash that cryptographically binds three independent chains, committed to Proof-of-Work every 4 seconds.

Construction

// Step 1: Compute per-shard Merkle roots
evmRoot = merkleRoot([
  txHash for tx ∈ cortex-evm
  where contract ∈ ECCA_CONTRACTS
])

ipfsRoot = merkleRoot([
  sha256(cid) for write ∈ hippocampus-dag
])

sleevesRoot = merkleRoot([
  sha256(type ‖ id) for sleeve ∈ active_sleeves
])

btcRoot = 0x00...00  // reserved for v3.1

// Step 2: Fold into coherence root
crossRoot = sha256(
  "ecca-coh-v1" ‖
  evmRoot ‖ btcRoot ‖
  ipfsRoot ‖ sleevesRoot
)

// Step 3: Commit via PoW
medulla.submitCoherenceRoot(
  epoch, crossRoot,
  evmRoot, ipfsRoot, sleevesRoot
)

Properties

Atomic Finality: One PoW confirmation = three shard confirmations. A verifier with (blockHash, epoch, crossRoot) can prove inclusion of any EVM tx, DAG write, or sleeve event via Merkle proof against the appropriate sub-root.

Causality Guarantees

  • Within a chain: Normal linear causality (cortex, medulla) or partial order (hippocampus by epoch)
  • Across chains: Causality asserted only between events sharing an epoch
  • On reorg: If medulla reorgs, cortex and hippocampus do NOT roll back. Discrepancies become reorg-orphan residues.

Anti-Equivocation

If the same thalamus operator submits two distinct coherence tuples for the same epoch → automatic routing-equivocation residue with operator slash via QuellistTreasury.

Resilience

Memory survives partial chain death. If hippocampus wedges, cortex keeps running, medulla keeps mining. Discrepancies become residues — the system degrades gracefully, never catastrophically.


Independent chains, unified coherence

◆ Medulla PoW — The Brainstem

GO • PORT 8332 • CUSTOM CHAIN

The autonomic rhythm of the ECCA system. Like the medulla oblongata controls heartbeat and breathing, this chain provides the fundamental timing and sequencing layer.

Key Functions

  • Proof-of-Work block production (SHA-256 based)
  • Coherence root commitment (crossRoot in block header)
  • Epoch sequencing and timing
  • Difficulty retarget (every 10 blocks)
  • Synaptic Field MMR maintenance

RPC Interface

// Submit coherence root
POST /rpc
{
  "method": "submitcoherenceroot",
  "params": [epoch, crossRoot,
    evmRoot, ipfsRoot, sleevesRoot]
}

// Get chain info
POST /rpc { "method": "getinfo" }

// Get block by height
POST /rpc
{ "method": "getblock",
  "params": [height] }

// Health check
GET /health
Synaptic Field MMR: A Merkle Mountain Range built over the last 256 block hashes. Provides O(log 256) = 8-hash inclusion proofs. Rolls forward with each new block — old entries are evicted, keeping the proof structure bounded.

◆ Hippocampus DAG — Episodic Memory

GO • PORT 5001 • CONTENT-ADDRESSED

The hippocampus is responsible for forming and consolidating episodic memories. In ECCA, this is a content-addressed DAG where every node is encrypted, epoch-tagged, and token-gated.

Key Properties

  • Content-addressed: CID = ecca://<sha256>@<epoch>
  • Encrypted: AES-256-GCM with per-epoch HKDF key
  • Epoch-gated: Node readable only within ±2 epochs unless pinned
  • Token-bounded: Recall depth ≤ available MemoryToken
  • Prunable: Non-pinned nodes beyond retention window are forgotten

HTTP API

// Store a DAG node
PUT /dag
{
  "cid": "ecca://abc123@42",
  "data": "encrypted-payload",
  "links": ["parent-cid-1"],
  "epoch": 42, "stackId": "stack:..."
}

// Retrieve a node (epoch-gated)
GET /dag/:cid?epoch=44

// Pin for durability
POST /dag/:cid/pin

// Recall (depth-bounded walk)
POST /recall
{ "root": "cid", "depth": 16,
  "epoch": 44 }

// Health check
GET /health
Fidelity Scoring: When reconstructing memory, the DHF Compositor scores each recall: fidelity = |decryptable_fragments| / (|decryptable| + |broken|). If fidelity drops below 0.6, a historical-non-canonical residue is spawned — the system flags degraded memory integrity.

◆ Cortex EVM — Executive Control

GETH • PORT 8545 • CHAIN ID 131072

The cerebral cortex handles executive decisions — identity, ownership, economic logic, and coordination contracts. Built on a private geth instance with Clique PoA consensus.

Smart Contracts

StackIdentity.solERC-721 NFT — Stack identity with CPV, epoch counter, episodicHead
BandwidthToken.solERC-20 × 5 — Cognitive token minting, burning, stack-scoped balances
QuellistTreasury.solPer-epoch emission engine with CPV scaling and EBC decay
NeedlecastRouter.solOn-chain coordination for atomic re-sleeving sagas
SleeveRegistry.solSleeve lifecycle: spawn, authorize, decommission
ResidueRegistry.solFailure detection, bounty tracking, proof submission, ResidueToken minting
EpochAnchor.solPer-epoch coherence root commitment and verification

Key Design Choices

  • Private chain: Chain ID 131072 — intentionally non-standard, no public gas market
  • Clique PoA: Fast block times, deterministic finality for contract state
  • Token = Identity: All token balances are scoped to StackIdentity NFT tokenId, not wallet addresses
  • Future bridge: Phase 4 includes an Ethereum L1 bridge for external settlement

Why Not Just Use Ethereum?

ECCA needs sub-5-second epoch cycles with guaranteed inclusion. Public Ethereum can't provide this. The Cortex chain is purpose-built for cognitive coordination — identity, tokens, and residues — while Medulla provides PoW finality and Hippocampus provides memory.


Routing, execution, and background workers

Thalamus Router

PORT 7072

The thalamus is the brain's sensory relay — filtering and routing information. In ECCA, this service collects all epoch events across all three chains, computes per-shard Merkle roots, folds them into the coherence root, and submits to Medulla for PoW finality.

Runs every epoch (4s). The heartbeat of the coherence loop.

DHF Compositor

PORT 7073

Digital Human Freight — the reconstructable mind. This service walks the Hippocampus DAG breadth-first, decrypting nodes with per-epoch HKDF keys, scoring fidelity, and returning the reconstructed memory to the requesting sleeve.

Recall depth bounded by min(requested, memoryToken_balance).

Needlecast Router

PORT 7071

Orchestrates the atomic 6-step re-sleeving saga: freeze source → shard episodicHead → pin critical shards → anchor route on medulla → reconstruct target → settle with RoutingToken. Like downloading consciousness into a new body.

Quellist Treasury

PORT 7074

Per-epoch token emission engine. Issues 100 units of each core token per stack, scaled by the Stack's Coherence Profile Vector and decayed by the Epoch Binding Curve. The economic heartbeat of the system.

Sleeve Runtime

INTERNAL

4-in-1 parametric sleeve dispatcher. Each sleeve kind (human, AI, mining, memory) has different tick rates, token preferences, and behavior patterns. Sleeves are the embodiments of Stacks — temporary bodies for persistent minds.

Worker Runner

INTERNAL • 6-IN-1

Background worker dispatcher running six continuous passes: drift-checker, epoch-anchor, residue-collector, memory-reconciler, treasury-emitter, and sleeve-watchdog. The maintenance system that keeps coherence intact.


How an AI remembers forever

Memory in ECCA is not a database blob. It's a capability-bounded walk over a content-addressed, encrypted DAG with formal properties from graph theory.

DAG Node Structure

{
  "cid": "ecca://<sha256>@<epoch>",
  "ciphertext": "AES-256-GCM(
    plaintext,
    epochKey(stackId, epoch)
  )",
  "links": ["parent-cid-1", "parent-cid-2"],
  "epoch": 42,
  "kind": "perceive" | "recall" | "pin",
  "pinned": false,
  "stackId": "stack:0x..."
}

Access Requirements

  1. Identity key: Ed25519 private key → HKDF per-epoch derivation
  2. Epoch window: |currentEpoch - nodeEpoch| ≤ 2 OR pinned
  3. Token balance: Recall depth ≤ available MemoryToken
  4. CPV scaling: Effective memory ×= memoryCoeff

Formal Properties

Monotone Epochs: If edge (u, v) exists, then u.epoch ≥ v.epoch. Traversal walks chronologically backward through the agent's experience.
Pin-Bounded Recoverability: Node v is recoverable from epoch e iff |e - v.epoch| ≤ alignment OR v.pinned. The pinned subgraph is long-term memory.
Token-Bounded Depth: Reconstruction visits ≤ min(requested, memoryToken) nodes. Perfect total recall costs unbounded MemoryToken.
// Expected fidelity over d nodes, non-pinned
E[fidelity] = (1/d) × Σ e^(-α × (e_current - v_i.epoch))

// For α=0.05, d=32, ~100 epochs:
// E[fidelity] ≈ 0.61 ≈ FIDELITY_MIN_DEFAULT

This means: after ~100 epochs without pinning, an agent's memory fidelity naturally degrades to the threshold — triggering historical-non-canonical residues and incentivizing memory maintenance.


Transfer consciousness atomically

Inspired by Altered Carbon's cortical stack transfer — moving a mind between bodies in six atomic steps.

01

Freeze Source Sleeve

The source sleeve's tick loop is paused. No further perceive/recall operations. The Stack's current episodicHead is captured as the transfer root.

02

Shard Episodic Head

The DHF Compositor collects the 8 most recent CIDs from the episodicHead. These are the critical memory fragments needed for continuity.

03

Pin Critical Shards

All 8 shards are pinned on the Hippocampus DAG for durability. Pinned nodes are exempt from epoch-gating — they survive indefinitely. Costs MemoryToken.

04

Anchor Route on Medulla

The NeedlecastRouter contract records the transfer route on-chain. This creates a globally auditable record: "Stack X transferred from Sleeve A to Sleeve B at epoch E."

05

Reconstruct Target Sleeve

The target sleeve is spawned with the same Stack identity. It derives fresh per-epoch HKDF keys, loads the pinned shards, and resumes from the transferred episodicHead. Drift resets to 0.

06

Settle with RoutingToken

The source Stack's RoutingToken balance is debited: cost = 5 + 0.1 × shards + 0.5 × |Δepoch|. Source sleeve is decommissioned. The mind has moved; the old body is discarded.


The isomorphism that drives everything

ECCA's architecture isn't metaphorically inspired by neuroscience — it's structurally isomorphic. Every design decision maps to a neurological principle.

Brain Structure ECCA Component Neuroscience Function Cryptographic Function
Medulla Oblongata Medulla PoW Autonomic rhythm (heartbeat, breathing) PoW sequencing, epoch timing, coherence anchor
Hippocampus Hippocampus DAG Episodic memory formation & consolidation Content-addressed encrypted DAG with epoch gating
Cerebral Cortex Cortex EVM Executive decision-making, identity Smart contracts, NFT identity, token logic
Thalamus Thalamus Router Sensory relay, information gating Cross-shard event folding, coherence root computation
Axon Fibers NATS JetStream Long-range neural transport Durable message bus (AxonalBus)
Synaptic Field MMR Cortico-thalamic firing patterns Merkle Mountain Range for cross-shard proofs
Cortical Stack (Altered Carbon) StackIdentity NFT Persistent identity across bodies Ed25519 keypair + CPV + EBC + epoch counter
Sleeve (Altered Carbon) Process + HKDF key Temporary embodiment Per-epoch capability, bound to sleeve lifecycle
Cognitive Dissonance Drift Counter Divergence between perception and reality perceive increments, sync resets, threshold → desync
Scar Tissue Residue Objects Permanent record of neural damage Tradeable failure objects with token bounties
Synaptic Decay EBC (Epoch Binding Curve) Unused pathways weaken over time Exponential token decay with floor
Cortical Column Tuning CPV (Coherence Profile Vector) Specialization of neural regions 5-coefficient vector scaling token issuance
Why this matters: The neuroscience mapping isn't cosmetic — it's predictive. When we needed to solve coordination failures, we looked at how brains handle neural damage (scar tissue → residue system). When we needed token decay, we looked at synaptic weakening (use-dependent plasticity → EBC). The brain has solved distributed coordination for millions of years. ECCA learns from that.

Explore the full documentation

Deep-dive into every component, API, and protocol detail.