|
| 1 | +# OpenCode Monitor — Project Memory |
| 2 | + |
| 3 | +## Project Identity |
| 4 | + |
| 5 | +**OpenCode Monitor** is a macOS desktop app for monitoring and interacting with OpenCode agents across multiple workspaces. It's a fork of [CodexMonitor](https://github.com/Dimillian/CodexMonitor), adapted to use OpenCode's protocol instead of Codex. |
| 6 | + |
| 7 | +## Tech Stack |
| 8 | + |
| 9 | +- **Frontend**: React 19 + Vite + TypeScript |
| 10 | +- **Backend**: Tauri 2 (Rust) |
| 11 | +- **Protocol**: Migrating from ACP (JSON-RPC over stdio) to REST API (`opencode serve`) |
| 12 | + |
| 13 | +## Architecture Invariants |
| 14 | + |
| 15 | +1. Frontend receives events in **same shape as original CodexMonitor** — all protocol translation happens in Rust |
| 16 | +2. Put shared/domain logic in `src-tauri/src/shared/*` first |
| 17 | +3. Keep app and daemon as thin adapters around shared cores |
| 18 | +4. Protocol translation is isolated to 3 Rust files for clean upstream merges |
| 19 | + |
| 20 | +## Key Files |
| 21 | + |
| 22 | +| Area | Primary Files | |
| 23 | +|------|--------------| |
| 24 | +| Protocol translation | `event_translator.rs`, `codex_core.rs`, `app_server.rs` | |
| 25 | +| Frontend composition | `src/App.tsx`, `src/services/tauri.ts`, `src/services/events.ts` | |
| 26 | +| Thread state | `useThreadsReducer.ts`, `threadReducer/*` | |
| 27 | +| Shared cores | `src-tauri/src/shared/*` | |
| 28 | + |
| 29 | +## Current Focus |
| 30 | + |
| 31 | +- REST API migration (from `opencode acp` to `opencode serve`) |
| 32 | +- Thread lifecycle and event handling polish |
| 33 | +- Token usage tracking and session management |
| 34 | + |
| 35 | +## Active Patterns |
| 36 | + |
| 37 | +- Event-driven architecture with single-listener fanout |
| 38 | +- Reducer composition for thread state |
| 39 | +- Workspace-scoped sessions |
| 40 | +- Import aliases: `@/*`, `@app/*`, `@threads/*`, `@services/*`, `@utils/*` |
| 41 | + |
| 42 | +## Recent Work (from git log) |
| 43 | + |
| 44 | +- Phantom session prevention and recency ordering |
| 45 | +- Token usage context window population |
| 46 | +- Question tool UI with submit/dismiss actions |
| 47 | +- Agent/model selection from REST API |
| 48 | +- Incremental SSE streaming |
| 49 | + |
| 50 | +--- |
| 51 | + |
| 52 | +*Last updated: Session initialization* |
0 commit comments