Loading image...Kiro
  • Docs
  • Downloads
  • Blog
  • Changelog
DOWNLOADS
Loading image...Kiro
Loading image...Kiro
Product
  • Documentation
  • Downloads
  • Blog
  • Changelog
© 2026 Amazon Web Services, Inc. or its affiliates. All rights reserved.
  1. Docs
  2. CLI
  3. Code Intelligence

Code Intelligence

On this page
  • Overview
  • How it works
  • Installing language servers
  • Initialize Code Intelligence
  • Using Language Servers
  • Example 1: Find a Symbol
  • Example 2: Find All References
  • Example 3: Go to Definition
  • Example 4: Get File Symbols
  • Example 5: Rename with Dry Run
  • Example 6: Get Diagnostics
  • Example 7: Get Hover Information
  • Example 8: Get Code Completions
  • Custom Language Servers
  • Troubleshooting
  • Best Practices
  • Limitations

Overview

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 .kiro/settings/lsp.json 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.

How it works

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:

  1. Install language servers
  2. Enable the LSP integration
  3. Ask code related questions to use language servers

Installing language servers

Supported Languages

LanguageExtensionsServerInstall Command
TypeScript/JavaScript.ts, .js, .tsx, .jsxtypescript-language-servernpm install -g typescript-language-server typescript
Rust.rsrust-analyzerrustup component add rust-analyzer
Python.pyjedi-language-servernpm install -g pyright or pip install pyright
Go.gogoplsgo install golang.org/x/tools/gopls@latest
Java.javajdtlsbrew install jdtls (macOS)
Ruby.rbsolargraphgem install solargraph
C/C++.c, .cpp, .h, .hppclangdbrew install llvm (macOS) or apt install clangd (Linux)

Initialize Code Intelligence

Workspace-scoped configuration

Code intelligence is configured per workspace, not globally. Each project maintains its own LSP settings independently.

Run this slash command in your project root:

/code init

This creates .kiro/settings/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:

  • ✓ - Initialized and ready
  • ◐ - Currently initializing
  • ○ available - Installed but not needed for detected languages
  • ○ not installed - Not installed on your system

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 .kiro/settings/lsp.json exists in the workspace.

Disabling code intelligence: Delete .kiro/settings/lsp.json from your project to disable. You must restart your session for this change to take effect. Re-enable anytime with /code init.

Using Language Servers

Language servers provide semantic code intelligence through natural language queries. You can search symbols, navigate definitions, find references, rename across files, get diagnostics, view method documentation, and discover available APIs on classes and objects.

Example 1: Find a Symbol

> Find the UserRepository class Searching for symbols matching: "UserRepository" 1. Class UserRepository at src/repositories/user.repository.ts:15:1

Example 2: Find All References

> 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)

Example 3: Go to Definition

> Find the definition of UserService src/services/user.service.ts:42:1: export class UserService { ...

Example 4: Get File Symbols

> 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

Example 5: Rename with Dry Run

> Dry run: rename the method "FetchUser" to "fetchUserData" Dry run: Would rename 12 occurrences in 5 files

Example 6: Get Diagnostics

> 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

Example 7: Get Hover Information

> What's the documentation for the authenticate method in AuthService? Type: (credentials: Credentials) => Promise<AuthResult> Documentation: Authenticates a user with the provided credentials. Returns an AuthResult containing the user token and profile. @param credentials - User login credentials @throws AuthenticationError if credentials are invalid

Example 8: Get Code Completions

> What methods are available on the s3Client instance? Available completions: 1. putObject - Function: (params: PutObjectRequest) => Promise<PutObjectOutput> 2. getObject - Function: (params: GetObjectRequest) => Promise<GetObjectOutput> 3. deleteObject - Function: (params: DeleteObjectRequest) => Promise<DeleteObjectOutput> 4. listObjects - Function: (params: ListObjectsRequest) => Promise<ListObjectsOutput> 5. headObject - Function: (params: HeadObjectRequest) => Promise<HeadObjectOutput>

Custom Language Servers

Add custom language servers by editing .kiro/settings/lsp.json in your project:

json
{ "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:

  • name: Display name for the language server
  • command: Binary/command to execute
  • args: Command line arguments (usually ["--stdio"])
  • file_extensions: File extensions this server handles
  • project_patterns: Files that indicate a project root (e.g., package.json)
  • exclude_patterns: Glob patterns to exclude from analysis
  • multi_workspace: Set to true if the LSP supports multiple workspace folders (default: false)
  • initialization_options: LSP-specific configuration passed during initialization
  • request_timeout_secs: Timeout in seconds for LSP requests. Default is 60.

After editing, restart KIRO CLI to load the new configuration.

Troubleshooting

IssueCause(s)Solution
Workspace is still initializingLSP servers are starting upWait and try again. If servers crashed, use /code init -f to restart.
LSP initialization failedCheck logs for details: /code logs -l
No symbols foundLanguage server is still indexing or File has syntax errors or Symbol name doesn't matchCheck file for errors, try broader search terms.
No definition foundPosition doesn't point to a symbol. Solution: Verify the row and column numbers point to a symbol name.

Best Practices

  1. Initialize once per project - Run /code init in project root
  2. Use exact positions - Row and column must point to the symbol
  3. Use dry_run for renames - Preview changes before applying
  4. Check diagnostics first - Syntax errors can prevent analysis
  5. Be specific in searches - "UserService" > "user"
  6. Ask for documentation naturally - "What does the login method do?" instead of specifying coordinates
  7. Discover APIs conversationally - "What methods does s3Client have?" to explore external library functionality

Limitations

  1. LSP feature support varies by language server - not all servers support every operation (e.g., some may not support rename or formatting)
  2. Large codebases may have slow initial indexing
Page updated: December 18, 2025
Auto complete
Billing for individuals