Code Intelligence integrates Language Server Protocol (LSP) into Kiro CLI to enable semantic understanding of your codebase for the Kiro agent, similar to how extensions provide capabilities in your IDE. It comes pre-configured with 7 languages (TypeScript, Rust, Python, Go, Java, Ruby, C/C++) but can be expanded to any language by adding custom LSP configurations to the lsp.json file in your project root. After running /code init, you can search symbols, find references, navigate definitions, rename across files, and get diagnostics through natural language queries.
Kiro CLI spawns LSP server processes in the background that communicate via JSON-RPC over stdio. When you initialize a workspace, it detects languages from project markers (like package.json, Cargo.toml) and
file extensions, then starts the appropriate language servers. These servers continuously analyze your code and maintain an index of symbols, types, and references. When you make queries, Kiro translates your
natural language into LSP protocol requests, sends them to the relevant server, and formats the responses back into readable output.
Here's how you can enable Kiro CLI to use LSP servers:
Supported Languages
| Language | Extensions | Server | Install Command |
|---|---|---|---|
| TypeScript/JavaScript | .ts, .js, .tsx, .jsx | typescript-language-server | npm install -g typescript-language-server typescript |
| Rust | .rs | rust-analyzer | rustup component add rust-analyzer |
| Python | .py | jedi-language-server | npm install -g pyright or pip install pyright |
| Go | .go | gopls | go install golang.org/x/tools/gopls@latest |
| Java | .java | jdtls | brew install jdtls (macOS) |
| Ruby | .rb | solargraph | gem install solargraph |
| C/C++ | .c, .cpp, .h, .hpp | clangd | brew install llvm (macOS) or apt install clangd (Linux) |
Run this slash command in your project root:
/code init
This creates lsp.json configuration and starts language servers.
What you'll see:
✓ Workspace initialization started Workspace: /path/to/your/project Detected Languages: ["python", "rust", "typescript"] Project Markers: ["Cargo.toml", "package.json"] Available LSPs: ○ clangd (cpp) - available ○ gopls (go) - not installed ◐ jdtls (java) - initializing... ✓ jedi-language-server (python) - initialized (687ms) ✓ rust-analyzer (rust) - initialized (488ms) ○ solargraph (ruby) - not installed ✓ typescript-language-server (typescript) - initialized (214ms)
Status indicators:
Restart LSP servers: If language servers shut down or become unresponsive, use /code init -f.
Auto-initialization: After the first /code init, KIRO CLI automatically initializes code intelligence on startup when lsp.json exists in the workspace.
Disabling code intelligence: Delete lsp.json from your project root to disable. Re-enable anytime with /code init.
> Find the UserRepository class Searching for symbols matching: "UserRepository" 1. Class UserRepository at src/repositories/user.repository.ts:15:1
> Find references of Person class Finding all references at: auth.ts:42:10 1. src/auth.ts:42:10 - export function authenticate(...) 2. src/handlers/login.ts:15:5 - authenticate(credentials) 3. src/handlers/api.ts:89:12 - await authenticate(token) (3 more items found)
> Find the definition of UserService src/services/user.service.ts:42:1: export class UserService { ...
> What symbols are in auth.service.ts? Getting symbols from: auth.service.ts 1. Class AuthService at auth.service.ts:12:1 2. Function login at auth.service.ts:25:3 3. Function logout at auth.service.ts:45:3 4. Function validateToken at auth.service.ts:62:3
> Dry run: rename the method "FetchUser" to "fetchUserData" Dry run: Would rename 12 occurrences in 5 files
> Get diagnostics for main.ts 1. Error line 15:10: Cannot find name 'undefined_var' 2. Warning line 42:5: 'result' is declared but never used
Add custom language servers by editing lsp.json in your project root:
{ "languages": { "mylang": { "name": "my-language-server", "command": "my-lsp-binary", "args": ["--stdio"], "file_extensions": ["mylang", "ml"], "project_patterns": ["mylang.config"], "exclude_patterns": ["**/build/**"], "multi_workspace": false, "initialization_options": { "custom": "options" } } } }
Fields:
After editing, restart KIRO CLI to load the new configuration.
| Issue | Cause(s) | Solution |
|---|---|---|
| Workspace is still initializing | LSP servers are starting up | Wait and try again. If servers crashed, use /code init -f to restart. |
| LSP initialization failed | Check logs for details: /code logs -l | |
| No symbols found | Language server is still indexing or File has syntax errors or Symbol name doesn't match | Check file for errors, try broader search terms. |
| No definition found | Position doesn't point to a symbol. Solution: Verify the row and column numbers point to a symbol name. |
Code Intelligence