DevMesh is a local multi-agent orchestration framework that lets you coordinate multiple AI CLI tools (Claude, Gemini, Codex, etc.) to work together autonomously on tasks.
- Leverage Multiple AI Tools β Use the best tool for each job (Claude for architecture, Codex for quick scripts, etc.)
- Autonomous Coordination β Agents work together without human intervention
- Safe Collaboration β Lock system prevents agents from stepping on each other's toes
- Local & Fast β No cloud dependencies, everything runs locally with WebSocket coordination
- Observable β Real-time dashboard shows what agents are doing, what they're accessing, and resource usage
- Extensible β Works with any AI CLI tool that accepts a prompt argument
Agents β AI CLI tools (Claude, Gemini, etc.) connected to DevMesh and ready to accept tasks
Tasks β Instructions broadcast to all agents; agents bid fairly to claim work
Locks β File access control system (READ/WRITE/INTENT/CO_WRITE) to prevent conflicts
Hardware Throttling β GPU/RAM limits enforced globally to prevent resource exhaustion
Rulebook β 10 design principles that ensure safe multi-agent collaboration
- WebSocket Coordinator β Single source of truth for all agent activity
- Live Dashboard β Real-time visualization of tasks, agents, and locks
- Lock Management β READ/WRITE/INTENT/CO_WRITE semantics for safe collaboration
- Hardware Throttling β Resource limits (GPU/RAM) enforced per agent
- Audit Logging β Event history persisted to SQLite and JSONL
- Configuration Management β Environment-based settings with validation
- Structured Logging β Color-coded console output with optional file logging
.
βββ server.py # Main orchestration server (WebSocket + HTTP)
βββ agent_bridge.py # CLI tool wrapper (registers agents with server)
βββ client_mock.py # Test client for development/testing
βββ dashboard.html # Web UI (static asset, served by server)
βββ config.py # Configuration management & validation
βββ logger.py # Structured logging with colored output
βββ errors.py # Custom exception hierarchy
βββ storage.py # SQLite storage + audit logging
βββ check_tools.py # Utility to verify available CLI tools
βββ requirements.txt # Python dependencies
βββ tests/
β βββ test_core.py # Unit tests
βββ .devmesh/
βββ audit.jsonl # Event audit log (JSONL mirror)
βββ devmesh.db # SQLite persistence (tasks, agents, audit, projects)
- Python 3.12+
- At least one AI CLI tool installed (Claude, Cursor Agent, Gemini, Codex, etc.)
- Install dependencies:
pip install -r requirements.txt
python server.pyThe dashboard will automatically open at http://127.0.0.1:7701 and the server listens on ws://127.0.0.1:7700 for agent connections.
DevMesh automatically detects and works with the following AI CLI tools (in order of precedence):
| Tool | Command | Invoke Mode | Best For |
|---|---|---|---|
| Claude (via agent CLI) | claude |
arg | Code generation, refactoring |
| Cursor Agent | agent |
arg | Agentic tasks with native trust |
| Google Gemini | gemini |
arg | Multi-modal tasks |
| OpenAI Codex | codex |
arg | Code completion, shell commands |
| Aider | aider |
stdin | Pair programming, collaborative editing |
| Continue | continue |
arg | IDE-integrated development |
| Sourcegraph Cody | cody |
arg | Code search & understanding |
| Ollama | ollama |
arg | Local LLM inference |
| ShellGPT | sgpt |
arg | Shell scripting assistance |
| GitHub Copilot | gh |
arg | GitHub-integrated suggestions |
All tools run in non-interactive mode (YOLO/auto-approve) to enable fully autonomous operation.
All settings can be overridden via environment variables:
# Server
export DEVMESH_WS_HOST=127.0.0.1
export DEVMESH_WS_PORT=7700
export DEVMESH_HTTP_PORT=7701
export DEVMESH_DASHBOARD_PORT=7702
# Hardware
export DEVMESH_GPU_VRAM_GB=16
export DEVMESH_RAM_GB=32
# Timeouts
export DEVMESH_LOCK_TTL_SEC=15
export DEVMESH_HEARTBEAT_GRACE_SEC=5
# Logging
export DEVMESH_LOG_LEVEL=INFO
export DEVMESH_LOG_FILE=logs/devmesh.logSee config.py for all available settings.
- Server Startup β WebSocket listeners start; Dashboard opens in browser
- Agent Registration β Agent CLI connects, declares tool name and resource requirements
- Tool Detection β Server checks if agent command is available in PATH
- Task Broadcast β User sends task from dashboard; server broadcasts to all connected agents
- Lock Negotiation β Agents request locks (READ/WRITE/INTENT/CO_WRITE) before accessing files
- Execution β Agent runs CLI tool with task prompt; captures structured JSON output
- Results Collection β Agent reports completion, release locks; results stored in audit log
- Display β Dashboard updates in real time with results, logs, and hardware metrics
The lock system prevents conflicts when multiple agents access the same files:
- READ β Multiple agents can hold simultaneously; blocks WRITE/INTENT
- WRITE β Exclusive access; only one agent at a time
- INTENT β Signal that you'll write soon; blocks other INTENT locks
- CO_WRITE β Pair programming mode; multiple agents can write collaboratively
βββββββββββ
β QUEUED β Task created, waiting for agent to claim
ββββββ¬βββββ
β
β
βββββββββββ
β CLAIMED β Agent has accepted the task
ββββββ¬βββββ
β
β
βββββββββββ
β WORKING β Agent is executing the task
ββββββ¬βββββ
β
+ββββββββββββββββββββββββββ
β β
ββββββββββββ ββββββββββββ
βCOMPLETED β β FAILED β
ββββββββββββ ββββββββββββ
β
βββ¬βββββββββββββββββββββββ
β β
ββββββββββββββββ βββββββββββββββ
β ABANDONED β β PAUSED * β
ββββββββββββββββ βββββββββββββββ
* PAUSED: Not fully implemented yet (reserved for future use)
Each agent declares its resource needs (VRAM, RAM). The server tracks allocation:
- Allocation Request β Agent requests GPU/RAM; server checks available capacity
- Grant or Deny β If capacity available, allocate. Otherwise reject with available resources
- Release β When agent disconnects or task completes, resources freed automatically
- Global Limits β All allocations checked against system-wide GPU/RAM limits (env-configurable)
- WebSocket Server β Listens on
ws://127.0.0.1:7700for agent connections - HTTP Server β Serves dashboard and provides REST API endpoints on
:7701 - Dashboard WebSocket β Separate connection on
:7702for real-time UI updates - State Management β Maintains authoritative state for agents, tasks, locks, and hardware
- Lock Arbitration β Implements lock request handling with conflict resolution
- Heartbeat Monitor β Tracks agent activity; auto-releases locks on timeout
- CLI Wrapper β Wraps any AI CLI tool for DevMesh integration
- Resource Declaration β Reports tool name, capabilities, and resource requirements
- Task Execution β Receives tasks via WebSocket, runs CLI tool with task prompt
- Lock Requests β Negotiates file locks with server before accessing files
- Structured Output β Parses tool output, captures stdout/stderr, reports results
- Real-Time UI β Live task list, agent status, lock visualization
- Task Command Center β Text input for broadcasting tasks to all agents
- Hardware Monitor β Graphs GPU/RAM usage over time
- Event Log β Raw stdout/stderr output and structured event stream
- Knowledge Base β RAG discoveries shared across agents
- Task Persistence β SQLite
taskstable with full task metadata - Agent Registry β Persistent record of connected agents, capabilities, resources
- Audit Logging β Every event (lock request, task completion, etc.) logged to
.devmesh/audit.jsonl - Thread-Safe Queue β Write queue prevents concurrent SQLite access issues
- Backup & Recovery β Audit log mirrored to both SQLite and JSONL for durability
- Centralized Settings β All environment variables and defaults in one place
- Tool Profiles β Command templates and capability declarations for each AI CLI tool
- Type Validation β Validates port ranges, file paths, resource limits on startup
- Environment Override β Any setting overrideable via
DEVMESH_*environment variables - Tool Detection β Lists all registered tools with their CLI commands and invoke modes
- Structured Output β Timestamps, log levels, module names in every message
- Color Coding β Different colors for DEBUG (blue), INFO (green), WARN (yellow), ERROR (red)
- File Output β Optional file logging (set
DEVMESH_LOG_FILE) - Readable Format β Easy to scan during development and debugging
- Exception Hierarchy β Base
DevMeshErrorwith specific subclasses for different scenarios - JSON Serialization β All errors convertible to JSON for dashboard/API responses
- Context Info β Each error includes relevant context for debugging
- Error Codes β Structured codes (e.g.,
TOOL_NOT_FOUND,LOCK_TIMEOUT) for programmatic handling
DevMesh enforces a set of rules to ensure safe multi-agent collaboration:
| # | Rule | Description |
|---|---|---|
| 1 | Framework Authority | First agent becomes ARCHITECT |
| 2 | No Task Assignment | Agents bid fairly; server arbitrates |
| 3 | Lock Hierarchy | INTENT β WRITE β READ with clear semantics |
| 4 | Heartbeat Obligation | Keep-alive signals or auto-release lock |
| 5 | Critic Requirement | Code review by second agent if flagged |
| 6 | Hardware Throttle | Respect GPU/RAM limits globally |
| 7 | Read Before Work | Non-ARCHITECT agents read framework first |
| 8 | Diff-Based Writes | Track file changes, prevent duplicates |
| 9 | Pub/Sub File Events | Real-time change notifications |
| 10 | Single Source of Truth | Server is authoritative state holder |
- β WebSocket Coordinator β Single source of truth for all agent activity, tasks, and locks
- β Live Dashboard β Real-time web UI with task tracking, agent monitoring, and lock visualization
- β Lock Management β READ/WRITE/INTENT/CO_WRITE semantics for safe collaboration between agents
- β Hardware Throttling β Global GPU/RAM limits enforced per each agent connection
- β Audit Logging β Complete event history persisted to SQLite and mirrored to JSONL
- β Configuration Management β Environment-based settings with validation and defaults
- β Structured Logging β Color-coded console output with optional file logging
- β Non-Interactive Mode β All tools run with auto-approval flags for autonomous operation
- β Multi-Tool Support β Works with 10+ different AI CLI tools via unified interface
These features are out of scope for the current release:
- PostgreSQL backend (SQLite is sufficient for most use cases)
- Kubernetes operator support (local orchestration is the focus)
- Slack/Discord bot notifications
- Git-based file versioning (can be added as a storage layer)
- Advanced performance profiling via Prometheus metrics
# Run all tests
pytest tests/ -v
# Run specific test file
pytest tests/test_core.py -v
# Run with coverage
pytest tests/ --cov=. --cov-report=term-missing# Create virtual environment
python -m venv venv
source venv/bin/activate # or `venv\Scripts\activate` on Windows
# Install dev dependencies
pip install -r requirements.txt
pip install pytest pytest-cov
# Start server in debug mode
DEVMESH_LOG_LEVEL=DEBUG python server.py# Terminal 1: Start server
python server.py
# Terminal 2: Connect a mock agent
python client_mock.py --model architect
# Terminal 3: Connect another agent
python client_mock.py --model agent1
# Terminal 4: Send tasks via dashboard at http://127.0.0.1:7701python check_tools.pyLists all AI CLI tools detected in your PATH and their versions.
MIT License β See LICENSE for details.
Contributions are welcome! Here's how to get started:
- Open an issue β Describe the feature or bug you want to fix
- Get feedback β Wait for maintainer feedback before large changes
- Check the Rulebook β Understand the 10 design principles in the rulebook
- Python 3.12+ β Use modern Python features (type hints, dataclasses, etc.)
- PEP 8 Compliance β Format code with
blackorautopep8 - Type Hints β All functions must have complete type annotations
- Docstrings β Document public functions and classes with docstrings
- Immutability β Prefer immutable data structures where possible
- Unit Tests β Write tests for all new functions in
tests/ - Integration Tests β Test interactions between components
- Coverage β Aim for 80%+ code coverage
- Run Before PR β Ensure all tests pass:
pytest tests/ -v
- README Updates β Reflect changes to user-facing features
- Inline Comments β Explain complex logic with comments
- Commit Messages β Use descriptive messages (e.g., "fix: resolve lock timeout in agent bridge")
- CHANGELOG β Update any breaking changes
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Commit with clear messages
- Push to your fork
- Open a PR with description of changes
- Address review feedback
- Merge when approved