> For the complete documentation index, see [llms.txt](https://kerno.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kerno.gitbook.io/docs/core-concepts/codebase-indexing.md).

# Codebase indexing

Most code tools that use LLMs rely on vector embeddings, which find relevant code by similarity. That is useful but approximate, and it does not reflect how your code is actually wired together.

**Kerno indexes deterministically**. It resolves symbols and cross-references straight from your source, so every function call, import, and variable reference gets a precise location that is reproducible across runs. The same index drives endpoint discovery and impact analysis.

Endpoint discovery is not pattern matching on filenames. Kerno reads each framework's routing constructs directly, so a route registered in a nested router group or behind a decorator is found the same way an obvious one is. See [Supported Technologies](/docs/references/supported-technologies.md) for the frameworks covered.

The index stays local. Relevant code excerpts are sent to LLM providers only when Kerno needs them to reason about a specific task. See [Security & Privacy](/docs/references/security-and-privacy.md).

```mermaid
   flowchart TD
       src["src/"]
       src --> routes["routes/"]
       src --> services["services/"]
       src --> models["models/"]

       routes --> userRouter["userRouter.ts"]
       services --> userService["userService.ts"]
       models --> userModel["userModel.ts"]

       userRouter --> createUser["POST /users"]
       userRouter --> getUser["GET /users/:id"]
       userService --> hashPassword["hashPassword()"]
       userService --> dbQuery["db.query()"]
       userModel --> emailField["email: string"]
       userModel --> idField["id: string"]

       classDef file stroke:#3b82f6,stroke-width:2px,fill:transparent
       classDef endpoint stroke:#f59e0b,stroke-width:2px,fill:transparent
       classDef symbol stroke:#10b981,stroke-width:2px,fill:transparent

       class userRouter,userService,userModel file
       class createUser,getUser endpoint
       class hashPassword,dbQuery,emailField,idField symbol
```

Directories, files, endpoints, and the symbols inside them are all nodes in one graph. Kerno traverses it in either direction: outward from a function to the endpoints that reach it, or inward from an endpoint to everything it touches.

### What the graph gives you

* **Deterministic blast-radius detection.** When you change code, Kerno knows which endpoints, scenarios, and dependencies are affected. It follows the call graph outward across your whole codebase, so a change to a shared helper surfaces every endpoint downstream of it.
* **No hallucinated context.** When Kerno asks an LLM to plan a scenario or update a baseline, it sends real code references rather than similarity matches.
* **Fast updates.** The graph updates incrementally, so a code change does not trigger a full re-index.

### What gets indexed

Kerno indexes the git-tracked source files in your project, including application code, configuration, and build files. Files that are not tracked by git (dependency directories, build outputs, anything in `.gitignore`) are skipped automatically.

A new file you just created is untracked until you stage or commit it, so stage or commit it before expecting Kerno to index and validate it.

In a monorepo, Kerno detects each application in the repository and indexes them into one graph that spans the whole repo.

### Index updates

Kerno indexes your codebase on first use. After that, your AI coding agent syncs the workspace after code changes, so Kerno always runs against the latest version of your code.

You can also trigger a sync yourself. Ask your coding agent to sync the workspace

{% code expandable="true" %}

```
Sync the Kerno workspace so it picks up my latest changes.
```

{% endcode %}

Kerno takes a fresh snapshot of your code and re-runs its analysis.
