DEV Community

MD
MD

Posted on

How I Cut AI Coding Token Costs by 96% with AST Compression

If you use Claude Code, Cursor, or Aider - you feel the pain.

You ask to fix a bug and it dumps 15 files into context. 45K tokens wasted.

I built PMC Engine - AST-level compression that scores every symbol and sends only what's needed.

The Numbers

FastAPI (48 files, 33K LOC, DeepSeek V4 Flash):

  • Simple fix: 45K -> 7.1K (84%)
  • Refactor: 85K -> 7.8K (91%)
  • Complex: 148K -> 7.7K (95%)
  • Avg: 91.8% reduction, 100% quality, <5ms

Quick Start

pip install pmc-engine
pmc index ./my-project
pmc serve --port 8080
Enter fullscreen mode Exit fullscreen mode

MIT: https://github.com/mdayan8/pmc-engine

Top comments (0)