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
docs(agents): resolve $UA_DIR in agent definitions and auto-update prompt
Lum1104353385f22785
diff --git a/understand-anything-plugin/agents/architecture-analyzer.md b/understand-anything-plugin/agents/architecture-analyzer.mdindex 569a291c..d6201a10 100644--- a/understand-anything-plugin/agents/architecture-analyzer.md+++ b/understand-anything-plugin/agents/architecture-analyzer.md@@ -298,10 +298,11 @@ For each pair of groups with imports between them, determine the dominant direct### Preparing the Script Input-Before writing the script, create its input JSON file:+Before writing the script, create its input JSON file. First resolve the project's data directory once (the legacy `.understand-anything/` when it already exists, otherwise the new `.ua/`) and reuse `$UA_DIR` for every path below:```bash-cat > $PROJECT_ROOT/.understand-anything/tmp/ua-arch-input.json << 'ENDJSON'+UA_DIR="$PROJECT_ROOT/$([ -d "$PROJECT_ROOT/.understand-anything" ] && echo .understand-anything || echo .ua)"+cat > $UA_DIR/tmp/ua-arch-input.json << 'ENDJSON'{"fileNodes": [<file nodes from prompt — all node types>],"importEdges": [<import edges from prompt>],@@ -315,7 +316,7 @@ ENDJSONAfter writing the script, execute it:```bash-node $PROJECT_ROOT/.understand-anything/tmp/ua-arch-analyze.js $PROJECT_ROOT/.understand-anything/tmp/ua-arch-input.json $PROJECT_ROOT/.understand-anything/tmp/ua-arch-results.json+node $UA_DIR/tmp/ua-arch-analyze.js $UA_DIR/tmp/ua-arch-input.json $UA_DIR/tmp/ua-arch-results.json```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.@@ -324,7 +325,7 @@ If the script exits with a non-zero code, read stderr, diagnose the issue, fix t## Phase 2 -- Semantic Layer Assignment-After the script completes, read `$PROJECT_ROOT/.understand-anything/tmp/ua-arch-results.json`. Use the structural analysis as the primary input for your layer decisions. Do NOT re-read source files or re-analyze imports -- trust the script's results entirely.+After the script completes, read `$UA_DIR/tmp/ua-arch-results.json`. Use the structural analysis as the primary input for your layer decisions. Do NOT re-read source files or re-analyze imports -- trust the script's results entirely.### Step 1 -- Evaluate Directory Groups as Layer Candidates@@ -473,7 +474,7 @@ Produce a single, valid JSON array. Every field shown is **required**.After producing the JSON:-1. Write the JSON array to: `<project-root>/.understand-anything/intermediate/layers.json`+1. Write the JSON array to the `intermediate/layers.json` file inside the project's data directory — `$UA_DIR/intermediate/layers.json` (`.ua/`, or the legacy `.understand-anything/` when that directory is present). Use the exact output path given in your dispatch prompt if one was provided.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.diff --git a/understand-anything-plugin/agents/domain-analyzer.md b/understand-anything-plugin/agents/domain-analyzer.mdindex be38e06f..c1e69342 100644--- a/understand-anything-plugin/agents/domain-analyzer.md+++ b/understand-anything-plugin/agents/domain-analyzer.md@@ -117,7 +117,7 @@ Produce a JSON object with this exact structure:## Writing Results-1. Write the JSON to: `<project-root>/.understand-anything/intermediate/domain-analysis.json`+1. Write the JSON to the `intermediate/domain-analysis.json` file inside the project's data directory (`.ua/`, or the legacy `.understand-anything/` when that directory is present). Use the exact output path given in your prompt.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.diff --git a/understand-anything-plugin/agents/file-analyzer.md b/understand-anything-plugin/agents/file-analyzer.mdindex dd25b753..568b0ac4 100644--- a/understand-anything-plugin/agents/file-analyzer.md+++ b/understand-anything-plugin/agents/file-analyzer.md@@ -32,7 +32,7 @@ Execute the pre-built structural extraction script bundled with the Understand-A### Step 1 — Prepare the input JSON-Create the input file with the batch data. **IMPORTANT:** Use the batch index in ALL temp file paths to avoid collisions when multiple file-analyzer agents run concurrently.+Create the input file with the batch data. **IMPORTANT:** Use the batch index in ALL temp file paths to avoid collisions when multiple file-analyzer agents run concurrently. First resolve the project's data directory once (the legacy `.understand-anything/` when it already exists, otherwise the new `.ua/`) and reuse `$UA_DIR` for every path below: `UA_DIR="$PROJECT_ROOT/$([ -d "$PROJECT_ROOT/.understand-anything" ] && echo .understand-anything || echo .ua)"`.Each entry in `batchFiles` MUST be an object with these four fields, copied verbatim from the dispatch prompt's batch list:@@ -42,7 +42,7 @@ Each entry in `batchFiles` MUST be an object with these four fields, copied verb- `fileCategory` (string) — `code`, `config`, `docs`, `infra`, `data`, `script`, or `markup````bash-cat > $PROJECT_ROOT/.understand-anything/tmp/ua-file-analyzer-input-<batchIndex>.json << 'ENDJSON'+cat > $UA_DIR/tmp/ua-file-analyzer-input-<batchIndex>.json << 'ENDJSON'{"projectRoot": "<project-root>","batchFiles": [@@ -71,17 +71,17 @@ Run the bundled `extract-structure.mjs` script. The `<SKILL_DIR>` path is provid```bashnode <SKILL_DIR>/extract-structure.mjs \- $PROJECT_ROOT/.understand-anything/tmp/ua-file-analyzer-input-<batchIndex>.json \- $PROJECT_ROOT/.understand-anything/tmp/ua-file-extract-results-<batchIndex>.json+ $UA_DIR/tmp/ua-file-analyzer-input-<batchIndex>.json \+ $UA_DIR/tmp/ua-file-extract-results-<batchIndex>.json```If the script exits non-zero, read stderr and report the error. Do NOT attempt to write a manual extraction script as fallback — the bundled script is the sole extraction path.-After the script returns, verify the output file exists and is non-empty (e.g. `test -s $PROJECT_ROOT/.understand-anything/tmp/ua-file-extract-results-<batchIndex>.json`). Exit 0 with a missing output file means the bundled script silently no-opped — report this as a hard failure rather than proceeding to Step 3.+After the script returns, verify the output file exists and is non-empty (e.g. `test -s $UA_DIR/tmp/ua-file-extract-results-<batchIndex>.json`). Exit 0 with a missing output file means the bundled script silently no-opped — report this as a hard failure rather than proceeding to Step 3.### Step 3 — Read the extraction results-Read `$PROJECT_ROOT/.understand-anything/tmp/ua-file-extract-results-<batchIndex>.json`. The output format is:+Read `$UA_DIR/tmp/ua-file-extract-results-<batchIndex>.json`. The output format is:```json{@@ -144,7 +144,7 @@ Treat these the same as tree-sitter-derived functions for node creation (Step 2## Phase 2 -- Semantic Analysis-After the script completes, read `$PROJECT_ROOT/.understand-anything/tmp/ua-file-extract-results-<batchIndex>.json`. Use these structured results as the foundation for your analysis. Do NOT re-read the source files unless the script skipped a file or you need to understand a specific pattern that the script could not capture.+After the script completes, read `$UA_DIR/tmp/ua-file-extract-results-<batchIndex>.json`. Use these structured results as the foundation for your analysis. Do NOT re-read the source files unless the script skipped a file or you need to understand a specific pattern that the script could not capture.For each file in the script's `results` array, produce `GraphNode` and `GraphEdge` objects by combining the script's structural data with your expert judgment.@@ -499,7 +499,7 @@ edgeCount = edges.length```**Step B — Decide split.**-- If `nodeCount ≤ 60` AND `edgeCount ≤ 120`: write ONE file to `.understand-anything/intermediate/batch-<batchIndex>.json`. Done. Skip to Step F.+- If `nodeCount ≤ 60` AND `edgeCount ≤ 120`: write ONE file to `$UA_DIR/intermediate/batch-<batchIndex>.json` (the data directory — `.ua/`, or the legacy `.understand-anything/` when present). Done. Skip to Step F.- Otherwise: `parts = ceil(max(nodeCount / 60, edgeCount / 120))`.**Step C — Partition.**@@ -508,7 +508,7 @@ Sort files in your batch alphabetically by path. Chunk them sequentially into `p- All edges whose `source` is in this part's nodes (target may be anywhere — same part, different part of same batch, different batch).**Step D — Write each part.**-Write part `k` (1-indexed) to `.understand-anything/intermediate/batch-<batchIndex>-part-<k>.json`. Each part is a valid GraphFragment: `{ "nodes": [...], "edges": [...] }`.+Write part `k` (1-indexed) to `$UA_DIR/intermediate/batch-<batchIndex>-part-<k>.json`. Each part is a valid GraphFragment: `{ "nodes": [...], "edges": [...] }`.**Step E — Self-validate.**For each file written, verify:diff --git a/understand-anything-plugin/agents/graph-reviewer.md b/understand-anything-plugin/agents/graph-reviewer.mdindex 34796224..3b32d37a 100644--- a/understand-anything-plugin/agents/graph-reviewer.md+++ b/understand-anything-plugin/agents/graph-reviewer.md@@ -170,10 +170,11 @@ 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. First resolve the project's data directory once (the legacy `.understand-anything/` when it already exists, otherwise the new `.ua/`) and reuse `$UA_DIR` below:```bash-node $PROJECT_ROOT/.understand-anything/tmp/ua-graph-validate.js "<graph-file-path>" "$PROJECT_ROOT/.understand-anything/tmp/ua-review-results.json"+UA_DIR="$PROJECT_ROOT/$([ -d "$PROJECT_ROOT/.understand-anything" ] && echo .understand-anything || echo .ua)"+node $UA_DIR/tmp/ua-graph-validate.js "<graph-file-path>" "$UA_DIR/tmp/ua-review-results.json"```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.@@ -182,7 +183,7 @@ If the script exits with a non-zero code, read stderr, diagnose the issue, fix t## Phase 2 -- Review and Decision-After the script completes, read `$PROJECT_ROOT/.understand-anything/tmp/ua-review-results.json`. Do NOT re-read the original graph file -- trust the script's results entirely.+After the script completes, read `$UA_DIR/tmp/ua-review-results.json`. Do NOT re-read the original graph file -- trust the script's results entirely.Review the `issues` and `warnings` arrays and render your decision:@@ -232,7 +233,7 @@ Produce the final validation report JSON:After producing the final JSON:-1. Write the JSON to: `<project-root>/.understand-anything/intermediate/review.json`+1. Write the JSON to `$UA_DIR/intermediate/review.json` inside the project's data directory (`.ua/`, or the legacy `.understand-anything/` when that directory is present). Use the exact output path given in your dispatch prompt if one was provided.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.diff --git a/understand-anything-plugin/agents/knowledge-graph-guide.md b/understand-anything-plugin/agents/knowledge-graph-guide.mdindex 52daa6d5..8ed3927e 100644--- a/understand-anything-plugin/agents/knowledge-graph-guide.md+++ b/understand-anything-plugin/agents/knowledge-graph-guide.md@@ -13,9 +13,11 @@ You are an expert on Understand-Anything knowledge graphs. You help users naviga### Graph Locations-- **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`+These live in the project's data directory `<UA_DIR>` — the legacy `.understand-anything/` when that directory already exists, otherwise the new `.ua/`. Resolve it with `UA_DIR="<project-root>/$([ -d "<project-root>/.understand-anything" ] && echo .understand-anything || echo .ua)"`.++- **Structural graph:** `<UA_DIR>/knowledge-graph.json`+- **Domain graph:** `<UA_DIR>/domain-graph.json` (optional, produced by `/understand-domain`)+- **Metadata:** `<UA_DIR>/meta.json`### Graph Structurediff --git a/understand-anything-plugin/agents/project-scanner.md b/understand-anything-plugin/agents/project-scanner.mdindex e6812ae7..cc3f7084 100644--- a/understand-anything-plugin/agents/project-scanner.md+++ b/understand-anything-plugin/agents/project-scanner.md@@ -54,11 +54,14 @@ If the manifest is missing or malformed, leave the corresponding field empty ratInvoke the bundled scan script. It walks the project (preferring `git ls-files`, falling back to a recursive walk for non-git directories), applies `.understandignore` filtering (defaults + user patterns), assigns `language` and `fileCategory` per the canonical tables, counts lines, and writes deterministic JSON. You do not see or maintain those tables — they live in the script.+Resolve the project's data directory once (the legacy `.understand-anything/` when it already exists, otherwise the new `.ua/`) and reuse `$UA_DIR` for every path below:+```bash-mkdir -p $PROJECT_ROOT/.understand-anything/tmp+UA_DIR="$PROJECT_ROOT/$([ -d "$PROJECT_ROOT/.understand-anything" ] && echo .understand-anything || echo .ua)"+mkdir -p $UA_DIR/tmpnode $PLUGIN_ROOT/skills/understand/scan-project.mjs \"$PROJECT_ROOT" \- "$PROJECT_ROOT/.understand-anything/tmp/ua-scan-files.json"+ "$UA_DIR/tmp/ua-scan-files.json"```Output JSON shape (you will read this verbatim and merge into the final scan-result):@@ -107,7 +110,7 @@ The script:**Priority rule:** most-specific wins. Filename / path rules fire before extension rules — e.g., `docker-compose.yml` is `infra` (not `config`); `.github/workflows/ci.yml` is `infra` (not `config`); `LICENSE` is `code` (not `docs`).-**`.understandignore` behavior:** the bundled script reads `.understandignore` and `.understand-anything/.understandignore` if present and merges them with the hardcoded defaults via `createIgnoreFilter`. `!`-negation overrides defaults (`!dist/` would re-include `dist/` files). The `filteredByIgnore` counter measures only user-driven drops, not baseline default drops.+**`.understandignore` behavior:** the bundled script reads `.understandignore` and the data directory's `.understandignore` (`.ua/.understandignore`, or `.understand-anything/.understandignore` when that legacy directory is present) if present and merges them with the hardcoded defaults via `createIgnoreFilter`. `!`-negation overrides defaults (`!dist/` would re-include `dist/` files). The `filteredByIgnore` counter measures only user-driven drops, not baseline default drops.If the script exits with a non-zero status, read stderr to diagnose. You have up to 2 retry attempts (re-invocations) before failing the phase. Do NOT attempt to substitute a custom scanner — there is no second-source replacement.@@ -120,8 +123,9 @@ After Step B has produced the file list, invoke the bundled `extract-import-map.Write the input JSON for the bundled script (the `files[]` array is exactly Step B's `files[]` — pass it through verbatim):```bash-mkdir -p $PROJECT_ROOT/.understand-anything/tmp-cat > $PROJECT_ROOT/.understand-anything/tmp/ua-import-map-input.json << 'ENDJSON'+UA_DIR="$PROJECT_ROOT/$([ -d "$PROJECT_ROOT/.understand-anything" ] && echo .understand-anything || echo .ua)"+mkdir -p $UA_DIR/tmp+cat > $UA_DIR/tmp/ua-import-map-input.json << 'ENDJSON'{"projectRoot": "<absolute-project-root>","files": [@@ -136,8 +140,8 @@ Then run:```bashnode $PLUGIN_ROOT/skills/understand/extract-import-map.mjs \- $PROJECT_ROOT/.understand-anything/tmp/ua-import-map-input.json \- $PROJECT_ROOT/.understand-anything/tmp/ua-import-map-output.json+ $UA_DIR/tmp/ua-import-map-input.json \+ $UA_DIR/tmp/ua-import-map-output.json```The output JSON has shape:@@ -166,8 +170,8 @@ Read the output JSON and merge the `importMap` field directly into your final sc## Phase 2 -- Description and Final AssemblyAfter Steps A + B + C have all completed, read:-1. `$PROJECT_ROOT/.understand-anything/tmp/ua-scan-files.json` — output of `scan-project.mjs` (file list with language, sizeLines, fileCategory; plus `totalFiles`, `filteredByIgnore`, `estimatedComplexity`).-2. `$PROJECT_ROOT/.understand-anything/tmp/ua-import-map-output.json` — output of `extract-import-map.mjs` (the `importMap` field).+1. `$UA_DIR/tmp/ua-scan-files.json` — output of `scan-project.mjs` (file list with language, sizeLines, fileCategory; plus `totalFiles`, `filteredByIgnore`, `estimatedComplexity`).+2. `$UA_DIR/tmp/ua-import-map-output.json` — output of `extract-import-map.mjs` (the `importMap` field).3. Your Step A in-memory notes (`name`, `rawDescription`, `readmeHead`, `frameworks`, `languages` narrative).Do NOT re-walk the file tree, re-count lines, or re-derive categories — trust `scan-project.mjs` entirely. Do NOT re-implement import resolution — trust `extract-import-map.mjs` entirely.@@ -228,8 +232,8 @@ Then assemble the final output JSON:After producing the final 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`+1. Create the output directory: `mkdir -p $UA_DIR/intermediate` (the data directory — `.ua/`, or the legacy `.understand-anything/` when present)+2. Write the JSON to: `$UA_DIR/intermediate/scan-result.json`. Use the exact output path given in your dispatch prompt if one was provided.3. Respond with ONLY a brief text summary: project name, total file count (with breakdown by category), detected languages, estimated complexity.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.mdindex 2240e7d0..9f2e70fd 100644--- a/understand-anything-plugin/agents/tour-builder.md+++ b/understand-anything-plugin/agents/tour-builder.md@@ -179,10 +179,11 @@ Note: input nodes may include all node types (file, config, document, service, p### Preparing the Script Input-Before writing the script, create its input JSON file:+Before writing the script, create its input JSON file. First resolve the project's data directory once (the legacy `.understand-anything/` when it already exists, otherwise the new `.ua/`) and reuse `$UA_DIR` for every path below:```bash-cat > $PROJECT_ROOT/.understand-anything/tmp/ua-tour-input.json << 'ENDJSON'+UA_DIR="$PROJECT_ROOT/$([ -d "$PROJECT_ROOT/.understand-anything" ] && echo .understand-anything || echo .ua)"+cat > $UA_DIR/tmp/ua-tour-input.json << 'ENDJSON'{"nodes": [<nodes from prompt — all types including non-code>],"edges": [<edges from prompt — all types>],@@ -196,7 +197,7 @@ ENDJSONAfter writing the script, execute it:```bash-node $PROJECT_ROOT/.understand-anything/tmp/ua-tour-analyze.js $PROJECT_ROOT/.understand-anything/tmp/ua-tour-input.json $PROJECT_ROOT/.understand-anything/tmp/ua-tour-results.json+node $UA_DIR/tmp/ua-tour-analyze.js $UA_DIR/tmp/ua-tour-input.json $UA_DIR/tmp/ua-tour-results.json```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.@@ -205,7 +206,7 @@ If the script exits with a non-zero code, read stderr, diagnose the issue, fix t## Phase 2 -- Pedagogical Tour Design-After the script completes, read `$PROJECT_ROOT/.understand-anything/tmp/ua-tour-results.json`. Use the structural analysis as your primary guide for designing the tour. Do NOT re-read source files or re-analyze the graph -- trust the script's results entirely.+After the script completes, read `$UA_DIR/tmp/ua-tour-results.json`. Use the structural analysis as your primary guide for designing the tour. Do NOT re-read source files or re-analyze the graph -- trust the script's results entirely.### Step 1 -- Choose the Starting Point@@ -371,7 +372,7 @@ Produce a single, valid JSON array.After producing the JSON:-1. Write the JSON array to: `<project-root>/.understand-anything/intermediate/tour.json`+1. Write the JSON array to `$UA_DIR/intermediate/tour.json` inside the project's data directory (`.ua/`, or the legacy `.understand-anything/` when that directory is present). Use the exact output path given in your dispatch prompt if one was provided.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.diff --git a/understand-anything-plugin/hooks/auto-update-prompt.md b/understand-anything-plugin/hooks/auto-update-prompt.mdindex 7eb58f27..cdc5800e 100644--- a/understand-anything-plugin/hooks/auto-update-prompt.md+++ b/understand-anything-plugin/hooks/auto-update-prompt.md@@ -8,12 +8,12 @@ Incrementally update the knowledge graph using deterministic structural fingerpr## Phase 0 — Pre-flight (Zero Token Cost)-1. Set `PROJECT_ROOT` to the current working directory.+1. Set `PROJECT_ROOT` to the current working directory. **Resolve the data directory `$UA_DIR`** once and reuse it for every read and write below: `UA_DIR="$PROJECT_ROOT/$([ -d "$PROJECT_ROOT/.understand-anything" ] && echo .understand-anything || echo .ua)"` — this selects the legacy `.understand-anything/` when it already exists, otherwise the new `.ua/`. Because each phase may run in a fresh shell, carry `$UA_DIR` forward like `$PROJECT_ROOT`, re-resolving it with the same line if a later command block needs it. Scripts written below that run in Node resolve the same rule in JavaScript.-2. Check that `$PROJECT_ROOT/.understand-anything/knowledge-graph.json` exists.+2. Check that `$UA_DIR/knowledge-graph.json` exists.- If not: report "No existing knowledge graph found. Run `/understand` first to create one." and **STOP**.-3. Check that `$PROJECT_ROOT/.understand-anything/meta.json` exists and read `gitCommitHash`.+3. Check that `$UA_DIR/meta.json` exists and read `gitCommitHash`.- If not: report "No analysis metadata found. Run `/understand` to create a baseline." and **STOP**.4. Get current commit hash:@@ -34,16 +34,16 @@ Incrementally update the knowledge graph using deterministic structural fingerpr8. Create intermediate directory:```bash- mkdir -p "$PROJECT_ROOT/.understand-anything/intermediate"+ mkdir -p "$UA_DIR/intermediate"```9. **Apply `.understandignore` exclusions** (same semantics as `/understand` Step 2.5 in `agents/project-scanner.md`).Without this step, files in user-excluded paths (migrations, vendored code, tests) are counted as structural changes and can spuriously escalate the action to `FULL_UPDATE` even when the real change set is tiny.- 1. If neither `$PROJECT_ROOT/.understand-anything/.understandignore` nor `$PROJECT_ROOT/.understandignore` exists, the step 7 extension filter is sufficient — skip to Phase 1.+ 1. If neither `$UA_DIR/.understandignore` nor `$PROJECT_ROOT/.understandignore` exists, the step 7 extension filter is sufficient — skip to Phase 1.- 2. Write the step 7 file list to `$PROJECT_ROOT/.understand-anything/intermediate/changed-files-pre.json` as a JSON array of relative paths.+ 2. Write the step 7 file list to `$UA_DIR/intermediate/changed-files-pre.json` as a JSON array of relative paths.3. Resolve `$PLUGIN_ROOT`:- Use `$CLAUDE_PLUGIN_ROOT` if set (Claude Code's hook context sets this).@@ -51,13 +51,15 @@ Incrementally update the knowledge graph using deterministic structural fingerpr- Validate the chosen candidate by checking `$candidate/packages/core/dist/ignore-filter.js` exists.- If neither resolves: report "Cannot locate plugin install at `$CLAUDE_PLUGIN_ROOT` or `$HOME/.understand-anything-plugin`; auto-update aborted. Run `/understand` to re-baseline." and **STOP**. Do **not** silently skip — silent skip reproduces issue #153.- 4. Write `$PROJECT_ROOT/.understand-anything/intermediate/ignore-filter.mjs`:+ 4. Write `$UA_DIR/intermediate/ignore-filter.mjs`:```javascript- import { readFileSync, writeFileSync } from 'node:fs';+ import { readFileSync, writeFileSync, existsSync } from 'node:fs';import { pathToFileURL } from 'node:url';import path from 'node:path';const PROJECT_ROOT = process.cwd();+ // Data directory: legacy `.understand-anything/` when present, else new `.ua/`.+ const UA_DIR = existsSync(path.join(PROJECT_ROOT, '.understand-anything')) ? '.understand-anything' : '.ua';const PLUGIN_ROOT = process.argv[2];const inputPath = process.argv[3];@@ -72,7 +74,7 @@ Incrementally update the knowledge graph using deterministic structural fingerprconst removed = input.length - kept.length;writeFileSync(- path.join(PROJECT_ROOT, '.understand-anything/intermediate/changed-files.json'),+ path.join(PROJECT_ROOT, UA_DIR, 'intermediate/changed-files.json'),JSON.stringify({ kept, removed, total: input.length }, null, 2),);console.log(`.understandignore: kept ${kept.length}/${input.length} (removed ${removed})`);@@ -80,12 +82,12 @@ Incrementally update the knowledge graph using deterministic structural fingerpr5. Run it:```bash- node "$PROJECT_ROOT/.understand-anything/intermediate/ignore-filter.mjs" \+ node "$UA_DIR/intermediate/ignore-filter.mjs" \"$PLUGIN_ROOT" \- "$PROJECT_ROOT/.understand-anything/intermediate/changed-files-pre.json"+ "$UA_DIR/intermediate/changed-files-pre.json"```- 6. Read `$PROJECT_ROOT/.understand-anything/intermediate/changed-files.json`. Pass the `kept` array as the input file list for Phase 1's fingerprint-check script.+ 6. Read `$UA_DIR/intermediate/changed-files.json`. Pass the `kept` array as the input file list for Phase 1's fingerprint-check script.7. If `kept.length === 0`: update `meta.json` with the new commit hash, report "All changed source files are in ignored paths. Metadata updated." and **STOP**.@@ -95,11 +97,11 @@ Incrementally update the knowledge graph using deterministic structural fingerprThis phase runs a deterministic Node.js script that compares file structures against stored fingerprints. It costs **zero LLM tokens** — only the script execution cost.-1. Write and execute a Node.js script (`$PROJECT_ROOT/.understand-anything/intermediate/fingerprint-check.mjs`):+1. Write and execute a Node.js script (`$UA_DIR/intermediate/fingerprint-check.mjs`):```javascript// The script should:-// 1. Read fingerprints.json from .understand-anything/fingerprints.json+// 1. Read fingerprints.json from the data directory (.ua/fingerprints.json, or .understand-anything/fingerprints.json when that legacy directory is present — resolve UA_DIR the same way as the other scripts)// 2. For each changed source file:// a. Read the file content// b. Compute SHA-256 content hash@@ -118,7 +120,7 @@ This phase runs a deterministic Node.js script that compares file structures aga// - Some STRUCTURAL, ≤10 files, same directories → action: "PARTIAL_UPDATE"// - New/deleted directories or >10 structural files → action: "ARCHITECTURE_UPDATE"// - >30 structural files or >50% of graph → action: "FULL_UPDATE"-// 6. Write result to .understand-anything/intermediate/change-analysis.json+// 6. Write result to <UA_DIR>/intermediate/change-analysis.json (.ua/, or .understand-anything/ when that legacy directory is present)```The output JSON should have this shape:@@ -136,7 +138,7 @@ The output JSON should have this shape:}```-2. Read `.understand-anything/intermediate/change-analysis.json`.+2. Read `$UA_DIR/intermediate/change-analysis.json`.3. **Decision gate:**@@ -153,7 +155,7 @@ The output JSON should have this shape:Only re-analyze files with structural changes. This is the **only** phase that costs LLM tokens.-1. Read the existing knowledge graph from `$PROJECT_ROOT/.understand-anything/knowledge-graph.json`.+1. Read the existing knowledge graph from `$UA_DIR/knowledge-graph.json`.2. Batch the files from `filesToReanalyze` (from Phase 1). Use a single batch if ≤10 files, otherwise batch into groups of 5-10.@@ -174,7 +176,7 @@ Only re-analyze files with structural changes. This is the **only** phase that c> Project: `<projectName>`> Languages: `<languages>`> Batch index: `1`- > Write output to: `$PROJECT_ROOT/.understand-anything/intermediate/batch-1.json`+ > Write output to: `$UA_DIR/intermediate/batch-1.json`>> All project files (for import resolution):> `<file list from existing graph nodes>`@@ -228,9 +230,9 @@ Perform lightweight validation (no graph-reviewer agent):### 3d. Save-1. Write the final knowledge graph to `$PROJECT_ROOT/.understand-anything/knowledge-graph.json`.+1. Write the final knowledge graph to `$UA_DIR/knowledge-graph.json`.-2. Write updated metadata to `$PROJECT_ROOT/.understand-anything/meta.json`:+2. Write updated metadata to `$UA_DIR/meta.json`:```json{"lastAnalyzedAt": "<ISO 8601 timestamp>",@@ -251,7 +253,8 @@ Perform lightweight validation (no graph-reviewer agent):import { createHash } from 'node:crypto';import path from 'node:path';- const fpPath = path.join(PROJECT_ROOT, '.understand-anything', 'fingerprints.json');+ const UA_DIR = existsSync(path.join(PROJECT_ROOT, '.understand-anything')) ? '.understand-anything' : '.ua';+ const fpPath = path.join(PROJECT_ROOT, UA_DIR, 'fingerprints.json');const existedAndNonEmpty = existsSync(fpPath) && readFileSync(fpPath, 'utf-8').trim().length > 0;// 1. LOAD ALL existing entries (NEVER skip — preserves un-analyzed files)@@ -291,7 +294,7 @@ Perform lightweight validation (no graph-reviewer agent):4. Clean up intermediate files:```bash- INTERMEDIATE_DIR="$PROJECT_ROOT/.understand-anything/intermediate"+ INTERMEDIATE_DIR="$UA_DIR/intermediate"if [ -n "$PROJECT_ROOT" ] && [ -d "$INTERMEDIATE_DIR" ]; thenrm -rf "$INTERMEDIATE_DIR"fi@@ -303,7 +306,7 @@ Perform lightweight validation (no graph-reviewer agent):- Cosmetic-only changes: N files (skipped)- Nodes updated: N- Action taken: PARTIAL_UPDATE / ARCHITECTURE_UPDATE- - Path to output: `$PROJECT_ROOT/.understand-anything/knowledge-graph.json`+ - Path to output: `$UA_DIR/knowledge-graph.json`---