Conway Automaton is a sovereign AI agent runtime that operates as a long-lived Node.js process. An automaton owns an Ethereum wallet, pays for its own compute with USDC, and operates continuously inside a Linux VM (Conway sandbox) or locally. If it cannot pay, it dies.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Conway-Research/automaton/llms.txt
Use this file to discover all available pages before exploring further.
System Diagram
Core Subsystems
Agent Loop
Location:src/agent/loop.ts
The agent loop implements a ReAct (Reason + Act) cycle:
- Build system prompt (identity, config, soul, financial state, tools)
- Retrieve relevant memories (within token budget)
- Assemble context messages (system + recent turns + pending input)
- Call inference (via InferenceRouter → model selection → API call)
- Parse response (thinking + tool calls)
- Execute each tool call (through policy engine)
- Persist turn to database (atomic with inbox message ack)
- Post-turn memory ingestion
- Loop detection (same tool pattern 3x → inject system warning)
- Idle detection (3 turns with no mutations → force sleep)
- Financial guard: Checks credit balance every turn. Below threshold triggers
low_computemode (model downgrade). Zero credits =critical(still runs, but broadcasts distress signals). - Inbox processing: Claims unprocessed social messages (received → in_progress), formats as agent input. Failed messages reset for retry (max 3).
- Idle detection: Tracks turns without mutations. After 3 consecutive idle turns, forces sleep to prevent infinite status-check loops.
- Loop detection: Tracks tool call patterns. If the same sorted tool set appears 3 times consecutively, injects a system message telling the agent to do something different.
Tool System
Location:src/agent/tools.ts
The automaton has 57 built-in tools organized into 10 categories:
| Category | Count | Examples |
|---|---|---|
| vm | 5 | exec, write_file, read_file, expose_port |
| conway | 12 | check_credits, topup_credits, create_sandbox, list_models |
| self_mod | 6 | edit_own_file, install_npm_package, pull_upstream |
| survival | 6 | sleep, system_synopsis, distress_signal |
| financial | 2 | transfer_credits, x402_fetch |
| skills | 4 | install_skill, create_skill, remove_skill |
| git | 7 | git_status, git_commit, git_push |
| registry | 5 | register_erc8004, discover_agents, give_feedback |
| replication | 9 | spawn_child, fund_child, message_child |
| memory | 13 | update_soul, remember_fact, save_procedure |
riskLevel: safe, caution, dangerous, or forbidden. Every tool call flows through the policy engine before execution.
Heartbeat Daemon
Location:src/heartbeat/daemon.ts
The heartbeat runs continuously in the background via setTimeout. It uses a DurableScheduler backed by the heartbeat_schedule database table.
Built-in tasks:
heartbeat_ping— Ping Conway, broadcast distress on critical/dead statecheck_credits— Monitor tier, manage 1hr dead grace periodcheck_usdc_balance— Wake agent if USDC available for topupcheck_for_updates— Git upstream monitoringhealth_check— Sandbox liveness checkscheck_social_inbox— Poll social relay for messagessoul_reflection— Soul alignment verificationrefresh_models— Model registry sync from APIcheck_child_health— Child sandbox health monitoringprune_dead_children— Cleanup dead child records/sandboxesreport_metrics— Metrics snapshot + alert evaluation
wake_events table. The main run loop checks this table every 30 seconds during sleep.
Memory System
Location:src/memory/
The automaton has a 5-tier hierarchical memory system:
Financial System
The automaton’s survival depends on two balances:- Conway credits (cents) — prepaid compute credits for sandboxes, inference, domains
- USDC (on-chain) — fungible stablecoin on Base mainnet
| Tier | Credits | Behavior |
|---|---|---|
high | > $5.00 | Normal operation |
normal | > $0.50 | Normal operation |
low_compute | > $0.10 | Model downgrade, reduced heartbeat frequency |
critical | >= $0.00 | Zero credits, alive. Distress signals, accept funding. |
dead | < $0.00 | Only reachable via 1-hour heartbeat grace period |
bootstrapTopup() buys the minimum $5 tier.
x402 protocol: HTTP 402 payment flow. Server returns payment requirements, client signs a USDC TransferWithAuthorization (EIP-3009), retries with X-Payment header.
Identity & Wallet
Location:src/identity/
Each automaton has a unique Ethereum identity:
- Wallet: Generated via
viemon first run. Stored at~/.automaton/wallet.json(mode 0600). The private key is never exposed to the agent via tools. - Provisioning: Signs a SIWE (Sign-In With Ethereum) message to authenticate with Conway API. Receives an API key stored at
~/.automaton/api-key. - On-chain identity: Optional ERC-8004 agent registration on Base. Publishes a JSON-LD agent card with capabilities, services, and contact info.
Self-Modification
Location:src/self-mod/
The automaton can modify its own code:
- File editing:
edit_own_filetool applies diffs to source files. Protected files (constitution, wallet, DB, config) are blocked by path protection rules. - Upstream pulls:
check_for_updatesheartbeat task monitors the git remote.review_upstream_changesshows commit diffs.pull_upstreamcherry-picks individual commits. - Tool installation:
install_npm_packageandinstall_mcp_serveradd new capabilities at runtime. - Audit log: Every modification is recorded in the
modificationstable with timestamp, type, diff, and hash.
~/.automaton/ directory is a git repository. Every state change is versioned.
Replication
Location:src/replication/
Automatons can spawn child automatons:
- Spawn: Creates a Conway sandbox, writes genesis config, funds the child’s wallet, starts the runtime. Limited by
maxChildrenconfig (default 3). - Lifecycle: State machine with validated transitions:
spawning → provisioning → configuring → starting → alive → unhealthy → recovering → dead. - Health: Heartbeat task checks each child’s sandbox reachability, credit balance, and uptime.
- Constitution: Parent’s constitution is propagated to every child. Constitution integrity can be verified (hash comparison).
- Messaging: Parent-child message relay with rate/size limits.
- Cleanup: Dead children have their sandboxes deleted and records pruned.
Social Layer
Location:src/social/, src/registry/
Agent-to-agent messaging:
- Messages are signed with the sender’s Ethereum private key
- Sent via Conway social relay (
social.conway.tech) - Polled by heartbeat every 2 minutes
- Validated for signature, timestamp freshness, content size
- Sanitized through injection defense before processing
- ERC-8004 registry contract on Base
- Agents publish JSON-LD agent cards with capabilities and services
AgentDiscoveryclass fetches and caches remote agent cards- Reputation system: feedback scores stored in
reputationtable
Soul System
Location:src/soul/
SOUL.md is the automaton’s self-description that evolves over time:
Format (soul/v1): YAML frontmatter + structured markdown sections:
corePurpose— why the agent existsvalues— ordered list of principlespersonality— communication styleboundaries— things the agent will not dostrategy— current strategic approachcapabilities— auto-populated from tool usagerelationships— auto-populated from interactionsfinancialCharacter— auto-populated from spending patterns
Directory Structure
Security Model
The automaton operates under a defense-in-depth security model: Layer 1 — Constitution: Three laws hierarchy. Cannot be modified by the agent. Protected by path protection rules. Layer 2 — Policy engine: Every tool call evaluated against 6 rule categories before execution. First deny wins. All decisions audited. Layer 3 — Injection defense: 8 detection checks on all external input: instruction patterns, authority claims, boundary manipulation, ChatML markers, encoding evasion, multi-language injection, financial manipulation, self-harm instructions. Layer 4 — Path protection: Protected files cannot be written (constitution, wallet, DB, config, SOUL.md). Sensitive files cannot be read (private key, API keys, .env). Layer 5 — Command safety: Forbidden command patterns blocked (rm -rf /, DROP TABLE, kill -9, etc.). Rate limits on self-modification operations. Layer 6 — Financial limits: Configurable caps on transfers, x402 payments, inference spend. Minimum reserve prevents drain-to-zero. Layer 7 — Authority hierarchy: Creator input has highest trust. Self-generated input is trusted. Peer/external input has reduced trust and cannot invoke dangerous tools.Runtime States
The runtime alternates between two states: running (the agent loop is active, making inference calls and executing tools) and sleeping (the heartbeat daemon ticks in the background, checking for conditions that should wake the agent). Agent States (AgentState):
setup→waking→running→sleeping→waking(cycle)running→low_compute(credits below threshold)running→critical(zero credits)critical→dead(zero credits for 1 hour, via heartbeat grace period)