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

bash
# 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

LanguageLSP ServerAuto-detected
TypeScript/JavaScripttypescript-language-serveryes
Gogoplsyes
Pythonpylspyes
Rustrust-analyzeryes
Rubysolargraphyes
PHPintelephenseyes
Javajdtlsyes
SCSSvscode-css-languageserveryes

MCP Code Tools

Agents access code intelligence through the MCP code tool:

TypeScript
// 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:

JSON
{
  "settings": {
    "lsp": {
      "enabled": true
    }
  }
}

Or via CLI:

bash
knowns config set lsp true
knowns config set lsp.go true      # Enable for specific language
  • 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