Commit Graph
1 Commits
Author SHA1 Message Date
Mao Nakamoto 9690eb7021 feat(rag): fleet-knowledge pgvector index + cross-project context injection
Captain-layer RAG — index what only FleetCrown sees across the fleet, never repo
code (the runtime retrieves that itself). Context injection becomes relevance-
ranked instead of profile-dump.

- Local embeddings: scripts/embed-server.py — fastembed BAAI/bge-small-en-v1.5
  (384-dim) behind an OpenAI-compatible /v1/embeddings, on the box (no cloud key).
  systemd fleetcrown-embed.service.
- src/lib/rag/embeddings.ts — provider-agnostic client (ported from OrangeCat's
  convention; EMBEDDINGS_BASE_URL/MODEL/DIM, graceful-off when unset → local dev).
- knowledge_embeddings table (pgvector, vector(384), user_id-scoped) — Drizzle
  schema + raw-SQL ingest/cosine-retrieve in db/queries/knowledge-embeddings.ts.
- scripts/reindex-knowledge.ts — backfill project profiles + dev-logs (P0).
- inject-core: dispatches now get a "Relevant context from your other projects"
  block retrieved against the task, excluding the project it's for. The engine
  under cross-project reference's suggested-references, and the first real fix
  for the "memory is the weakest strut" gap.
- docs/architecture/{cross-project-reference,fleet-knowledge-rag}.md — specs.

Verified live on the box: retrieval is semantically accurate (bitcoin→orangecat,
refugee housing→aoz-housing). 24 chunks indexed across 21 projects. tsc=0, eslint=0.
2026-06-25 16:57:11 +02:00