# lum1104/understand-anything architecture

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

- Interactive diagram: https://gitdiagram.com/lum1104/understand-anything
- Repository: https://github.com/lum1104/understand-anything

## Overview

1. **What this repository is**
   - This is a monorepo for the **Understand Anything** plugin ecosystem.
   - The main product is a **local AI-assistant plugin** that analyzes a target repo or knowledge base, produces a **knowledge graph JSON artifact**, and exposes that graph through commands and a dashboard.
   - The repo also contains a separate **marketing homepage** and platform-specific installation descriptors for several AI coding environments.

2. **Top-level architecture**
   - The system is split into three major runtime surfaces:
     - **Plugin/runtime package**: `understand-anything-plugin`
     - **Interactive dashboard**: `understand-anything-plugin/packages/dashboard`
     - **Homepage site**: `homepage`
   - Shared repo-level content includes docs/specs, installation manifests, and CI workflows.

3. **Core analysis engine**
   - `understand-anything-plugin/packages/core` is the main analysis library.
   - It handles:
     - project/file discovery
     - language and framework detection
     - parsing and extraction of symbols
     - graph construction and normalization
     - persistence of graph state
     - search and staleness tracking
   - This package is heavily test-driven and is the most important boundary for the graph-generation pipeline.

4. **Graph-generation pipeline**
   - The readme describes a multi-agent pipeline coordinated by the plugin commands.
   - The flow is roughly:
     - scan project
     - analyze files in parallel
     - build structural graph nodes/edges
     - detect architecture layers
     - generate guided tours
     - validate graph integrity
   - The output is persisted as `.understand-anything/knowledge-graph.json`, which becomes the central data artifact for downstream features.

5. **Agent orchestration layer**
   - `understand-anything-plugin/src` contains command-specific builders and orchestrators:
     - `understand-chat`
     - `diff-analyzer`
     - `explain-builder`
     - `onboard-builder`
     - `context-builder`
   - These modules assemble context and route tasks to the core analysis layer.
   - This is the boundary between the host AI platform’s command system and the repo’s analysis/graph logic.

6. **Specialized analyzers and prompt assets**
   - `understand-anything-plugin/agents` and `skills/` hold the prompt/agent definitions used for different workflows.
   - The named agents map to distinct responsibilities:
     - project scanning
     - file-level extraction
     - architecture analysis
     - tour generation
     - graph review
     - domain extraction
     - knowledge-base/article analysis
   - The skills directory also includes language/framework-specific guidance and helper scripts for extracting or merging graphs.

7. **Language and framework intelligence**
   - The core package contains a broad **language registry** and **framework registry** with configs for many ecosystems: TypeScript, Python, Go, Java, Rust, PHP, C#, etc.
   - There are also framework profiles for Django, Express, FastAPI, Flask, Gin, Next.js, Rails, React, Spring, and Vue.
   - This subsystem matters because it drives symbol extraction, layer inference, and explanations in a language-aware way rather than using one generic parser.

8. **Dashboard subsystem**
   - `packages/dashboard` is a separate Vite/React frontend that reads graph data and presents it visually.
   - It includes:
     - graph views
     - domain and knowledge-graph views
     - file explorer, search, filters, breadcrumbs
     - node details, tooltips, code viewer
     - diff toggle and export tools
     - persona-aware and theme-aware UI
   - The dashboard is effectively a **read-only visualization layer** over the generated graph artifact.

9. **Dashboard data and rendering flow**
   - The dashboard consumes the graph JSON, then applies:
     - filtering and edge aggregation
     - layout computation, including a web worker for heavier layout work
     - theme selection and node rendering
   - It supports multiple graph perspectives:
     - structural graph
     - domain/business flow graph
     - knowledge graph
   - This makes the graph artifact the shared contract between analysis and visualization.

10. **Knowledge-base mode**
   - The repo is not limited to source code analysis.
   - `/understand-knowledge` targets a Karpathy-style wiki knowledge base and uses a combination of deterministic parsing and LLM-based relationship extraction.
   - In this mode, the graph represents articles, entities, claims, categories, and implicit links rather than code symbols.

11. **Local artifact model**
   - The project is designed around **local generation and local consumption** of artifacts, not a central backend.
   - Important persisted outputs include:
     - `.understand-anything/knowledge-graph.json`
     - intermediate scratch data
     - diff overlays for change analysis
   - The readme explicitly treats the graph as something teams can commit and share, so the graph file is a first-class project artifact.

