You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: clarify session destroy vs delete semantics across all SDKs
Clarify the distinction between destroy() (closes session, releases
in-memory resources, preserves disk state for resumption) and
deleteSession() (permanently removes all data from disk).
Update doc comments across all four SDK languages (Go, Node.js, Python,
.NET) and the session persistence guide to make the behavioral
difference explicit and help users choose the right method.
Fixes#526
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/guides/session-persistence.md
+16-5Lines changed: 16 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -325,16 +325,16 @@ async function cleanupExpiredSessions(maxAgeMs: number) {
325
325
awaitcleanupExpiredSessions(24*60*60*1000);
326
326
```
327
327
328
-
### Explicit Session Destruction
328
+
### Closing a Session (`destroy`)
329
329
330
-
When a task completes, destroy the session explicitly rather than waiting for timeouts:
330
+
When a task completes, close the session explicitly rather than waiting for timeouts. This releases in-memory resources but **preserves session data on disk**, so the session can still be resumed later:
331
331
332
332
```typescript
333
333
try {
334
334
// Do work...
335
335
awaitsession.sendAndWait({ prompt: "Complete the task" });
336
336
337
-
// Task complete - clean up
337
+
// Task complete — release in-memory resources (session can be resumed later)
338
338
awaitsession.destroy();
339
339
} catch (error) {
340
340
// Clean up even on error
@@ -343,6 +343,17 @@ try {
343
343
}
344
344
```
345
345
346
+
### Permanently Deleting a Session (`deleteSession`)
347
+
348
+
To permanently remove a session and all its data from disk (conversation history, planning state, artifacts), use `deleteSession`. This is irreversible — the session **cannot** be resumed after deletion:
349
+
350
+
```typescript
351
+
// Permanently remove session data
352
+
awaitclient.deleteSession("user-123-task-456");
353
+
```
354
+
355
+
> **`destroy()` vs `deleteSession()`:**`destroy()` releases in-memory resources but keeps session data on disk for later resumption. `deleteSession()` permanently removes everything, including files on disk.
356
+
346
357
## Automatic Cleanup: Idle Timeout
347
358
348
359
The CLI has a built-in 30-minute idle timeout. Sessions without activity are automatically cleaned up:
0 commit comments