Happy to answer questions about the setup. I'm still unsure about the right task counter threshold for restarting sessions. Also, I'm trying to find a way to get the agents to indicate on my dashboard when they're "stuck" and waiting for something like access approval. The Claude Desktop app clearly knows when this happens (indicates it with a blue circle) but I haven't found a way to get the information into my dashboard.
What worked for me was making state updates part of the tool interface, not the prompt. Instead of 'report your status to this file,' the agent reads and writes to structured blocks (task tables, key-value state stores, append-only logs) through MCP as part of doing its actual work. The state update IS the work - when the agent completes a task, the tool call that marks it done also captures what it did, what it assumed, and what it skipped. The human sees a live dashboard without the agent needing to 'report' separately.
I've been using ctlsurf for this - each agent gets a task table it queries and updates through MCP tool calls. The key shift was: agents don't report status, they work inside a system that inherently tracks status.
On your task counter threshold question - I track session token usage in a state block and restart when the agent crosses ~80% of the context window. More reliable than counting tasks since some tasks eat way more context than others.