12. **Platform integration boundary**
   - The repo includes plugin manifests and install instructions for multiple hosts:
     - Claude Code
     - Codex
     - Cursor
     - GitHub Copilot / VS Code
     - OpenCode
     - OpenClaw
     - Gemini CLI
     - Pi Agent
   - These platform folders are integration shims, not the core product logic.
   - They mainly exist so the same plugin package can be discovered or installed in different AI environments.

13. **Homepage and documentation**
   - `homepage/` is an Astro static site for product marketing and demo hosting.
   - It is separate from the plugin runtime and exists to publish the homepage and live demo referenced in the readme.
   - The `docs/superpowers` directory contains design/spec/implementation plans, which are architectural and product documentation rather than runtime code.

14. **Operational/tooling boundary**
   - The repo uses a pnpm workspace and TypeScript across the main packages.
   - CI workflows cover validation and homepage deployment.
   - There is no obvious long-running server in the repository; the architecture is primarily:
     - local analysis engine
     - generated graph artifact
     - interactive frontend viewer
     - platform-specific plugin packaging

Main entry points: [`understand-anything-plugin/src`](https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/src) (Command layer), [`understand-anything-plugin/packages/core`](https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/packages/core) (Core engine), [`understand-anything-plugin/packages/dashboard`](https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/packages/dashboard) (Dashboard app), [`understand-anything-plugin/agents`](https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/agents) (Agents & skills)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_repo_root["Monorepo"]
  node_repo_docs["Docs & plans<br/>docs/specs"]
  node_platform_manifests["Host manifests<br/>integration shims<br/>[.claude-plugin]"]
  node_ops_workflows["CI & deploy<br/>repo operations<br/>[workflows]"]
end

subgraph group_plugin_runtime["Plugin runtime"]
  node_plugin_commands["Command layer<br/>orchestrators"]
  node_chat_orchestrator["Chat flow<br/>command builder<br/>[understand-chat.ts]"]
  node_diff_orchestrator["Diff flow<br/>command builder<br/>[diff-analyzer.ts]"]
  node_explain_orchestrator["Explain flow<br/>command builder<br/>[explain-builder.ts]"]
  node_onboard_orchestrator["Onboard flow<br/>command builder<br/>[onboard-builder.ts]"]
  node_context_builder["Context builder<br/>context assembly<br/>[context-builder.ts]"]
  node_agent_assets["Agents & skills<br/>prompt assets"]
  node_core_analysis[("Core engine<br/>analysis library")]
  node_discovery_plugins["Discovery layer<br/>scan & registry"]
  node_language_registry["Lang & framework registry<br/>intelligence registry"]
  node_graph_pipeline["Graph pipeline<br/>graph build"]
  node_graph_artifact["Knowledge graph<br/>persisted artifact"]
end

subgraph group_dashboard_site["UI surfaces"]
  node_dashboard_app["Dashboard app<br/>react frontend"]
  node_dashboard_state["View state<br/>ui state<br/>[store.ts]"]
  node_dashboard_layout["Render engine<br/>layout & render<br/>[layout.ts]"]
  node_homepage_site["Homepage site<br/>astro site"]
end

node_repo_docs -->|"specifies"| node_plugin_commands
node_platform_manifests -->|"installs"| node_plugin_commands
node_plugin_commands -->|"routes"| node_chat_orchestrator
node_plugin_commands -->|"routes"| node_diff_orchestrator
node_plugin_commands -->|"routes"| node_explain_orchestrator
node_plugin_commands -->|"routes"| node_onboard_orchestrator
node_plugin_commands -->|"shares"| node_context_builder
node_context_builder -->|"feeds"| node_core_analysis
node_agent_assets -->|"guides"| node_plugin_commands
node_agent_assets -.->|"informs"| node_core_analysis
node_core_analysis -->|"discovers"| node_discovery_plugins
node_core_analysis -->|"classifies"| node_language_registry
node_core_analysis -->|"builds"| node_graph_pipeline
node_graph_pipeline -->|"persists"| node_graph_artifact
node_core_analysis -->|"updates"| node_graph_artifact
node_graph_artifact -->|"consumed by"| node_dashboard_app
node_dashboard_app -->|"manages"| node_dashboard_state
node_dashboard_app -->|"renders via"| node_dashboard_layout
node_dashboard_state -->|"drives"| node_dashboard_layout
node_homepage_site -.->|"deployed by"| node_ops_workflows
node_ops_workflows -.->|"validates"| node_dashboard_app

