The Driftless loop has five phases. Every command, every event, every scan fits into one of them.Documentation Index
Fetch the complete documentation index at: https://docs.driftless.icu/llms.txt
Use this file to discover all available pages before exploring further.
Phase 1: Scan
The scanner extracts components from your TypeScript codebase. It reads the AST and identifies:- NestJS: endpoints, guards, services, modules, DTOs, interceptors, pipes
- Next.js: pages, layouts, route handlers, server actions, middleware
- React: components and hooks
- On demand:
driftless initordriftless scan - On push: The GitHub App triggers a scan when code is pushed to tracked branches
Phase 2: Observe
The GitHub App watches pushes and PRs. On every push to a tracked branch, it matches changed files against team topics. On PRs, it posts sticky context comments listing the relevant topics for the changed files.Phase 3: Contextualize
The API stores extracted facts and the team writes context on top of them. Topics are created with what/how/decisions/gotchas, anchored to files via patterns or explicit paths. Typed relations connect topics into a knowledge graph.[[slug]]) inside any free-text field are auto-parsed into forward and backward references in the graph.
Phase 4: Deliver
Context reaches agents and humans through CLI commands:Phase 5: Check
When code changes on tracked branches, topics whose anchored files overlap get marked stale. The staleness reason lists the specific files and commit that triggered it.System Architecture
Driftless is built as six components that compose into a single knowledge layer. Each component has one responsibility; the API orchestrates them. Scanner (@driftless/scanner): Static AST analysis that extracts components from TypeScript codebases. Identifies endpoints, guards, services, modules, and DTOs from NestJS; pages, layouts, route handlers, and server actions from Next.js; components and hooks from React. Uses a two-pass streaming pipeline with O(largest file) memory. Zero dependencies besides TypeScript and ts-morph.
API (NestJS, Render): REST API hosted at api.driftless.icu. Authenticates via API keys (x-api-key) and Clerk. A global WorkspaceGuard enforces workspace-level authorization across all endpoints. Exposes 45 endpoints for scans, context CRUD, graph queries, sync, and dashboard data.
CLI (@driftless-sh/cli, npm): 24 commands including init, sync, context CRUD, graph, install-skill, doctor, and branches. Bundled with esbuild for fast startup. The primary interface agents and developers use to interact with Driftless.
GitHub App: Posts context comments on PRs to surface relevant topics for changed files. Marks topics as stale when code is pushed to tracked branches, keeping the knowledge graph honest about drift.
Agent Skill (SKILL.md): Instructions for coding agents (Claude Code, Cursor). Teaches the sync to load to edit to persist workflow so agents automatically check and contribute context during coding sessions.
Dashboard (React + Vite, Vercel): Visual interface for workspace health, context browsing, architecture maps, and topic coverage. Companion to the CLI for team-level visibility.