Skip to content

Configuration ​

cora uses a layered config system with clear separation of concerns. Later sources override earlier ones.

File Roles ​

FileContentsUsed by
~/.cora/auth.tomlAPI key only (secret, chmod 600)Local dev
~/.cora/config.yamlProvider, model, base_url, focus, hook, output, etc.Global default
.cora.yamlPer-project config overridesProject + CI
CORA_API_KEY env varAPI key for CI/one-shotCI only

Config Resolution Order ​

Settings are resolved in this order (highest priority first):

  1. CLI flags — --provider, --model, --base-url, etc.
  2. Environment variables — CORA_PROVIDER, CORA_MODEL, CORA_BASE_URL
  3. .cora.yaml — Project root config file
  4. ~/.cora/config.yaml — Global config
  5. Auto-detect — Provider-specific env vars (OPENAI_API_KEY, ZAI_API_KEY, etc.)
  6. Built-in defaults — Sensible defaults for all settings

After all sources are merged, config values are validated at load time: out-of-range values (e.g. temperature: 5), unsupported formats (output.format: prety), and misspelled keys (quailty_gate, temprature) fail loudly with a clear message instead of being silently ignored. This applies to temperature (0.0–2.0), max_tokens/timeout (≥1), max_tokens_param, response_format, output.format, hook.mode/on_violation/min_severity, provider.base_url, and profile weight/action/tone/detail_level.

API Key Resolution ​

  1. --api-key flag (one-shot)
  2. CORA_API_KEY env var (CI)
  3. ~/.cora/auth.toml (local dev)
  4. Provider-specific env vars (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.)

.cora.yaml Example ​

Create this file in your project root. Run cora init to generate it.

yaml
# cora project config
provider:
  provider: openai
  model: gpt-4o
  base_url: https://api.openai.com/v1

llm:
  temperature: 0
  max_tokens: 4096
  max_tokens_param: auto       # auto | max_tokens | max_output_tokens | max_completion_tokens
  reasoning_effort: low        # optional: none | minimal | low | medium | high (sent as `reasoning_effort`)
  timeout: 120
  cache_ttl: 1440

review:
  system_prompt: "You are a senior code reviewer."
  # system_prompt_file: ./review-prompt.md
  response_format: json_object
  # Strip comments from added diff lines before the LLM sees them
  # (ALIBI defense, arXiv:2607.24964). Claim flagging is always on.
  sanitize_comments: false
  static_analysis:
    auto_clippy: false       # auto-run `cargo clippy` (Rust only)
    clippy_output_file: ""   # or read clippy output from file
  # Large diffs (see "Large Diffs")
  max_chunk_chars: 48000     # split a diff above this many characters
  exclude: []                # globs removed from the reviewed diff
  fail_on_incomplete: true   # exit 1 when part of the diff was not reviewed

focus: security, performance, bugs

hook:
  mode: warn
  min_severity: major
  max_diff_size: 51200
  on_violation: warn           # warn | disallow (blocks commit if violations found)

ignore:
  defaults: true               # built-in ignores: node_modules, vendor, dist, lockfiles, *.min.js ... (see Ignore Files)
  keep: []                     # built-ins to turn off one by one, e.g. ["**/vendor/**"]
  files:
    - "src/generated/**"       # added to the built-ins
    - "*.generated.ts"
  rules: []                    # rule IDs to skip (e.g. ["no-unwrap", "sql-injection"])

output:
  format: pretty               # pretty | json | compact | sarif
  color: true                  # ANSI colors in terminal output

quality_gate:
  enabled: true
  thresholds:
    max_critical: 0
    max_security: 0

bundling:
  max_chars_per_group: 60000
  max_files_per_group: 20
  strategy: smart            # smart | flat
  coalesce_by_directory: true
  coalesce_by_language: true

analysis:
  entry_point_patterns:
    - "*Handler"
    - "resolve_*"

brain:
  embedding: auto           # auto | off

profile: clean-code        # security-first | performance | clean-code | beginner-friendly | minimal | rust-strict | typescript-strict | go-pragmatic

Environment Variables ​

VariableDescription
CORA_API_KEYAPI key for CI (overrides auth.toml)
CORA_PROVIDERActive provider (openai, anthropic, groq, ollama, zai)
CORA_MODELModel name override
CORA_BASE_URLCustom API base URL
CORA_CONFIGPath to config file
CORA_FORMATOutput format (pretty, json, compact, sarif)
CORA_NO_COLORDisable colored output
CORA_NO_CACHESkip diff-hash review cache (same as --no-cache)
GITHUB_TOKENGitHub token for SARIF upload
GITHUB_REPOSITORYGitHub repo for SARIF upload
GITHUB_REFGitHub ref for SARIF upload

Provider-Specific Env Vars ​

Each provider has its own API key variable. cora checks these for auto-detection.

bash
# OpenAI
OPENAI_API_KEY=sk-...
OPENAI_BASE_URL=https://api.openai.com/v1

# Anthropic
ANTHROPIC_API_KEY=sk-ant-...

