๐ Language: English | ็ฎไฝไธญๆ
An AI companion that remembers, grows, and maintains emotional continuity
๐ Quick Start โข โจ Features โข ๐ผ๏ธ Screenshots โข ๐ Documentation
ATRI is an Android app + cloud backend AI companion project. Unlike ordinary chatbots, she has:
|
Chat with her anytime, anywhere Send images and documents |
She records what happened today Written from her perspective |
Diaries become "memories" Recalled in future conversations |
| Traditional Chatbots | ATRI's Approach |
|---|---|
| Every conversation starts fresh | ๐ Remembers everything important via diary + vector memory |
| Emotions change instantly | ๐ญ PAD 3D emotion model + natural decay, emotions have inertia |
| One-size-fits-all responses | ๐ Intimacy system affects speaking style, relationships grow |
| May fabricate memories | ๐ Tool registration mechanism, actively verifies when needed |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ฑ Android App (Kotlin) โ
โ Jetpack Compose โข Room โข DataStore โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HTTPS + Token Auth
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ๏ธ Cloudflare Worker (TypeScript) โ
โ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ D1 โ โ R2 โ โ Vectorize โ โ
โ โDatabase โ โ Storage โ โ Vector Database โ โ
โ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ OpenAI-Compatible API
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ค AI Model Service (Swappable) โ
โ OpenAI โข Claude โข Gemini โข DeepSeek โข Local Models โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| Requirement | Description |
|---|---|
| ๐ป | Computer (Windows / macOS / Linux) |
| โ๏ธ | Cloudflare account (free) |
| ๐ | OpenAI API Key or compatible API |
| ๐ฆ | Node.js 18+ |
| ๐ | Python 3.8+ |
๐ช Option A: Windows One-Click Deploy (Recommended for beginners)
- Double-click
scripts/deploy_cf.bat - 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, SiliconFlow recommended)
- Other optional secrets (can skip)
- The script will automatically create resources and deploy
- Copy the Worker URL when done
๐ Option B: macOS / Linux Manual Deploy
# 1. Clone the project
git clone https://github.com/your-username/ATRI.git
cd ATRI
# 2. Install dependencies
cd worker && npm install
# 3. Login to Cloudflare
npx wrangler login
# 4. Create D1 database
npx wrangler d1 create atri_diary
# Copy the database_id from output and paste into worker/wrangler.toml
# 5. Initialize database tables
npx wrangler d1 execute atri_diary --file=db/schema.sql
# 6. Create R2 bucket
npx wrangler r2 bucket create atri-media
# 7. Create Vectorize index
npx wrangler vectorize create atri-memories --dimensions=1024 --metric=cosine
# 8. Set secrets
npx wrangler secret put OPENAI_API_KEY
# 9. Sync prompts and deploy
cd .. && python3 scripts/sync_shared.py
cd worker && npx wrangler deployAfter successful deployment, you'll see the Worker URL:
โจ https://atri-worker.your-subdomain.workers.dev
| Secret | Description | Required |
|---|---|---|
OPENAI_API_KEY |
Chat model API key | โ |
EMBEDDINGS_API_KEY |
Embeddings API key for vector memory (SiliconFlow recommended) | โ |
APP_TOKEN |
Client access token to protect API | Recommended |
๐ฅ Download APK from Releases
Build a signed release APK (recommended)
- Go to
ATRI/ - Copy
keystore.properties.example->keystore.properties(do not commit it) - Generate a keystore (Windows example):
keytool -genkeypair -v -keystore keystore\\atri-release.jks -alias atri -keyalg RSA -keysize 2048 -validity 10000
- Fill passwords in
ATRI/keystore.properties - Build:
cd ATRI && .\\gradlew.bat :app:assembleRelease
Output: ATRI/app/build/outputs/apk/release/app-release.apk
| Step | Action |
|---|---|
| 1 | Welcome Screen: Set your nickname and avatar |
| 2 | Settings (tap โ๏ธ icon): Enter Worker URL and App Token |
| 3 | Select Model: Choose a model based on your API |
| 4 | Start Chatting โจ |
โ Deploy script says "node not found"
Install Node.js 18+: https://nodejs.org/
โ Deploy script says "Python not found"
Install Python 3.8+: https://www.python.org/downloads/
โ wrangler login keeps spinning
Check your network connection. You may need a VPN in some regions.
โ Chat not responding
- Verify Worker URL is correct
- Check if OPENAI_API_KEY is valid
- Check Worker logs in Cloudflare dashboard
โ Diary not generating
Diaries are generated daily at 23:59 Beijing time. There must be conversation records for that day. You can also manually trigger regeneration on the diary page.
โ How to use other AI services?
Any OpenAI-compatible API works:
- Edit
OPENAI_API_URLinworker/wrangler.toml - Optional: Configure separate
DIARY_API_URL/DIARY_MODEL(diary generation can use a different model) - Embeddings (vector memory): by default it's
https://api.siliconflow.cn/v1+BAAI/bge-m3- Set
EMBEDDINGS_API_KEY(SiliconFlow API key) - Optional: override
EMBEDDINGS_API_URL/EMBEDDINGS_MODEL
- Set
- Redeploy:
cd worker && npx wrangler deploy
|
In-Character Authentic personality defined in prompts.json |
Context Memory Today's conversations inform responses |
Auto Diary Nightly reflections from her perspective |
Long-term Memory Vector-stored memories awakened when needed |
Rich Media Send images or docs she understands them |
| Feature | Description |
|---|---|
| PAD Emotion Model | 3D emotion coordinates (Pleasure/Arousal/Dominance) + natural decay |
| Intimacy System | Relationship temperature affects reply style, fades without maintenance |
| Tool Registration | Model actively verifies memories, doesn't fabricate |
| Split Architecture | Chat and diary can use different upstreams independently |
| Signed Access Control | Path-based signatures solve model dropping query params |
![]() Welcome Set nickname and avatar |
![]() Chat Immersive chat experience |
![]() Sidebar Status and quick actions |
![]() Diary View ATRI's diary entries |
![]() Settings Configure backend and model |
.
โโโ ATRI/ # ๐ฑ Android App
โ โโโ app/src/main/
โ โ โโโ java/me/atri/
โ โ โ โโโ data/ # Data layer (API, DB, Repository)
โ โ โ โโโ di/ # Dependency Injection (Hilt)
โ โ โ โโโ ui/ # UI layer (Compose)
โ โ โ โโโ utils/ # Utilities
โ โ โโโ res/ # Resources
โ โโโ build.gradle.kts
โ
โโโ worker/ # โ๏ธ Cloudflare Worker
โ โโโ src/
โ โ โโโ routes/ # API routes
โ โ โโโ services/ # Core services
โ โ โโโ jobs/ # Scheduled jobs
โ โ โโโ utils/ # Utility functions
โ โโโ db/schema.sql # Database schema
โ โโโ wrangler.toml # Worker config
โ
โโโ shared/ # ๐ Shared Config
โ โโโ prompts.json # Personality and prompts
โ
โโโ scripts/ # ๐ง Deployment Scripts
โโโ deploy_cf.bat # Windows one-click deploy
โโโ sync_shared.py # Sync prompts
| Document | Content |
|---|---|
| ๐ Tech Architecture Blueprint | Design philosophy, data flow, API contracts, extension guide |
| ๐ Personality Definition | ATRI's personality, diary generation, memory system prompts |
| ๐๏ธ Database Schema | D1 database table definitions |
Contributions are welcome! Feel free to open issues or submit pull requests.
Before contributing code, we recommend reading the Tech Architecture Blueprint to understand the system design.
This project is licensed under the PolyForm Noncommercial License 1.0.0.
In short:
- โ Personal learning, research, non-commercial use
- โ Commercial use requires separate authorization
If this project helps you, consider giving it a โญ
Built with โค๏ธ for those who believe AI can be more than just a tool




