Files
agents_and_robots/shell/memory/migrations/001_init.sql
T
egutierrez 199dc18eb5 refactor(memory): migration files + embed.FS
- shell/memory/migrations/001_init.sql extraido del schema inline
- sqlite.go: applyMigrations() con embed.FS aplicado al abrir
- aplica regla db_migrations.md (fn_registry/.claude/rules/)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 00:45:00 +02:00

23 lines
795 B
SQL

-- Memoria persistente del agente: facts (clave/valor por sujeto) + messages (historial chat).
CREATE TABLE IF NOT EXISTS facts (
agent_id TEXT NOT NULL,
subject TEXT NOT NULL,
key TEXT NOT NULL,
value TEXT NOT NULL,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (agent_id, subject, key)
);
CREATE TABLE IF NOT EXISTS messages (
id INTEGER PRIMARY KEY AUTOINCREMENT,
agent_id TEXT NOT NULL,
room_id TEXT NOT NULL,
role TEXT NOT NULL,
content TEXT NOT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_messages_room ON messages(agent_id, room_id, created_at DESC);
CREATE INDEX IF NOT EXISTS idx_facts_subject ON facts(agent_id, subject);