Back to projects
case study · 2026 · in progress

Pilot CLI

A terminal AI coding agent in TypeScript, with tool calling, an approval prompt and an eval suite that scores how well it picks tools.

TypeScriptVercel AI SDKGeminiInkZodLaminar
  • 0.778 → 1.0tool-selection scorefile-tools eval set
  • Solobuilt end to endloop, tools, UI, evals
  • Tracedevery eval runin Laminar
case study · pilot cli
01
the problem

Why I built it

AI coding assistants feel like black boxes. I wanted to build one myself to understand how an agent decides which tool to call, and to measure whether it calls the right one.

02
my part

All of it, solo

  • 1Agent loop
  • 2Tool definitions
  • 3Terminal UI
  • 4Approval prompt
  • 5Eval suite
03
what I built

How a prompt moves through Pilot

  1. Ink terminaluser prompt
  2. AgentAI SDK + Gemini
  3. Approvaly / n prompt
  4. ToolsZod schemas
Eval suitereplays prompts against mocked tools · scores the agent's pick · traced in Laminar

The agent sends the prompt and Zod-typed tool schemas to Gemini through the Vercel AI SDK. Tool calls go through an approval prompt in the Ink UI before they run. The eval suite replays a dataset against mocked tools and scores tool selection with a precision/recall (F1-style) evaluator.

04
the hard part · results

The model kept picking the wrong file tool

My file-tools eval scored tool selection at 0.778. The cause was vague tool descriptions, not the model: after rewriting the readFile and listFiles descriptions so each one says exactly when to use it, the score went to 1.0. Try it.

tool descriptions

Press exact to rewrite readFile and listFiles.

prompt› show me src/agent.ts
agent pickedlistFiles ✗
tool-selection score0.778
scores: file-tools eval set · prompt and pick: illustrative

Every run is traced in Laminar, so a regression shows up as a lower score.

05
what I'd do next

Cables not plugged in yet

  • Make the loop multi-turn
  • Approval prompt on every file and shell tool
  • Evals for tool ordering and forbidden-tool avoidance

The full code is on GitHub.

case study · plug in