Agent Wealth HubFree public resources
中文 EN العربية

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

  1. Use list_sessions(directory=project_dir) to list sessions by last-modified time and show summary, branch, and file size with get_session_info. [sessions]
  2. On selection, load history using get_session_messages; title with rename_session and categorize with tag_session, using a soft-hidden tag by default. [sessions]
  3. For a new direction, call fork_session(session_id, up_to_message_id=...), then resume with ClaudeAgentOptions(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

Permissions

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

https://github.com/anthropics/anthropic-cookbook/blob/9c1e493ddd2b82df399d2a61b9c806c539e18be6/claude_agent_sdk/05_Building_a_session_browser.ipynb

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

Related resources