Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit df58a09

Browse files
tiwillia-ai-botclaude
andcommitted
docs: clarify agent lifecycle operations (interrupt/stop/kill/delete)
Addresses confusion between interrupt, stop, kill, and delete operations in the ambient workflow guidance. Changes: - protocol.md: Added "Agent Lifecycle Operations" section with clear definitions and distinctions between each operation - mcp_tools.go: Updated stop_agent, spawn_agent, and restart_agent tool descriptions to clarify behavior and data preservation - api-reference.md: Added lifecycle operations summary and expanded endpoint descriptions to clarify what is preserved vs deleted - AgentDetail.vue: Updated tooltips and dialog text to reinforce that kill/stop/restart preserve agent records while delete removes all data Key clarifications: - Interrupt = pause current task (agent keeps running) - Stop/Kill = end session cleanly (preserves agent record, can restart) - Delete = permanent removal (all data deleted, cannot restart) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 203f384 commit df58a09

4 files changed

Lines changed: 33 additions & 10 deletions

File tree

docs/api-reference.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Returns the agent's current state as JSON.
147147
DELETE /spaces/{space}/agent/{name}
148148
```
149149

150-
Removes the agent from the space.
150+
Permanently removes the agent record from the coordinator database. All history, messages, tasks, and metadata are deleted. This operation cannot be undone. The agent cannot be restarted after deletion.
151151

152152
**Response** `200 text/plain`
153153

@@ -413,13 +413,19 @@ data: {"space":"...","agent":"...","sender":"...","message":"..."}
413413

414414
Spawn, stop, and restart agents in their tmux sessions.
415415

416+
**Lifecycle Operations Summary:**
417+
- **Spawn** — Create and start a new agent session
418+
- **Stop** — Kill the session but preserve agent record (can restart)
419+
- **Restart** — Kill and re-spawn with same config (preserves history)
420+
- **Delete** — Permanently remove agent and all data from coordinator
421+
416422
### Spawn Agent
417423

418424
```
419425
POST /spaces/{space}/agent/{name}/spawn
420426
```
421427

422-
Starts a new tmux session for the agent and runs `claude --dangerously-skip-permissions`.
428+
Creates a new tmux/ACP session for the agent and runs `claude --dangerously-skip-permissions`.
423429

424430
**Required headers:** `X-Agent-Name: {name}`
425431

@@ -436,7 +442,7 @@ Starts a new tmux session for the agent and runs `claude --dangerously-skip-perm
436442
POST /spaces/{space}/agent/{name}/stop
437443
```
438444

439-
Kills the agent's tmux session.
445+
Kills the agent's session and marks it as `done`. The agent record is preserved in the coordinator database and can be restarted later.
440446

441447
**Required headers:** `X-Agent-Name: {name}`
442448

@@ -446,7 +452,7 @@ Kills the agent's tmux session.
446452
POST /spaces/{space}/agent/{name}/restart
447453
```
448454

449-
Stops and restarts the agent's tmux session.
455+
Kills the current session (if running) and spawns a new one with the same configuration. Preserves agent record, message history, and metadata.
450456

451457
**Required headers:** `X-Agent-Name: {name}`
452458

frontend/src/components/AgentDetail.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ watch(() => props.agentName, loadAgentDocuments)
650650
Restart
651651
</Button>
652652
</TooltipTrigger>
653-
<TooltipContent>Kill existing session and spawn a new one</TooltipContent>
653+
<TooltipContent>Kill existing session and spawn a new one (preserves agent record)</TooltipContent>
654654
</Tooltip>
655655
<Tooltip>
656656
<TooltipTrigger as-child>
@@ -680,7 +680,7 @@ watch(() => props.agentName, loadAgentDocuments)
680680
Kill
681681
</Button>
682682
</TooltipTrigger>
683-
<TooltipContent>Kill the agent's tmux session</TooltipContent>
683+
<TooltipContent>Kill the agent's session (agent record preserved, can restart)</TooltipContent>
684684
</Tooltip>
685685
</div>
686686

