How to build your own AI agent operating system from scratch. 4 phases. 20 steps. No coding background required. Paste-ready prompts throughout.
This is the full architecture for a personal AI agent operating system. Not just a chatbot. An actual operating system that knows your goals, manages your calendar, captures your thoughts, and coaches you toward what matters.
Follow it in order. Do not skip phases. The dependencies matter.
| Phase | What you build | End state |
|---|---|---|
| Phase 1 — Foundation | Telegram bot, personality, calendar, cloud deploy | Working assistant |
| Phase 2 — Input Layer | Voice notes, screenshots, document uploads | Frictionless capture |
| Phase 3 — Intelligence Layer | Obsidian knowledge base, auto-routing | Memory + context |
| Phase 4 — Proactivity Layer | Calendar write, smart scheduling, morning briefs, drift nudges | Full operating system |
Get a working Telegram bot live with calendar awareness and your personality baked in. End of Phase 1 = usable assistant.
Before building anything, get clear on the stack. Each tool has a free tier or low entry cost.
Sign up as you go. Save every login in a password manager.
API keys are how the agent connects to each service. Treat them like passwords.
sk-ant-1234567890:ABC...https://api.telegram.org/bot<TOKEN>/getUpdates in a browser. Find the chat.id number in the response.This is where the agent code lives on your machine.
mkdir ~/my-ai-agent
cd ~/my-ai-agent
On Mac, install GitHub CLI so Claude Code can push your work online:
brew install gh
gh auth login
When prompted: choose GitHub.com, then HTTPS, then login with browser. Follow the flow.
This is the most important step in the entire build. Define your agent's personality BEFORE writing code. The voice, the rules, the defaults. This is what separates an AI agent from a generic chatbot.
Start Claude Code from inside your project folder:
claude --dangerously-skip-permissions
Paste the prompt below. Customise the personality section to fit you before pasting.
Claude Code walks you through file by file. Approve each step. Customise the personality before pasting — the example uses one voice. Yours should match how you actually want to be spoken to.
Add the keys from Step 2 to your .env.local file:
Test locally with npm start. The bot should boot. Send it a Telegram message — nothing happens yet because Telegram doesn't know where your local server is. That gets fixed when you deploy in Step 8.
OAuth setup:
https://developers.google.com/oauthplaygroundGenerate a refresh token at developers.google.com/oauthplayground:
calendar.readonly and calendar.eventsrefresh_tokenTell the agent where you are and how your week works. Otherwise it defaults to UTC and Sunday-start weeks, which breaks reasoning about "this week" and "tomorrow".
Small but critical. Without it, ambiguous queries like "what is tomorrow" return wrong-day results.
The agent only works while your laptop runs. To go 24/7, deploy to Railway.
.env.local to Railway's Variables tabcurl https://api.telegram.org/bot<TOKEN>/setWebhook?url=https://your-railway-url.up.railway.app/api/telegram-webhook
Send a Telegram message. The bot replies from the cloud.
Make capture frictionless. Voice notes, screenshots, document uploads. Whatever's in your head should reach the agent in seconds.
Voice is faster than typing, especially for messy thoughts. Add OpenAI's Whisper model to transcribe voice notes sent via Telegram.
sk-)Claude can read images. Send a screenshot of an Instagram profile, an article, or a meeting note, and Claude can extract what's in it.
PDFs, Word docs, and other files all become readable input.
Connect a structured knowledge base. Teach the agent who you are, what you want, what matters. Then make it route input automatically.
Obsidian becomes the agent's long-term memory. Your goals, voice, businesses, contacts, daily logs all live here as markdown files. Numbered prefixes sort folders in workflow order automatically.
Production agents can't see your laptop, so the vault needs to live on GitHub for the agent to read it.
my-agent-vault)git init && git add . && git commit -m 'initial' && git pushGenerate a Personal Access Token with read+write access to that single repo:
github.com/settings/tokens?type=betaTell the agent which files to read on every message.
The agent now grounds every reply in your actual goals and voice. Generic answers become personalised answers.
This is the step most people skip and then wonder why their agent feels generic. Inside 00_BRAIN/, write real content into each file. Not aspirational. Real.
Now that input is captured (Phase 2) and a structured knowledge base exists (Steps 12–15), connect them. Voice notes, ideas, screenshots get classified and routed automatically.
The agent acts on its own. Creates events. Suggests focus. Sends morning briefs. Coaches you toward your goals without being asked.
The agent reads your calendar. Now let it write.
The agent can now manage your time, not just observe it. Always with confirmation, never autonomously.
The agent at full power. It looks at your calendar, your open loops, your goals, and your operating principles, then suggests how to spend free time.
Now you ask "what should I do" and the answer is grounded in your actual goals, not generic productivity advice.
A scheduled job that sends a brief to Telegram each morning. Pulls today's calendar, top open loop, top goal-relevant task.
On Railway: add a cron schedule (Settings → Cron). Run a brief generator at your wake-up time.
You wake up, glance at Telegram, know exactly what matters today. No decision fatigue.
The final piece. The agent flags when you're drifting from what you said you'd do.
Four phases. Twenty steps. A working assistant that knows your goals, captures your thoughts, organises your work, and coaches you toward what matters.
The hard part wasn't the code. The hard part was being honest about what you want this agent to do for you. That clarity is what makes it yours.
From here, it's iteration. Add new capabilities as you discover what you actually need. The architecture supports it. Each new feature is another conversation with Claude Code, another commit, another deploy.
AI Consultancy builds custom AI agents and operating systems for founders and businesses that want the result without the build.
Book a free discovery call →