Skip to content

Repository files navigation

CortexLoop

The company OS that reads every signal — and acts on it.

Cortex ingests engineering, product, and analytics signals, turns them into structured, searchable knowledge, and runs a fleet of autonomous agents that detect drift, declare and size incidents, predict problems before they happen, trace cause to effect, and keep a self-improving knowledge base — all exposed over a REST API and a React dashboard.

Python FastAPI React Supabase Claude


How it works

Everything hangs off one pipeline:

  Ingest  ─────────────►  Understand  ─────────────►  Act
  connectors + webhooks    Claude + embeddings         8 autonomous agents
  → raw_events             → knowledge_items           → incidents, predictions,
                                                          causality, briefings
  1. Ingest — connectors stream PRs, tickets, messages, PRDs, roadmap changes, and metrics via webhooks (with a 30-day backfill on connect) into a single normalized raw_events table.
  2. Understand — Claude Haiku extracts topic / decision / action / status from each signal; Voyage embeds it (512-dim) into knowledge_items for semantic search.
  3. Act — an orchestrator runs the agents in dependency order; they write back to Supabase and post to Slack / Linear.

Features

Layer What it does
Knowledge & Ask Cortex Extracted insights across every source, semantically searchable; grounded plain-English Q&A with sources.
Drift detection Cross-team checks (a PRD with no tickets, a KPI regressing with no owner…) → alerts + auto-generated engineering specs.
Incidents Auto-declares incidents from signals, sizes the blast radius in dollars, routes to the domain owner, files a Linear ticket, opens a Slack thread, and writes the RCA.
People graph Learns who owns and knows each domain across Engineering & Product; drives routing.
Predictive intelligence Recognizes signal patterns that preceded past incidents/churn/sprint-failures and predicts them before they happen, with accuracy that self-tunes.
Causal graph Temporal / sequential / cross-source edges from an engineering change to its business outcome; ranks incident root causes and scores impact in dollars.
Self-improving knowledge Stale facts decay, contradictions resolve (newest wins), duplicates merge, a company constitution is distilled, and gaps are surfaced.
Analytics & Product KPIs, metric anomalies, dashboards, roadmap/PRD alignment, experiments — with their own drift checks.
External API Other agents query Cortex over REST with an X-API-Key.

The agents

An orchestrator runs 8 fault-isolated, stateless agents in dependency order (state lives in Supabase; Haiku for speed, Sonnet for reasoning):

prediction → causal → knowledge → incident → sprint → analyst → customer → product

Tech stack

  • Backend — FastAPI (async), Supabase Postgres + pgvector, Anthropic Claude (claude-haiku-4-5 for fast classification/extraction, claude-sonnet-4-6 for reasoning), Voyage voyage-3-lite embeddings.
  • Frontend — React (CRA + CRACO) + Tailwind CSS, a dark grouped sidebar, SVG graph visualizations, Supabase Auth.
  • Data — ~30 Postgres tables across 12 SQL migrations, all tracing back to raw_events.

Repository layout

CortexLabs/
├── backend/
│   ├── main.py                 # FastAPI app, routers, startup jobs
│   ├── requirements.txt
│   ├── scripts/                # seed_demo.py, create_demo_user.py
│   ├── supabase/migrations/    # 002–013_*.sql (apply in order)
│   └── src/
│       ├── routes/             # events, connections, alerts, query, incidents,
│       │                       #   people, agents, product, analyst, predictions,
│       │                       #   causal, knowledge_mgmt, auth, external, webhooks_*
│       ├── connectors/         # github, slack, linear, notion, confluence, figma,
│       │                       #   productboard, amplitude, mixpanel, looker, sql, gong
│       ├── agents/             # base, orchestrator + the 8 agents
│       ├── jobs/               # extract, drift, product_drift, analyst_drift, routing,
│       │                       #   knowledge_maintenance
│       ├── lib/                # supabase, claude, voyage, normalize, people_graph,
│       │                       #   incident_engine, pattern_memory, causal_graph,
│       │                       #   knowledge_engine, audit
│       └── middleware/         # auth (JWT + AuthUser), verify_webhook
└── frontend/
    └── src/
        ├── pages/              # Dashboard, Knowledge, Ask Cortex, Alerts, Incidents,
        │                       #   Predictions, Causal, People, Executive, Analytics,
        │                       #   Developers, Login, Onboarding, Home (landing)
        ├── components/         # Nav + landing/*
        ├── hooks/useAuth.js
        └── lib/supabase.js

Getting started

Prerequisites

  • Python 3.11+, Node 18+
  • A Supabase project (with the pgvector extension)
  • An Anthropic API key and a Voyage API key

1. Database

Open the Supabase SQL Editor and run the migrations in backend/supabase/migrations/ in numeric order (002013). They create raw_events, knowledge_items, the intelligence-layer tables, and the auth tables.

2. Backend

cd backend
python -m venv .venv && source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env         # then fill in the values below
python -m uvicorn main:app --host 0.0.0.0 --port 4000

Backend serves at http://localhost:4000 (/health, interactive docs at /docs).

Required env (backend/.env):

SUPABASE_URL=...
SUPABASE_SERVICE_ROLE_KEY=...
SUPABASE_JWT_SECRET=...
ANTHROPIC_API_KEY=...
VOYAGE_EMBEDDINGS_API_KEY=...
FRONTEND_URL=http://localhost:3000
BACKEND_URL=http://localhost:4000
# optional: AGENTS_AUTORUN=false, plus per-connector keys (GitHub, Slack, Notion,
# Amplitude, Mixpanel, Looker, SQL, …) — connectors no-op gracefully when unset.

3. Frontend

cd frontend
npm install
npm start

Frontend serves at http://localhost:3000. Env (frontend/.env):

REACT_APP_API_URL=http://localhost:4000
REACT_APP_SUPABASE_URL=...
REACT_APP_SUPABASE_ANON_KEY=...

4. Seed demo data (optional)

cd backend
python scripts/seed_demo.py         # signals, incidents, metrics, people, product data
python scripts/create_demo_user.py  # a login that can browse the demo data

Demo login: demo@cortexlabs.ai / CortexDemo2026!

Connectors

Each authenticates per-user (OAuth or API key) and degrades gracefully when a key is missing.

Team Sources
Engineering GitHub, Slack, Linear
Product Notion, Confluence, Figma, Productboard, Loom
Analytics Amplitude, Mixpanel, Looker, SQL warehouse
Calls Gong

API overview

All routes are under /api. A few highlights:

GET  /api/events                       # normalized signal feed
POST /api/query                        # ask a question, get a grounded answer
GET  /api/incidents                    # incidents with dollar-sized blast radius
GET  /api/predictions/active           # what Cortex expects to break next
GET  /api/causal/graph                 # causal-graph stats + top impactful events
GET  /api/causal/root-causes/{id}      # ranked root causes for an incident
GET  /api/knowledge/constitution       # distilled "how this company operates"
POST /api/agents/run-all               # run every autonomous agent
POST /api/external/query               # external agents (X-API-Key header)
POST /api/auth/login                   # Supabase-backed auth

Status

Core intelligence layers and the dashboard are functional. Multi-tenant auth (RLS lockdown + per-route user_id scoping) is being rolled out additively — the auth middleware, /auth routes, and audit log are in place; the hard cutover is switchable and not yet enabled.

License

Proprietary — © CortexLoop. All rights reserved.

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages