Post #4020944
2026-07-22 21:56 UTC
TIL I wasn't using context-mode efficiently in Pi. That is wasting energy, and consquenly money. So I am sharing this as it might help others who aren't experts in the usage of LLMs to protect their wallet and the environment I guess.
First I noticed cost on DeepSeek was growing and the fact is my context had grown over a lot using the same session for 20 days. Most of it was about things that were rewritten / changes 10 times.
Short term solution for exploding context was to ask for a summary.md with important content from the accumulated context that had grown to sereral GB and start a n ew seassion (context data down to 100-200mb today). I noticed the startup of a session got slow.
Cache writes are 10x more expensive than cache reads on DeepSeek and I guess on others too. So smaller context changes everything.
Turns out context mode, which I had installed but didn't optimize to use properly.. can index data so the agent can search it locally instead of reprocessing all files all the time.
https://pi.dev/packages/context-mode
So I just told in agents.md which c and .lua files were essentials (core of the system) and now it can use the ctx_search more efficiently.
https://gist.lema.org/santiago/4219967b24874b3d872ed100b2370fb6
Replies (1)
-
@bryan@dusty.ninja 2026-07-22 22:07
@santi@gone.lema.org I basically do short runs with a fresh context each time. It is a must for a Local LLM where the maximum context is about 128-256k in size. here is a sample prompt: `read AGENTS.md, Spec.md, and todo.md. Read entire source files when doing edits. Do ONE ITEM in the todo.md list that you think is most important. After doing that ONE ITEM check off the item in todo.md, commit the change to git along with todo.md. Think about if there are other very important tasks that should be added to the todo.md. if there is, add them and commit. Now you're done. We are only doing ONE ITEM and adding to todo.md if really needed.` This is my version of a 'Ralph loop'.