feat(daemon): Run forks self-archive when their dispatched task completes#935
Merged
Conversation
…etes Cheap-v1 auto-close (spec 0076): the forked-run prompt now names the fork's own session id and instructs it to call the archive-session tool on itself as its final action — but only after every dispatched block has settled on the owner Program, and never when work remains pending, it is blocked, or the user joined the conversation in the fork. Archiving is the existing soft close, so the transcript and the owner Program's session clip stay valid. Prompt-enforced for now; a daemon-side deterministic close can back it up later under the same contract.
This was referenced Jul 22, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the "cheap v1" auto-close for selection Run forks: the forked-run prompt now tells the fork its own session id and instructs it to archive itself as its final action once the dispatched task is complete — specifically, only after every block it was dispatched for has settled on the owner Program. The prompt also spells out when NOT to close: work still pending, blocked, or the user has joined the conversation in the fork.
@{session:…}clip stays valid; the fork moves to the owner's archived-forks group.construct_archive_session/agentd_archive_session). A daemon-side deterministic close (state-transition tracker, sibling of the verb-merge hook) can back this up later under the same contract — spec 0076 records both the contract and that consequence.Verification
cargo test --workspace— green (exit 0).forked_run_prompt_instructs_self_archive_on_completionpins the contract: self-archive targets the fork's id (not the owner's), fires only after blocks settle, and the stay-open exceptions are present alongside the unchanged owner-targeting instructions.🤖 Generated with Claude Code