Skip to main content

PromptPilot

Small-language-model control layer for AI coding agents.

PromptPilot puts a cheap small model in front of Codex and Claude Code: it turns a rough prompt into a clear, constraint-pinned brief — so the frontier model stops burning tokens on ambiguity, repeated history, and noisy tool output.

What it does

  • Clarifies vague requests — flags ambiguity and asks first instead of guessing.
  • Pins constraints & protected spans — APIs, file paths, "don't touch X" go into the prompt explicitly.
  • Routes every request — clarify / answer / passthrough / act — instead of blindly forwarding.
  • Bounds session memory — long sessions don't re-feed the whole transcript every turn.
  • Compresses noisy tool output — pytest / grep / diff, via agent hooks, before the expensive model reads it.

The SLM manages the workflow; the frontier model still writes and debugs the code. PromptPilot optimizes for semantic-preserving context control, not blind token reduction — a rewrite may be longer when that preserves a constraint. The savings come from fewer ambiguous turns, bounded replay, and compressed context.

Measured (hybrid mode, one 15-turn chain): ~24k input tokens of SLM work directed ~12.66M input tokens of agent work — the control layer was ~0.2% of the input footprint, and the bounded session ran the same work on ~7.6× fewer input tokens than the tool's native --resume. Single workload, not a guarantee — see Benchmarks and Hybrid Mode.

Demo

PromptPilot visual demo: a vague request routes to clarify, the developer answers, and PromptPilot forwards a constraint-pinned brief to the coding agent

Above: a real slm-anthropic-v2 run. A vague one-liner routes to clarify — PromptPilot asks one sharp question instead of guessing — and after a one-line answer it routes act and forwards a precise, constraint-pinned brief. Steps 2 and 4 are genuine small-model output; refresh with python scripts/make_demo_svg.py --live.

Run the same control layer yourself with zero setup — python examples/demo.py defaults to the offline heuristic normalizer (no API key, no coding agent, no network); add --slm for the live routing + rewrite pictured above. The clarify route needs a v2 SLM backend, which the default slm now auto-selects for whichever auth you have — slm-anthropic-v2 / slm-openai-v2 (API key) or slm-subscription-v2 (Max OAuth / ChatGPT):

python examples/demo.py          # offline heuristic — zero setup
python examples/demo.py --slm    # live routing + rewrite (needs an API key)

Sample output, the live-SLM run, and every flag are in the demo walkthrough → examples/README.md.

How it works

%%{init: {"flowchart": {"curve": "basis", "nodeSpacing": 48, "rankSpacing": 60}}}%%
flowchart LR
  U([Developer request])

  subgraph PP["PromptPilot control plane"]
    direction LR
    M[["Session memory<br/>bounded summaries"]]
    C{{"SLM route<br/>clarify / answer / passthrough / act"}}
    Q["Clarify<br/>ask first"]
    A["Answer<br/>offer reply"]
    D["Direct reply<br/>opt-in only"]
    P["Passthrough<br/>raw prompt"]
    R["Act<br/>safe rewrite"]
  end

  subgraph AG["Frontier coding agent"]
    direction LR
    F["Codex / Claude CLI"]
    O["Code changes<br/>tests / summary"]
    T["Tool output"]
  end

  subgraph HK["Optional hooks"]
    H["Compress logs<br/>pytest / grep / diff"]
  end

  U --> M --> C
  C -->|clarify| Q
  C -->|answer| A
  A -->|enabled| D
  A -.->|otherwise| F
  C -->|passthrough| P --> F
  C -->|act| R --> F
  F --> O
  F --> T --> H --> F

  C -. "hybrid" .-> API[("Metered SLM API")]
  F -. "hybrid" .-> SUB[("Subscription CLI")]

  classDef entry fill:#fff7ed,stroke:#fb923c,stroke-width:2px,color:#7c2d12;
  classDef control fill:#eef2ff,stroke:#6366f1,stroke-width:2px,color:#312e81;
  classDef route fill:#f5f3ff,stroke:#8b5cf6,stroke-width:2px,color:#4c1d95;
  classDef agent fill:#ecfeff,stroke:#06b6d4,stroke-width:2px,color:#164e63;
  classDef hook fill:#f0fdf4,stroke:#22c55e,stroke-width:2px,color:#14532d;
  classDef infra fill:#f8fafc,stroke:#94a3b8,stroke-width:1.5px,color:#334155;

  class U entry;
  class M,Q,A,D,P,R control;
  class C route;
  class F,O,T agent;
  class H hook;
  class API,SUB infra;

