# bknorg/codebase-recall architecture

> Architecture diagram of the GitHub repository bknorg/codebase-recall, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bknorg/codebase-recall
- Repository: https://github.com/bknorg/codebase-recall

## Overview

codebase-recall is a developer CLI for producing LLM-ready code context and analyzing code relationships. Its main graph workflow parses project files, caches extracted entities, resolves relations, then answers queries or renders exports. The graph also captures the documented digest, impact, path, explain, report, search, and MCP capabilities. Some command internals were not sampled, so links for those branches follow documented responsibilities rather than inferred call chains.

Main entry points: [`src/commands/mod.rs`](https://github.com/bknorg/codebase-recall/blob/main/src/commands/mod.rs) (Command handlers), [`src/graph/query.rs`](https://github.com/bknorg/codebase-recall/blob/main/src/graph/query.rs) (Graph queries), [`src/cache/mod.rs`](https://github.com/bknorg/codebase-recall/blob/main/src/cache/mod.rs) (Graph cache), [`src/commands/sync.rs`](https://github.com/bknorg/codebase-recall/blob/main/src/commands/sync.rs) (Incremental sync)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and integrations"]
  node_cli_entry["CLI entry<br/>[main.rs]"]
  node_commands["Command handlers<br/>[mod.rs]"]
  node_mcp["MCP interface<br/>[mod.rs]"]
  node_setup["Agent setup<br/>[setup.rs]"]
end

subgraph group_index["Project indexing"]
  node_service["Sync service<br/>[service.rs]"]
  node_sync["Incremental sync<br/>[sync.rs]"]
  node_analysis["Language parsers<br/>[mod.rs]"]
  node_precise["Precise resolution<br/>[mod.rs]"]
  node_cache[("Graph cache<br/>[mod.rs]")]
end

subgraph group_graph["Relation graph"]
  node_graph_build["Graph resolution<br/>[mod.rs]"]
  node_graph_model["Relation graph<br/>[mod.rs]"]
  node_graph_query["Graph queries<br/>[query.rs]"]
  node_render["Graph renderers<br/>[mod.rs]"]
end

subgraph group_analysis["Codebase analysis"]
  node_digest["Architecture digest<br/>[mod.rs]"]
  node_impact["Impact analysis<br/>[mod.rs]"]
  node_path["Relation path<br/>[path.rs]"]
  node_explain["Symbol explain<br/>[mod.rs]"]
  node_report["Architecture report<br/>[report.rs]"]
  node_search["Code search<br/>[search.rs]"]
end

subgraph group_delivery["Context and visualization"]
  node_dump["Context dump<br/>[dump.rs]"]
  node_dump_format["Dump formatting<br/>[mod.rs]"]
  node_serve["Browser server<br/>[mod.rs]"]
end

node_developer(("Developer"))
node_agent(("AI agent"))
node_browser(("Browser viewer"))

node_developer -->|"runs commands"| node_cli_entry
node_cli_entry -->|"dispatches"| node_commands
node_commands -->|"requests sync"| node_service
node_service -->|"invokes sync"| node_sync
node_sync -->|"parses files"| node_analysis
node_sync -->|"updates cache"| node_cache
node_sync -.->|"resolves references"| node_precise
node_precise -->|"updates relations"| node_cache
node_service -->|"uses cache"| node_cache
node_commands -->|"builds relations"| node_graph_build
node_graph_build -->|"reads entities"| node_cache
node_graph_build -->|"produces graph"| node_graph_model
node_commands -->|"queries graph"| node_graph_query
node_graph_query -->|"reads graph"| node_graph_model
node_commands -->|"exports graph"| node_render
node_render -->|"renders graph"| node_graph_model
node_commands -->|"generates context"| node_dump
node_dump -->|"selects neighborhood"| node_graph_query
node_dump -->|"formats files"| node_dump_format
node_commands -->|"generates digest"| node_digest
node_digest -->|"queries structure"| node_graph_query
node_commands -->|"analyzes changes"| node_impact
node_impact -->|"traverses relations"| node_graph_query
node_commands -->|"finds connection"| node_path
node_path -->|"traverses relations"| node_graph_query
node_commands -->|"explains symbol"| node_explain
node_explain -->|"queries symbol"| node_graph_query
node_commands -->|"builds report"| node_report
node_report -->|"analyzes graph"| node_graph_query
node_commands -->|"searches code"| node_search
node_search -->|"searches symbols"| node_cache
node_commands -->|"starts viewer"| node_serve
node_serve -->|"serves graph"| node_browser
node_browser -->|"requests actions"| node_serve
node_serve -->|"runs dump"| node_dump
node_agent -->|"sends tool requests"| node_mcp
node_mcp -->|"dispatches tools"| node_commands
node_developer -->|"configures integration"| node_setup

click node_cli_entry "https://github.com/bknorg/codebase-recall/blob/main/src/main.rs"
click node_commands "https://github.com/bknorg/codebase-recall/blob/main/src/commands/mod.rs"
click node_mcp "https://github.com/bknorg/codebase-recall/blob/main/src/commands/mcp/mod.rs"
click node_setup "https://github.com/bknorg/codebase-recall/blob/main/src/commands/setup.rs"
click node_service "https://github.com/bknorg/codebase-recall/blob/main/src/service.rs"
click node_sync "https://github.com/bknorg/codebase-recall/blob/main/src/commands/sync.rs"
click node_analysis "https://github.com/bknorg/codebase-recall/blob/main/src/analysis/mod.rs"
click node_precise "https://github.com/bknorg/codebase-recall/blob/main/src/precise/mod.rs"
click node_cache "https://github.com/bknorg/codebase-recall/blob/main/src/cache/mod.rs"
click node_graph_build "https://github.com/bknorg/codebase-recall/blob/main/src/graph/resolve/mod.rs"
click node_graph_model "https://github.com/bknorg/codebase-recall/blob/main/src/graph/mod.rs"
click node_graph_query "https://github.com/bknorg/codebase-recall/blob/main/src/graph/query.rs"
click node_render "https://github.com/bknorg/codebase-recall/blob/main/src/graph/render/mod.rs"
click node_dump "https://github.com/bknorg/codebase-recall/blob/main/src/commands/dump.rs"
click node_dump_format "https://github.com/bknorg/codebase-recall/blob/main/src/dump/mod.rs"
click node_digest "https://github.com/bknorg/codebase-recall/blob/main/src/commands/digest/mod.rs"
click node_impact "https://github.com/bknorg/codebase-recall/blob/main/src/commands/impact/mod.rs"
click node_path "https://github.com/bknorg/codebase-recall/blob/main/src/commands/path.rs"
click node_explain "https://github.com/bknorg/codebase-recall/blob/main/src/commands/explain/mod.rs"
click node_report "https://github.com/bknorg/codebase-recall/blob/main/src/commands/report.rs"
click node_search "https://github.com/bknorg/codebase-recall/blob/main/src/commands/search.rs"
click node_serve "https://github.com/bknorg/codebase-recall/blob/main/src/server/mod.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli_entry,node_commands,node_mcp,node_setup,node_browser toneBlue
class node_service,node_sync,node_analysis,node_precise,node_cache toneAmber
class node_graph_build,node_graph_model,node_graph_query,node_render toneMint
class node_digest,node_impact,node_path,node_explain,node_report,node_search toneRose
class node_dump,node_dump_format,node_serve,node_developer,node_agent toneIndigo
```

## Components

### CLI and integrations

- [CLI entry](https://github.com/bknorg/codebase-recall/blob/main/src/main.rs): `src/main.rs`
- [Command handlers](https://github.com/bknorg/codebase-recall/blob/main/src/commands/mod.rs): `src/commands/mod.rs`
- [MCP interface](https://github.com/bknorg/codebase-recall/blob/main/src/commands/mcp/mod.rs): `src/commands/mcp/mod.rs`
- [Agent setup](https://github.com/bknorg/codebase-recall/blob/main/src/commands/setup.rs): `src/commands/setup.rs`

### Project indexing

- [Sync service](https://github.com/bknorg/codebase-recall/blob/main/src/service.rs): `src/service.rs`
- [Incremental sync](https://github.com/bknorg/codebase-recall/blob/main/src/commands/sync.rs): `src/commands/sync.rs`
- [Language parsers](https://github.com/bknorg/codebase-recall/blob/main/src/analysis/mod.rs): `src/analysis/mod.rs`
- [Precise resolution](https://github.com/bknorg/codebase-recall/blob/main/src/precise/mod.rs): `src/precise/mod.rs`
- [Graph cache](https://github.com/bknorg/codebase-recall/blob/main/src/cache/mod.rs): `src/cache/mod.rs`

### Relation graph

- [Graph resolution](https://github.com/bknorg/codebase-recall/blob/main/src/graph/resolve/mod.rs): `src/graph/resolve/mod.rs`
- [Relation graph](https://github.com/bknorg/codebase-recall/blob/main/src/graph/mod.rs): `src/graph/mod.rs`
- [Graph queries](https://github.com/bknorg/codebase-recall/blob/main/src/graph/query.rs): `src/graph/query.rs`
- [Graph renderers](https://github.com/bknorg/codebase-recall/blob/main/src/graph/render/mod.rs): `src/graph/render/mod.rs`

### Codebase analysis

- [Architecture digest](https://github.com/bknorg/codebase-recall/blob/main/src/commands/digest/mod.rs): `src/commands/digest/mod.rs`
- [Impact analysis](https://github.com/bknorg/codebase-recall/blob/main/src/commands/impact/mod.rs): `src/commands/impact/mod.rs`
- [Relation path](https://github.com/bknorg/codebase-recall/blob/main/src/commands/path.rs): `src/commands/path.rs`
- [Symbol explain](https://github.com/bknorg/codebase-recall/blob/main/src/commands/explain/mod.rs): `src/commands/explain/mod.rs`
- [Architecture report](https://github.com/bknorg/codebase-recall/blob/main/src/commands/report.rs): `src/commands/report.rs`
- [Code search](https://github.com/bknorg/codebase-recall/blob/main/src/commands/search.rs): `src/commands/search.rs`

### Context and visualization

- [Context dump](https://github.com/bknorg/codebase-recall/blob/main/src/commands/dump.rs): `src/commands/dump.rs`
- [Dump formatting](https://github.com/bknorg/codebase-recall/blob/main/src/dump/mod.rs): `src/dump/mod.rs`
- [Browser server](https://github.com/bknorg/codebase-recall/blob/main/src/server/mod.rs): `src/server/mod.rs`

### Other components

- **Developer**
- **AI agent**
- **Browser viewer**

## Connections

- Developer → CLI entry: runs commands
- CLI entry → Command handlers: dispatches
- Command handlers → Sync service: requests sync
- Sync service → Incremental sync: invokes sync
- Incremental sync → Language parsers: parses files
- Incremental sync → Graph cache: updates cache
- Incremental sync → Precise resolution: resolves references
- Precise resolution → Graph cache: updates relations
- Sync service → Graph cache: uses cache
- Command handlers → Graph resolution: builds relations
- Graph resolution → Graph cache: reads entities
- Graph resolution → Relation graph: produces graph
- Command handlers → Graph queries: queries graph
- Graph queries → Relation graph: reads graph
- Command handlers → Graph renderers: exports graph
- Graph renderers → Relation graph: renders graph
- Command handlers → Context dump: generates context
- Context dump → Graph queries: selects neighborhood
- Context dump → Dump formatting: formats files
- Command handlers → Architecture digest: generates digest
- Architecture digest → Graph queries: queries structure
- Command handlers → Impact analysis: analyzes changes
- Impact analysis → Graph queries: traverses relations
- Command handlers → Relation path: finds connection
- Relation path → Graph queries: traverses relations
- Command handlers → Symbol explain: explains symbol
- Symbol explain → Graph queries: queries symbol
- Command handlers → Architecture report: builds report
- Architecture report → Graph queries: analyzes graph
- Command handlers → Code search: searches code
- Code search → Graph cache: searches symbols
- Command handlers → Browser server: starts viewer
- Browser server → Browser viewer: serves graph
- Browser viewer → Browser server: requests actions
- Browser server → Context dump: runs dump
- AI agent → MCP interface: sends tool requests
- MCP interface → Command handlers: dispatches tools
- Developer → Agent setup: configures integration
