The CLI includes an AI-powered conversation title generation system that automatically creates meaningful titles for your conversations. This helps you organize and find conversations more easily.
The title generation system provides:
- Automatic AI-generated titles: Generate concise, descriptive titles based on conversation content
- Background processing: Titles are generated automatically without blocking the user interface
- Smart invalidation: Titles are regenerated when conversations are resumed or modified
- Configurable models: Choose which AI model to use for title generation
- User opt-out: Disable title generation with fallback to first 10 words
- Individual processing: Each conversation is processed separately for better reliability
Configure title generation in your .infer/config.yaml:
conversation:
title_generation:
enabled: true # Enable/disable title generation
model: "anthropic/claude-4-haiku" # AI model for title generation
batch_size: 10 # Number of conversations to process per batch
interval: 300 # Background job interval in seconds (default: 300 = 5 minutes)
system_prompt: | # Custom system prompt (optional)
Generate a concise conversation title based on the messages provided.
REQUIREMENTS:
- MUST be under 50 characters total
- MUST be descriptive and capture the main topic
- MUST use title case
- NO quotes, colons, or special characters
- Focus on the primary subject or task discussed
EXAMPLES:
- "React Component Testing"
- "Database Migration Setup"
- "API Error Handling"
- "Docker Configuration"
Respond with ONLY the title, no quotes or explanation.- enabled: Enable or disable automatic title generation (default: true)
- model: AI model to use for title generation. Falls back to
agent.modelif not specified - batch_size: Number of conversations to process in each background job run (default: 10)
- interval: Background job interval in seconds (default: 300 = 5 minutes)
- system_prompt: Custom prompt for title generation. Uses default if not specified
- New Conversations: When a new conversation is created, it starts with a basic title derived from the first user message
- Background Processing: A background service periodically scans for conversations that need AI-generated titles
- AI Generation: The system sends the conversation content to the configured AI model with instructions to create a concise title
- Title Updates: Generated titles are saved to the conversation metadata
Titles are automatically invalidated and regenerated when:
- A conversation is resumed after being saved
- New messages are added to an existing conversation with a generated title
- The conversation content changes significantly
If title generation is disabled or fails, the system falls back to:
- Taking the first 10 words from the first user message
- Truncating to 50 characters maximum
- Using "Conversation" if no suitable content is found
Trigger title generation for all pending conversations:
infer conversation-title generateThis command will:
- Find all conversations that need titles (new or invalidated)
- Process them individually using the configured AI model
- Update the conversation metadata with generated titles
- Report progress and completion time
View the current status of title generation:
infer conversation-title statusThis shows:
- Current configuration settings
- Whether background jobs are running
- Number of conversations pending title generation
- List of pending conversations (up to 10)
The title generation system adds the following fields to conversation metadata:
title_generated: Boolean flag indicating if the title was AI-generatedtitle_invalidated: Boolean flag indicating if the title needs regenerationtitle_generation_time: Timestamp of when the title was generated
The background job system:
- Runs at configurable intervals when persistent storage is enabled (default: 5 minutes)
- Processes conversations in batches according to
batch_sizesetting - Handles each conversation individually to prevent batch failures
- Includes error handling and logging for failed title generations
- Title generation uses individual API calls for each conversation (no batching)
- Background processing prevents blocking the user interface
- Generated titles are cached to avoid repeated API calls
- The system respects model token limits and conversation size constraints
Title generation works with all supported storage backends:
- SQLite: Full support with database schema migration
- PostgreSQL: Full support with database schema migration
- Redis: Full support using JSON metadata storage
- In-Memory: Not supported (titles would be lost on restart)
- Model Selection: Use fast, efficient models like
claude-4-haikufor title generation to minimize latency - Batch Size: Keep batch sizes reasonable (5-20) to balance performance and resource usage
- Monitoring: Check the status command periodically to ensure titles are being generated
- Fallback: Even with title generation disabled, the first-10-words fallback provides reasonable titles
# Check if storage is enabled
infer conversation-title status
# Ensure you have persistent storage configured
# Title generation requires storage.enabled: true in config- Reduce
batch_sizein configuration - Consider using a faster model for title generation
- Check network connectivity to inference gateway
- Verify persistent storage is enabled and working
- Check logs for background job initialization errors
- Ensure the configured model is available
The system includes robust error handling:
- Failed title generations are logged but don't stop processing other conversations
- Network errors are retried according to the client retry configuration
- Invalid or empty titles trigger fallback to first-10-words approach
- Storage errors are logged and the system continues with in-memory operation
Title generation integrates with the inference gateway using the same client configuration as other features:
- Respects timeout settings from
client.timeout - Uses retry configuration from
client.retry - Honors model availability and selection
- Includes middleware for logging and monitoring
When upgrading to a version with title generation:
- Database Migration: Schema changes are applied automatically on startup
- Existing Conversations: Will have
title_generated: falseand will be processed by background jobs - Configuration: Title generation is enabled by default but can be disabled
- Backward Compatibility: All existing functionality continues to work unchanged