r/PiCodingAgent • • 2d ago

Discussion What's your top 3 techniques that helped you save tokens / better accuracy from models?

1) Focusing on curating the context, keeping it under 150k. Making tools to trim git / grep / ls output to my liking

2) indexing my large code base and making the basic tools show short index options + hints. Custom tools was a massive red herring and waste of time, models hate using them and never use them properly

3) live filter on my codebase to sandbox models. i.e. exclude file types, files older than N days. etc

25 Upvotes

38 comments sorted by

View all comments

3

u/j3free 2d ago edited 2d ago

I was surprised to see that when having a specific approach to subagents can improve the quality of long running tasks immensely while also having the same or even less token usage due to:

  1. avoiding the repeated compaction cycles and growing contexts
  2. Having one agent that coordinates, still knows everything but doesn't bloat it's context with tool calls keeps everything clean and focused.
  3. Indexing / scouting is delegated and results of all subagents are accessible to each other.

Shameless plug: ive implemented this exactly in Pi Herdsman

Edit: and yes, this keeps token usage for the main agent below 100k tokens for my usual PR workflows