Expand description
Bridge pointer for crash-recovery.
Translated from openclaudecode/openclaudecode/src/bridge/bridgePointer.ts
Crash-recovery pointer for Remote Control sessions.
Written immediately after a bridge session is created, periodically
refreshed during the session, and cleared on clean shutdown. If the
process dies unclean (crash, kill -9, terminal closed), the pointer
persists. On next startup, claude remote-control detects it and offers
to resume via the –session-id flow.
Staleness is checked against the file’s mtime (not an embedded timestamp) so that a periodic re-write with the same content serves as a refresh.
Scoped per working directory (alongside transcript JSONL files) so two concurrent bridges in different repos don’t clobber each other.
Structs§
- Bridge
Pointer - Bridge pointer data
- Bridge
Pointer With Age - Bridge pointer with age information
Enums§
- Bridge
Pointer Source - Bridge pointer source
Constants§
- BRIDGE_
POINTER_ TTL_ MS - Crash-recovery pointer TTL in milliseconds (4 hours)
Functions§
- clear_
bridge_ pointer - Delete the pointer. Idempotent — ENOENT is expected when the process shut down clean previously.
- get_
bridge_ pointer_ path - Get the bridge pointer path for a directory
- read_
bridge_ pointer - Read the pointer and its age (ms since last write). Operates directly and handles errors — no existence check. Returns None on any failure: missing file, corrupted JSON, schema mismatch, or stale (mtime > 4h ago). Stale/invalid pointers are deleted so they don’t keep re-prompting after the backend has already GC’d the env.
- read_
bridge_ pointer_ across_ worktrees - Worktree-aware read for
--continue. The REPL bridge writes its pointer to the original CWD which EnterWorktreeTool/activeWorktreeSession can mutate to a worktree path — butclaude remote-control --continueruns with resolve(‘.’) = shell CWD. This fans out across git worktree siblings to find the freshest pointer, matching /resume’s semantics. - write_
bridge_ pointer - Write the pointer. Also used to refresh mtime during long sessions — calling with the same IDs is a cheap no-content-change write that bumps the staleness clock. Best-effort — a crash-recovery file must never itself cause a crash. Logs and swallows on error.