Skip to content

Memory

Memory in Maestro provides conversation persistence across sessions and restarts.

Each conversation is identified by a session ID:

  • Telegram: Uses the chat ID
  • CLI: Uses a fixed ID per terminal session
  • REST API: Provided by the caller

When you send a message:

  1. Maestro loads previous messages for your session
  2. Your new message is appended
  3. The full history is sent to the LLM
  4. The response is stored in memory

Each message includes:

FieldDescription
roleuser, assistant, or tool
contentMessage text
timestampWhen the message was sent
toolCallsTool calls made (if any)
toolResultsResults from tool execution

Maestro uses SQLite for memory:

  • File location: data/maestro.db
  • Auto-created: Database is created on first run
  • Persistent: Survives restarts
  • Self-contained: No external database needed

REST API:

Terminal window
curl http://localhost:3000/chat/session-123

CLI:

/history

CLI:

/clear

This clears the current session’s history but doesn’t affect other sessions.

Memory is session-scoped, not agent-scoped:

  • All agents in a conversation share the same memory
  • If the orchestrator routes to different agents, they all see the history
  • This enables context continuity across agent switches
You: What's the capital of France?
[personal-assistant responds: Paris]
You: Write a Python function to fetch weather for that city
[coder agent sees the previous exchange and knows "that city" = Paris]

Dynamic agents (created through conversation) are also stored in SQLite:

  • Agent configurations persist across restarts
  • Separate from session memory
  • Can be updated, listed, and deleted via tools

Long conversations can exceed the LLM’s context window. Maestro handles this by:

  1. Including recent messages up to the context limit
  2. Older messages may be truncated from the LLM’s view
  3. All messages remain stored in SQLite
data/
└── maestro.db # SQLite database
├── sessions # Conversation history
└── agents # Dynamic agent configs

The data/ directory is gitignored by default.

To backup your data:

Terminal window
cp data/maestro.db data/maestro.db.backup

To restore:

Terminal window
cp data/maestro.db.backup data/maestro.db

For production, consider automated backups.