Repository navigation
MCP tool for an agent to compact its own thread at a safe boundary #15106
kkolodziej7
started this conversation in
Ideas
Replies: 2 comments
This comment was marked as spam.
This comment was marked as spam.
|
+1, the agent knowing where the safe boundary is is the whole thing. the failure i keep seeing when compaction lands mid step is the goal itself gets summarized into somthing vague and the run kind of starts over. id want a way to pin the task statement on that tool so it survives word for word. i build a coding agent on open models (grunz) and pinning is what stopped that for us |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem or use case
With Orchestration V2 an agent can run a long-lived orchestrator thread: it delegates work with
delegate_task, gets woken with results, and keeps going for hours. That thread's context fills up, and today only the human can do something about it by sending/compact. The agent has tools to manage almost everything else about its thread (t3_thread_configure,t3_thread_fork,t3_worktree_handoff, the queue tools), but nothing to compact itself at a boundary it knows is safe, for example right after a batch of delegated tasks has landed and before it starts the next one.The result is that an unattended orchestrator either runs into provider auto-compaction at an arbitrary point in the middle of a step, or has to start a fresh thread with a hand-written summary and lose the thread's lineage.
Proposed solution
An MCP tool in the thread toolkit that requests compaction of the calling thread, equivalent to the user sending
/compact. Rough shape:t3_thread_compact, calling thread only (same restriction ast3_thread_configure).continuationPrompt, queued behind the compaction, so the agent resumes by itself (same idea ascontinuationPromptont3_worktree_handoff).Why this matters
The agent is the one that knows where the safe boundaries are. A human watching the context meter does not, and an unattended orchestrator has no human watching at all.
Smallest useful scope
Calling thread only, no arguments, Claude and Codex providers, scheduled after the current turn.
Alternatives considered
/compact: works, but needs someone present at the right moment.create_threadswith a summary prompt: works as a handoff, but the new thread has no lineage to the old one and delegated tasks still in flight wake the old thread.Checked against
mainatfed41fa88: no tool underapps/server/src/mcp/toolkitsrequests compaction;/compactis documented indocs/user/composer.mdas a user command only.All reactions