Documentation
¶
Overview ¶
Package link connects the old and new sessions using only official Claude Code features: it builds the resume command (--resume, --fork-session, --remote-control, --desktop), the start prompt that tells the resumed session it was moved and asks it to check its environment (and, when asked, to notify the old session with SendMessage), and the text to paste into the old session otherwise. It reads `claude auth status` to decide whether Remote Control is available and whether both machines use the same account. It never writes to session sockets.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OldSessionNotice ¶
OldSessionNotice is the text for the user to paste into the old session when automatic notification is not possible (no Remote Control on both sides).
func SameAccount ¶
SameAccount compares two logins. known is false when either side could not be read.
func StartPrompt ¶
StartPrompt is the first message of the moved session. It tells Claude what happened, what that implies, and asks it to verify the environment before continuing.
Types ¶
type Auth ¶
type Auth struct {
LoggedIn bool `json:"loggedIn"`
Method string `json:"authMethod"` // claude.ai | api-key | …
Provider string `json:"apiProvider"` // firstParty | bedrock | vertex | …
OrgID string `json:"orgId"` // identifies the account for comparisons
Subscription string `json:"subscriptionType"` // pro | max | team | enterprise | …
}
Auth is what `claude auth status --json` reports about a machine's login. The email address is deliberately not kept.
func (*Auth) RemoteControl ¶
RemoteControl reports whether this login can use Remote Control, and why not. Remote Control needs a claude.ai subscription login with Anthropic as the provider.
type Context ¶
type Context struct {
SourceHost string
SourceOS string
SourceVersion string // Claude Code version that last wrote the transcript
SourceCWD string
TargetHost string
TargetOS string
TargetCWD string
Branch string
WorktreeNote string // e.g. "a new worktree was created at …" / "the main checkout is used"
Unpushed int
Dirty int
UnmappedNote string // paths that were not remapped, if any
SecretsFound int
Redacted bool
ThinkingDrop bool
Live bool // the source session was still running
Fork bool // the source keeps running (fork) instead of handing off
NotifyOld bool // ask this session to message the old one
OldName string // the old session's name, for SendMessage
NewName string // this session's Remote Control name
}
Context is what the new session should know about its move.
type Resume ¶
type Resume struct {
Dir string
SessionID string
Fork bool
RemoteCtl bool
Name string // Remote Control / session name
StartPrompt string
// PromptFile, when set, holds StartPrompt; shell commands read it instead of inlining
// a long quoted prompt.
PromptFile string
// Desktop opens the session in the Claude desktop app (claude --desktop), where the
// installed Claude Code has that flag.
Desktop bool
}
Resume describes how to start the moved session.