---
name: agents
description: Always-loaded project anchor. Read this first. Contains project identity, non-negotiables, commands, and navigation pointer.
last_updated: 2026-04-07
---

# CAI — Coherence AI

## What This Is
A CLI and MCP server that keeps `.cai/` scaffold files in sync with the actual codebase — deterministic drift detection, back-pressure verification (`cai verify`), correction learning, and a global pattern library for Claude Code, Cursor, Copilot, and OpenCode.

## Non-Negotiables
- Drift detection must stay deterministic — no AI calls, no network, millisecond-level runtime.
- Never overwrite user content outside of `<!-- cai:start -->` / `<!-- cai:end -->` markers.
- All auto-fix operations must be idempotent — running twice produces the same result.
- Strict TypeScript (`strict: true`) — no `any` in core logic, no implicit coercion.
- ESM only — no CommonJS fallbacks. Node >=20 required.

## Commands
- Build: `npm run build` (tsup)
- Dev: `npm run dev` (tsup --watch)
- Test: `npm test` (vitest run)
- Test watch: `npm run test:watch`
- Typecheck: `npm run typecheck` (tsc --noEmit)

## After Every Task
After completing any task: update `.cai/ROUTER.md` project state and any `.cai/` context files that are now out of date. If no pattern existed for this task type, create one in `.cai/patterns/`.

## Navigation
Read `.cai/ROUTER.md` at the start of every session before doing anything else.
