Rachel9
No description available
Ask AI about Rachel9
Powered by Claude Β· Grounded in docs
I know everything about Rachel9. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
Rachel9
A personal AI assistant that lives in your Telegram. Built on the pi-mono agent framework. Supports multiple LLM providers out of the box: Google Gemini, OpenAI, Anthropic, and more via pi-ai.
Rachel can read and create documents, search the web, write and run code, manage your WhatsApp, schedule tasks, remember things about you, and much more β all through a simple Telegram chat.
Don't want to self-host? Get a fully managed Rachel at get-rachel.com β no setup, no server, just start chatting.
Features
- Telegram-native β chat naturally, send voice messages, photos, documents
- Persistent memory β Rachel remembers your preferences, past conversations, and important facts
- 10 built-in tools β file I/O, bash, grep, web search, web fetch, and more
- 12 specialized skills β PDF, Word, Excel, PowerPoint, web design, WhatsApp bridge, and more
- Task scheduler β cron-based reminders, bash jobs, and autonomous agent tasks
- Auto context compaction β handles long conversations gracefully (180K token window)
- Voice transcription β via Groq Whisper (free) or OpenAI Whisper
- WhatsApp bridge β read messages, export contacts, send files through WhatsApp
- Streaming responses β real-time message streaming with typing indicators
- Self-contained β single Bun process, SQLite database, no external services beyond the LLM
Quick Start
Prerequisites
- Bun (v1.1+)
- A Telegram bot token (from @BotFather)
- Your Telegram user ID (from @userinfobot)
- An LLM API key (Google AI Studio, OpenAI, Anthropic, or Z.ai)
Setup
git clone https://github.com/polly3223/Rachel9.git
cd Rachel9
bun install
# Interactive setup wizard β creates .env and optionally installs as systemd service
bun run setup
Or manually:
cp .env.example .env
# Edit .env with your values
bun run start
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
TELEGRAM_BOT_TOKEN | Yes | β | Bot token from @BotFather |
OWNER_TELEGRAM_USER_ID | Yes | β | Your Telegram user ID |
SHARED_FOLDER_PATH | Yes | β | Path for persistent data (memory, database, sessions) |
GEMINI_API_KEY | No* | β | Google AI Studio API key (recommended, enables Gemini Flash) |
ZAI_API_KEY | No* | β | Z.ai API key (fallback) |
GEMINI_MODEL | No | gemini-3-flash-preview | Override Gemini model name |
NODE_ENV | No | production | development, production, or test |
LOG_LEVEL | No | info | debug, info, warn, error |
THINKING_LEVEL | No | off | off, minimal, low, medium, high |
STT_PROVIDER | No | groq | groq or openai (for voice messages) |
GROQ_API_KEY | No | β | Required if using Groq for voice transcription |
* At least one LLM API key is required (GEMINI_API_KEY or ZAI_API_KEY).
Architecture
src/
βββ agent/ # Agent system β runner, tools, compaction, system prompt
β βββ tools/ # Custom tools: web search, web fetch, telegram file send
βββ config/ # Environment validation (Zod) and tunable constants
βββ lib/ # Database, memory, skills, task scheduler, usage tracking
βββ telegram/ # Bot setup, message handlers, media handlers, streaming
β βββ handlers/ # Message processing, 7 media type handlers
β βββ lib/ # Queue, formatting, timestamps, transcription
β βββ middleware/ # Auth guard (owner-only)
βββ whatsapp/ # WhatsApp Web bridge via Baileys
βββ setup/ # Interactive setup wizard + systemd installer
βββ index.ts # Entry point β webhook or polling mode
Agent: Uses pi-agent-core with 10 tools (7 coding tools from pi-coding-agent + 3 custom). Sessions persist as JSONL files.
Memory: Three layers β MEMORY.md (core facts, loaded every message), daily-logs/ (conversation history), context/ (deep topic knowledge).
Database: SQLite with WAL mode. Tables: conversations, tasks, usage.
Skills: Auto-discovered from skills/ directory. Each skill has a SKILL.md with YAML frontmatter that gets injected into the system prompt.
Docker
docker build -t rachel9 .
docker run -d \
--name rachel \
-v rachel-data:/data \
-e TELEGRAM_BOT_TOKEN=... \
-e OWNER_TELEGRAM_USER_ID=... \
-e GEMINI_API_KEY=... \
-e SHARED_FOLDER_PATH=/data \
rachel9
The Docker image includes Python 3, UV, pip, ffmpeg, git, and curl β everything Rachel needs to execute code and create documents.
Webhook Mode (Rachel Cloud)
When deployed as part of Rachel Cloud, set RACHEL_CLOUD=true to enable webhook mode. The container listens on port 8443 for updates forwarded by the central router.
docker run -d \
-e RACHEL_CLOUD=true \
-e WEBHOOK_PORT=8443 \
# ... other env vars
rachel9
Health check: GET /health returns {"status":"ok"}
Tunable Constants
All magic numbers live in src/config/constants.ts:
MAX_CONTEXT_TOKENS: 180_000 // Hard context limit
COMPACTION_THRESHOLD: 0.70 // Trigger compaction at 70%
COMPACTION_KEEP_RECENT_TURNS: 10 // Always keep last 10 exchanges
STREAM_THROTTLE_MS: 500 // Min ms between Telegram edits
TELEGRAM_MAX_MESSAGE_LENGTH: 4096 // Telegram's hard limit
TASK_POLL_INTERVAL_MS: 30_000 // Task scheduler poll interval
Skills
| Skill | Description |
|---|---|
pdf | Read, create, merge, split, watermark, OCR PDFs |
docx | Create and edit Word documents |
xlsx | Create and manipulate Excel spreadsheets |
pptx | Create PowerPoint presentations |
canvas-design | Generate HTML canvas graphics |
algorithmic-art | Create generative art |
frontend-design | Design web frontends |
web-artifacts-builder | Build web components |
webapp-testing | Playwright-based web testing |
mcp-builder | Guide for creating MCP servers |
skill-creator | Create new skills |
slack-gif-creator | Generate Slack GIFs |
WhatsApp Bridge
Connect Rachel to your WhatsApp to read messages, export contacts, and send files:
# Generate QR code to link
bun run src/whatsapp/cli.ts connect-qr
# Export contacts from a group
bun run src/whatsapp/cli.ts contacts "Group Name"
# Send a message
bun run src/whatsapp/cli.ts send "+1234567890" "Hello!"
Development
bun run dev # Start with hot reload
bun run typecheck # Type checking
bun run test # Run tests
License
MIT
