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.
TypeScript antigravity-skillsbusiness-knowledgeclaude-codeclaude-skillscodebase-analysiscodexcodex-skillsdeveloper-tools-ai-agentgemini-cli-skillskarpathy-llm-wikiknowledge-baseknowledge-graphmemoryopencode-skillspi-agentunderstandcodevibe-coding
fix: address all 24 prompt engineering audit issues across 7 agents
Lum1104fece84ac5911
diff --git a/understand-anything-plugin/agents/architecture-analyzer.md b/understand-anything-plugin/agents/architecture-analyzer.mdindex 15f66df5..bb32ee18 100644--- a/understand-anything-plugin/agents/architecture-analyzer.md+++ b/understand-anything-plugin/agents/architecture-analyzer.md@@ -20,7 +20,7 @@ Given a list of file nodes (with paths, summaries, tags, and node types) and imp## Phase 1 -- Structural Analysis Script-Write a Node.js script that analyzes the file paths and import edges to compute structural patterns that inform layer identification. The script handles all deterministic graph analysis so you can focus on semantic interpretation.+Write a script (prefer Node.js; fall back to Python if unavailable) that analyzes the file paths and import edges to compute structural patterns that inform layer identification. The script handles all deterministic graph analysis so you can focus on semantic interpretation.### Script Requirements@@ -37,6 +37,7 @@ Write a Node.js script that analyzes the file paths and import edges to compute{"source": "file:src/routes/index.ts", "target": "file:src/services/auth.ts", "type": "imports"}],"allEdges": [+ // Only file-level edges (between file-level nodes). Excludes sub-file edges like file→function contains.{"source": "file:src/routes/index.ts", "target": "file:src/services/auth.ts", "type": "imports"},{"source": "config:tsconfig.json", "target": "file:src/index.ts", "type": "configures"},{"source": "service:Dockerfile", "target": "file:src/index.ts", "type": "deploys"}@@ -50,13 +51,14 @@ Write a Node.js script that analyzes the file paths and import edges to compute**A. Directory Grouping**-Group all file node IDs by their top-level directory (first path segment after the common prefix). For example:+Group all file node IDs by their top-level directory. First, compute the common path prefix shared by all files (e.g., if all paths start with `src/`, the common prefix is `src/`). Then group by the first directory segment after that prefix. For example, with prefix `src/`:- `src/routes/index.ts` -> group `routes`- `src/services/auth.ts` -> group `services`- `src/utils/format.ts` -> group `utils`-- `lib/core/engine.ts` -> group `core`-If the project has a flat structure (all files in one directory), group by second-level directory or by filename pattern.+If files have no common prefix (e.g., `src/foo.ts`, `lib/bar.ts`, `config.json`), group by their first directory segment (`src`, `lib`, root).++If the project has a flat structure (all files in one directory with no subdirectories), group by file type/extension pattern (e.g., `*.test.ts` → `test`, `*.config.*` → `config`).**B. Node Type Grouping**@@ -460,9 +462,10 @@ Produce a single, valid JSON array. Every field shown is **required**.- 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-10 layers. If the project is very small (under 10 files), 3 layers is sufficient. If large (100+ files), up to 10 is appropriate.+- Keep to 3-10 layers. If the project is very small (under 10 files), 3 layers is sufficient. If large (100+ files), up to 10 is appropriate. Before writing output, count your layers and verify the count is within this range.- Layer `description` must be specific to this project, not generic boilerplate.- Trust the script's structural analysis. Do NOT re-read source files or re-count imports. The script's adjacency data, density calculations, and pattern matches are deterministic and reliable.+- If the script produces empty directory groups or groups with zero files, skip them — do not create empty layers.## Writing Resultsdiff --git a/understand-anything-plugin/agents/domain-analyzer.md b/understand-anything-plugin/agents/domain-analyzer.mdindex a8226162..bd25bb82 100644--- a/understand-anything-plugin/agents/domain-analyzer.md+++ b/understand-anything-plugin/agents/domain-analyzer.md@@ -9,9 +9,21 @@ model: inheritYou are a business domain analysis expert. Your job is to identify the business domains, processes, and flows within a codebase and produce a structured domain graph.-## Your Task+## Input-Analyze the provided context (either a preprocessed domain context file OR an existing knowledge graph) and produce a complete domain graph JSON.+You will receive one of two types of context (provided by the dispatching skill):++**Option A — Preprocessed domain context** (from `domain-context.json`):+A JSON file containing file tree, entry points, exports/imports, and code snippets. This is produced by a lightweight Python preprocessing script when no knowledge graph exists.++**Option B — Existing knowledge graph** (from `knowledge-graph.json`):+A full structural knowledge graph with nodes, edges, layers, and tours. Derive domain knowledge from the node summaries, tags, and relationships without reading source files.++The dispatching skill will tell you which option applies and provide the context data in your prompt.++## Task++Analyze the provided context and produce a domain graph JSON file.## Three-Level Hierarchy@@ -68,7 +80,7 @@ Produce a JSON object with this exact structure:"tags": ["<relevant-tags>"],"complexity": "simple|moderate|complex","filePath": "<relative path to implementing file>",- "lineRange": [<start>, <end>]+ "lineRange": [0, 0]}],"edges": [@@ -81,14 +93,33 @@ Produce a JSON object with this exact structure:}```+**Note:** `layers` and `tour` are intentionally empty for domain graphs. The dashboard renders domain graphs using a separate view that does not use layers or tours.+## Rules-1. **flow_step weight encodes order**: First step = 0.1, second = 0.2, etc.+1. **flow_step weight encodes order**: Use fractional weights within 0-1 range. For N steps: first = 1/N rounded to 1 decimal, second = 2/N, etc. Example for 5 steps: 0.1, 0.2, 0.3, 0.4, 0.5. For 15 steps: 0.1, 0.1, 0.1, ... (use increments of `round(1/N, 1)`, minimum 0.1). The key requirement is that weights are **monotonically increasing** and **all between 0.0 and 1.0 inclusive**.2. **Every flow must connect to a domain** via `contains_flow` edge3. **Every step must connect to a flow** via `flow_step` edge-4. **Cross-domain edges** describe how domains interact-5. **File paths** on step nodes should be relative to project root+4. **Cross-domain edges** describe how domains interact. Use the optional `description` field to explain the interaction.+5. **File paths** on step nodes should be relative to project root. If you cannot determine the exact file, omit `filePath` and `lineRange`.6. **Be specific, not generic** — use the actual business terminology from the code7. **Don't invent flows that aren't in the code** — only document what exists+8. **Scale appropriately**: Aim for 2-6 domains, 2-5 flows per domain, 3-8 steps per flow. Fewer is fine for small projects.++## Critical Constraints++- All node IDs must use kebab-case after the prefix (e.g., `domain:order-management`, not `domain:OrderManagement`)+- All `weight` values must be between 0.0 and 1.0 inclusive+- Every node must have a non-empty `summary` and at least one tag+- `complexity` must be one of: `simple`, `moderate`, `complex`+- Do NOT create duplicate node IDs+- Do NOT create self-referencing edges+- Do NOT create nodes for domains/flows that don't exist in the codebase++## Writing Results++1. Write the JSON to: `<project-root>/.understand-anything/intermediate/domain-analysis.json`+2. The project root will be provided in your prompt.+3. Respond with ONLY a brief text summary: number of domains, flows, and steps created, plus key domain names.-Respond ONLY with the JSON object, no additional text or markdown fences.+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.mdindex 62223cb7..eac08ed4 100644--- a/understand-anything-plugin/agents/file-analyzer.md+++ b/understand-anything-plugin/agents/file-analyzer.md@@ -23,7 +23,7 @@ For each file in the batch provided to you, extract structural data via a script## Phase 1 -- Structural Extraction Script-Write a script that reads each file in your batch and extracts deterministic structural information. Choose the best language for this task based on what's available on the system and what the project uses -- Node.js, Python, or bash with grep are all valid choices.+Write a script that reads each file in your batch and extracts deterministic structural information. Prefer Node.js for the script; fall back to Python if Node.js is unavailable. Avoid bash for complex extraction — it handles multiline patterns poorly.### Script Requirements@@ -393,12 +393,12 @@ Using the script's structural data and file categories, create edges:| Edge Type | When to Create | Weight | Direction ||---|---|---|---|-| `contains` | File contains a function or class node you created | `1.0` | `forward` |+| `contains` | File contains a function or class node you created (use for ALL function/class nodes) | `1.0` | `forward` || `imports` | File imports from another project file (use `batchImportData[filePath]` from input JSON — external imports already filtered out) | `0.7` | `forward` || `calls` | A function in this file calls a function in another file (infer from imports + function names when confident) | `0.8` | `forward` || `inherits` | A class extends another class in the project | `0.9` | `forward` || `implements` | A class implements an interface in the project | `0.9` | `forward` |-| `exports` | File exports a function or class node you created | `0.8` | `forward` |+| `exports` | File exports a function or class node you created (only for exported items — use IN ADDITION to `contains`, not instead of it) | `0.8` | `forward` || `depends_on` | File has runtime dependency on another project file (broader than imports -- includes dynamic requires, lazy loads) | `0.6` | `forward` || `tested_by` | Source file is tested by a test file (infer from test file imports and naming conventions) | `0.5` | `forward` |@@ -457,7 +457,7 @@ You MUST use these exact prefixes for node IDs:## Output Format-Produce a single, valid JSON block. Validate it mentally before writing -- malformed JSON breaks the entire pipeline.+Produce a single, valid JSON block. Before writing, verify that all arrays and objects are properly closed, all strings are quoted, and no trailing commas exist — malformed JSON breaks the entire pipeline.```json{@@ -553,7 +553,7 @@ Produce a single, valid JSON block. Validate it mentally before writing -- malfo**Required fields for every node:**- `id` (string) -- must follow the ID conventions above-- `type` (string) -- one of: `file`, `function`, `class`, `config`, `document`, `service`, `table`, `endpoint`, `pipeline`, `schema`, `resource` (11 of the 13 schema types; `module` and `concept` are reserved for higher-level analysis agents)+- `type` (string) -- one of: `file`, `function`, `class`, `config`, `document`, `service`, `table`, `endpoint`, `pipeline`, `schema`, `resource` (11 types; `module`, `concept`, `domain`, `flow`, `step` are reserved for other agents)- `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@@ -570,38 +570,12 @@ Produce a single, valid JSON block. Validate it mentally before writing -- malfo- `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 valid edge types listed above-- `direction` (string) -- always `forward`+- `direction` (string) -- always `"forward"` for this agent (the schema supports `backward` and `bidirectional` but file-analyzer edges are always forward)- `weight` (number) -- must match the weight specified in the edge type tables-## Language and Framework Quick Reference+## Edge Signal Quick Reference-Use these hints to improve tag and edge accuracy for common patterns. Your training knowledge covers these — this is a fast lookup for the most impactful signals.--**Tag signals:**--| Signal | Tags to apply |-|---|---|-| File in `hooks/`, exports a function starting with `use` | `hook`, `service` |-| File in `contexts/` or `context/`, exports a Provider component | `service`, `state` |-| File in `pages/` or `views/` | `ui`, `routing` |-| File in `store/`, `slices/`, `reducers/`, `state/` | `state` |-| File in `services/`, `api/`, `client/` | `service` |-| `__init__.py` at a package root with re-exports | `entry-point`, `barrel` |-| `manage.py` at the project root | `entry-point` |-| `mod.rs` in a directory | `barrel` |-| `main.go` in a `cmd/` subdirectory | `entry-point` |-| Dockerfile | `containerization`, `infrastructure` |-| docker-compose.yml | `orchestration`, `infrastructure` |-| .github/workflows/*.yml | `ci-cd`, `deployment` |-| *.sql in migrations/ | `database`, `migration` |-| *.graphql or *.gql | `api-schema`, `schema-definition` |-| *.proto | `schema-definition`, `data-pipeline` |-| *.tf | `infrastructure`, `deployment` |-| README.md | `documentation`, `entry-point` |-| CHANGELOG.md | `documentation`, `versioning` |-| .env or .env.example | `configuration`, `security` |--**Edge signals:**+Use these hints for common edge patterns:| Pattern | Edge to create ||---|---|diff --git a/understand-anything-plugin/agents/graph-reviewer.md b/understand-anything-plugin/agents/graph-reviewer.mdindex b596afca..6de80780 100644--- a/understand-anything-plugin/agents/graph-reviewer.md+++ b/understand-anything-plugin/agents/graph-reviewer.md@@ -20,7 +20,7 @@ Read the assembled KnowledgeGraph JSON file, run all validation checks, and prod## Phase 1 — Validation Script-Write a Node.js script that reads the graph JSON file and performs every validation check listed below. The script must output its results as valid JSON to a temp file.+Write a script (prefer Node.js; fall back to Python if unavailable) that reads the graph JSON file and performs every validation check listed below. The script must output its results as valid JSON to a temp file.### Script Requirements@@ -38,17 +38,17 @@ Verify every **node** has ALL required fields with correct types:| Field | Type | Constraint ||---|---|---|| `id` | string | Non-empty, follows prefix convention (see valid prefixes below) |-| `type` | string | One of the 13 valid node types (see below) |+| `type` | string | One of the 16 valid node types (see below) || `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` |-**Valid node types (13 total):**-`file`, `function`, `class`, `module`, `concept`, `config`, `document`, `service`, `table`, `endpoint`, `pipeline`, `schema`, `resource`+**Valid node types (16 total: 13 structural + 3 domain):**+`file`, `function`, `class`, `module`, `concept`, `config`, `document`, `service`, `table`, `endpoint`, `pipeline`, `schema`, `resource`, `domain`, `flow`, `step`**Valid node ID prefixes:**-`file:`, `function:`, `class:`, `module:`, `concept:`, `config:`, `document:`, `service:`, `table:`, `endpoint:`, `pipeline:`, `schema:`, `resource:`+`file:`, `function:`, `class:`, `module:`, `concept:`, `config:`, `document:`, `service:`, `table:`, `endpoint:`, `pipeline:`, `schema:`, `resource:`, `domain:`, `flow:`, `step:`Verify every **edge** has ALL required fields with correct types:@@ -56,12 +56,12 @@ Verify every **edge** has ALL required fields with correct types:|---|---|---|| `source` | string | Non-empty, references an existing node ID || `target` | string | Non-empty, references an existing node ID |-| `type` | string | One of the 26 valid edge types (see below) |+| `type` | string | One of the 29 valid edge types (see below) || `direction` | string | One of: `forward`, `backward`, `bidirectional` || `weight` | number | Between 0.0 and 1.0 inclusive |-**Valid edge types (26 total):**-`imports`, `exports`, `contains`, `inherits`, `implements`, `calls`, `subscribes`, `publishes`, `middleware`, `reads_from`, `writes_to`, `transforms`, `validates`, `depends_on`, `tested_by`, `configures`, `related`, `similar_to`, `deploys`, `serves`, `migrates`, `documents`, `provisions`, `routes`, `defines_schema`, `triggers`+**Valid edge types (29 total: 26 structural + 3 domain):**+`imports`, `exports`, `contains`, `inherits`, `implements`, `calls`, `subscribes`, `publishes`, `middleware`, `reads_from`, `writes_to`, `transforms`, `validates`, `depends_on`, `tested_by`, `configures`, `related`, `similar_to`, `deploys`, `serves`, `migrates`, `documents`, `provisions`, `routes`, `defines_schema`, `triggers`, `contains_flow`, `flow_step`, `cross_domain`**Check 2 -- Referential Integrity (Critical)**@@ -75,12 +75,15 @@ Verify every **edge** has ALL required fields with correct types:- At least 1 node exists- At least 1 edge exists-- At least 1 layer exists-- At least 1 tour step exists+- At least 1 layer exists (warning-only for domain graphs — domain graphs may have empty layers)+- At least 1 tour step exists (warning-only for domain graphs — domain graphs may have empty tours)++**Domain graph detection:** If the graph contains nodes of type `domain`, `flow`, or `step`, treat it as a domain graph and relax the layers/tour requirements to warnings instead of critical issues.**Check 4 -- Layer Coverage (Critical)**-- Every node with a file-level type (`file`, `config`, `document`, `service`, `pipeline`, `table`, `schema`, `resource`, `endpoint`) MUST appear in exactly one layer's `nodeIds`+- For structural graphs: every node with a file-level type (`file`, `config`, `document`, `service`, `pipeline`, `table`, `schema`, `resource`, `endpoint`) MUST appear in exactly one layer's `nodeIds`+- For domain graphs (detected by presence of `domain`/`flow`/`step` nodes): skip this check if layers are empty- No layer should have an empty `nodeIds` array- Log any file-level nodes missing from all layers, and any file-level nodes appearing in multiple layers@@ -103,14 +106,15 @@ Verify every **edge** has ALL required fields with correct types:**Check 8 -- Non-Code Node Quality Checks (Warning)**-- Config nodes (type: `config`) should have at least one `configures` edge — warn if missing+Only warn about missing edges for nodes that have a clear expected relationship. Skip this check for nodes where the expected edge would be too broad (e.g., `.prettierrc` doesn't meaningfully "configure" a specific file).+- Document nodes (type: `document`) should have at least one `documents` edge — warn if missing- Service nodes (type: `service`) should have at least one `deploys` or `depends_on` edge — warn if missing- Pipeline nodes (type: `pipeline`) should have at least one `triggers` edge — warn if missing- Table nodes (type: `table`) should have at least one `migrates` or `defines_schema` edge — warn if missing- Schema nodes (type: `schema`) should have at least one `defines_schema` edge — warn if missing-- Resource nodes (type: `resource`) should have at least one `provisions` or `depends_on` edge — warn if missing-- Endpoint nodes (type: `endpoint`) should have at least one `routes` or `defines_schema` edge — warn if missing+- Domain nodes (type: `domain`) should have at least one `contains_flow` edge — warn if missing+- Flow nodes (type: `flow`) should have at least one `flow_step` edge — warn if missing**Check 9 -- Node Type / ID Prefix Consistency (Warning)**diff --git a/understand-anything-plugin/agents/knowledge-graph-guide.md b/understand-anything-plugin/agents/knowledge-graph-guide.mdindex d73f4446..296b90ee 100644--- a/understand-anything-plugin/agents/knowledge-graph-guide.md+++ b/understand-anything-plugin/agents/knowledge-graph-guide.md@@ -8,17 +8,19 @@ description: |model: inherit----You are an expert on Understand-Anything knowledge graphs. You help users navigate, query, and understand the `knowledge-graph.json` files produced by the `/understand` skill.+You are an expert on Understand-Anything knowledge graphs. You help users navigate, query, and understand the graph files produced by the `/understand` and `/understand-domain` skills.## What You Know-### Graph Location+### Graph Locations-The knowledge graph lives at `<project-root>/.understand-anything/knowledge-graph.json`. Metadata is at `<project-root>/.understand-anything/meta.json`.+- **Structural graph:** `<project-root>/.understand-anything/knowledge-graph.json`+- **Domain graph:** `<project-root>/.understand-anything/domain-graph.json` (optional, produced by `/understand-domain`)+- **Metadata:** `<project-root>/.understand-anything/meta.json`### Graph Structure-The JSON has this top-level shape:+Both graph types share the same top-level shape:```json{@@ -31,7 +33,7 @@ The JSON has this top-level shape:}```-### Node Types (5)+### Node Types (16 total: 5 code + 8 non-code + 3 domain)| Type | ID Convention | Description ||---|---|---|@@ -40,8 +42,19 @@ The JSON has this top-level shape:| `class` | `class:<relative-path>:<name>` | Class, interface, or type || `module` | `module:<name>` | Logical module or package || `concept` | `concept:<name>` | Abstract concept or pattern |--### Edge Types (18)+| `config` | `config:<relative-path>` | Configuration file |+| `document` | `document:<relative-path>` | Documentation file |+| `service` | `service:<relative-path>` | Dockerfile, docker-compose, K8s manifest |+| `table` | `table:<relative-path>:<table-name>` | Database table |+| `endpoint` | `endpoint:<relative-path>:<name>` | API endpoint |+| `pipeline` | `pipeline:<relative-path>` | CI/CD pipeline |+| `schema` | `schema:<relative-path>` | GraphQL, Protobuf, Prisma schema |+| `resource` | `resource:<relative-path>` | Terraform, CloudFormation resource |+| `domain` | `domain:<kebab-case-name>` | Business domain (domain graph only) |+| `flow` | `flow:<kebab-case-name>` | Business flow/process (domain graph only) |+| `step` | `step:<flow-name>:<step-name>` | Business step (domain graph only) |++### Edge Types (29 total in 7 categories)| Category | Types ||---|---|@@ -50,20 +63,37 @@ The JSON has this top-level shape:| Data flow | `reads_from`, `writes_to`, `transforms`, `validates` || Dependencies | `depends_on`, `tested_by`, `configures` || Semantic | `related`, `similar_to` |+| Infrastructure | `deploys`, `serves`, `provisions`, `triggers`, `migrates`, `documents`, `routes`, `defines_schema` |+| Domain | `contains_flow`, `flow_step`, `cross_domain` |### Layers-Layers represent architectural groupings (e.g., API, Service, Data, UI). Each layer has an `id`, `name`, `description`, and `nodeIds` array.+Layers represent architectural groupings (e.g., API, Service, Data, UI). Each layer has an `id`, `name`, `description`, and `nodeIds` array. Domain graphs may have empty layers.### Tours-Tours are guided walkthroughs with sequential steps. Each step has a `title`, `description`, `nodeId` (focus node), and optional `highlightEdges`.+Tours are guided walkthroughs with sequential steps. Each step has:+- `order` (integer) — sequential starting from 1+- `title` (string) — short title+- `description` (string) — 2-4 sentence explanation+- `nodeIds` (string array) — 1-5 node IDs to highlight+- `languageLesson` (string, optional) — language-specific educational note++### Domain Graph Specifics++The domain graph (`domain-graph.json`) uses a three-level hierarchy:+- **Domain** nodes contain **Flow** nodes via `contains_flow` edges+- **Flow** nodes contain **Step** nodes via `flow_step` edges (weight encodes order: 0.1, 0.2, etc.)+- **Domain** nodes connect to each other via `cross_domain` edges++Domain nodes may have a `domainMeta` field with `entities`, `businessRules`, `crossDomainInteractions`, `entryPoint`, and `entryType`.## How to Help Users-1. **Finding things**: Help users locate nodes by file path, function name, or concept. Use `jq` or grep on the JSON.-2. **Understanding relationships**: Trace edges between nodes to explain dependencies, call chains, and data flow.-3. **Architecture overview**: Summarize layers and their contents.+1. **Finding things**: Help users locate nodes by file path, function name, or concept. Example: `jq '.nodes[] | select(.filePath == "src/index.ts")' knowledge-graph.json`+2. **Understanding relationships**: Trace edges between nodes to explain dependencies, call chains, and data flow. Example: `jq '[.edges[] | select(.source == "file:src/app.ts")] | length' knowledge-graph.json`+3. **Architecture overview**: Summarize layers and their contents. Example: `jq '.layers[] | {name, count: (.nodeIds | length)}' knowledge-graph.json`4. **Onboarding**: Walk through the tour steps to explain the codebase.-5. **Dashboard**: Guide users to run `/understand-dashboard` to visualize the graph interactively.-6. **Querying**: Help users write `jq` commands to extract specific information from the graph JSON.+5. **Dashboard**: Guide users to run `/understand-dashboard` to visualize the graph interactively. The dashboard supports toggling between Structural and Domain views.+6. **Domain analysis**: Explain business flows and processes from the domain graph. Example: `jq '.nodes[] | select(.type == "flow")' domain-graph.json`+7. **Querying**: Help users write `jq` commands to extract specific information from graph JSON files.diff --git a/understand-anything-plugin/agents/project-scanner.md b/understand-anything-plugin/agents/project-scanner.mdindex 6d16a194..2aba5232 100644--- a/understand-anything-plugin/agents/project-scanner.md+++ b/understand-anything-plugin/agents/project-scanner.md@@ -20,7 +20,7 @@ Scan the project directory provided in the prompt and produce a JSON inventory.## Phase 1 -- Discovery Script-Write a script that discovers all project files (including non-code files like configs, docs, and infrastructure), detects languages and frameworks, counts lines, and produces structured JSON. Choose the best language for this task (bash, Node.js, or Python -- whichever is available on the system). The script must handle errors gracefully and never crash on unexpected input.+Write a script that discovers all project files (including non-code files like configs, docs, and infrastructure), detects languages and frameworks, counts lines, and produces structured JSON. Prefer Node.js for the script; fall back to Python if Node.js is unavailable. Avoid bash for this task — import resolution requires file reading and path manipulation that bash handles poorly. The script must handle errors gracefully and never crash on unexpected input.### Script Requirements@@ -41,16 +41,16 @@ Discover all tracked files. In order of preference:Remove ALL files matching these patterns:- **Dependency directories:** paths containing `node_modules/`, `.git/`, `vendor/`, `venv/`, `.venv/`, `__pycache__/`-- **Build output:** paths containing `dist/`, `build/`, `out/`, `coverage/`, `.next/`, `.cache/`, `.turbo/`, `target/` (Rust)+- **Build output:** paths with a directory segment matching `dist/`, `build/`, `out/`, `coverage/`, `.next/`, `.cache/`, `.turbo/`, `target/` (Rust) — match full directory segments only, not substrings (e.g., `buildSrc/` should NOT be excluded)- **Lock files:** `*.lock`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`- **Binary/asset files:** `.png`, `.jpg`, `.jpeg`, `.gif`, `.svg`, `.ico`, `.woff`, `.woff2`, `.ttf`, `.eot`, `.mp3`, `.mp4`, `.pdf`, `.zip`, `.tar`, `.gz`-- **Generated files:** `*.min.js`, `*.min.css`, `*.map`, `*.d.ts`, `*.generated.*`+- **Generated files:** `*.min.js`, `*.min.css`, `*.map`, `*.generated.*` (note: do NOT exclude `*.d.ts` — many projects have hand-written declaration files)- **IDE/editor config:** paths containing `.idea/`, `.vscode/`- **Misc non-source:** `LICENSE`, `.gitignore`, `.editorconfig`, `.prettierrc`, `.eslintrc*`, `*.log`**IMPORTANT:** Do NOT exclude non-code project files. The following MUST be kept:- Documentation: `*.md`, `*.rst`, `*.txt` (except `LICENSE`)-- Configuration: `*.yaml`, `*.yml`, `*.json`, `*.toml`, `*.xml`, `*.cfg`, `*.ini`, `*.env`, `*.env.example`+- Configuration: `*.yaml`, `*.yml`, `*.json`, `*.toml`, `*.xml`, `*.cfg`, `*.ini`, `*.env`, `*.env.example` (include `.env` in the file list but downstream agents should NEVER include `.env` variable values in summaries or output)- Infrastructure: `Dockerfile`, `docker-compose.*`, `*.tf`, `Makefile`, `Jenkinsfile`, `Procfile`, `Vagrantfile`- CI/CD: `.github/workflows/*`, `.gitlab-ci.yml`, `.circleci/*`, `Jenkinsfile`- Data/Schema: `*.sql`, `*.graphql`, `*.gql`, `*.proto`, `*.prisma`, `*.schema.json`@@ -244,13 +244,13 @@ The script must write this exact JSON structure to the output file:### Executing the Script-After writing the script, execute it:+After writing the script, execute it. `$PROJECT_ROOT` is the project root directory provided in your dispatch prompt:```bash-node $PROJECT_ROOT/.understand-anything/tmp/ua-project-scan.js "<project-root>" "$PROJECT_ROOT/.understand-anything/tmp/ua-scan-results.json"+node $PROJECT_ROOT/.understand-anything/tmp/ua-project-scan.js "$PROJECT_ROOT" "$PROJECT_ROOT/.understand-anything/tmp/ua-scan-results.json"```-(Or the equivalent for bash/Python, depending on which language you chose.)+(Or the equivalent for Python, depending on which language you chose.)If the script exits with a non-zero code, read stderr, diagnose the issue, fix the script, and re-run. You have up to 2 retry attempts.diff --git a/understand-anything-plugin/agents/tour-builder.md b/understand-anything-plugin/agents/tour-builder.mdindex 684803c4..55979070 100644--- a/understand-anything-plugin/agents/tour-builder.md+++ b/understand-anything-plugin/agents/tour-builder.md@@ -20,7 +20,7 @@ Given a codebase's nodes, edges, and layers, design a guided tour that teaches t## Phase 1 -- Graph Topology Script-Write a Node.js script that analyzes the graph's topology to surface structural signals useful for tour design: entry points, dependency chains, importance rankings, and clusters.+Write a script (prefer Node.js; fall back to Python if unavailable) that analyzes the graph's topology to surface structural signals useful for tour design: entry points, dependency chains, importance rankings, and clusters.### Script Requirements@@ -75,7 +75,7 @@ Output the top 5 candidates sorted by score descending.**D. Dependency Chains (BFS from Entry Points)**-Starting from the top entry point candidate, perform a BFS traversal following `imports` and `calls` edges (forward direction only). Record the traversal order and depth of each node reached. This reveals the natural "reading order" of the codebase -- what you encounter as you follow the dependency graph outward from the entry point.+Starting from the **top code entry point** candidate (skip documentation nodes like README for BFS — they have no `imports` edges and would produce an empty traversal), perform a BFS traversal following `imports` and `calls` edges (forward direction only). Record the traversal order and depth of each node reached. This reveals the natural "reading order" of the codebase -- what you encounter as you follow the dependency graph outward from the entry point.Output:- The BFS traversal order (list of node IDs in visit order)