Architecture diagrams
Architectural diagrams for cerebro, following the C4 model and Simon Brown’s diagramming principles.
Created with D2. Source files live in diagrams/assets/current/.
For standalone SVG generation, such as for sharing, run just diagrams.
Current architecture
System context, C4 level 1
Shows cerebro, the developer, external systems such as git repos and the OpenCode DB, the cortex data directory, and AI agents connected via MCP.
Note: mdbook is an implementation detail of cortex, rendering
content/tobook/, not a consumer. The real consumers are AI agents, such as OpenCode and Pi, via the MCP server, and the developer via the Terminal User Interface.
Source: diagrams/assets/current/01-system-context.d2
Data flow pipeline
4-phase pipeline: scrape, process, store, consume. Shows how data flows from external sources through collectors and generators into the cortex, then to consumers, including AI agents via MCP and the Terminal User Interface.
Source: diagrams/assets/current/02-data-flow.d2
Component structure, C4 level 3
Crate-level overview with module detail layers.
| Layer | Description |
|---|---|
| Crate Overview | 4 crates + cross-crate dependencies |
| cerebro modules | Command-line tool binary module structure |
| cerebro-core modules | Shared types library |
| cerebro-mcp modules | MCP server module structure |
| cerebro-tui modules | Terminal User Interface binary module structure |
Source: diagrams/assets/current/03-components.d2
Type model
Core types from cerebro-core and their relationships.
Source: diagrams/assets/current/04-data-model.d2
Diagram conventions
All diagrams follow Simon Brown’s principles:
- Title: “Diagram Type: Scope” on every diagram
- Legend: Explains shapes, colors, line styles
- Directional arrows: One-way only, with specific labels
- Explicit types:
[Person],[Software System],[Container],[Component] - Stand-alone: Makes sense without a presenter
All diagrams import nord-config.d2 for consistent Nord dark theming via D2’s theme-overrides system.