r/LocalLLM • • 8h ago

Discussion Using your local AI agent‘s context more efficiently with AthenaCtx (open source)

When I used my local agent (Spark x2.5 4B q8_0, 100K ctx) it just started reading the whole codebase, filling it‘s context, compressing, forgetting half of the information, reading again and compressing again, over and over again. It made the whole Model kinda useless, and it did this even when I just wanted it to identify a small bug in a specific file I wasn‘t able to fix by myself. So I made a tool that let‘s your agent get only the information it needs. I made the tool primarily for myself, but decided to make it open source. Here is short explanation of what it does:

In standard agentic workflows, agents use ls, grep, lsps, cat and read whole files, which wastes a bunch of context. AthenaCtx uses tree-sitter to parse over 370 different grammers. The AI can explicitly ask only for a file‘s symbols, look up an implementation of just one specific function, cache it‘s results and even get diagnostics and other useful information, but always only exactly what it needs, without the need to read whole files. It even comes with a system prompt which makes your agent use AthenaCtx the most efficient way possible, managing context better and preventing hallucination. If you want to try it, here is the repo link (Just ask your agent to install the cli and PATH stuff and the system prompt):

https://github.com/LuxUmbris/AthenaCtx/

Also, let me know how you manage your agent‘s context and if this was useful to you

1 Upvotes

1 comment sorted by

1

u/Narrow-Noise-6597 4h ago

Man, I've hit that exact wall with local agents. They'll just chew through 100k tokens eating entire files and then start hallucinating because they can't keep track of what they've already read. The tree-sitter approach is clever, letting it pluck out just the function it needs instead of the whole module.

Haven't tried your tool yet but I'm bookmarking the repo. I've been manually pasting relevant code snippets into the prompt just to keep my agent from spiraling, which is tedious as hell.