Skip to content

Implement session/fork#183

Merged
benbrandt merged 11 commits intoagentclientprotocol:mainfrom
SteffenDE:sd-fork
Dec 12, 2025
Merged

Implement session/fork#183
benbrandt merged 11 commits intoagentclientprotocol:mainfrom
SteffenDE:sd-fork

Conversation

@SteffenDE
Copy link
Copy Markdown
Contributor

Work in progress! Uses a fork for now.

See agentclientprotocol/agent-client-protocol#277.

@cla-bot cla-bot bot added the cla-signed label Nov 28, 2025
This is a proof of concept for two new methods: "session/resume" and
"session/fork". The idea is to be able to continue an existing chat
using Claude's resume and forkSession functionalities, without the need
to stream all the existing conversation history (which prevents us from
having session/load with the Claude Agent SDK).

For now, I implemented this as extension methods, but I could see it
fit into the core protocol as optional agent capabilities. The methods
accept the same parameters as session/new and also return the same
response format. The only extra parameter that is required is the
"claudeSessionId", but it could also be called "resumeSessionToken".

It is required because Claude internally has its own session ID that is
independent from the ACP ID (it is only created when sending the first
message). Currently, there's a special extension notification called
"claude/sessionId", that send a mapping `{ sessionId, claudeSessionId }`.
Again, for a proper implementation, this could be called `resumeSessionToken`
instead.
src/acp-agent.ts Outdated
Comment on lines +642 to +643
// TODO: find a way to make this work for fork
extraArgs: { ...userProvidedOptions?.extraArgs, ...(creationOpts.resume ? {} : {"session-id": sessionId }) },
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBD

@benbrandt
Copy link
Copy Markdown
Member

@SteffenDE I merged in the upstream changes and went back to the upstream sdk as well

@SteffenDE
Copy link
Copy Markdown
Contributor Author

Nice, I'll also update this once agentclientprotocol/agent-client-protocol#333 is in and we have the changes in the TS SDK as well.

@benbrandt
Copy link
Copy Markdown
Member

@SteffenDE you should be good now.

One of these days I'll get release please to stop bumping the versions so high.. but today is not that day.

@SteffenDE
Copy link
Copy Markdown
Contributor Author

Updated to use the options passed to fork now!

@benbrandt
Copy link
Copy Markdown
Member

@SteffenDE does that mean it is working??

Copy link
Copy Markdown
Member

@benbrandt benbrandt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good from my end!

@SteffenDE
Copy link
Copy Markdown
Contributor Author

It's working as long as you fork a new session. Until we fix the session ids, forks cannot be forked.

@SteffenDE SteffenDE marked this pull request as ready for review December 12, 2025 13:36
@benbrandt benbrandt merged commit e81ecbd into agentclientprotocol:main Dec 12, 2025
2 checks passed
benbrandt pushed a commit that referenced this pull request Dec 19, 2025
AObuchow pushed a commit to AObuchow/claude-code-acp that referenced this pull request Jan 13, 2026
Work in progress! Uses a fork for now.

See
agentclientprotocol/agent-client-protocol#277.

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants