2. Monorepo structure with four crates
Date: 2026-04-22
Status
Accepted
Context
Cerebro needs to support several use cases: building dashboards from the command line, exposing a library for other tools, integrating with OpenCode over MCP, and browsing project data in an interactive terminal UI.
Decision
Cerebro uses a Rust workspace with four crates:
- cerebro is the command-line tool and main binary.
- cerebro-core is the library crate holding shared types, traits, collectors, and queries.
- cerebro-mcp is the binary crate that exposes an MCP server for OpenCode.
- cerebro-tui is the binary crate with the Ratatui terminal UI for interactive browsing.
Consequences
Pros
- Clear separation between the command-line tool, library, MCP server, and terminal UI
- Other tools can reuse cerebro-core as a library
- Each crate can evolve independently
- The terminal UI shares types with the command-line tool, so both render data consistently
Cons
- The workspace adds build complexity
- More build artifacts to manage
Notes
See the crates/ directory for the actual structure.