Repository navigation
Import an agent session: pick any Claude Code or codex session and resume it - #278
Merged
Merged
Conversation
…sume it `Ia` (session.import.agent, also in the menu bar) lists the Claude Code and codex sessions on this Mac that heed does not have, newest first, from any folder. Picking one resumes it with the agent that ran it: on its worktree, in its repo (added if new), or as a chat in its folder. Importing a worktree now resumes the newest session of either agent kept for it. Closes #271 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The agent session picker joins main's dialog stack (AppModel.Modal) instead of its own stored variable, and clicksReachLists is main's !dialogOpen. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scope: only Claude Code and codex for now. The other agents (cursor, pi, opencode, gemini) can be added in follow-up PRs, one each, once their on-disk session formats are checked.
Closes #271.
What
Importing a worktree resumed only the newest Claude Code session kept for its folder. You couldn't pick an older one, resume a codex session, or import a session from a folder heed doesn't know or outside any git repo.
Ia(session.import.agent, also Import an agent session… in the menu bar) lists the Claude Code and codex sessions on this Mac that heed doesn't have yet, newest first, from any folder. Each row shows the first prompt, the agent, the age and the folder. Type to filter by prompt, agent or folder.↩imports the session after a confirmation and resumes it with the agent that ran it (claude --resume <id>/codex resume <id>, with heed's hooks):Ipdoes).Import.chatSession).agentSessionID), sessions where nothing was typed, and sessions whose folder is gone are left out.Iw,Ip,↩in Repos) now resumes the newest session of either agent kept for the folder (Import.newestSessions). If that session's agent isn't in your config, heed starts your default agent fresh instead of resuming under another agent.Formats
~/.claude/projects/*/<id>.jsonl, top-level files only (subagent transcripts are in subfolders). The folder comes from the lines'cwd, never from the project folder's name, which loses_and..~/.codex/sessions/<yyyy>/<mm>/<dd>/rollout-<time>-<id>.jsonl. The id and folder come fromsession_meta. The prompt is the first userinput_textthat isn't<…>context or# AGENTS.md. Checked against codex 0.162 rollouts (recorded inPLAN.md). heed's own codex calls run with--ephemeraland leave none.Code
HeedCore/StartWork/Import.swift:allClaudeSessions,allCodexSessions,allSessions,newestSessions(for:),chatSession. Building the agent command is shared by the worktree and chat imports.HeedApp/Model/AppModel+AgentImport.swift: the picker, the import, and fixture sessions for shots.commitImportedis extracted fromimportWorktreesand shared.AgentImportViewinMainWindow.swift, modelled on theIwpicker.Verified
mise run test: 2508 tests pass. The new ones cover the Claude scan (across folders,cwdread from the transcript, excluded, prompt-less and subagent files), the codex scan, the mixed newest-first list, newest per worktree, and resume commands for chats with either agent.swiftformat --lint(the pinned 0.58) andswiftlintare clean.mise run lintpicked up a global swiftformat 0.64 locally and flagged untouched files.text-checkis clean.worktrees/import-agentwas rendered and looked at;import-worktree*were re-rendered for the new subtitle.Not verified live
No import was done in the running app. The codex sessions available were all from Codex Desktop, and the codex CLI wasn't installed, so
codex resume <id>picking up a Desktop session is untested.🤖 Generated with Claude Code