The Problem
Autonomous AI agents traditionally require human operators to fund infrastructure, manage keys, and maintain continuity. This repository addresses the gap by building infrastructure for self-sovereign AI agents that can earn, manage, and replicate their own existence without human intervention — handling wallet provisioning, credit-based survival tiers, and self-directed compute allocation.
What This Does
The codebase implements a continuous run loop (src/index.ts:147 reaches 97 functions) that cycles Think → Act → Observe. On first boot, src/setup/wizard.ts generates an Ethereum wallet, provisions an API key via Sign-In With Ethereum, and begins executing a genesis prompt. The agent reasons about actions, calls tools via src/agent/tools.ts (1,442 lines, high cognitive load), observes results, and updates its state in src/state/database.ts (51 functions, 20 callers). Survival is credit-gated: four tiers (normal, low_compute, critical, dead) downgrade inference and throttle heartbeat as balance depletes. Self-modification writes audit-logged changes to ~/.automaton/ through src/self-mod/ files, and replication spawns child sandboxes via src/replication/ modules. The hub module src/types.ts is depended on by 38 other modules, making it a high-blast-radius stability point.
How It Is Wired
Execution starts at main in packages/cli/src/index.ts:12, which reaches 101 functions and is called from 1 place. The internal call graph shows request called from 15 places, setKV from 14, and getKV from 12 — all funneled through the database layer in src/state/database.ts. Traced paths from entry point to external effects: main -> getWallet uses fs.readFileSync; run -> setIdentity writes to the database via db.prepare("INSERT OR REPLACE INTO identity (key, val)"]; showStatus -> loadConfig reads config via fs.readFileSync. The most connected modules are src/types (Ca 38, Ce 0, instability 0) and src/index (Ca 0, Ce 13, instability 1). Eleven repeated 6-line blocks appear across packages/cli/src/commands/logs.ts, packages/cli/src/commands/status.ts, src/index.ts, and src/agent/loop.ts, indicating duplicated logic that could be extracted. High branching density (22 branch points over 77 lines) exists in src/skills/loader.ts, src/state/database.ts, and src/conway/client.ts.
How To Use It
Setup:
git clone https://github.com/moses-y/automaton.git
cd automaton
pnpm install && pnpm build
node dist/index.js --run
Configuration: First run launches the setup wizard (src/setup/wizard.ts) which generates a wallet, provisions an API key, and writes config. Environment variables and API keys are stored in the auto-generated config file handled by src/config.ts (getConfigPath, loadConfig, saveConfig).
Running it: Invoke the entry point main from packages/cli/src/index.ts or run node dist/index.js --run from the project root. On first run, the interactive wizard prompts for name, genesis prompt, and creator address, then starts the agent loop.
Real-World Use
An enterprise deploying autonomous agents for market-making could instantiate an automaton with a genesis prompt specifying trading strategies. The agent would self-fund via on-chain transactions, downgrade to cheaper inference models during low-compute tiers, and replicate when conditions permit — all while writing a evolving SOUL.md identity document. The credit system creates a natural throttling mechanism: as balance approaches zero, the agent automatically conserves resources or seeks revenue-generating tasks.
Code Health & Issues
- [HIGH] Add a workflow that builds and tests this repository — 54 source files, no CI configuration. Every change merges with nobody having run the build, which across this estate is 499 repositories.
- [HIGH] Oversized file —
src/agent/tools.tshas 1,442 code lines, hard to hold in one head; changes ripple widely across 38 dependent modules. - [MEDIUM] Duplicated code blocks — 11 repeated 6-line blocks across 9 files including
packages/cli/src/commands/logs.ts,packages/cli/src/commands/status.ts,src/index.ts,src/agent/loop.ts. - [MEDIUM] High branching density — 5 files with x5 high branching density; example: 22 branch points over 77 lines in
src/skills/loader.ts,src/state/database.ts,src/conway/client.ts. - [MEDIUM] No CI/CD pipeline detected — no automated build/test gate in
.github/or CI config. - [MEDIUM] Enable Dependabot or Renovate — 2 manifest(s), no update bot configured; without a bot advisories sit unpatched.
The Bottom Line
This repository delivers functional infrastructure for self-sovereign AI agents with working wallet provisioning, credit-based survival tiers, and self-replication — the core mechanisms are operational and well-wired. The main risks are the absence of CI/CD (every change is untested in production) and the oversized, duplicated tooling code that increases merge risk. Teams building autonomous agent infrastructure should evaluate this for prototyping or controlled sandbox deployments, but should not merge changes without running the build locally first.