For answer, PromptPilot skips the downstream coding agent only when direct SLM answering is enabled (--let-slm-answer or PROMPTPILOT_LET_SLM_ANSWER); otherwise the request continues to the agent. The diagram keeps node labels short so GitHub Mermaid previews do not clip long text.

Dig deeper in Architecture, Routes and Decisions, and Semantic Preservation.

Install

PromptPilot wraps an existing coding-agent CLI — install and authenticate at least one first:

  • Claude Code: npm install -g @anthropic-ai/claude-code → claude auth login --claudeai
  • Codex: npm install -g @openai/codex → codex login
pip install prpt[claude]      # Claude/Anthropic SLM path
pip install prpt[codex]       # Codex/OpenAI SLM path
pip install prpt[all]         # both

Subscription auth and API keys both work; hybrid mode can route the small control layer to a metered API key and the coding agent to a subscription CLI. ([anthropic] / [openai] remain as aliases.)

First run

cd /path/to/your/repo
prpt setup                                # one-time onboarding (checks + smoke test)
prpt "fix the flaky test in payments"     # auto-detects claude or codex from PATH
prpt --dry-run "refactor auth, no API changes"  # preview the optimized prompt
prpt --tool codex "add dark mode"         # force a specific agent
prpt restart                              # collapse a heavy session -> handoff.md -> fresh

Applying edits: prpt "..." forwards the brief to the agent in a single non-interactive pass, and in that mode neither agent writes files by default — Claude Code proposes edits (pending approval), Codex runs in a read-only sandbox. To let them apply changes, add the agent's auto-approve flag: Claude → --tool-arg=--permission-mode --tool-arg=acceptEdits; Codex → --tool-arg=--full-auto. Or use prpt install-hook (below) to run the optimization inside an interactive Claude Code / Codex session where you approve changes as usual. --dry-run only prints the brief.

prpt doctor re-runs setup checks; prpt install-hook wires prompt/tool hooks into Claude Code (or Codex via prpt install-hook --tool codex). Full flag set: prpt --help (or prpt --advanced-help for researcher/internal flags). New here? → QUICKSTART.md.

Docs

Long-form docs live in docs/ (source of truth), mirrored to the PromptPilot GitHub Wiki by scripts/publish_wiki.sh. Start at the Project Overview or the docs index. Operational pages stay at the repo root: QUICKSTART.md, SECURITY.md, CONTRIBUTING.md.

Metadata

Release files for prpt 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prpt 0.3.0
File Size Uploaded Provenance Actions
prpt-0.3.0.tar.gz 140.3 kB With provenance Details for prpt-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for prpt 0.3.0
File Interpreter ABI Platform Actions
prpt-0.3.0-py3-none-any.whl Python 3 none any Details for prpt-0.3.0-py3-none-any.whl

Total release size: 260.5 kB

Release files / prpt-0.3.0.tar.gz

Download URL prpt-0.3.0.tar.gz
Size 140.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cf6906e2087cdc70aa6ff5824d60c9830e95a7c1713e375c69b969621ce67ba6
BLAKE2b-256 checksum
How to use checksums
8bbcbd232654095d4d0ff724e3a6c036614c3a2017d55935ec5b54f23c24a9de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 7, 2026.

Transparency log

Release files / prpt-0.3.0-py3-none-any.whl

Download URL prpt-0.3.0-py3-none-any.whl
Size 120.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0b7e6ea009dc9ff4d6d6b3f528ff2a2ed7d0379967737fd6d9be3ec86599299
BLAKE2b-256 checksum
How to use checksums
3466aafc1fd79740ea0ac245bd448756db117d1e626c9a63100c4600398a7aad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 7, 2026.

Transparency log

Security for prpt 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for prpt-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page