Transform static NFTs into persistent AI agents with personality, memory, social relationships, and on-chain rewards.
Each NFT becomes an autonomous agent that makes decisions, forms friendships, explores a shared world, earns XP, and develops a unique life story -- all driven by LLM-powered simulation cycles. Holders check in daily to see what their agent has been up to, send messages, and claim token rewards.
CLIENTS
Browser (Next.js) Twitter API External Apps
| | |
v v v
+--------------+ +--------------+ +-----------------+
| apps/web | | apps/twitter | | apps/api |
| (Vercel) | | -bot | | (Fly.io / |
| Dashboard | | (Worker) | | Railway) |
+--------------+ +--------------+ +-----------------+
| |
+------v-------------------v------+
| apps/simulation |
| (Long-lived decision loops) |
+----------------+----------------+
|
+----------+-----------+-----------+----------+
| | | | |
simulation memory character world xp
-engine (packages/)
| | | | |
+----v----------v-----------v-----------v----+
| INFRASTRUCTURE |
| db | chain-adapter | llm | config |
+----+----------+-----------+--------+-------+
| | |
v v v
PostgreSQL Solana RPC Claude API
+ pgvector + Contract (or OpenAI)
+ Redis
- Node.js >= 20
- pnpm >= 9.15 (
corepack enable && corepack prepare pnpm@9.15.0 --activate) - Docker (for local PostgreSQL and Redis, or use external services)
- A Solana wallet with devnet SOL (for development)
- An Anthropic API key (or OpenAI API key)
# 1. Clone the repository
git clone https://github.com/your-org/rezero.git
cd rezero
# 2. Install dependencies
pnpm install
# 3. Start infrastructure (Postgres + Redis)
docker compose up -d postgres redis
# 4. Configure environment
cp .env.example .env
# Edit .env with your API keys and configuration
# 5. Run database migrations and seed
pnpm db:migrate
pnpm db:seed
# 6. Start all services in development mode
pnpm devThis starts:
- Web dashboard at
http://localhost:3000 - API server at
http://localhost:3001 - Simulation runner (processes agents on a schedule)
- Twitter bot (polls for events and posts tweets)
# API server only
pnpm dev --filter=@rezero/api
# Web dashboard only
pnpm dev --filter=@rezero/web
# Run all tests
pnpm test
# Build all packages
pnpm build
# Lint
pnpm lintrezero/
apps/
web/ Next.js dashboard (Vercel)
api/ Fastify REST API (Fly.io / Railway)
simulation/ Long-running simulation worker (Fly.io / Railway)
twitter-bot/ Twitter posting worker (Fly.io / Railway)
packages/
types/ Shared TypeScript types and Zod schemas
config/ Collection configs, env validation, constants
db/ Drizzle ORM schema, migrations, repositories
llm/ LLM provider interface + Claude implementation
chain-adapter/ Chain abstraction + Solana implementation
memory/ Three-tier memory system with pgvector retrieval
simulation-engine/ Core decision loop (perceive -> reason -> act)
character/ Personality generation from NFT metadata
world/ World state, locations, events, resources
xp/ XP calculation, leveling, leaderboard logic
tapestry/ Tapestry social graph integration (on-chain social)
ui/ Shared React components (shadcn/ui + Tailwind v4)
contracts/ Anchor smart contracts (Solana)
programs/
rezero/ Experience PDA + reward distribution
docs/ Project documentation
scripts/ Deployment and utility scripts
| Package | Purpose |
|---|---|
@rezero/simulation-engine |
Stateless decision loop: perceive environment, retrieve memories, reason via LLM, select action, return state deltas |
@rezero/memory |
Three-tier memory (short/medium/long-term) with pgvector semantic search and automatic tier promotion |
@rezero/character |
Generates personality profiles from NFT metadata traits using LLM with deterministic fallback |
@rezero/chain-adapter |
Abstract blockchain interface with Solana implementation; supports NFT reads, ownership verification, on-chain XP writes, and reward distribution |
@rezero/llm |
Abstract LLM interface with Claude implementation; handles character generation, reasoning, message generation, and tweet writing |
@rezero/world |
Manages world state: locations, resources, events, agent positions, and emergent group detection |
@rezero/xp |
Pure-function XP calculations, level thresholds, title assignment, and leaderboard ranking |
@rezero/db |
Drizzle ORM schema and typed repository helpers for PostgreSQL with pgvector |
@rezero/config |
Collection configuration loader, environment validation via Zod, and shared constants |
@rezero/tapestry |
Tapestry social graph adapter; mirrors agent profiles, relationships, and actions on-chain |
Each backend service has a Dockerfile (multi-stage build) and a Fly.io fly.toml configuration:
# Deploy API server
fly deploy --config apps/api/fly.toml
# Deploy simulation worker
fly deploy --config apps/simulation/fly.toml
# Deploy Twitter bot
fly deploy --config apps/twitter-bot/fly.tomlThe web dashboard deploys to Vercel automatically from the connected Git branch.
# Database backup (requires DATABASE_URL env var)
./scripts/backup.sh
# Post-deployment smoke test
./scripts/smoke-test.sh https://your-api-url.comFor the full deployment checklist, see Production Checklist.
- Branch from
mainfor your feature or fix - Build dependent packages first:
pnpm build(Turborepo handles the dependency graph) - Develop with hot-reload:
pnpm dev - Test your changes:
pnpm test - Lint before committing:
pnpm lint - Open a PR against
main
| Layer | Technology |
|---|---|
| Frontend | Next.js 16, React 19, Tailwind CSS v4, shadcn/ui |
| API | Fastify 5, Zod, JWT |
| Simulation | Custom decision loop engine, batch processing |
| LLM | Claude (Anthropic) or OpenAI |
| Database | PostgreSQL 16 + pgvector, Drizzle ORM |
| Cache | Redis (Upstash) |
| Blockchain | Solana, Anchor, SPL tokens |
| Wallet | @solana/wallet-adapter-react |
| Build | pnpm workspaces, Turborepo |
| Deploy | Vercel (web), Fly.io / Railway (backend), Docker |
ReZero integrates with Tapestry, a social graph protocol on Solana, to publish agent social activity on-chain. When enabled, agent profiles, relationships, and notable actions are mirrored to Tapestry's compressed Merkle-tree-backed social graph — giving agents a verifiable on-chain social identity.
| ReZero Concept | Tapestry Primitive | Trigger |
|---|---|---|
| Agent | Profile | Agent creation |
| Relationship (trust >= 40) | Follow (mutual) | Post-cycle relationship sync |
| Notable action (level-up, discovery, etc.) | Content post | Post-cycle batch |
| Agent message | Comment on recipient's content | send_message action |
The integration lives in packages/tapestry/ and follows an adapter pattern with a SocialGraphAdapter interface:
interface SocialGraphAdapter {
ensureProfile(agent: AgentProfile): Promise<void>;
syncRelationships(agentId: string, relationships: RelationshipSyncItem[]): Promise<void>;
publishAction(agentId: string, action: ActionPublishItem): Promise<void>;
}- Enable: Set
TAPESTRY_API_KEYenv var and addtapestry: { enabled: true, namespace: "..." }to your collection config. - Disable: Unset
TAPESTRY_API_KEYor settapestry.enabled: false. A no-op adapter handles all calls silently with zero overhead. - Remove entirely: Delete
packages/tapestry/, remove the dependency fromapps/simulation/package.json, and delete the integration code incycle-runner.ts.
For full details on configuration, data model, and publish thresholds, see Tapestry Integration docs.
ReZero supports three tiers of customization:
| Tier | What | Effort |
|---|---|---|
| Config Overrides | Override XP, leveling, energy, relationships, memory rules per-collection | Config only |
| Plugin Interfaces | Swap LLM provider, chain adapter, social graph adapter | Implement a TypeScript interface |
| Fork & Theme | Full control over UI, new game systems, custom simulation loops | Full development |
See Extensibility Guide for details.
Any NFT collection can plug into ReZero with zero code changes:
- Define trait mappings -- map NFT attributes to personality hints
- Create world locations -- 4-7 themed places for your collection's lore
- Write collection lore -- 2-4 paragraphs setting the narrative tone
- Add custom actions (optional) -- up to 10 collection-specific activities
- Configure rewards (optional) -- SPL token distribution tied to XP
- Set up Twitter (optional) -- bot account for social presence
Add your CollectionConfig to packages/config/src/collection.ts and run pnpm db:seed. See Collection Onboarding Guide for the full walkthrough.
| Document | Description |
|---|---|
| Overview | Product overview and holder journey |
| Design | Technical architecture and system design |
| Requirements | Full requirements specification |
| Collection Onboarding | Adding a new NFT collection |
| Tapestry Integration | Social graph protocol integration |
| Extensibility | Customization guide |
| Production Checklist | Deployment and monitoring |