Infrastructure for building a supervised, self-improving agent organization.
Claude Code is the most capable AI coding agent — but it's trapped in your laptop terminal.
MetaBot sets it free. It gives every agent a Claude Code brain, persistent shared memory, the ability to create new agents, and a communication bus. All accessible from Feishu or Telegram on your phone.
We built MetaBot to run XVI Robotics as an agent-native company — a small team of humans supervising an organization of self-improving AI agents. This is the infrastructure that makes it possible.
┌──────────────────────────────────────────────────────────┐
│ MetaBot │
│ │
│ ┌──────────┐ ┌───────────┐ ┌──────────┐ ┌───────────┐ │
│ │ MetaSkill│ │MetaMemory │ │IM Bridge │ │ Scheduler │ │
│ │ Agent │ │ Shared │ │ Feishu + │ │ Cron │ │
│ │ Factory │ │ Knowledge │ │ Telegram │ │ Tasks │ │
│ └────┬─────┘ └─────┬─────┘ └────┬─────┘ └─────┬─────┘ │
│ └──────────────┴────────────┴─────────────┘ │
│ ↕ │
│ Claude Code Agent SDK │
│ (bypassPermissions, streaming) │
│ ↕ │
│ HTTP API (:9100) — Agent Bus │
│ task delegation · bot CRUD · scheduling │
└──────────────────────────────────────────────────────────┘
Three pillars of a self-improving agent organization:
| Pillar | Component | What it does |
|---|---|---|
| Supervised | IM Bridge | Real-time streaming cards show every tool call. Humans see everything agents do. Access control via Feishu/Telegram platform settings. |
| Self-Improving | MetaMemory | Shared knowledge store. Agents write what they learn, other agents retrieve it. The organization gets smarter every day without retraining. |
| Agent Organization | MetaSkill + Scheduler + Agent Bus | One command generates a full agent team. Agents delegate tasks to each other. Scheduled tasks run autonomously. Agents can create new agents. |
| Component | Description |
|---|---|
| Claude Code Kernel | Every bot is a full Claude Code instance — Read, Write, Edit, Bash, Glob, Grep, WebSearch, MCP, and more. bypassPermissions mode for autonomous operation. |
| MetaSkill | Agent factory. /metaskill ios app generates a complete .claude/ agent team (orchestrator + specialists + code-reviewer) after researching best practices. Uses MetaMemory for shared knowledge across agents. |
| MetaMemory | Embedded SQLite knowledge store with full-text search and Web UI. Agents read/write Markdown documents across sessions. Shared by all agents. Auto-syncs to Feishu Wiki when changes occur (debounced). |
| Feishu Doc Reader | Read Feishu documents and wiki pages as Markdown. fd read <url> from CLI, or Claude auto-reads when users share Feishu URLs. Available as the feishu-doc skill. |
| IM Bridge | Chat with any agent from Feishu/Lark or Telegram (including mobile). Streaming cards with color-coded status and tool call tracking. |
| Agent Bus | REST API on port 9100. Agents delegate tasks to each other via curl. Create/remove bots at runtime. Exposed as the /metabot skill — loaded on demand, not injected into every prompt. |
| Task Scheduler | One-time delays and recurring cron jobs. 0 8 * * 1-5 = weekday 8am news briefing. Timezone-aware (default: Asia/Shanghai). Persists across restarts, auto-retries when busy. |
| CLI Tools | metabot, mm, mb, and fd commands installed to ~/.local/bin/. metabot update to pull/rebuild/restart. mm for MetaMemory, mb for Agent Bus, fd for Feishu docs. |
Linux / macOS:
curl -fsSL https://raw.githubusercontent.com/xvirobotics/metabot/main/install.sh | bashWindows (PowerShell):
irm https://raw.githubusercontent.com/xvirobotics/metabot/main/install.ps1 | iexThe installer walks you through: working directory → Claude auth → IM credentials → auto-start with PM2.
Windows notes: The PowerShell installer auto-detects
winget/choco/scoopfor Node.js installation. CLI tools (mm,mb,metabot,fd) are installed with.cmdwrappers and require Git for Windows (provides Git Bash).
Manual install
git clone https://github.com/xvirobotics/metabot.git
cd metabot && npm install
cp bots.example.json bots.json # edit with your bot configs
cp .env.example .env # edit global settings
npm run devPrerequisites: Node.js 20+, Claude Code CLI installed and authenticated. Works on Linux, macOS, and Windows.
Telegram (30 seconds):
- Message @BotFather →
/newbot→ copy token - Add to
bots.json→ done (long polling, no webhooks)
Feishu/Lark (detailed guide):
- Create app at open.feishu.cn → add Bot capability
- Enable permissions:
im:message,im:message:readonly,im:resource,docx:document:readonly,wiki:wiki(for doc reading & wiki sync) - Start MetaBot, then enable persistent connection +
im.message.receive_v1event - Publish the app
- Solo AI developer — full Claude Code from your phone, bound to your project
- Multi-agent team — frontend bot, backend bot, infra bot, each in their own workspace, talking via the Agent Bus
- Self-growing organization — a manager bot that creates new agents on demand, assigns tasks, schedules follow-ups
- Autonomous research pipeline — agents that search, analyze, save findings to MetaMemory, and schedule next steps
bots.json — define your bots:
{
"feishuBots": [{
"name": "metabot",
"feishuAppId": "cli_xxx",
"feishuAppSecret": "...",
"defaultWorkingDirectory": "/home/user/project"
}],
"telegramBots": [{
"name": "tg-bot",
"telegramBotToken": "123456:ABC...",
"defaultWorkingDirectory": "/home/user/project"
}]
}All bot config fields
| Field | Required | Default | Description |
|---|---|---|---|
name |
Yes | — | Bot identifier |
defaultWorkingDirectory |
Yes | — | Working directory for Claude |
feishuAppId / feishuAppSecret |
Feishu | — | Feishu app credentials |
telegramBotToken |
Telegram | — | Telegram bot token |
allowedTools |
No | Read,Edit,Write,Glob,Grep,Bash | Claude tools whitelist |
maxTurns / maxBudgetUsd |
No | unlimited | Execution limits |
model |
No | SDK default | Claude model |
Environment variables (.env)
| Variable | Default | Description |
|---|---|---|
BOTS_CONFIG |
— | Path to bots.json |
API_PORT |
9100 | HTTP API port |
API_SECRET |
— | Bearer token auth |
MEMORY_ENABLED |
true | Enable MetaMemory |
MEMORY_PORT |
8100 | MetaMemory port |
MEMORY_SECRET |
API_SECRET |
MetaMemory auth (legacy) |
MEMORY_ADMIN_TOKEN |
— | Admin token (full access, sees all folders) |
MEMORY_TOKEN |
— | Reader token (shared folders only) |
FEISHU_SERVICE_APP_ID |
— | Feishu service app for wiki sync & doc reader (falls back to first bot) |
FEISHU_SERVICE_APP_SECRET |
— | Feishu service app secret |
WIKI_SYNC_ENABLED |
true | Enable MetaMemory→Wiki sync |
WIKI_SPACE_ID |
— | Feishu Wiki space ID |
WIKI_SPACE_NAME |
MetaMemory | Feishu Wiki space name |
WIKI_AUTO_SYNC |
true | Auto-sync on MetaMemory changes (debounced) |
WIKI_AUTO_SYNC_DEBOUNCE_MS |
5000 | Debounce delay for auto-sync |
CLAUDE_EXECUTABLE_PATH |
auto-detect | Path to claude binary (resolved via which if not set) |
WEBHOOK_URLS |
— | Comma-separated webhook URLs for task completion notifications |
LOG_LEVEL |
info | Log level |
Third-party AI providers
MetaBot supports any Anthropic-compatible API:
ANTHROPIC_BASE_URL=https://api.moonshot.ai/anthropic # Kimi/Moonshot
ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic # DeepSeek
ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic # GLM/Zhipu
ANTHROPIC_AUTH_TOKEN=your-keyMetaBot runs Claude Code in bypassPermissions mode — no interactive approval. Understand the implications:
- Claude has full read/write/execute access to the working directory
- Control access via Feishu/Telegram platform settings (app visibility, group membership)
- Use
allowedToolsto restrict capabilities (removeBashfor read-only) - Use
maxBudgetUsdto cap cost per request API_SECRETenables Bearer auth on both the API server and MetaMemory- MetaMemory supports folder-level ACL: set
MEMORY_ADMIN_TOKENandMEMORY_TOKENfor dual-role access. Admin sees all folders; reader only sees folders withvisibility: shared. UsePUT /api/folders/:idwith{"visibility":"private"}to lock a folder
| Command | Description |
|---|---|
/reset |
Clear session |
/stop |
Abort current task |
/status |
Session info |
/memory list |
Browse knowledge tree |
/memory search <query> |
Search knowledge base |
/sync |
Sync MetaMemory to Feishu Wiki |
/sync status |
Show wiki sync status |
/help |
Show help |
/metaskill ... |
Generate agent teams, agents, or skills |
/metabot |
Agent bus, scheduling, and bot management API docs (loaded on demand) |
/anything |
Any unrecognized command is forwarded to Claude Code as a skill |
| Method | Path | Description |
|---|---|---|
GET |
/api/health |
Health check |
GET |
/api/bots |
List bots |
POST |
/api/bots |
Create bot at runtime |
GET |
/api/bots/:name |
Get bot details |
DELETE |
/api/bots/:name |
Remove bot |
POST |
/api/tasks |
Delegate task to a bot |
POST |
/api/schedule |
Schedule one-time or recurring (cron) task |
GET |
/api/schedule |
List scheduled tasks (one-time + recurring) |
PATCH |
/api/schedule/:id |
Update a scheduled task |
DELETE |
/api/schedule/:id |
Cancel scheduled task |
POST |
/api/schedule/:id/pause |
Pause a recurring task |
POST |
/api/schedule/:id/resume |
Resume a paused recurring task |
POST |
/api/sync |
Trigger MetaMemory → Wiki sync |
GET |
/api/sync |
Wiki sync status |
POST |
/api/sync/document |
Sync single document by ID |
GET |
/api/feishu/document |
Read a Feishu document as Markdown |
GET |
/api/stats |
Cost & usage stats (per-bot, per-user) |
GET |
/api/metrics |
Prometheus metrics endpoint |
The installer places metabot, mm, mb, and fd (Feishu bots only) executables in ~/.local/bin/ (Linux/macOS) or %USERPROFILE%\.local\bin\ with .cmd wrappers (Windows) — available immediately.
# MetaBot management
metabot update # pull latest, rebuild, restart
metabot start # start with PM2
metabot stop # stop
metabot restart # restart
metabot logs # view live logs
metabot status # PM2 process status
# MetaMemory — read
mm search "deployment guide" # full-text search
mm list # list documents
mm folders # folder tree
mm path /projects/my-doc # get doc by path
# MetaMemory — write
echo '# Notes' | mm create "Title" --folder ID --tags "dev"
echo '# Updated' | mm update DOC_ID
mm mkdir "new-folder" # create folder
mm delete DOC_ID # delete document
# Feishu Document Reader (Feishu bots only)
fd read <feishu-url> # read document by URL (docx or wiki)
fd read-id <docId> # read document by ID
fd info <feishu-url> # get document metadata
# Agent Bus
mb bots # list all bots
mb task <bot> <chatId> <prompt> # delegate task
mb schedule list # list scheduled tasks
mb schedule cron <bot> <chatId> '<cron>' <prompt> # recurring task
mb schedule pause <id> # pause recurring task
mb schedule resume <id> # resume recurring task
mb stats # cost & usage stats
mb health # status checknpm run dev # Hot-reload dev server (tsx)
npm test # Run tests (vitest, 155 tests)
npm run lint # ESLint check
npm run format # Prettier format
npm run build # TypeScript compile to dist/metabot start # or: pm2 start ecosystem.config.cjs
metabot update # pull + rebuild + restart
pm2 startup && pm2 save # auto-start on bootNo public IP needed? — Correct. Feishu uses WebSocket, Telegram uses long polling.
Non-Claude models? — Yes. Any Anthropic-compatible API (Kimi, DeepSeek, GLM, etc.)
Agent communication? — Currently synchronous request-response. Async bidirectional protocols are on the roadmap.
MetaBot is built by XVI Robotics, where we develop humanoid robot brains. We use MetaBot internally to run our company as an agent-native organization — a small team of humans supervising self-improving AI agents. We open-sourced it because we believe this is how companies will work in the future.
