Pi local-model workflow
Pi extension: the local model does the work, GPT-5.6 only gates the plan and review.
Dev-storyChallenge
Cloud coding agents cost real money per run, and a local model on its own is not reliable enough for unattended edits.
What we did
A Pi extension where our local 27B model (FAST/SMART aliases over one loaded copy) drafts, implements and self-reviews, while GPT-5.6 is called only at two gates — plan finalization and final review — and never receives mutating tools; four commands (/deep, /run, /ralph, /web), a secret-redacted evidence packet for the paid review, and fail-closed per-run ceilings on paid requests, tokens and cost.
Result
Gated agentic coding where the paid model only plans and reviews — most tokens run locally on our own cluster — with hard cost caps per run.
Dev-story article
Pi local-model workflow: how the project was built
Cloud coding agents are fast but bill every token; a fully-local model is cheap but, on its own, not reliable enough to run unattended. Pi-local is the workflow that tries to get both at once: let the local 27B do the work, and spend a frontier cloud model only where it actually changes the outcome — the plan and the review.
Sections
05
Modules
05
Stack
TypeScript + Pi
Why the project exists
Cloud coding agents cost real money per run, and a local model on its own is not reliable enough for unattended edits.
Cloud coding agents are fast but bill every token; a fully-local model is cheap but, on its own, not reliable enough to run unattended. Pi-local is the workflow that tries to get both at once: let the local 27B do the work, and spend a frontier cloud model only where it actually changes the outcome — the plan and the review.
What was built
A Pi extension where our local 27B model (FAST/SMART aliases over one loaded copy) drafts, implements and self-reviews, while GPT-5.6 is called only at two gates — plan finalization and final review — and never receives mutating tools; four commands (/deep, /run, /ralph, /web), a secret-redacted evidence packet for the paid review, and fail-closed per-run ceilings on paid requests, tokens and cost.
A Pi extension with exactly four commands (/deep, /run, /ralph, /web). /run drives a gated pipeline: the local model drafts a plan, a cloud model audits and finalizes that plan, the local model implements and verifies, the local model adversarially self-reviews, an optional local fix runs, and the cloud model does the final review before APPROVED. The cloud model only ever plans and reviews, and never receives mutating tools.
Main modules and user path
It started on a general local runtime and then dropped it: the Thunderbolt-RDMA pair became the sole local executor, so the whole workflow runs on our own two-Mac cluster.
Cost is fail-closed: hard per-run ceilings on paid requests, tokens and dollars, and the paid reviewer starts from a secret-redacted evidence packet with no tools (it may answer NEEDS_INSPECTION rather than guess).
Escalation is the safety net: when the local model exhausts its fix loops, the smart model finishes the run rather than shipping something broken — the cheap path is the default, not a cliff.
Prefix-cache discipline keeps it fast: sticky per-session skill injection keeps the runtime prefix cache warm, and the fast and smart roles are aliases over one loaded copy of the weights, so switching phases never reloads the model.
A deterministic repo map orients each brief and tool call, and a live end-to-end harness runs the full pipeline against a real runtime so the gates are tested, not just described.
Architecture and technology decisions
Built with TypeScript, Pi, Agent workflow.
A TypeScript Pi extension; four commands; local fast/smart roles resolved from the already-loaded model catalog; a frontier model used as a tool-free planner and reviewer; hermetic smokes and multiround smoke tests gate go-live.
Result and lessons
Gated agentic coding where the paid model only plans and reviews — most tokens run locally on our own cluster — with hard cost caps per run.
Gated agentic coding where most tokens run locally on our own cluster and the paid model is spent only on planning and review — with hard cost caps per run, and an escalation path so a stuck local run still finishes cleanly instead of failing or quietly costing a fortune.
Related articles
Read next
Related project stories
These projects share nearby technical or product decisions, so they show how the same principle behaves in another context.
Dev-storyCMS
A dynamic headless CMS on webedge-db — content types, media, roles, and the public read API behind our sites and their articles.
Dev-storyWebEdge public site
Our lt/en/ru site on Astro, content pulled from the WebEdge CMS.
Dev-storyMeeting rooms and recaps
Video meetings on LiveKit + webedge-db — realtime rooms, recording (LiveKit Egress) and post-call recaps.
Have a similar idea?
Discuss your project