pi.dev - LLMs cost reduction

@santi@gone.lema.org

Content warning: pi.dev - LLMs cost reduction

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