Skip to content

Commit dab54af

Browse files
authored
feat(unstable): Add unstable plan operations (#1299)
1 parent 7b391e0 commit dab54af

12 files changed

Lines changed: 2248 additions & 11 deletions

File tree

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ unstable = [
2222
"unstable_llm_providers",
2323
"unstable_mcp_over_acp",
2424
"unstable_nes",
25+
"unstable_plan_operations",
2526
"unstable_session_additional_directories",
2627
"unstable_session_delete",
2728
"unstable_session_fork",
@@ -41,6 +42,7 @@ unstable_elicitation = []
4142
unstable_llm_providers = []
4243
unstable_mcp_over_acp = []
4344
unstable_nes = []
45+
unstable_plan_operations = []
4446
unstable_session_additional_directories = []
4547
unstable_session_delete = []
4648
unstable_session_fork = []

docs/protocol/draft/agent-plan.mdx

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Plans are execution strategies for complex tasks that require multiple steps.
77

88
Agents may share plans with Clients through [`session/update`](./prompt-turn#3-agent-reports-output) notifications, providing real-time visibility into their thinking and progress.
99

10+
The existing `plan` update is the baseline format. Clients that advertise `planCapabilities` during [initialization](./initialization#client-capabilities) can also receive identified plan operations through `plan_update` and `plan_removed`.
11+
1012
## Creating Plans
1113

1214
When the language model creates an execution plan, the Agent **SHOULD** report it to the Client:
@@ -46,6 +48,96 @@ When the language model creates an execution plan, the Agent **SHOULD** report i
4648
accomplished
4749
</ParamField>
4850

51+
## Plan Operations
52+
53+
Agents **MUST NOT** send `plan_update` or `plan_removed` unless the Client advertised `planCapabilities`. If the Client omits `planCapabilities`, the Agent **MUST** fall back to the existing `plan` update.
54+
55+
`plan_update` carries a `plan` object with a `type` discriminator. Every plan format includes a required `id` so Clients can track multiple plans independently.
56+
57+
### Item-Based Plans
58+
59+
```json
60+
{
61+
"jsonrpc": "2.0",
62+
"method": "session/update",
63+
"params": {
64+
"sessionId": "sess_abc123def456",
65+
"update": {
66+
"sessionUpdate": "plan_update",
67+
"plan": {
68+
"type": "items",
69+
"id": "plan-1",
70+
"entries": [
71+
{
72+
"content": "Analyze the existing codebase structure",
73+
"priority": "high",
74+
"status": "pending"
75+
}
76+
]
77+
}
78+
}
79+
}
80+
}
81+
```
82+
83+
### Markdown Plans
84+
85+
```json
86+
{
87+
"jsonrpc": "2.0",
88+
"method": "session/update",
89+
"params": {
90+
"sessionId": "sess_abc123def456",
91+
"update": {
92+
"sessionUpdate": "plan_update",
93+
"plan": {
94+
"type": "markdown",
95+
"id": "implementation-plan",
96+
"content": "## Steps\n- [ ] Refactor module\n- [ ] Add tests"
97+
}
98+
}
99+
}
100+
}
101+
```
102+
103+
### File Plans
104+
105+
```json
106+
{
107+
"jsonrpc": "2.0",
108+
"method": "session/update",
109+
"params": {
110+
"sessionId": "sess_abc123def456",
111+
"update": {
112+
"sessionUpdate": "plan_update",
113+
"plan": {
114+
"type": "file",
115+
"id": "design-doc",
116+
"uri": "file:///tmp/plan.md"
117+
}
118+
}
119+
}
120+
}
121+
```
122+
123+
### Removing Plans
124+
125+
Agents can remove a plan by sending `plan_removed` with the plan ID:
126+
127+
```json
128+
{
129+
"jsonrpc": "2.0",
130+
"method": "session/update",
131+
"params": {
132+
"sessionId": "sess_abc123def456",
133+
"update": {
134+
"sessionUpdate": "plan_removed",
135+
"id": "plan-1"
136+
}
137+
}
138+
}
139+
```
140+
49141
## Plan Entries
50142

51143
Each plan entry represents a specific task or goal within the overall execution strategy:

0 commit comments

Comments
 (0)