click node_repo_docs "https://github.com/lum1104/understand-anything/tree/main/docs/superpowers"
click node_platform_manifests "https://github.com/lum1104/understand-anything/blob/main/.claude-plugin"
click node_plugin_commands "https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/src"
click node_chat_orchestrator "https://github.com/lum1104/understand-anything/blob/main/understand-anything-plugin/src/understand-chat.ts"
click node_diff_orchestrator "https://github.com/lum1104/understand-anything/blob/main/understand-anything-plugin/src/diff-analyzer.ts"
click node_explain_orchestrator "https://github.com/lum1104/understand-anything/blob/main/understand-anything-plugin/src/explain-builder.ts"
click node_onboard_orchestrator "https://github.com/lum1104/understand-anything/blob/main/understand-anything-plugin/src/onboard-builder.ts"
click node_context_builder "https://github.com/lum1104/understand-anything/blob/main/understand-anything-plugin/src/context-builder.ts"
click node_agent_assets "https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/agents"
click node_core_analysis "https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/packages/core"
click node_discovery_plugins "https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/packages/core/src/plugins"
click node_language_registry "https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/packages/core/src/languages"
click node_graph_pipeline "https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/packages/core/src/analyzer"
click node_dashboard_app "https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/packages/dashboard"
click node_dashboard_state "https://github.com/lum1104/understand-anything/blob/main/understand-anything-plugin/packages/dashboard/src/store.ts"
click node_dashboard_layout "https://github.com/lum1104/understand-anything/blob/main/understand-anything-plugin/packages/dashboard/src/utils/layout.ts"
click node_homepage_site "https://github.com/lum1104/understand-anything/tree/main/homepage"
click node_ops_workflows "https://github.com/lum1104/understand-anything/blob/main/.github/workflows"

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_repo_docs,node_platform_manifests,node_ops_workflows toneBlue
class node_plugin_commands,node_chat_orchestrator,node_diff_orchestrator,node_explain_orchestrator,node_onboard_orchestrator,node_context_builder,node_agent_assets,node_core_analysis,node_discovery_plugins,node_language_registry,node_graph_pipeline,node_graph_artifact toneAmber
class node_dashboard_app,node_dashboard_state,node_dashboard_layout,node_homepage_site toneMint
```

## Components

### Monorepo

Top-level workspace, docs, platform manifests, and shared tooling.

- [Docs & plans](https://github.com/lum1104/understand-anything/tree/main/docs/superpowers): docs/specs · Architecture docs, specs, and implementation plans that describe the product and its evolution. · `docs/superpowers`
- [Host manifests](https://github.com/lum1104/understand-anything/blob/main/.claude-plugin): integration shims · Plugin descriptors and install instructions for Claude, Codex, Cursor, Copilot, Gemini, OpenCode, OpenClaw, Pi, and VS Code. · `.claude-plugin`
- [CI & deploy](https://github.com/lum1104/understand-anything/blob/main/.github/workflows): repo operations · Workspace-level validation and homepage deployment workflows. · `.github/workflows`

### Plugin runtime

Local analysis plugin, agent orchestration, skills, and core graph pipeline.

- [Command layer](https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/src): orchestrators · Command-specific builders that assemble context and route work into the analysis engine. · `understand-anything-plugin/src`
- [Chat flow](https://github.com/lum1104/understand-anything/blob/main/understand-anything-plugin/src/understand-chat.ts): command builder · Understands chat-oriented requests and routes them through the plugin command surface. · `understand-anything-plugin/src/understand-chat.ts`
- [Diff flow](https://github.com/lum1104/understand-anything/blob/main/understand-anything-plugin/src/diff-analyzer.ts): command builder · Builds change-analysis context and drives diff-oriented workflows. · `understand-anything-plugin/src/diff-analyzer.ts`
- [Explain flow](https://github.com/lum1104/understand-anything/blob/main/understand-anything-plugin/src/explain-builder.ts): command builder · Prepares explanation-oriented context for repo understanding and guided responses. · `understand-anything-plugin/src/explain-builder.ts`
- [Onboard flow](https://github.com/lum1104/understand-anything/blob/main/understand-anything-plugin/src/onboard-builder.ts): command builder · Creates onboarding context for first-run project understanding. · `understand-anything-plugin/src/onboard-builder.ts`
- [Context builder](https://github.com/lum1104/understand-anything/blob/main/understand-anything-plugin/src/context-builder.ts): context assembly · Shared context assembly boundary used by the command layer before analysis begins. · `understand-anything-plugin/src/context-builder.ts`
- [Agents & skills](https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/agents): prompt assets · Workflow prompts, skills, and helper scripts for scanning, extraction, tours, review, and knowledge-base handling. · `understand-anything-plugin/agents`
- [Core engine](https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/packages/core): analysis library · Main analysis package responsible for discovery, parsing, graph construction, persistence, search, and staleness tracking. · `understand-anything-plugin/packages/core`
- [Discovery layer](https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/packages/core/src/plugins): scan & registry · File discovery, ignore filtering, plugin discovery, and parser/extractor registry selection. · `understand-anything-plugin/packages/core/src/plugins`
- [Lang & framework registry](https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/packages/core/src/languages): intelligence registry · Language configs and framework profiles that guide symbol extraction and layer inference across many ecosystems. · `understand-anything-plugin/packages/core/src/languages`
- [Graph pipeline](https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/packages/core/src/analyzer): graph build · Graph builder, normalization, layer detection, LLM-assisted analysis, and tour generation. · `understand-anything-plugin/packages/core/src/analyzer`
- **Knowledge graph**: persisted artifact · Canonical local JSON artifact written under .understand-anything and shared by downstream tools.

### UI surfaces

Graph viewer dashboard and marketing homepage.

- [Dashboard app](https://github.com/lum1104/understand-anything/tree/main/understand-anything-plugin/packages/dashboard): react frontend · Vite/React application that reads graph data and presents interactive graph, domain, and knowledge views. · `understand-anything-plugin/packages/dashboard`
- [View state](https://github.com/lum1104/understand-anything/blob/main/understand-anything-plugin/packages/dashboard/src/store.ts): ui state · Client-side store, filtering, theme selection, and persona-aware rendering state. · `understand-anything-plugin/packages/dashboard/src/store.ts`
- [Render engine](https://github.com/lum1104/understand-anything/blob/main/understand-anything-plugin/packages/dashboard/src/utils/layout.ts): layout & render · Graph view rendering, edge aggregation, filtering, and worker-backed layout computation. · `understand-anything-plugin/packages/dashboard/src/utils/layout.ts`
- [Homepage site](https://github.com/lum1104/understand-anything/tree/main/homepage): astro site · Separate marketing and demo site for the product homepage. · `homepage`

## Connections

- Docs & plans → Command layer: specifies · Designs and plans describe command and pipeline behavior.
- Host manifests → Command layer: installs · Host-specific manifests expose the plugin runtime to AI platforms.
- Command layer → Chat flow: routes · Chat command entrypoint.
- Command layer → Diff flow: routes · Diff analysis entrypoint.
- Command layer → Explain flow: routes · Explanation entrypoint.
- Command layer → Onboard flow: routes · Onboarding entrypoint.
- Command layer → Context builder: shares · All command flows assemble context through a common boundary.
- Context builder → Core engine: feeds · Command context is converted into analysis requests.
- Agents & skills → Command layer: guides · Prompt assets define workflow-specific behavior.
- Agents & skills → Core engine: informs · Skills and agents complement the core analysis pipeline.
- Core engine → Discovery layer: discovers · Project and file discovery selects parsers and extractors.
- Core engine → Lang & framework registry: classifies · Language and framework profiles drive parsing and layer inference.
- Core engine → Graph pipeline: builds · Analysis output is normalized into graph structure and tours.
- Graph pipeline → Knowledge graph: persists · The final graph is written as a local JSON artifact.
- Core engine → Knowledge graph: updates · Persistence and staleness tracking maintain the shared artifact.
- Knowledge graph → Dashboard app: consumed by · Dashboard reads the generated graph as its main contract.
- Dashboard app → View state: manages · UI state coordinates filters, themes, persona, and selection.
- Dashboard app → Render engine: renders via · Graph views use layout and edge aggregation utilities.
- View state → Render engine: drives · State changes affect rendering and layout presentation.
- Homepage site → CI & deploy: deployed by · Homepage has a dedicated deployment workflow.
- CI & deploy → Dashboard app: validates · Repository CI covers the main plugin and UI surfaces.
