Hello,
First and foremost, I apologize for the title. “Protocol” is doing a lot of heavy lifting. I would say this is more of a methodology, but I think it might be good to develop a standard protocol against it.
I’ve had a lot of exposure to long running agent tasks. Some of the issues I’ve noticed:
- Agents loose context of the project premise and begin focusing on submodules, tests, or other smaller components. It begins to overengineer the shit out of them.
- Agents invent jargon within the context of the project. Often to represent various complex states of the program; but those compressed text representations loose their meaning once the context window sufficiently changes. Then the same jargon eventually gets used under various meanings, or compacted further into decoherant nonsense.
- Agents build the project to such large scale that the cost of every change starts increasing beyond what’s reasonable.
- Agents build huge testing apparatuses that rival the project itself in complexity.
- …
There’s a lot of issues that come up. Various approaches to managing different dimensions of the issues. ADRs are good if managed well. The TODO list many harnesses have agents maintain is decent. However, I have seen much better success with a setup like this:
Tell the agent to maintain a directory: ./.agents/todo/
In there, the agent should keep a root-level catalog of current tasks as a markdown file. Each task comes with a status. Finished tasks are removed from the catalog, to prevent context bloat. Every task comes with its own directory, at ./.agents/todo/<task>/.
Inside a task directory, you have a root-level task descriptor with important context (semantic details, relevant code branches, relevant tests, acceptance criteria, …) as well as subdirectories to hold evidence of implementation. Task directories are never deleted, so they can always be referenced in the future.
Your AGENTS.md file can instruct the agent to maintain the ./.agents/todo/ directory:
- before beginning, update the catalog and write task directories
- begin first task. Always update task status before and after focus on task.
- remove completed tasks from the catalog, but maintain the task subdirectories.
This does not replace a planning / reviewing process. Planning with the agent should still occur before the agent starts work. Reviewing should still occur afterward. All this does is help keep the agents context relevant and focused during implementation.
Anyway… I’m tried and did not have the energy to do a super professional writeup. I don’t think the idea needs one though… you can start trying this out with minimal details.
Long run, I think it would be better to have a protocol which pins goal-oriented tasks and their statuses into the context window. The agent can report task status, which would dynamically update which context is shown to the agent. For example: when task 1 is active, the task 1 context is expanded within the context window.
This framework can also introduce novel ways of additionally managing context. For example, an interesting one is “soft deactivation.” Soft deactivation is when you would print pinned text into the streaming context window before unpinning it. This lets the information “age out” of the context window more slowly rather than abruptly, which could be ideal under different situations.
Anyway. I’m going to bed. Downvote my stupid ideas if you want to. I’m just telling you, I’ve had good results by being more forensic with live context construction / management. Context is a much bigger deal than people seem to give it credit for. We need more tools for managing it in different ways.
Great thing, though, is that many different frameworks can be implemented and tested merely by instructing the agent to behave in a particular way. If a practice is shown to work well for a given scenario, we should be documenting the workflow religiously… how’s it propagate through the context window over time? How does it affect agent behavior? What happens based on whether it’s at the top, bottom, or middle of the context? What happens if it’s repeated? What if the instruction consumes 1% versus 5% of the context window? … these are all important details.
Right now, people just ask an agent to do something and pay zero attention to what winds up filling their context window. In a sense, current context window management is very “unsupervised.” It’s like those fireworks that just bounce around everywhere on the street, shooting off in random directions. Here’s the thing, though… how can we expect good output when we have such poor context governance? We know better… we already develop harnesses, skills, memory servers, MCP, … we develop this because we already know how important context is — so we try to give as much context as possible.
Well now it’s time to flip the script. You need to start being more discriminatory with what’s allowed in the context window. What structure should the context take?
I bet you, a well organized context has ripple effects causing well organized output. That means: you don’t tell the agent to output high quality content, it just does it because it’s repeating the patterns already present in its context window. You see what I’m saying?
Alright, I’m really going to bed now.