Skip to content

MIKUSCAT/ATRI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

89 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

ATRI

โœจ ATRI - Emotionally Evolving AI Companion โœจ

๐Ÿ’• Your personal AI who remembers, reflects, and grows alongside you ๐Ÿ’•


Android Backend AI License


Stars Forks Issues


๐ŸŒ Language: English | ็ฎ€ไฝ“ไธญๆ–‡


"An AI companion that remembers, grows, and maintains emotional continuity"


๐Ÿš€ Quick Start โ€ข โœจ Features โ€ข ๐Ÿ“ธ Screenshots โ€ข ๐Ÿ“š Documentation



๐Ÿ’ญ What is ATRI?

ATRI is an Android app + cloud backend AI companion project. Unlike ordinary chatbots, she has:



๐Ÿ“ฑ ATRI on Your Phone

Chat with her anytime, anywhere
Send images and documents



๐Ÿ“” Nightly Diary

She records what happened today
Written from her perspective



๐Ÿง  Long-term Memory

Diaries become "memories"
Recalled in future conversations



๐ŸŽฏ What Makes It Different?

๐Ÿค– Traditional Chatbots ๐Ÿ’– ATRI's Approach
Every conversation starts fresh Remembers everything important via diary + vector memory + real-time facts
Emotions change instantly Status capsule system + intimacy decay, moods have inertia
One-size-fits-all responses Intimacy system affects speaking style, relationships grow
May fabricate memories Tool registration mechanism with 8 tools, actively verifies via search/diary/web


๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     ๐Ÿ“ฑ Android App (Kotlin)                     โ”‚
โ”‚              Jetpack Compose โ€ข Room โ€ข DataStore                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚ ๐Ÿ” HTTPS + Token Auth
                           โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚                                             โ”‚
    โ–ผ                                             โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  โ˜๏ธ Cloudflare Workers โ”‚   OR    โ”‚   ๐Ÿ–ฅ๏ธ VPS / Zeabur Server      โ”‚
โ”‚  D1 + R2 + Vectorize  โ”‚         โ”‚  Fastify + PostgreSQL/pgvectorโ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚
                           โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              ๐Ÿค– AI Model Service (Native Multi-Format)          โ”‚
โ”‚     OpenAI โ€ข Claude โ€ข Gemini โ€ข DeepSeek โ€ข Local Models          โ”‚
โ”‚     (OpenAI / Anthropic / Gemini API format auto-adapt)         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜


๐Ÿš€ Quick Start

๐Ÿ“ฆ Choose Your Backend

Option Best For Features
โ˜๏ธ Cloudflare Workers Beginners, low cost Serverless, free tier, simple setup
๐Ÿ–ฅ๏ธ VPS / Zeabur Advanced users Web admin panel, PostgreSQL, compat API, more control


๐Ÿ”ง Backend Deployment

โœ… Option A: Zeabur One-Click Deploy (Recommended)

