PromptScan scans codebases for dead prompts and token costs without running your app
Spiritual_Fun_9933 · reddit · 2026-07-23
A developer built PromptScan, a CLI that statically scans codebases for OpenAI, Anthropic, and LangChain calls, estimates input-token cost, and flags duplicated, oversized, or dead prompts without needing an API key or runtime instrumentation.
What it does
- Reads the repo and finds prompt call sites.
- Estimates token usage and cost where it can resolve the prompt.
- Marks unresolved cases instead of guessing.
- Flags dead prompt constants, duplicated prompts, and oversized context blocks.
What the author tested
- Ran it on 8 known repos and 4,137 source files.
- Found genuinely dead prompt constants in openai/swarm and geekan/MetaGPT.
- Correctly labeled many runtime-built prompts as unresolved.
- Also caught some false positives, such as ASCII art and error strings in continuedev/continue.
Practical use
The tool can be used in CI with promptscan diff main HEAD to fail a PR when a prompt’s token count jumps past a threshold, catching context creep before it hits the bill.
Stack / install
- TypeScript/Node
- tree-sitter (WASM) for parsing broken files
- js-tiktoken for OpenAI token counting
- MIT license
- Install via npm install -g promptscan or npx promptscan ./src
More from coding & agent
- Agent sandbox OS runs AI code in AWS Lambda microVMs through MCP — dhana36 · 2026-07-23
- A prompt that tests whether your AI workflow compounds or degrades at scale — Powerful_Creme2224 · 2026-07-23
- AI Agents End the Era of Deep Work, Ushering in a 'Shallow Work' Future — nptacek · 2026-07-23
- Claude is easier than the AWS console for building network topology HTML views — generativist · 2026-07-23
- Codex users report a frequent “thinking longer” delay over SSH — chaumian · 2026-07-23
- Kling shows an MCP workflow for cinematic AI video generation — Eric520CC · 2026-07-23