aws / aws/amazon-q-developer-cli
Feature Request: Auto-Save Conversations
- Vorherrschende Sprache
- Rust
- Sterne
- 2k
- Forks
- 439
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
# Feature Request: Auto-Save Conversations
## Summary
Add automatic conversation saving functionality to Q CLI, allowing users to enable auto-saving of conversations without manually using the `/save` command.
## Motivation
Currently, users must manually execute `/save ` to preserve their conversations. This can lead to data loss if users forget to save important conversations or if the CLI crashes unexpectedly. An auto-save feature would provide:
- **Data Protection**: Automatic preservation of conversation history
- **User Convenience**: No need to remember to manually save
- **Workflow Continuity**: Seamless conversation preservation during long sessions
## Proposed Solution
### Settings
Add two new configuration settings:
- `chat.enableAutoSave` (boolean, default: `false`) - Enable/disable auto-save functionality
- `chat.autoSavePath` (string, default: `"auto-save-{timestamp}.json"`) - File path pattern for auto-saved conversations
### Behavior
- **Trigger**: Auto-save after each AI response completion
- **File Naming**: Generate filename at session start (e.g., `auto-save-20241030-143915.json`)
- **File Management**: Overwrite the same file throughout the session
- **Error Handling**: Log errors quietly without interrupting the conversation
- **User Experience**: Silent operation (no notifications)
### Usage Example
```bash
# Enable auto-save
q settings chat.enableAutoSave true
# Start conversation - auto-save file created at session start
q chat
# Each AI response automatically saves to the session file
# No manual intervention required
```
## Implementation Plan
### Minimal Changes Required (~15 lines)
1. **Settings Addition** (3 lines in `settings.rs`)
- Add `ChatEnableAutoSave` and `ChatAutoSavePath` to Setting enum
- Add corresponding string mappings
2. **Auto-Save Logic** (8-10 lines)
- Check if auto-save is enabled
- Generate session filename on first save
- Reuse existing persist logic from `/save` command
- Handle errors gracefully with logging
3. **Integration Point** (2-3 lines)
- Call auto-save function after AI response completion
- Integrate with existing conversation state management
### Files to Modify
- `crates/chat-cli/src/database/settings.rs` - Add new settings
- `crates/chat-cli/src/cli/chat/mod.rs` - Add auto-save call
- `crates/chat-cli/src/cli/chat/cli/persist.rs` - Extract reusable save logic (optional)
## Alternatives Considered
1. **Auto-save on user input**: Less intuitive, doesn't capture complete conversation turns
2. **Interval-based saving**: More complex, less predictable behavior
3. **Always-on auto-save**: Could surprise users, violates principle of least surprise
## Compatibility
- **Backward Compatible**: Feature is opt-in (disabled by default)
- **No Breaking Changes**: Existing `/save` and `/load` functionality unchanged
- **File Format**: Uses same JSON format as manual `/save`
## Testing Strategy
- Unit tests for auto-save logic
- Integration tests for setting management
- Error handling tests (disk full, permission denied)
- User workflow tests (enable/disable, file creation)
---
This feature addresses a common user need while maintaining Q CLI's existing behavior and design principles. The implementation is minimal and non-intrusive, making it a low-risk addition with high user value.
Beitragsleitfaden
Rechercherichtung
Beginnen Sie mit crates/chat-cli/src/database/settings.rs und dem bestehenden Speicherablauf in crates/chat-cli/src/cli/chat/cli/persist.rs und untersuchen Sie anschließend den Pfad zum Abschluss der Antwort in crates/chat-cli/src/cli/chat/mod.rs. Überprüfen Sie, dass die Einstellungen opt-in sind, eine Sitzungsdatei nach jeder AI-Antwort wiederverwendet wird, Fehler protokolliert werden, ohne den Ablauf zu unterbrechen, und das bestehende Verhalten von /save und /load unverändert bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust
- Bereich
- cli
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100