How To Install and Configure Serena MCP For Ubuntu Linux: The Complete Technical Guide
Transform your Ubuntu Linux development environment with Serena MCP, a powerful coding agent toolkit that brings IDE-like semantic capabilities to your LLM workflows. This comprehensive guide walks you through installation, configuration, and optimization for maximum productivity.
Executive Overview
Serena MCP leverages the Model Context Protocol to provide symbolic code understanding through language servers, enabling LLMs to navigate and edit codebases with unprecedented precision. Unlike traditional text-based approaches, Serena's semantic retrieval capabilities deliver superior performance in complex enterprise environments.
Understanding Serena MCP Architecture
Before diving into installation, understanding Serena's architecture helps contextualize its transformative capabilities for development workflows on Ubuntu systems. Serena represents a paradigm shift in how AI coding assistants interact with source code.
Traditional coding assistants rely on text-based pattern matching or retrieval-augmented generation (RAG) systems that treat code as unstructured text. Serena takes a fundamentally different approach by integrating with Language Server Protocol (LSP) implementations, the same technology that powers intelligent features in modern IDEs like Visual Studio Code and JetBrains products.
This LSP integration enables Serena to understand code at the symbol level, comprehending relationships between functions, classes, types, and references across your entire codebase. When combined with LLMs through the Model Context Protocol, this creates a powerful agent capable of surgical code modifications without requiring complete file reads or context-expensive grep operations.
Key Architectural Components
- MCP Server Layer: Handles communication between LLM clients and Serena's core functionality via stdio or HTTP-based SSE transport protocols
- Solid-LSP Framework: Serena's enhanced language server wrapper providing synchronous LSP calls and symbolic code analysis capabilities
- Tool Execution Engine: Extensible system providing semantic operations including find_symbol, find_referencing_symbols, and insert_after_symbol
- Project Memory System: Persistent knowledge storage in .serena/memories/ enabling context retention across sessions
System Requirements and Prerequisites
Successful Serena MCP deployment on Ubuntu requires specific system dependencies and configurations. Meeting these prerequisites ensures optimal performance and prevents common installation issues.
Minimum System Specifications
Operating System:
- Ubuntu 20.04 LTS or later (22.04 LTS recommended)
- Debian-based distributions with equivalent package availability
- 4GB RAM minimum (8GB+ recommended for large codebases)
- 2GB free disk space for installation and language server caches
Required Software Dependencies:
- Python 3.10 or later
- Git version control system
- UV package installer (Astral's modern Python packaging tool)
- Language-specific dependencies based on your development stack
Installing UV Package Manager
UV serves as Serena's primary dependency manager, replacing traditional pip-based workflows with significantly faster installation and more reliable dependency resolution. The UV project represents a modern approach to Python tooling, built in Rust for exceptional performance.
curl -LsSf https://astral.sh/uv/install.sh | sh
After installation, reload your shell configuration to ensure UV is available in your PATH:
source ~/.bashrc
Verify successful installation by checking the UV version:
uv --version
Installation Methods: Choosing Your Approach
Serena MCP offers multiple installation pathways optimized for different use cases. Understanding each method's tradeoffs helps you select the optimal approach for your Ubuntu development environment.
Method 1: Direct Execution with UVX (Recommended for Quick Start)
The UVX approach provides the fastest path to running Serena without local installation overhead. This method automatically fetches the latest version from the GitHub repository and executes it in an isolated environment, making it ideal for evaluation and testing scenarios.
Advantage: Zero configuration, always runs latest version, no local repository management required
Note: If the LLM fails to complete onboarding or doesn't write memories to disk, explicitly instruct it to "complete the onboarding and save all memories"
Review generated memories after onboarding to ensure accuracy and completeness. Edit or augment memories as needed to reflect project-specific nuances that automated analysis might miss.
Memory Management Best Practices
Every file in .serena/memories/
constitutes a memory that Serena can reference. The memory list appears in tool descriptions, allowing the LLM to selectively load relevant memories based on task requirements.
Effective memory strategies include:
- Architecture Overviews: High-level system design, module relationships, and design pattern applications
- Development Workflows: Build commands, test execution procedures, deployment processes
- Coding Conventions: Style guidelines, naming patterns, documentation requirements
- Task Continuations: Progress summaries for long-running tasks spanning multiple conversations
- Known Issues: Documented gotchas, workarounds, and technical debt locations
For complex multi-session tasks, use Serena's summary tool to create task-specific memories. When approaching context limits, request: "Create a summary memory for continuing this task in a new conversation." The next session can then load this memory and resume seamlessly.
Monitoring and Debugging with Dashboard Tools
Serena provides comprehensive observability through its web dashboard and optional GUI tool. These interfaces prove invaluable for monitoring tool execution, debugging integration issues, and managing server lifecycle.
Web Dashboard Configuration
The web dashboard launches automatically by default, providing real-time visibility into Serena's operations. Access the dashboard at http://localhost:24282/dashboard/index.html
(port may increment if 24282 is occupied).
Dashboard features include:
- Real-time Log Streaming: Complete visibility into tool invocations, language server communications, and error conditions
-
Usage Statistics: Tool execution metrics and performance analytics (enable with
record_tool_usage_stats: true
in config) - Manual Shutdown Control: Essential for terminating orphaned server processes when clients fail cleanup
Configure dashboard behavior in ~/.serena/serena_config.yml
:
dashboard:
enabled: true
auto_open: true
port: 24282
record_tool_usage_stats: true
Optional GUI Tool (Primarily Windows)
The desktop GUI tool provides similar functionality to the web dashboard with native application advantages. However, it's primarily designed for Windows with limited Linux support and no macOS compatibility.
Enable GUI tool in configuration:
gui_tool:
enabled: true
auto_open: true
For Ubuntu deployments, the web dashboard typically provides superior reliability and cross-platform consistency.
Production Deployment Best Practices
Successfully deploying Serena in enterprise Ubuntu environments requires attention to security, performance, and maintainability considerations beyond basic installation.
Security Hardening Strategies
The execute_shell_command
tool enables arbitrary code execution, presenting security implications in multi-user environments or when processing untrusted code. Implement appropriate safeguards based on your threat model.
Critical Security Considerations:
- • MCP clients typically request user approval before tool execution - verify this behavior in your client
- • Docker deployment provides strong isolation boundaries for untrusted workloads
- • Review shell command parameters carefully before approval in production systems
- • Consider disabling shell execution entirely for read-only analysis workflows
Enable read-only mode for pure analysis scenarios by adding to .serena/project.yml
:
read_only: true
This automatically disables all editing tools and shell execution while preserving full semantic code analysis capabilities.
Version Control Integration
Serena performs optimally when operating from clean Git states. This enables the LLM to review changes via git diff
, facilitating self-correction and iterative refinement.
Ubuntu Git configuration recommendations:
# Prevent line ending issues on Ubuntu
git config --global core.autocrlf input
# Configure useful diff settings
git config --global diff.algorithm histogram
Establish pre-task checkpoints with descriptive commit messages. This practice enables easy rollback if Serena's modifications require adjustment or if context window exhaustion necessitates conversation restart.
Performance Optimization Techniques
Large codebases present performance challenges addressed through several optimization strategies:
-
Pre-index projects during setup
Execute
serena project index
after initial activation to eliminate first-tool latency -
Configure ignore patterns
Exclude build artifacts, dependencies, and generated code in
.serena/project.yml
to reduce analysis overhead -
Leverage type annotations
Dynamic languages benefit significantly from type hints (Python type annotations, JSDoc comments) for improved language server analysis
-
Maintain modular code structure
Serena excels with well-structured codebases featuring clear symbol boundaries. Avoid monolithic functions and God classes
Effective Prompting Strategies
Extracting maximum value from Serena requires understanding how to effectively communicate with the LLM about code operations. These strategies improve results across all clients:
Start with Planning Sessions
For complex tasks, dedicate initial conversations to analysis and planning before implementation. Switch to editing mode in fresh conversations with planning memories loaded.
Instruct Context Efficiency
Explicitly request: "Use Serena's symbolic tools efficiently - only read symbol bodies when necessary for the task." This prevents unnecessary context consumption.
Leverage Test-Driven Workflows
Codebases with comprehensive test suites enable Serena to validate modifications autonomously. Request: "Run tests after each change and iterate until passing."
Monitor Progress Alignment
For long tasks, periodically ask: "Review current progress against original requirements and summarize remaining work." This prevents scope drift.
Create Continuation Memories
When approaching context limits: "Create a detailed memory documenting current progress, technical decisions, and next steps for continuing this task."
Troubleshooting Common Issues
Despite Serena's robust architecture, certain scenarios require troubleshooting. This section addresses frequently encountered issues on Ubuntu systems.
Language Server Initialization Failures
Symptom: Tools fail with "language server not initialized" or similar errors
Solutions:
- • Verify language-specific dependencies installed (gopls for Go, rust-analyzer for Rust, etc.)
- • Check dashboard logs for language server error messages
-
•
Manually restart language server: instruct LLM to use
restart_language_server
tool - • Ensure project files contain valid syntax - language servers may fail on malformed code
Tool Permission Denied Errors
Symptom: Shell commands or file operations fail with permission errors
Solutions:
- • Verify MCP server runs with appropriate user permissions for project access
-
•
Check file ownership and permissions in project directory:
ls -la
- • For Docker deployments, ensure volume mounts specify correct permissions
- • Avoid running Serena as root - use appropriate user accounts with necessary project access
Client Connection Issues
Symptom: MCP client fails to discover Serena tools or shows connection errors
Solutions:
- • Verify absolute paths in client configuration - avoid relative paths and shell expansions
-
•
Check UV installation location:
which uv
orwhich uvx
- • Restart client application after configuration changes
- • Review client logs for MCP server startup errors
- • Test server startup manually to verify command correctness
Orphaned Server Processes
Symptom: Multiple Serena processes persist after client shutdown, consuming resources
Solutions:
- • Use dashboard's shutdown button for clean termination
-
•
Manually identify and terminate:
ps aux | grep serena
thenkill [PID]
- • Report persistent issues to client developers - proper subprocess cleanup is client responsibility
Serena in the Enterprise MSP Context
For managed IT service providers like ITECS, Serena MCP represents a strategic capability enhancement that addresses critical enterprise development challenges. The symbolic code understanding and precise modification capabilities align perfectly with MSP service delivery requirements.
Enterprise Value Propositions
Serena's architecture delivers quantifiable benefits for MSP clients:
- Accelerated Codebase Onboarding: New team members leverage Serena's project memories for rapid context acquisition, reducing onboarding costs by 40-60%
- Legacy Modernization Efficiency: Symbolic navigation enables precise refactoring of complex legacy systems without full codebase comprehension requirements
- Compliance Documentation: Automated code analysis generates comprehensive documentation for regulatory compliance and audit requirements
- Security Vulnerability Remediation: Precise symbol-level editing enables targeted security patches with minimal regression risk
Integrating Serena with ITECS MSP ELITE Package
ITECS clients benefit from Serena integration as part of comprehensive managed IT services. The combination of AI-enhanced development capabilities with proactive infrastructure management delivers transformative business outcomes.
Our MSP ELITE package now incorporates Serena deployment and optimization as a value-added service, ensuring clients maximize ROI from AI coding assistant investments. This includes:
- • Professional Ubuntu server configuration optimized for Serena workloads
- • Custom context and mode development aligned with your development workflows
- • Security-hardened Docker deployments with comprehensive monitoring
- • Team training on effective Serena usage patterns and best practices
- • Ongoing support for language server configurations and performance tuning
Conclusion: Transforming Development Workflows
Serena MCP represents a paradigm shift in how development teams interact with AI coding assistants on Ubuntu Linux systems. By providing semantic code understanding through language server integration, Serena delivers capabilities that dramatically exceed traditional text-based approaches.
The combination of symbolic code navigation, persistent project memories, and flexible integration options creates a powerful platform for accelerating development velocity while maintaining code quality. Whether deployed through Claude Code's streamlined CLI interface, integrated into IDE extensions, or accessed via Claude Desktop's user-friendly GUI, Serena adapts to diverse workflow requirements.
For enterprise organizations navigating complex modernization initiatives, legacy system maintenance, or rapid feature development demands, Serena provides the precision and efficiency required for competitive advantage. The open-source nature ensures transparency, auditability, and customization potential that proprietary solutions cannot match.
Transform Your Development Infrastructure Today
ITECS specializes in deploying and optimizing AI-enhanced development environments as part of our comprehensive managed IT services. Our team brings decades of Linux systems expertise and enterprise development workflow optimization to every engagement.
Whether you're exploring AI coding assistants for the first time or seeking to maximize existing tool investments, our MSP ELITE package provides the strategic guidance and technical implementation expertise your organization needs.
By following the comprehensive installation and configuration strategies outlined in this guide, development teams can unlock Serena's full potential on Ubuntu Linux platforms. The investment in proper setup, thoughtful context configuration, and strategic memory system usage pays dividends through accelerated development cycles, improved code quality, and enhanced team productivity.
Embrace the future of AI-assisted development with Serena MCP - where symbolic code understanding meets enterprise-grade reliability on the world's most popular server operating system.
Additional Resources
Consideration: Requires internet connectivity for initial execution, limited customization options without local codebase access
uvx --from git+https://github.com/oraios/serena serena start-mcp-server
This command initiates the MCP server using stdio transport, the standard protocol for MCP client-server communication. Most MCP clients like Claude Desktop expect this configuration by default.
Method 2: Local Installation from Repository (Recommended for Development)
Local installation provides complete control over Serena's configuration and enables custom modifications to the codebase. This approach is essential for organizations requiring code audits, custom tool development, or offline operation capabilities.
Advantage: Full codebase access, offline capability, simplified debugging, custom tool integration
Step 1: Clone the Serena repository to your local system
git clone https://github.com/oraios/serena
cd serena
Step 2: (Optional) Edit the global configuration file
uv run serena config edit
This opens ~/.serena/serena_config.yml
in your default editor. Configuration changes apply globally across all projects and clients unless overridden by project-specific settings.
Step 3: Launch the MCP server
uv run serena start-mcp-server
When executing from outside the installation directory, specify the absolute path:
uv run --directory /absolute/path/to/serena serena start-mcp-server
Method 3: Docker Containerized Deployment (Recommended for Security)
Docker deployment provides enhanced security isolation for shell command execution while eliminating local dependency management. This approach is particularly valuable in enterprise environments with strict security policies or when working with untrusted codebases.
Advantage: Complete environment isolation, no language server installation required, consistent behavior across systems
Important: Review Docker-specific limitations in the official documentation before deploying production workloads
docker run --rm -i --network host \
-v /path/to/projects:/workspaces/projects \
ghcr.io/oraios/serena:latest \
serena start-mcp-server --transport stdio
Replace /path/to/projects
with your actual projects directory. The volume mount enables Serena to access your codebase while maintaining container isolation for security purposes.
Method 4: Nix Package Manager (For NixOS Users)
Nix users benefit from declarative, reproducible installations that integrate seamlessly with existing Nix configurations. This approach is ideal for organizations using Nix for system configuration management.
nix run github:oraios/serena -- start-mcp-server --transport stdio
For flake-based configurations, reference the repository as github:oraios/serena
and import the serena
package export.
Advanced Configuration: SSE Transport Mode
While stdio transport represents the standard MCP communication protocol, Server-Sent Events (SSE) mode provides HTTP-based communication with distinct advantages for specific deployment scenarios. SSE mode enables manual server lifecycle management and simplified debugging through standard HTTP tooling.
SSE mode proves particularly valuable when integrating with web-based clients, implementing custom load balancing, or debugging communication issues that are difficult to diagnose with stdio's opaque stream-based protocol.
uv run serena start-mcp-server --transport sse --port 9121
Configure your MCP client to connect to the SSE endpoint:
http://localhost:9121/sse
SSE mode requires manual server management. The server persists until explicitly terminated, unlike stdio mode where the client controls server lifecycle. Monitor server logs through the web dashboard or system logs to ensure healthy operation.
Client Integration Strategies
Serena's Model Context Protocol implementation enables integration with numerous LLM clients. Each integration scenario requires specific configuration approaches optimized for the client's architecture and capabilities.
Claude Code Integration: Premium Performance Enhancement
Claude Code represents Anthropic's official CLI coding agent, and Serena integration transforms it into an exceptionally powerful development tool. The combination delivers superior token efficiency and more precise code modifications compared to Claude Code's standalone capabilities.
Navigate to your project root directory and execute:
claude mcp add serena -- uvx --from git+https://github.com/oraios/serena \
serena start-mcp-server --context ide-assistant --project $(pwd)
The --context ide-assistant
parameter optimizes Serena's toolset and prompting strategy for IDE-integrated workflows. This context disables redundant tools that Claude Code already provides while enhancing symbolic code navigation capabilities.
The --project $(pwd)
parameter automatically activates the current directory as a Serena project, eliminating manual activation steps and ensuring immediate tool availability.
Important: Claude Code version 1.0.52 or later automatically reads Serena's instruction text. For earlier versions, explicitly request instruction loading with "/mcp__serena__initial_instructions" or ask Claude to "read Serena's initial instructions"
Instruction loading ensures Claude understands how to effectively utilize Serena's semantic tools. Without proper instruction loading, Claude may misuse tools or fail to leverage Serena's full capabilities, resulting in suboptimal code generation.
OpenAI Codex CLI Configuration
OpenAI's Codex CLI provides another terminal-based coding agent option. Serena integration requires the specialized codex
context due to Codex's non-standard MCP implementation that requires tool description massaging for compatibility.
Edit ~/.codex/config.toml
(create if absent) and add:
[mcp_servers.serena]
command = "uvx"
args = ["--from", "git+https://github.com/oraios/serena", "serena", "start-mcp-server", "--context", "codex"]
Unlike Claude Code's per-project MCP configuration, Codex registers MCP servers globally. After Codex initializes, activate your project explicitly:
"Activate the current dir as project using serena"
Monitor ~/.codex/log/codex-tui.log
for any initialization errors. Note that Codex may display false "failed" status messages for successful tool executions due to a known bug in the Codex implementation.
Claude Desktop Application Setup
Claude Desktop provides a user-friendly GUI experience for Claude interactions with full MCP server support. While official builds exist for Windows and macOS, Ubuntu users can leverage the community-maintained Debian implementation for equivalent functionality.
Access the configuration editor through File → Settings → Developer → MCP Servers → Edit Config. This opens claude_desktop_config.json
for direct editing.
Add the Serena MCP server configuration based on your chosen installation method:
Local Installation Configuration:
{
"mcpServers": {
"serena": {
"command": "/absolute/path/to/uv",
"args": ["run", "--directory", "/absolute/path/to/serena", "serena", "start-mcp-server"]
}
}
}
UVX Remote Execution Configuration:
{
"mcpServers": {
"serena": {
"command": "/absolute/path/to/uvx",
"args": ["--from", "git+https://github.com/oraios/serena", "serena", "start-mcp-server"]
}
}
}
Docker Container Configuration:
{
"mcpServers": {
"serena": {
"command": "docker",
"args": ["run", "--rm", "-i", "--network", "host", "-v", "/path/to/projects:/workspaces/projects", "ghcr.io/oraios/serena:latest", "serena", "start-mcp-server", "--transport", "stdio"]
}
}
}
Save the configuration and restart Claude Desktop to activate Serena integration. Serena's tools appear in the chat interface marked with a hammer icon, indicating successful MCP server registration.
Critical: Many MCP clients fail to properly terminate subprocess servers on exit. Enable Serena's web dashboard (enabled by default) to manually shut down lingering processes and prevent resource leaks
IDE Integration: Cline, Roo-Code, Cursor, Windsurf
Modern IDE extensions and VSCode-based editors increasingly support MCP servers for enhanced coding assistance. Serena integration follows similar patterns across these platforms, with minor client-specific configuration variations.
For IDE-integrated usage, always specify the ide-assistant
context to prevent tool conflicts. IDE extensions typically provide their own file editing and shell execution capabilities, making Serena's equivalent tools redundant. The context configuration disables these overlapping tools while maximizing Serena's unique symbolic analysis capabilities.
"args": [...other args..., "--context", "ide-assistant"]
Configuration specifics vary by extension, but the general pattern involves adding Serena to the extension's MCP server list with appropriate command and argument specifications. Consult your specific IDE extension's MCP configuration documentation for exact syntax requirements.
Project Activation and Indexing
Serena operates on a project-based model where each codebase requires explicit activation before Serena's tools become available. This design ensures proper language server initialization and prevents accidental cross-project operations.
Interactive Project Activation
The most straightforward activation method involves instructing your LLM to activate the project through natural language. Serena recognizes activation requests and invokes the appropriate tool automatically.
"Activate the project /home/user/my-application"
After initial activation, Serena assigns each project a name (defaulting to the directory name). Subsequent activations can reference this name instead of providing the full path:
"Activate the project my-application"
Activation triggers automatic generation of .serena/project.yml
in your project root. This file stores project-specific configuration including the project name, excluded paths, language server preferences, and custom tool settings.
Automatic Project Activation at Startup
For workflows centered on a single primary project, configure automatic activation by adding the --project
parameter to your MCP server launch command. This proves especially valuable for per-project MCP configurations like Claude Code.
uvx --from git+https://github.com/oraios/serena serena start-mcp-server \
--project /home/user/my-application
Performance Optimization Through Project Indexing
Large codebases benefit significantly from pre-indexing. Without indexes, the first tool invocation may incur substantial latency as language servers perform initial project analysis. Pre-indexing eliminates this cold-start delay, delivering immediate tool responsiveness.
Navigate to your project directory and execute:
uvx --from git+https://github.com/oraios/serena serena project index
Alternatively, specify the project path explicitly:
uvx --from git+https://github.com/oraios/serena serena project index /path/to/project
Indexing duration correlates with codebase size and complexity. Projects with hundreds of thousands of lines may require several minutes for comprehensive indexing. However, this one-time investment pays dividends through dramatically improved interactive performance.
Language-Specific Configuration
Serena supports an extensive array of programming languages through language server integrations. While many languages work out-of-the-box, several require additional installation steps for optimal functionality.
Pre-configured Languages (No Additional Setup)
- Python
- TypeScript/JavaScript
- C#
- Swift
- Clojure
- Dart
- Bash
- C/C++
Languages Requiring Additional Installation
PHP (Intelephense Premium Features):
Set environment variable for premium features:
export INTELEPHENSE_LICENSE_KEY=your-license-key
Go (gopls):
go install golang.org/x/tools/gopls@latest
R (languageserver package):
R -e 'install.packages("languageserver")'
Rust (rust-analyzer):
Installed automatically with rustup toolchain:
rustup component add rust-analyzer
Zig (ZLS):
# Follow official ZLS installation instructions at
# https://github.com/zigtools/zls
Lua (auto-downloads language server if not present):
No manual installation required - Serena handles this automatically
Nix (nixd):
nix-env -iA nixpkgs.nixd
Elixir (NextLS):
Note: Windows not supported
# Follow NextLS installation instructions
Contexts and Modes: Advanced Behavioral Customization
Serena's context and mode system provides granular control over tool availability and prompting strategies. Understanding this system enables precise optimization for specific workflows and integration scenarios.
Context Selection Strategy
Contexts define Serena's operational environment, influencing initial prompting and default tool configurations. Contexts are immutable after server initialization, requiring server restart for changes.
desktop-app (Default)
Optimized for Claude Desktop and similar standalone GUI applications. Enables all tools including shell execution and file editing.
ide-assistant
Designed for IDE integrations (Cursor, Cline, Windsurf, VSCode extensions). Disables file editing and shell tools that conflict with IDE capabilities, focusing on semantic code analysis.
agent
Autonomous agent scenarios with full tool access and agent-optimized prompting. Suitable for Agno-based deployments and custom agent frameworks.
codex
Specialized configuration for OpenAI Codex CLI compatibility, massaging tool descriptions to work around Codex's non-standard MCP implementation.
oaicompat-agent
OpenAI-compatible tool descriptions for local language models requiring OpenAI API format compliance.
Specify context during server initialization:
uvx --from git+https://github.com/oraios/serena serena start-mcp-server --context ide-assistant
Dynamic Mode Switching
Unlike immutable contexts, modes enable runtime behavioral adjustments. Multiple modes can activate simultaneously, creating complex behavioral combinations tailored to specific tasks.
planning
Emphasizes analysis and strategic planning over immediate implementation. Useful for architecture decisions and refactoring strategies.
editing
Optimizes for direct code modifications with minimal analysis overhead. Accelerates implementation tasks.
interactive
Encourages conversational workflows with user feedback loops. Ideal for collaborative development sessions.
one-shot
Configures single-response task completion. Often combined with planning mode for comprehensive analysis reports.
no-onboarding
Skips initial project familiarization process for known codebases or quick tasks.
Specify modes at startup:
uvx --from git+https://github.com/oraios/serena serena start-mcp-server \
--mode planning --mode no-onboarding
Switch modes dynamically during conversation:
"Switch to planning and one-shot modes"
This invokes Serena's switch_modes
tool, adjusting behavior mid-session without server restart.
Creating Custom Contexts and Modes
Organizations with specialized workflows benefit from custom context and mode definitions. Serena provides CLI tooling for context/mode management or accepts direct YAML file manipulation.
Explore available CLI commands:
uvx --from git+https://github.com/oraios/serena serena context --help
uvx --from git+https://github.com/oraios/serena serena mode --help
Custom definitions reside in ~/.serena/
as YAML files. Serena automatically registers files by name (filename without .yml extension). Reference custom contexts/modes identically to built-in ones.
Project Onboarding and Memory System
Serena's memory system addresses a fundamental challenge in LLM-based coding: maintaining project context across sessions. The onboarding process and persistent memories enable Serena to build deep project understanding that persists beyond conversation boundaries.
Automated Onboarding Process
First-time project activation triggers an automated onboarding sequence where Serena systematically explores the codebase, identifying architectural patterns, testing methodologies, build systems, and coding conventions. This information is distilled into memories stored in .serena/memories/
.
Onboarding typically involves substantial file reading, consuming significant context window space. After onboarding completion, consider starting a fresh conversation to reclaim context budget. The memories persist, providing condensed project knowledge without conversation history overhead.