Skip to content

Introduction ​

Lucy is a self-hosted personal AI agent. It runs on your own Linux server, talks to you through Telegram and a web cockpit, keeps a long-term memory in plain Markdown files, and does larger jobs by handing them to a board of specialist agents. The thinking is done by Claude, through the Claude Code CLI and the Claude Agent SDK.

Lucy is built for one owner. Every entry point is locked to you: the Telegram bot answers only your user ID, and the web hub sits behind a password with optional two-factor login.

What Lucy can do ​

AreaWhat you get
ChatTalk to Lucy from Telegram or the web hub. Replies stream in as they are written. Send a new message mid-reply to redirect her, or /stop to cut the reply off. Send photos and documents (PDF, DOCX, XLSX, CSV, …) and Lucy opens them with her tools.
MemoryA Markdown vault (Obsidian-compatible) is Lucy's brain. Before each turn she searches it for relevant notes (full-text search, plus optional vector search and reranking through Jina). Conversation turns are logged for cross-session recall, and a nightly "dream" job consolidates new signals into stable preferences.
Agents & boardBig jobs become cards on a Kanban-style board. A coordinator moves each card through a pipeline (for example engineering, research, blog) and hands each stage to a persona (engineer, reviewer, researcher, writer, …). A worker process runs the stages; an optional autopilot approves routine gates for you.
Tools, skills & MCPIn chat Lucy uses Claude Code's native tools (read/write files, shell, web). Agents can mount MCP servers: filesystem, web, read-only git, memory, and with credentials GitHub, Google (Gmail/Calendar/Drive/YouTube, read-only), Notion and market data. A library of Agent Skills lives in skills/.
AutomationsScheduled prompts from the hub (results can be pushed to Telegram), the nightly memory dream via cron, the autopilot for the board, and a token guard that throttles spending.
Cheap model lanesBesides Claude, Lucy can route work to OpenAI-compatible providers (OpenRouter, Groq, Gemini, Cerebras, Mistral, Z.ai, Nous, OpenCode Zen). Personas can be pinned to a cheap "lane" model, and the token guard drops executors to a cheap lane when the daily soft limit is reached.

Architecture ​

All processes are declared in ecosystem.config.cjs and run under PM2. Each one listens only on 127.0.0.1; nginx is the only thing exposed to the internet.

text
                    ┌──────────────────────────── your server ───────────────────────────────┐
                    │                                                                        │
 Telegram ──────────┼─► lucy-bridge (Python) ── Claude Agent SDK ──► Anthropic API           │
 (you)              │       │   one live Claude session per chat     (direct, no proxy)      │
                    │       │                                                                │
                    │       ├──► lucy-coordinator :8780 ◄──── lucy-vps-worker ──► Claude /    │
                    │       │      recall index, board,  ◄──── lucy-autopilot     cheap lanes │
                    │       │      token guard, personas            │                         │
                    │       │             │                         ▼                         │
                    │       │             ▼                  lucy-pxpipe :47821 ──► Anthropic │
                    │       └──────► lucy-vault/  (Markdown memory, its own git repo)         │
                    │                     ▲                                                  │
 Browser ── nginx ──┼─► lucy-hub :8800 ───┘  (web cockpit: chat, board, brain, schedules)    │
   (HTTPS)          │                                                                        │
                    │  cron 02:00 ─► bridge/cron_dream.sh (consolidate memory + reindex)    │
                    └────────────────────────────────────────────────────────────────────────┘

How a Telegram message flows ​

  1. Poll. lucy-bridge long-polls Telegram (getUpdates). Messages from anyone other than LUCY_ALLOWED_USER_ID are dropped. /stop and /restart are handled immediately; everything else goes into a per-chat queue.
  2. Recall. In parallel, the bridge asks the coordinator's /recall endpoint for relevant vault notes. A cheap gate skips recall for corrections and pure follow-ups ("no, I meant…", "option 2"), and hits below a relevance score are dropped.
  3. Think. The message, the recall block and a few per-turn hints go to a persistent Claude session for that chat (Claude Agent SDK client, claude_code system preset plus bridge/persona.md). The vault is added as an extra working directory, so Lucy can read and write notes with her normal tools.
  4. Stream. Text deltas are streamed back by editing the Telegram message in place.
  5. Remember. The turn is logged to the coordinator (episodic memory) and its token usage is reported to the shared token guard. When a session fills about 70% of the context window, the bridge rotates to a fresh session and carries the recent thread over.

The web hub follows a similar path with its own chat history, and adds the board, the memory views and the schedules.

Why chat bypasses pxpipe

lucy-pxpipe is a local token-compression proxy for the high-volume worker and autopilot traffic. Chat deliberately goes straight to Anthropic: compression was found to strip the persona that is appended to the system prompt. See Operations.

Components ​

Process (PM2 name)DirectoryPortRole
lucy-bridgebridge/—Telegram ↔ Claude. Persistent session per chat, recall prefetch, file intake, commands.
lucy-coordinatoragent-machine/8780Central API: memory recall and indexing, board (cards, projects, pipelines), personas, model lanes, token guard.
lucy-vps-workeragent-machine/—Claims card stages from the coordinator and runs them with Claude or a cheap lane.
lucy-autopilotagent-machine/—Approves, rejects or answers routine card gates (never deploy/security gates).
lucy-hubhub/server/8800Web cockpit: serves the built React UI and the /api used by it.
lucy-pxpipepxpipe/47821Token-compression proxy used by the worker, autopilot and hub.
noteflow-viewagent-machine/8090Static viewer for one card workspace. Specific to the original install; you can drop it.
DataDefault locationContents
Vault~/lucy/lucy-vaultMarkdown memory. Search index in .index/memory.db (rebuildable).
Coordinator dataAM_DATABoard state, token ledger.
Hub stateLUCY_STATE (~/.lucy-hub)2FA secret, schedules, event log, chat history.
Bridge state~/.lucy-bridge-*.jsonChat→session map, Telegram offset, per-chat preferences, status.

Telegram commands ​

CommandEffect
(plain message)Chat with Lucy.
/newStart a fresh session (forget the current thread).
/stopClear queued messages and interrupt the reply in progress.
/model, /personaChoose the chat model (a Claude model, a cheap lane, or auto) or a persona overlay for this chat.
/think on|offShow or hide the reasoning block of lane models that expose it.
/prompt <task>Have the Prompt Architect turn a rough request into a polished prompt.
/fan, /orch, /autoRun tasks in parallel, as plan → sub-agents → synthesis, or in an autonomous loop.
/ctx, /info, /token, /idInspect context usage, engine, token usage, your chat and user ID.
/restartRestart the bridge through PM2.

More in Telegram.

Where to go next ​