feat: initial alpha scaffold — FastAPI + MCP + pgvector
Implements v0.0.1 of OpenBrain: - FastAPI REST API (capture, search, recent, stats) with Bearer auth - MCP server (streamable HTTP at /mcp) exposing all 4 tools - pgvector schema (vector(1024) for bge-m3) - asyncpg connection pool with lazy init + graceful close - Ollama embedding client with fallback (stores thought without vector if Ollama unreachable) - Woodpecker CI pipeline (lint + kaniko build + push to Gitea registry) - Portainer/Swarm deployment compose - Mosaic framework files: AGENTS.md, PRD.md, TASKS.md, scratchpad Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
28
docker/postgres/init.sql
Normal file
28
docker/postgres/init.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
-- OpenBrain — Database Initialization
|
||||
-- Runs once on first container start
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||
CREATE EXTENSION IF NOT EXISTS vector;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS thoughts (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
content TEXT NOT NULL,
|
||||
embedding vector(1024), -- bge-m3 native dimension
|
||||
source VARCHAR(100) NOT NULL DEFAULT 'unknown',
|
||||
metadata JSONB NOT NULL DEFAULT '{}',
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Vector similarity search index (cosine)
|
||||
CREATE INDEX IF NOT EXISTS thoughts_embedding_idx
|
||||
ON thoughts USING ivfflat (embedding vector_cosine_ops)
|
||||
WITH (lists = 100);
|
||||
|
||||
-- Recent queries
|
||||
CREATE INDEX IF NOT EXISTS thoughts_created_at_idx
|
||||
ON thoughts (created_at DESC);
|
||||
|
||||
-- Filter by source
|
||||
CREATE INDEX IF NOT EXISTS thoughts_source_idx
|
||||
ON thoughts (source);
|
||||
Reference in New Issue
Block a user