Back to catalog / Agent workflows
Browse, organize, and branch agent sessions
List local session history, read messages, add titles/tags, and resume a branch from an earlier conversation while preserving the original.
Goal
Help users recover and safely continue past agent work.
Steps
- Use
list_sessions(directory=project_dir)to list sessions by last-modified time and show summary, branch, and file size withget_session_info. [sessions] - On selection, load history using
get_session_messages; title withrename_sessionand categorize withtag_session, using a soft-hidden tag by default. [sessions] - For a new direction, call
fork_session(session_id, up_to_message_id=...), then resume withClaudeAgentOptions(resume=fork.session_id)and verify the source session is unchanged. [sessions]
How to verify
The sidebar and message order match the transcript; the fork has its own session ID, writes continue on the fork, and the original remains intact.
Troubleshooting
If the list is empty, check that `directory` matches the `cwd` used to create sessions; hard deletion removes the transcript, so prefer a hidden tag.
Permissions
Prerequisites
- Python 3.11+, claude-agent-sdk v0.1.51+, Claude Code CLI, Anthropic API key, and access to the local project transcript directory.
Permissions
- The browser can read and update local conversation transcripts for the project; use tags for soft hiding and call `delete_session` only for an explicit hard delete.
Limitations
These functions operate on local transcripts under `~/.claude/projects/` without starting an agent or calling the API; a tag is one string, not an array.
Pinned upstream source
- Repository
- anthropics/anthropic-cookbook
- File path
- claude_agent_sdk/05_Building_a_session_browser.ipynb
- Pinned commit
9c1e493ddd2b82df399d2a61b9c806c539e18be6- Source checked
- 2026-10-14 · Reviewed against the pinned upstream source
Repository metrics
These values describe the upstream repository, not popularity or likes for an individual skill or playbook.
- Stars
- Not collected
- Forks
- Not collected
- Observed at
- Not collected
No metrics snapshot is available yet.
License: MIT
Main topic
Turn ecommerce campaign materials into a reviewable weekly brief