β οΈ Early Development Notice: This project is actively being developed. Features may change, break, or be incomplete. Native OS installers are generated via Tauri v2, but APIs are considered unstable prior to v1.0. Use at your own risk.
SwarmCode is a powerful desktop-based AI engineering assistant, providing intelligent, multi-agent coding assistance, deep repository understanding, and autonomous browser automation directly on your system. It completely shifts the paradigm from standard "AI Chatbots" to "Autonomous AI Engineering Hives."
- Overview
- Core Architecture
- Key Features
- In-Depth Subsystems
- Installation & Requirements
- Complete Configuration Guide
- Environment Variables
- Usage Guide & CLI Operations
- Supported AI Models
- Creating Custom Agents
- Model Context Protocol (MCP) & Custom Tools
- Security & Zero-Trust Paradigm
- Internal APIs & IPC Documentation
- Keyboard Shortcuts
- Future Project Roadmap
- Troubleshooting & FAQ
- Development & Contributing
- License
SwarmCode is a Rust and React-based desktop application that brings a specialized AI engineering team to your local environment. It provides a beautiful, VS Code-like GUI for interacting with various AI models to execute highly complex software engineering tasks.
Unlike standard chat bots that blindly edit files, SwarmCode employs a dynamic Multi-Agent "Hive" architecture with specialized tools to natively search AST codebases, operate web browsers invisibly, and run CLI commands. It uses maximum capabilities across the Model Context Protocol (MCP) to interact securely with your local file system.
The core philosophy of SwarmCode is to eliminate "copy-pasting" from web browsers into your IDE. The AI has direct, sandboxed access to the filesystem, the terminal, and a headless web browser to perform end-to-end testing, feature development, and CI/CD validation.
The computing concerns in SwarmCode are heavily separated for security and speed. The entire backend is strictly typed Rust.
graph TD;
GUI[Swarm GUI - React/Tauri] --> API[Swarm API];
TUI[Swarm Matrix - Ratatui] --> API;
API --> Runtime[Swarm Runtime Central Nervous System];
Runtime --> Hands[SwarmHands: WebAgent];
Runtime --> Senses[SwarmSenses: AST Knowledge Graph];
Hands --> Browser[Chromiumoxide CDP];
Senses --> TS[Tree-sitter Grammars];
| Subsystem | Scope | Description |
|---|---|---|
swarm-gui |
Frontend | Tauri v2 application wrapper and React (Vite) frontend. Native window management. |
swarm-api |
Backend | Core AI prompt orchestration, token management, and LLM provider interfaces. |
swarm-runtime |
Logic | The central nervous system regulating memory context, system state, and active agents. |
swarm-hive |
Teamwork | Multi-agent coordination engine via asynchronous mailboxes and shared task lists. |
swarm-senses |
Indexing | Tree-sitter powered abstract syntax tree mapping using Petgraph native execution. |
swarm-hands |
E2E | Chromiumoxide-based deterministic web automation via Chrome DevTools Protocol. |
swarm-matrix |
TUI | High-performance terminal rendering engine built on top of ratatui. |
swarm-master |
CLI | Command-line parsing engine for CI/CD integrations or quick terminal usage. |
adversary |
Security | Proactive inspector for detecting malicious patterns in AI outputs before execution. |
- Interactive GUI & TUI: Built with React/Tauri for a premium desktop experience, with a seamless Ratatui terminal fallback.
- Dynamic Agent Swarms (Hive Intelligence): Create specialized teams (e.g., QA, Security, Architect) that communicate asynchronously and solve tasks in parallel via the SwarmHive.
- Hierarchical Memory Store: Persistent, scoped memory (Global vs Local) with tagged record boundaries for consistent agent recall across sessions.
- Multiple AI Providers: Native support for Anthropic Claude, OpenAI, Google Gemini, Groq, Ollama (Local), and Mistral.
- SwarmSenses (Deep Code Search): Uses Tree-Sitter and Petgraph to build an AST-based knowledge graph. Search by functions, classes, and logic rather than plain text.
- SwarmHands (Browser Automation): A dedicated WebAgent using
chromiumoxide. It can visually navigate websites, extract data, or test login flows either in headless mode or with an actively visible DOM. - Integrated Terminal Execution: Safe, user-approved sandbox execution of terminal commands directly from the AI.
- Adversarial Safety Inspector: Proactive auditing of model responses to prevent command injection, path traversal, and "runaway" output generation.
- Single Native Binary: Compiles down to a single Windows
.exe(or Linux AppImage/macOS .app) with all subsystems baked in. - Bootstrap Autopilot: Multi-phase project initialization that guides a codebase from cold-start to active development.
- Auto-Compaction Memory Management: Seamlessly summarize past context thresholds to ensure long-running sessions never run out of tokens.
SwarmSenses replaces traditional text-based "grep" operations with semantic understanding. When analyzing a new workspace, SwarmSenses parses .rs, .ts, .py, and .go files into an Abstract Syntax Tree using tree-sitter.
It then pushes these nodes into a petgraph dependency web, allowing the AI to query "Where is this struct used?" or "What function inherently calls this endpoint?" rather than just matching raw strings.
- Nodes: Represent structs, implementations, classes, functions, and interfaces.
- Edges: Represent call graphs, implementations, and imports.
The WebAgent module connects natively to system Chrome/Chromium installation via Chrome DevTools Protocol (CDP).
- It injects a semantic reference ID (
data-swarm-ref) into every interactable element in the DOM. - The AI natively reads the simplified DOM tree.
- The AI commands SwarmHands to natively
click_element_by_ref("4")without struggling to write complex XPaths. - Visible Option: In the GUI, you can toggle "Show Browser" so that the headless browser opens a window frame. You can physically watch the AI click UI elements, login, and scrape metadata.
For Linux server environments or developers who hate leaving their tmux session, SwarmMatrix wraps the entire intelligence engine in a keyboard-driven terminal dashboard. It shares 100% of the cognitive engine as the desktop GUI. It uses ratatui with immediate-mode rendering for instant frame-rate drops.
SwarmHive is the management layer that allows multiple agents to coordinate on a single project.
- Asynchronous Mailboxes: Each agent has an independent
inboxwhere they can receive messages from other Hive members without blocking the main event loop. - Shared Task List: A centralized task board (
TeamTask) allows agents to claim, update, and finalize tasks synchronously. - Persistent Team State: The entire state of the swarm (messages, task status, member health) is persisted to the workspace, allowing teams to resume work after a restart.
MemoryStore provides a hierarchical layer of "long-term" memory for agents.
- Scoped Memory: Supports
Globalscope (machine-wide settings and general knowledge) andLocalscope (project-specific patterns, styling rules, or architecture decisions). - Tagged Records: Memories are stored as tagged text records inside robust boundaries (
--- RECORD ---), enabling high-precision retrieval without data corruption.
The SwarmCode GUI provides deep visibility into the AI's internal state via specialized message blocks.
- ThinkingBlock: Renders the agent's internal reasoning process in a collapsible, interactive UI element.
- VisualBlock: Dynamically renders structured data, including charts, diagrams, and generated artifacts, directly within the chat stream.
To develop or build SwarmCode, you need:
- Node.js (v18+)
- Rust / Cargo (v1.75+)
-
Clone the repository:
git clone https://github.com/your-username/swarmcode.git cd swarmcode -
Install node modules:
cd swarm-gui/frontend npm install -
Run in Development Mode:
cd ../src-tauri npx tauri dev
Tauri requires the Microsoft Visual Studio C++ Linker (link.exe). Without this, Cargo cannot assemble the final binary UI payload.
Run this exclusively in an Administrator PowerShell:
winget install --id Microsoft.VisualStudio.2022.BuildTools --exact --forceWhen installing manually, ensure you select the "Desktop development with C++" workload.
To generate the final production .exe installer:
cd swarm-gui/src-tauri
npx tauri buildThe .exe will be located in swarm-gui/src-tauri/target/release/bundle/nsis/.
SwarmCode behaves hierarchically with its configuration files. It searches for .swarmcode.json in the following priority list:
- The currently loaded workspace directory
$XDG_CONFIG_HOME/swarmcode/$HOME/.swarmcode.json
{
"system": {
"auto_compact": true,
"max_context_tokens": 128000,
"theme": "cyber-dark",
"log_level": "info",
"shell": {
"path": "/bin/bash",
"args": ["-l"]
}
},
"providers": {
"openai": {
"disabled": false,
"default_model": "gpt-4o"
},
"anthropic": {
"disabled": false,
"default_model": "claude-3-7-sonnet-20250219"
},
"ollama": {
"disabled": false,
"endpoint": "http://127.0.0.1:11434/v1"
}
},
"agents": {
"security_auditor": {
"instructions": "Be brutal. Look for injections, memory leaks, and unsafe blocks.",
"priority": "high",
"model": "claude-3-7-sonnet"
},
"web_scout": {
"instructions": "Execute E2E tests using SwarmHands without destroying prod state.",
"priority": "normal",
"model": "gpt-4o"
}
},
"workspace": {
"ignore_patterns": [
"**/node_modules/**",
"**/target/**",
"**/.git/**"
]
}
}For security in shared environments or CI pipelines, you can bypass the configuration files using process environment variables. SwarmCode will automatically read these on boot and populate the settings.
| Environment Variable | Target Provider | Requirements |
|---|---|---|
ANTHROPIC_API_KEY |
Anthropic | sk-ant-... format required |
OPENAI_API_KEY |
OpenAI | sk-proj-... format required |
GEMINI_API_KEY |
Google AI Studio | Standard alpha-numeric key |
GROQ_API_KEY |
Groq | Needed for extreme-speed inference |
MISTRAL_API_KEY |
Mistral La Plateforme | Platform Key |
CUSTOM_LOCAL_ENDPOINT |
LMStudio / VLLM | e.g. http://localhost:1234/v1 |
VERTEXAI_PROJECT |
Google Cloud VertexAI | GCP Project string |
CLAWSWARM_LOG |
Internal Rust Tracing | Example: swarm_api=debug,info |
- Double-click the
SwarmCode.exe. - Click the
Foldericon in the Explorer sidebar to load your codebase. - Select your AI Provider correctly (e.g. Anthropic) and verify the API key is active.
- Chat with your agent in the main console window.
- If an agent wants to run a CLI command (e.g.,
npm run test), SwarmCode will pause and ask for explicit permission in the UI.
For rapid, single-shot inquiries without launching a visual window:
# General query over current directory
swarm-master "Refactor the main.rs file to use async traits"
# Run with specific JSON output formatting
swarm-master "List all unused dependencies" --format json
# Force headless browser workflow
swarm-master "Go to https://news.ycombinator.com and extract top 5 headlines" --agent hands
# Disable spinner for script output
swarm-master "Return the active aws profile name" --quietSwarmCode supports massive varieties of models. Because SwarmCode uses highly specific tools, we strongly recommend using Reasoning or Tier-1 models (claude-3.7, gpt-4o), as smaller models often fail to correctly output JSON-formatted Tool Calls.
- Anthropic Claude 3.7 Sonnet (The absolute best at coding & tool execution)
- OpenAI GPT-4.5 Preview
- OpenAI GPT-4o
- Google Gemini 2.5 Pro
- Anthropic Claude 3.5 Haiku
- Google Gemini 2.0 Flash
- Groq Llama-3.3-70B-Versatile
- OpenAI o1 / o3-mini (Note: O-series models may refuse certain system prompts or tool schemas natively. SwarmCode automatically maps these edge-cases when possible).
- Ollama qwen2.5-coder:32b
- Ollama deepseek-coder-v2
SwarmCode allows you to go beyond prompt engineering and define entirely new Agent Personas. An agent is defined by its system message wrapper, its allowed tools, and the specific model it forces invocation on.
You can create an agent in your local .swarmcode.json:
{
"agents": {
"database_admin": {
"name": "DBA Architect",
"model": "claude-3-7-sonnet-20250219",
"system_prompt": "You are a senior PostgreSQL architect. You only review database schemas. You must immediately run `psql --version` to verify tooling when spawned.",
"allowed_tools": ["terminal_run", "fs_read_file"],
"denied_tools": ["fs_delete_file", "hands_run_agent"]
}
}
}When you open SwarmCode, DBA Architect will appear in your Agent Panel, ready for deployment.
SwarmCode natively implements the Model Context Protocol (MCP), allowing you to attach completely foreign executables as callable AI tools.
If you have an enterprise API or a proprietary linter, you do not need to rewrite SwarmCode in Rust. You simply define an MCP Server in your config:
{
"mcpServers": {
"my_enterprise_linter": {
"type": "stdio",
"command": "/usr/local/bin/enterprise_linter",
"env": ["LINT_KEY=SECRET293"],
"args": ["--stdio-bridge"]
},
"web_cloud_indexer": {
"type": "sse",
"url": "https://api.mycompany.com/mcp",
"headers": {
"Authorization": "Bearer token"
}
}
}
}The AI will dynamically ping the MCP server on boot, learn the tool schemas provided by /usr/local/bin/enterprise_linter, and will automatically show the user a permission request to execute the external tool whenever necessary.
AI execution is dangerous. SwarmCode was designed strictly with a Zero-Trust security module preventing arbitrary execution and exfiltration.
- Path Traversal Protection: All file system tools (read, write, edit, grep) are shielded by a robust path validation engine. The AI cannot "escape" the workspace using
..sequences or access sensitive system paths (e.g.,/etc/passwd,C:\Windows). - Environment Scrubbing: Sensitive environment variables, including
OPENAI_API_KEY,GITHUB_TOKEN, andDATABASE_URL, are automatically scrubbed before spawning child processes. This prevents Hook processes, MCP servers, or Shell scripts from stealing your credentials. - Sandboxed Terminal: Any command requested by the AI (e.g.,
rm -rf node_modules) is trapped in theswarm-runtimebuffer. It triggers an IPC event to the React GUI. The GUI halts all AI inference and waits for explicit human action:AlloworDeny. - JSON Payload Safety: To prevent stack exhaustion attacks, the internal JSON parser enforces a maximum recursion depth (128). This mitigates adversarial "billion laughs" style JSON payloads designed to crash the agent.
- Hardened OAuth Storage: OAuth credentials are saved with restricted filesystem permissions (
0600). Randomness is handled via a cross-platform Cryptographically Secure Pseudo-Random Number Generator (CSPRNG), ensuring secure token exchange even on Windows. - API Key Isolation: All LLM queries are processed in the internal Rust memory. API keys are never leaked to the React DOM or Webview environment, isolating them from XSS or generic browser attacks.
If you are developing features for SwarmCode, all communication between the Desktop UI and the AI Engine occurs over Tauri V2 asynchronous IPC channels.
invoke("chat_send_message", { message: string, agent: string })- Dispatches a message to the unified message queue.
invoke("agents_start_swarm", { focus: string })- Initializes the parallel multi-threaded inference core.
invoke("hands_run_agent", { req: { url: string, task: string, show_browser: bool }})- Hooks into Chromiumoxide and spawns the Browser Agent natively.
invoke("senses_search", { query: string })- Initiates an AST query mapping search against the
petgraphcache.
- Initiates an AST query mapping search against the
Speed is critical for an engineering tool. SwarmCode supports extensive keyboard operations.
| Shortcut | Context | Action |
|---|---|---|
Ctrl+Enter / Cmd+Enter |
Text Input | Submit message to currently active agent |
Ctrl+P / Cmd+P |
Global | Fast document switcher / Fuzzy file finder |
Ctrl+Shift+F |
Global | Jump directly to SwarmSenses AST Search tab |
Esc |
Process | Instantly cancel/abort a running LLM generation |
Ctrl+L |
Text Input | Clear chat history & reset context window |
Ctrl+, |
Global | Open global SwarmCode settings pane |
| `Ctrl+`` | Global | Toggle embedded terminal drawer |
| Shortcut | Context | Action |
|---|---|---|
Ctrl+C |
Global | Kill sequence, exit TUI immediately |
Ctrl+K |
Input | Open Custom Command / Workflow template modal |
Tab |
Input Mode | Cycle focus between Chat, Files, and System Logs |
Up/Down |
List Focus | Navigate elements (Messages, File tree, Modules) |
Esc |
Global | Close overlay dialogs or exit Insert Mode |
While SwarmCode is highly functional, the architectural vision expands further:
- Basic LLM abstractions.
- Tauri v2 GUI launch.
- Integration of SwarmHands and SwarmSenses.
- Support for distributed processing. Letting your desktop delegate "Web Scouting" to an AWS Lambda containing
swarm-handswhile the GUI stays local. - True peer-to-peer agent collaboration arrays (agents debating code architectures before presenting them).
- Deep memory vector databases (RAG) natively stored in SQLite
swarm-runtime/data.dbto remember developer preferences across months of interaction. - Mobile Application companion app (Tauri v2 Mobile).
A: Check if the agent requires permission. In the GUI, look for a pending "Action Required" notification block. By default, SwarmCode operates in Zero-Trust mode and will not execute arbitrary shell injection without your explicit "Allow" click.
A: Ensure you have Google Chrome or Chromium natively installed on your OS path. The headless agent attempts to locate the default OS browser installation to hook into the DevTools protocol.
A: This is a Rust error on Windows indicating the MSVC compiler is missing. Install Visual Studio Build Tools, select "Desktop Development with C++", and be sure to execute cargo build inside the "x64 Native Tools Command Prompt" provided by Visual Studio.
A: In your settings, enable Auto-Compact. When the conversation approaches the 80% mark of the provider's token limit, SwarmCode will inject a background summarizing prompt and drastically truncate the chat history while retaining explicit system knowledge.
A: Ollama binds to 127.0.0.1:11434 by default. If you are running SwarmCode inside WSL or via Docker, you must set OLLAMA_HOST=0.0.0.0 before starting your Ollama server so the GUI can successfully hit the local socket.
We welcome structural improvements, new tool additions, and UI enhancements!
- Rust Format: Always run
cargo fmtin thesrc-tauridirectory. - Clippy Checks: Ensure 0 warnings by running
cargo clippy -- -D warnings. - Frontend Rules: Run
npm run lintinside thefrontend/directory before pushing. React components should strictly use Tailwind utility classes or inline React styles matching the Dark/Cyberpunk aesthetic.
- Fork the repository on GitHub.
- Create a clean feature branch:
git checkout -b feature/your-feature-name - Commit verbosely:
git commit -m "feat(hands): support shadow-dom traversal in ref_engine" - Push and create a Pull Request against the
mainbranch.
If you are adding a new Tool capability to the AI (e.g., "Docker control"), you must:
- Implement the logic natively in a new crate (
core/swarm-docker). - Add the JSON Schema definition of the tool in
swarm-runtime/src/tools/. - Ensure the Desktop GUI explicitly receives a message packet alerting the React UI that a Docker command is executing.
When SwarmCode communicates with external MCP servers or language servers, it strictly enforces standard JSON schema payloads. For plugin developers, adhering to these schemas is mandated.
All tools registered within swarm-runtime must accept generic Map<String, Value> but are evaluated via strict Serde serialization:
{
"name": "fs_read_file",
"arguments": {
"file_path": "/absolute/path/to/project/src/main.rs",
"offset": 0,
"limit": 500
}
}Errors in tool execution MUST not crash the agent; they must return a standardized error artifact:
{
"status": "error",
"message": "Permission Denied: User Rejected Action",
"data": null,
"recovery_hint": "Request human intervention or write to a scratchpad buffer instead."
}SwarmSenses does not use RegEx. It compiles Tree-Sitter grammars dynamically for true Abstract Syntax Tree resolution.
- Rust (
.rs): Full support for traits, async mod blocks, closures, and macros. - TypeScript (
.ts/.tsx): Full JSX element tagging, React Hooks detection, and interface mapping. - Python (
.py): Resolves class inheritance, typing stubs, and decorator injection dependencies. - Go (
.go): Fully supports struct tags, goroutine inference, and channel mappings. - C / C++ (
.c/.cpp): Parses header files (.h) to construct accurate symbol tables before diving into core implementations.
(To add a new language, compile the tree-sitter C bindings and link them directly into the swarm-senses/build.rs module.)
Agents in SwarmCode are not static. You can design them to hold explicit tool constraints.
"agents": {
"strict_auditor": {
"name": "Security Auditor",
"model": "gpt-4o",
"system_prompt": "You are a cyber-security auditor. You must parse input, but you cannot edit it.",
"tools": {
"allow": ["fs_list", "fs_read", "senses_query"],
"deny": ["fs_write", "terminal_run", "hands_click"]
},
"max_context": 32000,
"temperature": 0.0
}
}If strict_auditor attempts to output a tool invocation for terminal_run, the swarm-runtime interceptor will halt execution and inject an internal warning prompt back to the LLM, informing it that it lacks physical permissions to do so, thus forcing a self-correction cycle.
SwarmCode deals with context bloat automatically. When the context length surpasses 90%:
- The
TaskEvictionServicepauses the inference loop. - The past 100 turns of chat history are sent to a rapid, low-latency model (e.g.,
gemini-2.5-flash). - The conversation is synthesized into a highly dense
Memory Object. - The synthesized memory replaces the raw chat logs.
- The inference loop resumes flawlessly.
(Coming in v1.2)
Currently, SwarmCode relies heavily on raw API keys injected via $ENV vectors or the React configuration GUI. For enterprise users, we will be linking SwarmCode natively into standard OIDC (OpenID Connect) authentication rings for Azure AD and Okta integration natively.
If you wish to hardcode a new ability straight into the Rust binary instead of using MCP via stdio, implement the ToolProvider trait inside swarm-plugins:
use async_trait::async_trait;
use serde_json::Value;
pub struct CustomDeployTool;
#[async_trait]
impl ToolProvider for CustomDeployTool {
fn schema(&self) -> Value {
serde_json::json!({
"name": "docker_deploy",
"description": "Deploys to local swarm"
})
}
async fn execute(&self, args: Value) -> Result<String, String> {
Ok("Deployment Initialized.".to_string())
}
}Bind this module to the central Engine on boot, and your custom compilation of SwarmCode will permanently possess native Docker routing.
- Initial Release: Complete rebranding to SwarmCode.
- Tauri v2 Migration: Moved entirely off Tauri v1 to leverage Android/iOS unified core systems (preparation for v1.0 mobile companion).
- SwarmSenses Setup: Integrated Tree-sitter natively for AST indexing across Rust, TS, Python, Go, and C.
- SwarmHands MVP: Brought in CDP automation. Web Agent can now bypass basic Cloudflare screens and execute structured E2E tests against live DOM elements.
- Master TUI: Full terminal rewrite dropping standard stdout in favor of an immediate-mode Ratatui engine.
- LLM Engine Swap: Deprecated localized prompt bindings in favor of a universal Adapter interface mapping to Anthropic, OpenAI, Groq, and Ollama.
- Initial React UI: Converted Python Tkinter legacy dashboard into the React interface.
When you invoke npx tauri build, the installer defaults to your host architecture. However, SwarmCode's strict Rust base allows robust cross-compilation.
To build SwarmCode for specific platforms:
Windows ARM64 (Snapdragon Elite)
# Install target
rustup target add aarch64-pc-windows-msvc
# Build
npm run tauri build -- --target aarch64-pc-windows-msvcmacOS Universal (Intel + Apple Silicon)
npm run tauri build -- --target universal-apple-darwinLinux AppImage Sandbox
Tauri will automatically bundle AppImage and .deb files if compiling on a Linux system. It requires webkit2gtk system dependencies.
npm run tauri build- Discord: (Link coming soon)
- X (Twitter): (Link coming soon)
- Discussions: Open a GitHub Discussion for feature requests!
SwarmCode is built by developers, for developers. If you find a bug where the AI gets stuck in an infinite loop while executing a file system write operation, please open an issue immediately. Our zero-trust framework relies on community audits to remain impenetrable.
This project is open-sourced under the Apache License 2.0.
You may freely use, modify, distribute, and commercialize this software. The Apache 2.0 license provides explicit patent grants, shielding adopters from patent retaliation, making it the premier choice for professional developer tooling.
See the LICENSE file for the full legal text.
Copyright Β© 2026 Ravuri Rithesh Venkata Sai Mani. All rights reserved.
