# gvsambhu/codeograph architecture

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

- Interactive diagram: https://gitdiagram.com/gvsambhu/codeograph
- Repository: https://github.com/gvsambhu/codeograph

## Overview

Codeograph acquires a Java/Spring corpus and produces a deterministic, metrics-bearing graph and run manifest. Its principal workflow continues with optional advisory LLM enrichment; a separate render command uses prior run artefacts to generate NestJS source and a project scaffold. The README also documents evaluation, cache management, and telemetry. Some pipeline links below are documented at product level rather than verified in sampled orchestration code; those links are dashed where their exact caller is unverified.

Main entry points: [`codeograph/cli/main.py`](https://github.com/gvsambhu/codeograph/blob/main/codeograph/cli/main.py) (CLI commands), [`codeograph/analyzer/llm_corpus_enricher.py`](https://github.com/gvsambhu/codeograph/blob/main/codeograph/analyzer/llm_corpus_enricher.py) (Enrichment orchestrator), [`codeograph/cli/render_pipeline.py`](https://github.com/gvsambhu/codeograph/blob/main/codeograph/cli/render_pipeline.py) (Render orchestration), [`codeograph/manifest/assembler.py`](https://github.com/gvsambhu/codeograph/blob/main/codeograph/manifest/assembler.py) (Run manifest)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["Corpus acquisition"]
  node_acquire["Input acquisition<br/>[input_acquirer.py]"]
  node_discover["Source discovery"]
end

subgraph group_analysis["Deterministic analysis"]
  node_parse["Parser dispatch"]
  node_java["Java AST parser"]
  node_fallback["Regex fallback<br/>[regex_fallback.py]"]
  node_analyzer["Corpus analyzer<br/>[corpus_analyzer.py]"]
  node_builder["Graph builder<br/>[graph_builder.py]"]
  node_assembler["Graph assembler<br/>[graph_assembler.py]"]
  node_schema["Graph schema<br/>[graph_schema.py]"]
  node_writer["Graph writer<br/>[graph_writer.py]"]
end

subgraph group_enrichment["LLM enrichment"]
  node_enricher["Enrichment orchestrator"]
  node_pass1["Node annotation<br/>[node_annotator.py]"]
  node_pass2["Corpus synthesis"]
  node_llm["Provider stack<br/>[resolver.py]"]
  node_cache[("SQLite response cache<br/>[sqlite_backend.py]")]
end

subgraph group_rendering["Rendering"]
  node_render_pipeline["Render orchestration<br/>[render_pipeline.py]"]
  node_selection["Class selection<br/>[class_selector.py]"]
  node_registry["Renderer registry"]
  node_nestjs["NestJS renderer"]
  node_scaffold["Project scaffold"]
end

subgraph group_operations["Run operations"]
  node_manifest["Run manifest<br/>[assembler.py]"]
  node_telemetry["LLM telemetry<br/>[session_manager.py]"]
  node_eval["Evaluation framework<br/>[runner.py]"]
  node_settings["Configuration<br/>[settings.py]"]
end

node_engineer(("Engineer"))
node_cli["CLI commands<br/>[main.py]"]

node_engineer -->|"runs commands"| node_cli
node_cli -->|"acquires input"| node_acquire
node_acquire -.->|"discovers sources"| node_discover
node_discover -.->|"provides files"| node_parse
node_parse -->|"tries AST"| node_java
node_parse -->|"falls back"| node_fallback
node_cli -->|"runs analysis"| node_analyzer
node_analyzer -.->|"builds graph"| node_builder
node_builder -.->|"assembles graph"| node_assembler
node_assembler -->|"validates against"| node_schema
node_cli -->|"writes artefacts"| node_writer
node_writer -.->|"records run"| node_manifest
node_cli -->|"assembles manifest"| node_manifest
node_cli -.->|"starts enrichment"| node_enricher
node_enricher -->|"starts session"| node_telemetry
node_telemetry -->|"opens cache"| node_cache
node_enricher -->|"resolves provider"| node_llm
node_enricher -->|"runs annotations"| node_pass1
node_enricher -->|"runs synthesis"| node_pass2
node_pass1 -->|"requests completions"| node_llm
node_llm -.->|"caches responses"| node_cache
node_enricher -.->|"adds annotations"| node_manifest
node_cli -->|"delegates rendering"| node_render_pipeline
node_render_pipeline -.->|"selects classes"| node_selection
node_render_pipeline -.->|"selects renderer"| node_registry
node_registry -->|"dispatches renderer"| node_nestjs
node_nestjs -.->|"emits scaffold"| node_scaffold
node_render_pipeline -->|"patches pointer"| node_manifest
node_cli -->|"runs evaluations"| node_eval
node_cli -->|"loads settings"| node_settings

click node_cli "https://github.com/gvsambhu/codeograph/blob/main/codeograph/cli/main.py"
click node_acquire "https://github.com/gvsambhu/codeograph/blob/main/codeograph/input/input_acquirer.py"
click node_discover "https://github.com/gvsambhu/codeograph/blob/main/codeograph/input/source_discoverer.py"
click node_parse "https://github.com/gvsambhu/codeograph/blob/main/codeograph/parser/file_parser_dispatcher.py"
click node_java "https://github.com/gvsambhu/codeograph/blob/main/codeograph/parser/java_file_parser.py"
click node_fallback "https://github.com/gvsambhu/codeograph/blob/main/codeograph/parser/regex_fallback.py"
click node_analyzer "https://github.com/gvsambhu/codeograph/blob/main/codeograph/analyzer/corpus_analyzer.py"
click node_builder "https://github.com/gvsambhu/codeograph/blob/main/codeograph/graph/graph_builder.py"
click node_assembler "https://github.com/gvsambhu/codeograph/blob/main/codeograph/graph/graph_assembler.py"
click node_schema "https://github.com/gvsambhu/codeograph/blob/main/codeograph/graph/models/graph_schema.py"
click node_writer "https://github.com/gvsambhu/codeograph/blob/main/codeograph/graph/graph_writer.py"
click node_manifest "https://github.com/gvsambhu/codeograph/blob/main/codeograph/manifest/assembler.py"
click node_enricher "https://github.com/gvsambhu/codeograph/blob/main/codeograph/analyzer/llm_corpus_enricher.py"
click node_pass1 "https://github.com/gvsambhu/codeograph/blob/main/codeograph/passes/pass1/node_annotator.py"
click node_pass2 "https://github.com/gvsambhu/codeograph/blob/main/codeograph/passes/pass2/corpus_synthesizer.py"
click node_llm "https://github.com/gvsambhu/codeograph/blob/main/codeograph/llm/resolver.py"
click node_cache "https://github.com/gvsambhu/codeograph/blob/main/codeograph/llm/cache/sqlite_backend.py"
click node_telemetry "https://github.com/gvsambhu/codeograph/blob/main/codeograph/telemetry/session_manager.py"
click node_render_pipeline "https://github.com/gvsambhu/codeograph/blob/main/codeograph/cli/render_pipeline.py"
click node_selection "https://github.com/gvsambhu/codeograph/blob/main/codeograph/rendering/class_selector.py"
click node_registry "https://github.com/gvsambhu/codeograph/blob/main/codeograph/renderers/renderer_registry.py"
click node_nestjs "https://github.com/gvsambhu/codeograph/blob/main/codeograph/renderers/typescript_nestjs/typescript_renderer.py"
click node_scaffold "https://github.com/gvsambhu/codeograph/blob/main/codeograph/renderers/typescript_nestjs/scaffold_emitter.py"
click node_eval "https://github.com/gvsambhu/codeograph/blob/main/codeograph/evals/runner.py"
click node_settings "https://github.com/gvsambhu/codeograph/blob/main/codeograph/config/settings.py"

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_acquire,node_discover toneBlue
class node_parse,node_java,node_fallback,node_analyzer,node_builder,node_assembler,node_schema,node_writer toneAmber
class node_enricher,node_pass1,node_pass2,node_llm,node_cache toneMint
class node_render_pipeline,node_selection,node_registry,node_nestjs,node_scaffold toneRose
class node_manifest,node_telemetry,node_eval,node_settings,node_engineer toneIndigo
class node_cli toneTeal
```

## Components

### Corpus acquisition

- [Input acquisition](https://github.com/gvsambhu/codeograph/blob/main/codeograph/input/input_acquirer.py): `codeograph/input/input_acquirer.py`
- [Source discovery](https://github.com/gvsambhu/codeograph/blob/main/codeograph/input/source_discoverer.py): `codeograph/input/source_discoverer.py`

### Deterministic analysis

- [Parser dispatch](https://github.com/gvsambhu/codeograph/blob/main/codeograph/parser/file_parser_dispatcher.py): `codeograph/parser/file_parser_dispatcher.py`
- [Java AST parser](https://github.com/gvsambhu/codeograph/blob/main/codeograph/parser/java_file_parser.py): `codeograph/parser/java_file_parser.py`
- [Regex fallback](https://github.com/gvsambhu/codeograph/blob/main/codeograph/parser/regex_fallback.py): `codeograph/parser/regex_fallback.py`
- [Corpus analyzer](https://github.com/gvsambhu/codeograph/blob/main/codeograph/analyzer/corpus_analyzer.py): `codeograph/analyzer/corpus_analyzer.py`
- [Graph builder](https://github.com/gvsambhu/codeograph/blob/main/codeograph/graph/graph_builder.py): `codeograph/graph/graph_builder.py`
- [Graph assembler](https://github.com/gvsambhu/codeograph/blob/main/codeograph/graph/graph_assembler.py): `codeograph/graph/graph_assembler.py`
- [Graph schema](https://github.com/gvsambhu/codeograph/blob/main/codeograph/graph/models/graph_schema.py): `codeograph/graph/models/graph_schema.py`
- [Graph writer](https://github.com/gvsambhu/codeograph/blob/main/codeograph/graph/graph_writer.py): `codeograph/graph/graph_writer.py`

### LLM enrichment

- [Enrichment orchestrator](https://github.com/gvsambhu/codeograph/blob/main/codeograph/analyzer/llm_corpus_enricher.py): `codeograph/analyzer/llm_corpus_enricher.py`
- [Node annotation](https://github.com/gvsambhu/codeograph/blob/main/codeograph/passes/pass1/node_annotator.py): `codeograph/passes/pass1/node_annotator.py`
- [Corpus synthesis](https://github.com/gvsambhu/codeograph/blob/main/codeograph/passes/pass2/corpus_synthesizer.py): `codeograph/passes/pass2/corpus_synthesizer.py`
- [Provider stack](https://github.com/gvsambhu/codeograph/blob/main/codeograph/llm/resolver.py): `codeograph/llm/resolver.py`
- [SQLite response cache](https://github.com/gvsambhu/codeograph/blob/main/codeograph/llm/cache/sqlite_backend.py): `codeograph/llm/cache/sqlite_backend.py`

### Rendering

- [Render orchestration](https://github.com/gvsambhu/codeograph/blob/main/codeograph/cli/render_pipeline.py): `codeograph/cli/render_pipeline.py`
- [Class selection](https://github.com/gvsambhu/codeograph/blob/main/codeograph/rendering/class_selector.py): `codeograph/rendering/class_selector.py`
- [Renderer registry](https://github.com/gvsambhu/codeograph/blob/main/codeograph/renderers/renderer_registry.py): `codeograph/renderers/renderer_registry.py`
- [NestJS renderer](https://github.com/gvsambhu/codeograph/blob/main/codeograph/renderers/typescript_nestjs/typescript_renderer.py): `codeograph/renderers/typescript_nestjs/typescript_renderer.py`
- [Project scaffold](https://github.com/gvsambhu/codeograph/blob/main/codeograph/renderers/typescript_nestjs/scaffold_emitter.py): `codeograph/renderers/typescript_nestjs/scaffold_emitter.py`

### Run operations

- [Run manifest](https://github.com/gvsambhu/codeograph/blob/main/codeograph/manifest/assembler.py): `codeograph/manifest/assembler.py`
- [LLM telemetry](https://github.com/gvsambhu/codeograph/blob/main/codeograph/telemetry/session_manager.py): `codeograph/telemetry/session_manager.py`
- [Evaluation framework](https://github.com/gvsambhu/codeograph/blob/main/codeograph/evals/runner.py): `codeograph/evals/runner.py`
- [Configuration](https://github.com/gvsambhu/codeograph/blob/main/codeograph/config/settings.py): `codeograph/config/settings.py`

### Other components

- **Engineer**
- [CLI commands](https://github.com/gvsambhu/codeograph/blob/main/codeograph/cli/main.py): `codeograph/cli/main.py`

## Connections

- Engineer → CLI commands: runs commands (evidence: `README.md`)
- CLI commands → Input acquisition: acquires input (evidence: `codeograph/cli/main.py`)
- Input acquisition → Source discovery: discovers sources
- Source discovery → Parser dispatch: provides files
- Parser dispatch → Java AST parser: tries AST (evidence: `codeograph/parser/file_parser_dispatcher.py`)
- Parser dispatch → Regex fallback: falls back (evidence: `codeograph/parser/file_parser_dispatcher.py`)
- CLI commands → Corpus analyzer: runs analysis (evidence: `codeograph/cli/main.py`)
- Corpus analyzer → Graph builder: builds graph
- Graph builder → Graph assembler: assembles graph
- Graph assembler → Graph schema: validates against (evidence: `codeograph/graph/graph_assembler.py`)
- CLI commands → Graph writer: writes artefacts (evidence: `codeograph/cli/main.py`)
- Graph writer → Run manifest: records run
- CLI commands → Run manifest: assembles manifest (evidence: `codeograph/cli/main.py`)
- CLI commands → Enrichment orchestrator: starts enrichment (evidence: `codeograph/cli/main.py`)
- Enrichment orchestrator → LLM telemetry: starts session (evidence: `codeograph/analyzer/llm_corpus_enricher.py`)
- LLM telemetry → SQLite response cache: opens cache (evidence: `codeograph/telemetry/session_manager.py`)
- Enrichment orchestrator → Provider stack: resolves provider (evidence: `codeograph/analyzer/llm_corpus_enricher.py`)
- Enrichment orchestrator → Node annotation: runs annotations (evidence: `codeograph/analyzer/llm_corpus_enricher.py`)
- Enrichment orchestrator → Corpus synthesis: runs synthesis (evidence: `codeograph/analyzer/llm_corpus_enricher.py`)
- Node annotation → Provider stack: requests completions (evidence: `codeograph/passes/pass1/node_annotator.py`)
- Provider stack → SQLite response cache: caches responses
- Enrichment orchestrator → Run manifest: adds annotations
- CLI commands → Render orchestration: delegates rendering (evidence: `codeograph/cli/render_pipeline.py`)
- Render orchestration → Class selection: selects classes
- Render orchestration → Renderer registry: selects renderer
- Renderer registry → NestJS renderer: dispatches renderer (evidence: `codeograph/renderers/renderer_registry.py`)
- NestJS renderer → Project scaffold: emits scaffold
- Render orchestration → Run manifest: patches pointer (evidence: `codeograph/cli/render_pipeline.py`)
- CLI commands → Evaluation framework: runs evaluations (evidence: `codeograph/cli/main.py`)
- CLI commands → Configuration: loads settings (evidence: `codeograph/cli/main.py`)
