Back to Writing

Writeup

Building a local AI agent from scratch with Ollama and OpenClaw

I'd already poked at this idea before building it properly — running n8n workflows connected to my Google Calendar, testing Gemini's built-in Google Suite integration as a kind of assistant. Both worked, in a limited way. n8n meant I was boxed into its own workflow logic, and I didn't want to pay for a VPS just to keep an instance running. Gemini's integration was tighter, but the agent itself was limited to whatever Google handed it.

The bigger reason was privacy. Claude, ChatGPT, Gemini — having them sit on top of my calendar, my data, the things I actually ask — is a real exposure, and a Pro subscription doesn't change that; it's still a public, hosted service, and "we don't train on your data" only goes so far before I stop taking it on faith. If I was going to hand an assistant access to my actual life — calendar, email, even trading research — I wanted it to be something I owned outright, running on hardware I controlled. And if it could reference my own trading rules and research, there was a reasonable chance it could pay for itself over time, not just save me effort.

The harness

OpenClaw is the actual framework — an open-source AI harness, essentially a prebuilt agent shell that just needs a brain plugged in through a local LLM. It comes with a "soul" file that defines the agent's personality and what it's meant to do, a skills section for extending what it can reference and act on, and a memory area for storing markdown files and other context.

Local models matter more in this community than most because of how it started: people were attaching OpenClaw to API access that was effectively unlimited at a flat price, until that access got restricted. Running your own model sidesteps that entirely — no one can throttle a model that's already sitting on your own hardware.

Buying the hardware

Hosting it myself ruled out two things fast. My own computer was off the table — it's my work machine, and I wasn't going to risk compromising it for a side project. Building a dedicated PC wasn't realistic either; RAM prices alone made that expensive, on top of everything else a new build needs. An old PC seemed like the cheap option until I actually checked the specs and realized it wouldn't keep up.

I landed on a Mac Mini — 16GB unified memory, Unix-based, Apple's M4 chip, around $600. A genuinely small, capable machine for the price. I pulled the trigger.

Picking a model

Once it was set up and connected to Discord, I started testing models through Ollama — Qwen, Gemma, Qwen Coder, the ones most people in this space land on first. A lot of it was just learning: how hardware and parameter size actually trade off against each other, how fast a model responds, how good the responses actually are once you push past demo-level questions. The differences between models weren't just speed and accuracy — they came through almost like separate personalities, in how they phrased things and what they defaulted to when a question was ambiguous.

Skills and memory

Once it was live and reachable from my phone, the real work was building out memory and context — deciding what skills it actually needed. ClawHub turned out to be the resource for that: an open-source repository of skills, structured as markdown files, built by other people running the same setup. Going through them taught me as much about prompt and skill design as anything else in this project — what actually gets a model to behave consistently, what doesn't, and why.

Memory took longer to get right. The early structure just dumped information into markdown files without much thought to how the agent would actually find anything in them. I ended up architecting it more like a graph than a flat folder — files referencing other files, organized so the agent has a real path to the right context instead of scanning everything and hoping.

What it actually costs

The local-model pitch is that it's free once you've bought the hardware, and that's only half true. Anything that needs live data — search, web access, connecting out to Google — runs through third-party APIs, and those cost money. I started using OpenRouter to switch between providers and keep those costs contained, but the lesson stuck: running this is not actually free, just differently priced.

The other honest lesson: open models are still behind Claude and ChatGPT for a lot of tasks. I don't think that gap closes as fast as some people assume. I'm fine using a hosted API for the things local models genuinely aren't good at yet — this was never about ideological purity, it was about not wanting my data sitting on someone else's server by default.

The actual thesis

This started as a personal-assistant project, but underneath it is a bet about where things are headed. We're increasingly a "you'll own nothing and be happy about it" kind of economy — subscriptions instead of ownership, "free" apps that make their money selling you to data brokers. I think privacy is going to matter more to more people over time, and a self-hosted AI assistant — like running your own server for your photos and movies instead of trusting a cloud service with them — is still a niche move right now, but a growing one.

Part of why I built this was to test that thesis on myself before believing it about anyone else. If it holds up, the skills from this project are also the skills behind eventually offering something like it as a service to people who want the same thing without building it themselves.

Back to Writing Questions? Let's talk →