Docs

CLI & API

codiluce start is all most people need. The other commands give you each step on its own, for scripts, CI or a shared server.

Commands

CommandWhat it does
start [PATH]Detect, index, serve and open the map. PATH defaults to the current directory. The first start asks the setup questions.
setup [PATH]Ask the setup questions again: history depth, API keys, describing the code, connecting agents.
initDetect applications and write the configuration. Keeps an existing configuration and graph.
indexAnalyze the repository into the graph. Reuses the cache for applications that did not change.
serveServe the API and the map for an existing index.
inspect …Query the graph from the terminal, as JSON: summary, entities, entity, relations, relation, diagnostics.
history indexIndex past commits of a branch into the history store.
history statusShow what history is indexed.
annotateDescribe the code with a language model, after a cost estimate.
mcpServe the index to your agent over MCP (stdio), and save what it explains for the map.

Run them as npx codiluce <command>, codiluce <command> after a global install, or npm run codiluce -- <command> from a source checkout.

Common options

OptionMeaning
--repo PATHThe repository. Defaults to the current directory.
--state-dir PATHWhere the analysis lives. Defaults to <repo>/.codiluce.
--port NServer port. start tries 4300 and then the next free one; 0 asks the system.
--no-openstart: print the URL instead of opening a browser.
--no-cacheAnalyze everything again instead of replaying unchanged applications.
--yesstart: ask no questions (saved settings, or defaults that spend nothing).
--history DEPTHstart: index this much history in the background this time: a number of commits, a Git date ("6 months ago"), all or none.
--history-indexingLet the map index commits on demand.
--read-onlyserve: refuse every write: on-demand history indexing (even with --history-indexing), and asking, renaming or deleting explanations.
--ui PATH | noneserve another build of the map, or only the API.

Step by step

npx codiluce init --repo /path/to/repository
npx codiluce index --repo /path/to/repository
npx codiluce inspect summary --repo /path/to/repository
npx codiluce serve --repo /path/to/repository --port 4300

index exits with 0 when no analyzer reported an error, 2 when parse or configuration errors were recorded (the graph is still written), and 1 for fatal failures. A failed run keeps the previous graph. Reindexing while serve runs is picked up within about 30 seconds, and the map offers a reload.

Inspect the graph

npx codiluce inspect entities --search /auth/login --type api_endpoint
npx codiluce inspect entities --type database_table
npx codiluce inspect diagnostics --code unresolved-http-call
npx codiluce inspect relations --id ID --direction outgoing --type handles

Lists are paginated (100 by default, 500 at most) and leave out evidence. Details of one entity or relation include all of its evidence. The graph is plain SQLite, so you can also query .codiluce/codiluce.db directly.

MCP server for agents

codiluce mcp serves the index to an agent over the Model Context Protocol, on stdio. Add it once, from the repository:

claude mcp add codiluce -- npx -y codiluce@latest mcp
codex mcp add codiluce -- npx -y codiluce@latest mcp

Its tools search the index and read entities, relationships, flows, impact, history and source, and save explanations for the map. See Explanations.

HTTP API

serve binds to loopback and opens the graph read-only. It only accepts GET, except for on-demand history indexing when you allow it and for explanations (asking the chat, renaming, deleting), which --read-onlyrefuses. Open /api for the full directory. The main routes:

GET /api/summary                         counts and diagnostics of the index
GET /api/entities?search=&type=          entity search (paginated)
GET /api/entities/:id/relations          relationships with evidence
GET /api/projection/flows?kind=page      every flow by entry point
GET /api/projection/impact/:id?depth=4   blast radius
GET /api/projection/steps/:id            what happens from here
GET /api/projection/coverage             coverage category of every file
GET /api/projection/families             data families
GET /api/history                         the timeline
GET /api/history/changes?snapshot=&compareTo=
GET /api/source?entity=ID                a bounded window of source
GET /api/explanations                    explanations, with what went stale
GET /api/explanations/entity/:id         the explanations that link an entity

Projection, source and detail routes accept snapshot=ID and compareTo=ID to read any indexed commit. Source is addressed by entity, evidence or finding, never by path, and is limited to 400 lines per request.