Compylar is a local CLI for giving AI coding agents a durable, evidence-backed understanding of a repository. Instead of making the agent rediscover the same structure on every session, it builds a small repository brain that can be reused for future work.
This repository contains the implementation of that workflow: a compiler for repository facts, a local brain stored on disk, and a set of commands for status checks, task context, and refreshes.
Compylar is designed around a simple idea:
- analyze a JavaScript or TypeScript repository
- capture facts with source evidence
- detect when that knowledge is stale
- produce targeted context for a coding task
- work with an agent without requiring a full repository re-scan every time
The implementation is deterministic by default. It does not depend on an OpenAI key to compile facts or generate context.
Compylar is published on npm, so you can run it directly with npx or install it globally.
Check that the CLI works:
npx -y compylar@0.1.2 --helpTo use it in a real repository, install Compylar for the agent you want to work with:
cd /path/to/your-repositoryFor Codex:
npx -y compylar@0.1.2 setup-agent . --agent codex --scope project --applyFor Claude Code:
npx -y compylar@0.1.2 setup-agent . --agent claude --scope project --applyFor OpenCode:
npx -y compylar@0.1.2 setup-agent . --agent opencode --scope project --applyFor Cursor:
npx -y compylar@0.1.2 setup-agent . --agent cursor --scope project --applyThis installs the Compylar skill bundle, including source-backed codebase-rules generation, and a short project trigger so the agent knows to use repository memory before broad source-code reads. Cursor receives a native .cursor/rules/compylar.mdc trigger; the other agents retain their existing instruction-file surfaces.
Compylar runs locally through Node.js and npm:
- Node.js 22.5+
- macOS
- Linux
- Windows through npm launchers
Agent setup currently supports:
- Codex
- Claude Code
- Cursor
- OpenCode
No OpenAI API key is required for the core workflow.
After running setup-agent, start your coding agent inside the same repository.
For Codex:
cd /path/to/your-repository
codexThen ask:
Index this codebase
The first index can take some time. Compylar creates a deterministic repository brain, and the installed agent workflow guides the agent through a deeper source-cited codebase index and memory ingest.
After indexing finishes, start a new agent session in the same repository and ask normal questions such as:
- What does this project do?
- How does authentication work?
- Explain the main architecture.
Expected behavior: the agent should use Compylar memory first instead of grepping or reading broad sets of files just to rediscover foundational knowledge.
Then try a real feature request:
- Add an activity timeline to the dashboard using the existing project patterns.
Expected behavior: the agent should retrieve task-specific Compylar context, read only targeted files when necessary, implement the change, run validation, and update Compylar memory afterward so future sessions do not repeat the same discovery work. After first semantic onboarding it also generates a source-backed RULES.md; later structural or convention changes refresh a Compylar-managed rules file alongside memory.
If you want to try the built-in demo instead of wiring up a real repository, run:
npx -y compylar@0.1.2 demoThe main flow is straightforward:
# compile repository facts into a local brain
compylar compile .
# inspect the current state
compylar brain .
# see whether the repository changed since the last compile
compylar status .
# create task-specific context for an agent
compylar context "add authentication to the dashboard" .A few important details:
compilecreates the repository brain and stores it under.compylar/statuscompares the current repository to the last successful baselinecontextreturns relevant evidence and metadata without flooding the agent with raw sourcerefreshandsyncare used when the repository has changed and the stored knowledge needs to be updated
- Node.js 22.5 or newer
- pnpm
pnpm typecheck
pnpm test
pnpm buildUseful developer commands:
pnpm demo
pnpm first-run
pnpm benchmarkCompylar is designed to be useful to AI agents, but the repository itself is not an AI-only product. The core behavior is based on deterministic repository analysis, with optional AI enrichment available only when explicitly enabled by the user.
If you are using Compylar in a real project, the most important thing is to keep the README and project description grounded in what the code actually does. That is the difference between a polished project page and a generic generated one.
The repository includes:
- the CLI implementation in the
src/directory - example applications under
examples/ - agent integration assets in
skills/andAGENTS.md - design and contract documents in
docs/