Invect

Chat Message Persistence

How the AI assistant remembers your conversation history.

Chat Message Persistence

The AI chat assistant maintains a per-flow conversation history that is automatically saved to the database and restored when you return to a flow. Your assistant remembers what you discussed, what tools it ran, and what changes it made — even across page reloads or browser restarts.

How it works

  • Auto-save: Messages are saved automatically after each assistant response and when you switch flows.
  • Per-flow scoping: Each flow has its own independent conversation history.
  • Full context: Tool calls, their arguments, and results are all persisted, so the assistant has context when you return.
  • Graceful handling: If you close the tab, a final save is dispatched automatically.

Clearing history

Click the trash icon in the chat panel to clear the conversation for the current flow. This deletes all messages from the database — the assistant starts fresh next time.

Database

Chat messages are stored in the chat_messages table, scoped by flow. Deleting a flow automatically cleans up its chat history (cascade delete).

API

MethodPathDescription
GET/chat/messages/:flowIdGet all messages for a flow
PUT/chat/messages/:flowIdReplace all messages for a flow
DELETE/chat/messages/:flowIdDelete all messages for a flow

Programmatic access

const messages = await core.getChatMessages(flowId);
await core.saveChatMessages(flowId, messages);
await core.deleteChatMessages(flowId);