Docs & usage

Everything a developer needs to install Codevira, wire it into every AI tool, and use the CLI + MCP surface. Local-first, MIT, ~70 MB — no cloud, no vectors, no account.

Install

pipx is recommended (isolated). Plain pip works too.

# 1 — install (isolated, recommended)
pipx install codevira          # or: pip install codevira

# 2 — bootstrap a project (writes .codevira/, AGENTS.md, .gitignore)
cd ~/Projects/my-project
codevira init

# 3 — wire codevira into every AI tool detected on this machine
codevira setup

That's it. Decisions live in <repo>/.codevira/decisions.jsonl. By default that memory stays per-machine (not committed), so unrelated projects never bleed into each other; run codevira init --shared to commit it and share decisions with teammates on the same repo. The code graph lives in a rebuildable, gitignored cache. With no ML model to load, the server starts in under a second and warm tool calls typically take a few milliseconds.

Requires Python ≥ 3.10. After codevira setup, restart your AI tool so it picks up the new MCP server and (for Claude Code) lifecycle hooks.
3.7 Opt-in tracking. codevira init is the explicit opt-in: codevira tracks only the projects you init. A project you merely open in your editor stays inert — its tools return a "run codevira init" hint and nothing is written, so ~/.codevira/projects/ never fills with projects you never chose. Existing tracked projects (they have an in-repo .codevira/config.yaml) are grandfathered in with zero migration. Want the old track-everything behavior? Set CODEVIRA_AUTO_ADOPT=1.

Connect your AI tools

codevira setup auto-detects installed tools (strong signals: binary on PATH + valid config) and configures each one. What it writes depends on what the tool can do: Cursor gets one user-level entry that resolves the active project from the editor's workspace roots, while Claude Code and Antigravity get an entry per project, pinned with --project-dir, because a project-less entry can bind a session to the wrong project. Pass --force with --ide if the detector misses an install, or --dry-run to preview.

