Skip to content

Conversation

@edenreich
Copy link
Contributor

@edenreich edenreich commented Dec 11, 2025

Implements automatic saving of agent conversations to database. Adds --no-save flag to disable persistence. Agent sessions now appear in conversation history alongside chat sessions.

And it is possible to continue a session that was started in agent mode, in chat mode.

Changes

Key Features:

  • Automatic persistence: Agent conversations are automatically saved to the configured storage backend (SQLite by default)
  • Complete session tracking: Each message, tool execution, and token usage is persisted
  • Optional saving: Added --no-save flag to disable saving for specific runs (useful for testing or temporary sessions)
  • Unified history: Agent sessions now appear in conversation history alongside chat sessions

Technical Changes:

  1. Modified conversation repository interface (internal/domain/interfaces.go):

    • Added SaveAgentConversation method to support agent session persistence
    • Updated GetConversations to include agent sessions in history
  2. Enhanced SQLite storage (internal/infra/storage/sqlite.go):

    • Added agent conversation table schema
    • Implemented agent session persistence logic
    • Updated queries to handle both chat and agent conversations
  3. Updated agent command (cmd/agent.go):

    • Added --no-save flag to disable persistence
    • Integrated with persistent conversation service
    • Automatic saving of agent sessions to database
  4. Enhanced conversation services (internal/services/conversation.go, internal/services/persistent_conversation.go):

    • Unified handling of chat and agent conversations
    • Added agent-specific persistence logic
    • Updated conversation listing to include agent sessions
  5. Updated documentation (CLAUDE.md):

    • Documented the new --no-save flag
    • Added information about agent session persistence
    • Updated usage examples

Benefits:

  • Better user experience: Users can now review and continue agent sessions from history
  • Improved debugging: Complete session logs available for troubleshooting
  • Consistent behavior: Agent sessions work like chat sessions with full persistence
  • Flexibility: --no-save flag provides control over when to persist sessions

Testing:

  • Updated mock repository (tests/mocks/domain/fake_conversation_repository.go)
  • Modified shortcut handler (internal/handlers/chat_shortcut_handler.go)
  • Updated core shortcuts (internal/shortcuts/core.go)

This feature brings agent mode to parity with chat mode in terms of persistence and history management, making it easier for users to work with long-running agent sessions.

@edenreich edenreich linked an issue Dec 11, 2025 that may be closed by this pull request
10 tasks
@edenreich edenreich merged commit cba596a into main Dec 11, 2025
5 checks passed
@edenreich edenreich deleted the feat/agent-persistence-332 branch December 11, 2025 16:13
ig-semantic-release-bot bot pushed a commit that referenced this pull request Dec 11, 2025
## [0.88.0](v0.87.0...v0.88.0) (2025-12-11)

### 🚀 Features

* Add persistent storage for agent mode conversations ([#333](#333)) ([cba596a](cba596a))
* **agent:** Add session resumption support ([#335](#335)) ([a8942f7](a8942f7))

### 🐛 Bug Fixes

* Improve tool execution status tracking ([#334](#334)) ([95f71cd](95f71cd))
@ig-semantic-release-bot
Copy link

🎉 This PR is included in version 0.88.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add database persistence for agent mode conversations

2 participants