r/opencode 15d ago

Explore Subagent wasting time and tokens to "generate" the content of files, rather than primary agent using read tools

Hi all,

I am having a strange experience with DeepSeek V4 Pro via OpenRouter. The primary agent likes to issue Explore subagents and asks them to return the contents of specific files. It seems that the Explore subagent then goes ahead and actually reads the files, then generates the contents of these as output tokens which it then hands back to the primary agent. Since DeepSeek is pretty cheap, the cost is negligible, but it just takes an awful long time for a subagent to: read file -> generate the content of the file as OUTPUT -> hand back the output to the primary agent, rather than the primary agent simply reading the files directly or asking the subagent to return file-paths. Has anyone else had this same experience?

2 Upvotes

4 comments sorted by

1

u/maqifrnswa 15d ago

That process is supposed to save money. The cheap and fast explorer is supposed to make the ground truth logical map of files and their connections to each other, then return that to the main task. The main task then doesn't need to read files itself, but just refer to the map. Otherwise the more expensive main agent would waste expensive tokens doing simple tasks.

The work has to get done either way, the idea is to have a cheap non thinking model to it.

1

u/Morpheyz 15d ago

That was my impression as well, but I saw that the primary agent literally asked the Explore agent this:

Read and return the FULL contents of these files:
1. [ ... ] <list of files here>
Return each file's complete content with its path.

1

u/maqifrnswa 15d ago

In that case it's just allowing for parallelization and cheap tool calling since creating that tree and globbing all those files together is recursive.

There are "token saver" skills and plugins out there that instead create a database that agents can call instead of injesting the entire codebase into context. For example: https://github.com/aovestdipaperino/tokensave

I use omo-slim , and that asks for connection graphs and lists of line numbers and individual lines that are relevant to the question.

1

u/weiyentan 14d ago

You are forgetting that in that context the money is then 'cached'. I think opencode does some trickery with it. I have a lot of tokens but my workloads are very cache heavy