Skip to content

feat: gr new --agent-session-id to adopt an existing agent session #550

Description

@d0ugal

Summary

Support creating a graith session that wraps an existing agent session (e.g. a Claude conversation) rather than always starting fresh.

Proposed behavior

gr new <name> --repo <path> --agent-session-id <id> --worktree-path <path>

This would:

  1. Create a graith session entry pointing to the given agent session ID
  2. Use the specified worktree path (or create one at the expected location) — the agent won't resume correctly if the working directory doesn't match
  3. Resume the agent with the existing session ID, so the full conversation history and context is available
  4. Wire up graith sandboxing, messaging, and lifecycle management around it

Why

Sometimes an agent session gets orphaned (graith session deleted, crash, etc.) but the Claude session still exists in ~/.claude/ with valuable context. Currently there's no way to bring it back under graith management — you can claude --resume <id> directly but lose sandboxing, messaging, gr msg, gr store, and the session appearing in gr list.

Key constraint

The worktree path must match what the original session used. Claude won't resume correctly in a different working directory — it tracks the project path. So --worktree-path (or recreating the worktree at the original location) is essential.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliCLI commands and UXenhancementNew feature or requestsize: MNew command/subsystem across several files + state

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions