Skip to main content
Sessions in Goose represent individual conversations with the AI agent. Each session maintains its own state, history, configuration, and context, enabling you to work on multiple tasks independently and resume work later.

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:
Subagent sessions are:
  • 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

Compaction is triggered automatically:

Extension Data

Sessions store extension-specific data:
Extensions can persist state across messages:

Session Naming

Goose automatically generates descriptive session names:
The AI analyzes the conversation and suggests names like:
  • “Refactoring authentication module”
  • “Debugging WebSocket connection issues”
  • “Setting up CI/CD pipeline”
Users can override:

Token Tracking

Sessions track token usage for cost estimation:
After each model call:

Session Isolation

Sessions are isolated for security and organization:

Working Directory Isolation

Each session operates in its own working directory:
File operations are scoped to the 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:
Each session maintains independent:
  • 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

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