Create new table in Ava's SQLite db for storing tool traces.
Ava already uses SQLite for various storage. The db is at $AVA_DATA_ROOT/ava.db (typically /home/ava/ava.db). Look at existing table creation patterns in the codebase.
CREATE TABLE tool_traces ( id TEXT PRIMARY KEY, -- UUID, e.g. 'trace-550e8400-e29b-41d4-a716-446655440000' created_at TEXT NOT NULL, -- ISO8601 timestamp tool_name TEXT NOT NULL, -- e.g. 'python_exec', 'run_bash', 'read_file' input TEXT NOT NULL, -- JSON string of tool input output TEXT NOT NULL, -- JSON string of tool output duration_ms INTEGER NOT NULL, -- Execution time in milliseconds user_id TEXT, -- Telegram user ID (optional, for filtering) chat_id TEXT -- Telegram chat ID (optional, for filtering) );
CREATE INDEX idx_traces_created ON tool_traces(created_at);
1. Add migration/table creation in Omni/Ava.hs or wherever DB is initialized 2. Create helper functions:
3. Add TraceRecord data type in appropriate module
Call cleanupOldTraces periodically (e.g., on startup and every hour). Can use a simple approach - no need for a separate thread, just clean on each insert or on startup.
Add unit tests for insert/get/cleanup functions.