ToolWhat codevira writes
Claude Codea per-project stdio entry in ~/.claude.json (projects.<root>.mcpServers.codevira-<name>, pinned with --project-dir; a bare user-scope codevira entry is removed) + five lifecycle hooks (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Stop). Verified hard enforcement
Cursorone user-level stdio entry codevira in ~/.cursor/mcp.json, no project path (resolved from workspace roots) + reads AGENTS.md
Antigravitya per-project stdio entry codevira-<project> pinned with --project-dir (it sends no workspace roots), written to each Antigravity config under ~/.gemini/ + a PreToolUse hook in <project>/.agents/hooks.json that denies decision-reverting edits 3.7.1 (the hook's verdict is tested; not yet confirmed in a live Antigravity session) + reads AGENTS.md
Claude Desktopone stdio entry codevira in claude_desktop_config.json; it has no workspace signal, so the project is chosen per tool call from the call's file path
Codex · Copilotread AGENTS.md natively — the decisions are portable, no MCP entry required. codevira setup --daemon additionally writes a [mcp_servers.<name>] table for Codex in ~/.codex/config.toml

Prefer manual config? Add this stdio entry to the MCP config of a client that reports its workspace roots (Cursor) — codevira resolves the active project from them. For any other client, and for Claude Code (which keeps its settings per project), add "--project-dir", "/path/to/project" to args so the project is pinned, not guessed:

// e.g. project .mcp.json, .cursor/mcp.json
{
  "mcpServers": {
    "codevira": { "command": "codevira", "args": [] }
  }
}

codevira init also registers the project with the tools it detects; codevira init --per-project writes project-level files (.mcp.json, .cursor/mcp.json) instead.

One shared Codevira for every agent 4.3

By default each AI tool session starts its own codevira. With many agents, worktrees and projects open, switch them all to one local process:

Animated architecture of Codevira: six AI tools (Claude Code, Cursor, Codex, Antigravity, Claude Desktop and a worktree agent) connect over MCP, hooks and git pre-commit to one shared codevira daemon (opt-in; by default each AI tool session runs its own process) with four parts: a router that binds every call to its project, 36 MCP tools, an enforcement engine with 7 policies, and an incremental code graph. Below sit each project's in-repo .codevira/ memory and the per-machine ~/.codevira home. It plays four scenes: a worktree agent records a decision into its main project's memory; a locked decision blocks an edit; saving a file re-indexes only that file; a call that names no project is refused.
codevira daemon install                 # macOS: start at login, restart on crash
codevira setup --daemon --all-projects  # point every project's AI tools at it

It listens on 127.0.0.1 only and needs a token. Each tool's entry names its project and every call carries it, so memory lands in the right project; a call that names none is refused. Worktrees use their main project's entry. Every edited config is backed up first; codevira setup --no-daemon restores it exactly. After daemon install, codevira init and codevira setup use the daemon for new projects (--no-daemon opts out). Claude Desktop reaches it through codevira connect --project <path>.

Verify a connection any time with codevira doctor — it reports which project the server bound to and why, plus an MCP-visibility check for Claude Code.

CLI commands

30 commands total; codevira <cmd> --help shows flags for any one. The daily drivers:

CommandWhat it does
codevira setupDetect AI tools + write MCP configs + Claude Code hooks. --daemon points them at the shared daemon, --no-daemon restores them exactly, --all-projects does every registered project
codevira daemon 4.3The one shared local Codevira: install (start at login, restart on crash), start / stop / restart / status, token / rotate-token, uninstall
codevira connect 4.3Stdio bridge to the shared daemon for clients that can only launch a command (Claude Desktop)
codevira doctorRead-only health check (✓ / ⚠ / ✗ with exact fix commands)
codevira statusIndex health + project state
codevira projectsOne row per real project, worktrees counted under it; --all shows leftovers too; projects archive <name>
codevira indexBuild / refresh the code graph cache
codevira syncRegenerate AGENTS.md + manifest from decisions.jsonl
codevira repair-ids 3.7Detect/repair cross-engineer decision-id collisions (--apply; --semantic reports near-duplicate decisions)
codevira replayBrowse the decision timeline (terminal / markdown / HTML)
codevira search 3.6Search decisions from the terminal; --all-projects searches every registered repo, --json for scripts
codevira eval 3.5Score read-side relevance (recall@k / MRR) on self-derived cases
codevira uninstallReverse the system writes codevira made (--keep-data to keep memory; --dry-run to preview). It does not remove the shared daemon's login service; codevira daemon uninstall does

MCP tool surface

36 tools are surfaced to AI clients via tools/list (one admin tool, refresh_graph, is hidden). They're summary-first by default — pass full=true or expand(ids=[…]) for detail. Set CODEVIRA_TOOL_PROFILE=lean to advertise only the 12 daily-driver tools (about 60% smaller tools/list: ~31 KB → ~13 KB of JSON, measured on 4.3.0).

GroupRepresentative tools
Orientationget_session_context, get_roadmap
Decisionssearch_decisions, list_decisions, expand, record_decision, supersede_decision, mark_decision_outdated, set_decision_flag, get_history
Code graphget_node, get_impact, query_graph
Roadmap / phasesget_phase, add_phase, update_phase_status, complete_phase, update_next_action, write_session_log
Memory subsystemsworking memory, skills, provenance (working_add, working_promote, record_skill, get_skill, origin_of, …)
Code-graph tools (get_impact / query_graph) cover Python, TypeScript, JS/JSX, Go, and Rust. For other languages the agent reads the file directly.
Changed in 4.0: 15 tools were removed on measured usage — the consensus, reflections, spatial and preferences subsystems, plus get_code / get_signature. Nothing recorded was deleted; see MIGRATING.md.
New in 3.6: record_decision(symbol="login") scopes a do_not_revert decision to a single function/class — the lock then blocks only edits that land inside that symbol (edits elsewhere in the file warn). And search_decisions(query, all_projects=true) searches every registered project's decisions, each result tagged with the repo it came from (also via codevira search --all-projects).
New in 3.7 — memory stays fresh: record_decision now supersedes a strong, unprotected near-duplicate instead of appending a stale twin; get_session_context hides superseded / outdated / reverted decisions; and mark_decision_outdated(id) retires a decision that's simply no longer true (reversible). Protected do_not_revert decisions are never auto-retired — the conflict is surfaced for you.

Configuration

Codevira works with zero config. These environment variables (set them in your MCP server's env block) tune the surface — all default to the conservative behavior.

Surface & tokens

VariableEffect
CODEVIRA_TOOL_PROFILE=leanAdvertise only the 12 daily-driver tools (about 60% smaller tools/list)
CODEVIRA_DECISION_DETAIL=fullRestore verbose (pre-v3.5) decision payloads instead of summary-first

Project tracking 3.7

VariableEffect
CODEVIRA_AUTO_ADOPT=1Track every project you open (pre-3.7 behavior), instead of only the ones you codevira init
CODEVIRA_AUTO_ADOPT=0Strict — un-init'd projects refuse without a hint (default is a friendly hint)

Enforcement engine

VariableEffect
CODEVIRA_ENGINE=0Kill switch — disable all hooks/policies for this session
CODEVIRA_DECISION_LOCK_MODEoff / warn / block (default block)
CODEVIRA_DECISION_LOCK_CONTENT_AWARE=0Restore strict file-level locking (default is content-aware)
CODEVIRA_BLAST_RADIUS_MODE / _THRESHOLDTune the blast-radius veto (default block, threshold 5)

Opt-in read-side smarts 3.5

VariableEffect
CODEVIRA_SYNONYM_WIDENING=1Widen queries via a curated synonym map (e.g. database → postgres)

Troubleshooting

Start with codevira doctor — every ⚠ / ✗ ships the exact fix command.

SymptomFix
Codevira tools don't show up in the AI toolRe-run codevira setup, then fully restart the IDE. codevira doctor includes a Claude Code MCP-visibility check.
Agent reads memory from the wrong projectcodevira doctor shows which project the server bound to and why. Claude Code and Antigravity entries are pinned to one project; Cursor's single entry resolves from the client's workspace roots. A bare codevira entry next to project-pinned ones can win and bind the wrong project: doctor flags it.
“0 decisions” / empty resultsDecisions are keyword-searched (FTS5/BM25). Query the rarest distinct keyword; search_decisions is not semantic by default.
Stale code graph after editsThe live watcher + git post-commit hook normally keep it fresh; run codevira index to force a rebuild.
A tool call returns codevira_upgradedCodevira was upgraded while that AI tool's server kept running. Restart the AI tool; nothing was read or written. The shared daemon restarts itself.
codevira projects lists worktrees or leftovers4.3 removes cache-only leftovers on its first start and collects worktree caches by itself afterwards; the removed list is in ~/.codevira/logs/prune-<time>.json.
Starting freshcodevira reset (auto-exports decisions first) or codevira uninstall to reverse every system write.
3.7.1 Upgrading is automatic. Codevira migrates your memory on the first server start after an upgrade — no manual steps, and your existing decisions stay put. If an IDE then shows the wrong project, doesn't show codevira at all, or memory looks missing, it's almost always a stale IDE-config entry, not lost data. Two fixes cover most cases: (1) remove a stray or temporary codevira entry with codevira untrack <path> (or sweep dead ones with codevira prune --ghosts); (2) run codevira doctor, which names the bound project and ships the exact fix for each ⚠ / ✗. Full guides: IDE config hygiene and Antigravity.

Still stuck? See the FAQ or open an issue.