Introduction to Opcode
Relevant source files
The following files were used as context for generating this wiki page:
Opcode is a comprehensive desktop application and toolkit designed to enhance the experience of using Anthropic's Claude Code CLI. Built using the Tauri 2 framework, it provides a graphical user interface (GUI) that bridges the gap between traditional command-line AI interactions and a visual development environment. Opcode allows developers to manage interactive Claude Code sessions, create and deploy specialized AI agents, track API usage costs, and integrate with Model Context Protocol (MCP) servers.
The system is architected to provide local-first security and process isolation, ensuring that AI-assisted development remains private and controlled. It supports advanced features such as session versioning through checkpoints, visual timelines, and a specialized "Web Server Mode" that enables access to Claude Code sessions via mobile devices and browsers.
Sources: README.md:16-25, web_server.design.md:5-10
Core Architecture
Opcode utilizes a cross-platform architecture combining a Rust-based backend with a React/TypeScript frontend. The backend manages low-level process spawning of the claude CLI binary and handles persistent storage via SQLite.
System Components and Data Flow
The application operates by wrapping the Claude Code CLI. In the standard desktop mode, communication between the frontend and the Claude binary occurs through Tauri's IPC (Inter-Process Communication). In "Web Server Mode," this is handled via an Axum-based REST API and WebSockets.
The diagram above illustrates how user requests from the UI travel through the Rust backend to execute the Claude CLI, with output being streamed back to the interface in real-time.
Sources: web_server.design.md:12-23, README.md:167-175, src-tauri/tauri.conf.json:1-15
Key Technologies
| Layer | Technology |
|---|---|
| Frontend | React 18, TypeScript, Vite 6, Tailwind CSS v4, shadcn/ui |
| Backend | Rust, Tauri 2, Axum (for Web Server Mode) |
| Database | SQLite (via rusqlite) |
| CLI Core | Claude Code CLI (Anthropic) |
Sources: README.md:167-175
CC Agents System
Opcode introduces "CC Agents," which are specialized AI wrappers built on top of Claude Code. Users can define custom system prompts, select specific models (Sonnet or Opus), and set default tasks for these agents to perform autonomously.
Agent Workflow and Orchestration
Agents often follow a multi-phase workflow by spawning specialized sub-agents. For instance, the Security Scanner and Unit Tests Bot use a task-spawn model to move through analysis, planning, execution, and verification phases.
As shown in the diagram, complex agents decompose a primary objective into discrete sub-tasks handled by specialized configurations.
Sources: cc_agents/unit-tests-bot.opcode.json:15-100, cc_agents/security-scanner.opcode.json:15-150
Pre-built Agents
- Git Commit Bot: Automates Git workflows using Conventional Commits.
- Security Scanner: Performs AI-powered SAST (Static Application Security Testing) based on OWASP Top 10 and CWE.
- Unit Tests Bot: Analyzes codebases to generate and verify unit tests, aiming for >80% coverage.
Sources: cc_agents/README.md:14-22
Session and Checkpoint Management
Opcode provides sophisticated session tracking that goes beyond the standard CLI history. It allows for "Checkpoints," which act as versions of a coding session.
Timeline Navigation
The application features a visual timeline where users can:
- Create Checkpoints: Save the current state of a conversation and project files.
- Instant Restore: Revert the environment to a previous checkpoint.
- Fork Sessions: Create new branching timelines from any historical point to explore alternative implementation paths.
Sources: README.md:72-78, src/components/ClaudeCodeSession.tsx:1060-1070
Interactive Communication Flow
Communication with the Claude process is handled through a streaming architecture to ensure real-time feedback.
Deployment Modes
Opcode supports two primary modes of operation:
1. Desktop Mode (Default)
The standard installation as a Tauri application. It uses native OS decorations and communicates with the Claude CLI installed on the local system path.
Sources: src-tauri/tauri.conf.json:10-25
2. Web Server Mode
A specialized mode where the Rust backend acts as an Axum web server. This allows mobile devices or remote browsers to connect to the developer's machine to interact with Claude Code.
- REST API: Manages session lifecycles and cancellations.
- WebSocket: Handles the low-latency streaming of terminal output to the browser.
- Security: Uses
--dangerously-skip-permissionsfor remote execution contexts.
Sources: web_server.design.md:30-41, web_server.design.md:154-160
Summary
Opcode serves as a high-level orchestration layer for Claude Code, transforming a CLI tool into a multi-faceted development platform. By combining process management, session versioning, and an extensible agent system, it provides developers with a visual "command center" for AI-assisted software engineering. Its architecture emphasizes local control while offering flexibility through its web-server capabilities and integration with the Model Context Protocol.