Your Agent's Best Handler.
Diana is the ultimate mission control for your AI agents. Just as every Agent 47 needs a Diana, every LLM needs a handler to manage directives (configuration), monitor results (outputs), and keep the budget in check (token calculation). It focuses on unified agent config management, at-a-glance token visibility, and fast in-app edits so you can adjust settings without juggling files.
Important
This project is under active development. Currently only macOS is tested and supported. Other platforms (Linux, Windows) have not been tested.
Important
Always select a project directory when starting an agent session.
Token metrics are tracked per project directory. Running multiple agents on the same project directory will cause conflicts and inaccurate metrics.
Best Practice: Use git worktree to create separate directories for parallel work on the same repository:
git worktree add ../my-project-feature feature-branchThis way, each agent operates in its own directory with isolated token tracking.
brew tap taotao7/diana
brew install --cask dianaThis installs Diana.app to your Applications folder.
If the tap is not available yet, you can install directly from this repo:
brew install --cask https://raw.githubusercontent.com/taotao7/Diana/v0.1.1/homebrew/Casks/diana.rbNote: Currently only Apple Silicon (ARM64) Macs are supported.
Download the latest DMG from GitHub Releases.
See the Build section below.
- Multi-tab terminal emulator for running AI agents (VT100/xterm via libvterm)
- Supports Claude Code, Codex, and OpenCode
- Automatic executable detection for agents installed via nvm, Volta, asdf, Cargo, or global npm
- Provider/model configuration switching with atomic file updates
- Real-time token usage monitoring with charts (Claude Code, Codex, OpenCode)
- Per-project token metrics tracking
- Config import/export for backup and sharing (includes Diana's own config files)
- Claude Code multi-profile configuration management
- OpenCode multi-profile configuration management
- Unified Agent Config panel with tab switching and fast in-app edits
- GitHub-style activity heatmap for token usage
- Double-click session tabs to rename
- MCP Marketplace - Browse and install MCP servers and skills from Smithery.ai
- Keyboard shortcuts - Quick panel toggles with Cmd+1/2/3/4
- Terminal clipboard - Text selection, copy (Cmd+C), and paste (Cmd+V) support
| Agent | Config Location | Format |
|---|---|---|
| Claude Code | settings.json (auto-detected) |
JSON |
| Codex | ~/.codex/config.toml |
TOML |
| OpenCode | ~/.config/opencode/opencode.json |
JSONC |
Providers/models can be entered directly in the configuration fields.
| Category | Technology | Purpose |
|---|---|---|
| Language | C++17 | Core implementation |
| Build System | CMake 3.20+ | Cross-platform build configuration |
| UI Framework | Dear ImGui (docking) | Immediate-mode GUI |
| Charting | ImPlot | Real-time data visualization |
| Windowing | GLFW 3.4 | Cross-platform window/input |
| Graphics | OpenGL 3.3+ | Hardware-accelerated rendering |
| Terminal | libvterm | VT100/xterm emulation |
| JSON | nlohmann/json 3.11.3 | Config parsing, JSONL processing |
| TOML | tomlplusplus 3.4.0 | Codex config parsing |
| File Dialog | nativefiledialog-extended | Native OS file dialogs |
| Testing | GoogleTest 1.14.0 | Unit testing framework |
- Xcode Command Line Tools
- CMake 3.20+
brew install cmake
xcode-select --install- GCC 9+ or Clang 10+
- CMake 3.20+
- OpenGL development libraries
- X11 or Wayland development libraries
# Ubuntu/Debian
sudo apt install build-essential cmake libgl1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-devAll dependencies are fetched automatically via CMake FetchContent.
mkdir build && cd build
# Release build (recommended)
cmake .. -DCMAKE_BUILD_TYPE=Release -DDIANA_BUILD_TESTS=OFF
make -j8
# Run
./dianacmake .. -DCMAKE_BUILD_TYPE=Release -DDIANA_BUILD_TESTS=ON
make -j8
./diana_testsCreate a distributable .app bundle and DMG:
./scripts/package-dmg.shOutput: build/Diana-<version>-<arch>.dmg
For distribution outside the App Store, code signing and notarization are required:
export CODESIGN_IDENTITY="Developer ID Application: Your Name (XXXXXXXXXX)"
export APPLE_ID="your@email.com"
export APPLE_TEAM_ID="XXXXXXXXXX"
export APPLE_APP_PASSWORD="xxxx-xxxx-xxxx-xxxx"
export VERSION="0.1.0"
./scripts/package-dmg.shGenerate an app-specific password at appleid.apple.com.
- Click "+" to create a terminal session
- Select agent type (Claude Code, Codex, OpenCode, Shell)
- Click "Start" to launch the agent
- Double-click a session tab to rename it
- Type in the input field and press Enter to send commands
- Click "Stop" to terminate the agent
- Select text with mouse drag, copy with Cmd+C, paste with Cmd+V
Diana automatically detects agent executables installed via:
- nvm:
~/.nvm/versions/node/*/bin/(prioritizes default version from~/.nvm/alias/default) - Volta:
~/.volta/bin/ - asdf:
~/.asdf/shims/ - Cargo:
~/.cargo/bin/ - npm global:
~/.npm-global/bin/,~/.local/bin/ - Homebrew:
/opt/homebrew/bin/,/usr/local/bin/
- Multi-profile configuration management
- Create, edit, rename, delete profiles
- Import current config from
settings.json - Radio button to activate profile (syncs to
settings.json) - Full config editing: model, env vars, permissions, sandbox, attribution
- Multi-profile configuration management
- Create, edit, rename, delete profiles
- Import current config from
opencode.json - Radio button to activate profile (syncs to
opencode.json) - Full config editing:
- Basic: model, small_model, theme, default_agent, instructions
- Providers: API keys, base URLs, custom models with full configuration (name, limits, modalities, variants)
- Agents: custom agents with model, prompt, tool restrictions
- Tools: enable/disable individual tools
- Permissions: per-tool approval settings (ask/allow)
- MCP Servers: local and remote MCP server configuration
- TUI: scroll speed, acceleration, diff style
- Advanced: share mode, auto-update, compaction, watcher ignore, plugins
The Agent Config panel provides unified access to both Claude Code and OpenCode configuration with tab switching at the top of the panel.
- Monitors token usage from Claude JSONL logs (projects/transcripts) and OpenCode storage (
$XDG_DATA_HOME/opencode/storage/message/) - Displays real-time rates (tok/sec, tok/min)
- Shows cumulative totals and costs
- Bar chart visualization of token rate over last 60 seconds
- Per-session scope selector
- Aggregates token usage per agent type (Claude Code, Codex, OpenCode)
- Scans Claude Code project/transcript logs and
$XDG_DATA_HOME/opencode/storage/message/(fallback:~/.local/share/opencode/storage/message/) - Displays total tokens, cost, and token breakdown (input/output/cache)
- Session list with subagent detection
- GitHub-style activity heatmap (last 365 days)
- Browse and install MCP servers and skills from Smithery.ai
- Search by keyword with paginated results
- View server/skill details: verification status, use count, stars, forks
- Install MCP servers to Claude Code or Codex with one click
- Install skills to Claude Code
- View and manage installed MCPs and skills
- Terminal-based install output for debugging
- Configure Smithery API key for authenticated access
| Shortcut | Action |
|---|---|
| Cmd+1 | Toggle Terminal Panel |
| Cmd+2 | Toggle Agent Config Panel |
| Cmd+3 | Toggle Token Metrics Panel |
| Cmd+4 | Toggle Agent Token Stats Panel |
| Cmd+C | Copy selected terminal text |
| Cmd+V | Paste into terminal |
diana/
├── CMakeLists.txt
├── src/
│ ├── main.cpp # Entry point, GLFW/OpenGL setup
│ ├── app/
│ │ ├── app_shell.h/cpp # Main application orchestrator
│ │ └── dockspace.h/cpp # ImGui docking layout manager
│ ├── core/
│ │ ├── types.h # Shared enums (AppKind)
│ │ ├── event_queue.h # Thread-safe lock-free event queue
│ │ └── session_events.h # Event type definitions
│ ├── terminal/
│ │ ├── vterminal.h/cpp # libvterm wrapper (VT100/xterm)
│ │ ├── terminal_session.h/cpp # Per-tab session state machine
│ │ └── terminal_panel.h/cpp # Multi-tab terminal UI
│ ├── process/
│ │ ├── process_runner.h/cpp # PTY/fork process spawning (POSIX)
│ │ └── session_controller.h/cpp # Agent lifecycle management
│ ├── adapters/
│ │ ├── app_adapter.h # Abstract adapter interface
│ │ ├── claude_code_adapter.h/cpp # Claude Code settings.json
│ │ ├── claude_code_config.h/cpp # Full Claude Code config struct
│ │ ├── claude_profile_store.h/cpp# Multi-profile CRUD operations
│ │ ├── codex_adapter.h/cpp # Codex config.toml
│ │ ├── opencode_adapter.h/cpp # OpenCode config adapter
│ │ ├── opencode_config.h/cpp # Full OpenCode config struct
│ │ ├── opencode_profile_store.h/cpp # OpenCode multi-profile CRUD
│ │ ├── config_manager.h/cpp # Unified config access facade
│ │ ├── config_exporter.h/cpp # JSON export/import utilities
│ │ └── marketplace_settings.h/cpp # Smithery API key storage
│ ├── marketplace/
│ │ ├── marketplace_panel.h/cpp # MCP/Skill browser UI
│ │ ├── marketplace_client.h/cpp # Smithery API client
│ │ └── marketplace_types.h # MCP/Skill data structures
│ ├── metrics/
│ │ ├── metrics_store.h/cpp # Token metrics with EMA smoothing
│ │ ├── multi_metrics_store.h/cpp # Per-project metrics hub
│ │ ├── claude_usage_collector.h/cpp # Claude JSONL file watcher
│ │ ├── codex_usage_collector.h/cpp # Codex log parser
│ │ ├── opencode_usage_collector.h/cpp # OpenCode storage parser
│ │ └── agent_token_store.h/cpp # Per-agent token aggregation
│ └── ui/
│ ├── theme.h/cpp # Catppuccin theme + system detection
│ ├── theme_macos.mm # macOS appearance bridge
│ ├── claude_code_panel.h/cpp # Claude Code profile list + config editor
│ ├── opencode_panel.h/cpp # OpenCode profile list + config editor
│ ├── agent_config_panel.h/cpp # Unified tab panel for agent configs
│ ├── metrics_panel.h/cpp # Real-time token charts
│ └── agent_token_panel.h/cpp # Agent stats + heatmap
├── tests/
│ ├── test_main.cpp
│ ├── core/test_event_queue.cpp
│ ├── metrics/
│ │ ├── test_metrics_store.cpp
│ │ ├── test_multi_metrics_store.cpp
│ │ ├── test_agent_token_store.cpp
│ │ └── test_claude_usage_collector.cpp
│ └── adapters/
│ ├── test_config_exporter.cpp
│ ├── test_opencode_config.cpp
│ └── test_opencode_profile_store.cpp
├── packaging/
│ ├── Info.plist.in # macOS bundle metadata
│ └── entitlements.plist # macOS signing entitlements
├── scripts/
│ ├── package-dmg.sh # DMG packaging
│ └── generate-appicon.sh # App icon generator
├── third_party/
│ └── libvterm/ # Vendored terminal emulation library
└── resources/
└── fonts/
├── IoskeleyMono-*.ttf # Primary UI font family
└── unifont.otf # Unicode fallback
┌──────────────────────────────────────────────────────────────────────┐
│ AppShell │
│ ┌───────────────────┐ ┌─────────────────┐ ┌─────────────────────┐ │
│ │ AgentConfigPanel │ │ TerminalPanel │ │ MetricsPanel │ │
│ │ (Claude+OpenCode) │ │ (Multi-tab) │ │ AgentTokenPanel │ │
│ │ MarketplacePanel │ │ │ │ │ │
│ └────────┬──────────┘ └────────┬────────┘ └──────────┬──────────┘ │
└───────────┼──────────────────────┼──────────────────────┼────────────┘
│ │ │
▼ ▼ ▼
┌────────────────────┐ ┌──────────────────┐ ┌─────────────────────────────┐
│ ProfileStore │ │ SessionController│ │ ClaudeUsageCollector │
│ (Claude+OpenCode) │ │ ProcessRunner │ │ CodexUsageCollector │
│ ConfigManager │ │ VTerminal │ │ OpenCodeUsageCollector │
│ ConfigExporter │ └────────┬─────────┘ │ MultiMetricsStore │
│ MarketplaceClient │ │ │ AgentTokenStore │
└─────────┬──────────┘ │ └───────────┬─────────────────┘
│ │ │
▼ ▼ ▼
~/.claude/ PTY/fork Claude Code logs
~/.config/opencode/ subprocess $XDG_DATA_HOME/opencode/storage/
~/.config/diana/
┌─────────────────┐
│ User Input │
└────────┬────────┘
│
▼
┌────────────────────────────────────────────────────────────┐
│ TerminalPanel │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Tab 1 │ │ Tab 2 │ │ Tab N │ │
│ │ Session │ │ Session │ │ Session │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
└───────┼─────────────┼─────────────┼────────────────────────┘
│ │ │
└─────────────┼─────────────┘
▼
┌─────────────────┐
│SessionController│
└────────┬────────┘
│
┌────────────┼────────────┐
▼ ▼ ▼
┌───────────┐ ┌───────────┐ ┌───────────┐
│ProcessRun │ │ VTerminal │ │ AppAdapter│
│ (PTY) │ │ (libvterm)│ │ (config) │
└─────┬─────┘ └─────┬─────┘ └─────┬─────┘
│ │ │
▼ ▼ ▼
Agent Screen Config
Process Buffer Files
Claude Code JSONL logs (projects/transcripts)
Codex logs (~/.codex/*)
$XDG_DATA_HOME/opencode/storage/{project,session,message}/
│
├─────────────────────────────┐
▼ ▼
┌────────────────────────────┐ ┌───────────────────┐
│ ClaudeUsageCollector │ │ AgentTokenStore │
│ CodexUsageCollector │ │ (Claude+Codex+ │
│ OpenCodeUsageCollector │ │ OpenCode) │
└───────────┬────────────────┘ └──────────┬────────┘
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────┐
│MultiMetricsStore│ │ AgentTokenPanel │
└────────┬────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ MetricsPanel │
└─────────────────┘
The project includes 87 unit tests covering core functionality:
./diana_tests| Test Suite | Tests | Coverage |
|---|---|---|
| EventQueueTest | 5 | Thread-safe queue operations |
| MetricsStoreTest | 5 | Token aggregation, EMA rates |
| MultiMetricsStoreTest | 7 | Per-project storage |
| AgentTokenStoreTest | 10 | JSONL parsing, session tracking |
| ClaudeUsageCollectorTest | 12 | File watching, incremental parsing |
| ConfigExporterTest | 5 | JSON export/import |
| OpenCodeConfigTest | 25 | OpenCode JSON serialization, empty field handling |
| OpenCodeProfileTest | 1 | Profile serialization |
| OpenCodeProfileStoreTest | 8 | Profile store operations |
| OpenCodeProfileStoreIntegrationTest | 6 | CRUD integration tests |
| AgentTokenUsageTest | 1 | Token calculation |
| DailyTokenDataTest | 1 | Date formatting |
| AgentTypeNameTest | 1 | Enum to string |
- Claude Code Skill/MCP marketplace browser
- OpenCode configuration panel (similar to Claude Code)
- Codex configuration panel (similar to Claude Code)
- Agent token stats panel with per-agent aggregation
- Per-project token metrics tracking
- GitHub-style activity heatmap
- Session history and replay
- Cost estimation and budget alerts
- Linux/Windows support
All dependencies are fetched automatically via CMake FetchContent:
| Dependency | Version | Purpose |
|---|---|---|
| Dear ImGui | docking branch | Immediate-mode GUI framework |
| GLFW | 3.4 | Cross-platform windowing |
| ImPlot | master | Real-time plotting |
| nlohmann/json | 3.11.3 | JSON/JSONL parsing |
| tomlplusplus | 3.4.0 | TOML config parsing |
| nativefiledialog-extended | 1.2.1 | Native file dialogs |
| GoogleTest | 1.14.0 | Unit testing (optional) |
Vendored:
- libvterm (in
third_party/libvterm/) - Terminal emulation
Diana loads all .ttf, .otf, and .ttc files from resources/fonts at startup and merges them into a single ImGui font atlas. unifont.otf (GNU Unifont) is used as the Unicode fallback, while the first face with Regular in its filename (for example IoskeleyMono-Regular.ttf) becomes the primary UI font. Add or replace fonts in that folder to customize the UI without code changes.
MIT