Session Management - djvolz/coda-code-assistant GitHub Wiki
Session Management
Coda provides powerful session management capabilities to save, load, and organize your AI conversations. Sessions are automatically saved and can be branched, searched, and exported in various formats.
Quick Start
# Your conversation is automatically saved
coda "Help me debug this Python function"
# List all your sessions
coda
> /session list
# Load a previous session
coda
> /session load my-debugging-session
# Export your conversation
coda
> /export markdown
Core Concepts
What are Sessions?
Sessions are persistent conversations with AI that include:
- All messages exchanged between you and the AI
- The AI provider and model used
- Timestamps for each interaction
- Metadata like tags and descriptions
- Parent-child relationships for branched conversations
- Tool usage history (when agent mode is enabled)
Automatic Saving
Coda automatically saves your conversations:
- Sessions are created when you send your first message
- Every message is saved in real-time
- No manual saving required - just start chatting
- Sessions are stored in
~/.cache/coda/sessions.db
- First-run detection shows helpful tips for new users
Session Indexing
For improved performance, sessions are indexed by:
- Name (for quick lookups)
- Creation time (for sorting)
- Full-text search across all messages
Session Commands
Viewing Sessions
# List all sessions
/session list
/s list
# Show detailed info about current session
/session info
/s info
# Show info about a specific session
/session info my-session
/s info 123 # Using session ID
Loading Sessions
# Load by name
/session load my-debugging-session
/s load my-debugging-session
# Load by ID
/session load 42
/s load 42
# Load most recent session
/session last
/s last
# Resume from where you left off (also works with --resume flag)
coda --resume
Saving Sessions
Sessions are auto-saved, but you can rename them:
# Rename current session
/session save my-important-chat
/s save bug-fix-discussion
Branching Sessions
Create alternate conversation paths:
# Branch from current conversation
/session branch
/s branch
# Branch with a custom name
/session branch alternative-approach
/s branch testing-refactor
Searching Sessions
Full-text search across all your conversations:
# Search for specific topics
/session search "python decorator"
/s search "error handling"
# Search with multiple terms
/session search "async await"
Deleting Sessions
# Delete by name or ID (with confirmation)
/session delete old-session
/s delete 123
# Delete multiple sessions
/session delete session1 session2 session3
/s rm 123 456 789
# Skip confirmation with -f flag
/session delete old-session -f
Renaming Sessions
# Rename current session
/session rename "better-name"
# Rename a specific session by ID
/session rename 123 "new-name"
Export Functionality
Export your conversations in various formats:
Export Formats
# Markdown format (great for documentation)
/export markdown
/export md
/e md
# JSON format (preserves all metadata)
/export json
/e json
# Plain text format
/export txt
/export text
/e txt
# HTML format (with syntax highlighting)
/export html
/e html
Export Examples
# Export creates a file with timestamp
/export markdown
# Creates: coda_session_2025_01_05_143052.md
# Exported files include:
# - Full conversation history
# - Model and provider information
# - Timestamps
# - Session metadata
Context Management
Coda intelligently manages conversation context to stay within model token limits:
Automatic Context Windowing
- Preserves system prompts and mode settings
- Prioritizes recent messages
- Includes relevant historical context
- Automatically adjusts to model limits
Context Preservation
- Full conversation history is always saved
- Only relevant context is sent to the AI
- You can always access complete history via exports
Best Practices
Session Naming
- Use descriptive names:
bug-fix-auth-system
- Include dates for time-sensitive work:
2025-01-05-deployment
- Use prefixes for organization:
feature/new-api
,debug/memory-leak
Branching Strategy
- Branch before trying different approaches
- Keep main session for successful solutions
- Use branches for experimentation
Privacy Considerations
- Sessions are stored locally on your machine
- Use
/session delete
to remove sensitive conversations - Export and backup important sessions
Advanced Usage
Session Templates
Create template sessions for common tasks:
# Create a debugging template
coda
> /mode debug
> I need help debugging Python code. Please ask for details.
> /session save template-python-debug
# Later, branch from template
> /session load template-python-debug
> /session branch new-bug-investigation
Session Workflows
Example workflow for complex debugging:
# 1. Start with problem description
coda "Application crashes on startup"
# 2. Save with descriptive name
/session save debug-startup-crash
# 3. Try different approaches via branches
/session branch check-dependencies
# ... investigate dependencies ...
/session load debug-startup-crash
/session branch check-config
# ... investigate configuration ...
# 4. Export successful solution
/export markdown
Troubleshooting
Common Issues
Session not found:
- Check exact name with
/session list
- Try searching:
/session search "partial name"
- Use session ID instead of name
Export not working:
- Ensure you have write permissions in current directory
- Check disk space
- Try different export format
Context seems lost:
- This is normal for long conversations
- Full history is preserved in database
- Use
/export
to see complete conversation
Database Location
Sessions are stored in:
- Default:
~/.cache/coda/sessions.db
- Follows XDG Base Directory specification
- SQLite database format
Future Enhancements
Planned improvements for session management:
- Cloud sync for sessions across devices
- Session sharing via URLs
- Team collaboration features
- Session analytics and insights
- Conversation summarization
- Template marketplace
Related Documentation
- Getting-Started - Basic Coda usage
- AI-Modes - Using different AI personalities
- Command-Reference - All available commands
- Configuration - Configuring Coda