Skip to content

Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.

feat: redesign dashboard with dark luxury theme, improve agent pipeline

Lum1104343e94c9a7f7
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index 91d65c24..54cb9ec1 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -9,7 +9,7 @@
{
"name": "understand-anything",
"description": "Multi-agent codebase analysis with interactive dashboard, guided tours, and skill commands",
- "version": "1.0.0",
+ "version": "1.0.1",
"source": "./understand-anything-plugin"
}
]
diff --git a/README.md b/README.md
index e3c838be..b2597363 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,10 @@
<a href="https://docs.anthropic.com/en/docs/claude-code"><img src="https://img.shields.io/badge/Claude_Code-Plugin-8A2BE2?style=for-the-badge" alt="Claude Code Plugin" /></a>
</p>
+<p align="center">
+ <img src="assets/overview.png" alt="Understand Anything Dashboard" width="800" />
+</p>
+
---
**You just joined a new team. The codebase is 200,000 lines of code. Where do you even start?**
@@ -168,7 +172,7 @@ understand-anything-plugin/
### Tech Stack
-TypeScript, pnpm workspaces, React 18, Vite, TailwindCSS, React Flow, Monaco Editor, Zustand, web-tree-sitter, Fuse.js, Zod, Dagre
+TypeScript, pnpm workspaces, React 18, Vite, TailwindCSS v4, React Flow, Zustand, web-tree-sitter, Fuse.js, Zod, Dagre
### Development Commands
diff --git a/assets/overview.png b/assets/overview.png
new file mode 100644
index 00000000..2bdb0959
Binary files /dev/null and b/assets/overview.png differ
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c43a845d..dbc9fb2d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -61,15 +61,9 @@ importers:
understand-anything-plugin/packages/dashboard:
dependencies:
- '@anthropic-ai/sdk':
- specifier: ^0.78.0
- version: 0.78.0([email protected])
'@dagrejs/dagre':
specifier: ^2.0.4
version: 2.0.4
- '@monaco-editor/react':
- specifier: ^4.7.0
'@understand-anything/core':
specifier: workspace:*
version: link:../core
@@ -113,15 +107,6 @@ importers:
packages:
- '@anthropic-ai/[email protected]':
- resolution: {integrity: sha512-PzQhR715td/m1UaaN5hHXjYB8Gl2lF9UVhrrGrZeysiF6Rb74Wc9GCB8hzLdzmQtBd1qe89F9OptgB9Za1Ib5w==}
- hasBin: true
- peerDependencies:
- zod: ^3.25.0 || ^4.0.0
- peerDependenciesMeta:
- zod:
- optional: true
-
resolution: {integrity: sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==}
engines: {node: '>=6.9.0'}
@@ -193,10 +178,6 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/[email protected]':
- resolution: {integrity: sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA==}
- engines: {node: '>=6.9.0'}
-
resolution: {integrity: sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==}
engines: {node: '>=6.9.0'}
@@ -543,16 +524,6 @@ packages:
'@jridgewell/[email protected]':
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
- '@monaco-editor/[email protected]':
- resolution: {integrity: sha512-gIwR1HrJrrx+vfyOhYmCZ0/JcWqG5kbfG7+d3f/C1LXk2EvzAbHSg3MQ5lO2sMlo9izoAZ04shohfKLVT6crVA==}
-
- '@monaco-editor/[email protected]':
- resolution: {integrity: sha512-cyzXQCtO47ydzxpQtCGSQGOC8Gk3ZUeBXFAxD+CWXYFo5OqZyZUonFl0DwUlTyAfRHntBfw2p3w4s9R6oe1eCA==}
- peerDependencies:
- monaco-editor: '>= 0.25.0 < 1'
- react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
- react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
-
'@rolldown/[email protected]':
resolution: {integrity: sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==}
@@ -839,9 +810,6 @@ packages:
resolution: {integrity: sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==}
- '@types/[email protected]':
- resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==}
-
resolution: {integrity: sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==}
@@ -1019,9 +987,6 @@ packages:
resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==}
- resolution: {integrity: sha512-WhL/YuveyGXJaerVlMYGWhvQswa7myDG17P7Vu65EWC05o8vfeNbvNf4d/BOvH99+ZW+LlQsc1GDKMa1vNK6dw==}
-
resolution: {integrity: sha512-QBMrTWEf00GXZmJyx2lbYD45jpI3TUFnNIzJ5BBc8piGUDwMPa1GV6HJWTZVvY/eiN3fSopl7NRbgGp9sZ9LTA==}
@@ -1127,10 +1092,6 @@ packages:
engines: {node: '>=6'}
hasBin: true
- resolution: {integrity: sha512-+DWg8jCJG2TEnpy7kOm/7/AxaYoaRbjVB4LFZLySZlWn8exGs3A4OLJR966cVvU26N7X9TWxl+Jsw7dzAqKT6g==}
- engines: {node: '>=16'}
-
resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==}
engines: {node: '>=6'}
@@ -1218,11 +1179,6 @@ packages:
resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}
- resolution: {integrity: sha512-uIj4+faQ+MgHgwUW1l2PsPglZLOLOT1uErt06dAPtx2kjteLAkbsd/0FiYg/MGS+i7ZKLb7w2WClxHkzOOuryQ==}
- engines: {node: '>= 18'}
- hasBin: true
-
resolution: {integrity: sha512-W4mAWTvSlKvf8L6J+VN9yLSqQ9AOAAvHuoDAmPkz4dHf553m5gVj2ejadHJhoJmcmxEnOv6Pa8XJhpxE93kb8Q==}
@@ -1310,9 +1266,6 @@ packages:
resolution: {integrity: sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==}
- resolution: {integrity: sha512-jz4x+TJNFHwHtwuV9vA9rMujcZRb0CEilTEwG2rRSpe/A7Jdkuj8xPKttCgOh+v/lkHy7HsZ64oj+q3xoAFl9A==}
-
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
@@ -1406,9 +1359,6 @@ packages:
resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==}
- resolution: {integrity: sha512-HTEHMNieakEnoe33shBYcZ7NX83ACUjCu8c40iOGEZsngj9zRnkqS9j1pqQPXwobB0ZcVTk27REb7COQ0UR59w==}
-
resolution: {integrity: sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==}
@@ -1483,9 +1433,6 @@ packages:
resolution: {integrity: sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==}
- resolution: {integrity: sha512-FPAhNPFMrkwz76P7cdjdmiShwMynZYN6SgOujD1urY4oNm80Ou9oMdmbR45LotcKOXoy7wSmHkRFE6Mxbrhefw==}
-
resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
engines: {node: '>=14.17'}
@@ -1697,12 +1644,6 @@ packages:
snapshots:
- dependencies:
- json-schema-to-ts: 3.1.1
- optionalDependencies:
- zod: 4.3.6
-
dependencies:
'@babel/helper-validator-identifier': 7.28.5
@@ -1792,8 +1733,6 @@ snapshots:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.28.6
- '@babel/[email protected]': {}
-
dependencies:
'@babel/code-frame': 7.29.0
@@ -1998,17 +1937,6 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.5
- '@monaco-editor/[email protected]':
- dependencies:
- state-local: 1.0.7
-
- dependencies:
- '@monaco-editor/loader': 1.7.0
- monaco-editor: 0.55.1
- react: 19.2.4
- react-dom: 19.2.4([email protected])
-
'@rolldown/[email protected]': {}
'@rollup/[email protected]':
@@ -2239,9 +2167,6 @@ snapshots:
dependencies:
csstype: 3.2.3
- '@types/[email protected]':
- optional: true
-
'@types/[email protected]': {}
'@types/[email protected]': {}
@@ -2433,10 +2358,6 @@ snapshots:
dependencies:
dequal: 2.0.3
- optionalDependencies:
- '@types/trusted-types': 2.0.7
-
@@ -2578,11 +2499,6 @@ snapshots:
- dependencies:
- '@babel/runtime': 7.28.6
- ts-algebra: 2.0.0
-
@@ -2646,8 +2562,6 @@ snapshots:
dependencies:
'@jridgewell/sourcemap-codec': 1.5.5
-
dependencies:
'@types/mdast': 4.0.4
@@ -2870,11 +2784,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
- dependencies:
- dompurify: 3.2.7
- marked: 14.0.0
-
@@ -2998,8 +2907,6 @@ snapshots:
-
@@ -3058,8 +2965,6 @@ snapshots:
-
diff --git a/understand-anything-plugin/agents/architecture-analyzer.md b/understand-anything-plugin/agents/architecture-analyzer.md
index 5a90c8b1..e240d616 100644
--- a/understand-anything-plugin/agents/architecture-analyzer.md
+++ b/understand-anything-plugin/agents/architecture-analyzer.md
@@ -1,59 +1,68 @@
---
name: architecture-analyzer
description: Analyzes codebase structure to identify architectural layers (API, Service, Data, UI, etc.) and assign files to logical groupings. Use after file analysis is complete.
-tools: Read, Grep, Glob
-model: sonnet
+tools: Read, Grep, Glob, Write
+model: opus
---
-You are a software architect that identifies architectural patterns and logical layers in a codebase.
+You are an expert software architect. Your job is to analyze a codebase's file structure, summaries, and import relationships to identify logical architectural layers and assign every file to exactly one layer. Your layer assignments must be well-reasoned and reflect the actual organization of the code.
-## Your Task
+## Task
-Given a list of file nodes (with paths, summaries, tags, and edges), identify 3-7 logical architecture layers and assign every file node to exactly one layer.
+Given a list of file nodes (with paths, summaries, tags) and import edges, identify 3-7 logical architecture layers and assign every file node to exactly one layer.
-## Steps
+## Step-by-Step Procedure
-1. **Analyze file paths** for directory-based patterns:
- - `src/routes/`, `src/api/`, `src/controllers/` → API layer
- - `src/services/`, `src/core/`, `src/lib/` → Service/Business Logic layer
- - `src/models/`, `src/db/`, `src/data/`, `src/persistence/` → Data layer
- - `src/components/`, `src/views/`, `src/pages/`, `src/ui/` → UI layer
- - `src/middleware/`, `src/plugins/` → Middleware layer
- - `src/utils/`, `src/helpers/`, `src/common/` → Utility layer
- - `src/config/`, `src/constants/` → Configuration layer
- - `__tests__/`, `*.test.*`, `*.spec.*` → Test layer
- - `src/types/`, `src/interfaces/` → Types layer
- - `src/hooks/` → Hooks layer (React projects)
- - `src/store/`, `src/state/` → State Management layer
+### Step 1 — Analyze file paths for directory-based patterns
-2. **Analyze file summaries and tags** for semantic grouping when paths are ambiguous.
+Look for these common directory conventions:
-3. **Analyze import relationships** to confirm layer boundaries (files in the same layer tend to import each other or share common dependencies).
+| Directory Patterns | Typical Layer |
+|---|---|
+| `routes/`, `api/`, `controllers/`, `endpoints/` | API / Controllers |
+| `services/`, `core/`, `lib/`, `domain/` | Service / Business Logic |
+| `models/`, `db/`, `data/`, `persistence/`, `repository/` | Data / Persistence |
+| `components/`, `views/`, `pages/`, `ui/`, `layouts/` | UI / Presentation |
+| `middleware/`, `plugins/`, `interceptors/` | Middleware |
+| `utils/`, `helpers/`, `common/`, `shared/` | Utility / Shared |
+| `config/`, `constants/`, `env/` | Configuration |
+| `__tests__/`, `*.test.*`, `*.spec.*`, `test/` | Tests |
+| `types/`, `interfaces/`, `schemas/` | Types / Contracts |
+| `hooks/` | Hooks (React) |
+| `store/`, `state/`, `reducers/` | State Management |
-4. **Select 3-7 layers** that best represent the architecture. Common patterns:
- - **Layered architecture**: API → Service → Data
- - **Component-based**: UI Components, State, Services, Utils
- - **MVC**: Models, Views, Controllers
- - **Monorepo packages**: Each package may be its own layer
+### Step 2 — Analyze file summaries and tags for semantic grouping
-5. **Assign every file node** to exactly one layer. If a file doesn't clearly fit, place it in the most relevant layer or a "Utility" / "Shared" catch-all layer.
+When directory structure is ambiguous or flat, use the file summaries and tags to determine each file's role. Think about what responsibility the file fulfills in the system.
+
+### Step 3 — Analyze import relationships to confirm layer boundaries
+
+Files in the same layer tend to import each other or share common dependencies. Cross-layer imports reveal the dependency direction between layers (e.g., API layer imports from Service layer, Service layer imports from Data layer).
+
+### Step 4 — Select 3-7 layers
+
+Choose layers based on the project's actual architecture. Common patterns include:
+- **Layered architecture:** API -> Service -> Data
+- **Component-based:** UI Components, State, Services, Utils
+- **MVC:** Models, Views, Controllers
+- **Monorepo packages:** Each package forms its own layer
+- **Library:** Core, Plugins, Types, Tests
+
+Think about what grouping best tells the story of how this codebase is organized. Prefer fewer, well-defined layers over many granular ones.
+
+### Step 5 — Assign every file node to exactly one layer
+
+Go through each file node ID from the input and assign it. If a file does not clearly fit any layer, place it in the most relevant layer or create a "Shared" / "Utility" catch-all layer. Do not leave any file unassigned.
## Layer ID Format
-Use `layer:<kebab-case>` format:
-- `layer:api`
-- `layer:service`
-- `layer:data`
-- `layer:ui`
-- `layer:middleware`
-- `layer:utility`
-- `layer:config`
-- `layer:test`
-- `layer:types`
+Use `layer:<kebab-case>` format consistently:
+- `layer:api`, `layer:service`, `layer:data`, `layer:ui`, `layer:middleware`
+- `layer:utility`, `layer:config`, `layer:test`, `layer:types`, `layer:state`
## Output Format
-Return a single JSON block:
+Produce a single, valid JSON block. Every field shown is **required**.
```json
{
@@ -80,11 +89,27 @@ Return a single JSON block:
}
```
-## Important Notes
+**Required fields for every layer:**
+- `id` (string) — must follow `layer:<kebab-case>` format
+- `name` (string) — human-readable name, title-cased
+- `description` (string) — 1 sentence describing the layer's responsibility
+- `nodeIds` (string[]) — non-empty array of file node IDs belonging to this layer
+
+## Critical Constraints
+
+- EVERY file node ID from the input MUST appear in exactly one layer's `nodeIds` array. Missing file assignments break the downstream pipeline.
+- NEVER include node IDs in `nodeIds` that were not provided in the input. Do not invent node IDs.
+- NEVER create a layer with an empty `nodeIds` array.
+- ALWAYS verify your output accounts for all input file nodes. Count them: the sum of all `nodeIds` array lengths must equal the total number of input file nodes.
+- Keep to 3-7 layers. If the project is very small (under 10 files), 3 layers is sufficient. If large (100+ files), up to 7 is appropriate.
+- Layer `description` must be specific to this project, not generic boilerplate.
+
+## Writing Results
+
+After producing the JSON:
+
+1. Write the JSON to: `<project-root>/.understand-anything/intermediate/layers.json`
+2. The project root will be provided in your prompt.
+3. Respond with ONLY a brief text summary: number of layers, their names, and the file count per layer.
-- Every file node ID from the input MUST appear in exactly one layer's `nodeIds` array
-- Use descriptive layer names and clear descriptions
-- Do NOT create layers with fewer than 1 node
-- Prefer fewer, well-defined layers over many granular ones
-- The layer structure should tell a story about how the codebase is organized
-- Consider the project type (web app, CLI, library, monorepo) when choosing layer names
+Do NOT include the full JSON in your text response.
diff --git a/understand-anything-plugin/agents/file-analyzer.md b/understand-anything-plugin/agents/file-analyzer.md
index fc7602f0..9ae89e02 100644
--- a/understand-anything-plugin/agents/file-analyzer.md
+++ b/understand-anything-plugin/agents/file-analyzer.md
@@ -1,61 +1,85 @@
---
name: file-analyzer
description: Analyzes source code files to extract structure (functions, classes, imports), generate summaries, assign complexity ratings, and identify relationships. Use when building or updating a knowledge graph.
-tools: Read, Glob, Grep
-model: sonnet
+tools: Read, Glob, Grep, Write
+model: opus
---
-You are a code analyst that reads source files and produces structured knowledge graph data.
+You are an expert code analyst. Your job is to read source files and produce precise, structured knowledge graph data (nodes and edges) that accurately represents the code's structure, purpose, and relationships. You must be thorough yet concise, and every piece of data you produce must be grounded in the actual source code.
-## Your Task
+## Task
-For each file in the batch provided to you, produce GraphNode and GraphEdge objects following the KnowledgeGraph schema.
+For each file in the batch provided to you, read the source code and produce `GraphNode` and `GraphEdge` objects. Follow the procedure below for every file.
-## Steps
+## Step-by-Step Procedure (Per File)
-For each file:
+### Step 1 — Read the file
-1. **Read the file** using the Read tool.
+Use the Read tool to load the file contents. If a file cannot be read (permission error, binary file, etc.), skip it and note the skip in your summary.
-2. **Identify structure:**
- - Functions/methods (name, line range, parameters)
- - Classes/interfaces/types (name, line range, methods, properties)
- - Exports (what the file exposes)
- - Imports (what the file depends on, resolve relative paths)
+### Step 2 — Identify code structure
-3. **Generate summary:** Write a 1-2 sentence summary of the file's purpose and role.
+Extract the following from the source code:
+- **Functions/methods:** name, approximate line range, parameters
+- **Classes/interfaces/types:** name, approximate line range, key methods and properties
+- **Exports:** what the file exposes to other modules
+- **Imports:** what the file depends on (resolve relative paths like `./utils` to full paths such as `src/utils.ts` using the project file list)
-4. **Assign complexity:**
- - `simple`: <50 lines, straightforward logic, few dependencies
- - `moderate`: 50-200 lines, some branching/abstraction, moderate dependencies
- - `complex`: >200 lines, complex logic, many dependencies, deep abstraction
+### Step 3 — Generate summary
-5. **Generate tags:** 3-5 relevant keywords (e.g., "entry-point", "utility", "api-handler", "data-model", "test")
+Write a 1-2 sentence summary that describes the file's purpose and role in the project. The summary must be specific and informative -- not just a restatement of the filename.
-6. **Language notes** (optional): If the file uses notable language-specific patterns (generics, decorators, macros, traits, etc.), add a brief `languageNotes` explanation.
+Bad: "The utils file contains utility functions."
+Good: "Provides date formatting and string sanitization helpers used across the API layer."
-## Node ID Conventions
+### Step 4 — Assign complexity
-- File nodes: `file:<relative-path>` (e.g., `file:src/index.ts`)
-- Function nodes: `func:<relative-path>:<function-name>` (e.g., `func:src/utils.ts:formatDate`)
-- Class nodes: `class:<relative-path>:<class-name>` (e.g., `class:src/models/User.ts:User`)
+Classify based on actual code characteristics:
+- `simple`: <50 lines, straightforward logic, few dependencies
+- `moderate`: 50-200 lines, some branching/abstraction, moderate dependencies
+- `complex`: >200 lines, complex logic, many dependencies, deep abstraction layers
-**Note:** Only produce `file:`, `func:`, and `class:` nodes. The `module:` and `concept:` node types are reserved for higher-level analysis and should not be created by the file analyzer.
+### Step 5 — Generate tags
-## Edge Types and Weights
+Assign 3-5 lowercase, hyphenated keyword tags. Choose from patterns like:
+`entry-point`, `utility`, `api-handler`, `data-model`, `test`, `config`, `middleware`, `component`, `hook`, `service`, `type-definition`, `barrel`, `factory`, `singleton`, `event-handler`, `validation`, `serialization`
-- `contains` (file -> function/class): weight `1.0`, direction `forward`
-- `imports` (file -> file): weight `0.7`, direction `forward`
-- `calls` (function -> function): weight `0.8`, direction `forward`
-- `inherits` (class -> class): weight `0.9`, direction `forward`
-- `implements` (class -> interface): weight `0.9`, direction `forward`
-- `exports` (file -> function/class): weight `0.8`, direction `forward`
-- `depends_on` (file -> file): weight `0.6`, direction `forward`
-- `tested_by` (file -> test file): weight `0.5`, direction `forward`
+### Step 6 — Language notes (optional)
+
+If the file uses notable language-specific patterns (generics, decorators, macros, traits, discriminated unions, etc.), add a brief `languageNotes` string explaining the pattern and why it matters.
+
+## Node Types and ID Conventions
+
+You MUST use these exact prefixes for node IDs:
+
+| Node Type | ID Format | Example |
+|---|---|---|
+| File | `file:<relative-path>` | `file:src/index.ts` |
+| Function | `func:<relative-path>:<function-name>` | `func:src/utils.ts:formatDate` |
+| Class | `class:<relative-path>:<class-name>` | `class:src/models/User.ts:User` |
+
+**Scope restriction:** Only produce `file:`, `func:`, and `class:` nodes. The `module:` and `concept:` node types are reserved for higher-level analysis and MUST NOT be created by this agent.
+
+## Edge Types, Weights, and Directions
+
+Use ONLY these edge types with their specified weights:
+
+| Edge Type | Meaning | Weight | Direction |
+|---|---|---|---|
+| `contains` | file contains function/class | `1.0` | `forward` |
+| `imports` | file imports from another file | `0.7` | `forward` |
+| `calls` | function calls another function | `0.8` | `forward` |
+| `inherits` | class extends another class | `0.9` | `forward` |
+| `implements` | class implements an interface | `0.9` | `forward` |
+| `exports` | file exports a function/class | `0.8` | `forward` |
+| `depends_on` | file has runtime dependency on another file | `0.6` | `forward` |
+| `tested_by` | source file is tested by a test file | `0.5` | `forward` |
+
+Do NOT use edge types not listed in this table.
## Output Format
-Return a single JSON block:
+Produce a single, valid JSON block. Validate it mentally before writing -- malformed JSON breaks the entire pipeline.
```json
{
@@ -65,7 +89,7 @@ Return a single JSON block:
"type": "file",
"name": "index.ts",
"filePath": "src/index.ts",
- "summary": "Main entry point that re-exports all public modules.",
+ "summary": "Main entry point that bootstraps the application and re-exports all public modules.",
"tags": ["entry-point", "barrel", "exports"],
"complexity": "simple",
"languageNotes": "TypeScript barrel file using re-exports."
@@ -76,7 +100,7 @@ Return a single JSON block:
"name": "formatDate",
"filePath": "src/utils.ts",
"lineRange": [10, 25],
- "summary": "Formats a Date object to ISO string with timezone.",
+ "summary": "Formats a Date object to ISO string with timezone offset.",
"tags": ["utility", "date", "formatting"],
"complexity": "simple"
}
@@ -100,14 +124,44 @@ Return a single JSON block:
}
```
-## Important Notes
-
-- Create a `file:` node for EVERY file in the batch
-- Only create `func:` and `class:` nodes for significant functions/classes (skip trivial helpers, one-liners, type aliases)
-- Resolve relative import paths to full paths from project root (e.g., `./utils` -> `src/utils.ts`)
-- For import edges, only create edges to files that exist in the project (provided in the file list context)
-- Every node MUST have: id, type, name, summary, tags, complexity
-- Every edge MUST have: source, target, type, direction, weight
-- `lineRange` is optional — include for function/class nodes when determinable, omit for file nodes
-- `filePath` is required for file nodes, optional for others
-- Be thorough but concise -- summaries should be informative yet brief
+**Required fields for every node:**
+- `id` (string) — must follow the ID conventions above
+- `type` (string) — one of: `file`, `function`, `class`
+- `name` (string) — display name (filename for file nodes, function/class name for others)
+- `summary` (string) — 1-2 sentence description, NEVER empty
+- `tags` (string[]) — 3-5 lowercase hyphenated tags, NEVER empty
+- `complexity` (string) — one of: `simple`, `moderate`, `complex`
+
+**Conditionally required fields:**
+- `filePath` (string) — REQUIRED for `file` nodes, optional for others
+- `lineRange` ([number, number]) — include for `function` and `class` nodes when determinable
+
+**Optional fields:**
+- `languageNotes` (string) — only when there is a genuinely notable pattern
+
+**Required fields for every edge:**
+- `source` (string) — must reference an existing node `id` in your output or a known node from the project
+- `target` (string) — must reference an existing node `id` in your output or a known node from the project
+- `type` (string) — must be one of the 8 edge types listed above
+- `direction` (string) — always `forward`
+- `weight` (number) — must match the weight specified in the edge type table
+
+## Critical Constraints
+
+- NEVER invent file paths. Every `filePath` and every file reference in node IDs must correspond to a real file you read with the Read tool or that appears in the project file list provided to you.
+- NEVER create edges to nodes that do not exist. If an import target is not in the project file list (e.g., it is an external package like `react` or `lodash`), do NOT create an edge for it.
+- ALWAYS create a `file:` node for EVERY file in your batch, even if the file is trivial.
+- Only create `func:` and `class:` nodes for significant code elements. Skip trivial one-liners, type aliases, simple re-exports, and auto-generated boilerplate.
+- ALWAYS resolve relative import paths to project-root-relative paths (e.g., `./utils` in `src/services/auth.ts` becomes `src/services/utils.ts`). Use the full project file list to confirm the resolved path exists.
+- NEVER produce duplicate node IDs within your batch.
+- NEVER create self-referencing edges (where source equals target).
+
+## Writing Results
+
+After producing the JSON:
+
+1. Write the JSON to: `<project-root>/.understand-anything/intermediate/batch-<batchIndex>.json`
+2. The project root and batch index will be provided in your prompt.
+3. Respond with ONLY a brief text summary: number of nodes created (by type), number of edges created, and any files that were skipped.
+
+Do NOT include the full JSON in your text response.
diff --git a/understand-anything-plugin/agents/graph-reviewer.md b/understand-anything-plugin/agents/graph-reviewer.md
index 34980f83..030b0510 100644
--- a/understand-anything-plugin/agents/graph-reviewer.md
+++ b/understand-anything-plugin/agents/graph-reviewer.md
@@ -1,83 +1,112 @@
---
name: graph-reviewer
description: Validates knowledge graph completeness, referential integrity, and quality. Use as a final quality check after graph assembly.
-tools: Read
-model: haiku
+tools: Read, Write
+model: sonnet
---
-You are a QA validator for knowledge graphs produced by the Understand Anything analysis pipeline.
+You are a rigorous QA validator for knowledge graphs produced by the Understand Anything analysis pipeline. Your job is to systematically check the assembled graph for correctness, completeness, and quality, then render an approval or rejection decision with clear justification.
-## Your Task
+## Task
-Validate the assembled KnowledgeGraph JSON for correctness, completeness, and quality. Report issues and provide an approval decision.
+Read the assembled KnowledgeGraph JSON file, run all validation checks below, and produce a structured validation report.
-## Validation Checks
+## Validation Procedure
-### 1. Schema Validation
+Read the graph file provided in the prompt, then execute each validation check in order. Track every issue and warning as you go.
-Every node MUST have:
-- `id` (string, non-empty)
-- `type` (one of: `file`, `function`, `class`, `module`, `concept`)
-- `name` (string, non-empty)
-- `summary` (string, non-empty)
-- `tags` (array of strings, at least 1 tag)
-- `complexity` (one of: `simple`, `moderate`, `complex`)
+### Check 1 — Schema Validation (Critical)
-Every edge MUST have:
-- `source` (string, references an existing node ID)
-- `target` (string, references an existing node ID)
-- `type` (one of the 18 valid edge types — see below)
-- `direction` (one of: `forward`, `backward`, `bidirectional`)
-- `weight` (number between 0 and 1 inclusive)
+Verify every **node** has ALL required fields with correct types:
-Valid edge types (18 total):
+| Field | Type | Constraint |
+|---|---|---|
+| `id` | string | Non-empty, follows prefix convention |
+| `type` | string | One of: `file`, `function`, `class`, `module`, `concept` |
+| `name` | string | Non-empty |
+| `summary` | string | Non-empty, not just the filename |
+| `tags` | string[] | At least 1 element, all lowercase and hyphenated |
+| `complexity` | string | One of: `simple`, `moderate`, `complex` |
+
+Verify every **edge** has ALL required fields with correct types:
+
+| Field | Type | Constraint |
+|---|---|---|
+| `source` | string | Non-empty, references an existing node ID |
+| `target` | string | Non-empty, references an existing node ID |
+| `type` | string | One of the 18 valid edge types (see below) |
+| `direction` | string | One of: `forward`, `backward`, `bidirectional` |
+| `weight` | number | Between 0.0 and 1.0 inclusive |
+
+**Valid edge types (18 total):**
`imports`, `exports`, `contains`, `inherits`, `implements`, `calls`, `subscribes`, `publishes`, `middleware`, `reads_from`, `writes_to`, `transforms`, `validates`, `depends_on`, `tested_by`, `configures`, `related`, `similar_to`
-### 2. Referential Integrity
+### Check 2 — Referential Integrity (Critical)
-- Every edge `source` must reference an existing node `id`
-- Every edge `target` must reference an existing node `id`
-- Every `nodeIds` entry in layers must reference an existing node `id`
-- Every `nodeIds` entry in tour steps must reference an existing node `id`
+- Every edge `source` MUST reference an existing node `id`
+- Every edge `target` MUST reference an existing node `id`
+- Every `nodeIds` entry in layers MUST reference an existing node `id`
+- Every `nodeIds` entry in tour steps MUST reference an existing node `id`
+- Log every dangling reference with the specific edge/layer/step and the missing ID
-### 3. Completeness
+### Check 3 — Completeness (Critical)
- At least 1 node exists
- At least 1 edge exists
- At least 1 layer exists
- At least 1 tour step exists
-- Every file in the project's source list should have a corresponding `file:` node
-### 4. Layer Coverage
+### Check 4 — Layer Coverage (Critical)
-- Every `file` type node should appear in exactly one layer's `nodeIds`
+- Every node with `type: "file"` MUST appear in exactly one layer's `nodeIds`
- No layer should have an empty `nodeIds` array
+- Log any file nodes missing from all layers, and any file nodes appearing in multiple layers
-### 5. Tour Validation
+### Check 5 — Tour Validation (Warning)
- Tour steps have sequential `order` values starting from 1
-- Each step has at least 1 `nodeIds` entry
- No duplicate `order` values
+- Each step has at least 1 entry in `nodeIds`
+- Tour has between 5 and 15 steps
-### 6. Quality Checks
+### Check 6 — Quality Checks (Warning)
- No duplicate node IDs
-- No empty summaries or summaries that are just the filename
-- Edge weights are within 0-1 range
-- Node IDs follow conventions: `file:`, `func:`, `class:`, `module:`, `concept:`
-- No self-referencing edges (source === target)
-- Tags are lowercase and hyphenated
+- No summaries that are empty or just restate the filename (e.g., summary = "index.ts")
+- Edge weights are within 0.0-1.0 range
+- Node IDs follow conventions: must start with `file:`, `func:`, `class:`, `module:`, or `concept:`
+- No self-referencing edges (where `source` equals `target`)
+- All tags are lowercase and hyphenated (no spaces, no uppercase)
+- No orphan nodes (nodes with zero edges connecting to or from them) -- log as warning, not critical
+
+## Severity Classification
+
+**Critical issues** (cause rejection):
+- Missing required fields on any node or edge
+- Broken referential integrity (dangling references)
+- Zero nodes, edges, layers, or tour steps
+- Invalid edge types or node types
+- Edge weights outside 0.0-1.0 range
+- File nodes missing from all layers
+
+**Warnings** (acceptable, logged for improvement):
+- Orphan nodes with no edges
+- Short or generic summaries
+- Missing `languageNotes` where patterns exist
+- Tour step count outside 5-15 range
+- Non-standard tag formatting
## Output Format
-Return a single JSON block:
+Produce a single, valid JSON block.
```json
{
"approved": true,
"issues": [],
"warnings": [
- "3 function nodes have no edges connecting to them"
+ "3 function nodes have no edges connecting to them",
+ "Node 'file:src/config.ts' has a generic summary"
],
"stats": {
"totalNodes": 42,
@@ -90,14 +119,30 @@ Return a single JSON block:
}
```
+**Required fields:**
+- `approved` (boolean) — `true` if no critical issues, `false` if any critical issues exist
+- `issues` (string[]) — list of critical issues; empty array `[]` if none
+- `warnings` (string[]) — list of non-critical observations; empty array `[]` if none
+- `stats` (object) — summary statistics with `totalNodes`, `totalEdges`, `totalLayers`, `tourSteps`, `nodeTypes` (object mapping type to count), `edgeTypes` (object mapping type to count)
+
## Decision Criteria
-- **Approved** (`approved: true`): No critical issues. Warnings are acceptable.
-- **Rejected** (`approved: false`): Has critical issues listed in `issues` array. Critical issues include:
- - Missing required fields on nodes/edges
- - Broken referential integrity (dangling references)
- - Zero nodes, edges, layers, or tour steps
- - Invalid edge types or node types
- - Edge weights outside 0-1 range
+- **Approved** (`approved: true`): Zero critical issues. Any number of warnings is acceptable.
+- **Rejected** (`approved: false`): One or more critical issues exist. The `issues` array must list every critical issue found, with enough detail to locate and fix it (e.g., "Edge at index 14 references non-existent target node 'file:src/missing.ts'").
+
+## Critical Constraints
+
+- NEVER approve a graph that has critical issues. Be strict.
+- ALWAYS provide specific, actionable issue descriptions. "Broken reference" is not enough -- say which edge or layer entry has the problem and what ID is missing.
+- ALWAYS count carefully. Verify your `stats` numbers by actually counting, not estimating.
+- The `issues` and `warnings` arrays must be arrays of strings, never nested objects.
+
+## Writing Results
+
+After producing the JSON:
+
+1. Write the JSON to: `<project-root>/.understand-anything/intermediate/review.json`
+2. The project root will be provided in your prompt.
+3. Respond with ONLY a brief text summary: approved/rejected, critical issue count, warning count, and key stats.
-Warnings are non-critical observations (e.g., orphan nodes, short summaries, missing language notes).
+Do NOT include the full JSON in your text response.
diff --git a/understand-anything-plugin/agents/project-scanner.md b/understand-anything-plugin/agents/project-scanner.md
index a390a64a..86c5eb70 100644
--- a/understand-anything-plugin/agents/project-scanner.md
+++ b/understand-anything-plugin/agents/project-scanner.md
@@ -1,64 +1,90 @@
---
name: project-scanner
description: Scans a project directory to discover source files, detect programming languages and frameworks, and estimate analysis scope. Use when starting codebase analysis.
-tools: Bash, Glob, Grep, Read
-model: haiku
+tools: Bash, Glob, Grep, Read, Write
+model: sonnet
---
-You are a project scanner that inventories source files in a codebase.
-
-## Your Task
-
-Scan the project directory and produce a structured inventory of all source files, detected languages, frameworks, and estimated complexity.
-
-## Steps
-
-1. **List source files:** Run `git ls-files` to get tracked files. If not a git repo, use `find . -type f` with exclusions.
-
-2. **Exclude non-source paths:** Filter out these patterns:
- - `node_modules/`, `.git/`, `dist/`, `build/`, `coverage/`, `.next/`, `.cache/`
- - Lock files: `*.lock`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`
- - Binary files: images, fonts, compiled assets
- - Generated files: `*.min.js`, `*.map`, `*.d.ts`
-
-3. **Detect languages** from file extensions:
- - `.ts`, `.tsx` → typescript
- - `.js`, `.jsx` → javascript
- - `.py` → python
- - `.go` → go
- - `.rs` → rust
- - `.java` → java
- - `.rb` → ruby
- - `.cpp`, `.cc`, `.cxx`, `.h`, `.hpp` → cpp
- - `.c` → c
- - `.cs` → csharp
- - `.swift` → swift
- - `.kt` → kotlin
- - `.php` → php
- - `.vue` → vue
- - `.svelte` → svelte
-
-4. **Detect frameworks** by reading config files:
- - `package.json` → check dependencies for React, Vue, Svelte, Express, Next.js, Vite, etc.
- - `tsconfig.json` → TypeScript project
- - `Cargo.toml` → Rust project
- - `go.mod` → Go project
- - `requirements.txt` / `pyproject.toml` → Python project
- - `Gemfile` → Ruby project
-
-5. **Read project description** from README.md (first 10 lines) or package.json description field.
-
-6. **Count lines** per file using `wc -l` on a representative sample if >50 files.
-
-7. **Estimate complexity:**
- - `small`: ≤20 files
- - `moderate`: 21-100 files
- - `large`: 101-500 files
- - `very-large`: >500 files (warn user, suggest scope filtering)
+You are a meticulous project inventory specialist. Your job is to scan a codebase directory and produce a precise, structured inventory of all source files, detected languages, frameworks, and estimated complexity. Accuracy is paramount — every file path you report must actually exist on disk.
+
+## Task
+
+Scan the project directory provided in the prompt and produce a JSON inventory. Follow each step below in order.
+
+## Step-by-Step Procedure
+
+### Step 1 — Discover source files
+
+Run `git ls-files` to get all tracked files. If this fails (not a git repo), fall back to `find . -type f` with appropriate exclusions.
+
+### Step 2 — Exclude non-source paths
+
+Filter out ALL of the following patterns:
+- **Dependency directories:** `node_modules/`, `.git/`, `vendor/`, `venv/`, `.venv/`
+- **Build output:** `dist/`, `build/`, `out/`, `coverage/`, `.next/`, `.cache/`, `.turbo/`
+- **Lock files:** `*.lock`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`
+- **Binary/asset files:** images (`.png`, `.jpg`, `.svg`, `.ico`), fonts (`.woff`, `.ttf`), compiled assets
+- **Generated files:** `*.min.js`, `*.map`, `*.d.ts`, `*.generated.*`
+- **IDE/editor config:** `.idea/`, `.vscode/` (unless specifically source-relevant)
+
+### Step 3 — Detect languages from file extensions
+
+Map extensions to language identifiers using this table:
+
+| Extensions | Language ID |
+|---|---|
+| `.ts`, `.tsx` | `typescript` |
+| `.js`, `.jsx` | `javascript` |
+| `.py` | `python` |
+| `.go` | `go` |
+| `.rs` | `rust` |
+| `.java` | `java` |
+| `.rb` | `ruby` |
+| `.cpp`, `.cc`, `.cxx`, `.h`, `.hpp` | `cpp` |
+| `.c` | `c` |
+| `.cs` | `csharp` |
+| `.swift` | `swift` |
+| `.kt` | `kotlin` |
+| `.php` | `php` |
+| `.vue` | `vue` |
+| `.svelte` | `svelte` |
+
+Only include languages that actually appear in the file list. Do not guess or infer languages beyond what the file extensions show.
+
+### Step 4 — Detect frameworks from config files
+
+Read the following config files **if they exist** (use Read tool, do not guess):
+- `package.json` — check `dependencies` and `devDependencies` for React, Vue, Svelte, Express, Next.js, Vite, Vitest, Jest, etc.
+- `tsconfig.json` — confirms TypeScript usage
+- `Cargo.toml` — Rust project
+- `go.mod` — Go project
+- `requirements.txt` / `pyproject.toml` / `setup.py` — Python project
+- `Gemfile` — Ruby project
+
+Only list frameworks you can confirm from these config files. NEVER guess at frameworks.
+
+### Step 5 — Read project description
+
+Extract a brief project description from one of these sources (in priority order):
+1. `package.json` `description` field
+2. First 10 lines of `README.md`
+3. If neither exists, use: `"No description available"`
+
+### Step 6 — Count lines per file
+
+For each source file, get line counts using `wc -l`. If there are more than 50 source files, sample a representative set and estimate for the rest.
+
+### Step 7 — Estimate complexity
+
+Classify the project by source file count:
+- `small`: 1-20 files
+- `moderate`: 21-100 files
+- `large`: 101-500 files
+- `very-large`: >500 files
## Output Format
-Return a single JSON block:
+Produce a single, valid JSON block matching this exact structure. Every field shown below is **required**.
```json
{
@@ -74,9 +100,30 @@ Return a single JSON block:
}
```
-## Important Notes
+**Field requirements:**
+- `name` (string): Project name from `package.json` name field, or directory name as fallback
+- `description` (string): 1-2 sentence description
+- `languages` (string[]): Deduplicated, sorted alphabetically
+- `frameworks` (string[]): Only confirmed frameworks; empty array `[]` if none detected
+- `files` (object[]): Every source file, sorted by `path` alphabetically. Each entry has `path` (string, relative to project root), `language` (string), `sizeLines` (integer)
+- `totalFiles` (integer): Must equal `files.length`
+- `estimatedComplexity` (string): One of `small`, `moderate`, `large`, `very-large`
+
+## Critical Constraints
+
+- NEVER invent or guess file paths. Every `path` in the `files` array must come directly from the file discovery commands you ran.
+- NEVER include files that do not exist on disk.
+- ALWAYS validate that `totalFiles` matches the actual length of the `files` array.
+- ALWAYS sort `files` by `path` for deterministic output.
+- Only include source code files in `files` — no configs, docs, images, or assets.
+- If there are >200 source files, include a note in `description` suggesting the user may want to scope the analysis to a subdirectory.
+
+## Writing Results
+
+After producing the JSON:
+
+1. Create the output directory: `mkdir -p <project-root>/.understand-anything/intermediate`
+2. Write the JSON to: `<project-root>/.understand-anything/intermediate/scan-result.json`
+3. Respond with ONLY a brief text summary: project name, total file count, detected languages, estimated complexity.
-- Only include source code files in the `files` array (no configs, docs, or assets unless they are critical like `package.json`)
-- Sort files by path for deterministic output
-- If there are >200 source files, note this in the output and suggest the user may want to scope the analysis
-- Be fast — use Glob and Bash for file discovery, only Read individual files when needed for framework detection
+Do NOT include the full JSON in your text response.
diff --git a/understand-anything-plugin/agents/tour-builder.md b/understand-anything-plugin/agents/tour-builder.md
index 87b84f10..30496051 100644
--- a/understand-anything-plugin/agents/tour-builder.md
+++ b/understand-anything-plugin/agents/tour-builder.md
@@ -1,50 +1,77 @@
---
name: tour-builder
description: Creates guided learning tours for codebases, designing step-by-step walkthroughs that teach project architecture and key concepts. Use after architecture analysis is complete.
-tools: Read, Grep, Glob
-model: sonnet
+tools: Read, Grep, Glob, Write
+model: opus
---
-You are a technical educator that designs learning paths through codebases.
+You are an expert technical educator who designs learning paths through codebases. Your job is to create a guided tour of 5-15 steps that teaches someone the project's architecture and key concepts in a logical, pedagogical order. Each step should build on previous ones, creating a coherent narrative that takes a newcomer from "What is this project?" to "I understand how it works."
-## Your Task
+## Task
-Given a codebase's nodes, edges, and layers, design a guided tour of 5-15 steps that teaches someone the project's architecture and key concepts.
+Given a codebase's nodes, edges, and layers, design a guided tour that teaches the project's architecture and key concepts. The tour must reference only real node IDs from the provided graph data.
-## Steps
+## Step-by-Step Procedure
-1. **Identify entry points:** Find the main entry file(s) — typically `index.ts`, `main.ts`, `app.ts`, `server.ts`, or files with "entry" in tags.
+### Step 1 — Identify entry points
-2. **Follow dependency flow:** Start from entry points and trace imports/calls outward:
- - Entry point → core services → utilities
- - API routes → handlers → data layer
- - UI components → state → services
+Find the main entry file(s) by looking for:
+- Files named `index.ts`, `main.ts`, `app.ts`, `server.ts`, `mod.rs`, `main.go`, `main.py`
+- Files with `entry-point` or `barrel` in their tags
+- Files that are imported by many other files but import few themselves
-3. **Group related nodes:** Each tour step should focus on 1-5 related nodes that teach one concept or area.
+### Step 2 — Trace the dependency flow
-4. **Design pedagogical order:**
- - Step 1: Always start with the entry point / project overview
- - Steps 2-3: Core abstractions and types
- - Steps 4-6: Main feature modules
- - Steps 7-9: Supporting infrastructure (middleware, utilities, config)
- - Steps 10+: Advanced topics, tests, deployment
+Starting from entry points, follow the import and call edges outward to understand the project's execution flow:
+- Entry point -> core services -> utilities
+- API routes -> handlers -> data layer
+- UI components -> state management -> services
-5. **Write descriptions:** Each step description should:
- - Explain what this area does and WHY it matters
- - Connect it to previous steps ("Building on the types from Step 2...")
- - Highlight key patterns or design decisions
- - Be written for someone new to the codebase
+### Step 3 — Group related nodes into tour steps
-6. **Add language lessons** (optional): If a step involves notable language patterns, include a brief `languageLesson`:
- - TypeScript: generics, discriminated unions, utility types, decorators
- - React: hooks, context, render patterns, suspense
- - Python: decorators, generators, context managers, metaclasses
- - Go: goroutines, channels, interfaces, embedding
- - Rust: ownership, lifetimes, traits, pattern matching
+Each tour step should focus on 1-5 related nodes that together teach one concept or area of the codebase. Good groupings:
+- A service file and its types
+- A set of related API routes
+- A group of UI components that form a feature
+
+### Step 4 — Design the pedagogical order
+
+Follow this progression pattern:
+
+| Step Range | Focus | Purpose |
+|---|---|---|
+| Step 1 | Entry point / project overview | Orient the reader |
+| Steps 2-3 | Core types, interfaces, data models | Establish the vocabulary |
+| Steps 4-6 | Main feature modules | Show the primary functionality |
+| Steps 7-9 | Supporting infrastructure | Explain middleware, utilities, config |
+| Steps 10+ | Advanced topics, tests, deployment | Cover secondary concerns |
+
+Adjust the number of steps to the project's size: small projects need 5-7 steps, large projects may need 12-15.
+
+### Step 5 — Write step descriptions
+
+Each description must:
+- Explain WHAT this area does and WHY it matters to the project
+- Connect to previous steps (e.g., "Building on the User types from Step 2, this service implements...")
+- Highlight key design decisions or patterns
+- Be written for someone who has never seen this codebase before
+- Be 2-4 sentences long
+
+Bad description: "This is the auth service file."
+Good description: "The authentication service handles user login, token generation, and session management. It builds on the User model from Step 2 and uses the JWT utility from Step 3. Notice the strategy pattern here -- different auth providers (OAuth, email/password) implement a common AuthProvider interface."
+
+### Step 6 — Add language lessons (optional)
+
+If a step involves notable language-specific patterns, include a brief `languageLesson` string. Only add these when genuinely educational:
+- **TypeScript:** generics, discriminated unions, utility types, decorators, template literal types
+- **React:** hooks, context, render patterns, suspense, compound components
+- **Python:** decorators, generators, context managers, metaclasses, protocols
+- **Go:** goroutines, channels, interfaces, embedding, error wrapping
+- **Rust:** ownership, lifetimes, traits, pattern matching, async/await
## Output Format
-Return a single JSON block:
+Produce a single, valid JSON block.
```json
{
@@ -52,26 +79,45 @@ Return a single JSON block:
{
"order": 1,
"title": "Entry Point",
- "description": "Start with src/index.ts, the main entry point that bootstraps the application. This file imports and initializes core modules, sets up configuration, and starts the server.",
+ "description": "Start with src/index.ts, the main entry point that bootstraps the application. This file imports and initializes core modules, sets up configuration, and starts the server. It gives you a bird's-eye view of the project's structure.",
"nodeIds": ["file:src/index.ts"],
"languageLesson": "TypeScript barrel files use 'export * from' to re-export modules, creating a clean public API surface."
},
{
"order": 2,
- "title": "Core Types",
- "description": "The type system defines the domain model. These interfaces are used throughout the codebase and form the contract between layers.",
+ "title": "Core Types and Models",
+ "description": "The type system defines the domain model. These interfaces establish the vocabulary used throughout the codebase and form the contract between layers.",
"nodeIds": ["file:src/types.ts", "file:src/interfaces/user.ts"]
}
]
}
```
-## Important Notes
+**Required fields for every step:**
+- `order` (integer) — sequential starting from 1, no gaps, no duplicates
+- `title` (string) — short, descriptive title (2-5 words)
+- `description` (string) — 2-4 sentences explaining the area and its importance
+- `nodeIds` (string[]) — 1-5 node IDs from the provided graph, NEVER empty
+
+**Optional fields:**
+- `languageLesson` (string) — brief explanation of a language pattern, only when genuinely useful
+
+## Critical Constraints
+
+- NEVER reference node IDs that do not exist in the provided graph data. Every entry in `nodeIds` must match an actual node `id` from the input.
+- NEVER create steps with empty `nodeIds` arrays.
+- The `order` field MUST be sequential integers starting from 1 with no gaps (1, 2, 3, ..., N).
+- Tour MUST have between 5 and 15 steps inclusive.
+- Steps MUST build on each other — the tour tells a story, not a random list of files.
+- Not every file needs to appear in the tour. Focus on the most important and illustrative files that teach the architecture.
+- ALWAYS start with the project entry point or overview in Step 1.
+
+## Writing Results
+
+After producing the JSON:
+
+1. Write the JSON to: `<project-root>/.understand-anything/intermediate/tour.json`
+2. The project root will be provided in your prompt.
+3. Respond with ONLY a brief text summary: number of steps and their titles in order.
-- Tour should have 5-15 steps (aim for 8-10 for most projects)
-- Every `nodeIds` entry must reference a valid node ID from the graph
-- Steps should build on each other — later steps can reference earlier ones
-- `languageLesson` is optional — only include when there's a genuinely useful pattern to teach
-- Focus on the most important files/concepts; not every file needs to be in the tour
-- The tour tells the story of the codebase: "Here's how this project works, from the ground up"
-- `order` must be sequential starting from 1
+Do NOT include the full JSON in your text response.
diff --git a/understand-anything-plugin/package.json b/understand-anything-plugin/package.json
index c4df88f8..3b3d9d64 100644
--- a/understand-anything-plugin/package.json
+++ b/understand-anything-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@understand-anything/skill",
- "version": "0.1.0",
+ "version": "1.0.1",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
diff --git a/understand-anything-plugin/packages/core/package.json b/understand-anything-plugin/packages/core/package.json
index e8a05556..f26319bd 100644
--- a/understand-anything-plugin/packages/core/package.json
+++ b/understand-anything-plugin/packages/core/package.json
@@ -16,6 +16,10 @@
"./types": {
"types": "./dist/types.d.ts",
"default": "./dist/types.js"
+ },
+ "./schema": {
+ "types": "./dist/schema.d.ts",
+ "default": "./dist/schema.js"
}
},
"scripts": {
diff --git a/understand-anything-plugin/packages/dashboard/index.html b/understand-anything-plugin/packages/dashboard/index.html
index 429059d8..07bd687b 100644
--- a/understand-anything-plugin/packages/dashboard/index.html
+++ b/understand-anything-plugin/packages/dashboard/index.html
@@ -4,6 +4,12 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Understand Anything</title>
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
+ <link
+ href="https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap"
+ rel="stylesheet"
+ />
</head>
<body>
<div id="root"></div>
diff --git a/understand-anything-plugin/packages/dashboard/package.json b/understand-anything-plugin/packages/dashboard/package.json
index 58e10a23..623d6a36 100644
--- a/understand-anything-plugin/packages/dashboard/package.json
+++ b/understand-anything-plugin/packages/dashboard/package.json
@@ -9,9 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
- "@anthropic-ai/sdk": "^0.78.0",
"@dagrejs/dagre": "^2.0.4",
- "@monaco-editor/react": "^4.7.0",
"@understand-anything/core": "workspace:*",
"@xyflow/react": "^12.0.0",
"react": "^19.0.0",
diff --git a/understand-anything-plugin/packages/dashboard/src/App.tsx b/understand-anything-plugin/packages/dashboard/src/App.tsx
index d1690458..3d29e05d 100644
--- a/understand-anything-plugin/packages/dashboard/src/App.tsx
+++ b/understand-anything-plugin/packages/dashboard/src/App.tsx
@@ -1,167 +1,111 @@
-import { useEffect } from "react";
-import type { KnowledgeGraph } from "@understand-anything/core";
+import { useEffect, useState } from "react";
+import { validateGraph } from "@understand-anything/core/schema";
import { useDashboardStore } from "./store";
import GraphView from "./components/GraphView";
import CodeViewer from "./components/CodeViewer";
import SearchBar from "./components/SearchBar";
import NodeInfo from "./components/NodeInfo";
-import ChatPanel from "./components/ChatPanel";
import LayerLegend from "./components/LayerLegend";
import LearnPanel from "./components/LearnPanel";
import PersonaSelector from "./components/PersonaSelector";
+import ProjectOverview from "./components/ProjectOverview";
function App() {
const graph = useDashboardStore((s) => s.graph);
const setGraph = useDashboardStore((s) => s.setGraph);
+ const selectedNodeId = useDashboardStore((s) => s.selectedNodeId);
const tourActive = useDashboardStore((s) => s.tourActive);
- const startTour = useDashboardStore((s) => s.startTour);
- const stopTour = useDashboardStore((s) => s.stopTour);
const persona = useDashboardStore((s) => s.persona);
+ const codeViewerOpen = useDashboardStore((s) => s.codeViewerOpen);
+ const closeCodeViewer = useDashboardStore((s) => s.closeCodeViewer);
+ const [loadError, setLoadError] = useState<string | null>(null);
useEffect(() => {
fetch("/knowledge-graph.json")
.then((res) => res.json())
- .then((data: KnowledgeGraph) => setGraph(data))
- .catch((err) => console.error("Failed to load knowledge graph:", err));
+ .then((data: unknown) => {
+ const result = validateGraph(data);
+ if (result.success && result.data) {
+ setGraph(result.data);
+ } else {
+ const errorMsg = result.errors?.join("; ") ?? "Unknown validation error";
+ console.error("Knowledge graph validation failed:", errorMsg);
+ setLoadError(`Invalid knowledge graph: ${errorMsg}`);
+ }
+ })
+ .catch((err) => {
+ console.error("Failed to load knowledge graph:", err);
+ setLoadError(`Failed to load knowledge graph: ${err instanceof Error ? err.message : String(err)}`);
+ });
}, [setGraph]);
- const nodeCount = graph?.nodes.length ?? 0;
- const edgeCount = graph?.edges.length ?? 0;
- const hasTour = (graph?.tour.length ?? 0) > 0;
+ // Determine sidebar content
+ // Learn persona always shows LearnPanel; tour active overrides everything
+ const sidebarContent = tourActive || persona === "junior" ? (
+ <LearnPanel />
+ ) : selectedNodeId ? (
+ <NodeInfo />
+ ) : (
+ <ProjectOverview />
+ );
return (
- <div className="h-screen w-screen flex flex-col bg-gray-900 text-white">
+ <div className="h-screen w-screen flex flex-col bg-root text-text-primary noise-overlay">
{/* Header */}
- <div className="flex items-center justify-between px-4 py-2 bg-gray-950 border-b border-gray-800 shrink-0">
- <div className="flex items-center gap-4">
- <h1 className="text-sm font-bold tracking-widest text-gray-200">
- UNDERSTAND ANYTHING
+ <header className="flex items-center justify-between px-5 py-3 bg-surface border-b border-border-subtle shrink-0">
+ <div className="flex items-center gap-5">
+ <h1 className="font-serif text-lg text-text-primary tracking-wide">
+ {graph?.project.name ?? "Understand Anything"}
</h1>
+ <div className="w-px h-5 bg-border-subtle" />
<PersonaSelector />
</div>
- <div className="flex items-center gap-4 text-xs text-gray-400">
- {graph && (
- <>
- <span>{graph.project.name}</span>
- <span className="text-gray-600">|</span>
- <span>{nodeCount} nodes</span>
- <span className="text-gray-600">|</span>
- <span>{edgeCount} edges</span>
- <span className="text-gray-600">|</span>
- <LayerLegend />
- </>
- )}
+ <div className="flex items-center gap-4">
+ <LayerLegend />
</div>
- </div>
+ </header>
- {/* Search Bar */}
+ {/* Search */}
<SearchBar />
- {/* Persona-adaptive layout */}
- {persona === "non-technical" ? (
- /* Non-technical: 2-column layout — graph + stacked learn/chat (no CodeViewer) */
- <div className="flex-1 grid grid-cols-2 gap-1 p-1 min-h-0">
- <div className="min-h-0 min-w-0">
- <GraphView />
- </div>
- <div className="min-h-0 min-w-0 flex flex-col gap-1">
- <div className="flex-1 min-h-0">
- <LearnPanel />
- </div>
- <div className="flex-1 min-h-0">
- <ChatPanel />
- </div>
- </div>
+ {/* Error banner */}
+ {loadError && (
+ <div className="px-5 py-3 bg-red-900/30 border-b border-red-700 text-red-200 text-sm">
+ {loadError}
</div>
- ) : (
- /* Junior + Experienced: 4-panel grid */
- <div className="flex-1 grid grid-cols-2 grid-rows-2 gap-1 p-1 min-h-0">
- {/* Top-left: Graph View */}
- <div className="min-h-0 min-w-0">
- <GraphView />
- </div>
+ )}
- {/* Top-right: Code Viewer */}
- <div className="min-h-0 min-w-0">
- <CodeViewer />
- </div>
+ {/* Main content: Graph + Sidebar */}
+ <div className="flex-1 flex min-h-0 relative">
+ {/* Graph area */}
+ <div className="flex-1 min-w-0 min-h-0">
+ <GraphView />
+ </div>
- {/* Bottom-left: Chat */}
- <div className="min-h-0 min-w-0">
- <ChatPanel />
- </div>
+ {/* Right sidebar */}
+ <aside className="w-[360px] shrink-0 bg-surface border-l border-border-subtle overflow-hidden">
+ {sidebarContent}
+ </aside>
- {/* Bottom-right: persona-dependent */}
- <div className="min-h-0 min-w-0 flex flex-col">
- {persona === "junior" ? (
- /* Junior: always show tabbed Details/Tour panel */
- hasTour ? (
- <>
- <div className="flex bg-gray-800 rounded-t-lg border-b border-gray-700 shrink-0">
- <button
- onClick={() => {
- if (tourActive) stopTour();
- }}
- className={`flex-1 text-xs font-medium py-1.5 px-3 transition-colors ${
- !tourActive
- ? "text-white border-b-2 border-indigo-500"
- : "text-gray-500 hover:text-gray-300"
- }`}
- >
- Details
- </button>
- <button
- onClick={() => {
- if (!tourActive) startTour();
- }}
- className={`flex-1 text-xs font-medium py-1.5 px-3 transition-colors ${
- tourActive
- ? "text-white border-b-2 border-indigo-500"
- : "text-gray-500 hover:text-gray-300"
- }`}
- >
- Tour
- </button>
- </div>
- <div className="flex-1 min-h-0">
- {tourActive ? <LearnPanel /> : <NodeInfo />}
- </div>
- </>
- ) : (
- <NodeInfo />
- )
- ) : (
- /* Experienced: show tabbed panel only when tour is explicitly active */
- tourActive && hasTour ? (
- <>
- <div className="flex bg-gray-800 rounded-t-lg border-b border-gray-700 shrink-0">
- <button
- onClick={() => stopTour()}
- className={`flex-1 text-xs font-medium py-1.5 px-3 transition-colors ${
- !tourActive
- ? "text-white border-b-2 border-indigo-500"
- : "text-gray-500 hover:text-gray-300"
- }`}
- >
- Details
- </button>
- <button
- className="flex-1 text-xs font-medium py-1.5 px-3 transition-colors text-white border-b-2 border-indigo-500"
- >
- Tour
- </button>
- </div>
- <div className="flex-1 min-h-0">
- <LearnPanel />
- </div>
- </>
- ) : (
- <NodeInfo />
- )
- )}
+ {/* Code viewer overlay */}
+ {codeViewerOpen && (
+ <div className="absolute bottom-0 left-0 right-0 h-[40vh] bg-surface border-t border-border-subtle animate-slide-up z-20">
+ <div className="h-full flex flex-col">
+ <div className="flex items-center justify-end px-3 py-1 shrink-0">
+ <button
+ onClick={closeCodeViewer}
+ className="text-text-muted hover:text-text-primary text-xs transition-colors"
+ >
+ Close
+ </button>
+ </div>
+ <div className="flex-1 min-h-0">
+ <CodeViewer />
+ </div>
+ </div>
</div>
- </div>
- )}
+ )}
+ </div>
</div>
);
}
diff --git a/understand-anything-plugin/packages/dashboard/src/components/ChatPanel.tsx b/understand-anything-plugin/packages/dashboard/src/components/ChatPanel.tsx
deleted file mode 100644
index ca0d9475..00000000
--- a/understand-anything-plugin/packages/dashboard/src/components/ChatPanel.tsx
+++ /dev/null
@@ -1,253 +0,0 @@
-import { useEffect, useRef, useState } from "react";
-import ReactMarkdown from "react-markdown";
-import { useDashboardStore } from "../store";
-
-export default function ChatPanel() {
- const graph = useDashboardStore((s) => s.graph);
- const selectedNodeId = useDashboardStore((s) => s.selectedNodeId);
- const apiKey = useDashboardStore((s) => s.apiKey);
- const chatMessages = useDashboardStore((s) => s.chatMessages);
- const chatLoading = useDashboardStore((s) => s.chatLoading);
- const setApiKey = useDashboardStore((s) => s.setApiKey);
- const sendChatMessage = useDashboardStore((s) => s.sendChatMessage);
- const clearChat = useDashboardStore((s) => s.clearChat);
-
- const [input, setInput] = useState("");
- const [keyInput, setKeyInput] = useState("");
- const messagesEndRef = useRef<HTMLDivElement>(null);
-
- const selectedNode = graph?.nodes.find((n) => n.id === selectedNodeId);
-
- // Load API key from localStorage on mount
- useEffect(() => {
- const storedKey = localStorage.getItem("ua-api-key");
- if (storedKey) {
- setApiKey(storedKey);
- }
- }, [setApiKey]);
-
- // Auto-scroll to latest message
- useEffect(() => {
- messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
- }, [chatMessages, chatLoading]);
-
- const handleSend = () => {
- if (!input.trim() || chatLoading || !apiKey) return;
- sendChatMessage(input.trim());
- setInput("");
- };
-
- const handleKeyDown = (e: React.KeyboardEvent) => {
- if (e.key === "Enter" && !e.shiftKey) {
- e.preventDefault();
- handleSend();
- }
- };
-
- const handleSetKey = () => {
- if (keyInput.trim()) {
- setApiKey(keyInput.trim());
- setKeyInput("");
- }
- };
-
- const handleKeyInputKeyDown = (e: React.KeyboardEvent) => {
- if (e.key === "Enter") {
- e.preventDefault();
- handleSetKey();
- }
- };
-
- // Clear API key from store and localStorage so the user can re-enter it.
- // Note: the API key is stored in localStorage as plain text. This is a known
- // tradeoff — it keeps the UX simple (key survives page reloads) at the cost
- // of exposing the key to anything that can read localStorage. A more secure
- // approach would use a backend proxy or session-scoped memory only.
- const handleClearKey = () => {
- localStorage.removeItem("ua-api-key");
- setApiKey("");
- };
-
- return (
- <div className="h-full w-full bg-gray-800 rounded-lg flex flex-col overflow-hidden">
- {/* Header */}
- <div className="flex items-center justify-between px-3 py-2 border-b border-gray-700 shrink-0">
- <h3 className="text-xs font-semibold text-gray-400 uppercase tracking-wider">
- Chat
- </h3>
- <div className="flex items-center gap-2">
- {apiKey && (
- <button
- onClick={handleClearKey}
- className="text-[10px] text-gray-500 hover:text-gray-300 transition-colors"
- title="Change API key"
- >
- Change Key
- </button>
- )}
- {chatMessages.length > 0 && (
- <button
- onClick={clearChat}
- className="text-[10px] text-gray-500 hover:text-gray-300 transition-colors"
- >
- Clear
- </button>
- )}
- </div>
- </div>
-
- {/* API Key Input */}
- {!apiKey && (
- <div className="px-3 py-2 border-b border-gray-700 shrink-0">
- <div className="flex gap-2">
- <input
- type="password"
- value={keyInput}
- onChange={(e) => setKeyInput(e.target.value)}
- onKeyDown={handleKeyInputKeyDown}
- placeholder="Enter Anthropic API key..."
- className="flex-1 bg-gray-700 text-xs text-white rounded px-2 py-1.5 placeholder-gray-500 outline-none focus:ring-1 focus:ring-blue-500"
- />
- <button
- onClick={handleSetKey}
- disabled={!keyInput.trim()}
- className="text-xs bg-blue-600 text-white px-2 py-1.5 rounded hover:bg-blue-500 disabled:opacity-40 disabled:cursor-not-allowed transition-colors"
- >
- Set
- </button>
- </div>
- </div>
- )}
-
- {/* Context Indicator */}
- {selectedNode && (
- <div className="px-3 py-1.5 border-b border-gray-700 shrink-0">
- <span className="text-[10px] text-gray-500">Context: </span>
- <span className="text-[10px] text-blue-400">{selectedNode.name}</span>
- </div>
- )}
-
- {/* Messages */}
- <div className="flex-1 overflow-y-auto px-3 py-2 space-y-2 min-h-0">
- {chatMessages.length === 0 && (
- <div className="flex items-center justify-center h-full">
- <p className="text-gray-500 text-xs text-center">
- {apiKey
- ? "Ask anything about this codebase"
- : "Set your API key to start chatting"}
- </p>
- </div>
- )}
-
- {chatMessages.map((msg, i) => (
- <div
- key={i}
- className={`flex ${msg.role === "user" ? "justify-end" : "justify-start"}`}
- >
- {msg.role === "user" ? (
- <div className="max-w-[85%] rounded-lg px-3 py-2 text-xs leading-relaxed whitespace-pre-wrap bg-blue-600 text-white">
- {msg.content}
- </div>
- ) : (
- <div className="max-w-[85%] rounded-lg px-3 py-2 text-xs leading-relaxed bg-gray-700 text-gray-200 chat-markdown">
- <ReactMarkdown
- components={{
- h1: ({ children }) => (
- <h1 className="text-sm font-bold mb-1 mt-2 first:mt-0">{children}</h1>
- ),
- h2: ({ children }) => (
- <h2 className="text-xs font-bold mb-1 mt-2 first:mt-0">{children}</h2>
- ),
- h3: ({ children }) => (
- <h3 className="text-xs font-semibold mb-1 mt-1.5 first:mt-0">{children}</h3>
- ),
- p: ({ children }) => (
- <p className="mb-1.5 last:mb-0">{children}</p>
- ),
- ul: ({ children }) => (
- <ul className="list-disc list-inside mb-1.5 space-y-0.5">{children}</ul>
- ),
- ol: ({ children }) => (
- <ol className="list-decimal list-inside mb-1.5 space-y-0.5">{children}</ol>
- ),
- code: ({ className, children }) => {
- const isBlock = className?.includes("language-");
- return isBlock ? (
- <code className="block bg-gray-900 rounded px-2 py-1.5 mb-1.5 overflow-x-auto text-[11px] leading-relaxed">
- {children}
- </code>
- ) : (
- <code className="bg-gray-900 rounded px-1 py-0.5 text-[11px]">
- {children}
- </code>
- );
- },
- pre: ({ children }) => (
- <pre className="mb-1.5 last:mb-0">{children}</pre>
- ),
- strong: ({ children }) => (
- <strong className="font-semibold text-white">{children}</strong>
- ),
- a: ({ href, children }) => (
- <a href={href} className="text-blue-400 underline hover:text-blue-300" target="_blank" rel="noopener noreferrer">
- {children}
- </a>
- ),
- blockquote: ({ children }) => (
- <blockquote className="border-l-2 border-gray-500 pl-2 mb-1.5 text-gray-400 italic">
- {children}
- </blockquote>
- ),
- }}
- >
- {msg.content}
- </ReactMarkdown>
- </div>
- )}
- </div>
- ))}
-
- {chatLoading && (
- <div className="flex justify-start">
- <div className="bg-gray-700 rounded-lg px-3 py-2 text-xs text-gray-400">
- <span className="inline-flex gap-1">
- <span className="animate-pulse">Thinking</span>
- <span className="animate-pulse delay-100">.</span>
- <span className="animate-pulse delay-200">.</span>
- <span className="animate-pulse delay-300">.</span>
- </span>
- </div>
- </div>
- )}
-
- <div ref={messagesEndRef} />
- </div>
-
- {/* Input */}
- <div className="px-3 py-2 border-t border-gray-700 shrink-0">
- <div className="flex gap-2">
- <input
- type="text"
- value={input}
- onChange={(e) => setInput(e.target.value)}
- onKeyDown={handleKeyDown}
- placeholder={
- apiKey
- ? "Ask about this codebase..."
- : "Set API key first"
- }
- disabled={!apiKey || chatLoading}
- className="flex-1 bg-gray-700 text-xs text-white rounded px-2 py-1.5 placeholder-gray-500 outline-none focus:ring-1 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"
- />
- <button
- onClick={handleSend}
- disabled={!apiKey || chatLoading || !input.trim()}
- className="text-xs bg-blue-600 text-white px-3 py-1.5 rounded hover:bg-blue-500 disabled:opacity-40 disabled:cursor-not-allowed transition-colors"
- >
- Send
- </button>
- </div>
- </div>
- </div>
- );
-}
diff --git a/understand-anything-plugin/packages/dashboard/src/components/CodeViewer.tsx b/understand-anything-plugin/packages/dashboard/src/components/CodeViewer.tsx
index 9d45b7a1..d1df7c3a 100644
--- a/understand-anything-plugin/packages/dashboard/src/components/CodeViewer.tsx
+++ b/understand-anything-plugin/packages/dashboard/src/components/CodeViewer.tsx
@@ -1,113 +1,91 @@
-import Editor from "@monaco-editor/react";
import { useDashboardStore } from "../store";
-const extensionToLanguage: Record<string, string> = {
- ts: "typescript",
- tsx: "typescript",
- js: "javascript",
- jsx: "javascript",
- py: "python",
- go: "go",
- rs: "rust",
- rb: "ruby",
- java: "java",
- kt: "kotlin",
- cs: "csharp",
- cpp: "cpp",
- c: "c",
- swift: "swift",
- php: "php",
- json: "json",
- yaml: "yaml",
- yml: "yaml",
- md: "markdown",
- html: "html",
- css: "css",
- sql: "sql",
- sh: "shell",
- bash: "shell",
-};
-
-function getLanguage(filePath: string | undefined): string {
- if (!filePath) return "plaintext";
- const ext = filePath.split(".").pop()?.toLowerCase() ?? "";
- return extensionToLanguage[ext] ?? "plaintext";
-}
-
export default function CodeViewer() {
const graph = useDashboardStore((s) => s.graph);
- const selectedNodeId = useDashboardStore((s) => s.selectedNodeId);
+ const codeViewerNodeId = useDashboardStore((s) => s.codeViewerNodeId);
+ const closeCodeViewer = useDashboardStore((s) => s.closeCodeViewer);
- const node = graph?.nodes.find((n) => n.id === selectedNodeId) ?? null;
+ const node = graph?.nodes.find((n) => n.id === codeViewerNodeId) ?? null;
if (!node) {
return (
- <div className="h-full w-full flex items-center justify-center bg-gray-800 rounded-lg">
- <p className="text-gray-400 text-sm">
- Select a node to view its source code
- </p>
+ <div className="h-full w-full flex items-center justify-center bg-surface">
+ <p className="text-text-muted text-sm">No file selected</p>
</div>
);
}
- const language = getLanguage(node.filePath);
const lineInfo = node.lineRange
- ? `Lines ${node.lineRange[0]}-${node.lineRange[1]}`
+ ? `Lines ${node.lineRange[0]}\u2013${node.lineRange[1]}`
: "Full file";
- const placeholderCode = [
- `// ${node.name}`,
- `// Type: ${node.type}`,
- `// File: ${node.filePath ?? "unknown"}`,
- `// ${lineInfo}`,
- `//`,
- `// Summary:`,
- `// ${node.summary}`,
- `//`,
- `// Note: Source code display requires file content access.`,
- `// In a full integration, this panel will show the actual`,
- `// source code from the analyzed project.`,
- "",
- ...(node.tags.length > 0
- ? [`// Tags: ${node.tags.join(", ")}`]
- : []),
- ...(node.languageNotes
- ? [`//`, `// Language Notes:`, `// ${node.languageNotes}`]
- : []),
- ].join("\n");
-
return (
- <div className="h-full w-full flex flex-col bg-gray-800 rounded-lg overflow-hidden">
- <div className="flex items-center gap-3 px-3 py-2 bg-gray-900 border-b border-gray-700 shrink-0">
- <span className="text-[10px] font-semibold uppercase tracking-wider text-gray-400 bg-gray-700 px-2 py-0.5 rounded">
+ <div className="h-full w-full flex flex-col bg-surface overflow-hidden">
+ {/* Header */}
+ <div className="flex items-center gap-3 px-4 py-2.5 bg-elevated border-b border-border-subtle shrink-0">
+ <span
+ className="text-[10px] font-semibold uppercase tracking-wider px-2 py-0.5 rounded border"
+ style={{
+ color: "var(--color-node-file)",
+ borderColor: "rgba(74,124,155,0.3)",
+ backgroundColor: "rgba(74,124,155,0.1)",
+ }}
+ >
{node.type}
</span>
- <span className="text-sm font-bold text-white truncate">
+ <span className="text-sm font-serif text-text-primary truncate">
{node.name}
</span>
{node.filePath && (
- <span className="text-xs text-gray-500 truncate ml-auto">
+ <span className="text-xs font-mono text-text-muted truncate ml-auto">
{node.filePath}
</span>
)}
+ <span className="text-[10px] text-text-muted">{lineInfo}</span>
+ <button
+ onClick={closeCodeViewer}
+ className="text-text-muted hover:text-text-primary ml-2 transition-colors"
+ >
+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
+ </svg>
+ </button>
</div>
- <div className="flex-1 min-h-0">
- <Editor
- height="100%"
- language={language}
- value={placeholderCode}
- theme="vs-dark"
- options={{
- readOnly: true,
- minimap: { enabled: false },
- fontSize: 13,
- lineNumbers: "on",
- scrollBeyondLastLine: false,
- wordWrap: "on",
- padding: { top: 8 },
- }}
- />
+ {/* Body */}
+ <div className="flex-1 overflow-auto p-5">
+ {/* Summary */}
+ <div className="mb-4">
+ <h4 className="text-[11px] font-semibold text-gold uppercase tracking-wider mb-2">Summary</h4>
+ <p className="text-sm text-text-secondary leading-relaxed">{node.summary}</p>
+ </div>
+
+ {/* Language notes callout */}
+ {node.languageNotes && (
+ <div className="mb-4 bg-gold/5 border border-gold/20 rounded-lg p-3">
+ <h4 className="text-[11px] font-semibold text-gold uppercase tracking-wider mb-1.5">Language Notes</h4>
+ <p className="text-sm text-text-secondary leading-relaxed">{node.languageNotes}</p>
+ </div>
+ )}
+
+ {/* Tags */}
+ {node.tags.length > 0 && (
+ <div className="mb-4">
+ <h4 className="text-[11px] font-semibold text-gold uppercase tracking-wider mb-2">Tags</h4>
+ <div className="flex flex-wrap gap-1.5">
+ {node.tags.map((tag) => (
+ <span key={tag} className="text-[11px] glass text-text-secondary px-2.5 py-1 rounded-full">
+ {tag}
+ </span>
+ ))}
+ </div>
+ </div>
+ )}
+
+ {/* Source note */}
+ <div className="text-[11px] text-text-muted italic">
+ Source code available locally at {node.filePath ?? "the project directory"}
+ </div>
</div>
</div>
);
diff --git a/understand-anything-plugin/packages/dashboard/src/components/CustomNode.tsx b/understand-anything-plugin/packages/dashboard/src/components/CustomNode.tsx
index 58273bdb..57199e98 100644
--- a/understand-anything-plugin/packages/dashboard/src/components/CustomNode.tsx
+++ b/understand-anything-plugin/packages/dashboard/src/components/CustomNode.tsx
@@ -1,39 +1,26 @@
import { Handle, Position } from "@xyflow/react";
import type { NodeProps, Node } from "@xyflow/react";
-const typeColors: Record<string, { bg: string; border: string; text: string }> =
- {
- file: {
- bg: "bg-blue-900",
- border: "border-blue-500",
- text: "text-blue-300",
- },
- function: {
- bg: "bg-green-900",
- border: "border-green-500",
- text: "text-green-300",
- },
- class: {
- bg: "bg-purple-900",
- border: "border-purple-500",
- text: "text-purple-300",
- },
- module: {
- bg: "bg-orange-900",
- border: "border-orange-500",
- text: "text-orange-300",
- },
- concept: {
- bg: "bg-pink-900",
- border: "border-pink-500",
- text: "text-pink-300",
- },
- };
+const typeColors: Record<string, string> = {
+ file: "var(--color-node-file)",
+ function: "var(--color-node-function)",
+ class: "var(--color-node-class)",
+ module: "var(--color-node-module)",
+ concept: "var(--color-node-concept)",
+};
+
+const typeTextColors: Record<string, string> = {
+ file: "text-node-file",
+ function: "text-node-function",
+ class: "text-node-class",
+ module: "text-node-module",
+ concept: "text-node-concept",
+};
const complexityColors: Record<string, string> = {
- simple: "bg-green-600",
- moderate: "bg-yellow-600",
- complex: "bg-red-600",
+ simple: "text-node-function",
+ moderate: "text-gold-dim",
+ complex: "text-[#c97070]",
};
export interface CustomNodeData extends Record<string, unknown> {
@@ -52,64 +39,70 @@ export type CustomFlowNode = Node<CustomNodeData, "custom">;
export default function CustomNode({
data,
}: NodeProps<CustomFlowNode>) {
- const colors = typeColors[data.nodeType] ?? typeColors.file;
- const complexityColor =
- complexityColors[data.complexity] ?? complexityColors.simple;
+ const barColor = typeColors[data.nodeType] ?? typeColors.file;
+ const textColor = typeTextColors[data.nodeType] ?? typeTextColors.file;
+ const complexityColor = complexityColors[data.complexity] ?? complexityColors.simple;
- let ringClass = "";
+ let extraClass = "";
if (data.isSelected) {
- ringClass = "ring-2 ring-white";
+ extraClass = "ring-2 ring-gold node-glow";
} else if (data.isTourHighlighted) {
- ringClass = "ring-2 ring-blue-400 animate-pulse";
+ extraClass = "ring-2 ring-gold-dim animate-gold-pulse";
} else if (data.isHighlighted) {
const score = data.searchScore ?? 1;
if (score <= 0.1) {
- ringClass = "ring-2 ring-yellow-300";
+ extraClass = "ring-2 ring-gold-bright";
} else if (score <= 0.3) {
- ringClass = "ring-2 ring-yellow-400";
+ extraClass = "ring-2 ring-gold";
} else {
- ringClass = "ring-2 ring-yellow-500/60";
+ extraClass = "ring-1 ring-gold-dim/60";
}
}
+ const name = data.label ?? "unnamed";
const truncatedName =
- data.label.length > 24 ? data.label.slice(0, 22) + "..." : data.label;
+ name.length > 24 ? name.slice(0, 22) + "..." : name;
return (
<div
- className={`rounded-lg border-2 ${colors.bg} ${colors.border} ${ringClass} px-3 py-2 min-w-[180px] max-w-[220px] shadow-lg`}
+ className={`relative rounded-lg bg-elevated border border-border-subtle ${extraClass} min-w-[180px] max-w-[220px] overflow-hidden transition-all duration-200`}
+ style={{ boxShadow: '0 2px 8px rgba(0,0,0,0.3)' }}
>
+ {/* Left color bar */}
+ <div
+ className="absolute left-0 top-0 bottom-0 w-1 rounded-l-lg"
+ style={{ backgroundColor: barColor }}
+ />
+
<Handle
type="target"
position={Position.Top}
- className="!bg-gray-400 !w-2 !h-2"
+ className="!bg-text-muted !w-2 !h-2"
/>
- <div className="flex items-center justify-between mb-1">
- <span
- className={`text-[10px] font-semibold uppercase tracking-wider ${colors.text}`}
- >
- {data.nodeType}
- </span>
- <span
- className={`text-[9px] px-1.5 py-0.5 rounded-full text-white font-medium ${complexityColor}`}
- >
- {data.complexity}
- </span>
- </div>
+ <div className="pl-4 pr-3 py-2">
+ <div className="flex items-center justify-between mb-1">
+ <span className={`text-[10px] font-semibold uppercase tracking-wider ${textColor}`}>
+ {data.nodeType}
+ </span>
+ <span className={`text-[9px] font-mono ${complexityColor}`}>
+ {data.complexity}
+ </span>
+ </div>
- <div className="text-sm font-bold text-white truncate" title={data.label}>
- {truncatedName}
- </div>
+ <div className="text-sm font-serif text-text-primary truncate" title={data.label}>
+ {truncatedName}
+ </div>
- <div className="text-[11px] text-gray-300 mt-1 line-clamp-2 leading-tight">
- {data.summary}
+ <div className="text-[11px] text-text-secondary mt-1 line-clamp-2 leading-tight">
+ {data.summary}
+ </div>
</div>
<Handle
type="source"
position={Position.Bottom}
- className="!bg-gray-400 !w-2 !h-2"
+ className="!bg-text-muted !w-2 !h-2"
/>
</div>
);
diff --git a/understand-anything-plugin/packages/dashboard/src/components/GraphView.tsx b/understand-anything-plugin/packages/dashboard/src/components/GraphView.tsx
index 7583dbcc..762b1247 100644
--- a/understand-anything-plugin/packages/dashboard/src/components/GraphView.tsx
+++ b/understand-anything-plugin/packages/dashboard/src/components/GraphView.tsx
@@ -4,6 +4,7 @@ import {
useNodesState,
useEdgesState,
Background,
+ BackgroundVariant,
Controls,
MiniMap,
} from "@xyflow/react";
@@ -14,7 +15,7 @@ import CustomNode from "./CustomNode";
import type { CustomFlowNode } from "./CustomNode";
import { useDashboardStore } from "../store";
import { applyDagreLayout, NODE_WIDTH, NODE_HEIGHT } from "../utils/layout";
-import { getLayerColor, getLayerBorderColor } from "./LayerLegend";
+// Layer colors are hardcoded to gold-tinted values in the group node styles
const LAYER_PADDING = 40;
@@ -25,6 +26,7 @@ export default function GraphView() {
const selectedNodeId = useDashboardStore((s) => s.selectedNodeId);
const searchResults = useDashboardStore((s) => s.searchResults);
const selectNode = useDashboardStore((s) => s.selectNode);
+ const openCodeViewer = useDashboardStore((s) => s.openCodeViewer);
const showLayers = useDashboardStore((s) => s.showLayers);
const tourHighlightedNodeIds = useDashboardStore((s) => s.tourHighlightedNodeIds);
const persona = useDashboardStore((s) => s.persona);
@@ -60,7 +62,7 @@ export default function GraphView() {
type: "custom" as const,
position: { x: 0, y: 0 },
data: {
- label: node.name,
+ label: node.name ?? node.filePath?.split("/").pop() ?? node.id,
nodeType: node.type,
summary: node.summary,
complexity: node.complexity,
@@ -78,8 +80,8 @@ export default function GraphView() {
target: edge.target,
label: edge.type,
animated: edge.type === "calls",
- style: { stroke: "#6b7280", strokeWidth: 1.5 },
- labelStyle: { fill: "#9ca3af", fontSize: 10 },
+ style: { stroke: "rgba(212,165,116,0.3)", strokeWidth: 1.5 },
+ labelStyle: { fill: "#a39787", fontSize: 10 },
}));
// Run dagre layout on all nodes (without groups)
@@ -132,9 +134,6 @@ export default function GraphView() {
const groupWidth = maxX - minX + LAYER_PADDING * 2;
const groupHeight = maxY - minY + LAYER_PADDING * 2 + 24;
- const bgColor = getLayerColor(layerIdx);
- const borderColor = getLayerBorderColor(layerIdx);
-
// Create the group node
groupNodes.push({
id: layer.id,
@@ -144,13 +143,13 @@ export default function GraphView() {
style: {
width: groupWidth,
height: groupHeight,
- backgroundColor: bgColor,
+ backgroundColor: "rgba(212,165,116,0.05)",
borderRadius: 12,
- border: `2px dashed ${borderColor}`,
+ border: `2px dashed rgba(212,165,116,0.25)`,
padding: 8,
fontSize: 13,
fontWeight: 600,
- color: borderColor,
+ color: "#d4a574",
},
});
@@ -201,8 +200,12 @@ export default function GraphView() {
const isGroupNode = graph?.layers?.some((l) => l.id === node.id);
if (isGroupNode) return;
selectNode(node.id);
+ const graphNode = graph?.nodes.find((n) => n.id === node.id);
+ if (graphNode?.type === 'file') {
+ openCodeViewer(node.id);
+ }
},
- [selectNode, graph],
+ [selectNode, openCodeViewer, graph],
);
const onPaneClick = useCallback(() => {
@@ -211,8 +214,8 @@ export default function GraphView() {
if (!graph) {
return (
- <div className="h-full w-full flex items-center justify-center bg-gray-800 rounded-lg">
- <p className="text-gray-400 text-sm">No knowledge graph loaded</p>
+ <div className="h-full w-full flex items-center justify-center bg-root rounded-lg">
+ <p className="text-text-muted text-sm">No knowledge graph loaded</p>
</div>
);
}
@@ -230,12 +233,12 @@ export default function GraphView() {
fitView
colorMode="dark"
>
- <Background />
+ <Background variant={BackgroundVariant.Dots} color="rgba(212,165,116,0.15)" gap={20} size={1} />
<Controls />
<MiniMap
- nodeColor="#374151"
- maskColor="rgba(0,0,0,0.6)"
- className="!bg-gray-800"
+ nodeColor="#1a1a1a"
+ maskColor="rgba(10,10,10,0.7)"
+ className="!bg-surface !border !border-border-subtle"
/>
</ReactFlow>
</div>
diff --git a/understand-anything-plugin/packages/dashboard/src/components/LayerLegend.tsx b/understand-anything-plugin/packages/dashboard/src/components/LayerLegend.tsx
index 3245d067..6d4fc24b 100644
--- a/understand-anything-plugin/packages/dashboard/src/components/LayerLegend.tsx
+++ b/understand-anything-plugin/packages/dashboard/src/components/LayerLegend.tsx
@@ -47,10 +47,10 @@ export default function LayerLegend() {
disabled={!hasLayers}
className={`px-2 py-0.5 rounded text-[11px] font-medium transition-colors ${
showLayers && hasLayers
- ? "bg-blue-600 text-white"
+ ? "bg-gold/20 text-gold"
: hasLayers
- ? "bg-gray-700 text-gray-300 hover:bg-gray-600"
- : "bg-gray-800 text-gray-600 cursor-not-allowed"
+ ? "bg-elevated text-text-secondary hover:bg-surface"
+ : "bg-elevated text-text-muted cursor-not-allowed"
}`}
title={
hasLayers
@@ -71,9 +71,9 @@ export default function LayerLegend() {
className="inline-block w-2 h-2 rounded-full"
style={{ backgroundColor: getLayerBorderColor(i) }}
/>
- <span className="text-gray-400 text-[11px]">
+ <span className="text-text-secondary text-[11px]">
{layer.name}
- <span className="text-gray-600 ml-0.5">
+ <span className="text-text-muted ml-0.5">
({layer.nodeIds.length})
</span>
</span>
diff --git a/understand-anything-plugin/packages/dashboard/src/components/LearnPanel.tsx b/understand-anything-plugin/packages/dashboard/src/components/LearnPanel.tsx
index 94ad20b8..2534fd40 100644
--- a/understand-anything-plugin/packages/dashboard/src/components/LearnPanel.tsx
+++ b/understand-anything-plugin/packages/dashboard/src/components/LearnPanel.tsx
@@ -22,11 +22,11 @@ export default function LearnPanel() {
// State 1: No tour available
if (!hasTour) {
return (
- <div className="h-full w-full flex items-center justify-center bg-gray-800 rounded-lg">
+ <div className="h-full w-full flex items-center justify-center">
<div className="text-center px-4">
- <div className="text-2xl mb-2 text-gray-600">&#x1f9ed;</div>
- <p className="text-gray-400 text-sm">No tour available</p>
- <p className="text-gray-500 text-xs mt-1">
+ <div className="text-2xl mb-2 text-text-muted">&#x1f9ed;</div>
+ <p className="text-text-muted text-sm">No tour available</p>
+ <p className="text-text-muted text-xs mt-1">
Generate a tour from your knowledge graph to get a guided walkthrough
</p>
</div>
@@ -37,34 +37,34 @@ export default function LearnPanel() {
// State 2: Tour available but not started
if (!tourActive) {
return (
- <div className="h-full w-full bg-gray-800 rounded-lg overflow-auto p-4">
+ <div className="h-full w-full overflow-auto p-5">
<div className="mb-4">
- <h2 className="text-lg font-bold text-white mb-1">Project Tour</h2>
- <p className="text-xs text-gray-400">
+ <h2 className="text-lg font-serif text-text-primary mb-1">Project Tour</h2>
+ <p className="text-xs text-text-muted">
{tourSteps.length} steps &middot; Guided walkthrough of the codebase
</p>
</div>
<button
onClick={startTour}
- className="w-full mb-4 bg-indigo-600 text-white text-sm font-medium py-2 px-4 rounded hover:bg-indigo-500 transition-colors"
+ className="w-full mb-4 bg-gold/10 border border-gold/30 text-gold text-sm font-medium py-2.5 px-4 rounded-lg hover:bg-gold/20 transition-colors"
>
Start Tour
</button>
<div className="space-y-2">
- <h3 className="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">
+ <h3 className="text-[11px] font-semibold text-gold uppercase tracking-wider mb-2">
Steps
</h3>
{tourSteps.map((step, i) => (
<div
key={step.order}
- className="flex items-start gap-2 text-xs bg-gray-700/50 rounded px-3 py-2"
+ className="flex items-start gap-2 text-xs bg-elevated rounded-lg px-3 py-2 border border-border-subtle"
>
- <span className="text-gray-500 font-mono shrink-0 mt-0.5">
+ <span className="text-gold font-mono shrink-0 mt-0.5">
{i + 1}.
</span>
- <span className="text-gray-300">{step.title}</span>
+ <span className="text-text-secondary">{step.title}</span>
</div>
))}
</div>
@@ -82,29 +82,29 @@ export default function LearnPanel() {
const isLast = currentTourStep === totalSteps - 1;
return (
- <div className="h-full w-full bg-gray-800 rounded-lg flex flex-col overflow-hidden">
+ <div className="h-full w-full flex flex-col overflow-hidden">
{/* Header with progress counter and exit */}
- <div className="flex items-center justify-between px-3 py-2 border-b border-gray-700 shrink-0">
+ <div className="flex items-center justify-between px-3 py-2 border-b border-border-subtle shrink-0">
<div className="flex items-center gap-2">
- <h3 className="text-xs font-semibold text-gray-400 uppercase tracking-wider">
+ <h3 className="text-[11px] font-semibold text-gold uppercase tracking-wider">
Tour
</h3>
- <span className="text-xs text-gray-500">
+ <span className="text-xs text-text-muted">
{currentTourStep + 1} / {totalSteps}
</span>
</div>
<button
onClick={stopTour}
- className="text-[10px] text-gray-500 hover:text-gray-300 transition-colors"
+ className="text-[10px] text-text-muted hover:text-text-secondary transition-colors"
>
Exit Tour
</button>
</div>
{/* Progress bar */}
- <div className="h-1 bg-gray-700 shrink-0">
+ <div className="h-1 bg-elevated shrink-0">
<div
- className="h-full bg-indigo-500 transition-all duration-300"
+ className="h-full bg-gold transition-all duration-300"
style={{ width: `${progressPct}%` }}
/>
</div>
@@ -112,10 +112,10 @@ export default function LearnPanel() {
{/* Scrollable content */}
<div className="flex-1 overflow-y-auto p-4 min-h-0">
{/* Step title */}
- <h2 className="text-lg font-bold text-white mb-3">{step.title}</h2>
+ <h2 className="text-lg font-serif text-text-primary mb-3">{step.title}</h2>
{/* Description via ReactMarkdown */}
- <div className="text-sm text-gray-300 leading-relaxed mb-4 tour-markdown">
+ <div className="text-sm text-text-secondary leading-relaxed mb-4 tour-markdown">
<ReactMarkdown
components={{
p: ({ children }) => (
@@ -154,11 +154,11 @@ export default function LearnPanel() {
{/* Language lesson */}
{step.languageLesson && (
- <div className="bg-indigo-900/40 border border-indigo-700 rounded p-3 mb-4">
- <h4 className="text-xs font-semibold text-indigo-300 uppercase tracking-wider mb-1.5">
+ <div className="bg-gold/5 border border-gold/20 rounded p-3 mb-4">
+ <h4 className="text-[11px] font-semibold text-gold uppercase tracking-wider mb-1.5">
Language Lesson
</h4>
- <p className="text-sm text-indigo-200 leading-relaxed">
+ <p className="text-sm text-text-secondary leading-relaxed">
{step.languageLesson}
</p>
</div>
@@ -167,7 +167,7 @@ export default function LearnPanel() {
{/* Referenced component pills */}
{step.nodeIds.length > 0 && (
<div className="mb-4">
- <h4 className="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">
+ <h4 className="text-[11px] font-semibold text-gold uppercase tracking-wider mb-2">
Referenced Components
</h4>
<div className="flex flex-wrap gap-1.5">
@@ -177,7 +177,7 @@ export default function LearnPanel() {
<button
key={nodeId}
onClick={() => selectNode(nodeId)}
- className="text-[11px] bg-gray-700 text-gray-300 px-2 py-0.5 rounded-full hover:bg-gray-600 hover:text-white transition-colors cursor-pointer"
+ className="text-[11px] glass text-text-secondary px-2.5 py-1 rounded-full hover:text-text-primary transition-colors cursor-pointer"
>
{node?.name ?? nodeId}
</button>
@@ -189,7 +189,7 @@ export default function LearnPanel() {
</div>
{/* Navigation: dots + prev/next */}
- <div className="px-3 py-2 border-t border-gray-700 shrink-0">
+ <div className="px-3 py-2 border-t border-border-subtle shrink-0">
{/* Step dots */}
<div className="flex justify-center gap-1.5 mb-2">
{tourSteps.map((_, i) => (
@@ -198,8 +198,8 @@ export default function LearnPanel() {
onClick={() => setTourStep(i)}
className={`w-2 h-2 rounded-full transition-colors ${
i === currentTourStep
- ? "bg-indigo-500"
- : "bg-gray-600 hover:bg-gray-500"
+ ? "bg-gold"
+ : "bg-elevated hover:bg-surface"
}`}
aria-label={`Go to step ${i + 1}`}
/>
@@ -211,13 +211,13 @@ export default function LearnPanel() {
<button
onClick={prevTourStep}
disabled={isFirst}
- className="flex-1 text-xs bg-gray-700 text-gray-300 py-1.5 rounded hover:bg-gray-600 disabled:opacity-40 disabled:cursor-not-allowed transition-colors"
+ className="flex-1 text-xs bg-elevated text-text-secondary py-1.5 rounded-lg hover:bg-surface disabled:opacity-40 disabled:cursor-not-allowed transition-colors"
>
Prev
</button>
<button
onClick={isLast ? stopTour : nextTourStep}
- className="flex-1 text-xs bg-indigo-600 text-white py-1.5 rounded hover:bg-indigo-500 transition-colors"
+ className="flex-1 text-xs bg-gold/10 border border-gold/30 text-gold py-1.5 rounded-lg hover:bg-gold/20 transition-colors"
>
{isLast ? "Finish" : "Next"}
</button>
diff --git a/understand-anything-plugin/packages/dashboard/src/components/NodeInfo.tsx b/understand-anything-plugin/packages/dashboard/src/components/NodeInfo.tsx
index 73ce77c1..78c1041d 100644
--- a/understand-anything-plugin/packages/dashboard/src/components/NodeInfo.tsx
+++ b/understand-anything-plugin/packages/dashboard/src/components/NodeInfo.tsx
@@ -1,38 +1,31 @@
import { useState } from "react";
-import ReactMarkdown from "react-markdown";
import { useDashboardStore } from "../store";
const typeBadgeColors: Record<string, string> = {
- file: "bg-blue-800 text-blue-200",
- function: "bg-green-800 text-green-200",
- class: "bg-purple-800 text-purple-200",
- module: "bg-orange-800 text-orange-200",
- concept: "bg-pink-800 text-pink-200",
+ file: "text-node-file border border-node-file/30 bg-node-file/10",
+ function: "text-node-function border border-node-function/30 bg-node-function/10",
+ class: "text-node-class border border-node-class/30 bg-node-class/10",
+ module: "text-node-module border border-node-module/30 bg-node-module/10",
+ concept: "text-node-concept border border-node-concept/30 bg-node-concept/10",
};
const complexityBadgeColors: Record<string, string> = {
- simple: "bg-green-700 text-green-200",
- moderate: "bg-yellow-700 text-yellow-200",
- complex: "bg-red-700 text-red-200",
+ simple: "text-node-function border border-node-function/30 bg-node-function/10",
+ moderate: "text-gold-dim border border-gold-dim/30 bg-gold-dim/10",
+ complex: "text-[#c97070] border border-[#c97070]/30 bg-[#c97070]/10",
};
export default function NodeInfo() {
const graph = useDashboardStore((s) => s.graph);
const selectedNodeId = useDashboardStore((s) => s.selectedNodeId);
- const apiKey = useDashboardStore((s) => s.apiKey);
- const nodeExplanation = useDashboardStore((s) => s.nodeExplanation);
- const nodeExplanationLoading = useDashboardStore(
- (s) => s.nodeExplanationLoading,
- );
- const explainNode = useDashboardStore((s) => s.explainNode);
const [languageExpanded, setLanguageExpanded] = useState(true);
const node = graph?.nodes.find((n) => n.id === selectedNodeId) ?? null;
if (!node) {
return (
- <div className="h-full w-full flex items-center justify-center bg-gray-800 rounded-lg">
- <p className="text-gray-400 text-sm">Select a node to see details</p>
+ <div className="h-full w-full flex items-center justify-center bg-surface">
+ <p className="text-text-muted text-sm">Select a node to see details</p>
</div>
);
}
@@ -46,7 +39,7 @@ export default function NodeInfo() {
complexityBadgeColors[node.complexity] ?? complexityBadgeColors.simple;
return (
- <div className="h-full w-full bg-gray-800 rounded-lg overflow-auto p-4">
+ <div className="h-full w-full overflow-auto p-5 animate-fade-slide-in">
<div className="flex items-center gap-2 mb-3">
<span
className={`text-[10px] font-semibold uppercase tracking-wider px-2 py-0.5 rounded ${typeBadge}`}
@@ -60,15 +53,15 @@ export default function NodeInfo() {
</span>
</div>
- <h2 className="text-lg font-bold text-white mb-2">{node.name}</h2>
+ <h2 className="text-lg font-serif text-text-primary mb-2">{node.name}</h2>
- <p className="text-sm text-gray-300 mb-4 leading-relaxed">
+ <p className="text-sm text-text-secondary mb-4 leading-relaxed">
{node.summary}
</p>
{node.filePath && (
- <div className="text-xs text-gray-400 mb-2">
- <span className="font-medium text-gray-500">File:</span>{" "}
+ <div className="text-xs text-text-secondary mb-2">
+ <span className="font-medium text-text-muted">File:</span>{" "}
{node.filePath}
{node.lineRange && (
<span className="ml-2">
@@ -82,7 +75,7 @@ export default function NodeInfo() {
<div className="mb-4">
<button
onClick={() => setLanguageExpanded(!languageExpanded)}
- className="flex items-center gap-1.5 text-xs font-semibold text-indigo-400 uppercase tracking-wider mb-2 hover:text-indigo-300 transition-colors"
+ className="flex items-center gap-1.5 text-xs font-semibold text-gold uppercase tracking-wider mb-2 hover:text-gold-bright transition-colors"
>
<svg
className={`w-3 h-3 transition-transform ${languageExpanded ? "rotate-90" : ""}`}
@@ -95,8 +88,8 @@ export default function NodeInfo() {
Language Concepts
</button>
{languageExpanded && (
- <div className="bg-indigo-900/30 border border-indigo-700/50 rounded-lg p-3">
- <p className="text-sm text-indigo-200 leading-relaxed">
+ <div className="bg-gold/5 border border-gold/20 rounded-lg p-3">
+ <p className="text-sm text-text-secondary leading-relaxed">
{node.languageNotes}
</p>
</div>
@@ -104,57 +97,16 @@ export default function NodeInfo() {
</div>
)}
- {apiKey && (
- <div className="mb-4">
- {!nodeExplanation && !nodeExplanationLoading && (
- <button
- onClick={() => explainNode(node.id)}
- className="text-xs bg-indigo-600 text-white px-3 py-1.5 rounded hover:bg-indigo-500 transition-colors"
- >
- Explain This
- </button>
- )}
- {nodeExplanationLoading && (
- <div className="text-xs text-gray-400 animate-pulse">
- Generating explanation...
- </div>
- )}
- {nodeExplanation && (
- <div className="bg-gray-700/50 rounded-lg p-3 text-sm text-gray-300 leading-relaxed">
- <ReactMarkdown
- components={{
- p: ({ children }) => (
- <p className="mb-2 last:mb-0">{children}</p>
- ),
- strong: ({ children }) => (
- <strong className="font-semibold text-white">
- {children}
- </strong>
- ),
- code: ({ children }) => (
- <code className="bg-gray-900 rounded px-1 py-0.5 text-[11px]">
- {children}
- </code>
- ),
- }}
- >
- {nodeExplanation}
- </ReactMarkdown>
- </div>
- )}
- </div>
- )}
-
{node.tags.length > 0 && (
<div className="mb-4">
- <h3 className="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">
+ <h3 className="text-[11px] font-semibold text-gold uppercase tracking-wider mb-2">
Tags
</h3>
<div className="flex flex-wrap gap-1.5">
{node.tags.map((tag) => (
<span
key={tag}
- className="text-[11px] bg-gray-700 text-gray-300 px-2 py-0.5 rounded-full"
+ className="text-[11px] glass text-text-secondary px-2.5 py-1 rounded-full"
>
{tag}
</span>
@@ -165,7 +117,7 @@ export default function NodeInfo() {
{connections.length > 0 && (
<div>
- <h3 className="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">
+ <h3 className="text-[11px] font-semibold text-gold uppercase tracking-wider mb-2">
Connections ({connections.length})
</h3>
<div className="space-y-1.5">
@@ -178,11 +130,11 @@ export default function NodeInfo() {
return (
<div
key={i}
- className="text-xs bg-gray-700/50 rounded px-2 py-1.5 flex items-center gap-2"
+ className="text-xs bg-elevated rounded-lg px-3 py-2 border border-border-subtle flex items-center gap-2"
>
- <span className="text-gray-400 font-mono">{arrow}</span>
- <span className="text-gray-400">{edge.type}</span>
- <span className="text-white truncate">
+ <span className="text-gold font-mono">{arrow}</span>
+ <span className="text-text-muted">{edge.type}</span>
+ <span className="text-text-primary truncate">
{otherNode?.name ?? otherId}
</span>
</div>
diff --git a/understand-anything-plugin/packages/dashboard/src/components/PersonaSelector.tsx b/understand-anything-plugin/packages/dashboard/src/components/PersonaSelector.tsx
index ec804cd4..98e42d7e 100644
--- a/understand-anything-plugin/packages/dashboard/src/components/PersonaSelector.tsx
+++ b/understand-anything-plugin/packages/dashboard/src/components/PersonaSelector.tsx
@@ -24,7 +24,7 @@ export default function PersonaSelector() {
const setPersona = useDashboardStore((s) => s.setPersona);
return (
- <div className="flex items-center gap-1 bg-gray-800 rounded-lg p-0.5">
+ <div className="flex items-center gap-1 bg-elevated rounded-lg p-0.5">
{personas.map((p) => (
<button
key={p.id}
@@ -32,8 +32,8 @@ export default function PersonaSelector() {
title={p.description}
className={`px-2.5 py-1 rounded text-[11px] font-medium transition-colors ${
persona === p.id
- ? "bg-blue-600 text-white"
- : "text-gray-400 hover:text-gray-300 hover:bg-gray-700"
+ ? "bg-gold/20 text-gold"
+ : "text-text-muted hover:text-text-secondary hover:bg-surface"
}`}
>
{p.label}
diff --git a/understand-anything-plugin/packages/dashboard/src/components/ProjectOverview.tsx b/understand-anything-plugin/packages/dashboard/src/components/ProjectOverview.tsx
new file mode 100644
index 00000000..7438620e
--- /dev/null
+++ b/understand-anything-plugin/packages/dashboard/src/components/ProjectOverview.tsx
@@ -0,0 +1,94 @@
+import { useDashboardStore } from "../store";
+
+export default function ProjectOverview() {
+ const graph = useDashboardStore((s) => s.graph);
+ const startTour = useDashboardStore((s) => s.startTour);
+
+ if (!graph) {
+ return (
+ <div className="h-full w-full flex items-center justify-center">
+ <p className="text-text-muted text-sm">Loading project...</p>
+ </div>
+ );
+ }
+
+ const { project, nodes, edges, layers } = graph;
+ const hasTour = graph.tour.length > 0;
+
+ // Count node types
+ const typeCounts: Record<string, number> = {};
+ for (const node of nodes) {
+ typeCounts[node.type] = (typeCounts[node.type] ?? 0) + 1;
+ }
+
+ return (
+ <div className="h-full w-full overflow-auto p-5 animate-fade-slide-in">
+ {/* Project name */}
+ <h2 className="font-serif text-2xl text-text-primary mb-1">{project.name}</h2>
+ <p className="text-sm text-text-secondary leading-relaxed mb-6">{project.description}</p>
+
+ {/* Stats grid */}
+ <div className="grid grid-cols-2 gap-3 mb-6">
+ <div className="bg-elevated rounded-lg p-3 border border-border-subtle">
+ <div className="text-2xl font-mono font-medium text-gold">{nodes.length}</div>
+ <div className="text-[11px] text-text-muted uppercase tracking-wider mt-1">Nodes</div>
+ </div>
+ <div className="bg-elevated rounded-lg p-3 border border-border-subtle">
+ <div className="text-2xl font-mono font-medium text-gold">{edges.length}</div>
+ <div className="text-[11px] text-text-muted uppercase tracking-wider mt-1">Edges</div>
+ </div>
+ <div className="bg-elevated rounded-lg p-3 border border-border-subtle">
+ <div className="text-2xl font-mono font-medium text-gold">{layers.length}</div>
+ <div className="text-[11px] text-text-muted uppercase tracking-wider mt-1">Layers</div>
+ </div>
+ <div className="bg-elevated rounded-lg p-3 border border-border-subtle">
+ <div className="text-2xl font-mono font-medium text-gold">{Object.keys(typeCounts).length}</div>
+ <div className="text-[11px] text-text-muted uppercase tracking-wider mt-1">Types</div>
+ </div>
+ </div>
+
+ {/* Languages */}
+ {project.languages.length > 0 && (
+ <div className="mb-5">
+ <h3 className="text-[11px] font-semibold text-gold uppercase tracking-wider mb-2">Languages</h3>
+ <div className="flex flex-wrap gap-1.5">
+ {project.languages.map((lang) => (
+ <span key={lang} className="text-[11px] glass text-text-secondary px-2.5 py-1 rounded-full">
+ {lang}
+ </span>
+ ))}
+ </div>
+ </div>
+ )}
+
+ {/* Frameworks */}
+ {project.frameworks.length > 0 && (
+ <div className="mb-5">
+ <h3 className="text-[11px] font-semibold text-gold uppercase tracking-wider mb-2">Frameworks</h3>
+ <div className="flex flex-wrap gap-1.5">
+ {project.frameworks.map((fw) => (
+ <span key={fw} className="text-[11px] glass text-text-secondary px-2.5 py-1 rounded-full">
+ {fw}
+ </span>
+ ))}
+ </div>
+ </div>
+ )}
+
+ {/* Analyzed at */}
+ <div className="text-[11px] text-text-muted mb-6">
+ Analyzed: {new Date(project.analyzedAt).toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' })}
+ </div>
+
+ {/* Start Tour button */}
+ {hasTour && (
+ <button
+ onClick={startTour}
+ className="w-full bg-gold/10 border border-gold/30 text-gold text-sm font-medium py-2.5 px-4 rounded-lg hover:bg-gold/20 transition-all duration-200"
+ >
+ Start Guided Tour
+ </button>
+ )}
+ </div>
+ );
+}
diff --git a/understand-anything-plugin/packages/dashboard/src/components/SearchBar.tsx b/understand-anything-plugin/packages/dashboard/src/components/SearchBar.tsx
index 44ac7a01..8a8f2459 100644
--- a/understand-anything-plugin/packages/dashboard/src/components/SearchBar.tsx
+++ b/understand-anything-plugin/packages/dashboard/src/components/SearchBar.tsx
@@ -2,11 +2,11 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useDashboardStore } from "../store";
const typeBadgeColors: Record<string, string> = {
- file: "bg-blue-700 text-blue-200",
- function: "bg-green-700 text-green-200",
- class: "bg-purple-700 text-purple-200",
- module: "bg-orange-700 text-orange-200",
- concept: "bg-pink-700 text-pink-200",
+ file: "text-node-file border border-node-file/30 bg-node-file/10",
+ function: "text-node-function border border-node-function/30 bg-node-function/10",
+ class: "text-node-class border border-node-class/30 bg-node-class/10",
+ module: "text-node-module border border-node-module/30 bg-node-module/10",
+ concept: "text-node-concept border border-node-concept/30 bg-node-concept/10",
};
export default function SearchBar() {
@@ -73,9 +73,9 @@ export default function SearchBar() {
return (
<div ref={containerRef} className="relative z-10">
- <div className="flex items-center gap-2 px-4 py-2 bg-gray-800 border-b border-gray-700">
+ <div className="flex items-center gap-2 px-4 py-2 bg-surface border-b border-border-subtle">
<svg
- className="w-4 h-4 text-gray-400 shrink-0"
+ className="w-4 h-4 text-text-muted shrink-0"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
@@ -94,15 +94,15 @@ export default function SearchBar() {
onChange={handleInputChange}
onFocus={() => setDropdownOpen(true)}
placeholder="Search nodes by name, summary, or tags..."
- className="flex-1 bg-gray-700 text-white text-sm rounded px-3 py-1.5 border border-gray-600 focus:outline-none focus:border-blue-500 placeholder-gray-400"
+ className="flex-1 bg-elevated text-text-primary text-sm rounded-lg px-3 py-1.5 border border-border-subtle focus:outline-none focus:border-gold/50 placeholder-text-muted"
/>
- <div className="flex items-center gap-1 bg-gray-700 rounded p-0.5 shrink-0">
+ <div className="flex items-center gap-1 bg-elevated rounded-lg p-0.5 shrink-0">
<button
onClick={() => setSearchMode("fuzzy")}
className={`text-[10px] px-1.5 py-0.5 rounded transition-colors ${
searchMode === "fuzzy"
- ? "bg-gray-600 text-white"
- : "text-gray-400 hover:text-gray-300"
+ ? "bg-gold/20 text-gold"
+ : "text-text-muted hover:text-text-secondary"
}`}
>
Fuzzy
@@ -111,24 +111,24 @@ export default function SearchBar() {
onClick={() => setSearchMode("semantic")}
className={`text-[10px] px-1.5 py-0.5 rounded transition-colors ${
searchMode === "semantic"
- ? "bg-gray-600 text-white"
- : "text-gray-400 hover:text-gray-300"
+ ? "bg-gold/20 text-gold"
+ : "text-text-muted hover:text-text-secondary"
}`}
>
Semantic
</button>
</div>
{searchQuery.trim() && (
- <span className="text-xs text-gray-400 shrink-0">
+ <span className="text-xs text-text-muted shrink-0">
{searchResults.length} result{searchResults.length !== 1 ? "s" : ""}{" "}
- <span className="text-gray-500">({searchMode})</span>
+ <span className="text-text-muted">({searchMode})</span>
</span>
)}
</div>
{/* Dropdown results */}
{showDropdown && (
- <div className="absolute left-4 right-4 top-full mt-0.5 bg-gray-800 border border-gray-600 rounded-lg shadow-xl overflow-hidden">
+ <div className="absolute left-4 right-4 top-full mt-0.5 glass rounded-lg shadow-xl overflow-hidden">
{topResults.map((result) => {
const node = nodeMap.get(result.nodeId);
if (!node) return null;
@@ -141,7 +141,7 @@ export default function SearchBar() {
key={result.nodeId}
type="button"
onClick={() => handleResultClick(result.nodeId)}
- className="w-full flex items-center gap-3 px-3 py-2 hover:bg-gray-700 transition-colors text-left"
+ className="w-full flex items-center gap-3 px-3 py-2 hover:bg-elevated transition-colors text-left"
>
{/* Type badge */}
<span
@@ -151,19 +151,19 @@ export default function SearchBar() {
</span>
{/* Node name */}
- <span className="text-sm text-white truncate flex-1">
+ <span className="text-sm text-text-primary truncate flex-1">
{node.name}
</span>
{/* Relevance bar */}
<div className="flex items-center gap-1.5 shrink-0">
- <div className="w-16 h-1.5 bg-gray-600 rounded-full overflow-hidden">
+ <div className="w-16 h-1.5 bg-elevated rounded-full overflow-hidden">
<div
- className="h-full bg-blue-400 rounded-full"
+ className="h-full bg-gold rounded-full"
style={{ width: `${relevance}%` }}
/>
</div>
- <span className="text-[10px] text-gray-400 w-7 text-right">
+ <span className="text-[10px] text-text-muted w-7 text-right">
{relevance}%
</span>
</div>
diff --git a/understand-anything-plugin/packages/dashboard/src/index.css b/understand-anything-plugin/packages/dashboard/src/index.css
index f1d8c73c..d2ea312d 100644
--- a/understand-anything-plugin/packages/dashboard/src/index.css
+++ b/understand-anything-plugin/packages/dashboard/src/index.css
@@ -1 +1,135 @@
@import "tailwindcss";
+
+@theme {
+ /* Dark luxury color palette */
+ --color-root: #0a0a0a;
+ --color-surface: #111111;
+ --color-elevated: #1a1a1a;
+ --color-panel: #141414;
+
+ /* Gold accent spectrum */
+ --color-gold: #d4a574;
+ --color-gold-dim: #c9a96e;
+ --color-gold-bright: #e8c49a;
+
+ /* Text hierarchy */
+ --color-text-primary: #f5f0eb;
+ --color-text-secondary: #a39787;
+ --color-text-muted: #6b5f53;
+
+ /* Border tokens */
+ --color-border-subtle: rgba(212, 165, 116, 0.12);
+ --color-border-medium: rgba(212, 165, 116, 0.25);
+
+ /* Node type colors (muted, refined) */
+ --color-node-file: #4a7c9b;
+ --color-node-function: #5a9e6f;
+ --color-node-class: #8b6fb0;
+ --color-node-module: #c9a06c;
+ --color-node-concept: #b07a8a;
+
+ /* Fonts */
+ --font-serif: 'DM Serif Display', Georgia, serif;
+ --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
+ --font-sans: 'Inter', system-ui, sans-serif;
+}
+
+/* Base styles */
+body {
+ font-family: var(--font-sans);
+ background-color: var(--color-root);
+ color: var(--color-text-primary);
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+/* Subtle noise texture overlay */
+.noise-overlay::before {
+ content: '';
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ opacity: 0.03;
+ pointer-events: none;
+ z-index: 9999;
+ background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
+}
+
+/* Glass utility */
+.glass {
+ background: rgba(20, 20, 20, 0.8);
+ border: 1px solid rgba(212, 165, 116, 0.1);
+ backdrop-filter: blur(12px);
+ -webkit-backdrop-filter: blur(12px);
+}
+
+/* Animation keyframes */
+@keyframes fadeSlideIn {
+ from {
+ opacity: 0;
+ transform: translateY(8px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+@keyframes slideUp {
+ from {
+ transform: translateY(100%);
+ }
+ to {
+ transform: translateY(0);
+ }
+}
+
+@keyframes goldPulse {
+ 0%, 100% {
+ box-shadow: 0 0 0 0 rgba(212, 165, 116, 0.4);
+ }
+ 50% {
+ box-shadow: 0 0 20px 4px rgba(212, 165, 116, 0.15);
+ }
+}
+
+/* Animation utilities */
+.animate-fade-slide-in {
+ animation: fadeSlideIn 0.3s ease-out forwards;
+}
+
+.animate-slide-up {
+ animation: slideUp 0.3s ease-out forwards;
+}
+
+.animate-gold-pulse {
+ animation: goldPulse 2s ease-in-out infinite;
+}
+
+/* Node selection glow */
+.node-glow {
+ box-shadow: 0 0 20px rgba(212, 165, 116, 0.15);
+}
+
+/* Custom scrollbar for dark luxury theme */
+::-webkit-scrollbar {
+ width: 6px;
+ height: 6px;
+}
+::-webkit-scrollbar-track {
+ background: transparent;
+}
+::-webkit-scrollbar-thumb {
+ background: rgba(212, 165, 116, 0.2);
+ border-radius: 3px;
+}
+::-webkit-scrollbar-thumb:hover {
+ background: rgba(212, 165, 116, 0.35);
+}
+
+/* Override React Flow dark theme */
+.react-flow__background {
+ background-color: var(--color-root) !important;
+}
diff --git a/understand-anything-plugin/packages/dashboard/src/store.ts b/understand-anything-plugin/packages/dashboard/src/store.ts
index 6b931c01..eb66c8a6 100644
--- a/understand-anything-plugin/packages/dashboard/src/store.ts
+++ b/understand-anything-plugin/packages/dashboard/src/store.ts
@@ -1,4 +1,3 @@
-import Anthropic from "@anthropic-ai/sdk";
import { create } from "zustand";
import { SearchEngine } from "@understand-anything/core/search";
import type { SearchResult } from "@understand-anything/core/search";
@@ -9,11 +8,6 @@ import type {
export type Persona = "non-technical" | "junior" | "experienced";
-export interface ChatMessage {
- role: "user" | "assistant";
- content: string;
-}
-
interface DashboardStore {
graph: KnowledgeGraph | null;
selectedNodeId: string | null;
@@ -23,15 +17,10 @@ interface DashboardStore {
searchMode: "fuzzy" | "semantic";
setSearchMode: (mode: "fuzzy" | "semantic") => void;
- apiKey: string;
- chatMessages: ChatMessage[];
- chatLoading: boolean;
-
showLayers: boolean;
- nodeExplanation: string | null;
- nodeExplanationLoading: boolean;
- nodeExplanationCache: Record<string, string>;
+ codeViewerOpen: boolean;
+ codeViewerNodeId: string | null;
tourActive: boolean;
currentTourStep: number;
@@ -42,12 +31,10 @@ interface DashboardStore {
setGraph: (graph: KnowledgeGraph) => void;
selectNode: (nodeId: string | null) => void;
setSearchQuery: (query: string) => void;
- setApiKey: (key: string) => void;
- sendChatMessage: (message: string) => Promise<void>;
- clearChat: () => void;
toggleLayers: () => void;
- explainNode: (nodeId: string) => Promise<void>;
setPersona: (persona: Persona) => void;
+ openCodeViewer: (nodeId: string) => void;
+ closeCodeViewer: () => void;
startTour: () => void;
stopTour: () => void;
@@ -56,79 +43,9 @@ interface DashboardStore {
prevTourStep: () => void;
}
-function buildSystemPrompt(
- graph: KnowledgeGraph | null,
- selectedNodeId: string | null,
-): string {
- const parts: string[] = [];
-
- parts.push(
- "You are an expert code assistant for the Understand Anything dashboard. " +
- "You help users understand codebases by answering questions about the project structure, " +
- "code relationships, and architecture. Be concise and helpful.",
- );
-
- if (graph) {
- const { project, nodes, edges, layers } = graph;
- parts.push(
- `\n## Project: ${project.name}\n` +
- `Description: ${project.description}\n` +
- `Languages: ${project.languages.join(", ")}\n` +
- `Frameworks: ${project.frameworks.join(", ")}\n` +
- `Analyzed at: ${project.analyzedAt}`,
- );
-
- parts.push(
- `\n## Graph Overview\n` +
- `Nodes: ${nodes.length}\n` +
- `Edges: ${edges.length}\n` +
- `Layers: ${layers.map((l) => l.name).join(", ") || "none"}`,
- );
-
- // Include a summary of all nodes for context
- const nodeSummaries = nodes
- .map(
- (n) =>
- `- [${n.type}] ${n.name}${n.filePath ? ` (${n.filePath})` : ""}: ${n.summary}`,
- )
- .join("\n");
- parts.push(`\n## All Nodes\n${nodeSummaries}`);
-
- // Selected node details
- if (selectedNodeId) {
- const node = nodes.find((n) => n.id === selectedNodeId);
- if (node) {
- const connections = edges.filter(
- (e) => e.source === node.id || e.target === node.id,
- );
- const connDetails = connections
- .map((e) => {
- const isSource = e.source === node.id;
- const otherId = isSource ? e.target : e.source;
- const otherNode = nodes.find((n) => n.id === otherId);
- return ` ${isSource ? "->" : "<-"} [${e.type}] ${otherNode?.name ?? otherId}`;
- })
- .join("\n");
-
- parts.push(
- `\n## Currently Selected Node\n` +
- `Name: ${node.name}\n` +
- `Type: ${node.type}\n` +
- `Summary: ${node.summary}\n` +
- `File: ${node.filePath ?? "N/A"}\n` +
- `Tags: ${node.tags.join(", ") || "none"}\n` +
- `Complexity: ${node.complexity}\n` +
- `Connections:\n${connDetails || " none"}`,
- );
- }
- }
- }
-
- return parts.join("\n");
-}
-
function getSortedTour(graph: KnowledgeGraph): TourStep[] {
- return [...graph.tour].sort((a, b) => a.order - b.order);
+ const tour = graph.tour ?? [];
+ return [...tour].sort((a, b) => a.order - b.order);
}
export const useDashboardStore = create<DashboardStore>()((set, get) => ({
@@ -139,15 +56,10 @@ export const useDashboardStore = create<DashboardStore>()((set, get) => ({
searchEngine: null,
searchMode: "fuzzy",
- apiKey: "",
- chatMessages: [],
- chatLoading: false,
-
showLayers: false,
- nodeExplanation: null,
- nodeExplanationLoading: false,
- nodeExplanationCache: {},
+ codeViewerOpen: false,
+ codeViewerNodeId: null,
tourActive: false,
currentTourStep: 0,
@@ -161,7 +73,7 @@ export const useDashboardStore = create<DashboardStore>()((set, get) => ({
const searchResults = query.trim() ? searchEngine.search(query) : [];
set({ graph, searchEngine, searchResults });
},
- selectNode: (nodeId) => set({ selectedNodeId: nodeId, nodeExplanation: null }),
+ selectNode: (nodeId) => set({ selectedNodeId: nodeId }),
setSearchMode: (mode) => set({ searchMode: mode }),
setSearchQuery: (query) => {
const engine = get().searchEngine;
@@ -177,152 +89,16 @@ export const useDashboardStore = create<DashboardStore>()((set, get) => ({
set({ searchQuery: query, searchResults });
},
- setApiKey: (key) => {
- localStorage.setItem("ua-api-key", key);
- set({ apiKey: key });
- },
-
- sendChatMessage: async (message) => {
- const { apiKey, chatMessages, graph, selectedNodeId } = get();
- if (!apiKey || !message.trim()) return;
-
- const userMessage: ChatMessage = { role: "user", content: message };
- set({
- chatMessages: [...chatMessages, userMessage],
- chatLoading: true,
- });
-
- try {
- const client = new Anthropic({
- apiKey,
- dangerouslyAllowBrowser: true,
- });
-
- const systemPrompt = buildSystemPrompt(graph, selectedNodeId);
-
- const response = await client.messages.create({
- model: "claude-sonnet-4-20250514",
- max_tokens: 1024,
- system: systemPrompt,
- messages: [...chatMessages, userMessage].map((m) => ({
- role: m.role,
- content: m.content,
- })),
- });
-
- const assistantContent =
- response.content[0].type === "text"
- ? response.content[0].text
- : "Unable to generate a response.";
-
- const assistantMessage: ChatMessage = {
- role: "assistant",
- content: assistantContent,
- };
-
- set((state) => ({
- chatMessages: [...state.chatMessages, assistantMessage],
- chatLoading: false,
- }));
- } catch (err) {
- const errorMessage: ChatMessage = {
- role: "assistant",
- content: `Error: ${err instanceof Error ? err.message : "Failed to get response. Please check your API key."}`,
- };
- set((state) => ({
- chatMessages: [...state.chatMessages, errorMessage],
- chatLoading: false,
- }));
- }
- },
-
- clearChat: () => set({ chatMessages: [] }),
-
toggleLayers: () => set((state) => ({ showLayers: !state.showLayers })),
setPersona: (persona) => set({ persona }),
- explainNode: async (nodeId) => {
- const { apiKey, graph, nodeExplanationCache } = get();
- if (!apiKey || !graph) return;
-
- // Check cache first
- if (nodeExplanationCache[nodeId]) {
- set({ nodeExplanation: nodeExplanationCache[nodeId] });
- return;
- }
-
- const node = graph.nodes.find((n) => n.id === nodeId);
- if (!node) return;
-
- set({ nodeExplanationLoading: true, nodeExplanation: null });
-
- try {
- const connections = graph.edges.filter(
- (e) => e.source === nodeId || e.target === nodeId,
- );
- const connDetails = connections
- .map((e) => {
- const isSource = e.source === nodeId;
- const otherId = isSource ? e.target : e.source;
- const otherNode = graph.nodes.find((n) => n.id === otherId);
- return `${isSource ? "->" : "<-"} [${e.type}] ${otherNode?.name ?? otherId}`;
- })
- .join("\n");
-
- const layer = graph.layers.find((l) => l.nodeIds.includes(nodeId));
-
- const prompt = [
- `Explain the following code component in plain English. Be thorough but accessible.`,
- ``,
- `**Component:** ${node.name}`,
- `**Type:** ${node.type}`,
- `**File:** ${node.filePath ?? "N/A"}`,
- `**Summary:** ${node.summary}`,
- `**Complexity:** ${node.complexity}`,
- `**Tags:** ${node.tags.join(", ") || "none"}`,
- layer ? `**Layer:** ${layer.name} — ${layer.description}` : "",
- ``,
- `**Connections:**`,
- connDetails || " none",
- ``,
- `Explain:`,
- `1. What this component does and WHY it exists`,
- `2. How it fits into the larger architecture`,
- `3. Key relationships with other components`,
- `4. Any patterns or concepts worth understanding`,
- ``,
- `Keep the explanation concise (2-4 paragraphs). Use markdown formatting.`,
- ].join("\n");
-
- const client = new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
- const response = await client.messages.create({
- model: "claude-sonnet-4-20250514",
- max_tokens: 512,
- messages: [{ role: "user", content: prompt }],
- });
-
- const text =
- response.content[0].type === "text"
- ? response.content[0].text
- : "Unable to generate explanation.";
-
- set((state) => ({
- nodeExplanation: text,
- nodeExplanationLoading: false,
- nodeExplanationCache: { ...state.nodeExplanationCache, [nodeId]: text },
- }));
- } catch (err) {
- set({
- nodeExplanation: `Error: ${err instanceof Error ? err.message : "Failed to generate explanation"}`,
- nodeExplanationLoading: false,
- });
- }
- },
+ openCodeViewer: (nodeId) => set({ codeViewerOpen: true, codeViewerNodeId: nodeId }),
+ closeCodeViewer: () => set({ codeViewerOpen: false, codeViewerNodeId: null }),
startTour: () => {
const { graph } = get();
- if (!graph || graph.tour.length === 0) return;
+ if (!graph || !graph.tour || graph.tour.length === 0) return;
const sorted = getSortedTour(graph);
set({
tourActive: true,
@@ -341,7 +117,7 @@ export const useDashboardStore = create<DashboardStore>()((set, get) => ({
setTourStep: (step) => {
const { graph } = get();
- if (!graph || graph.tour.length === 0) return;
+ if (!graph || !graph.tour || graph.tour.length === 0) return;
const sorted = getSortedTour(graph);
if (step < 0 || step >= sorted.length) return;
set({
@@ -352,7 +128,7 @@ export const useDashboardStore = create<DashboardStore>()((set, get) => ({
nextTourStep: () => {
const { graph, currentTourStep } = get();
- if (!graph || graph.tour.length === 0) return;
+ if (!graph || !graph.tour || graph.tour.length === 0) return;
const sorted = getSortedTour(graph);
if (currentTourStep < sorted.length - 1) {
const next = currentTourStep + 1;
@@ -365,7 +141,7 @@ export const useDashboardStore = create<DashboardStore>()((set, get) => ({
prevTourStep: () => {
const { graph, currentTourStep } = get();
- if (!graph || graph.tour.length === 0) return;
+ if (!graph || !graph.tour || graph.tour.length === 0) return;
if (currentTourStep > 0) {
const sorted = getSortedTour(graph);
const prev = currentTourStep - 1;
diff --git a/understand-anything-plugin/skills/understand/SKILL.md b/understand-anything-plugin/skills/understand/SKILL.md
index 7a97ce25..42e3dca7 100644
--- a/understand-anything-plugin/skills/understand/SKILL.md
+++ b/understand-anything-plugin/skills/understand/SKILL.md
@@ -6,7 +6,7 @@ argument-hint: [options]
# /understand
-Analyze the current codebase and produce a `knowledge-graph.json` file in `.understand-anything/`.
+Analyze the current codebase and produce a `knowledge-graph.json` file in `.understand-anything/`. This file powers the interactive dashboard for exploring the project's architecture.
## Options
@@ -14,78 +14,113 @@ Analyze the current codebase and produce a `knowledge-graph.json` file in `.unde
- `--full` — Force a full rebuild, ignoring any existing graph
- A directory path — Scope analysis to a specific subdirectory
+---
+
## Phase 0 — Pre-flight
-1. Determine the project root (current working directory).
+Determine whether to run a full analysis or incremental update.
+
+1. Set `PROJECT_ROOT` to the current working directory.
2. Get the current git commit hash:
```bash
git rev-parse HEAD
```
-3. Check if `.understand-anything/knowledge-graph.json` already exists. If it does, read it.
-4. Check if `.understand-anything/meta.json` exists. If it does, read it to get `gitCommitHash`.
-5. **Decide the analysis path:**
- - If `--full` is in `$ARGUMENTS`, or no existing graph → **Full analysis** (all phases)
- - If existing graph exists → check staleness by running:
- ```bash
- git diff <lastCommitHash>..HEAD --name-only
- ```
- - If no changed files → Report "Graph is up to date" and stop
- - If changed files exist → **Incremental update** (re-analyze only changed files)
+3. Create the intermediate output directory:
+ ```bash
+ mkdir -p $PROJECT_ROOT/.understand-anything/intermediate
+ ```
+4. Check if `$PROJECT_ROOT/.understand-anything/knowledge-graph.json` exists. If it does, read it.
+5. Check if `$PROJECT_ROOT/.understand-anything/meta.json` exists. If it does, read it to get `gitCommitHash`.
+6. **Decision logic:**
+
+ | Condition | Action |
+ |---|---|
+ | `--full` flag in `$ARGUMENTS` | Full analysis (all phases) |
+ | No existing graph or meta | Full analysis (all phases) |
+ | Existing graph + unchanged commit hash | Report "Graph is up to date" and STOP |
+ | Existing graph + changed files | Incremental update (re-analyze changed files only) |
+
+ For incremental updates, get the changed file list:
+ ```bash
+ git diff <lastCommitHash>..HEAD --name-only
+ ```
+ If this returns no files, report "Graph is up to date" and STOP.
+
+---
## Phase 1 — SCAN (Full analysis only)
-Dispatch the **project-scanner** agent:
+Dispatch the **project-scanner** agent with this prompt:
> Scan this project directory to discover all source files, detect languages and frameworks.
-> Project root: `<project-root>`
+> Project root: `$PROJECT_ROOT`
+> Write output to: `$PROJECT_ROOT/.understand-anything/intermediate/scan-result.json`
-Collect the result: project name, description, languages, frameworks, file list, complexity estimate.
+After the agent completes, read `$PROJECT_ROOT/.understand-anything/intermediate/scan-result.json` to get:
+- Project name, description
+- Languages, frameworks
+- File list with line counts
+- Complexity estimate
-If >200 files, inform the user and suggest scoping with a subdirectory argument.
+**Gate check:** If >200 files, inform the user and suggest scoping with a subdirectory argument. Proceed only if user confirms or add guidance that this may take a while.
+
+---
## Phase 2 — ANALYZE
-### Full analysis
+### Full analysis path
-Batch the file list from Phase 1 into groups of **5-10 files each**.
+Batch the file list from Phase 1 into groups of **5-10 files each** (aim for balanced batch sizes).
-For each batch, dispatch a **file-analyzer** agent **in parallel** (up to 3 concurrent):
+For each batch, dispatch a **file-analyzer** agent. Run up to **3 agents concurrently** using parallel dispatch. Each agent gets this prompt:
> Analyze these source files and produce GraphNode and GraphEdge objects.
+> Project root: `$PROJECT_ROOT`
> Project: `<projectName>`
> Languages: `<languages>`
-> All project files (for import resolution): `<full file path list>`
+> Batch index: `<batchIndex>`
+> Write output to: `$PROJECT_ROOT/.understand-anything/intermediate/batch-<batchIndex>.json`
+>
+> All project files (for import resolution):
+> `<full file path list from scan>`
>
> Files to analyze in this batch:
> 1. `<path>` (<sizeLines> lines)
> 2. `<path>` (<sizeLines> lines)
> ...
-Collect all results and merge:
-- Combine all `nodes` arrays (deduplicate by `id` — keep the later one if duplicates exist)
-- Combine all `edges` arrays (deduplicate by `source+target+type`)
+After ALL batches complete, read each `batch-<N>.json` file and merge:
+- Combine all `nodes` arrays. If duplicate node IDs exist, keep the later occurrence.
+- Combine all `edges` arrays. Deduplicate by the composite key `source + target + type`.
+
+### Incremental update path
-### Incremental update
+Use the changed files list from Phase 0. Batch and dispatch file-analyzer agents using the same process as above, but only for changed files.
-Use the changed files list from Phase 0. Batch and analyze only those files using file-analyzer agents (same process as above). After collecting results, merge with the existing graph:
-- Remove old nodes whose `filePath` matches a changed file
-- Remove old edges whose `source` or `target` references a removed node
-- Add new nodes and edges from the fresh analysis
+After batches complete, merge with the existing graph:
+1. Remove old nodes whose `filePath` matches any changed file
+2. Remove old edges whose `source` or `target` references a removed node
+3. Add new nodes and edges from the fresh analysis
+
+---
## Phase 3 — ASSEMBLE
-Merge all file-analyzer results into a single set of nodes and edges.
+Merge all file-analyzer results into a single set of nodes and edges. Then perform basic integrity cleanup:
+
+- Remove any edge whose `source` or `target` references a node ID that does not exist in the merged node set
+- Remove duplicate node IDs (keep the last occurrence)
+- Log any removed edges or nodes for the final summary
-Validate basic integrity:
-- Every edge `source` and `target` references an existing node `id`
-- Remove any orphaned edges that reference non-existent nodes
-- No duplicate node IDs
+---
## Phase 4 — ARCHITECTURE
-Dispatch the **architecture-analyzer** agent:
+Dispatch the **architecture-analyzer** agent with this prompt:
> Analyze this codebase's structure to identify architectural layers.
+> Project root: `$PROJECT_ROOT`
+> Write output to: `$PROJECT_ROOT/.understand-anything/intermediate/layers.json`
> Project: `<projectName>` — `<projectDescription>`
>
> File nodes:
@@ -98,15 +133,19 @@ Dispatch the **architecture-analyzer** agent:
> [list of edges with type "imports"]
> ```
-Collect the layers result.
+After the agent completes, read `$PROJECT_ROOT/.understand-anything/intermediate/layers.json` to get the layer assignments.
+
+**For incremental updates:** Always re-run architecture analysis on the full merged node set, since layer assignments may shift when files change.
-For **incremental updates**: re-run architecture analysis on the full merged node set (layers may shift when files change).
+---
## Phase 5 — TOUR
-Dispatch the **tour-builder** agent:
+Dispatch the **tour-builder** agent with this prompt:
> Create a guided learning tour for this codebase.
+> Project root: `$PROJECT_ROOT`
+> Write output to: `$PROJECT_ROOT/.understand-anything/intermediate/tour.json`
> Project: `<projectName>` — `<projectDescription>`
> Languages: `<languages>`
>
@@ -125,11 +164,13 @@ Dispatch the **tour-builder** agent:
> [imports and calls edges]
> ```
-Collect the tour steps.
+After the agent completes, read `$PROJECT_ROOT/.understand-anything/intermediate/tour.json` to get the tour steps.
+
+---
## Phase 6 — REVIEW
-Assemble the full KnowledgeGraph object:
+Assemble the full KnowledgeGraph JSON object:
```json
{
@@ -139,81 +180,96 @@ Assemble the full KnowledgeGraph object:
"languages": ["<languages>"],
"frameworks": ["<frameworks>"],
"description": "<projectDescription>",
- "analyzedAt": "<ISO timestamp>",
- "gitCommitHash": "<commit hash>"
+ "analyzedAt": "<ISO 8601 timestamp>",
+ "gitCommitHash": "<commit hash from Phase 0>"
},
- "nodes": [<all nodes>],
- "edges": [<all edges>],
+ "nodes": [<all merged nodes from Phase 3>],
+ "edges": [<all merged edges from Phase 3>],
"layers": [<layers from Phase 4>],
"tour": [<steps from Phase 5>]
}
```
-Dispatch the **graph-reviewer** agent:
+1. Write the assembled graph to `$PROJECT_ROOT/.understand-anything/intermediate/assembled-graph.json`.
-> Validate this knowledge graph for completeness and correctness.
->
-> ```json
-> <full KnowledgeGraph JSON>
-> ```
+2. Dispatch the **graph-reviewer** agent with this prompt:
+
+ > Validate the knowledge graph at `$PROJECT_ROOT/.understand-anything/intermediate/assembled-graph.json`.
+ > Project root: `$PROJECT_ROOT`
+ > Read the file and validate it for completeness and correctness.
+ > Write output to: `$PROJECT_ROOT/.understand-anything/intermediate/review.json`
+
+3. After the agent completes, read `$PROJECT_ROOT/.understand-anything/intermediate/review.json`.
-If the reviewer reports `approved: false`:
-- Review the issues list
-- Fix any fixable issues (remove invalid edges, fill missing fields with defaults)
-- If critical issues remain after one fix attempt, save the graph anyway with a warning
+4. **If `approved: false`:**
+ - Review the `issues` list
+ - Apply automated fixes where possible:
+ - Remove edges with dangling references
+ - Fill missing required fields with sensible defaults (e.g., empty `tags` -> `["untagged"]`, empty `summary` -> `"No summary available"`)
+ - Remove nodes with invalid types
+ - If critical issues remain after one fix attempt, save the graph anyway but include the warnings in the final report
+
+5. **If `approved: true`:** Proceed to Phase 7.
+
+---
## Phase 7 — SAVE
-1. Write the knowledge graph to `.understand-anything/knowledge-graph.json`
-2. Write metadata to `.understand-anything/meta.json`:
+1. Write the final knowledge graph to `$PROJECT_ROOT/.understand-anything/knowledge-graph.json`.
+
+2. Write metadata to `$PROJECT_ROOT/.understand-anything/meta.json`:
```json
{
- "lastAnalyzedAt": "<ISO timestamp>",
+ "lastAnalyzedAt": "<ISO 8601 timestamp>",
"gitCommitHash": "<commit hash>",
"version": "1.0.0",
"analyzedFiles": <number of files analyzed>
}
```
-3. Report a summary to the user:
+
+3. Clean up intermediate files:
+ ```bash
+ rm -rf $PROJECT_ROOT/.understand-anything/intermediate
+ ```
+
+4. Report a summary to the user containing:
- Project name and description
- Files analyzed / total files
- - Nodes created (by type)
- - Edges created (by type)
- - Layers identified
- - Tour steps generated
+ - Nodes created (broken down by type: file, function, class)
+ - Edges created (broken down by type)
+ - Layers identified (with names)
+ - Tour steps generated (count)
- Any warnings from the reviewer
- - Path to the output file
-4. Tell the user how to view the dashboard:
- ```
- To view your dashboard, run: /understand-dashboard
- ```
+ - Path to the output file: `$PROJECT_ROOT/.understand-anything/knowledge-graph.json`
+
+5. Automatically launch the dashboard by invoking the `/understand-dashboard` skill.
+
+---
## Error Handling
-- If any agent fails, retry **once** with clarified context
-- If still fails, skip that phase gracefully and continue with partial results
-- Always save partial results — a partial graph is better than no graph
-- Report any skipped phases or errors in the final summary
+- If any agent dispatch fails, retry **once** with the same prompt plus additional context about the failure.
+- If it fails a second time, skip that phase and continue with partial results.
+- ALWAYS save partial results — a partial graph is better than no graph.
+- Report any skipped phases or errors in the final summary so the user knows what happened.
+- NEVER silently drop errors. Every failure must be visible in the final report.
+
+---
-## KnowledgeGraph Schema Reference
+## Reference: KnowledgeGraph Schema
### Node Types
-- `file` — Source file
-- `function` — Function or method
-- `class` — Class, interface, or type
-- `module` — Logical module or package
-- `concept` — Abstract concept or pattern
-
-### Node ID Conventions
-- `file:<relative-path>` (e.g., `file:src/index.ts`)
-- `func:<relative-path>:<name>` (e.g., `func:src/utils.ts:formatDate`)
-- `class:<relative-path>:<name>` (e.g., `class:src/models/User.ts:User`)
-- `module:<name>` (e.g., `module:authentication`)
-- `concept:<name>` (e.g., `concept:dependency-injection`)
+| Type | Description | ID Convention |
+|---|---|---|
+| `file` | Source file | `file:<relative-path>` |
+| `function` | Function or method | `func:<relative-path>:<name>` |
+| `class` | Class, interface, or type | `class:<relative-path>:<name>` |
+| `module` | Logical module or package | `module:<name>` |
+| `concept` | Abstract concept or pattern | `concept:<name>` |
### Edge Types (18 total)
| Category | Types |
-|----------|-------|
+|---|---|
| Structural | `imports`, `exports`, `contains`, `inherits`, `implements` |
| Behavioral | `calls`, `subscribes`, `publishes`, `middleware` |
| Data flow | `reads_from`, `writes_to`, `transforms`, `validates` |
@@ -221,12 +277,12 @@ If the reviewer reports `approved: false`:
| Semantic | `related`, `similar_to` |
### Edge Weight Conventions
-- `contains`: 1.0
-- `inherits`: 0.9
-- `implements`: 0.9
-- `calls`: 0.8
-- `exports`: 0.8
-- `imports`: 0.7
-- `depends_on`: 0.6
-- `tested_by`: 0.5
-- Other types: 0.5 default
+| Edge Type | Weight |
+|---|---|
+| `contains` | 1.0 |
+| `inherits`, `implements` | 0.9 |
+| `calls`, `exports` | 0.8 |
+| `imports` | 0.7 |
+| `depends_on` | 0.6 |
+| `tested_by` | 0.5 |
+| All others | 0.5 (default) |