CortexDB Docs
Features

Code Intelligence Plane

Index a repository into CortexDB and retrieve task-scoped, cited code context.

The Code Intelligence Plane indexes a code repository into CortexDB and answers "what code is relevant to this task?" with cited snippets — each pinned to repo:path@commit#Lx-Ly. It's a separate surface from the memory layers, gated behind a flag and its own /v1/code/* routes.

Off by default; enable with CORTEX_CODE_PLANE=1

The code plane is disabled unless CORTEX_CODE_PLANE=1 is set. With the flag off, every /v1/code/* route returns 503 CODE_PLANE_DISABLED. The ~21 /v1/code/* routes are not in /v1/openapi.json — they're a separate surface. (There is no /v1/code/health route — a 404 there means "no such route", not "disabled".)

Enable and mount a repository

The server can only index paths it can read, so mount the repo into the container:

docker run -d --name cortexdb \
  -p 127.0.0.1:3141:3141 \
  -v cortexdb-data:/data \
  -v /host/path/to/myrepo:/repos/myrepo:ro \
  -e CORTEX_CODE_PLANE=1 \
  -e OPENAI_API_KEY=$OPENAI_API_KEY \
  cortexdb/cortexdb:latest

Register a repository

curl -X POST http://localhost:3141/v1/code/repos \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "X-Cortex-Actor: $CORTEX_ACTOR" \
  -H "Content-Type: application/json" \
  -d '{ "name": "myrepo", "path": "/repos/myrepo" }'

Returns 201 with parse statistics (files parsed, symbols extracted). The path is the in-container path you mounted, not a host path.

Retrieve task-scoped context

curl -X POST http://localhost:3141/v1/code/context \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "X-Cortex-Actor: $CORTEX_ACTOR" \
  -H "Content-Type: application/json" \
  -d '{
    "repo": "myrepo",
    "task": "where is the recall pack assembled?",
    "token_budget": 4000
  }'

The response is a set of cited snippets, each identified as repo:path@commit#Lx-Ly, with a reason code explaining why it was selected. Feed that context straight into a coding agent's prompt.

The CLI

The cortexdb CLI wraps the plane under cortexdb code:

cortexdb code repos                # list registered repos
cortexdb code import <name> <path> # register + index
cortexdb code context <name> "task description"

Run cortexdb code --help for the full set (repos, imports, bundles, GC).

What the plane stores

Registering a repo parses it into symbols and indexes them alongside CortexDB's other indexes in the same data directory — so a cold backup covers the code plane too. The snippets are content-addressed by commit hash, so a context result always points at an exact revision.

On this page