# Understand Anything — Mental Model Wiki > A Claude Code plugin that turns any codebase into an interactive knowledge graph dashboard. It combines a multi-agent LLM pipeline, tree-sitter static analysis, and a React Flow UI so engineers can predict relationships, navigate architecture, and incrementally refresh the graph as code changes. This is a Grok-Wiki source-grounded repository wiki. Use the complete Markdown link when an agent needs the full repo context. ## Context Links - [Complete Markdown wiki](https://grok-wiki.com/public/wiki/lum1104-understand-anything-3b923df96896/llms-full.txt) - [Complete Markdown alias](https://grok-wiki.com/public/wiki/lum1104-understand-anything-3b923df96896.md) - [Human interactive wiki](https://grok-wiki.com/public/wiki/lum1104-understand-anything-3b923df96896) - [GitHub repository](https://github.com/Lum1104/Understand-Anything) ## Repository - Repository: Lum1104/Understand-Anything - Generated: 2026-05-22T00:58:23.057Z - Updated: 2026-05-22T00:58:34.378Z - Runtime: Claude Code - Format: Mental Model - Pages: 8 ## Pages - [The Mental Model: Graph-First Codebase Understanding](https://grok-wiki.com/public/wiki/lum1104-understand-anything-3b923df96896/pages/01-the-mental-model-graph-first-codebase-understanding.md): The single simplest model of the whole system: a CLI plugin triggers a sequential multi-agent pipeline that emits one JSON knowledge graph, which is then rendered as an interactive React Flow dashboard. Everything else — tree-sitter extractors, parsers, staleness checks, Zustand store — supports this central invariant. Understanding this flow lets you predict where any new feature, bug, or change lands. - [Agent Pipeline: Five Phases from Scan to Graph](https://grok-wiki.com/public/wiki/lum1104-understand-anything-3b923df96896/pages/02-agent-pipeline-five-phases-from-scan-to-graph.md): The /understand skill orchestrates five sequential agent phases: project-scanner (file discovery), file-analyzer (per-file nodes), architecture-analyzer (cross-cutting edges), tour-builder (guided walkthroughs), and assemble-reviewer (graph assembly and validation). Agents write intermediate JSON to .understand-anything/intermediate/ to avoid polluting context; results are merged and cleaned up. Auto-update mode replays stale phases after a git commit via the PostToolUse hook. - [Schema & Type Contracts: Nodes, Edges, and Aliases](https://grok-wiki.com/public/wiki/lum1104-understand-anything-3b923df96896/pages/03-schema-type-contracts-nodes-edges-and-aliases.md): The knowledge graph is defined by two Zod schemas: NodeTypeSchema (21 canonical node types such as file, function, class, domain, article) and EdgeTypeSchema (35 edge types across 8 categories: structural, behavioral, data-flow, dependencies, semantic, infrastructure, domain, knowledge). Alias maps (NODE_TYPE_ALIASES, EDGE_TYPE_ALIASES) normalize LLM-generated variants to canonical forms at assembly time. This schema is the contract between the agent pipeline and the dashboard — both sides import from @understand-anything/core/types and @understand-anything/core/schema. - [Static Analysis: Tree-Sitter Extractors & Parsers](https://grok-wiki.com/public/wiki/lum1104-understand-anything-3b923df96896/pages/04-static-analysis-tree-sitter-extractors-parsers.md): Two plugin families produce deterministic graph nodes without LLM calls. Language extractors (TypeScript, Python, Go, Java, Rust, C++, Ruby, C#, PHP) use web-tree-sitter (WASM) via tree-sitter-plugin.ts to parse ASTs and emit function/class/module nodes. Config parsers (JSON, YAML, TOML, SQL, GraphQL, Dockerfile, Protobuf, Makefile, shell, Markdown, Terraform, .env) extract config/schema/document nodes. The plugin registry in registry.ts and discovery.ts wires both families together. The WASM constraint — no native bindings — is a hard invariant: never swap in the native tree-sitter package. - [Staleness Detection & Incremental Updates](https://grok-wiki.com/public/wiki/lum1104-understand-anything-3b923df96896/pages/05-staleness-detection-incremental-updates.md): The knowledge graph is stored as .understand-anything/knowledge-graph.json alongside config.json (which records the last analyzed commit hash and user preferences such as language and autoUpdate). On each /understand invocation, staleness.ts compares git diff lastCommitHash..HEAD; if files changed, only affected nodes are removed and re-analyzed (incremental mode). --full forces a complete rebuild. The auto-update hook re-triggers analysis after every git commit when autoUpdate is true. Worktree redirect is a critical invariant: graphs generated inside a Claude Code worktree are redirected to the main repo root to prevent ephemeral loss. - [Dashboard State Machine: Zustand Store & View Modes](https://grok-wiki.com/public/wiki/lum1104-understand-anything-3b923df96896/pages/06-dashboard-state-machine-zustand-store-view-modes.md): The dashboard's single Zustand store (store.ts) owns all runtime state: the loaded KnowledgeGraph, active Persona (non-technical / junior / experienced), ViewMode (structural / domain / knowledge), FilterState (node types, complexities, layers, edge categories), selected node, search results via SearchEngine (Fuse.js fuzzy search on name/tags/summary/languageNotes), and the React Flow instance. The store is the single source of truth — components never hold local graph state. Key boundary: dashboard imports only from @understand-anything/core/search, /types, and /schema (browser-safe subpath exports); never the core main entry point, which pulls in Node.js modules. - [Skill Surface: /understand, /understand-chat, /understand-diff & Hooks](https://grok-wiki.com/public/wiki/lum1104-understand-anything-3b923df96896/pages/07-skill-surface-understand-understand-chat-understand-diff-hooks.md): Eight skills are exposed: /understand (full graph build), /understand-dashboard (opens dashboard), /understand-chat (Q&A against the graph using context-builder.ts), /understand-diff (change analysis via diff-analyzer.ts), /understand-explain (node explanation via explain-builder.ts), /understand-onboard (onboarding guide via onboard-builder.ts), /understand-domain, and /understand-knowledge. The @understand-anything/skill package exports typed builders consumed by the chat/diff/explain/onboard skills. Hooks (hooks.json) fire PostToolUse on git commit to trigger auto-update and a PreToolUse hook to auto-update before /understand-chat responses. Agent models are all set to inherit for cross-platform compatibility. - [Invariants, Failure Modes & Safe-Change Rules](https://grok-wiki.com/public/wiki/lum1104-understand-anything-3b923df96896/pages/08-invariants-failure-modes-safe-change-rules.md): A synthesis of every load-bearing constraint in the system. Hard invariants: (1) use web-tree-sitter (WASM) only — native bindings break on darwin/arm64 + Node 24; (2) dashboard imports only browser-safe core subpath exports; (3) graphs inside git worktrees are redirected to the main repo root; (4) all five version fields must be bumped in sync when releasing. Key failure modes: stale graph after code changes (fix: run /understand or enable autoUpdate), broken incremental update when lastCommitHash is missing from config.json (fix: --full rebuild), dashboard blank on schema mismatch (fix: check WarningBanner, validate graph JSON against schema.ts). Safe-change rules: adding a new language extractor only requires a new file under extractors/ plus registry entry; adding a new edge type requires updating schema.ts alias maps and the EDGE_CATEGORY_MAP in store.ts; dashboard layout changes are isolated to components/ and never touch core. ## Source Files - `README.md` - `understand-anything-plugin/agents/architecture-analyzer.md` - `understand-anything-plugin/agents/assemble-reviewer.md` - `understand-anything-plugin/agents/file-analyzer.md` - `understand-anything-plugin/agents/project-scanner.md` - `understand-anything-plugin/agents/tour-builder.md` - `understand-anything-plugin/CLAUDE.md` - `understand-anything-plugin/hooks/auto-update-prompt.md` - `understand-anything-plugin/hooks/hooks.json` - `understand-anything-plugin/package.json` - `understand-anything-plugin/packages/core/package.json` - `understand-anything-plugin/packages/core/src/plugins/discovery.ts` - `understand-anything-plugin/packages/core/src/plugins/extractors/base-extractor.ts` - `understand-anything-plugin/packages/core/src/plugins/extractors/typescript-extractor.ts` - `understand-anything-plugin/packages/core/src/plugins/parsers/index.ts` - `understand-anything-plugin/packages/core/src/plugins/registry.ts` - `understand-anything-plugin/packages/core/src/plugins/tree-sitter-plugin.test.ts` - `understand-anything-plugin/packages/core/src/plugins/tree-sitter-plugin.ts` - `understand-anything-plugin/packages/core/src/schema.ts` - `understand-anything-plugin/packages/core/src/search.ts` - `understand-anything-plugin/packages/core/src/staleness.ts` - `understand-anything-plugin/packages/core/src/types.test.ts` - `understand-anything-plugin/packages/dashboard/src/App.tsx` - `understand-anything-plugin/packages/dashboard/src/components/CodeViewer.tsx` - `understand-anything-plugin/packages/dashboard/src/components/GraphView.tsx` - `understand-anything-plugin/packages/dashboard/src/components/NodeInfo.tsx` - `understand-anything-plugin/packages/dashboard/src/components/WarningBanner.tsx` - `understand-anything-plugin/packages/dashboard/src/store.ts` - `understand-anything-plugin/skills/understand-chat/SKILL.md` - `understand-anything-plugin/skills/understand/SKILL.md` - `understand-anything-plugin/src/context-builder.ts` - `understand-anything-plugin/src/diff-analyzer.ts` - `understand-anything-plugin/src/explain-builder.ts` - `understand-anything-plugin/src/index.ts` - `understand-anything-plugin/src/onboard-builder.ts`