Module 11: Build Your Own Setup
The end-to-end walkthrough. From zero to a working agent with memory, tools, a coding pipeline, and background work.
This is Module 11 of a 12-part curriculum: Build Software Products with AI — From First Principles to Production Pipeline.
Theory is over. This module is a practical walkthrough of building your own agent setup from scratch.
By the end, you’ll have:
- A persistent agent with memory and identity
- A set of core tools
- A coding pipeline that uses git worktrees and PRs
- At least one scheduled background job
- A local model option for private tasks
I’ll cover the OpenClaw runtime specifically (it’s what I use), but the patterns transfer to any framework.
Step 1: Choose Your Runtime
You need something to run your agents. The options broadly:
Managed frameworks. LangChain, CrewAI, AutoGen — Python-heavy, lots of abstractions. Good for learning; can be heavyweight for production personal use.
OpenClaw. Agent runtime for macOS. Manages sessions, memory, tool execution, cron, channel routing. Runs locally. What I use. Good for personal agent setups.
Custom stack. Build your own orchestrator using the Anthropic or OpenAI SDK directly. Full control; significant upfront engineering.
Hosted platforms. Relevance AI, Beam AI, others. Managed infrastructure; limited control; ongoing cost.
My recommendation: start with OpenClaw if you’re on a Mac and want to move fast. Build custom if you need maximum flexibility and are comfortable with the engineering overhead.
For the rest of this walkthrough, I’ll use OpenClaw patterns, but the concepts map cleanly to any runtime.
Step 2: Create Your Workspace
Your workspace is the working directory for your agent — the root of everything it knows.
Create a directory:
mkdir ~/.openclaw/workspace
cd ~/.openclaw/workspace
git init
Put it in git. Your workspace is your agent’s brain. Back it up.
Create the foundational files:
SOUL.md — Who is your agent? What are its principles? How does it think and communicate?
# SOUL.md
## Identity
- Name: [Your agent's name]
- Role: Personal strategic assistant
- Purpose: Amplify clarity, reduce cognitive load, increase leverage
## Principles
- First principles over rules of thumb
- Systems over one-off solutions
- Action over analysis paralysis
- Verification over assumption
## Tone
- Direct and specific
- No filler, no disclaimers
- Honest feedback over comfortable agreement
USER.md — Who are you? What does the agent need to know persistently?
# USER.md
- Name: [Your name]
- Timezone: [Your timezone]
- Current focus: [Top 1-3 priorities right now]
- Working style: [How you like to work]
- Projects: [Brief list of active projects]
MEMORY.md — Starts empty. The agent will build this over time.
# MEMORY.md
Last updated: [date]
---
(empty — will fill as you use the agent)
AGENTS.md — Instructions for the agent on startup. What to read, how to behave, what the rules are.
Step 3: Write Your System Prompt
Your main agent’s system prompt pulls together identity, operating instructions, and capabilities.
A minimal starting system prompt:
You are [Name], a personal AI assistant for [Your name].
On startup:
1. Read SOUL.md — your identity and principles
2. Read USER.md — who you're helping
3. Read MEMORY.md — what you know
4. Read today's and yesterday's memory/[date].md if they exist
Rules:
- When you learn something worth remembering, write it to memory/[today's date].md
- When something is important long-term, update MEMORY.md
- For coding tasks: always use branches, never commit to main
- For sensitive data: use local models only
Capabilities:
[List the skills/tools available to this agent]
Keep it concise. The system prompt is loaded on every session — it should contain what the agent needs to know on startup, not an exhaustive manual.
Step 4: Set Up Core Tools
Start with a minimal tool set. You can always add more.
Essential tools:
read_file— read file contentswrite_file— write content to a fileexec— run shell commandslist_directory— list files in a directory
These four tools, combined with a capable model, can accomplish an enormous amount. Don’t add more tools until you have a clear need.
Practical additions for coding work:
- The
githubskill (using theghCLI) — list PRs, create issues, check CI - The
gittool set — status, diff, log, branch management
For background/automation work:
- File system watchers for event-triggered tasks
- Calendar/email API integrations if you need proactive reminders
Test each tool as you add it. Give the agent a task that requires it. Verify the tool is called correctly and the result is handled properly.
Step 5: Set Up Your First Project and Coding Pipeline
Pick one active project. Set up the pipeline end-to-end for it.
# Create the project (or use an existing repo)
cd ~/Desktop
git clone [your-repo] myproject
cd myproject
# Create the worktrees directory
mkdir -p ~/Desktop/myproject-worktrees
Document the project in your agent’s workspace:
mkdir ~/.openclaw/workspace/projects
cat > ~/.openclaw/workspace/projects/myproject.md << EOF
# My Project
## Location
~/Desktop/myproject/
## Stack
[Your stack — e.g., Next.js, TypeScript, Postgres]
## Worktrees directory
~/Desktop/myproject-worktrees/
## Rules
- Never commit to main directly
- Every task gets a branch: feat/task-name or fix/task-name
- Run tests before opening PR
- All PRs require review before merge
## Key files
[List the most important files the agent should know about]
EOF
Set up CI. At minimum: lint, type check, tests on every PR. GitHub Actions is the easiest option.
Write a task spec for the agent’s first coding task. Be specific. Give it context, acceptance criteria, and a clear scope. Assign it a branch. Watch what it does.
Review the PR. Give precise feedback. Iterate. This first cycle is where you calibrate your expectations and refine your prompts.
Step 6: Set Up Memory Routines
Your agent should be actively maintaining its own memory.
Add to your system prompt:
Memory protocol:
- After completing any significant task, write a brief entry to memory/[today].md
- Include: what was done, what was decided, what to follow up
- When you identify something that should persist long-term, update MEMORY.md
- At the start of each session, confirm you've read the relevant memory files
Create the memory directory:
mkdir -p ~/.openclaw/workspace/memory
Set up a cron job (or heartbeat) to write a daily note:
# Every day at 1am
0 1 * * * → agent writes a brief summary of the day to memory/[date].md
Over time, this creates a rich episodic record of everything the agent has done. You’ll be surprised how useful it is to be able to ask “what did we work on last Tuesday?” and get a coherent answer.
Step 7: Set Up Background Work
Start with one or two background jobs. Don’t over-schedule.
Good first background jobs:
Daily note + priorities (1am): Creates tomorrow’s daily note with a priorities section. When you open your laptop, the structure is already there.
Weekly backup (11:30pm Sunday): Commits and pushes the workspace to a private GitHub repo. If your machine fails, your agent’s memory is safe.
Heartbeat (every 30-60 minutes): Checks for anything urgent: new messages, file arrivals, backlog updates. Reports if something needs attention. Otherwise silent.
Define each job with the same rigour as a task spec:
- What does it do, step by step?
- What does it read?
- What does it write?
- How does it decide what to communicate?
- What does it do on failure?
Step 8: Add a Local Model
For tasks involving sensitive data, set up a local model.
Install Ollama:
brew install ollama
Pull a model:
ollama pull qwen3:30b
Test it:
ollama run qwen3:30b "Explain what a context window is in 2 sentences"
Document your sensitive data policy in the workspace:
# Data Privacy Policy
The following must only be processed by local models (Ollama):
- Financial data (bank statements, spending, net worth)
- Health data
- Private credentials
- Sensitive business strategy
Local model: ollama/qwen3:30b
Update your agent’s routing logic to honour this policy.
Step 9: Calibrate and Iterate
After running your setup for a week, you’ll have feedback. Common things to adjust:
The agent is too verbose. Add a brevity constraint to the system prompt. “Low verbosity on routine tasks. High depth on analytical ones.”
The agent makes wrong routing decisions. Add more specific routing rules. Ambiguous cases need explicit examples.
The agent forgets things it should remember. Add more explicit memory writing instructions. Specify what categories of information warrant a memory entry.
The coding agent produces code you need to rewrite. Tighten the system prompt. Add more specific constraints. Provide more context about conventions and patterns.
Background jobs run when you don’t want them. Add quiet hours. Add conditions: “only if there’s something genuinely urgent.”
Calibration is iterative. The setup that works well at month three looks quite different from what you built on day one. Build in the habit of reviewing and improving regularly.
What You’ve Built
By following this guide, you have:
✓ A persistent agent with identity and memory
✓ Core tools and a skill set
✓ A coding pipeline with branch discipline, worktrees, and PR-first workflow
✓ Background jobs that do useful work without being asked
✓ A local model for sensitive tasks
✓ A calibration habit to keep it improving
This is a real foundation — not a demo, not a toy. You can build on it indefinitely.
What’s Next
The final module is different from everything before it. It’s not instruction — it’s retrospective. A complete, honest case study of how this system was actually built, what worked, what didn’t, and what I’d do differently. The unfair advantage of learning from someone who’s been running this in production rather than theorising about it.
Further Reading
-
[Docs] OpenClaw Documentation — The full reference for the OpenClaw runtime. Start with the quickstart.
-
[Docs] Ollama — Running Local Models — The model library for local inference. Browse what’s available before deciding which model to run locally.
-
[Docs] Anthropic API Quickstart — The fastest path to your first Claude API call. Good starting point before integrating with a runtime.
-
[Tool] GitHub CLI (gh) — The gh CLI is essential for the coding pipeline. Install this early.
-
[Blog] How I use LLMs — Andrej Karpathy — Karpathy’s practical mental model for working with LLMs daily. Sets the right expectations for building with AI.
-
[Course] MIT 6.5940 - TinyML and Efficient Deep Learning — If Module 11’s local model section interests you, this is the deep reference. Covers quantisation, pruning, and efficient inference — the techniques that make local models viable.
Referenced from @nikovijay
“I built an AI legal document generator that made $2,345 in 24 hours while caring for my newborn son. No coding needed.” — @sirajraval
“Claude Code + Figma is the future of design ✅” — @_heyrico
Subscribe to get notified when new modules and courses drop. No drip — just updates when there's something worth reading.
Subscribe on Substack →