feat: brain service — self-contained second brain knowledge manager

Full backend service with:
- FastAPI REST API with CRUD, search, reprocess endpoints
- PostgreSQL + pgvector for items and semantic search
- Redis + RQ for background job processing
- Meilisearch for fast keyword/filter search
- Browserless/Chrome for JS rendering and screenshots
- OpenAI structured output for AI classification
- Local file storage with S3-ready abstraction
- Gateway auth via X-Gateway-User-Id header
- Own docker-compose stack (6 containers)

Classification: fixed folders (Home/Family/Work/Travel/Knowledge/Faith/Projects)
and fixed tags (28 predefined). AI assigns exactly 1 folder, 2-3 tags, title,
summary, and confidence score per item.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yusuf Suleman
2026-04-01 11:48:29 -05:00
parent 51a8157fd4
commit 8275f3a71b
73 changed files with 24081 additions and 4209 deletions

View File

@@ -5,8 +5,8 @@ Platform Gateway — Response helpers mixed into GatewayHandler.
import json
from http.cookies import SimpleCookie
from config import SESSION_MAX_AGE
from sessions import get_session_user
from config import SESSION_MAX_AGE, DEV_AUTO_LOGIN
from sessions import get_session_user, get_or_create_dev_user
class ResponseMixin:
@@ -30,6 +30,8 @@ class ResponseMixin:
return None
def _get_user(self):
if DEV_AUTO_LOGIN and self.headers.get("X-Dev-Auto-Login") == "1":
return get_or_create_dev_user()
token = self._get_session_token()
return get_session_user(token)