English | Português (BR)
Pi Bot is a personal AI assistant for Telegram or WhatsApp. It runs headless on Node.js and SQLite, with the Pi harness and @earendil-works/pi-durable for conversation history and execution. A Docker deployment uses one bot container and one data volume.
Beta. Ready for day-to-day use. Configuration and commands may change between releases. Project site.
- Node.js 24 or newer for a bare Node install, or Docker Engine with Compose v2.24+.
- A Telegram bot token and allowed numeric user IDs, or a phone to pair with WhatsApp. Choose one gateway per installation.
- Credentials for a supported text model, or ChatGPT Plus/Pro for ChatGPT/Codex OAuth.
- A writable, persistent
DATA_DIR. Keep the whole directory across restarts and upgrades, includingapp.sqlite,durable.sqlite, SQLite sidecar files, configuration, credentials, WhatsApp session files, memory, skills, and task artifacts.
Clone the repository.
git clone https://github.com/forge-z/pi-bot.git
cd pi-botcp .env.example .env
docker compose up -d --build
docker compose exec pi-bot npm run setupCompose mounts the named volume pi_bot_data at /app/data (DATA_DIR). The container can start before setup, and every entry in .env is optional. Choose Save and restart gateway after setup.
npm ci
export DATA_DIR="$PWD/data"
mkdir -p "$DATA_DIR"
npm run build
npm run setup
npm startUse the same DATA_DIR each time you start the bot. In either install, choose Setup gateway and Text model in setup, then send /status in an allowed chat to verify the connection.
Pi Bot loads config.default.yaml and overlays $DATA_DIR/config.yaml (or the path set in CONFIG_FILE). Dictionaries merge recursively, lists replace the entire default list, and null removes a key. The usual path is /app/data/config.yaml in Docker or ./data/config.yaml in the bare Node setup above.
Rebuild after code changes (docker compose up -d --build or npm run build). Restart the gateway after configuration changes. Environment overrides take precedence over saved values. See .env.example.
Setup also configures image and audio models, MCP, web tools, and memory. See gateway and runtime setup for model fallback, web search, weather, skills and memory, and WhatsApp setup and troubleshooting for pairing and chat behavior.
See model catalog and reasoning for provider-specific settings, including Ollama.
Telegram registers its command menu automatically. On WhatsApp, type commands into the chat.
| Command | What it does |
|---|---|
/model |
Choose a model for this conversation. |
/thinking |
Choose the model's reasoning effort. |
/crons |
Manage schedules on Telegram or toggle existing schedules on WhatsApp. |
/goal |
Watch for a condition or PR merge on Telegram. |
/new |
Start a new conversation and retain the previous one. |
/resume |
Resume work parked after a crash or dismiss an uncertain MCP outcome. |
/stop |
Cancel current work. |
/queue <message> |
Hold a message for the next turn if the bot is busy. |
/compact [focus] |
Compact conversation history, optionally with a focus. |
/status |
Show model, usage, MCP servers, current run, and version. |
/receipt [n] |
Show a turn receipt, counting back from the latest. |
/job |
Show the latest async job's state, elapsed time, and PR or error. |
/approvals |
List reads you have always allowed. |
/revoke <n> |
Remove an always-allow rule. |
/memory |
Show saved memory. |
/forget <text-or-key> |
Remove matching memory text or an exact key, depending on the backend. |
/remember <key> <fact> |
Store or update a fact in Internal Advanced memory. |
/help |
Show chat help. |
/start |
Show chat help. |
See chat commands and active turns and persistent goals for behavior and examples.
Use MCP platform in setup to connect Executor, Composio, Upsy, or a self-hosted gateway.
For a custom server list, set MCP_CONFIG_FILE or MCP_SERVERS_JSON. That list replaces the servers selected in setup.
See MCP configuration and sign-in for credentials, server examples, and tool classification.
Set subagents.enabled: true in $DATA_DIR/config.yaml and restart to enable delegation.
Subagents use the same model for read-only MCP work and return their final text. /stop stops them.
See subagent setup and limits.
Registered async jobs run beyond the chat turn. A poller reports state and delivers results to the originating chat or topic.
Use /job for the latest stored observation.
See job manifests and sandbox setup.
Ask in chat to create a durable task with a goal, or to steer a running task by ID. Review the Markdown artifact and accept its current version, or reject it with a reason to request another attempt. An interrupted task can be rejected the same way to run it again. Code jobs dispatched from a task report back to its original chat. See durable task workflows.
- Approval decisions come from the user. Pi Bot never accepts an approval on the user's behalf.
- Protect the host and data volume, which contain chat history, credentials, and ledgers. Treat MCP output as untrusted data. See verification and runtime limits.
- The repository runs Gitleaks secret scanning. See secret scanning for the workflow and local command, and uncertain MCP outcomes for handling writes with an unknown result.
Stop every writer before upgrading. Take a consistent backup of the entire volume and its databases, including SQLite WAL and state files, before swapping the binary. Roll back by restoring both the previous binary and that pre-upgrade backup. Run only one version against a database at a time. See deployment and rollback.
| Path | Contents |
|---|---|
| src/ | Gateway, runtime, and tools |
| test/ | Tests |
| scripts/ | Setup, diagnostics, and deployment scripts |
| docs/ | Operator references |
| docker-compose.yml | Container services and data volume |
| config.default.yaml | Shipped defaults |
| CHANGELOG.md | Release history |
MIT. See third-party notices.