Compass is a context engine that builds temporal knowledge graphs. Written in Go (1.25+), it uses PostgreSQL with pgvector, pg_trgm, and tsvector extensions. Single binary with no external dependencies beyond Postgres.
Proto definitions live in a separate repo: raystack/proton (at ../proton relative to compass). Never edit files in gen/ directly.
Workflow for API changes:
- Edit proto definitions in the proton repo first
- Regenerate:
buf generate ../proton --template buf.gen.yaml --path raystack/compass - Update compass handler/service code to match
Alternative: make proto fetches proton from GitHub using the PROTON_COMMIT pinned in the Makefile.
Generated code lands in gen/raystack/compass/v1beta1/. The API layer uses ConnectRPC (not plain gRPC) -- handlers implement the connect service interface.
core/-- Domain logic (entity, principal, document, embedding, namespace, pipeline)store/-- PostgreSQL repositories and migrationshandler/-- ConnectRPC handlersinternal/mcp/-- MCP server for AI agent tool accessinternal/middleware/-- Connect interceptors (namespace, principal, logging, recovery)internal/server/-- Server bootstrap and wiringinternal/config/-- Configurationcli/-- CLI commandsgen/-- Auto-generated protobuf/connect code (DO NOT EDIT)
- Identity model uses
Principal(not User/Caller) -- supports types: user, agent, service - Multi-tenancy via
Namespacewith PostgreSQL Row-Level Security - Temporal data: entities and edges use
valid_from/valid_totimestamps - Soft deletes: set
valid_to = now()instead of DELETE - Database migrations in
store/migrations/-- sequential numbering (000001, 000002, etc.) - MCP server reads namespace and principal from context (injected by middleware)
make build # Build binary
make test # Run tests with coverage
make proto # Regenerate proto from proton (GitHub, uses PROTON_COMMIT)
make lint # Run golangci-lint
go vet ./... # Run vet
go build ./... # Check compilation
Local proto generation from a local proton checkout:
buf generate ../proton --template buf.gen.yaml --path raystack/compass
- Edit files in
gen/directly - Add Elasticsearch, Kafka, or other infrastructure dependencies -- Postgres only
- Use
UserorCallernaming -- the identity type isPrincipal - Skip database migrations -- always add a new migration file for schema changes