OpenCode Console is a high-performance, web-based observability and management interface designed specifically for the OpenCode AI coding agent. It transforms the terminal-native experience into a rich visual dashboard, providing real-time monitoring of agent "thought" processes, interactive file diffing, deep inspection of MCP (Model Context Protocol) tool calls, and multi-session management.
While OpenCode's terminal interface is powerful for developers comfortable with CLI tools, many scenarios benefit from a visual dashboard:
Monitor agent activity as it happens with a categorized, searchable event log:
Visualize the agent's reasoning process with expandable task hierarchies:
Review code changes with powerful diff visualization:
Debug and understand tool interactions with visual inspection:
Organize and navigate between coding sessions:
Maintain control over agent actions with approval workflows:
Fine-tune agent behavior without editing configuration files:
| Technology | Version | Purpose |
|---|---|---|
| Next.js | 15 (App Router) | React framework with server components |
| React | 19 | UI component library |
| Tailwind CSS | 3.4+ | Utility-first CSS framework |
| Shadcn/UI | Latest | Accessible component library |
| Lucide React | 0.400+ | Icon library |
| TanStack Query | 5.45+ | Data fetching and caching |
| Zustand | 4.5+ | Local UI state management |
| Technology | Version | Purpose |
|---|---|---|
| Bun | 1.1+ | JavaScript/TypeScript runtime |
| SQLite | Latest | Local database for session persistence |
| Drizzle ORM | 0.31+ | Type-safe database access |
| Socket.io | 4.7+ | Real-time WebSocket communication |
Before installing OpenCode Console, ensure you have:
OPENAI_API_KEY or relevant model provider keysThe fastest way to get started is using the initialization script:
# Clone the repository
git clone https://github.com/NocturnLabs/opencode-console.git
cd opencode-console
# Run the initialization script
./init.sh
# Open in browser
open http://localhost:3000
The init script will:
For more control over the installation process:
# Clone the repository
git clone https://github.com/NocturnLabs/opencode-console.git
cd opencode-console
# Navigate to the console app
cd apps/console
# Install dependencies
bun install
# Set up the database
bun run db:push
# Start the development server
bun run dev
Create a .env.local file in the apps/console directory:
# Database
DATABASE_URL="file:./sqlite.db"
# OpenCode Bridge
OPENCODE_BRIDGE_PORT=3001
OPENCODE_SOCKET_URL="ws://localhost:3001"
# Model Configuration (optional)
OPENAI_API_KEY="your-api-key"
ANTHROPIC_API_KEY="your-api-key"
opencode-console/
├── apps/
│ └── console/ # Next.js frontend application
│ ├── src/
│ │ ├── app/ # Next.js App Router pages
│ │ │ ├── globals.css
│ │ │ ├── layout.tsx
│ │ │ └── page.tsx
│ │ └── lib/ # Shared utilities
│ │ ├── db.ts # Database connection
│ │ └── schema.ts # Drizzle ORM schema
│ ├── drizzle.config.ts # Drizzle configuration
│ ├── next.config.js # Next.js configuration
│ ├── tailwind.config.js
│ └── package.json
├── packages/
│ └── bridge/ # OpenCode connector (planned)
├── scripts/
│ ├── run-autonomous.sh # Autonomous mode launcher
│ └── security-allowlist.json
├── feature_list.json # Feature tracking and test cases
├── app_spec.md # Project specification
└── init.sh # Quick start script
OpenCode Console uses SQLite with Drizzle ORM for local persistence. The schema supports session tracking, event logging, and file change management.
Stores coding session metadata:
export const sessions = sqliteTable('sessions', {
id: text('id').primaryKey(),
name: text('name').notNull(),
status: text('status').notNull(), // 'active', 'completed', 'failed'
createdAt: integer('created_at', { mode: 'timestamp' }).notNull(),
modelConfig: text('model_config', { mode: 'json' }).$type<{
provider: string;
model: string;
temperature: number;
}>(),
});
Logs all agent activity:
export const events = sqliteTable('events', {
id: text('id').primaryKey(),
sessionId: text('session_id').references(() => sessions.id).notNull(),
type: text('type').notNull(), // 'user', 'assistant', 'system', 'context', 'tool'
content: text('content').notNull(),
payload: text('payload', { mode: 'json' }),
timestamp: integer('timestamp', { mode: 'timestamp' }).notNull(),
});
Tracks file modifications by the agent:
export const fileChanges = sqliteTable('file_changes', {
id: text('id').primaryKey(),
sessionId: text('session_id').references(() => sessions.id).notNull(),
filePath: text('file_path').notNull(),
diff: text('diff').notNull(),
status: text('status').notNull(), // 'pending', 'applied', 'rejected'
});
Records Model Context Protocol tool invocations:
export const mcpCalls = sqliteTable('mcp_calls', {
id: text('id').primaryKey(),
eventId: text('event_id').references(() => events.id).notNull(),
serverName: text('server_name').notNull(),
method: text('method').notNull(),
params: text('params', { mode: 'json' }),
result: text('result', { mode: 'json' }),
durationMs: integer('duration_ms').notNull(),
});
| Endpoint | Method | Description |
|---|---|---|
/api/sessions | GET | List all sessions with pagination |
/api/sessions | POST | Create a new session |
/api/sessions/:id | GET | Get session details |
/api/sessions/:id/events | GET | Get event history for a session |
| Endpoint | Method | Description |
|---|---|---|
/api/agent/command | POST | Send user input to the agent |
/api/agent/approval | POST | Approve or reject a pending action |
/api/agent/status | GET | Get current agent state (idle, thinking, busy) |
| Endpoint | Method | Description |
|---|---|---|
/api/config | GET | Fetch current OpenCode configuration |
/api/config | PATCH | Update model or provider settings |
# Start development server with hot reload
bun run dev
# Build for production
bun run build
# Start production server
bun run start
# Run ESLint
bun run lint
# Database commands
bun run db:generate # Generate migration files
bun run db:push # Push schema changes to database
bun run db:migrate # Run migrations
bun run db:studio # Open Drizzle Studio GUI
Drizzle Studio provides a visual interface for database inspection:
cd apps/console
bun run db:studio
This opens a browser-based GUI for viewing and editing database contents.
The project uses Shadcn/UI for components. To add a new component:
# Install shadcn CLI (if not already installed)
bunx shadcn-ui@latest add button
# Or add multiple components
bunx shadcn-ui@latest add card dialog dropdown-menu
OpenCode Console is designed for high-performance operation:
| Metric | Target |
|---|---|
| Event Log Capacity | 10,000+ events per session without UI lag |
| Initial Load Time | < 1.5 seconds on local environment |
| Event Latency | < 200ms from OpenCode to Console display |
| Bridge Memory | < 100MB for the WebSocket bridge process |
The console connects to OpenCode via a WebSocket bridge that:
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ OpenCode │────▶│ Bridge │────▶│ Console │
│ (TUI) │◀────│ (WebSocket) │◀────│ (Web) │
└─────────────┘ └─────────────┘ └─────────────┘
OPENCODE_SOCKET_URL is correctly configured# Reset the database
rm apps/console/sqlite.db
bun run db:push
# Clear Next.js cache
rm -rf apps/console/.next
# Reinstall dependencies
rm -rf node_modules
bun install
The following features are planned for future releases:
This project follows autonomous development practices. All changes should be:
feature_list.jsonbun run devSee the LICENSE file in the repository for license information.