All projects

Pi local-model workflow

Pi extension: the local model does the work, GPT-5.6 only gates the plan and review.

TypeScriptPiAgent workflow
Pi terminal screenshotDev-story
01

Challenge

Cloud coding agents cost real money per run, and a local model on its own is not reliable enough for unattended edits.

02

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.

03

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

01

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.

02

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.

03

Main modules and user path

M01

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.

M02

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).

M03

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.

M04

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.

M05

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.

04

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.

05

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.

Read next

These projects share nearby technical or product decisions, so they show how the same principle behaves in another context.

Have a similar idea?

Discuss your project