AstraLife is an open-source AI civilization simulator where autonomous agents live, work, and interact in a persistent village. Each AI villager has their own memory, goals, personality, and relationships — creating a dynamic mini-world that evolves over time.
- 🧠 Real AI reasoning — Each villager's decisions are powered by Claude (Anthropic), not random scripts
- 💾 Memory — Villagers remember past events and interactions
- 🎯 Goals — They have ambitions that evolve over time
- 🤝 Relationships — Bonds, friendships, and rivalries form naturally
- ⚡ Inject world events — Throw a flood, festival, or stranger into the village and watch them react
- 🗺️ Live map — See agents move across the village in real time
- 📊 Dashboard — Track resources, happiness, relationships, and event logs
Perceive World → Think (Claude AI) → Decide → Act → Remember → Repeat
Every "tick", each villager receives:
- Their current goal and mood
- Their recent memory (last 3 events)
- Their relationships with other villagers
- Any world event you injected
Claude then decides what they do — move, trade, argue, help, or set a new goal.
- Node.js v18+
- An Anthropic API key
# Clone the repo
git clone https://github.com/marky1flag/AstraLife.git
cd AstraLife
# Install dependencies
npm install
# Set up your API key
cp .env.example .env
# Edit .env and add: ANTHROPIC_API_KEY=sk-ant-...
# Start the server
npm startOpen http://localhost:3000 in your browser. 🎉
| Agent | Role | Goal |
|---|---|---|
| 🌾 Lina | Farmer | Grow crops and feed the village |
| 🔨 Borin | Blacksmith | Forge tools for the village |
| 💰 Milo | Merchant | Maximize profit and expand trade |
| 🏗️ Tara | Builder | Build and upgrade structures |
| 👑 Eldric | Mayor | Grow the village and keep citizens happy |
- Fork this repo
- Connect to Railway
- Add
ANTHROPIC_API_KEYas an environment variable - Done — your village is live! 🚂
AstraLife/
├── server.js # Express backend, proxies to Anthropic API
├── package.json
├── .env.example # API key template
└── public/
└── index.html # Full frontend (map, agents, dashboard)
- Frontend — Vanilla JS, SVG, CSS (no frameworks)
- Backend — Node.js + Express
- AI — Claude Sonnet (Anthropic)
- Deploy — Railway
- More agent roles (Priest, Thief, Doctor)
- Persistent world (save/load village state)
- Agent-to-agent dialogue (visible conversations)
- Mobile-friendly UI
- Multi-village support
Contributions are welcome! Feel free to open an issue or submit a pull request.
git checkout -b feature/your-feature
git commit -m "add: your feature"
git push origin feature/your-featureInterior & character pixel art by LimeZu — Modern Interiors (free pack). Huge thanks! If you like the assets, consider supporting them on itch.io.
Code: MIT — free to use, modify, and share. Art assets: see LimeZu's license terms included in the asset pack.