AI & Agents · Pro
Personal Agent That Lives in Your Chats
A Telegram and iMessage agent with long-term memory and a cron scheduler that proactively runs jobs, remembers context, and acts across your tools
You build a personal AI agent that lives inside Telegram (and optionally iMessage via Cheogram or a Mac bridge) and uses Claude's tool-calling API to take real actions on your behalf. The agent persists conversation memory in a pgvector-backed Postgres store so it recalls context across sessions, days, and topics. A cron scheduler lets the agent proactively ping you, run recurring tasks, and surface reminders without you initiating anything. The result is a single chat thread that replaces a pile of disconnected automation scripts and sticky notes.
What you build
- Telegram bot that routes every incoming message through Claude with full tool-calling enabled
- Long-term semantic memory using pgvector: the agent embeds and retrieves relevant past context before every reply
- Cron-based proactive scheduler: the agent can set, cancel, and fire its own timed jobs (reminders, digests, checks)
- Tool registry with pluggable actions including web search, calendar read/write, and shell command execution
- Conversation threading so group chats and DMs each maintain isolated memory namespaces
- Graceful confirmation gate: the agent asks before executing any write or destructive tool
What it teaches
- Claude tool-calling loop: parsing tool_use blocks, dispatching to local functions, and returning tool_result messages
- Semantic memory with pgvector: embedding text, storing vectors, and doing cosine-similarity nearest-neighbor retrieval
- Proactive agent patterns: cron-triggered synthetic turns vs. purely reactive request-response bots
- Stateful multi-session context management with namespace isolation per chat
- Webhook vs. polling tradeoffs for bot APIs in production environments
- Confirmation-gated write tools as a safety primitive for agentic systems
How it works
- 1
User Message
- Telegram DM
- group chat
↓ webhook
- 2
Memory Retrieval
- embed query
- pgvector top-5
↓ inject
- 3
Claude Agent
- system + memories
- tool definitions
- tool_use loop
↓ dispatch
- 4
Tool Execution
- search / calendar
- save_memory
- schedule_job
↓ tool_result
- 5
Cron Runner
- polls scheduled_jobs
- fires due jobs
↓ send
- 6
Bot Reply
- Telegram message
- proactive ping
Sign in to open the build guide
Free account. Get the step-by-step build and every resource link.
Take it further
- Add an iMessage bridge using the open-source Beeper/Matrix bridge or a local AppleScript relay so the same agent answers in both Telegram and iMessage from one backend.
- Expose a web dashboard (plain Next.js route) that shows the memory store and scheduled job queue with delete controls, turning the invisible context into something inspectable.
- Give the agent a voice: use Telegram voice messages, transcribe with Whisper, and respond with a TTS audio note so the interaction feels ambient rather than keyboard-bound.