Deploy on Zeabur


  1. Click the button above

  2. Fill in only 2 variables:

    • DOMAIN - Public domain bound to the API service (must match the publicly exposed domain)
    • PASSWORD - Your password (used for admin login and client auth)

    ๐Ÿ’ก PASSWORD can be a strong password (special characters like @ : / # ? are safe)

    โš ๏ธ Important: DOMAIN must match the actual public domain, otherwise the admin panel may fail with CORS / bad_origin

  3. Wait for deployment to complete

  4. Visit your domain to access the admin panel

  5. Configure upstream API (OpenAI/Claude/Gemini) in the admin panel

๐Ÿ“ Note: The Android client and web frontend use the same public API paths on both backends (Cloudflare Workers and VPS/Zeabur), so switching backends is just changing the base URL.


โ˜๏ธ Option B: Cloudflare Workers

๐ŸชŸ Windows One-Click Deploy
  1. Double-click scripts/deploy_cf.bat
  2. Follow the prompts to enter:
    • Worker name (press Enter for default)
    • D1 database name (press Enter for default)
    • R2 bucket name (press Enter for default)
    • Vectorize index name (press Enter for default)
    • OPENAI_API_KEY (required)
    • EMBEDDINGS_API_KEY (required for vector memory)
  3. The script will automatically create resources and deploy
  4. Copy the Worker URL when done
๐ŸŽ macOS / ๐Ÿง Linux Manual Deploy
# 1. Clone and install
git clone https://github.com/MIKUSCAT/ATRI.git
cd ATRI/worker && npm install

# 2. Login to Cloudflare
npx wrangler login

# 3. Create resources
npx wrangler d1 create atri_diary
npx wrangler r2 bucket create atri-media
npx wrangler vectorize create atri-memories --dimensions=1024 --metric=cosine

# 4. Update wrangler.toml with database_id from step 3

# 5. Initialize and deploy
npx wrangler d1 execute atri_diary --file=db/schema.sql
npx wrangler secret put OPENAI_API_KEY
cd .. && python3 scripts/sync_shared.py
cd worker && npx wrangler deploy

๐Ÿณ Option C: Docker Compose (Self-hosted VPS)

cd server
cp .env.example .env
# Edit .env with your configuration
docker-compose up -d

๐Ÿ“– See server/README.md for detailed VPS deployment guide.



๐Ÿ“ฒ Install the Android App

Step Action
1๏ธโƒฃ Download APK from Releases
2๏ธโƒฃ Install and open the app
3๏ธโƒฃ Set your nickname on the welcome screen
4๏ธโƒฃ Go to Settings (โš™๏ธ) and configure: API URL, App Token, Model


โœจ Key Features


๐ŸŽญ

In-Character
Authentic personality
defined in prompts.json



๐Ÿ’ฌ

Context Memory
Today + yesterday's chats
inform responses



๐Ÿ““

Auto Diary
Nightly reflections
from her perspective



๐Ÿง 

Long-term Memory
Vector-stored memories
+ real-time facts



๐Ÿ–ผ๏ธ

Rich Media
Send images or docs
she understands them



๐Ÿ”ฌ Technical Highlights

Feature Description
๐ŸŽจ Status Capsule Dynamic mood status with label text + color, model-driven updates via set_status tool
๐Ÿ’• Intimacy System Relationship temperature affects reply style, fades without maintenance
๐Ÿ”ง 8 Registered Tools search_memory read_diary read_conversation web_search set_status update_intimacy remember_fact forget_fact
๐ŸŒ Native Multi-Format Natively supports OpenAI, Anthropic (Claude), and Gemini API formats
๐Ÿ”€ Split Architecture Chat and diary can use different upstreams independently
๐ŸŒ Web Admin Panel (VPS) Runtime config, prompt editing, encrypted secrets management
๐Ÿ”Œ Compat API (VPS) OpenAI / Anthropic / Gemini compatible endpoints for third-party clients


๐Ÿ–ผ๏ธ UI Preview


๐Ÿ‘‹ Welcome

๐Ÿ’ฌ Chat

๐Ÿ“‹ Sidebar

๐Ÿ“” Diary

โš™๏ธ Settings


๐Ÿ“ Project Structure

.
โ”œโ”€โ”€ ๐Ÿ“ฑ ATRI/                 # Android App (Kotlin / Jetpack Compose)
โ”‚   โ”œโ”€โ”€ app/src/main/
โ”‚   โ”‚   โ”œโ”€โ”€ java/me/atri/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ data/        # Data layer (API, DB, Repository, DataStore)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ di/          # Dependency Injection (Koin)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ui/          # UI layer (Compose screens & components)
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ utils/       # Utilities
โ”‚   โ”‚   โ””โ”€โ”€ res/             # Resources
โ”‚   โ””โ”€โ”€ build.gradle.kts
โ”‚
โ”œโ”€โ”€ โ˜๏ธ worker/               # Cloudflare Worker Backend
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ routes/          # API routes
โ”‚   โ”‚   โ”œโ”€โ”€ services/        # Core services
โ”‚   โ”‚   โ””โ”€โ”€ utils/           # Utility functions
โ”‚   โ”œโ”€โ”€ db/schema.sql        # Database schema
โ”‚   โ””โ”€โ”€ wrangler.toml        # Worker config
โ”‚
โ”œโ”€โ”€ ๐Ÿ–ฅ๏ธ server/               # VPS Backend (Fastify + PostgreSQL + pgvector)
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ routes/          # API routes (chat, diary, conversation, media, admin, admin-ui, models, compat)
โ”‚   โ”‚   โ”œโ”€โ”€ services/        # Core services (agent, LLM, memory, diary, profile, runtime-settings)
โ”‚   โ”‚   โ”œโ”€โ”€ jobs/            # Scheduled jobs (diary-cron, diary-scheduler, memory-rebuild)
โ”‚   โ”‚   โ”œโ”€โ”€ runtime/         # Environment & types
โ”‚   โ”‚   โ”œโ”€โ”€ admin/           # Admin log buffer
โ”‚   โ”‚   โ”œโ”€โ”€ config/          # Default prompts
โ”‚   โ”‚   โ”œโ”€โ”€ utils/           # Utilities (auth, media-signature, attachments, sanitize)
โ”‚   โ”‚   โ””โ”€โ”€ scripts/         # Build & import scripts
โ”‚   โ”œโ”€โ”€ admin-ui/            # Web admin panel (static assets)
โ”‚   โ”œโ”€โ”€ docker-compose.yml
โ”‚   โ”œโ”€โ”€ Dockerfile
โ”‚   โ””โ”€โ”€ zeabur.yaml          # Zeabur deployment config
โ”‚
โ”œโ”€โ”€ ๐Ÿ”— shared/               # Shared Config
โ”‚   โ””โ”€โ”€ prompts.json         # Personality and prompts
โ”‚
โ””โ”€โ”€ ๐Ÿ“œ scripts/              # Deployment Scripts
    โ”œโ”€โ”€ deploy_cf.bat        # Windows CF deploy
    โ””โ”€โ”€ sync_shared.py       # Sync prompts


๐Ÿ“š Learn More

๐Ÿ“„ Document ๐Ÿ“ Content
๐Ÿ›๏ธ Tech Architecture Blueprint Design philosophy, data flow, API contracts
๐Ÿš€ VPS Deployment Guide Docker, Zeabur, 1Panel, Baota deployment
๐ŸŽญ Personality Definition ATRI's personality and prompts


๐Ÿค Contributing

Contributions are welcome!

Feel free to open issues or submit pull requests.


Contributors



๐Ÿ“„ License

This project is licensed under the PolyForm Noncommercial License 1.0.0.

  • โœ… Personal learning, research, non-commercial use allowed
  • โš ๏ธ Commercial use requires separate authorization



โญ Star History

Star History Chart




๐ŸŒŸ If this project helps you, consider giving it a Star ๐ŸŒŸ


๐Ÿ’– Built with love for those who believe AI can be more than just a tool ๐Ÿ’–


About

ATRI - Emotionally Evolving AI Companion

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 3

  •  
  •  
  •