Docs
Threads
This page tells you how Pensieve makes threads, how it sets the state, and how you close the work.
What a thread is
Pensieve makes one thread for each agent session and each branch that the session did work on. Work on a branch
is lines that the session wrote and that are uncommitted there, or that are in commits that the remote's default
branch does not have yet. A commit, a push or a PR is work too. A session that did work on two branches has two
threads. On main, a session's thread is open while its lines are uncommitted or not pushed.
A session that wrote nothing but ran on a feature branch is a review. Its card is on that branch, with the tag “review”.
Pensieve reads the sessions from your agents' transcript folders, a little at a time, and keeps the facts on disk. A new message in a session shows on its card at once. Threads need no index and no model, so they work in Threads mode and in Developer mode.
A ticket that is assigned to you is also a thread: a to-do. It stays a to-do until a session, a branch or a PR picks it up (see To-do threads).
Pensieve leaves out sessions in temporary folders and under ~/Library. Apps and scripts start those.
The thread card
Each card shows the title, the state, the time of the last activity, and where the work is: the repo, the branch and the uncommitted files. Click the card to open it, and click it again to close it. It has these buttons:
| Button | What it does |
|---|---|
| Resume session | Opens Terminal in the session's folder and resumes the session in the agent that wrote it. The copy button copies the command. It also works in Threads mode. |
| Fork session | Opens Terminal and starts a new agent session that reads the thread first. The copy button copies a prompt with the thread in it, for any agent. To change the agent, go to Settings → Agents. |
| Ship, Discard | Open a modal with the steps left (see Ship and Discard). A card in a cluster does not show them, because the cluster header has them. |
| Thread id | Copies the thread id, for the thread MCP tool. |
| Preview (eye) | Shows the thread as a page. |
An open card has these parts:
- Conversation snippet: the last words of the session. For a to-do, the ticket description.
- Related sessions: one list, newest first. It has the sessions on the same branch, PR or ticket, and the sessions that edited the same files (“≈ similar context”).
- Data sources in session: the PRs, tickets and branches.
- Slack: the Slack messages that name the thread's ticket key, PR link or branch name, up to 10, newest first. Each one says which of them it names. A direct message has the tag “direct” (see Slack).
- Files: up to 20, collapsed by default. First what the session made for people: a Notion page it wrote, a Slack message it sent, a published Artifact. Then what it used as context: a Slack thread, an email or a page that the agent read, a link in the conversation, a local document that it read. Code files that it edited are not on the list: the branch and its PRs hold them.
- Activity.
A card that lost its branch to another thread links to the thread that holds the branch.
How Pensieve joins tickets to threads
A thread gets a ticket when the ticket key is in one of these places:
- The branch name. The key can be in any case, for a ticket that Pensieve knows:
abc-123-fixandfeature/ABC_123both matchABC-123. - The session title.
- A commit subject.
- A PR title.
A git command that is only in quoted text or in a heredoc does not count as a branch write. Examples are test inputs, commit messages and PR bodies.
Clusters: the threads of one branch
The threads of one branch sit together in a cluster, newest session first, joined by a tree line.
One session holds the branch: the session with the largest share of the branch's surviving lines. Surviving lines are the lines that the session wrote and that are still on the branch. On a tie, the later session holds the branch. Its card says “holds the branch · N% of the branch's lines”, and its Resume session button takes the state color. The other cards show their share.
A session that does not hold the branch gets its state from its own data sources. If it has none, it gets the state of the branch that it wrote to. Such a session is never a thought.
The cluster's title is its PR's title. If it has no PR, the title is its ticket's title. If it has neither, the title is the title of the session that holds the branch. Each card in the cluster keeps its own title.
The cluster header shows the repo, the branch and the uncommitted files. It has these buttons: Resume, Ship, Discard, Fork from all N, a copy button for the prompt, and a preview. Resume resumes the session that holds the branch. Fork from all N starts a new agent session that reads all the threads of the branch first. Its prompt names each session that changed the branch, so that the agent can read their transcripts.
The six states
Pensieve sets each state from the thread's data sources: its PRs, branches and tickets. Material work is edits, commits, a branch or a PR. By default, the Threads tab shows Open, To-do, Thoughts and Loose ends.
| State | Meaning | Set automatically when |
|---|---|---|
| Open | You work on it now. | A session runs now. Or the thread has material work and activity in the last 3 days, and it is not done. |
| To-do | A ticket of yours that nothing picked up. | A ticket that is assigned to you and is not done, with no session, branch or PR on it yet. It becomes Open when work starts. |
| Thoughts | A session with no data source: no PR, branch or ticket that it wrote to. | A session with no data source, with activity in the last 2 days. |
| Loose ends | Work that is not done and is quiet. Close it out. | Work that is not done (an open PR, a ticket that is not done, uncommitted files, or work left), with no activity in the last 3 days. Work with a data source stays a loose end, also after a long time. |
| Closed | Done. A closed thread does not open again: new work starts a new thread. | Each data source is verified done: a PR is merged or closed, a ticket is done, a branch is merged or deleted. |
| Forgotten | Not finished, and it will probably stay that way. | A thought with no activity for 2 days. Or a thread that you set aside by hand. |
You can set a state by hand on the thread. A state set by hand stays until the thread has new activity. Then the automatic state applies again. Agents never set states. An agent closes a thread in git, GitHub or the tracker, and Pensieve sees the evidence.
To-do threads
When you connect your issue tracker (see Connections), the tickets that are assigned to you become to-do threads. A to-do card has these buttons: Start session in worktree and Discard.
Start session in worktree does these steps:
- It makes a worktree in
<repo>/.claude/worktrees/<branch>, from the default branch. The branch name comes from the ticket key and title. - It starts your agent in the worktree, with the ticket's title, URL and description.
For the first to-do of a ticket project, Pensieve asks which repo to use. It keeps the answer in the
ticket_repos setting. Agents start a to-do with the start_todo MCP tool.
Ship and Discard
Ship and Discard close the work. Each button opens a modal with the steps left. The buttons show on threads in these states: Open, To-do, Loose ends and Forgotten.
| Button | Steps |
|---|---|
| Ship | Commit, push, open a PR, review and merge. After the merge, mark the ticket done. |
| Discard | Drop the uncommitted files, close the PR without a merge, delete the branch (local and remote), and mark the ticket cancelled. |
Click Start shipping or Start discarding in the modal. An agent session starts in Terminal and does the steps. The agent asks you before each step that leaves your Mac. Pensieve itself only reads: it sees the result in git, GitHub or the tracker. The button resumes the session that holds the branch, with the steps as its next message, so the request is in the conversation of the work that it closes. If that session can't take a message on resume, a new session does the steps. Thoughts and closed threads have no Ship or Discard.
Search threads
The search box on the Threads tab finds threads by the words on the page. Put words in quotes
("exact words") to find only the threads that contain them. Put a minus before a word
(-word) to leave out the threads with that word. Threads have no search by meaning.
Threads from the command line
pensieve thread <thread id> -o thread.html # the thread as one HTML page
pensieve thread <thread id> --json # the thread as JSON
pensieve thread <thread id> --agent # the thread as text for an agent
A thread follows the pensieve-thread/2 JSON schema.
Pensieve also reads files in the older context-card/1 format. The threads MCP tool gives the thread ids.
Threads for your agents
Agents get the same threads over MCP. threads lists the threads that are not done, the closest to
done first, with their steps left. thread gives one thread whole. cluster gives the threads
of one branch, with the steps to ship or discard the work. thread_page saves the page of a thread or a
branch as one HTML file in ~/Downloads, with the threads as JSON inside. start_todo starts a
to-do. At the start of a session and at natural pauses, the agent offers to close the thread closest to done (the
pensieve-wrap-up skill). With the Claude Code prompt hook, a prompt such as “where did I leave off on
ABC-12” gets the thread before the agent starts.
Something wrong or missing? Tell us on GitHub.