# Groq
GROQ_API_KEY=gsk_...

# Ollama (local, no key needed)
OLLAMA_HOST=http://localhost:11434
# Optional: OLLAMA_API_KEY if your Ollama instance requires auth
OLLAMA_API_KEY=...

# Z.AI
ZAI_API_KEY=...

Diff-Hash Caching ​

cora caches review results by diff hash in ~/.cache/cora/reviews/. If you re-review the same diff, the cached result is returned instantly.

SettingDescription
llm.cache_ttlTTL in minutes (default: 1440 / 24h)
--no-cache or CORA_NO_CACHE=1Bypass cache

Custom System Prompts ​

Override the default system prompt for review or scan commands to match your project's coding standards and review criteria.

yaml
review:
  system_prompt: "Focus on Rust idioms and error handling."
  # Or load from a file:
  system_prompt_file: ./prompts/review.md

scan:
  system_prompt: "Check for OWASP Top 10 vulnerabilities."
  system_prompt_file: ./prompts/scan.md

If both system_prompt and system_prompt_file are set, the file takes precedence.

Response Format (JSON Mode) ​

Opt into structured JSON output from the LLM by setting review.response_format to json_object. This instructs the LLM to return valid JSON, enabling machine-readable parsing and pipeline integration.

yaml
review:
  response_format: json_object

Requires provider support for structured output. Works with OpenAI, Anthropic, and compatible APIs.

Anti-Hallucination ​

cora uses three mechanisms to prevent the LLM from fabricating findings:

  • File path injection — Actual file paths are embedded in the prompt, anchoring the LLM to real files in the diff.
  • Post-parse filtering — After parsing, any reported file paths or line numbers that don't exist in the actual diff are discarded.
  • Position validation — The model also quotes the source line each finding is about (snippet). Before a finding is shown or stored, cora checks line against that quote. If the quote is on line, nothing changes. If it is on exactly one line within 25 lines of line (or the only line of the file that holds it when there is no line), the finding moves there. If the quote is nowhere to be found, or two lines equally near hold it, the finding becomes file-level instead of pointing at the wrong code. Whitespace and a +/- diff marker in the quote are ignored, quotes shorter than 4 characters are not trusted, and a finding with no quote keeps the old behaviour. The same check runs for review, scan and the MCP tools.

Cross-File Review Context ​

To review a change accurately, cora injects cross-file context alongside the diff — it doesn't review the diff in isolation. This is deterministic (no extra LLM calls) and bounded by a token budget so cost stays predictable.

Two axes are resolved:

  • Outbound — what the changed code calls/imports (function/type definitions the diff references).
  • Inbound (blast radius) — who calls the changed code. If a PR modifies a function signature or type, its call-sites across the repo are surfaced so breaking changes can be flagged.

When the budget can't fit a full definition, a thin signature slice is injected instead of skipping it, so more symbols fit under the same budget.

yaml
review:
  context_chain:
    enabled: true               # master switch for cross-file context
    max_context_tokens: 5000    # budget (~4 chars/token) for injected context
    follow_depth: 1             # outbound resolution depth (1 = direct refs only)
    include_tests: true         # resolve test files via naming convention
    include_callers: true       # resolve callers of changed code (blast radius)
    use_brain: true             # enrich prompt with symbol-index intelligence
    auto_index: true            # bring the index up to date first (CI, fresh clones)
    impact_depth: 2             # blast-radius traversal depth (2 = callers of callers)
    prefer_index: true          # prefer symbol index (FTS5 + call graph) over regex
FieldDefaultNotes
enabledtrueDisable to review the diff only.
max_context_tokens5000Approx. 20 KB of code injected.
follow_depth1Outbound recursion depth (1 = direct references).
include_teststrueMap changed source to its test files.
include_callerstrueInbound caller resolution. When the symbol index is unavailable (regex fallback): gitignore-aware file scan bounded to ≤400 files and ≤3 call-sites per symbol. When the index is available (default path, prefer_index: true): up to 20 call-sites per symbol, filtered by ignore.files patterns.
auto_indextrueBefore a review or scan with a judge (an LLM, or an agent through cora.review_prepare / cora.scan_prepare) builds its context, bring the project's index and vectors up to date (incremental: unchanged files are skipped). Without it a fresh checkout, such as a CI runner, has no code intelligence and the code embedding model goes unused. A --no-llm run only reads an existing index. false reads an existing index only.
use_braintrueEnrich prompt with symbol-index intelligence (impact analysis, affected tests, semantic search). Only active when cora index has been run.
impact_depth2Blast-radius traversal depth. See Impact depth guidance below.
prefer_indextruePrefer symbol index (FTS5 + call graph) over regex scanning for outbound resolution.

Impact Depth Guidance ​

