What is a Session?
A session encapsulates:- Conversation history: All messages exchanged with the agent
- Working directory: Where the agent operates on your filesystem
- Extension state: Which tools are enabled and their data
- Configuration: Model, provider, and recipe being used
- Metadata: Creation time, token usage, session name
Session Types
Goose supports different session types for different purposes:User Sessions
Standard interactive sessions:SubAgent Sessions
Created automatically when spawning subagents:- Isolated from parent session
- Have their own conversation history
- Can have different extensions/settings
- Automatically cleaned up when complete
Session Lifecycle
Creating Sessions
Updating Sessions
Goose uses a builder pattern for updates:Querying Sessions
Session Storage
Sessions are persisted to SQLite:Database Schema
Conversation Management
Each session maintains a conversation object:Message Types
Context Management
Goose automatically manages context to stay within model limits:Context Compaction
Extension Data
Sessions store extension-specific data:Session Naming
Goose automatically generates descriptive session names:- “Refactoring authentication module”
- “Debugging WebSocket connection issues”
- “Setting up CI/CD pipeline”
Token Tracking
Sessions track token usage for cost estimation:Session Isolation
Sessions are isolated for security and organization:Working Directory Isolation
Each session operates in its own working directory:Extension Isolation
Extensions are session-specific:Conversation Isolation
Conversation history doesn’t leak between sessions:Multi-Session Workflows
You can work with multiple sessions simultaneously:- Conversation history
- Working directory
- Extension state
- Model/provider settings
Session Management API
REST API
Agent Client Protocol (ACP)
Session Insights
Get aggregated statistics:Best Practices
Use descriptive session names
Use descriptive session names
Set appropriate working directories
Set appropriate working directories
Clean up old sessions
Clean up old sessions
Monitor token usage
Monitor token usage
Use session types appropriately
Use session types appropriately
Troubleshooting
Session Not Found
Session State Corruption
High Token Usage
Lost Session Data
Next Steps
Agents
Learn about agent orchestration
Recipes
Configure sessions with recipes
CLI Reference
Session management commands
API Reference
Session management API