<!-- Markdown mirror. Canonical: https://empryo.com/docs/concepts/intelligence -->

# Code intelligence

> How the agent finds definitions, references and type errors with your language servers, falls back to parsing when none is available, and checks every edit.

Empryo gives the agent the same code intelligence your editor has: go to definition, find references, rename, type information and error checking. The agent looks things up by symbol instead of grepping through whole files, which is cheaper and more accurate.

There is nothing to configure. Empryo picks the best available method for each request.

## What the agent can ask

| Question | Example |
|----------|---------|
| **Where is it defined?** | "where is `parseConfig` defined?" |
| **Who uses it?** | "who calls `parseConfig`?" |
| **Rename it everywhere** | "rename `useChat` to `useConversation` everywhere" |
| **What type is it?** | "what's the return type of `fetchUser`?" |
| **Any errors?** | "any errors in this file?" |
| **What does it call?** | "what does `buildTools` call?" |

The agent answers these with the `navigate` and `analyze` tools.

## How it finds answers

Empryo tries the most precise method first and falls back when it isn't available:

1. **Language server (LSP).** Exact types, workspace-wide rename and diagnostics.
2. **Parsing the code.** Outlines, imports and symbol lookups across many languages, plus deeper structure for TypeScript and JavaScript.
3. **Text search.** A last resort that works on any file.

If no language server is running for your language, the agent still works. The fallbacks cover most questions.

## Language servers without the editor

The agent can use language servers even when the editor is closed. In the terminal UI, when you open the embedded Neovim editor (`Ctrl+E`), requests go through the servers Neovim already runs. When it's closed, Empryo starts the servers itself.

See which servers are attached:

```
/lsp status
```

Install more servers from the Mason registry:

```
/lsp install
```

See [LSP](/docs/tools/lsp) for more.

## Checks after every edit

Empryo records the errors in a file before an edit and compares them afterwards. The agent is told:

- which errors it just introduced,
- which errors it just fixed,
- which errors appeared in other files because of the edit.

This lets the agent fix its own mistakes right away, without running a full typecheck after every change.
