Pi + Ollama I Replaced Claude Code With This FREE Local Agent
Leon van Zyl ·2026-06-30 ·2 min read
Summary written by us from the video's transcript. The video, and everything in it, is Leon van Zyl's work.
Learn how to set up a lean local AI coding agent using Pi Agent SDK and Ollama, manage context windows, and efficiently build and deploy a website with free models.
Takeaways
- A lean harness preserves token budget and keeps small models effective for coding tasks.
- Pi Agent SDK works with Ollama‑downloaded local models via a simple `Models.json` configuration file.
- Use memory files (`agents.nd`) to store design rules and reference assets during generation.
- Add only needed extensions (e.g., web search) to avoid context bloat while still gaining functionality.
- Break large implementation plans into small feature files to stay within the model’s context window.
Why a Lean Harness Matters
Local models often fail in coding because harnesses like Claude Code preload 20,000‑30,000 tokens, quickly exhausting the limited context window of free models (≈120k‑200k tokens). When the context exceeds ~50‑70% of its capacity, model quality degrades. A minimal harness keeps token usage low and avoids confusing smaller models that lack advanced tool‑calling abilities.
Installing Pi Agent SDK and Ollama
Visit pi.dev, copy the npm install command, run it in a terminal, then verify with the `pi` command to open the chat interface. Download Ollama from ollama.com for your OS, install it, and confirm it works by running `ollama` and seeing its menu.
Adding Local Models
Pull a suitable model such as QIN 3.6 (27B ≈ 16 GB VRAM or 35B ≈ 24 GB). Use `ollama pull <model>` then test with `ollama run <model>`. In the Pi Agent folder (`~/.agent/Models.json`) add an entry for each model so the `/model` command lists them.
Configuring Project Memory and Design System
Create an `agents.nd` file to set project rules (e.g., respond like a pirate). Add a `design.md` file containing typography, colors, spacing, etc., and tag it in memory so the agent can reference the design system during code generation.
Extending the Harness When Needed
By default Pi Agent lacks web search, MCP, or skills. Install extensions from the Pi marketplace—e.g., `pi-web-access` to enable live searches. After installation, a new session can answer queries like “latest news from OpenAI” using a real‑time search tool.
Creating and Splitting an Implementation Plan
Generate a detailed step‑by‑step implementation plan for the website (using ChatGPT or Claude) and save it as `implementation_plan.md`. Because the file is large, ask the agent to split it into logical feature chunks, then feed each chunk individually, clearing the context (`/new`) between features.
Deploying the Finished Site
Package the HTML/CSS/JS files into a zip (or `public_html` folder) and upload to HostingGo (or similar). After migration, the site is live at a temporary domain; custom domains can be added later. Updating the site simply requires re‑zipping changed files and repeating the migrate step.