Skip to content

immanencer/cosyworld8

Repository files navigation

CosyWorld - AI Avatar Ecosystem

0.0.8 Moonstone Sanctum 🌟

An advanced AI avatar ecosystem that creates persistent, intelligent entities with memory, combat mechanics, and cross-platform capabilities.

Features

  • 🤖 Advanced AI Integration: Multiple intelligence tiers from GPT-4 and Claude to Llama and other models
  • 🧠 Hierarchical Memory: Short-term, long-term, and emotional memory for meaningful interactions
  • ⚔️ Dynamic Combat: Strategic PvP battles with unique mechanics and consequences
  • 🧬 Avatar Breeding: Create unique avatars by combining traits and personalities
  • 🎭 Evolving Characters: Avatars develop based on interactions and experiences
  • 💾 Persistent Storage: MongoDB for dynamic data, S3 for assets, Arweave for permanent records
  • 🖼️ Image Generation: AI-powered visual avatars via Replicate API
  • 🌐 Cross-Platform: Support for Discord, Telegram, and X (Twitter)

Prerequisites

  • Node.js v18+
  • MongoDB database
  • S3-compatible storage
  • Discord Bot Token (for Discord integration)
  • OpenRouter API key (for AI model access)
  • Replicate API key (for image generation)

Environment Setup

Create a .env file with the following variables (see .env.example for a template):

# Core Configuration
NODE_ENV="development"
API_URL="http://localhost:3000"
PUBLIC_URL="http://localhost:3000"

# Database
MONGO_URI="mongodb://127.0.0.1:27017"
MONGO_DB_NAME="moonstone"

# AI Services
OPENROUTER_API_TOKEN="your_openrouter_token"
REPLICATE_API_TOKEN="your_replicate_token"

# Storage
S3_API_ENDPOINT="your_s3_endpoint"
S3_API_KEY="your_s3_key"
S3_API_SECRET="your_s3_secret"
CLOUDFRONT_DOMAIN="your_cdn_domain"

# Platform Integration
DISCORD_BOT_TOKEN="your_discord_bot_token"

Quick Start

  1. Install dependencies:
npm install
  1. Start both server and client:
npm start
  1. For frontend development:
npm run dev
  1. Run server only:
npm run serve
  1. For production build:
npm run build

Commands

Avatar Management

  • !summon [description] - Create or summon an existing avatar
  • !breed [avatar1] [avatar2] - Breed two avatars to create a new one

Combat System

  • !attack [avatar] - Initiate combat with another avatar
  • !defend - Take a defensive stance in combat

World Interaction

  • !explore [location] - Discover new areas and items
  • !remember [topic] - Access avatar memories on a topic

System Architecture

Moonstone Sanctum is composed of several interconnected services:

Core Services

  • Chat Service: Manages conversations and AI interactions
  • Dungeon Service: Handles combat, exploration, and RPG mechanics
  • Memory Service: Stores and retrieves hierarchical avatar memories
  • Location Service: Manages environmental contexts and zones
  • Avatar Service: Handles avatar creation, evolution, and management

Support Services

  • AI Service: Interfaces with multiple AI providers through OpenRouter
  • Image Service: Handles avatar image generation and storage
  • Database Service: Manages persistent data storage and retrieval

Development

The project uses:

  • Discord.js for bot functionality
  • Express for the web server
  • MongoDB for data persistence
  • OpenRouter for AI model access
  • S3/Arweave for storage
  • Webpack and Babel for frontend build
  • TailwindCSS for styling

Documentation

For detailed documentation, see the /docs directory:

For build system documentation, see README.build.md.

License

This project is licensed under the MIT License.