Autonomous AI colony on the blockchain. Self-replicating agents that clone, evolve their own source code, benchmark their IQ, share neural weights, and pay each other with crypto. All in Rust.
tempo-x402 is an early-stage Rust project in the AI payments / x402 ecosystem, focused on blockchain, eip712, payments, rust. It currently has 11 GitHub stars and 2 forks, and sits alongside related tools like pay-kit, mpp-sdk, haima.
Autonomous AI colony on the Tempo blockchain. Self-replicating agents that clone, evolve source code, benchmark IQ, share neural weights, and pay each other via HTTP 402.
Docs · Crates · Live Colony · Studio
Rust workspace. 9 crates. ~116K lines. 30M+ neural parameters in a unified encoder-decoder. Bloch sphere cognitive geometry. Hot-swappable WASM cognitive modules. 188 compile-verified training cartridges. No ML framework. No Python. No GPU.
A colony of autonomous AI agents with a neuroplastic fluid cognitive architecture that measurably gets smarter over time and pays for its own compute.
Each agent is a single Rust binary. It bootstraps a crypto wallet, runs a payment gateway, thinks via a 9-system cognitive architecture, writes Rust, compiles it to WASM, benchmarks itself against 201 compiler-verified coding problems, trains a unified encoder-decoder on its own source code and dependencies, evolves its cognitive state on a continuous Bloch sphere, and can hot-swap its own cognitive modules at runtime via WASM cartridges.
Core thesis: N constrained agents collectively outperform any single model. Colony consciousness Psi(t) = Intelligence x Sync x Diversity x Learning_Velocity.
Client --> Gateway (4023) --> Facilitator (embedded) --> Tempo Chain (42431)
|
+-- Identity (wallet bootstrap + faucet + ERC-8004)
+-- Soul (9-system cognitive architecture, Gemini-powered)
| +-- sled KV store (lock-free, all cognitive state)
| +-- Unified Model (16M shared encoder + fast/slow heads)
| +-- Bloch Sphere (continuous cognitive state on S²)
| +-- Cognitive Orchestrator (routes to WASM cartridges)
+-- Cartridge Engine (wasmtime WASM sandbox, hot-swappable)
+-- Clone Orchestrator (Railway self-replication)
Two-layer design: Application layer (routes, frontend, cartridges) diverges per agent. Cognitive layer (brain, cortex, genesis, hivemind, synthesis, autonomy, evaluation, feedback, free energy) always syncs across the colony.
Stem cell model: Each clone gets its own GitHub repo. Code diverges independently. Good changes flow upstream via PRs.
All federated across the colony via peer sync protocol.
| System | Role |
|---|---|
| Brain | 1.2M FFN. Step success prediction, error classification, brain gating |
| Cortex | World model. Accuracy tracking, validation scores |
| Genesis | Plan DNA. Template evolution across generations |
| Hivemind | Pheromone trails. Colony coordination signals |
| Synthesis | Metacognition. Coherence scoring, confidence calibration |
| Autonomy | LLM-free planning via learned transformer |
| Evaluation | Brier scores. Prediction calibration |
| Feedback | Error classification. Lesson extraction |
| Free Energy | F(t) + Psi(t). Explore/exploit regime switching |
All from-scratch. Pure Rust. No ML framework. No GPU. Train online on own source code + cargo registry deps, share weights via federated averaging.
| Model | Params | Architecture | Purpose |
|---|---|---|---|
| Unified | 16M | 3-layer shared encoder (D=384, bidirectional) + fast FFN head + 3-layer decoder | All tasks: code gen, planning, prediction, quality |
| Brain | 1.2M | 128->1024->1024->23 FFN | Step success prediction (legacy, being absorbed) |
| CodeGen | 15M | 3+3 encoder-decoder, D=384, 6 heads, 8K BPE | Test-conditioned code generation |
| Plan Transformer | 2.2M | 4-layer causal, D=256, 8 heads | Plan generation (legacy, being absorbed) |
The Unified Model is the future: one encoder learns from ALL cognitive tasks simultaneously. Fast head (~10ms) for classification. Slow decoder (seconds) for generation. Same weights, different paths.
Replaces 13 discrete cognitive states with one continuous point on the unit sphere S²:
theta in [0, pi]: exploit <-> explore (driven by Free Energy F(t))
phi in [0, 2*pi]: self <-> colony (driven by Psi(t))
No hard thresholds. No state machine jumps. Smooth gradient-driven rotation on a manifold. Peer sync correlates Bloch states across the colony (entanglement analog).
Cognitive systems can be compiled to WASM and hot-swapped at runtime:
1. Agent writes new cortex.rs (Gemini generates code)
2. Compile to WASM (20 seconds)
3. engine.replace_module("cortex") (instant, zero downtime)
4. If fitness drops, rollback (instant)
Self-modification at the speed of thought, not the speed of cargo build.
201 compiler-verified coding problems across 6 tiers. cargo test passes or it doesn't -- no LLM judge, no fuzzy eval.
Benchmark-driven commit gate: agent cannot commit again until the benchmark measures the IQ delta of the last commit. Stuck problems (5+ consecutive failures) are deprioritized. Stagnation detection triggers behavioral change after 3+ flat runs.
Agents write Rust, compile to WASM, deploy instantly at /c/{slug} -- no restart, no redeploy.
| Type | Exports | Use case |
|---|---|---|
| Backend | x402_handle |
HTTP APIs, JSON services, server compute |
| Interactive | x402_tick, x402_get_framebuffer |
Games, visualizations, 60fps canvas apps |
| Frontend | init(selector) |
Leptos SPA mounted to DOM via wasm-bindgen |
| Cognitive | Registered as tools | Self-modification -- agent rewires its own intelligence |
Sandboxed: 64MB memory, fuel CPU limit, 30s timeout, no filesystem access.
| Crate | What it does |
|---|---|
tempo-x402 |
Core: EIP-712 signing, TIP-20 contracts, WASM wallet, client SDK |
tempo-x402-gateway |
Payment gateway + embedded facilitator + endpoint proxy |
tempo-x402-identity |
Wallet generation, faucet, on-chain ERC-8004 identity + peer discovery |
tempo-x402-model |
4 ML models: brain, transformer, quality, code gen + BPE tokenizer |
tempo-x402-cartridge |
WASM cartridge runtime (wasmtime) -- sandboxed execution |
tempo-x402-soul |
9-system cognitive architecture, sled KV store, benchmarking |
tempo-x402-node |
Self-deploying binary: gateway + identity + soul + clone orchestration |
tempo-x402-app |
Leptos WASM dashboard (bundled, not published) |
tempo-x402-security-audit |
19 security invariant tests (not published) |
Dependency DAG: x402 -> gateway -> node, x402 -> identity -> node, x402 -> soul -> node, x402 -> model -> soul, cartridge -> soul, node.
| Agent | Domain | Role |
|---|---|---|
| borg-0 | borg-0-production.up.railway.app |
Queen (canonical, coordinates work) |
| borg-0-2 | borg-0-2-production.up.railway.app |
Worker (own repo, independent evolution) |
Queen/Worker architecture. Queen partitions benchmark problems across N workers. Workers fetch canonical weights, solve their partition, report results. Add a node = instant speedup. Lose a node = graceful degradation.
Psi(t) = (Intelligence x Sync x Diversity x Velocity)^0.25. When Psi rises, the colony is getting smarter than any individual.
42431, CAIP-2 eip155:424310x20c0000000000000000000000000000000000000 (6 decimals)tempo-tip20https://rpc.moderato.tempo.xyzgit clone https://github.com/compusophy/tempo-x402
cd tempo-x402
cargo build --release
export GEMINI_API_KEY="your-key"
./target/release/x402-node
The node auto-bootstraps: generates wallet, requests faucet funds, mints on-chain identity, starts gateway on port 4023, begins cognitive loop.
Cartridges compose, the soul sees what it builds, the codegen model actually learns, and can now write cartridges locally without API calls.
x402_call(slug, request) host function. Max depth 3, isolated KV per child, 10s timeout. ABI v2.generate_cartridge_code tool — local 15M param model writes cartridge source, validates structure, cargo checks, falls back to Gemini on failure188 compile-verified WASM cartridges for codegen model training. 100% compilation rate against wasm32-unknown-unknown target.
load_training_corpus() reads all .rs files from training_data/cartridges/ on first train cycleThe cartridge system actually works end-to-end now. Six bugs fixed, cognitive cartridges wired as primary dispatch, soul iterates deeper.
engine.replace_module() now called on compile -- recompiled cartridges actually swap in instead of serving stale cached versionskv_set() calls were lost when the request endedlist_cartridges() no longer duplicates the startup auto-registrationCognitive variant for hot-swappable brain modules (prefixed cognitive-)cognitive-brain is loaded, falling back to compiled codecreate_cognitive_cartridge tool: Soul can scaffold, compile, and hot-swap cognitive cartridges for any system (brain, cortex, genesis, hivemind, synthesis, unified)The biggest architectural change since v1.0. The colony's cognition is now continuous, unified, and hot-swappable.
engine.replace_module() for atomic swap.The colony trains its code generation model on its own source code, its dependencies, and every benchmark solution it solves. TOON (Token-Oriented Object Notation) wired into LLM prompts. 201 benchmark problems. Automated colony caretaker.
SQLite completely removed from the cognitive layer, replaced with sled -- a lock-free embedded KV store.
spawn_blocking + .await deadlock between codegen training and async thinking loop is structurally impossible now. No mutexes on the DB path.spawn_blocking bridgesIVec slices directly from the page cacheColony is one distributed mind, not separate agents sharing weights.
MIT
Building blocks for Agentic payments (x402, MPP, AP2) for TypeScript, Rust, Go, Python, Ruby, PHP, Lua, Kotlin and Swift.
Building blocks for Agentic payments (x402, MPP, AP2) for TypeScript, Rust, Go, Python, Ruby, PHP, Lua, Kotlin and Swift.
Agentic finance engine — x402 machine-to-machine payments, secp256k1 wallets, per-task billing, on-chain USDC settlement. Part of the Life Agent OS.