impact_depth controls how many levels up the call graph the blast-radius traversal follows:

  • 1 — direct callers only. Cheapest, misses indirect breakage.
  • 2 — callers of callers. Recommended default — covers the common layered case (handler → service → helper).
  • 3 — deep blast radius for strongly layered codebases (handler → service → repository → helper). Higher token cost.
  • 4+ — rarely worth it. The traversal is BFS with cycle protection, so it is always safe, but on real codebases the caller count grows quickly with depth: heavily-used utility functions and entry points turn into hubs with hundreds of callers, and the injected context fills with noise rather than signal.

Why not "unlimited"? Setting a very large depth is technically valid — traversal stops on its own once every reachable caller is visited — but on any non-trivial repo it surfaces the entire transitive caller closure. The prompt budget (max_context_tokens) then truncates the output arbitrarily, so you pay full traversal cost for context the LLM never sees.

How to choose:

  • Small / flat repo → leave at 2.
  • Layered repo (handler/service/repository split) where bugs manifest several layers from the root cause → 3 for that repo's .cora.yaml.
  • Want precision rather than reach → keep 2 and rely on cora impact interactively with --depth to explore specific symbols on demand.

Note: impact_depth only governs the automatic blast-radius context injected during cora review. The interactive cora impact / cora trace commands default to --depth 3 and are unaffected by this setting.

Quality Gate ​

Quality gate evaluates review findings against configurable thresholds to produce a PASS/FAIL result. This is useful for CI enforcement — block merges when code quality drops below your standards.

yaml
quality_gate:
  enabled: true

  # Global thresholds — any exceeded = FAIL
  thresholds:
    max_critical: 0        # 0 critical issues allowed
    max_major: 3           # max 3 major issues (disabled by default)
    max_minor: 10          # max 10 minor issues (disabled by default)
    max_security: 0        # 0 security findings allowed

  # Per-category overrides
  categories:
    security:
      action: block        # block = any finding → CI fail
      max_findings: 0
    performance:
      action: warn         # warn = comment only, don't fail CI
      max_findings: 5
    bug_risk:
      action: block
      max_findings: 3
    style:
      action: ignore       # skip entirely — don't count toward gate

How It Works ​

  1. After review, findings are counted by severity and category

  2. Each threshold is checked against actual counts

  3. Category actions determine enforcement:

    • block — exceed threshold = gate FAIL (exit code 2)
    • warn — report but don't fail gate
    • ignore — skip entirely

    Actions are validated enums — case-insensitive (block, Block, BLOCK all work), and an unknown value (e.g. blok) fails at config load instead of silently becoming blocking. A disabled gate (enabled: false) never fails.

  4. Overall gate status: PASSED or FAILED

CLI Output ​

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  QUALITY GATE RESULT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  Status:   ❌ FAILED
  Findings: 2 critical, 1 major, 4 minor, 0 info

  Threshold Checks:
  ❌ max_critical          → 2 found   ❌ EXCEEDED
  ✅ max_major             → 1 found   ✅ OK
  ✅ max_security          → 0 found   ✅ OK
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Exit Codes ​

CodeMeaning
0Gate passed, no issues
2Gate failed (threshold exceeded)

Default Behavior ​

When quality_gate.enabled is false (default), quality gate is skipped. The existing --ci flag and hook.on_violation settings continue to work as before.

Debt Tracking ​

