Files
tobayah 5bcb5871b3 feat: scaffold Compass AI-native foundation (Sprint 0+1)
Sprint 0 — .claude/ and project memory:
- ADR-001 AI-native mandates (8 rules: agent-first, schema-first, streaming, eval-driven, cost-aware routing, cache-aware, async-first, observable)
- 3 project skills: compass-architecture (12-pt self-check), compass-clause-taxonomy (13-pt), compass-ai-native-mandates (8-pt)
- CLAUDE.md (project identity, 5 moats, stack, skill priority, security invariants, license PRIVATE, Bridgestone IP risk)
- AGENTS.md (8-subagent topology spec with model + tools + parallelizable + routing)
- .claude/settings.json (permissions + hooks placeholders)

Sprint 1 — monorepo, Python skeleton, hooks:
- Disconnected Lovable: removed lovable-tagger from package.json + vite.config.ts; rewrote README to Compass-focused
- npm workspaces root + apps/web/ (existing frontend moved intact; vite/tailwind/tsconfig paths still relative to apps/web/)
- uv workspace root (12 members): apps/{api,workers,mcp-server} + packages/{core,schemas,prompts,agents,llm-gateway,retrieval,ingestion,evals,jurisdictions}
- apps/api: FastAPI app with /health, /ready, / endpoints + structlog lifespan (smoke-tested: 200 OK + JSON)
- apps/workers: Celery configured (Redis broker, no tasks yet)
- packages/core: auth (User), tenant context, audit log, SSE events, confidence classifier (all stubs except confidence which is functional)
- packages/llm-gateway: working LLMRouter with select_model() per ADR-001 M5 + Langfuse trace wrapper + GatewayRejected if tenant_id/operation missing (M5+M8 enforcement at gateway)
- 6 subagent definitions in .claude/agents/: doc-parser, clause-extractor, clause-reviewer, jurisdiction-checker, rls-auditor, test-writer
- 5 hook scripts in scripts/hooks/: check_destructive_sql, check_secrets_stage, check_git_identity (Bridgestone domain block), format_file (ruff/prettier router), warn_sensitive_paths (prompts/migrations reminders)
- .claude/settings.json hooks block activated (PreToolUse Bash + PowerShell, PostToolUse Edit/Write)
- .env.example template + extended .gitignore (Python, .venv, .uv, secrets, eval results, Hetzner state)

Smoke tests passed:
- npm install (371 packages, no lovable-tagger)
- uv sync --all-packages (297 packages including FastAPI, Celery, LiteLLM, Langfuse, Voyage)
- compass imports: confidence + schemas + jurisdictions + llm-gateway all green
- npm run build (3894 modules transformed, 27s, dist 1.5MB)
- uvicorn serving /health 200 + /ready 200 + / 200 + /docs Swagger UI

Refs: docs/architecture/ADR-001-ai-native.md, docs/handoffs/2026-05-17-sprint0-handoff.md
2026-05-17 15:24:20 +02:00

4.9 KiB

Compass — open-core legal-tech contract management

Status: PRIVATE. Build phase. No public mentions, no monetization, no LinkedIn references. See: CLAUDE.md (project memory + license posture), docs/architecture/ADR-001-ai-native.md (AI-native architecture mandates), AGENTS.md (multi-agent topology).

What

Multi-tenant legal-tech contract management for SME legal teams, boutique law firms, in-house counsel in multi-jurisdiction operations. Differentiated by:

  1. AI-native architecture (LLM/agents/embeddings in core data flow, not bolted on)
  2. Multi-tenant Postgres RLS day 1
  3. Multi-jurisdiction (~30 countries) clause variants
  4. On-prem self-host (Hetzner) — vs hosted-only competitors
  5. EU regulatory focus (GDPR/RODO/Schrems II/AI Act)

Monorepo layout

