Let agents archive their own thread (archive_thread MCP tool) #14329
luigiwidmore
started this conversation in
Ideas
Replies: 0 comments
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.
Idea: give agents an
archive_threadtool in the built-int3-codeMCP server, so they can archive their own thread when the user asks (for example "archive this thread once everything is done").Why: I run many long agent threads (tasks that end with a merge, a deploy, a report). Once one is done, the natural last instruction is "archive this". Today the agent can link PRs to its thread but can't close it out, so I archive by hand.
One non-obvious constraint: the agent calls the tool during its own turn. Archiving right away makes provider ingestion drop the rest of that turn: the final message, the turn completion, and the session returning to ready. The thread then looks stuck as running, even after unarchiving. So the tool should defer the archive until the calling turn ends, and cancel it if the user starts a new turn first.
I opened a small PR that does exactly this, in case it's useful: #14328. It adds a new
threadtoolkit and capability granted to every provider, uses event-stream-based deferral, and includes tests. Happy to change the approach, or to close the PR if you'd rather design this differently.All reactions