This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
OpenCow is a Mac desktop client built with Electron and React for visually managing multiple Claude Code sessions and tasks.
Core problem: When developers run multiple Claude Code tasks across several terminals simultaneously, there is no easy way to get a quick overview of each task's status and progress. OpenCow solves this by providing a unified dashboard for monitoring and managing all active Claude Code sessions.
| Layer | Choice |
|---|---|
| Desktop | Electron (latest stable) |
| UI | React 19, functional components + hooks |
| Language | TypeScript strict mode |
| Styling | Tailwind CSS |
| State Management | Zustand |
| Build | Vite (electron-vite) + electron-builder |
| Testing | Vitest + React Testing Library |
- Monitor (MVP): Read-only mode -- displays Claude Code sessions, tasks, and their statuses.
- Command (future): Issue tasks, create/resume sessions directly from OpenCow.
The Monitor phase MUST NOT be blocked by design decisions intended for the Command phase.
OpenCow integrates with Claude Code through official interfaces only (MUST NOT modify Claude Code internals):
- Hooks: Register hooks via
settings.jsonto listen forSessionStart,Stop,TaskCompleted,Notification, and other events, receiving JSON on stdin. - CLI: Use
claude -p --output-format jsonto programmatically query session state. - File system watching: Watch
~/.claude/tasks/(task state) and~/.claude/projects/(session memory). - MCP: OpenCow runs a local MCP server to receive status updates pushed by Claude Code.
contextIsolation: true(must be enabled)nodeIntegration: false(disabled in the renderer process)- Main and Renderer processes communicate via typed, validated IPC channels
- File system access is restricted to
~/.claude/and directories the user explicitly opens
# Install dependencies
pnpm install
# Development mode (Vite HMR + Electron)
pnpm dev
# Type checking
pnpm typecheck # Run both node and web type checks
pnpm typecheck:node # Main process only
pnpm typecheck:web # Renderer process only
# Lint
pnpm lint
# Format
pnpm format
# Testing
pnpm test # Run all tests
pnpm test:watch # Watch mode
npx vitest run <file> # Run a single test file
# Build
pnpm build # Build the renderer process
pnpm package # Package the Electron .app (unsigned, directory output)
pnpm package:dmg # Package as .dmg- TypeScript strict mode; zero
anyusage - Component files use PascalCase (
TaskCard.tsx); utility files use camelCase (parseHookEvent.ts) - Prefer functional components with hooks; avoid class components
- Prefer Tailwind utility classes for styling
- Follow the Conventional Commits format for commit messages
- Modules that handle Claude Code data (hook payloads, CLI JSON, task file parsing) MUST have type definitions and unit tests
tsc --noEmit-- zero errors- ESLint -- zero warnings
- Prettier -- consistent formatting
- Vitest -- all tests pass; new modules MUST include tests
- UI components MUST have
aria-labelor semantic HTML and support keyboard navigation - Respect
prefers-reduced-motionandprefers-color-scheme - WCAG 2.1 AA compliance
- When producing plans, analyses, or design documents, generate
.mdfiles for traceability. - Start each document with a concise summary of the core idea before expanding into details.
- For flowcharts and architecture diagrams, prefer Mermaid syntax.
- Entry/exit transitions should feel natural and intentional.
- Dialog, Popover, Tooltip, and Toast components must include animations, and animations of the same type must be consistent across the application.
IMPORTANT: This project has a knowledge graph. ALWAYS use the code-review-graph MCP tools BEFORE using Grep/Glob/Read to explore the codebase. The graph is faster, cheaper (fewer tokens), and gives you structural context (callers, dependents, test coverage) that file scanning cannot.
- Exploring code:
semantic_search_nodesorquery_graphinstead of Grep - Understanding impact:
get_impact_radiusinstead of manually tracing imports - Code review:
detect_changes+get_review_contextinstead of reading entire files - Finding relationships:
query_graphwith callers_of/callees_of/imports_of/tests_for - Architecture questions:
get_architecture_overview+list_communities
Fall back to Grep/Glob/Read only when the graph doesn't cover what you need.
| Tool | Use when |
|---|---|
detect_changes |
Reviewing code changes — gives risk-scored analysis |
get_review_context |
Need source snippets for review — token-efficient |
get_impact_radius |
Understanding blast radius of a change |
get_affected_flows |
Finding which execution paths are impacted |
query_graph |
Tracing callers, callees, imports, tests, dependencies |
semantic_search_nodes |
Finding functions/classes by name or keyword |
get_architecture_overview |
Understanding high-level codebase structure |
refactor_tool |
Planning renames, finding dead code |
- The graph auto-updates on file changes (via hooks).
- Use
detect_changesfor code review. - Use
get_affected_flowsto understand impact. - Use
query_graphpattern="tests_for" to check coverage.