compass-contract-hub/
├── apps/
│   ├── web/                    # Vite + React 18 + TS + shadcn (frontend)
│   ├── api/                    # FastAPI + PydanticAI agents (Python)
│   ├── workers/                # Celery tasks (Python)
│   └── mcp-server/             # MCP server (Python)
├── packages/                   # shared Python packages (uv workspace)
│   ├── core/                   # auth, tenant context, audit, events
│   ├── schemas/                # Pydantic models (entities + LLM I/O)
│   ├── prompts/                # versioned prompts
│   ├── agents/                 # PydanticAI agent definitions
│   ├── llm-gateway/            # LiteLLM + router + cache + Langfuse
│   ├── retrieval/              # Qdrant + chunking + hybrid search
│   ├── ingestion/              # PDF/DOCX/OCR pipeline
│   ├── evals/                  # golden datasets + promptfoo runners
│   └── jurisdictions/          # pl/, de/, fr/, ... per-country rules
├── supabase/                   # migrations + Edge Functions
├── scripts/hooks/              # Claude Code hooks (PreToolUse/PostToolUse)
├── docs/
│   ├── architecture/           # ADRs
│   └── handoffs/               # session handoff docs
├── .claude/
│   ├── skills/                 # project-specific skills (compass-*)
│   ├── agents/                 # subagent definitions
│   └── settings.json
├── CLAUDE.md
├── AGENTS.md
├── pyproject.toml              # uv workspace root
└── package.json                # npm workspace root

Stack

  • Frontend: Vite + React 18 + TypeScript + shadcn/ui + Tailwind + Supabase JS
  • Backend: Python 3.12 + FastAPI + PydanticAI + LangGraph (selective) + LiteLLM
  • DB: Supabase Postgres + RLS day 1 (migration to self-hosted Hetzner pre enterprise launch)
  • Vector: Qdrant + Voyage AI voyage-multilingual-2
  • Doc processing: unstructured.io + PyMuPDF + Marker + Tesseract OCR
  • Observability: Langfuse self-hosted
  • Eval: promptfoo + custom golden datasets, CI regression
  • Task queue: Celery + Redis
  • Hosting: Hetzner CCX23 Falkenstein DE

Setup (local dev)

Requirements:

  • Node.js 20+ (nvm install 20)
  • Python 3.12+
  • uv (pip install uv)
  • Docker + docker compose
  • Supabase CLI (brew install supabase/tap/supabase / scoop install supabase)
# Frontend
cd apps/web
npm install
npm run dev          # http://localhost:8080

# Backend (separate terminal)
uv sync              # installs all packages in workspace
cd apps/api
uv run uvicorn main:app --reload --port 8000

# Workers (separate terminal)
cd apps/workers
uv run celery -A celery_app worker --loglevel=info

# Local services (Redis, Qdrant, Langfuse)
docker compose -f docker-compose.dev.yml up -d

Env vars: copy .env.example → .env.local and populate. Never commit .env*.

Working in this repo

Read CLAUDE.md first. Defines:

  • Project identity + 5 moats
  • Stack final + skill priority order (legal-tech → compass-* → framework → communication)
  • 8 AI-native mandates (ADR-001) — non-negotiable for every PR with LLM ops
  • Security invariants (RLS day 1, tenant_id everywhere, audit log, AI legal disclaimer)
  • Cost discipline (per-tenant tracking, model routing rules)
  • License posture (PRIVATE — no public commits, no LinkedIn mentions)

Per-PR self-check required in description:

  • compass-ai-native-mandates 8-point checklist (every LLM/agent change)
  • compass-architecture 12-point checklist (architectural changes)
  • compass-clause-taxonomy 13-point checklist (prompt/schema changes)

PR review gated by compass-pr-reviewer subagent (see AGENTS.md).

License

Deferred. Decision pending IP lawyer review (Apache 2.0 vs AGPL-3.0 + Commercial Exception). Until then: no public distribution, no published forks, no derivative works outside this private repo.

Owner

Tobiasz Badura — solo founder (private build phase). Contact via personal channels only; do not use Bridgestone work email or systems for anything related to this project.