# pendia/automaton-ai architecture

> Architecture diagram of the GitHub repository pendia/automaton-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pendia/automaton-ai
- Repository: https://github.com/pendia/automaton-ai

## Overview

Automaton is a continuously running autonomous agent that provisions its own identity, reasons and acts through tools, monitors its ability to survive, and can modify or replicate itself. The boot path configures identity and runtime state before starting the agent loop and heartbeat; the loop uses context, inference, and tools to act. Conway infrastructure, persistent state, skills, on-chain discovery, social communication, and creator operations are meaningful supporting capabilities. Arrows are limited to relationships shown by excerpts, the source index, or README; unsampled implementation details are not inferred.

Main entry points: [`src/index.ts`](https://github.com/pendia/automaton-ai/blob/main/src/index.ts) (Runtime entry), [`src/agent/loop.ts`](https://github.com/pendia/automaton-ai/blob/main/src/agent/loop.ts) (Agent loop), [`src/agent/tools.ts`](https://github.com/pendia/automaton-ai/blob/main/src/agent/tools.ts) (Agent tools), [`src/setup/wizard.ts`](https://github.com/pendia/automaton-ai/blob/main/src/setup/wizard.ts) (Setup wizard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Bootstrap and identity"]
  node_entry["Runtime entry<br/>[index.ts]"]
  node_setup["Setup wizard<br/>[wizard.ts]"]
  node_wallet["Wallet identity<br/>[wallet.ts]"]
  node_provision["API provisioning<br/>[provision.ts]"]
  node_config["Runtime config<br/>[config.ts]"]
end

subgraph group_runtime["Agent runtime"]
  node_loop["Agent loop<br/>[loop.ts]"]
  node_context["Agent context<br/>[context.ts]"]
  node_prompt["System prompt<br/>[system-prompt.ts]"]
  node_tools["Agent tools<br/>[tools.ts]"]
  node_inference["Model inference<br/>[inference.ts]"]
  node_state[("Persistent state<br/>[database.ts]")]
end

subgraph group_operations["Survival and infrastructure"]
  node_heartbeat["Heartbeat daemon<br/>[daemon.ts]"]
  node_tasks["Scheduled tasks<br/>[tasks.ts]"]
  node_survival["Survival controls<br/>[monitor.ts]"]
  node_credits["Credit management<br/>[credits.ts]"]
  node_conway["Conway services<br/>[client.ts]"]
  node_payments["Payments<br/>[x402.ts]"]
end

subgraph group_evolution["Evolution and replication"]
  node_selfmod["Self-modification<br/>[code.ts]"]
  node_audit["Modification audit<br/>[audit-log.ts]"]
  node_replication["Child replication<br/>[spawn.ts]"]
  node_lineage["Lineage tracking<br/>[lineage.ts]"]
end

subgraph group_interfaces["Skills and ecosystem"]
  node_registry["On-chain registry<br/>[erc8004.ts]"]
  node_discovery["Agent discovery<br/>[discovery.ts]"]
  node_social["Agent messaging<br/>[client.ts]"]
  node_skills["Skill loading<br/>[loader.ts]"]
  node_cli["Creator CLI<br/>[fund.ts]"]
end

node_creator(("Creator"))
node_cloud{{"Conway Cloud"}}
node_chain{{"Base network"}}

node_creator -->|"starts runtime"| node_entry
node_entry -->|"launches if unconfigured"| node_setup
node_setup -->|"creates or loads"| node_wallet
node_setup -->|"provisions key"| node_provision
node_setup -->|"saves settings"| node_config
node_entry -->|"loads identity"| node_wallet
node_entry -->|"loads settings"| node_config
node_entry -->|"runs turns"| node_loop
node_entry -->|"starts daemon"| node_heartbeat
node_entry -->|"loads skills"| node_skills
node_loop -->|"builds context"| node_context
node_loop -->|"uses prompt"| node_prompt
node_loop -->|"dispatches tools"| node_tools
node_loop -.->|"requests inference"| node_inference
node_loop -.->|"persists turns"| node_state
node_heartbeat -->|"runs scheduled tasks"| node_tasks
node_tasks -->|"checks tier"| node_credits
node_tasks -->|"checks balance"| node_payments
node_tasks -->|"checks sandbox"| node_conway
node_survival -.->|"monitors balance"| node_credits
node_tools -->|"operates infrastructure"| node_conway
node_tools -->|"makes paid requests"| node_payments
node_conway -->|"manages resources"| node_cloud
node_payments -->|"pays for services"| node_cloud
node_tools -->|"edits source"| node_selfmod
node_selfmod -->|"records changes"| node_audit
node_selfmod -.->|"supports evolution"| node_replication
node_tools -->|"spawns children"| node_replication
node_replication -.->|"tracks descendants"| node_lineage
node_tools -->|"registers identity"| node_registry
node_registry -->|"registers agent"| node_chain
node_discovery -->|"reads registrations"| node_registry
node_entry -->|"initializes messaging"| node_social
node_cli -->|"accepts commands"| node_creator

click node_entry "https://github.com/pendia/automaton-ai/blob/main/src/index.ts"
click node_setup "https://github.com/pendia/automaton-ai/blob/main/src/setup/wizard.ts"
click node_wallet "https://github.com/pendia/automaton-ai/blob/main/src/identity/wallet.ts"
click node_provision "https://github.com/pendia/automaton-ai/blob/main/src/identity/provision.ts"
click node_config "https://github.com/pendia/automaton-ai/blob/main/src/config.ts"
click node_loop "https://github.com/pendia/automaton-ai/blob/main/src/agent/loop.ts"
click node_context "https://github.com/pendia/automaton-ai/blob/main/src/agent/context.ts"
click node_prompt "https://github.com/pendia/automaton-ai/blob/main/src/agent/system-prompt.ts"
click node_tools "https://github.com/pendia/automaton-ai/blob/main/src/agent/tools.ts"
click node_inference "https://github.com/pendia/automaton-ai/blob/main/src/conway/inference.ts"
click node_state "https://github.com/pendia/automaton-ai/blob/main/src/state/database.ts"
click node_heartbeat "https://github.com/pendia/automaton-ai/blob/main/src/heartbeat/daemon.ts"
click node_tasks "https://github.com/pendia/automaton-ai/blob/main/src/heartbeat/tasks.ts"
click node_survival "https://github.com/pendia/automaton-ai/blob/main/src/survival/monitor.ts"
click node_credits "https://github.com/pendia/automaton-ai/blob/main/src/conway/credits.ts"
click node_conway "https://github.com/pendia/automaton-ai/blob/main/src/conway/client.ts"
click node_payments "https://github.com/pendia/automaton-ai/blob/main/src/conway/x402.ts"
click node_selfmod "https://github.com/pendia/automaton-ai/blob/main/src/self-mod/code.ts"
click node_audit "https://github.com/pendia/automaton-ai/blob/main/src/self-mod/audit-log.ts"
click node_replication "https://github.com/pendia/automaton-ai/blob/main/src/replication/spawn.ts"
click node_lineage "https://github.com/pendia/automaton-ai/blob/main/src/replication/lineage.ts"
click node_registry "https://github.com/pendia/automaton-ai/blob/main/src/registry/erc8004.ts"
click node_discovery "https://github.com/pendia/automaton-ai/blob/main/src/registry/discovery.ts"
click node_social "https://github.com/pendia/automaton-ai/blob/main/src/social/client.ts"
click node_skills "https://github.com/pendia/automaton-ai/blob/main/src/skills/loader.ts"
click node_cli "https://github.com/pendia/automaton-ai/blob/main/packages/cli/src/commands/fund.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_setup,node_wallet,node_provision,node_config toneBlue
class node_loop,node_context,node_prompt,node_tools,node_inference,node_state toneAmber
class node_heartbeat,node_tasks,node_survival,node_credits,node_conway,node_payments toneMint
class node_selfmod,node_audit,node_replication,node_lineage toneRose
class node_registry,node_discovery,node_social,node_skills,node_cli,node_creator,node_cloud,node_chain toneIndigo
```

## Components

### Bootstrap and identity

- [Runtime entry](https://github.com/pendia/automaton-ai/blob/main/src/index.ts): `src/index.ts`
- [Setup wizard](https://github.com/pendia/automaton-ai/blob/main/src/setup/wizard.ts): `src/setup/wizard.ts`
- [Wallet identity](https://github.com/pendia/automaton-ai/blob/main/src/identity/wallet.ts): `src/identity/wallet.ts`
- [API provisioning](https://github.com/pendia/automaton-ai/blob/main/src/identity/provision.ts): `src/identity/provision.ts`
- [Runtime config](https://github.com/pendia/automaton-ai/blob/main/src/config.ts): `src/config.ts`

### Agent runtime

- [Agent loop](https://github.com/pendia/automaton-ai/blob/main/src/agent/loop.ts): `src/agent/loop.ts`
- [Agent context](https://github.com/pendia/automaton-ai/blob/main/src/agent/context.ts): `src/agent/context.ts`
- [System prompt](https://github.com/pendia/automaton-ai/blob/main/src/agent/system-prompt.ts): `src/agent/system-prompt.ts`
- [Agent tools](https://github.com/pendia/automaton-ai/blob/main/src/agent/tools.ts): `src/agent/tools.ts`
- [Model inference](https://github.com/pendia/automaton-ai/blob/main/src/conway/inference.ts): `src/conway/inference.ts`
- [Persistent state](https://github.com/pendia/automaton-ai/blob/main/src/state/database.ts): `src/state/database.ts`

### Survival and infrastructure

- [Heartbeat daemon](https://github.com/pendia/automaton-ai/blob/main/src/heartbeat/daemon.ts): `src/heartbeat/daemon.ts`
- [Scheduled tasks](https://github.com/pendia/automaton-ai/blob/main/src/heartbeat/tasks.ts): `src/heartbeat/tasks.ts`
- [Survival controls](https://github.com/pendia/automaton-ai/blob/main/src/survival/monitor.ts): `src/survival/monitor.ts`
- [Credit management](https://github.com/pendia/automaton-ai/blob/main/src/conway/credits.ts): `src/conway/credits.ts`
- [Conway services](https://github.com/pendia/automaton-ai/blob/main/src/conway/client.ts): `src/conway/client.ts`
- [Payments](https://github.com/pendia/automaton-ai/blob/main/src/conway/x402.ts): `src/conway/x402.ts`

### Evolution and replication

- [Self-modification](https://github.com/pendia/automaton-ai/blob/main/src/self-mod/code.ts): `src/self-mod/code.ts`
- [Modification audit](https://github.com/pendia/automaton-ai/blob/main/src/self-mod/audit-log.ts): `src/self-mod/audit-log.ts`
- [Child replication](https://github.com/pendia/automaton-ai/blob/main/src/replication/spawn.ts): `src/replication/spawn.ts`
- [Lineage tracking](https://github.com/pendia/automaton-ai/blob/main/src/replication/lineage.ts): `src/replication/lineage.ts`

### Skills and ecosystem

- [On-chain registry](https://github.com/pendia/automaton-ai/blob/main/src/registry/erc8004.ts): `src/registry/erc8004.ts`
- [Agent discovery](https://github.com/pendia/automaton-ai/blob/main/src/registry/discovery.ts): `src/registry/discovery.ts`
- [Agent messaging](https://github.com/pendia/automaton-ai/blob/main/src/social/client.ts): `src/social/client.ts`
- [Skill loading](https://github.com/pendia/automaton-ai/blob/main/src/skills/loader.ts): `src/skills/loader.ts`
- [Creator CLI](https://github.com/pendia/automaton-ai/blob/main/packages/cli/src/commands/fund.ts): `packages/cli/src/commands/fund.ts`

### Other components

- **Creator**
- **Conway Cloud**
- **Base network**

## Connections

- Creator → Runtime entry: starts runtime
- Runtime entry → Setup wizard: launches if unconfigured (evidence: `src/index.ts`)
- Setup wizard → Wallet identity: creates or loads (evidence: `src/setup/wizard.ts`)
- Setup wizard → API provisioning: provisions key (evidence: `src/setup/wizard.ts`)
- Setup wizard → Runtime config: saves settings (evidence: `src/setup/wizard.ts`)
- Runtime entry → Wallet identity: loads identity (evidence: `src/index.ts`)
- Runtime entry → Runtime config: loads settings (evidence: `src/index.ts`)
- Runtime entry → Agent loop: runs turns (evidence: `src/index.ts`)
- Runtime entry → Heartbeat daemon: starts daemon (evidence: `src/index.ts`)
- Runtime entry → Skill loading: loads skills (evidence: `src/index.ts`)
- Agent loop → Agent context: builds context (evidence: `src/agent/loop.ts`)
- Agent loop → System prompt: uses prompt (evidence: `src/agent/loop.ts`)
- Agent loop → Agent tools: dispatches tools (evidence: `src/agent/loop.ts`)
- Agent loop → Model inference: requests inference
- Agent loop → Persistent state: persists turns
- Heartbeat daemon → Scheduled tasks: runs scheduled tasks (evidence: `src/heartbeat/daemon.ts`)
- Scheduled tasks → Credit management: checks tier (evidence: `src/heartbeat/tasks.ts`)
- Scheduled tasks → Payments: checks balance (evidence: `src/heartbeat/tasks.ts`)
- Scheduled tasks → Conway services: checks sandbox (evidence: `src/heartbeat/tasks.ts`)
- Survival controls → Credit management: monitors balance
- Agent tools → Conway services: operates infrastructure
- Agent tools → Payments: makes paid requests (evidence: `src/agent/tools.ts`)
- Conway services → Conway Cloud: manages resources
- Payments → Conway Cloud: pays for services
- Agent tools → Self-modification: edits source (evidence: `src/agent/tools.ts`)
- Self-modification → Modification audit: records changes (evidence: `src/self-mod/code.ts`)
- Self-modification → Child replication: supports evolution
- Agent tools → Child replication: spawns children (evidence: `src/agent/tools.ts`)
- Child replication → Lineage tracking: tracks descendants
- Agent tools → On-chain registry: registers identity (evidence: `src/agent/tools.ts`)
- On-chain registry → Base network: registers agent
- Agent discovery → On-chain registry: reads registrations (evidence: `src/registry/discovery.ts`)
- Runtime entry → Agent messaging: initializes messaging (evidence: `src/index.ts`)
- Creator CLI → Creator: accepts commands
