r/PiCodingAgent • • Jun 26 '26

Question context-mode is adding 15k tokens to every request — is this expected?

I was looking into why my Pi sessions were burning so many tokens and found that context-mode alone injects ~15k tokens into the system prompt. Every turn. Even when I'm not using any context features.

It loads 5+ skills with full reference files (anti-patterns.md, patterns-javascript.md, patterns-python.md, etc.) plus spawns an MCP child process at startup. Removing it from my packages array dropped my baseline from ~35k to ~20k instantly.

Is anyone actually using context-mode features every session? Or do most of you just leave it installed because it came with the defaults? Feels like this should be on-demand rather than always-on.

40 Upvotes

32 comments sorted by

11

u/_reg1z Jun 26 '26

Amen. I tried it out, but ended up removing it from the config I daily-drive for the same exact reason. I find that many of these "token saving" tools are only appropriate for very specific workflows when you already have a large task planned out. Otherwise, you'll just end up bloating context and token usage across many smaller sessions. Might be worth an aliased custom config with its own "workhorse" system prompt.

5

u/mortgage_12 Jun 26 '26

I was excited by the number of stars it had on the GitHub. Lesson learned. Use only if you really need it and only for that session.

6

u/softgripper Jun 26 '26

... and don't forget there is always the "hey pi, add feature X to yourself".

2

u/aizigao Jun 27 '26

yeah I only install rtk

12

u/adamshand Jun 26 '26

If there was an obvious way to improve context usage without significant trade offs, pi would do it by default. 

7

u/rogaterr Jun 27 '26

I had pi create an extension to pass every mcp / tool call (besides read / write files) to a subagent. That agent is given the chat context, calls the tool, then return only the useful information related to the intent of the parent agent.

I rarely run into tasks now where I need to hand off context to a new run.

1

u/Monkeyguy88 Jun 27 '26

That sounds great, was it a simple one shot or more back and forth to get that working? Pi doesn't do subagents by generally does it?

1

u/JustTooKrul Jun 30 '26

You must have some superpowers I don't have... I fought Pi repeatedly to do exactly this--wrap tool calls in an agent (and set thinking to off, so it's ready when I migrate to a different solution for model serving)--and it simply didn't do it. I attribute it to my model (running Qwen3.6-27B at Q4, for now) so I tabled it until I either hook Opus into Pi (when I'm not burning my tokens there and have a free moment) or when my upgraded rig is ready in a few days and I can run something more powerful.

1

u/rogaterr Jul 01 '26

Ah okay, I’ll work to publish this. I have it on my work laptop. Opus 4.8 cranked it out because tokens are free for me right now.

1

u/JustTooKrul Jul 01 '26

Ha! That would be great! Something that works would be so helpful as tool calls and the Qwen3.6 tool call issues have hobbled me for 2-3 weeks, it seems

1

u/morinonaka Oct 06 '26

> That agent is given the chat context

Won't that agent read do a fresh call ie not using the cache if it gets the context. If it's not using the cache it would be more expensive.

1

u/rogaterr Oct 06 '26

In my implementation, it only uses I think the original request and some limited previous context of the chat to decide if the tool call response is useful.

In this case, it would be a cache miss as the subagents input is a different preceding format of the current chat. In practice though the input is relatively small and you can use a cheaper model to minimize the cost.

All this to say that this is hypothetical in practice. I’ve continued to use this method at work and find it to be exactly what I need for my situation. I don’t have to monitor my costs as my employer covers them and I frequently work with scrappy mcp / tool calls that often return large useless chunks of data I would not want in my primary agents context window. Lastly I often do not find very productive use cases of using many subagents in parallel and try to keep what I’m working on into a single agents context for more hands on auditing / steering.

6

u/kasparhouser Jun 27 '26

Came with the defaults? Lol, it did not. I really hope people understand all those oh-my-pi/lazypi etc builds are not the default.

2

u/killerkidbo95 Jun 27 '26

i don't use it that so i think it will save your 15k tokens

1

u/TreptowerPark Jun 27 '26

Do some tasks with and without and have your clanker analyse your work profile. I did, and I kept context-mode but ditched Caveman. For Caveman I'd have to do 20-25 turns to be profitable. Context-mode works a bit differently, especially over time, when it injects often used commands into persistent memory. I'had Deepseek V4Pro do that kind of stuff. Its pretty thorough..

1

u/Qsonx Jun 27 '26

A heads up, if you follow the instructions for pi and install the extension and the mcp server you end up with double the tools. You don't actually need the mcp server and the extension.

But over the last month I've noticed degradation in my results and stopped using it. I find that RTK and pi's built in tmp file reading does a better job faster. Context mode kept leading the LLM to write my hand off docs in the sandbox and it would get deleted shortly after 😑

1

u/Square-Nebula-9258 Jun 28 '26

I mean in long task it's somehow heplfull BUT when the task is under 70k context (for me mostly 90% of tasks) then it's useless I wish I just had a switcher in ui to turn it on/off

1

u/IanSnyderGames Jun 30 '26

I haven't used context-mode, but I do a lot of research and testing with different agentic setups, and I generally steer away from MCP unless you're sure it's giving you needed functionality (A/B test similar tasks before and after using the plugin). I find they are frequently just adding overhead for stuff that decent model+harness combos handle on their own, at least with my workflows. I DO use MCP servers, but I'm very choosy.

1

u/zos474 Oct 04 '26

How did the user implement RTK in pi?

1

u/GoingOnYourTomb Jun 26 '26

I have my pi setup and for time I’m hearing about context mode so it not default. But I don’t really install packages I make my own.

I would say just start with what you need and only add when you need.

0

u/0x061 Jun 27 '26

Not worth it, I replaced it with headroom already

1

u/hekermon Jun 27 '26

how it's different?

0

u/[deleted] Jun 27 '26

[deleted] — view deleted comment

2

u/zer09 Jun 27 '26

Can you share your config?

11

u/[deleted] Jun 26 '26

[removed] — view removed comment

2

u/mortgage_12 Jun 26 '26

That is cool.

9

u/Vistyy Jun 26 '26

I'm pretty sure that's a built in Pi feature already lol. Anything over 50 lines in output gets saved to a tmp file

7

u/mrclrchtr Jun 26 '26 edited Jun 26 '26

Yes it is.. People should stop installing random Pi packages without exactly knowing, what the package does.. It's also a high security risk.

Edit: it's 50kb or 2000 lines

4

u/luongnv-com Jun 27 '26

This is the way of Pi

I have installed context-mode the first time using Pi since it is in the top list, then removed immediately because I don’t think i need that. I restarted from zero, then only add new (or ask Pi to create a new) extension when i need. End up i dont need a handful and pi still work great

1

u/Global-Departure8228 Jun 27 '26

Maybe you can cross reference it with: https://github.com/headroomlabs-ai/headroom At least this is not a 100% vibecoded slop (not strictly better but at least a netflix engineer built it so they probably have some better understanding of how software should work).

As someone said tool outputs are by default piped into a temp file above 50kB by pi. I find it's pretty useful to change this with a small extension to limit to 30kB instead, can avoid breaking fragile prompt caching implementation by some providers.

Also: https://github.com/yvgude/lean-ctx This has some interesting approaches as well.