Skip to content

Commit a0f431a

Browse files
SteffenDEbenbrandtjosevalim
authored
docs(rfd): fork options (#326)
* fork options * Apply suggestion from @josevalim Co-authored-by: José Valim <[email protected]> --------- Co-authored-by: Ben Brandt <[email protected]> Co-authored-by: José Valim <[email protected]>
1 parent 54ead78 commit a0f431a

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

docs/rfds/session-fork.mdx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,27 @@ We propose to add a new "session/fork" method. Agents must declare this option i
4646
available by returning `session: { fork : {} }` in its capabilities. The object is reserved
4747
to declare future capabilities, such as forking from a specific message, a tool call, or similar.
4848

49-
Then the client would be able to request a fork of the current session:
49+
Then the client would be able to request a fork of the given session:
5050

5151
```json
5252
{
5353
"jsonrpc": "2.0",
5454
"id": 1,
5555
"method": "session/fork",
5656
"params": {
57-
"sessionId": "sess_789xyz"
57+
"sessionId": "sess_789xyz",
58+
"cwd": "...",
59+
"mcpServers": [...]
5860
}
5961
}
6062
```
6163

62-
And the agent would respond with optional data such as config options, the same as `session/load`.
64+
The request expects the same options as `session/load`, such as `cwd` and `mcpServers`.
6365

64-
A proof of concept is available here: https://github.com/zed-industries/claude-code-acp/pull/145
66+
Similarly, the agent would respond with optional data such as config options, the same as `session/load`.
67+
68+
Agents may reply with an error if forking of that specific session or with the given options is not supported,
69+
for example if the agent does not support forking with a different working directory than the initial session.
6570

6671
## Frequently asked questions
6772

@@ -74,6 +79,16 @@ For example, "session/new" has options such as capabilities and MCP which are no
7479
recommended to be set when forking, as the context being forked was built with other
7580
tools, and forking may accept a messageId for checkpoints.
7681

82+
**Q: Should fork only accept the `sessionId` or also other options, similar to `session/load`?**
83+
84+
Initially, we proposed to only accept the `sessionId`, but this would make it more difficult to
85+
allow forking of inactive sessions in agents like `claude-code-acp`, as Claude does not retain the
86+
configured MCP servers of a session. Limiting fork to only already active sessions would limit its usefulness.
87+
88+
Moreover, allowing to pass different options also allows features like dynamically adding MCP servers
89+
to existing sessions to work by forking them with the new options, if the agent supports it. If it
90+
does not, the client can still show an appropriate error message.
91+
7792
### What alternative approaches did you consider, and why did you settle on this one?
7893

7994
None. This proposal is inspired by the abilities exposed in Claude Agent SDK. It must be validated against other agents too.
@@ -82,3 +97,4 @@ None. This proposal is inspired by the abilities exposed in Claude Agent SDK. It
8297

8398
- 2025-11-17: Mentioned capabilities format, updated FAQ.
8499
- 2025-11-20: Added request format and updated capabilities format.
100+
- 2025-12-10: Adjust fork options to align with `session/load`.

0 commit comments

Comments
 (0)