System architecture

Covenant is a single long-running daemon — covenantd — plus a thin set of clients (the CLI, the web UI, third-party tooling over HTTP) and a number of agent processes. The daemon is the only component that holds state; everything else is replaceable.

Component map

┌──────────────────────────────────────────────────────────────┐
│                          covenantd                           │
│ ┌──────────┐  ┌──────────┐  ┌────────────┐  ┌────────────┐  │
│ │  IPC     │  │   HTTP   │  │   MCP      │  │   A2A      │  │
│ │  socket  │  │  gateway │  │ adapter    │  │ adapter    │  │
│ └────┬─────┘  └────┬─────┘  └─────┬──────┘  └─────┬──────┘  │
│      │             │              │               │          │
│      ▼             ▼              ▼               ▼          │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │                    Server::respond                       │ │
│ │ (intent dispatch, capability checks, audit, ignore set)  │ │
│ └────────┬─────────┬─────────┬─────────┬─────────┬─────────┘ │
│          │         │         │         │         │            │
│          ▼         ▼         ▼         ▼         ▼            │
│      ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────────┐        │
│      │Router│ │Runtime│ │Memory│ │ Audit│ │Settlement│        │
│      └──┬───┘ └──┬───┘ └──┬───┘ └──┬───┘ └──┬───────┘        │
│         │        │        │        │        │                │
└─────────┼────────┼────────┼────────┼────────┼────────────────┘
          │        │        │        │        │
          ▼        ▼        ▼        ▼        ▼
       cards    spawned  SQLite  JSONL    JSONL  ←  on-chain
       on disk  processes  +    audit/   receipts  settlement
                          embeds events           program

Process model

covenantd runs as a single process per machine, owned by the operator's user account. It owns:

  • a Unix socket at $COVENANT_HOME/sock for local clients,
  • an HTTP listener on 127.0.0.1:8421 for browser- facing UIs and third-party tooling (loopback only),
  • the SQLite memory database at $COVENANT_HOME/memory.db,
  • append-only JSONL stores at audit/events.jsonl, capabilities/granted.jsonl, capabilities/revoked.jsonl, and receipts/working.jsonl,
  • the local ed25519 identity key.

Each registered agent runs as a child process spawned on demand when an intent is dispatched. Agents have no direct access to the daemon's state — every interaction goes through the daemon. The runtime wall-clocks each agent against the budget declared in its manifest and kills processes that overrun.

Request lifecycle

  1. A client (CLI, web UI, third-party caller) sends a SubmitIntent request over the Unix socket or HTTP.
  2. The daemon checks the intent text against the configured ignore set; matches are short-circuited with anIntentIgnored audit event and skipped.
  3. The router scores the intent against registered agent capability cards via keyword overlap and selects the best match (or falls back to an echo response).
  4. The daemon runs a capability check for the matched agent's required actions. The check writes a CapabilityCheck audit event regardless of outcome. A failed check rejects the dispatch with Response::Error.
  5. On success, the runtime spawns the agent, sends the intent on stdin, reads the result on stdout, and enforces the wall-clock budget.
  6. The daemon writes a working-tier MemoryRecord (with an embedding vector if an embedder is configured), a SettlementReceipt for the resources consumed, and an IntentDispatched audit event.
  7. The client receives an IntentResult with the intent UUID, the result text, sources, and (when applicable) the receipt.

State on disk

Everything Covenant remembers about its operations sits under $COVENANT_HOME. Default location is ~/.covenant; override with the COVENANT_HOME environment variable.

PathFormatOwner
identity/local.keyraw 32 bytes (ed25519 seed)covenant-identity
memory.dbSQLitecovenant-memory
audit/events.jsonlJSONL, append-onlycovenant-audit
capabilities/granted.jsonlJSONL, append-onlycovenant-permissions
capabilities/revoked.jsonlJSONL, append-only (tombstones)covenant-permissions
receipts/working.jsonlJSONL, append-onlycovenant-settlement
agents/*.tomlTOML, one manifest per filecovenant-router
secrets.tomlTOMLcovenant-llm, covenant-tools, covenant-mcp
.covenantignoregitignore-style patternscovenant-memory
sockUnix domain socketcovenant-ipc

Crate layout

The daemon is composed from a number of small Rust crates, each owning one primitive. Each crate exposes a trait + at least two implementations (one for production, one in-memory for tests), which keeps the daemon's wiring straightforward and the test suite fast.

CrateRole
covenant-typesWire-level types shared by every other crate ( Intent, AgentId, Capability, MemoryRecord, SettlementReceipt).
covenant-manifestParser and validator for agent.toml.
covenant-routerLoads agent manifests and matches intents to agents via keyword overlap.
covenant-runtimeSubprocess agent runner with stdin/stdout JSON protocol and a wall-clock budget.
covenant-memoryThree-tier memory store (SQLite + in-memory) with cosine similarity search over stored vectors.
covenant-identityed25519 identity, on-disk persistence, signing helpers.
covenant-permissionsCapability tokens — sign, verify, persist, revoke.
covenant-auditAppend-only audit log with JSONL and in-memory backends.
covenant-settlementSettlement primitive: receipts, credits, off-chain accounting that pairs with the on-chain program.
covenant-llmProvider trait with mock, Ollama, Anthropic, and OpenAI-compatible implementations.
covenant-toolsTool provider trait with mock, Brave, and SerpAPI search implementations.
covenant-mcpModel Context Protocol integration — tool trait, registry, native tools, stdio JSON-RPC transport for external servers.
covenant-a2aAgent-to-agent task and result envelopes; in-process mailbox.
covenant-ipcLength-prefixed JSON IPC protocol for the local socket.
covenantdThe daemon binary. Wires the primitives together; exposes the IPC and HTTP surfaces.
covenantThe CLI binary.

On-chain settlement

The on-chain side of Covenant is a single Anchor program for Solana, deployed under the operator's authority. It implements the credit-mint, consumption, and buyback shape described in Settlement. The daemon batches off-chain receipts and flushes them to the program; once flushed, the receipt's onchain_sig is populated and the receipt is reconcilable from chain state alone.

The program is deliberately small. Bigger token mechanics — oracle integration, DEX routing for buyback — live one layer up and can change without touching the on-chain authority surface.

What is not in scope

Covenant is not an LLM, not an agent framework, and not a chat product. It does not host models, and it does not prescribe how agents should reason. The goal is for an agent stack of any kind — handcrafted, framework-built, fine-tuned end-to-end — to plug into the same primitives so that permissions, memory, identity, and settlement are not each application's problem to solve from scratch.