Serena-Go - LSP-Powered Code Intelligence
Helix integrates with serena-go — a high-performance LSP (Language Server Protocol) based code analysis engine written in Go, providing deep code understanding capabilities for your programming assistant.
serena-go is a standalone project that AI Agent uses for LSP-powered code intelligence. It's a complete rewrite of the original Python Serena with better performance and simpler deployment.
✨ Core Features
🔍 Symbol-Level Code Navigation
- Precise Search: Quickly locate classes, functions, and variable definitions
- Reference Tracking: Find all usages of code across the project
- Type Navigation: Jump to type definitions with one click
- Hierarchy Analysis: Understand inheritance and call relationships
📝 Intelligent Code Editing
- Symbol-Level Modifications: Precisely replace function implementations without affecting surrounding code
- Structure Awareness: Understand code structure to avoid syntax errors
- Batch Refactoring: Smart symbol renaming with automatic reference updates
- Context Completion: Intelligent suggestions based on project context
📊 Project-Level Understanding
- Architecture Insights: Quickly grasp overall project structure
- Dependency Analysis: Understand inter-module dependencies
- Monorepo Support: Automatic sub-project recognition
- Cross-File Analysis: Understand code relationships across files
🚀 Technical Advantages
30+ Programming Language Support
serena-go supports mainstream programming languages through LSP:
| Priority | Languages |
|---|---|
| Tier 1 | Go, Python, TypeScript/JavaScript, Rust, Dart |
| Tier 2 | Java, C/C++, C#, Ruby, PHP |
| Tier 3 | Kotlin, Scala, Swift, Lua, Zig, Elixir, Haskell, Vue, Svelte, etc. |
How it works: Reuses mature language server ecosystems (gopls, pyright, typescript-language-server, etc.) without reinventing the wheel.
Multi-Project Parallel Processing
- ✅ Analyze multiple projects simultaneously: Seamlessly switch between codebases
- ✅ Monorepo auto-detection: Automatically discover and activate sub-projects
- ✅ Independent LSP instances: Each project analyzed independently without interference
High-Performance Architecture
- ⚡ Native Go implementation: High performance, low memory footprint
- 💾 Smart caching: Results cached after first analysis, sub-second subsequent queries
- 🔄 Incremental updates: Only update affected parts when files change
💡 Use Cases
1. Code Exploration
"Where are the main entry points in this project?"
"List all API route definitions"
"Find all methods in the UserService class"
2. Code Modification
"Rename getUserInfo function to fetchUserDetails"
"Replace the implementation logic of calculatePrice function"
"Add a new method to the User class"
3. Code Understanding
"Explain how the processPayment function works"
"Where is this variable used?"
"Show the inheritance hierarchy of the Database class"
4. Refactoring Assistance
"Find all calls to deprecated_function"
"Analyze dependencies of this module"
"Check for unused imports"
🎯 Using with AI Agent
Desktop Application (Recommended)
serena-go is built into the desktop application, ready to use out of the box:
- Open Workspace: Select project folder
- Auto Activation: serena-go automatically analyzes project structure
- Start Chatting: Directly ask code-related questions
Status Indicators:
- 🟢 Green: serena-go ready
- 🟡 Yellow: Analyzing project
- 🔴 Red: Language server installation needed
Server Mode
When running AI Agent backend service, serena-go starts automatically with workspace:
# Start AI Agent
./agentbackend --data-dir ~/.aiagent
# serena-go starts automatically with workspace
# No additional configuration needed
🔧 Language Servers
serena-go requires corresponding LSP servers to analyze specific languages. Below is a comprehensive list of supported language servers with installation instructions.
Mainstream Languages
| Language | LSP Server | Installation | Homepage |
|---|---|---|---|
| Go | gopls | go install golang.org/x/tools/gopls@latest | gopls.dev |
| Python | pyright | npm install -g pyright | pyright |
| Python | pylsp (alternative) | pip install python-lsp-server | pylsp |
| TypeScript/JavaScript | typescript-language-server | npm install -g typescript-language-server typescript | ts-ls |
| Rust | rust-analyzer | rustup component add rust-analyzer | rust-analyzer |
| Java | jdtls | Download Eclipse JDT LS | jdtls |
| C/C++ | clangd | brew install llvm (macOS) or Download | clangd |
| C# | csharp-ls | dotnet tool install --global csharp-ls | csharp-ls |
| C# | OmniSharp (alternative) | Download | OmniSharp |
Web & Frontend
| Language | LSP Server | Installation | Homepage |
|---|---|---|---|
| HTML | vscode-html-languageserver | npm install -g vscode-langservers-extracted | vscode-html |
| CSS/SCSS | vscode-css-languageserver | npm install -g vscode-langservers-extracted | vscode-css |
| JSON | vscode-json-languageserver | npm install -g vscode-langservers-extracted | vscode-json |
| Vue | volar | npm install -g @vue/language-server | Volar |
| Svelte | svelte-language-server | npm install -g svelte-language-server | svelte-ls |
Mobile & Cross-Platform
| Language | LSP Server | Installation | Homepage |
|---|---|---|---|
| Dart/Flutter | dart | Included with Dart SDK | Dart |
| Kotlin | kotlin-language-server | Download | kotlin-ls |
| Swift | sourcekit-lsp | Included with Xcode or Swift Toolchain | sourcekit-lsp |
Systems & Low-Level
| Language | LSP Server | Installation | Homepage |
|---|---|---|---|
| Zig | zls | brew install zls (macOS) or Build from source | zls |
| Haskell | haskell-language-server | ghcup install hls | hls |
| OCaml | ocaml-lsp | opam install ocaml-lsp-server | ocaml-lsp |
| Elixir | elixir-ls | Download | elixir-ls |
Scripting & Dynamic Languages
| Language | LSP Server | Installation | Homepage |
|---|---|---|---|
| Ruby | solargraph | gem install solargraph | solargraph |
| PHP | intelephense | npm install -g intelephense | intelephense |
| Lua | lua- install lua-language-server` (macOS) | lua-ls | |
| Perl | perlnavigator | npm install -g perlnavigator-server | perlnavigator |
| Bash | bash-language-server | npm install -g bash-language-server | bash-ls |
Configuration & Markup
| Language | LSP Server | Installation | Homepage |
|---|---|---|---|
| YAML | yaml-language-server | npm install -g yaml-language-server | yaml-ls |
| TOML | taplo | cargo install taplo-cli --features lsp | taplo |
| Markdown | marksman | Download | marksman |
| LaTeX | texlab | cargo install texlab | texlab |
Data & Query Languages
| Language | LSP Server | Installation | Homepage |
|---|---|---|---|
| SQL | sqls | go install github.com/lighttiger2505/sqls@latest | sqls |
| GraphQL | graphql-language-service | npm install -g graphql-language-service-cli | graphql-ls |
Installation Tips
macOS
# Install via Homebrew (recommended)
brew install llvm # For clangd (C/C++)
brew install lua-language-server
brew install zls # For Zig
# Install via npm (Node.js required)
npm install -g typescript-language-server typescript
npm install -g pyright
npm install -g vscode-langservers-extracted # HTML, CSS, JSON
npm install -g yaml-language-server
npm install -g bash-language-server
npm install -g intelephense
npm install -g svelte-language-server
npm install -g @vue/language-server
# Install via language-specific package managers
go install golang.org/x/tools/gopls@latest
cargo install taplo-cli --features lsp
pip install python-lsp-server
gem install solargraph
Linux (Ubuntu/Debian)
# Install system packages
sudo apt install clangd # C/C++
# Install via npm
npm install -g typescript-language-server typescript
npm install -g pyright
npm install -g vscode-langservers-extracted
npm install -g yaml-language-server
npm install -g bash-language-server
# Install via snap
sudo snap install rust-analyzer --beta
# Language-specific
go install golang.org/x/tools/gopls@latest
pip install python-lsp-server
gem install solargraph
Windows
# Install via Scoop (recommended)
scoop install llvm # For clangd
scoop install lua-language-server
# Install via npm
npm install -g typescript-language-server typescript
npm install -g pyright
npm install -g vscode-langservers-extracted
npm install -g yaml-language-server
npm install -g bash-language-server
# Install via Chocolatey
choco install rust-analyzer
# Language-specific
go install golang.org/x/tools/gopls@latest
pip install python-lsp-server
Verification
After installation, verify language servers are available:
# Check if language server is in PATH
which gopls # Go
which pyright # Python
which typescript-language-server # TypeScript
which rust-analyzer # Rust
which clangd # C/C++
# Test language server
gopls version
pyright --version
typescript-language-server --version
Configuration
Most language servers work out-of-the-box with serena-go. For advanced configuration:
Go (gopls)
// .gopls.json
{
"ui.diagnostic.analyses": {
"unusedparams": true,
"shadow": true
},
"ui.completion.usePlaceholders": true
}
Python (pyright)
// pyrightconfig.json
{
"typeCheckingMode": "basic",
"reportMissingImports": true,
"reportMissingTypeStubs": false
}
TypeScript
// tsconfig.json (in project root)
{
"compilerOptions": {
"strict": true,
"esModuleInterop": true
}
}
C/C++ (clangd)
# .clangd
CompileFlags:
Add: [-std=c++17, -Wall]
Remove: [-W*]
Helix will detect when a language server is missing and prompt you with installation instructions. You can also configure automatic installation in Settings → Language Servers → Auto-install.
Some language servers require project-specific files to work properly:
- Go:
go.modfile - TypeScript:
tsconfig.jsonorpackage.json - Python:
pyproject.toml,setup.py, orrequirements.txt - Rust:
Cargo.toml - Java:
pom.xmlorbuild.gradle - C/C++:
compile_commands.jsonor.clangd
serena-go will automatically detect these files and configure language servers accordingly.
📈 Performance Characteristics
Initial Analysis
- Small projects (< 100 files): < 5 seconds
- Medium projects (100-1000 files): 5-30 seconds
- Large projects (> 1000 files): 30-60 seconds
Subsequent Operations
- Symbol lookup: < 100ms
- Reference search: < 500ms
- Code navigation: instant
Resource Usage
- Memory: 50-200MB per project
- CPU: Peak < 50% during analysis, < 5% when idle
🆚 Comparison with Traditional Methods
| Feature | serena-go (LSP) | Traditional Text Analysis |
|---|---|---|
| Precision | 🟢 Semantic understanding | 🔴 Regex matching |
| Refactoring Safety | 🟢 Auto-update references | 🔴 Manual find/replace |
| Cross-File Analysis | 🟢 Native support | 🟡 Partial support |
| Language Support | 🟢 30+ languages | 🟡 Limited |
| Performance | 🟢 Cache optimized | 🟡 Re-scan each time |
💬 Real-World Examples
Example 1: Quick Familiarization with New Project
👤 "What does this project do? What are the main modules?"
🤖 [Using serena-go to analyze]
- Entry file found: cmd/main.go
- Core packages identified: pkg/api, pkg/database, pkg/service
- API endpoints listed: 12 REST interfaces
- Data models: 5 main entities
Example 2: Safe Refactoring
👤 "Rename GetUser to FetchUser, update all calls"
🤖 [Using serena-go to execute]
✅ Function definition renamed
✅ 23 call sites updated
✅ 5 test files updated
✅ Type safety maintained
Example 3: Understanding Complex Logic
👤 "Explain the workflow of processOrder function"
🤖 [Using serena-go to analyze]
1. Read function implementation → understand control flow
2. Trace called sub-functions → build call graph
3. Analyze data flow → understand state changes
4. Generate natural language explanation
🔮 Future Features
- 🚧 Real-time Error Detection: Instant feedback while editing
- 🚧 Intelligent Completion: Context-aware code suggestions
- 🚧 Test Generation: Auto-generate tests from function signatures
- 🚧 Documentation Generation: Extract comments to generate docs
🔗 Related Resources
- Architecture Overview - Learn how serena-go integrates with AI Agent
- Skills System - Create custom skills using serena-go
- API Reference - Detailed serena-go tool API documentation
Note: serena-go is AI Agent's built-in MCP server, no additional installation required. Through LSP protocol, it enables AI to truly "understand" your code, not just process text.