Comment by kretaceous

8 days ago

Re: the lcm_expand(summaryID) tool

> Because expansion can recover arbitrarily large volumes of earlier conversation, this tool is restricted to sub-agents spawned via the Task tool; the main agent cannot call it directly. This restriction prevents uncontrolled context growth in the primary interaction loop.

What if the lcm_expand is called for a summary that has 1000s of messages that immediately floods the sub-agent's own context window?

Does lcm_expand only unroll one "layer" of the DAG and unrolls more if needed by another subagent?

By construction, individual summaries are not typically large enough to overload the context window when expanded.

The reason that the volume is potentially arbitrarily large is that one sub-agent can call lcm_expand multiple times - either vertically or horizontally. But that's a process that occurs gradually as the tool is used repeatedly.

This has not been a problem in our testing, but if it were a problem it would be easy to prevent sub-agents from invoking lcm_expand once their context buffer has reached a specified threshold.

  • Suppose there's the following situation:

        Summary A = summarise(message 1 to P)
        Summary B = summarise(Summary A, message P+1 to Q)
        Summary C = summarise(Summary B, message Q+1 to R)
    

    What does calling lcm_expand(Summary C) do? Does it unroll all messages from message 1 to message R or does it unroll to Summary B and message Q+1 to R?

    > volume is potentially arbitrarily large is that one sub-agent can call lcm_expand multiple times - either vertically or horizontally

    I'm assuming from this that it's the latter? In that case, that addresses my concern about not blowing up the context window immediately.

Another question is, why would earlier conversations need to be stored and recalled? They're irrelevant. Only records of the initial requirements and the work done, or work in progress, needs to be stored.

  • You could definitely build a coding agent that way, and it sounds like you've done it. We store the conversation history because:

    1. In our use of coding agents, we find that there are often things referenced earlier in the conversation (API keys, endpoint addresses, feedback to the agent, etc.) that it's useful to have persist.

    2. This is a general-purpose LLM memory system, which we've just used here to build a coding agent. But it is also designed for personal assistants, legal LLMs, etc.