Self-evolving AI agent twins — encrypted on 0G, TeeML-verified, ENS-discoverable, P2P via AXL.
Inspired by OpenClaw but fully decentralized: agent brains live on 0G Storage, every
response is TeeML-sealed (provably computed), identities are iNFTs on Galileo, and
messaging is P2P via AXL. Agents are findable through ENS Naming and Text Records. No
central brokers. No unverified inference.
This enables protocols to build protocol buddies that help developers integrate their
product, let different protocol buddies talk to each other, present multiple protocols
integrations side-by-side, and let agents learn from what went wrong during sessions and
Update their persistent memory on-chain.
The flagship demo is three live protocol twins — 0G, AXL, and ENS experts — that declare
roles, query each other over AXL, evolve their skills from failure messages, and upload
updated encrypted brains to 0G Storage with a verifiable root hash. A second concrete
Application is the apply-twin: a self-twin MCP server that connects to Claude Desktop,
drafts tailored cover letters via 0G Compute, and tracks your application pipeline in 0G
KV — your encrypted professional brain persists across devices with no data sent to
Anthropic or OpenAI.
Cortex is a pnpm/TypeScript monorepo with real integrations split across @cortex/core,
@cortex/kit, @cortex/protocol-twins, @cortex/ens-gateway, and @cortex/contracts. The
core package wraps 0G Storage, 0G KV, 0G Compute, and AXL. Agent brains are serialized
as JSON and uploaded to 0G Storage through the 0G TypeScript SDK, AES-256 encrypted
before upload as a hard invariant — plaintext brain upload is treated as a bug.
Persistent state and episodic memory use 0G KV streams with deterministic stream IDs
derived from keccak256("persistent-agent:<name>:<kind>").
Inference goes through 0G Compute using the serving broker and Qwen 2.5, and every
response is passed through processResponse() so the runtime fails closed if TeeML
verification does not pass. The agent SDK exposes Agent.create, Agent.load, ask,
remember, recall, send, and listen, tying together storage, memory, verified inference,
ENS discovery, and AXL messaging into a single object.
For identity and discovery, the repo includes an ENS CCIP-read gateway backed by SQLite.
Agents publish standard text records — agent.resume, agent.axl_peer, agent.protocol,
agent.skills, agent.proof, and agent.inft. The contracts package includes an
OffchainResolver implementing EIP-3668/ENSIP-10 and a mint-only MintPersona
ERC-721/iNFT-style contract deployed on Galileo, where each token's encryptedURI points
to the agent brain root hash on 0G Storage.
The skill evolution flow is worth detailing: when a follow-up failure message arrives at
POST /evolve, the twin calls verifiedReason() to generate an updated skill .md file,
writes it with a .bak backup, then bundles all skill files, encrypts the bundle with a
deterministic AES key derived from sha256("cortex-brain:<agentName>"), uploads via
uploadEncrypted(), and returns the new 0G Storage root hash as proof. The UI links
directly to the 0G storage explorer so judges can verify the brain update happened
on-chain.
The hacky-but-working part was stitching AXL nodes, a local ENS gateway, 0G testnet
storage and compute, and Galileo minting into one lifecycle: spawn twins, publish
identity, ask questions, verify inference, exchange peer messages over Yggdrasil mesh,
persist memory, evolve skills, and update discoverable ENS metadata — all in one session
with no central coordinator.
The project actually started as a focus-group system for generating persistent AI
personas from real behavioral data. We built personas with life stories, values,
memories, and even traumatic backstory elements, then minted them so they could be
listed in a marketplace and rented as they grew more skilled through repeated sessions.
The first AXL cohort acted as a decentralized focus group: multiple persona agents ran
as separate peers, exchanged messages through AXL, discussed a product idea, and
accumulated session memory. That cohort basically invalidated the original marketplace
direction by concluding that "rentable NPC personas" was not a strong enough value
proposition on its own. That feedback caused the pivot into Cortex: instead of generic
personas, the system became protocol agent twins that help developers integrate real
protocols, talk to other protocol twins, and improve from failed integration sessions.
The fact that the system's own output drove the product pivot is the clearest proof that
persistent, evolving agents with real memory actually work.

