June 16, 2026 · build log
A second brain, one loop at a time.
I wrote last time about turning Claude Code into a self-running agent with a goal, a loop, and claude -p. This is the layer that makes those loops actually useful day after day: a persistent second brain, and the boring tools you already have — Telegram, cron, your calendar, your task tracker — wired up as its hands. The trick isn't building it all at once. It's starting with one lean loop, watching how it serves you, and adding the missing loops only when you feel the gap.
What the second brain is (and isn't)
It's not a vector database you bolt on and forget. It's a small set of places your context actually lives, each one plain enough that you can open and read it yourself:
- Facts — short lines that auto-reload every session. The “what's true right now” index: who you are, what you're working on, the rules.
- A graph — structured “where does X live / what depends on Y,” so the agent navigates instead of re-reading everything.
- Notes & runbooks — hub docs with the exact how-to steps, written once.
- State — what's in flight, done, or blocked.
The point of all four is one thing: an agent that boots informed instead of blank. A cold agent re-derives your whole world on every run — slow, costly, and how it repeats last week's mistakes. A warm one picks up where the last one left off.
How claude -p leverages it
claude -p is Claude Code run headless — a prompt in, work done with tools, result out, on your existing subscription (no second API bill). Two mechanics make it lean on the brain instead of starting from zero:
- A session-start hook injects the context. Before the agent reads your prompt, a hook hands it the facts index and a short operating manual. Even a job a cron fires at 3am wakes up knowing who it is and what it's doing.
- It inherits your tools. Every MCP server you've added shows up as a tool the headless run can call — so the same agent that reasons over the brain can also read your calendar or write a task, with no glue code.
So a single line — claude -p “<goal>” --allowedTools “…” — becomes: read the brain, decide the right move, act through real tools, write back what it learned. The --allowedTools flag is your blast radius; give each run only what that job needs.
The tools you already have become its hands
You don't need to buy anything. The everyday tools on your machine already cover the senses and the actuators an agent needs:

- Telegram — the conversation. The two-way channel. You message the agent from your phone; it messages you back when something needs you. It's the difference between “a script that runs” and “something you talk to.”
- cron / launchd — the heartbeat. A schedule that wakes the loop. This is what makes it autonomous rather than something you have to remember to run. Keep the cadence slow at first (a few times a day) — you can always speed it up.
- Calendar — follow-ups & reminders. When the agent decides “circle back Thursday,” it drops a real calendar event. Your follow-ups stop living in your head.
- Tasks (e.g. Linear) — what's in flight. The agent writes decisions and next-actions into your tracker and reads back what's blocked, so work doesn't evaporate between sessions.
Each of these is just an MCP tool to claude -p. The agent doesn't know or care that “Telegram” is special — it's a tool it's allowed to use, same as reading a file.
Start with one lean loop
Resist building the whole thing. On day one you want exactly one loop, simple enough that you can see whether it earns its place:
# heartbeat.sh — fired by cron a few times a day
claude -p "Read my brain (facts + open tasks). Pick the SINGLE
highest-value thing I should do next. Message it to me on Telegram
in one short paragraph. Don't do anything else." \
--allowedTools "Read,mcp__telegram__send,mcp__tasks__list"That's the entire system on day one: a heartbeat that reads your context and tells you the one move that matters. No autonomy to post, spend, or change anything — just a sharp nudge from something that remembers everything. Live with it for a few days. You'll feel, concretely, what it's missing.
Then add the missing loops — only when you feel them
Every loop you add should answer a friction you actually hit, not one you imagine. The order writes itself once you're using it:

- You keep forgetting to circle back → a follow-up loop that turns “ping them Thursday” into a calendar event and surfaces today's.
- Decisions keep evaporating → a task-sync loop that records what's in flight and reads back what's blocked.
- You're drowning in inputs → a triage loop that reads, classifies, and only pings you above a threshold.
- You want it to do real work → a research or outreach loop (like the Reddit/X examples) that drafts while you sleep and leaves the sending to you.
The rule of thumb: add a loop the third time you wish it existed. Before that, you're guessing; after that, you're solving a problem you can name.
Why lean-first wins
Grow the organism, don't build the cathedral. A big upfront agent is mostly loops you guessed at, half of which you'll never trust enough to let run. A lean one earns each addition — and because every loop reads and writes the same brain, each new one makes the others smarter, not just more numerous. The system compounds instead of bloating.
It's the same bet I keep making: put the intelligence in the harness, not the model. The brain is durable context; the loops are durable behavior; the model is the best one going, already paid for, rented only for the seconds it's thinking. Keep the model cheap and replaceable, and let the value pile up in the structure around it — the memory, the loops, the rules — where it persists.
Start with the heartbeat. Let it tell you what to build next.