Created base memories table (ai-brain-base.sql), applied hybrid upgrade (chunks + embeddings + tsvector triggers), and added search_memories() RRF function (search-memories.sql). Validated end-to-end: insert → chunk → embed via OpenRouter → hybrid search returns ranked results combining full-text and vector similarity. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
22 lines
645 B
SQL
22 lines
645 B
SQL
-- ai_brain base schema
|
|
-- Date: 10.03.2026
|
|
--
|
|
-- Prerequisites:
|
|
-- CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
|
-- CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
-- CREATE EXTENSION IF NOT EXISTS vector;
|
|
--
|
|
-- Apply this first, then clawdie-brain-hybrid-upgrade.sql
|
|
|
|
CREATE TABLE IF NOT EXISTS memories (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
created_at TIMESTAMPTZ DEFAULT NOW(),
|
|
session_id TEXT,
|
|
importance INTEGER DEFAULT 2,
|
|
summary TEXT NOT NULL,
|
|
topics TEXT[] DEFAULT '{}',
|
|
key_facts TEXT[] DEFAULT '{}',
|
|
decisions TEXT[] DEFAULT '{}',
|
|
first_message TEXT,
|
|
message_count INTEGER DEFAULT 0
|
|
);
|