Write your AI rules once.
Every coding agent follows them.
Cortex compiles one .cortex/ folder into the native instruction files of Claude Code, Codex, Cursor, Copilot, Gemini CLI, Windsurf, Kiro and Antigravity — formatted for each model, fitted to each tool’s limits, and checked for drift in CI.
npm install -g github:Phani3108/Cortex
## Architecture - Business logic lives in src/services/ - ! Never commit secrets or .env files ## Testing - Every bug fix ships with a failing test first
Your team uses four AI tools. They are following four different rulebooks.
Every tool reads a different file, in a different format, with different limits — and the copies drift the week after you write them.
- The same rules pasted into CLAUDE.md, .cursor/rules, Copilot instructions and AGENTS.md
- Windsurf silently cuts rule files past 12,000 characters; Antigravity past 24 KB
- Tools that read AGENTS.md and their own file load your rules twice
- Nobody notices the copies drifted until an agent does the wrong thing
- One markdown source in
.cortex/, reviewed like code - Hard limits enforced by keeping your highest-impact rules, whole — and telling you what didn’t fit
- Path-scoped rules become native globs; skills become portable
SKILL.md cortex compile --checkfails CI the moment anything drifts
Edit the source. Watch every tool’s file update.
This is the same engine the CLI ships, running in your browser. Nothing is uploaded. Try adding scope: frontmatter, a ! critical rule, or switching tools on and off.
Token counts are estimates (characters ÷ the model family’s average characters-per-token). Limits come from each vendor’s documentation — see the tool matrix.
Three commands. Then it runs itself.
Init
Detects your stack and the AI tools you already use, and imports hand-written CLAUDE.md / AGENTS.md / Cursor / Copilot files so nothing is lost.
cortex init
Compile
Writes each tool’s native files. Refuses to overwrite files a human wrote or edited, and cleans up files it no longer generates.
cortex compile
Guard
Commit the sources and the outputs (cloud agents read them from the repo). CI fails when they drift; cortex learn turns your edits into rule suggestions.
cortex compile --check
Native output for every tool — verified against vendor docs.
Paths, frontmatter and limits live in one table in the engine. When a vendor changes its conventions, one edit updates the CLI, the docs and this page.
| Tool | Always-on rules | Path-scoped rules | Skills | Limit | Docs |
|---|---|---|---|---|---|
| Loading… | |||||
A build system for AI context.
Model-aware formatting
XML sections for Claude, numbered lists for GPT, context-first for Gemini, compact constraints for reasoning models. Set a model per tool and the output follows.
Budget-aware, never truncated
Hard limits are met by keeping whole, high-impact rules — critical rules (- !) first — and listing exactly what was left out.
Path-scoped rules
Add scope: ["src/**/*.tsx"] to a rule file. Cortex emits Cursor globs, Copilot applyTo, Claude paths, Kiro fileMatch and Windsurf glob triggers.
Agent Skills, portable
Skills compile to the open SKILL.md standard in .claude/skills, .agents/skills and .kiro/skills — loaded on demand, not stuffed into every prompt.
Safe by default
Hand-written or hand-edited files are never overwritten without --force. cortex init imports what you already have first.
Live model data
Pricing and context windows for 200+ models, refreshed daily by a GitHub Action. cortex cost tells you what your always-on context really costs.
Give every agent the same brain.
Install, run cortex init in a repo, and commit the result. Two minutes.
npm install -g github:Phani3108/Cortex
cortex init && cortex compile