You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add persistent chat history with directory isolation
Implements persistent chat history that survives CLI restarts and is isolated by working directory.
Features:
- Chat history persists across CLI sessions using SQLite database
- History is isolated per working directory (/project/a vs /project/b)
- Up arrow navigation works with persistent history
- Dual cleanup limits: max 100 entries per directory, 1000 total
- Silent failure: history issues don't break CLI functionality
- Filters out empty/whitespace-only inputs
Implementation:
- Database table: chat_history(input TEXT, cwd TEXT) with index on cwd
- Uses existing database infrastructure and Os abstraction
- Transactional insert+cleanup for data consistency
- Early return for empty inputs to avoid unnecessary DB operations
Files modified:
- crates/chat-cli/src/database/mod.rs: Added ensure_chat_history_table(), add_chat_history_entry(), get_chat_history()
- crates/chat-cli/src/cli/chat/input_source.rs: Load history on startup, save on input
Edge cases handled:
- Database failures (silent)
- Empty/whitespace inputs (filtered)
- Working directory access failures (fallback to default)
- Unicode/special characters (parameterized queries)
0 commit comments