cora tracks review findings over time and reports quality trends. Every review is recorded in the reviews table of cora.db, and cora debt (and the MCP tool cora.get_debt) aggregate it. cora.db is the only source: the .cora/history/*.json snapshots of older versions are no longer written or read, and the directory can be deleted.

yaml
debt:
  enabled: true              # show the debt report (`cora debt`, `cora.get_debt`)
  history_dir: ""            # deprecated and ignored; still accepted
  retention_days: 90         # (reserved)
  max_stored_findings: 500   # findings stored per run, most severe first; 0 = all

debt.max_stored_findings bounds what one review or scan writes to cora.db. A full-repository scan can find thousands of issues; storing them all buried the few actionable ones. When a run is cut, its stored summary says how many were left out, and the quality score still uses the whole run. Findings that were not stored are not auto-resolved. To clean an existing database, use cora findings prune (see the CLI reference): --stale-projects removes projects whose directory is gone, and --older-than DAYS removes old resolved findings. Run it with --dry-run first. prune also deletes the vector files of the projects it removes.

CLI Usage ​

bash
cora debt                    # show debt report table
cora debt --json             # machine-readable JSON
cora debt --trend            # quality score trend graph
cora debt --badge            # shields.io badge JSON
cora debt --estimate         # show estimated fix time
cora debt --since v0.4.5     # filter by git tag or date

Quality Score ​

Ranges from 0–10 (10 = no issues). Penalties per finding:

SeverityPenalty
Critical-2.0
Major-1.0
Minor-0.3
Info-0.1

Badge Integration ​

Use cora debt --badge output as a shields.io endpoint:

markdown
[![Quality](https://img.shields.io/endpoint?url=https://example.com/cora-badge.json)]()

Secrets Pre-Scan ​

cora runs a deterministic secrets scan before the AI review. 12 built-in patterns detect leaked credentials:

PatternSeverity
AWS Access Key (AKIA...)Critical
GitHub Token (ghp_/gho_/ghu_)Critical
OpenAI API Key (sk-/sk-proj-)Critical
Anthropic API Key (sk-ant-)Critical
Private Key BlockCritical
JWT TokenMajor
And more (Groq, xAI, Slack, Stripe, Google)Varies

Secrets are automatically masked in output (e.g. AKIA****CDEF). Test/spec/fixture files are auto-skipped.

Static Security Scanner ​

cora runs a static security scan on added lines before the AI review. 11 built-in patterns detect common vulnerabilities:

PatternCategorySeverity
MD5 used for password hashingWeak cryptoMajor
SHA-1 used for password hashingWeak cryptoMajor
Weak hash algorithm (MD5/SHA1)Weak cryptoMinor
Hardcoded password or secretHardcoded secretCritical
SQL injection via string concatenationInjectionCritical
eval() with dynamic inputInjectionCritical
Command injection via exec/systemInjectionCritical
Hardcoded role or permission checkAuthMajor
Debug mode enabledConfigMajor
CORS wildcard allows all originsConfigMajor
SSL certificate verification disabledCryptoCritical

Test files are automatically skipped. Findings are injected into the LLM prompt as additional context.

What the hardcoded-secret check does (and does not) flag ​

The check looks for a secret-named key (password, secret, token, api_key, ...) assigned a literal value, and ignores values that are references:

  • Flagged: quoted literals (password = "...", typed declarations, Go :=, JSON "password": "..."), SQL PASSWORD '...', literal defaults inside env reads (os.getenv("X", "literal"), process.env.X || "literal"), shell ${VAR:-literal}, bare values in .env / .properties / .ini / shell / YAML files when they look like a secret.
  • Not flagged: env reads and other expressions (process.env.X, os.getenv("X")), identifiers and member accesses, ${VAR} / $VAR interpolation, empty strings, UI bindings, placeholders such as %s / $1 / .
  • Known limit: an unquoted YAML value made only of letters (password: correcthorsebattery) is not flagged. It cannot be told apart from a reference to another key (secret: kubernetes, token: optional) without flooding Kubernetes/Compose files with false positives. Quote the value, or give it a digit or symbol, and it is detected. Use cora-ignore: <rule> (see below) for a finding you accept.

Language-Specific Analyzers ​

cora detects the languages in your diff and injects tailored review guidance:

LanguageGuidance
Dart / FlutterWidget lifecycle, state management, async patterns, null safety
Svelte / TypeScriptReactivity, store patterns, SSR considerations, type safety
GoError handling, concurrency, goroutine leaks, interface design
RustOwnership, lifetimes, error handling, unsafe usage, idioms
PythonType hints, async patterns, security (pickle/eval), common pitfalls

No configuration needed — language context is auto-detected from file extensions in the diff.

Quality Profiles ​

cora includes built-in quality profiles for different review focus:

ProfileDescription
security-firstStrict security focus — zero tolerance for vulnerabilities
performanceFocus on speed, memory, and allocation patterns — best for hot-path code
clean-code(default) Broad quality — readability, naming, complexity — best for team projects
beginner-friendlyGentle review — focus on common mistakes and learning opportunities
minimalOnly critical + security — best for quick PRs and hotfixes
rust-strictRust-specific: unsafe, unwrap, panic, lifetime, error handling, idiomatic patterns
typescript-strictTypeScript-specific: any types, null safety, proper typing, async patterns
go-pragmaticGo-specific: error handling, goroutine safety, interface design, idiomatic Go

Run cora profile list to see all profiles. Cora auto-detects the best profile based on your project's primary language (Rust → rust-strict, Go → go-pragmatic, others → clean-code).

Set in .cora.yaml:

yaml
profile: security-first

Custom Rule Engine ​

Write your own regex-based rules under rules_engine.custom in .cora.yaml:

yaml
rules_engine:
  custom:
    - id: no-unwrap
      pattern: "\\.unwrap\\(\\)"
      severity: minor
      message: "Avoid unwrap() in production code — use proper error handling"
      languages: ["rs"]
      exclude: ["tests/**"]

    - id: no-console-log
      pattern: "console\\.log\\("
      severity: minor
      message: "Remove console.log before merging"
      languages: ["ts", "js"]
FieldRequiredDescription
idyesUnique rule id; must not collide with a built-in rule id (it is what ignore.rules and cora-ignore name)
patternyesA regex matched against each line; an invalid regex is a config error
severityyescritical, major, minor or info
messageyesThe finding text
languagesno (default ["all"])File extensions ("rs", "py", "ts") or language names ("rust", "typescript"); "all" or "*" matches every file. An unknown value is a config error
excludeno (default none)Glob patterns of paths to skip

The top-level rules: key is a different thing: a list of free-text instructions for the LLM reviewer (strings), not rule objects.

Rules run during the deterministic pre-scan phase (no LLM needed). cora config validate rejects an invalid pattern, a duplicate id, an unknown language or an empty message with the rule id. cora config validate --dry-run [--path DIR] also runs every custom rule over the project and prints how many lines each one matched, so a rule that matches nothing is visible.

Index Scanner Configuration ​

Control how index-based scanners (unused imports, dead code, breaking changes) behave — including file skip patterns to reduce false positives on bundler entry points and config files.

yaml
rules_engine:
  enabled: true
  max_findings: 50
  index_skip_files:
    - "*.config.ts"
    - "vite.config.*"
    - "webpack.config.*"
    - "tailwind.config.*"
    - "next.config.*"
    - "src/main.ts"
    - "src/index.tsx"
    - "src/app.tsx"
    - "build.rs"
FieldTypeDefaultDescription
enabledbooltrueEnable/disable the rule engine
max_findingsint50Max deterministic findings shown per run; Critical and Major are never hidden (0 or null = unlimited). See below
include_testsboolfalseScan test code like any other code (see "Test code" below)
clone_hintsboolfalseRun the qual-clone hint for Rust .clone() calls (info; noisy on idiomatic Rust, so off by default)
index_skip_files[string](see below)Glob patterns for files to skip during index scanning

Test code ​

Tests legitimately unwrap(), println!, clone, use http:// fixtures and fake credentials, so by default the rules treat test code differently:

  • What counts as test code: whole files under test paths (tests/, *_test.*, *.test.ts, spec/, __tests__/, fixtures/, examples/), Rust #[cfg(test)] modules and #[test] functions (found by brace matching), and, in a diff, a hunk inside mod tests.
  • What is skipped there: the built-in rules bug-unwrap, bug-expect, bug-println, qual-clone, qual-error-ignore, sec-hardcoded-url and sec-hardcoded-secret. The secret scanners only run their high-confidence patterns (AWS keys, GitHub tokens, private keys, ...) on test code, so a real credential committed in a test is still found.
  • bug-println is also skipped in program entry points (main.rs, src/bin/, examples/, benches/). Other CLI modules keep the rule; use ignore.rules to silence it there.
  • Not exempt: custom rules, bug-todo, and every other pattern. In particular, injection, eval, weak-crypto and similar security patterns still apply inside inline test blocks, so wrapping code in a test-looking block does not hide it. (Whole test files by path keep the older behavior: only high-confidence secrets are scanned.)
  • Set rules_engine.include_tests: true to scan test code like any other code. Detection is conservative: when it cannot tell, the line stays scanned. A #[cfg(test)] region is only trusted when brace matching and indentation agree (block comments are skipped; a region that never closes, or has an item starting at or left of its own indentation, is ignored rather than extended over the code after it), and a diff that does not show the mod tests line is scanned normally.

What max_findings caps ​

max_findings caps the deterministic findings only (rule engine, secrets, security, and index scanners; the findings that carry a rule_id). LLM issues are never capped.

  • The cap is applied after suppression (ignore.rules and inline cora-ignore: markers), so suppressed findings never use up slots and hide real ones.
  • Findings are kept highest severity first (Critical, Major, Minor, Info); ties keep their original order. Critical and Major findings are never hidden: the cap limits the noise (Minor, Info) and never drops below the number of serious findings, so a project with 60 Major findings sees all 60 (and no Minor ones). Because the most severe findings always survive, the cap never changes the blocking decision.
  • When findings are cut, cora scan and cora review print one line on stderr (⚠ N more deterministic findings not shown (rules.max_findings = 50; critical and major are never hidden; raise it or set 0/null to show all)), and the cora scan summary mentions it. JSON, SARIF and compact output on stdout are unchanged.
  • 0 or null means unlimited. For large diffs that cora review splits into chunks, the cap applies per chunk.

Default index_skip_files patterns (bundled with cora):

  • *.config.ts, *.config.js, *.config.mjs — bundler/build config files
  • vite.config.*, next.config.*, tailwind.config.* — framework config files
  • src/main.ts, src/index.tsx, src/app.tsx, src/main.rs, src/lib.rs — app entry points
  • build.rs — Rust build scripts

Why skip these? Entry-point files and bundler configs often import symbols that are consumed by the bundler/compiler, not by other source code. Index scanners detect these as "unused" because there are no code-level references. Skipping them eliminates the most common source of false positives.

Glob patterns support: exact match (main.rs), wildcard suffix (*.config.ts), wildcard prefix (vite.*), and any-directory (**/main.ts).

