Skip to content

Plugin /path:resume + /path:link-pr; fixes that make projected Claude sessions resumable - #150

Open
benbaarber wants to merge 2 commits into
mainfrom
ben/plugin-resume-link-pr
Open

Plugin /path:resume + /path:link-pr; fixes that make projected Claude sessions resumable#150
benbaarber wants to merge 2 commits into
mainfrom
ben/plugin-resume-link-pr

Conversation

@benbaarber

@benbaarber benbaarber commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #148.

Summary

Two new plugin commands (plugin path 0.2.0), plus the CLI guard that keeps same-machine round-trips from destroying local history. (The two resume-blocking projector fixes discovered in the same investigation — signature serialization and the trailing newline — merged to main separately via #151; this PR was rebased over them.)

CLI

  • p export claude --project refuses to overwrite an existing session file (new --force restores the old behavior), and path resume short-circuits the already-local case to resuming the local copy. Without this, same-machine round-trips — share your own session, then resume it — silently replaced the richer local original with the lossy projection.

Commands

  • /path:resume <input> (Pathbase URL, owner/repo/slug, file, or cache id): fetches and projects the session into the current project, then hands the user the exact resume step — /resume <id> in the running UI, or claude -r <id>. A plugin cannot switch the running TUI's session (verified against current docs; deep links only open new windows), so the one-keystroke handoff is the floor. The already-local case rides the CLI guard: the export's refusal carries the session id and becomes a direct /resume handoff — made structural after watching a headless run ignore a prose-only guard and re-export anyway.
  • /path:link-pr [pr]: shares the current conversation (same selection/auth rules as /path:share) and appends Agent session: [description](url) to the PR description — the PR from the arguments, else the current branch's, else the one under discussion. Description is phrased so "share this conversation to the PR" invokes it. Idempotent per URL; distinct sessions stack as separate lines.

Testing

  • New unit tests: project_claude never overwrites (diverged local file untouched, AlreadyLocal returned); p export claude refuses without --force and obeys it.
  • Live end-to-end: a projected thinking-bearing session resumes cleanly and summarizes its own history; headless /path:resume verified on both the fresh-projection and already-local paths; headless /path:link-pr against a real PR (append + second-session stacking), body restored after. Implicit invocation subsequently verified live: "share this session with my pr" routed through /path:link-pr and linked this session into this PR's description.
  • scripts/quality_gates.sh: 8/8 under the pinned toolchain; plugin suite 11 checks.

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

🔍 Preview deployed: https://3dcdad7b.toolpath.pages.dev

@ben-emp
ben-emp force-pushed the ben/plugin-resume-link-pr branch from a324f72 to 2d4b1d2 Compare July 30, 2026 20:33
Base automatically changed from ben/claude-plugin to main July 30, 2026 20:35
…th resume short-circuits

p export claude --project refuses to overwrite an existing session file (the
error names the id and suggests claude -r); a new --force flag restores the
old clobbering behavior. Found the hard way: same-machine round-trips —
share your own session, then resume it — silently replaced the richer local
original with the lossy projection. path resume short-circuits instead:
project_claude returns AlreadyLocal and the resume execs the local copy,
which may be newer than the shared document. Tests cover the diverged-local
untouched case and the refuse/--force pair.

(The signature-serialization and trailing-newline fixes discovered in the
same investigation landed on main separately via #151.)
/path:resume <input> fetches a shared session (Pathbase URL, owner/repo/slug,
file, or cache id) and projects it into the current project via p import
pathbase + p export claude, then hands the user the exact resume step —
/resume <id> in the running UI, or claude -r <id> from a terminal. Claude
Code has no mechanism for a plugin to switch the running TUI's session
(verified against current docs; deep links only open new windows), so the
handoff is the floor. The already-local case leans on the CLI guard: the
export's refusal carries the session id, and the command turns it into a
direct /resume handoff instead of an overwrite — verified headless, where
the model previously ignored a prose-only guard and re-exported anyway.

/path:link-pr [pr] shares the current conversation (same selection and auth
rules as /path:share) and appends the Pathbase link to a PR description —
the PR from the arguments, else the current branch's, else the one under
discussion; description phrased so "share this conversation to the PR"
invokes it. Idempotent per URL; distinct sessions stack as separate lines.
Verified headless against a real PR (append + second-session line), body
restored after; implicit invocation later verified live from the phrase
"share this session with my pr".

Both live end-to-end tests passed: a projected thinking-bearing session now
resumes cleanly (summarized its own history) and link-pr produced working
PR + Pathbase links.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant