PhilGitHub

a coding agent experiment

Phil

Phil is a terminal coding agent built on LangGraph. It sends each request down the fixed workflow that fits it, and uses the cheaper model wherever that's enough. It's open source.

uv tool install phil-agent

Example run · Full path

One run, start to finish.

A feature request goes down the full path: a question, a plan, three tasks in their own worktree, and a review. An illustrative run, shortened. Real runs print more.

phil · calc @ mainillustrative
›add a --json flag to calc history
● routed: full path · Jev, confidence 0.93 · 160 ms
? Should --json print one array, or one object per line?› one array
? Two ways to build it: a formatter module, or a flag inside the command.› a formatter module
architect (high) wrote a spec and a plan: 3 tasks
critic (high) approved the plan
worktree .phil/worktrees/r-7c2a on branch phil/r-7c2a
task 1/3 the JSON formatter · implementer (low) · tests pass
task 2/3 the --json flag · implementer (low) · tests pass
task 3/3 the docs · implementer (low) · checks pass
reviewer (high) 0 open issues
✓ branch ready · phil pr r-7c2a · run cost $0.31

How it works

A request, a classifier, three paths.

A classifier reads each request and picks one of three fixed workflows. Each workflow is a LangGraph graph, so a run always takes the same steps for the same kind of request, and a small change never pays for a big one's process.

Your requestClassifierJev, or your low model if Jev is unavailable

Answer

A question or a diagnosis.

Answer path: a read-only agent replies.read-only agentreply

It reads a snapshot of your working tree. No branch, no commits.

Quick

A small, well-specified change.

Quick path: intake, implement, review; review can send a fix back to implement, up to three times; ends in a branch.intakeimplementreviewfix, up to 3branch

Up to three reviews, each followed by a fix. If a fix fails its tests, Phil offers the full path.

Full

A feature, a refactor, design work or a broad project.

Full path: intake, architect, critic (which can send the plan back to the architect to revise), your approval, tasks in a worktree, reviewer (which can send fix tasks back); ends in a branch ready for a PR.intakearchitectcriticyou approvetasks in a worktreereviewerrevisefix tasksbranch ready for a PR

Planned, critiqued and approved before any code is written. Design options on request.

Built withPython 3.14LangGraphLangChainDeepAgentsTextualRichTyperprompt_toolkitSQLite checkpoints

Decisions

Five decisions.

The choices that shape the experiment, and what we saw.

FIG 0.1

01 · Routing

A classifier picks the workflow

A small decision model, TypeSafe Jev, sorts each request into a path. If Jev is unavailable, your low model does it.

Deciding whether you asked a question or want a refactor is a classification problem. It doesn't need a large chat model.

What we saw: In the 2026-10-06 benchmark, Jev routed 50 cases with no wrong-path or unsafe routes, about 12× faster than the low model at p95 and about 4× cheaper.

FIG 0.2

02 · Models

Two tiers, plus vision

A high tier for judgement (architect, critic, reviewer) and a low tier for doing the work (implementer, tester). An optional vision model reads images only when an agent's own model can't. Each tier can come from OpenRouter, OpenAI, Anthropic, Google, Ollama, or an OpenAI-compatible endpoint.

Most of a run is routine work. Paying for the most capable model on every step spends the most where it helps the least.

FIG 0.3

03 · Structure

A fixed graph, not a free-roaming agent

Each workflow is a LangGraph graph. Its steps hand the next one a contract it can check, and state is checkpointed in SQLite.

A run that always takes the same steps is easier to predict, to measure and to debug, and a stopped run resumes where it left off.

FIG 0.4

04 · Context

Context kept small

Sub-agents return short answers instead of their whole search. Repeated history is prompt-cached on Anthropic models; other vendors cache on their own. Skills load only for the stages they help.

Most tokens in a long run are the same context sent again. Sending less, and paying less for what repeats, is where the savings are.

What we saw: With prompt caching on, 68% of the architect's input came from the cache, and its cost on the same goal fell from $0.38 to $0.21.

FIG 0.5

05 · Security

Agent shells never see your keys

Key and token variables are removed from every command an agent runs, code those commands run can't read a stored key through keyring, and commands with shell operators are rejected.

An agent that can run shell commands is one prompt injection away from reading your keys. This doesn't stop a malicious test from reaching the OS keychain directly, so review what agents add.

Install · Three commands

Install it and point it at a repo.

Phil needs Python 3.14, which uv installs for you if it's missing. Run phil setup once to pick a provider and models, then run phil in any git repo.

01 · Install

From PyPI, with uv (or pipx install phil-agent):

uv tool install phil-agent

02 · Set up

Pick a provider and a model for each tier. Your key goes in the OS key store.

phil setup

03 · Run

Start a chat in any git repo:

phil