Session Management
What Are Sessions?
Section titled “What Are Sessions?”Sessions in Rawi are persistent conversation threads that maintain context across multiple interactions. Each session:
- Preserves context — AI remembers previous messages in the conversation
- Belongs to a profile — Organized by your configured AI provider profiles
- Has metadata — Tracks creation time, message count, and usage statistics
- Can be continued — Resume conversations from where you left off
- Stores history — All messages are saved and searchable
Basic Session Usage
Section titled “Basic Session Usage”Automatic Session Management
Section titled “Automatic Session Management”Rawi handles sessions automatically:
# First message creates a new sessionrawi ask "Help me design a REST API"
# Follow-up messages continue the same sessionrawi ask "What about authentication?"rawi ask "How should I handle rate limiting?"Explicit Session Control
Section titled “Explicit Session Control”Take control of your conversation flow:
# Start a new session explicitlyrawi ask "Let's plan a new project" --new-session
# Continue a specific sessionrawi ask "What were we discussing?" --session abc123-def456
# Start a session with a custom namerawi ask "Begin architecture discussion" --session-name "Microservices Design"
# 🆕 Interactive session selectionrawi ask "Continue from where I left off" --list-sessionsrawi chat --list-sessions
# 🆕 Session management optionsrawi ask "Show current session details" --show-session-idrawi ask "Export this conversation" --export-session abc123-def456rawi chat --rename-session "Updated Project Name"
# Get session ID for later userawi history sessions --limit 1Session Management
Section titled “Session Management”Session Lifecycle
Section titled “Session Lifecycle”1. Session Creation
Section titled “1. Session Creation”Sessions are created automatically or explicitly:
# Automatic creation (first message for profile)rawi ask "Hello, I need help with Python"
# Explicit creationrawi ask "Start fresh discussion" --new-session
# Profile-specific sessionsrawi ask "Help with deployment" --profile work --new-session2. Session Continuation
Section titled “2. Session Continuation”Resume conversations seamlessly:
# Continue current session (default behavior)rawi ask "Can you expand on that?"
# Continue specific sessionrawi ask "What about error handling?" --session abc123-def456
# Switch between sessionsrawi ask "Different topic" --session xyz789-abc1233. Session History
Section titled “3. Session History”Access your conversation history:
# View recent sessionsrawi history sessions
# Show specific sessionrawi history show abc123-def456
# Search across sessionsrawi history --search "docker deployment"Advanced Session Management
Section titled “Advanced Session Management”Multiple Concurrent Sessions
Section titled “Multiple Concurrent Sessions”Manage different conversation threads:
# Work project sessionrawi ask "Design microservices architecture" --profile work --new-session# Session ID: work-session-1
# Personal learning sessionrawi ask "Explain quantum computing" --profile personal --new-session# Session ID: personal-session-1
# Switch between themrawi ask "Add API gateway details" --session work-session-1rawi ask "What about quantum algorithms?" --session personal-session-1Profile-Based Session Organization
Section titled “Profile-Based Session Organization”Sessions are organized by profile:
# Development profile sessionsrawi ask "Review this code" --profile development
# Analysis profile sessionsrawi ask "Analyze this dataset" --profile analysis
# Local profile sessionsrawi ask "Quick question" --profile local
# View sessions by profilerawi history sessions --profile developmentSession Naming and Organization
Section titled “Session Naming and Organization”Sessions can have meaningful titles:
# Sessions auto-generate titles based on contentrawi ask "Help me build a React component" --new-session# Creates session with title like "React Component Development"
# View sessions with titlesrawi history sessionsSession Context Management
Section titled “Session Context Management”Understanding Context Windows
Section titled “Understanding Context Windows”Each session maintains conversation context:
- Full context — AI sees all previous messages in the session
- Token limits — Longer sessions may hit model token limits
- Smart truncation — Rawi manages context when approaching limits
- Fresh start — New sessions start with clean context
Context Strategies
Section titled “Context Strategies”Choose the right approach for your use case:
# Long-form discussions (maintain context)rawi ask "Let's architect a complex system" --new-sessionrawi ask "What about the database layer?"rawi ask "How do we handle scalability?"
# Quick questions (start fresh)rawi ask "Quick Python syntax question" --new-sessionrawi ask "Another unrelated question" --new-session
# Project-specific contextsrawi ask "Working on mobile app" --profile mobile --new-sessionrawi ask "Backend API questions" --profile backend --new-sessionSession Discovery and Navigation
Section titled “Session Discovery and Navigation”Listing Sessions
Section titled “Listing Sessions”Find your conversations with enhanced display options:
# Recent sessions (enhanced with full IDs)rawi history sessions
# 🆕 Interactive session selectionrawi history sessions --interactive
# 🆕 Table format with full detailsrawi history sessions --table
# 🆕 Session statistics and metricsrawi history sessions --stats
# More sessions with limitsrawi history sessions --limit 20
# All sessionsrawi history sessions --all
# Profile-specific sessionsrawi history sessions --profile work
# 🆕 Advanced session operationsrawi history sessions --operations-menuSearching Sessions
Section titled “Searching Sessions”Find specific conversations:
# Search message contentrawi history --search "docker deployment"
# Search with filtersrawi history --search "react components" --profile frontend
# Time-based searchrawi history --from 2024-01-01 --search "authentication"Session Details
Section titled “Session Details”Get comprehensive session information:
# Full session conversationrawi history show abc123-def456
# Session metadatarawi history sessions | grep abc123-def456
# 🆕 Session operationsrawi history rename abc123-def456 "New Session Name"rawi history delete abc123-def456rawi history export abc123-def456 --output session.json🆕 Enhanced Session Features
Section titled “🆕 Enhanced Session Features”Interactive Session Management
Section titled “Interactive Session Management”The new interactive features make session management effortless:
# Interactive session selection with full IDsrawi ask "Continue discussion" --list-sessions# Displays: Complete session IDs, names, message counts, creation dates# Allows: Easy selection with arrow keys and enter
# Table format displayrawi history sessions --table# Shows: Organized table with full session details# Includes: ID, Name, Messages, Created, Profile
# Session statistics dashboardrawi history sessions --stats# Displays: Total sessions, messages, usage patterns# Metrics: Provider distribution, model usage, activity trendsAdvanced Session Operations
Section titled “Advanced Session Operations”Comprehensive session management capabilities:
# Session naming and organizationrawi chat --session-name "Project Alpha Planning"rawi history rename abc123 "Updated Project Name"
# Session export and backuprawi history export abc123 --output "project-session.json"rawi history export --profile work --output "work-backup.json"
# Session insights and analyticsrawi history stats --profile developmentrawi history sessions --search "authentication" --table
# Batch operationsrawi history cleanup --days 30 --profile old-projectrawi history delete-multiple --interactiveFull ID Display and No Truncation
Section titled “Full ID Display and No Truncation”All session identifiers are displayed in full:
- Complete IDs — No more truncated session identifiers
- Clear Tables — Formatted tables with all details visible
- Easy Selection — Interactive prompts with full context
- Better Navigation — Find and select sessions with confidence
Session Analytics
Section titled “Session Analytics”Usage Statistics
Section titled “Usage Statistics”Monitor your AI usage with comprehensive analytics:
# Overall statistics dashboardrawi history stats# Shows: Total sessions, messages, providers, models, time patterns
# 🆕 Session-specific statisticsrawi history sessions --stats# Displays: Session distribution, average messages, activity trends
# Profile-specific analyticsrawi history stats --profile work# Shows: Work profile usage patterns and metrics
# Enhanced statistics include:# - Total sessions and messages# - Usage by provider and model# - Time-based activity patterns# - Session duration analytics# - Message frequency insightsSession Metrics
Section titled “Session Metrics”Understanding your conversation patterns with enhanced displays:
# 🆕 Enhanced session list with complete metricsrawi history sessions --table# Table shows: Full IDs, names, message counts, creation dates, profiles
# 🆕 Interactive session analyticsrawi history sessions --interactive --stats# Combines: Session selection with statistical insights
# Detailed session-level statisticsrawi history stats --detailed# Shows: Per-session metrics, usage trends, conversation analyticsSession Cleanup and Maintenance
Section titled “Session Cleanup and Maintenance”Managing Sessions
Section titled “Managing Sessions”Keep your history organized with enhanced management tools:
# 🆕 Enhanced session deletionrawi history delete abc123-def456 # Delete specific sessionrawi history delete --interactive # Select sessions to delete
# 🆕 Session renamingrawi history rename abc123-def456 "New Name" # Rename specific sessionrawi chat --rename-session "Updated Name" # Rename current session
# Clean up old sessions with better filteringrawi history cleanup --days 30 # Remove sessions older than 30 daysrawi history cleanup --profile old-project --days 7 # Profile-specific cleanup
# 🆕 Batch operationsrawi history cleanup --interactive # Interactive cleanup selectionrawi history sessions --operations-menu # Session management menuExporting Sessions
Section titled “Exporting Sessions”Backup your conversation history with enhanced export options:
# 🆕 Enhanced export capabilitiesrawi history export --output backup.json # Export all historyrawi history export abc123 --output session.json # Export specific session
# Advanced export optionsrawi history export --profile work --output work-conversations.jsonrawi history export --from 2024-01-01 --to 2024-03-31 --output q1-history.json
# 🆕 Export with full metadata preservationrawi history export abc123 --include-metadata --output detailed-session.jsonrawi history export --stats --output usage-report.jsonBest Practices
Section titled “Best Practices”Session Organization
Section titled “Session Organization”- Use meaningful profiles — Separate work, personal, and project contexts
- Start new sessions for new topics — Avoid mixing unrelated discussions
- Continue sessions for related work — Maintain context for ongoing projects
- Clean up regularly — Remove old or unnecessary sessions
Context Management
Section titled “Context Management”- Monitor session length — Very long sessions may lose early context
- Start fresh when needed — New sessions for significantly different topics
- Use explicit session IDs — For important conversations you want to continue
- Leverage search — Find relevant past discussions quickly
Workflow Integration
Section titled “Workflow Integration”# Daily workflow examplerawi ask "Review today's priorities" --profile work --new-sessionrawi ask "What about the deployment issue from yesterday?" --session yesterday-session
# Research workflowrawi ask "Learning about machine learning" --profile learning --new-sessionrawi ask "Can you elaborate on neural networks?"rawi ask "What about training data?"
# Problem-solving workflowrawi ask "Debugging authentication issue" --profile support --new-sessionrawi ask "The JWT token seems invalid"rawi ask "How do I validate the signature?"Integration with Other Features
Section titled “Integration with Other Features”Session + Act Templates
Section titled “Session + Act Templates”Combine sessions with expert templates:
# Start expert consultationrawi ask --act security-expert "Review authentication system" --new-sessionrawi ask "What about password policies?"rawi ask "How about two-factor authentication?"
# Continue with different expertrawi ask --act database-admin "Optimize user queries" --session auth-sessionSession + Profiles
Section titled “Session + Profiles”Use sessions across different AI providers:
# Start with powerful modelrawi ask "Complex architecture question" --profile claude --new-session
# Continue with faster model for follow-uprawi ask "Quick clarification" --profile local --session arch-session
# Switch back for complex analysisrawi ask "Deep dive into performance" --profile claude --session arch-sessionTroubleshooting Sessions
Section titled “Troubleshooting Sessions”Common Issues
Section titled “Common Issues”Session not found:
# Check if session exists with enhanced displayrawi history sessions --table | grep abc123
# List recent sessions with full detailsrawi history sessions --limit 10 --tableContext lost:
# Very long sessions may hit token limits# Start a new session with a summary:rawi ask "Summarize our previous discussion about X" --new-sessionSession conflicts:
# Sessions belong to specific profiles# Use correct profile to access session:rawi ask "Continue discussion" --profile correct-profile --session abc123🆕 Interactive selection issues:
# If interactive selection doesn't work, try direct approach:rawi history sessions --table # View all sessionsrawi ask "Continue" --session [specific-id] # Use specific session ID
# Check terminal compatibility for interactive featuresrawi history sessions --no-interactive # Fallback to table displaySession Recovery
Section titled “Session Recovery”Enhanced recovery options:
# View comprehensive session detailsrawi history show abc123-def456 --detailed
# Export session for backup with full metadatarawi history export abc123-def456 --include-metadata --output recovery.json
# Search for similar discussions with enhanced searchrawi history --search "relevant keywords" --table
# 🆕 Session analytics for pattern matchingrawi history stats --find-similar abc123-def4564. Use Sessions with Templates
Section titled “4. Use Sessions with Templates”# Start a specialized sessionrawi ask --new-session --act software-engineer "I'm designing a microservices architecture"
# Continue with the same expertiserawi ask "How do I handle service-to-service communication?"Advanced Session Features
Section titled “Advanced Session Features”Session with Profiles
Section titled “Session with Profiles”# Use different profiles for different sessionsrawi ask --new-session --profile work "Let's discuss the API redesign"rawi ask --new-session --profile personal "Help me with my side project"Session Export and Sharing
Section titled “Session Export and Sharing”# Export session as markdownrawi history --session abc123 --export --format markdown > discussion.md
# Export as JSON for processingrawi history --session abc123 --export --format json > session.json
# Export specific date rangerawi history --since "2024-01-01" --until "2024-01-31" --exportSession Search and Analysis
Section titled “Session Search and Analysis”# Search across all sessionsrawi history --search "authentication JWT"
# Find sessions about specific topicsrawi history --search "React hooks" --sessions-only
# Get session statisticsrawi history --statsSession Workflow Patterns
Section titled “Session Workflow Patterns”Project-Based Sessions
Section titled “Project-Based Sessions”# Main project sessionrawi ask --new-session --session main-project "Working on the user dashboard feature"
# Feature-specific sessionsrawi ask --new-session --session auth-feature "Implementing OAuth2 integration"rawi ask --new-session --session ui-redesign "Updating the component library"Daily Development Sessions
Section titled “Daily Development Sessions”# Morning planning sessionrawi ask --new-session --session daily-$(date +%Y%m%d) "Today I'm working on [feature]"
# Reference throughout the dayrawi ask --session daily-$(date +%Y%m%d) "I'm stuck on this implementation"Code Review Sessions
Section titled “Code Review Sessions”# Start review sessionrawi ask --new-session --act code-reviewer "I need to review this pull request"
# Iterative reviewrawi ask "Here's the first file: [code]"rawi ask "And here's the test file: [code]"rawi ask "What about the overall architecture?"Session Configuration
Section titled “Session Configuration”Default Session Behavior
Section titled “Default Session Behavior”# Configure default session settingsrawi configure --auto-session true # Auto-create sessionsrawi configure --session-timeout 24h # Session expiry timerawi configure --max-sessions 50 # Maximum stored sessionsSession Cleanup
Section titled “Session Cleanup”# Clean up old sessionsrawi history --cleanup --older-than "30d"
# Archive important sessionsrawi history --session abc123 --archiveTroubleshooting Sessions
Section titled “Troubleshooting Sessions”Common Session Issues
Section titled “Common Session Issues”Session not found:
# List all sessions to find the correct IDrawi history --sessionsSession context lost:
# Check session detailsrawi history --session abc123 --showToo many sessions:
# Clean up old sessionsrawi history --cleanupIntegration with Other Features
Section titled “Integration with Other Features”Sessions + Shell Integration
Section titled “Sessions + Shell Integration”# Start session with file analysiscat app.js | rawi ask --new-session --act code-reviewer "Review this file"
# Continue session with more filescat tests.js | rawi ask "Now review the tests for the same functionality"Sessions + Workflows
Section titled “Sessions + Workflows”# Development workflow sessionrawi ask --new-session "Starting feature: user profile management"# ... development continues ...rawi ask "Feature complete, now I need deployment instructions"