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:
- Create a graith session entry pointing to the given agent session ID
- 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
- Resume the agent with the existing session ID, so the full conversation history and context is available
- 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.
Summary
Support creating a graith session that wraps an existing agent session (e.g. a Claude conversation) rather than always starting fresh.
Proposed behavior
This would:
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 canclaude --resume <id>directly but lose sandboxing, messaging,gr msg,gr store, and the session appearing ingr 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.