Code Intelligence
LSP-based code navigation, search, symbols, and diagnostics
Code Intelligence
Knowns includes LSP-based code intelligence so agents can navigate real code — go to definition, find references, rename symbols, and get diagnostics — all accessible via MCP.
What It Provides
- LSP-based code navigation for supported languages
- Go to definition, find references, find implementations
- Symbol search across workspace
- Rename symbol across codebase
- Diagnostics (compile errors/warnings)
- Code-aware MCP tools for structured agent retrieval
- Auto-detection of project languages and LSP server management
This feature is opt-in. If you don't enable LSP, your existing task/doc/memory workflows keep working normally.
LSP Management
# Show supported languages and their status
knowns lsp list
# Download and install an LSP server
knowns lsp install typescript
knowns lsp install go
knowns lsp install python
# Remove old LSP server versions
knowns lsp cleanup
Knowns auto-detects project languages and checks for LSP binaries. If a binary is missing, knowns lsp list shows install guidance.
Supported Languages
| Language | LSP Server | Auto-detected |
|---|---|---|
| TypeScript/JavaScript | typescript-language-server | yes |
| Go | gopls | yes |
| Python | pylsp | yes |
| Rust | rust-analyzer | yes |
| Ruby | solargraph | yes |
| PHP | intelephense | yes |
| Java | jdtls | yes |
| SCSS | vscode-css-languageserver | yes |
MCP Code Tools
Agents access code intelligence through the MCP code tool:
// List symbols in a file
code({ action: "symbols", path: "src/auth/middleware.ts" })
// Search symbols by name pattern
code({ action: "find", query: "handleAuth" })
// Go to definition
code({ action: "definition", query: "validateToken", path: "src/auth/" })
// Find all references
code({ action: "references", query: "UserService", path: "src/services/user.ts" })
// Find implementations of interface
code({ action: "implementations", query: "AuthProvider", path: "src/auth/" })
// Get diagnostics (errors/warnings)
code({ action: "diagnostics", path: "src/auth/middleware.ts" })
// Rename symbol across workspace
code({ action: "rename", query: "oldName", path: "src/utils.ts" })
// Replace content with regex/literal
code({ action: "replace", path: "src/config.ts" })
// Replace entire symbol body
code({ action: "replace_body", path: "src/auth/middleware.ts" })
// Insert code before/after a symbol
code({ action: "insert", path: "src/models/user.ts" })
// Safe delete with reference check
code({ action: "delete", path: "src/deprecated.ts" })
Configuration
Enable LSP in .knowns/config.json:
{
"settings": {
"lsp": {
"enabled": true
}
}
}
Or via CLI:
knowns config set lsp true
knowns config set lsp.go true # Enable for specific language
Related
- MCP Integration - structured tools for code-aware agent workflows
- Web UI - workspace switching and richer chat UI
- Semantic Search - search and retrieval behavior across docs, tasks, and memory
Code Intelligence
Knowns bao gồm LSP-based code intelligence để agents có thể navigate code thực — go to definition, find references, rename symbols, và diagnostics — tất cả truy cập qua MCP.
Cung cấp gì
- LSP-based code navigation cho các ngôn ngữ được hỗ trợ
- Go to definition, find references, find implementations
- Symbol search across workspace
- Rename symbol across codebase
- Diagnostics (compile errors/warnings)
- Code-aware MCP tools cho structured agent retrieval
- Auto-detection ngôn ngữ project và quản lý LSP server
Tính năng này là opt-in. Nếu bạn không bật LSP, các task/doc/memory workflows hiện tại vẫn hoạt động bình thường.
LSP Management
# Hiển thị languages và status
knowns lsp list
# Download và install LSP server
knowns lsp install typescript
knowns lsp install go
knowns lsp install python
# Xóa LSP server versions cũ
knowns lsp cleanup
Knowns auto-detect ngôn ngữ project và kiểm tra LSP binaries. Nếu binary thiếu, knowns lsp list hiển thị hướng dẫn cài đặt.
Ngôn ngữ hỗ trợ
| Ngôn ngữ | LSP Server | Auto-detected |
|---|---|---|
| TypeScript/JavaScript | typescript-language-server | yes |
| Go | gopls | yes |
| Python | pylsp | yes |
| Rust | rust-analyzer | yes |
| Ruby | solargraph | yes |
| PHP | intelephense | yes |
| Java | jdtls | yes |
| SCSS | vscode-css-languageserver | yes |
MCP Code Tools
Agents truy cập code intelligence qua MCP code tool:
// List symbols trong file
code({ action: "symbols", path: "src/auth/middleware.ts" })
// Search symbols theo name pattern
code({ action: "find", query: "handleAuth" })
// Go to definition
code({ action: "definition", query: "validateToken", path: "src/auth/" })
// Find all references
code({ action: "references", query: "UserService", path: "src/services/user.ts" })
// Find implementations of interface
code({ action: "implementations", query: "AuthProvider", path: "src/auth/" })
// Get diagnostics (errors/warnings)
code({ action: "diagnostics", path: "src/auth/middleware.ts" })
// Rename symbol across workspace
code({ action: "rename", query: "oldName", path: "src/utils.ts" })
// Replace content với regex/literal
code({ action: "replace", path: "src/config.ts" })
// Replace entire symbol body
code({ action: "replace_body", path: "src/auth/middleware.ts" })
// Insert code before/after symbol
code({ action: "insert", path: "src/models/user.ts" })
// Safe delete với reference check
code({ action: "delete", path: "src/deprecated.ts" })
Cấu hình
Bật LSP trong .knowns/config.json:
{
"settings": {
"lsp": {
"enabled": true
}
}
}
Hoặc qua CLI:
knowns config set lsp true
knowns config set lsp.go true # Bật cho ngôn ngữ cụ thể
Liên quan
- MCP Integration - structured tools cho code-aware agent workflows
- Web UI - workspace switching và richer chat UI
- Semantic Search - search và retrieval across docs, tasks, và memory