@@ -1088,7 +1088,7 @@ watch(() => props.agentName, loadAgentDocuments)
10881088
<AlertDialogHeader>
10891089
<AlertDialogTitle>Delete agent?</AlertDialogTitle>
10901090
<AlertDialogDescription>
1091-
This will permanently remove <span class="font-semibold text-foreground">{{ agentName }}</span>. This cannot be undone.
1091+
This will permanently remove <span class="font-semibold text-foreground">{{ agentName }}</span> from the coordinator database. All history, messages, and metadata will be deleted. This cannot be undone.
10921092
</AlertDialogDescription>
10931093
</AlertDialogHeader>
10941094
<AlertDialogFooter>

internal/coordinator/mcp_tools.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ func pruneReadMessages(ag *AgentUpdate) {
10551055
func (s *Server) addToolSpawnAgent(srv *mcp.Server) {
10561056
srv.AddTool(&mcp.Tool{
10571057
Name: "spawn_agent",
1058-
Description: "Spawn a new agent in a space.",
1058+
Description: "Create and start a new agent session. Creates a new tmux/ACP session, launches the agent, and sends the ignition prompt.",
10591059
InputSchema: jsonSchema([]string{"space", "name"}, map[string]map[string]any{
10601060
"space": prop("string", "The workspace name"),
10611061
"name": prop("string", "The agent name to spawn"),
@@ -1124,7 +1124,7 @@ func (s *Server) addToolSpawnAgent(srv *mcp.Server) {
11241124
func (s *Server) addToolRestartAgent(srv *mcp.Server) {
11251125
srv.AddTool(&mcp.Tool{
11261126
Name: "restart_agent",
1127-
Description: "Restart an agent using the same config.",
1127+
Description: "Restart an existing agent. Kills the current session (if running) and spawns a new one with the same configuration. Preserves agent record and history.",
11281128
InputSchema: jsonSchema([]string{"space", "name"}, map[string]map[string]any{
11291129
"space": prop("string", "The workspace name"),
11301130
"name": prop("string", "The agent name to restart"),
@@ -1159,7 +1159,7 @@ func (s *Server) addToolRestartAgent(srv *mcp.Server) {
11591159
func (s *Server) addToolStopAgent(srv *mcp.Server) {
11601160
srv.AddTool(&mcp.Tool{
11611161
Name: "stop_agent",
1162-
Description: "Stop an agent and mark it as done.",
1162+
Description: "Stop an agent by killing its session and marking it as done. The agent record is preserved and can be restarted. Does not delete the agent from the system.",
11631163
InputSchema: jsonSchema([]string{"space", "name"}, map[string]map[string]any{
11641164
"space": prop("string", "The workspace name"),
11651165
"name": prop("string", "The agent name to stop"),

internal/coordinator/protocol.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,23 @@ An HTTP REST API is available at `{COORDINATOR_URL}` for non-MCP clients (webhoo
6161
- Use `send_message(to: "parent")` to message your manager when blocked
6262
- Continue working on what you can while waiting for decisions
6363

64+
### Agent Lifecycle Operations
65+
66+
Understanding the differences between agent session operations:
67+
68+
**Interrupt** — Pause the current task without ending the session. Sends Escape key to the agent's terminal, allowing it to cancel the current operation and return to the prompt. The agent remains running and can continue working.
69+
70+
**Stop** — End the agent's session cleanly and mark the agent as `done`. Kills the tmux/ACP session process but keeps the agent record in the coordinator. The agent can be restarted later with `restart_agent`.
71+
72+
**Kill** — Synonym for "stop" in this system — forcefully terminates the session process. Use `stop_agent` tool or the stop endpoint.
73+
74+
**Delete** — Completely remove the agent record from the coordinator database. All history, messages, and metadata are deleted. The agent cannot be restarted — you must spawn a new agent with the same name.
75+
76+
**Summary:**
77+
- **Interrupt** = pause (agent keeps running)
78+
- **Stop/Kill** = end session (agent record remains, can restart)
79+
- **Delete** = remove agent entirely (cannot restart)
80+
6481
### Message Polling
6582

6683
Use `check_messages` with the `since` cursor for efficient polling:

0 commit comments

Comments
 (0)