feat(sessions): pick up a session Caprock did not start - #22
Merged
Conversation
Rule 7 says Caprock never types into a process it did not launch, and the reason is concrete rather than principled: two writers on one PTY interleave characters and ruin both terminals. So a session started in somebody's own terminal was readable here and nothing else — the stats, the timeline, the cost, and no way to act on any of it. `claude --resume` is the way through, and it does not break the rule. It starts a *second* process on the same conversation, with the history read from disk. Nothing is taken away from the terminal that already has one, and the new process is one Caprock started, so it is typeable like any other — stats, timeline and terminal all live. Two shapes, because the situation has two. While the original is still running the copy branches: --fork-session and a new id. Two live processes sharing one id would write a single transcript between them and each end up holding half the other's turns. Once the original has ended there is nothing to collide with, so it simply continues under the same id. Both flag combinations were checked against the real binary rather than assumed. `--session-id` alongside `--resume` is refused outright unless --fork-session is present, which is the same distinction the other way round, and finding that out from `claude --help` cost nothing compared to finding it out from a user. Verified end to end: branched this very conversation into Caprock, saw its own history in the terminal, and the copy came up OWNED with pause/resume/kill live. The command is offered for copying too. Somebody who lives in tmux does not want a second place to type. Claude-Session: https://claude.ai/code/session_01DR8fggA2LRHcjNWUsqtDcF
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.
Both halves of that, and the second one turns out to solve the first.
Why it could not be done directly
Rule 7 — Caprock never types into a process it did not launch — is concrete rather than principled: two writers on one PTY interleave characters and ruin both terminals. So a session started in your own terminal was readable here and nothing else. Stats, timeline, cost, and no way to act on any of it.
What actually works
claude --resumestarts a second process on the same conversation, history read from disk. Nothing is taken from the terminal that already has one, and the new process is one Caprock started — so it is typeable like any other, with stats, timeline and terminal all live.Two shapes, because the situation has two
Still running → branch.
--fork-sessionand a new id, because two live processes sharing one id would write a single transcript between them and each end up holding half the other's turns.Ended → continue under the same id. Nothing to collide with.
Checked against the real binary, not assumed
Which is the same distinction from the other side. Reading
claude --helpcost nothing next to finding this out from a user — a lesson from earlier today, applied.Verified end to end
Branched this very conversation into Caprock and watched its own history appear in the web terminal. The copy came up OWNED with pause/resume/kill live, while the original carried on untouched.
The command is offered for copying too — somebody who lives in tmux does not want a second place to type.
https://claude.ai/code/session_01DR8fggA2LRHcjNWUsqtDcF