Architecture

                           mandala serve  (one process)
 ┌───────────────────────────────────────────────────────────────────────────────┐
 │  HTTP (axum) on ALMA_LISTEN                                                   │
 │   ├─ /            the Workspace web app (static files, ALMA_WEB_ROOT)         │
 │   ├─ /api/*       the app's API: comms, knowledge, data, settings, sync…      │
 │   ├─ /copilotkit  the chat runtime (AG-UI over SSE)                           │
 │   └─ /v1/*        the generated DHL API (proxied to a loopback listener)      │
 │                                                                               │
 │  Accomplice: agent loop ── tool host ── extensions                             │
 │     Goethe · Google · Telegram (TDLib) · WhatsApp · web · pictures ·          │
 │     GitHub · Meta Ads · MCP · Ahrefs · PostHog · code sessions · DHL tools    │
 │                                                                               │
 │  Dharma node (in process)                                                     │
 │     DHL contracts compiled to Wasm (Wasmi) · Karma storage engine (C++20)     │
 │     with native query projections · OpenRaft authority (one voter)            │
 │                                                                               │
 │  Background loops: scheduler · triage (Gmail, chats, events) · voice jobs ·   │
 │     sync (HTTP + iroh mesh) · vault sync (Loro CRDT) · live co-editing        │
 └───────────────────────────────────────────────────────────────────────────────┘
        data directory: records, keys, vaults, chat sessions, caches

The pieces

  • Workspace — a React app, served as static files by the binary.
  • The accomplice — a plain agent loop: build the prompt, call the model with tools, run the tools through the host (which enforces approvals, autonomy and the risk check), repeat. Conversations, turns, tool calls, approvals and memory are signed records.
  • Goethe — typed Markdown vaults on disk: documents, types, views, tasks, links. Each vault is a directory you can also open with any editor or the Goethe TUI.
  • Dharma and Karma — the DHL engine. Dharma compiles and runs contracts and checks authority; Karma keeps accepted state durably and maintains the query projections. No SQL server.
  • Sync — each node keeps a log of signed intents; paired nodes exchange what the other lacks every 20 seconds, over HTTP or the iroh device mesh. Vaults sync as text CRDT updates on the same log.

Principles you can rely on

  • One executable, one service. Coding turns and Workbench trials run as subcommands of the same binary (mandala code-turn, mandala workbench-check), never as separate daemons.
  • Durable background work. Every queue, poll and pending job is stored. A restart (or a crash) loses nothing: interrupted answers are resumed, effects in flight are followed until they settle, and backfills continue where they stopped.
  • Restart is a normal operation. Mandala restarts itself to load a new vault or contract; the service manager must restart it on exit (Restart=always).