Brain Embedding ​

Cora uses one embedding model for vector search, potion-code-16M-v2 (256 dimensions, a 16M-parameter static code model, MIT), inside the release binaries (a cargo install build downloads it once, 33.5 MB, on the first cora index, cora brain or cora explore) and then used offline.

yaml
brain:
  embedding: auto   # auto | off
ValueDescription
auto (default)Use the code model. While it is not available (offline before the first download, CORA_EMBED_OFFLINE=1), the vector signal is off: search uses keywords and the call graph and says so
offNever use embeddings

potion still loads and means auto. hashing and pretrained were removed (#751): they load, mean auto and print one warning.

Release binaries carry the model. The archives published on GitHub Releases are built with the bundled-model feature: the first command that needs embeddings unpacks the model from the binary into <data dir>/models/potion-code-16M-v2/ (size and SHA-256 checked, atomic, no network, CORA_EMBED_OFFLINE=1 works). Only a binary without it (cargo install, a source build) downloads, as below. To build your own bundled binary: scripts/fetch-model.sh <dir>, then CORA_BUNDLED_MODEL_DIR=<dir> cargo build --release --features tree-sitter,bundled-model.

The model download. Without a bundled model, the first command that needs embeddings downloads all three model files in one step into <data dir>/models/potion-code-16M-v2/ (~/.codecora/cora-code/models/...). The revision is pinned and every file is checked against its SHA-256 before it is moved into place, so a download is verified byte for byte. Several concurrent runs wait for one download. If the download fails (offline, blocked network), cora warns, turns the vector signal off and does not retry for an hour.

Environment variableEffect
CORA_EMBED_MODEL_DIRUse a model already on disk (air-gapped machines, a pre-baked image). Any Model2Vec model with config.json, tokenizer.json and model.safetensors works; its dimensions are read from the model. Nothing is downloaded into it
CORA_EMBED_MODEL_URLFetch the files from this base URL instead of the Hugging Face hub (an internal mirror). The pinned hashes still apply
CORA_EMBED_OFFLINE=1Never touch the network; use the model only if it is already downloaded

One vector file per project and model. Vectors live in <data dir>/vectors/<project id>.<model>.vecq and are rebuilt from the project's symbols after every index run that changed them. Changing brain.embedding, or the first run after the code model became available, re-embeds the project on the next cora index even when no file changed; the file of a model no longer used is removed. brain.vector_store and brain.vector_bits were removed: a config that still sets them loads and warns once.

Inline Suppression (cora-ignore) ​

ignore.rules hides a finding across the whole project (substring match on title or type, plus exact match on rule id). To suppress one finding at one location, put a marker in a source comment:

ts
const bytesPerToken = 4; // cora-ignore: Hardcoded password or secret in variable

// cora-ignore: Rule A, Rule B   (comment-only line: applies to the next line)
const next = compute();
  • Syntax: cora-ignore: <rule>[, <rule>...], matched as a substring of the line, so it works after //, #, --, inside /* */ or <!-- -->, etc. The marker is case-insensitive.
  • <rule> is the finding title or its rule id (e.g. sec-hardcoded-secret, index-dead-code), matched exactly and case-insensitively (not a substring, unlike ignore.rules). Ids are stable, so prefer them over titles.
  • Finding a rule's id: deterministic findings carry a rule_id, shown as (rule: <id>) in pretty output, (<id>) at the end of compact lines, as rule_id in JSON, and as properties.coraRuleId in SARIF. LLM findings have no id; use their title.
  • If an LLM finding and a scanner finding on the same line describe the same problem (they share a topic word, e.g. both are about a hardcoded password/secret), only the LLM finding is reported, and a marker (or ignore.rules entry) naming the scanner rule's id or title still suppresses it. If the LLM finding is about something else (say SQL injection next to a hardcoded secret), both are reported and a marker only suppresses the one it names.
  • Scope: the same line; plus the next line when the marker line contains only a comment.
  • A bare cora-ignore (no : or empty rule list) suppresses nothing, so every suppression names its rule.
  • The rule list runs to the end of the line (or the comment terminator). Put an explanation after --: // cora-ignore: sec-hardcoded-secret -- env var name, not a value. Text without the separator becomes part of the rule name.
  • A marker on a line that has findings but names none of them (a typo, an unknown rule, trailing text) prints warning: cora-ignore at FILE:LINE matched no finding ... on stderr, listing the rule ids that are on that line.
  • Applies to both deterministic scanner and LLM findings, in both cora review and cora scan. Other rules on the same line and the rest of the project stay visible. Works alongside ignore.rules and ignore.files.
  • cora review reads markers from the diff (added and context lines); a marker outside the diff's context window is not seen. cora scan reads markers from the full file contents.
  • cora scan also runs the deterministic secrets and security scanners on every scanned file and applies ignore.rules, so those findings are reported even when the LLM call fails.

Large Diffs ​

cora review sends the diff to the model in requests of at most review.max_chunk_chars characters (default 48,000, about 1,000 lines; the minimum is 2,000). A larger diff is split into chunks of whole files, a single file larger than the budget is split at hunk boundaries (the file header is repeated in every piece), and the findings are merged and de-duplicated. This also applies with --ci; --no-auto-chunk turns it off. hook.max_diff_size remains the hard limit for runs that do not chunk.

review.exclude takes the same globs as ignore.files, but it filters the diff itself: an excluded file is never sent to the model and never produces a finding (ignore.files only scopes the symbol index and the context chain). Use it for CHANGELOG.md, docs/**, lockfiles and generated code. The pretty output names the excluded files; with json, sarif and compact the note goes to stderr so stdout stays parseable.

A review that did not cover the whole diff is not a pass. When a chunk fails, or the model call fails and only the deterministic findings remain, the output says which files were not reviewed and the exit code is 1 instead of 0 (a blocking code, 2, is never lowered). Set review.fail_on_incomplete: false to keep the old warn-and-pass behaviour.

When the model cannot answer a whole request ​

A reasoning model can spend its entire output budget on thinking and return an empty reply with finish_reason=length, however large max_tokens is. Cora first raises max_tokens (up to a ceiling). If the reply is still empty, or the model call fails, it reviews the diff again in two halves, and halves a failing chunk again, down to a quarter of the original; a single hunk cannot be cut further. llm.reasoning_effort (for example low, or none where the model allows it) is sent with every request and keeps the model from over-thinking in the first place. Leave it unset to use the provider default. A provider that rejects the field answers HTTP 400, so set it only for models that take it.

A reply whose findings array is followed by more JSON (a duplicate or truncated copy) is never shown as a summary: the findings in the array are kept and the extra text is dropped, and with an empty array the reply is retried instead of reported as "No issues found".

Path-scoped ignore rules ​

ignore.rules entries can be plain strings (the rule is silenced everywhere) or objects that silence a rule only under some paths:

yaml
ignore:
  rules:
    - "Hardcoded password or secret"          # whole project
    - rule: bug-println
      files: ["crates/cli/**", "evals/**"]    # only these paths
    - rule: bug-expect
      files: ["**/subprocess.rs"]
      reason: "expects state a local invariant"   # optional, for reviewers

rule is matched like a plain entry (rule id or title fragment). files uses the same globs as ignore.files and must not be empty (an empty list is a config error). It applies to review, scan and the MCP tools, before the max_findings cap. reason is documentation for the people reading the config.

Ignore Files ​

Files and directories that are out of scope for cora. Ignoring is the first thing to set up in a project: dependencies, build output and generated code are noise for the reviewer, cost tokens, put untrusted third-party text in the prompt, and fill the code index with symbols that are not yours (so "related code" would point into node_modules).

Built-in ignores ​

Cora ignores these by default in cora review (the diff), cora scan and cora index. Only names that are almost always third-party or generated are on the list; names that are often a project's own code are not:

KindPatterns
Dependenciesnode_modules, vendor, bower_components, __pycache__, site-packages, .venv, Pods (at any depth, so a monorepo's packages/app/node_modules too)
Outputdist, target and .git at the project root; .next, .nuxt, .gradle at any depth
Minified files and source maps*.min.js, *.min.css, *.js.map, *.css.map
Lockfilespackage-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb, Cargo.lock, poetry.lock, Pipfile.lock, Gemfile.lock, composer.lock, go.sum, flake.lock

Not ignored on purpose: build, out, coverage, venv, docs/_build and similar. They are often real source or scripts (coveragepy's coverage/ package is its whole source; a Go build/ holds scripts). Build and coverage output is normally in .gitignore, which cora scan and cora index follow; list the rest yourself in ignore.files. The list was checked against real repositories (Django, Rails, React, Flask, Express, coveragepy, ripgrep, cobra): it hid only vendored libraries, minified files, source maps and lockfiles.

cora review says how many files of the diff the built-ins skipped, and which. See the effective list with cora config show. Turn built-ins off when one of them is wrong for your project:

yaml
ignore:
  keep:                # turn single built-ins off (written exactly as above)
    - "**/vendor/**"   # a vendor/ directory that is your own code
    - "**/Cargo.lock"  # review lockfile changes
  # defaults: false    # or turn the whole list off

Your own patterns ​

yaml
ignore:
  files:
    - "src/generated/**"
    - "**/*.pb.go"
    - "*.generated.ts"

ignore.files adds to the built-ins. It excludes files from review-time context, cora scan and cora index.

PatternMatches
src/main.tsExact path — only src/main.ts
*.config.tsSuffix wildcard — any file ending in .config.ts
vite.config.*Prefix wildcard — vite.config.js, vite.config.ts
**/main.tsAny-dir name — src/main.ts, app/main.ts, a/b/main.ts
**/phaser/**Any-dir wildcard — any path containing a phaser/ directory
src/engine/**Prefix-dir — everything under src/engine/
**/*.test.tsDouble wildcard ext — any .test.ts file anywhere

Files that .gitignore already excludes are skipped by the walk of cora scan and cora index as well.

Which mechanism for what ​

SettingEffect
ignore.defaultsfalse turns the built-in list off. ignore.keep turns single entries off.
ignore.filesOut of scope for scan, index and review-time context. Adds to the built-ins.
review.excludeRemoved from the reviewed diff (never sent to the model, never produces a finding), whatever ignore.files says.
rules_engine.index_skip_filesLeft out of the index scanners only (dead code, unused imports); the files are still indexed.
ignore.rulesSilences a rule (everywhere, or only under some paths); the files are still reviewed. Give a reason.
cora-ignore: commentSilences one finding at one place.

Prefer ignoring files over silencing rules, and a narrow ignore.rules over a broad one: a silenced rule hides the same mistake in your own code too. Do not ignore your tests or your source to make a report shorter.

Static Analysis ​

Run language-specific static analysis tools automatically during review and feed their output to the LLM for better findings.

yaml
review:
  static_analysis:
    auto_clippy: false       # auto-run `cargo clippy` (Rust only)
    clippy_output_file: ""   # or read clippy output from a file
FieldDefaultDescription
auto_clippyfalseAuto-run cargo clippy --message-format=json and inject warnings into review context (Rust projects only)
clippy_output_file""Read clippy JSON output from a file instead of running clippy (useful for CI where clippy runs separately)

Bundling ​

Deprecation notice: as of the current release, cora scan does not read this section — batch sizing is governed by --batch-files (default 20) and an internal ~60,000-character batch budget. These keys are parsed but have no effect on cora scan. They are kept for backward compatibility; do not rely on them.

yaml
bundling:
  max_chars_per_group: 60000  # max source characters per LLM batch
  max_files_per_group: 20      # max files per batch
  strategy: smart              # grouping strategy: smart | flat
  coalesce_by_directory: true  # merge small batches from the same directory
  coalesce_by_language: true   # merge small batches with the same language
FieldDefaultDescription
max_chars_per_group60000Soft limit on source characters per batch
max_files_per_group20Max files per batch before splitting
strategysmartGrouping strategy: smart (coalesce by directory + language within limits) or flat (first-fit by character count, legacy)
coalesce_by_directorytrueMerge small batches from the same directory into one LLM call
coalesce_by_languagetrueMerge small batches with the same primary language

Analysis ​

Configure entry-point symbol patterns for architecture and call-graph analysis. Entry points are treated as roots when tracing execution paths and detecting dead code.

yaml
analysis:
  entry_point_patterns:
    - "*Handler"
    - "resolve_*"
    - "*Middleware"
    - "main"
FieldDefaultDescription
entry_point_patterns[]Glob patterns identifying entry-point symbols (used by dead-code, trace, and arch commands to avoid false positives on intentionally-unreachable functions)

Tech Debt Tracker ​

cora tracks review history and calculates tech debt metrics over time.

Config ​

yaml
debt:
  enabled: true           # default: true
  # history_dir is deprecated and ignored: history is stored in cora.db
  retention_days: 90

CLI ​

bash
cora debt                    # Show debt report table
cora debt --json             # Machine-readable JSON output
cora debt --trend            # ASCII quality score graph
cora debt --since 2026-06-01 # Filter by date
cora debt --since v0.4.5     # Filter by git tag
cora debt --branch develop   # Filter by branch

Snapshots are auto-saved after every review (best-effort, never fails the review).

MCP Server ​

cora includes a built-in MCP (Model Context Protocol) server that exposes rules and config to AI coding agents like Claude Code, Cursor, Copilot, and Windsurf.

Start the server ​

bash
cora mcp      # Start MCP server
cora serve    # Start MCP server + auto-reindex on startup (ensures fresh index)

Available tools ​

ToolDescription
cora.list_rulesList all rules, security patterns, and secret patterns
cora.check_snippetCheck a code snippet against deterministic scanners (no LLM)
cora.get_quality_gateGet quality gate config and thresholds
cora.get_configGet effective project config (no secrets exposed)
cora.list_profilesList all quality profiles
cora.search_symbolsSearch the symbol index (requires cora index)
cora.find_callersFind all callers of a symbol (reverse call graph)
cora.find_impactAnalyze blast radius of changing a symbol
cora.find_affected_testsFind test files affected by changed source files
cora.index_statusCheck if a symbol index exists and get statistics
cora.review_diffReview a git diff using cora's full pipeline (makes LLM call)
cora.review_prepareAgent-as-reviewer step 1: prompts, valid_files and deterministic findings for a diff. No LLM in cora
cora.review_finalizeAgent-as-reviewer step 2: merge and validate the agent's findings, apply rules and gate. No LLM call
cora.scan_prepareAgent-as-reviewer scan step 1: one batch of project files (paged) plus deterministic findings
cora.scan_finalizeAgent-as-reviewer scan step 2: merge and validate the agent's findings for the whole scan
cora.get_debtGet tech debt report from review history
cora.get_project_infoGet project context (repo, branch, cora version, index status)
cora.get_memoryRecall project patterns from Uteke (requires uteke CLI)
cora.brain_searchHybrid code search: FTS5 + vector + graph → RRF fusion
cora.installDetect installed AI agents and configure cora as MCP server
cora.dead_codeFind potentially dead code (functions with no callers)
cora.queryQuery the code graph with simple patterns (e.g. main -> *)

Configure in Claude Code ​

Add to your project's .claude/settings.json:

json
{
  "mcpServers": {
    "cora": {
      "command": "cora",
      "args": ["mcp"]
    }
  }
}

Configure in Cursor ​

Add to .cursor/mcp.json:

json
{
  "mcpServers": {
    "cora": {
      "command": "cora",
      "args": ["mcp"]
    }
  }
}

The MCP server communicates via JSON-RPC 2.0 over stdio — no HTTP server needed.