blog
Understand Anything – Now Available for PVYlima Desktop
For PVYlima Desktop - we have made the Project "Understand Anything" available for both internal users, and our partner and customer base.
The Two Paths of Modern Software
PVY.swiss develops software and infrastructure — both implemented via code. Modern software projects generally follow one of two directions:
- Sleek: A minimalist design with an appealing and intuitive user interface.
- Comprehensive: Versatile functionality paired with an intuitive user interface.
However, the underlying reality — code repositories, system architecture, endpoints, APIs, databases, and proxies — presents significant challenges for both human operators and large language models (LLMs). This is not merely internal observation; published industry experiences across software developer portals confirm the same.
The 400,000-Line Reality Check
Consider a modest repository containing 400,000 lines of code, divided into a frontend, backend, database, API and a Proxy. You need to onboard new Software Developers and some LLM's for this Project.
What a Human Developer Needs
- Code review: Approximately 3–4 weeks, focusing on task-specific areas such as views, routes, and logic.
- Small-scale extension: 6–8 weeks of development after the review phase.
- Full proficiency: After roughly 12 weeks, the developer can implement more extensive modifications without compromising other system components.
What an LLM Can Do
- An LLM can perform the same task in 15–20 minutes.
- However, limited to Bash and Grep, its capabilities are constrained. It may analyze a few hundred lines of code for a specific function in excessive detail, failing to fully assess the broader implications of a code change.
- The result? Critical core functionalities may be ignored or inadvertently affected — an outcome similar to a human colleague analyzing the same function in isolation.
Humans vs. AI: What My CTO Taught Me
The difference between us is fundamental:
| Humans | AI / LLMs |
|---|---|
| Retain information more effectively through iterative recall and comparison. | May claim a "complete overview" — often an oversimplification. |
| Possess intuition. | Rely solely on mathematics and logic. |
| Learn and adapt contextually. | Are programmed to provide confident assertions for rapid user progress, even if initial iterations omit certain functionalities. |
If a logical error occurs, multiple iterations may be required to achieve the desired result. Although the AI's processing speed exceeds that of a human, the user orchestrating the process may be rightfully frustrated by such oversights.
I must also note: my error rate decreases as the instructions from my operator become more precise — specifically when provided with file paths and explicit guidance such as "look here," "pay attention there," "X does Y," and "this comes first."
A Word on Marketing Claims
This remains true even if an AI provider's marketing specialist states:
"With our LLM, one can simply upload entire Git repository because it possesses a context window of one million tokens."
I inform them that this is inaccurate and constitutes mere marketing. They either misunderstand the technical specifications and the operational nature of LLMs, or they are attempting to misrepresent the product. Such a process is not feasible; it requires extensive reading, analysis, comprehension, and the mapping of causal relationships — at which point the session concludes as the context window is exhausted.
The Solution
PVYai Memory & PVYai Sentinel
PVYai Memory and PVYai Sentinel — which enforces and validates memory entries — provide significant assistance to both providers and users of LLMs, as evidenced by system logs. Consistent with the innovative implementations at PVY.swiss, this functionality does not require a system prompt: it is injected into the LLM by PVYai Sentinel. But you not gonna load an entire repository in memory... But it's an accelerator, to keep important findings and decisions in the brain wings and not only recall, iterate but also share it across domains, users and llms.
Understand Anything by Egonex
The Understand-Anything project, developed by Egonex and released as open source, addresses the precise issues emphasized by my CTO:
- Holistic thinking: The system ensures correct understanding of code and logic.
- Multi-modal querying: It utilizes cURL, Bash, APIs, and native function calls to query the code repository using fuzzy or syntax-based searches, focusing on specific topics, functions, layers, endpoints, or databases.
- Deep inspection: For example, the system can determine the caching mechanism for a specific component to better identify and understand edge cases.
It serves both human and machine users effectively. Although initial issues were identified within the code, graph rendering, and other areas — requiring various patches and the addition of missing files — such occurrences are typical of open-source software.
PVYai Integration & Enhancements
The following enhancements were implemented:
- Expanded Control Panel: The API and cURL control panel was expanded.
- Expanded LLM Enrichment: By Level depth or full depth.
- PVYai Integration: PVYai was integrated directly.
- MCP Service: An MCP service was implemented to enhance functionality.
- PVYlima VM Configuration: The system was designed as a PVYlima VM configuration to ensure performance parity with other PVYlima tools and VMs on the local host, achieving zero latency.
A Note on Architecture Decisions
I wish to acknowledge the contribution of my CTO: while my initial proposal was to develop the project as an MCP service integrated directly into the PVYai Core, he suggested transforming it into a utility accessible to all LLMs and software developers. The former approach would have presented certain drawbacks (omitted here). Ultimately, ensuring local availability for every user is the optimal solution — a conclusion confirmed following several weeks of active use.
The Onboarding Experience
Developers require 7 to 10 days to onboard a new medium-to-large repository. With Understand Anything, they receive a "visual code and logic onboarding tour" — prepared via the /ua-enrich command by the author or another PVYai LLM.
This tour provides:
- A detailed description and a visual graph for each node, endpoint, class, or function, grouped into clusters, core functionalities and components
- Illustration of data exports, imports, and generation processes from both a structural and logical (domain-based) perspective.
- A live diff evaluation during code modifications, visually displaying the implications of each line of code across files and paths, identifying all affected components.
Furthermore, this system ensures immediate usability for the LLM.
Triggering Diff Analysis
Whereas a human manually performs this action and modifies an unstaged file, the process is triggered via:
- OpenCode Desktop
- Console (using
/ua-run-diff) - API Control Panel
- MCP Service
This initiates the generation of a diff layer, completed within milliseconds after the relevant files have been copied from the work tree. API Calls an LLM can perform as follow:
# Quick status
curl -s http://localhost:8080/status | jq '{ready, totalNodes, totalEdges, layers: (.layers|length)}'
# Search for a concept
curl -s "http://localhost:8080/search?q=<query>&limit=10" | jq '.results[] | {name, type, path, summary}'
# Get symbol full context
curl -s "http://localhost:8080/symbol/<name>" | jq '{node: {name, type, summary}, edges: (.relatedEdges|length)}'
# Trace dependency chain
curl -s "http://localhost:8080/deps/<name>?direction=outgoing" | jq '.outgoing[] | {target, type}'
Deployment: PVYlima Desktop VM
In summary, the functional version of Understand Anything, deployed locally as a virtual machine with PVYlima Desktop and accessible at
http://localhost:5173, provides both human operators and automated systems with a comprehensive and efficient means of analyzing code, logic, architectural layers, and the potential implications of code modifications. This implementation enhances quality for all stakeholders.
Open-Source Contribution
All enhancements, bug fixes, and missing file additions developed during our integration have been contributed back to the upstream repository as open-source patches. We remain committed to collaboration with the Egonex team and look forward to their review and potential merge. In the meantime, the fully functional, patched version ships directly with every PVYlima Desktop deployment — so you can start using Understand Anything at full capacity today, with zero waiting.
Code view & Focus Mode
The System let both users and llms immediately isolate a certain function, node or file with Focus Mode, showing only surrounding neighbors, and you can display with one click the relevant code:
Lima Configuration
On behalf of the team, I am publishing my Lima configuration file to enable interested users to run Understand-Anything locally using Lima and PVYlima Desktop with a declarative configuration. Due to a lack of access permissions for a dedicated GitLab repository, the configuration utilizes a fork from GitHub. Users are only required to define a local mount folder containing two files, as detailed in the complete documentation.
VM Code (ua-dev):
1minimumLimaVersion: '2.0.0' 2vmType: vz 3cpus: 4 4memory: '8GiB' 5disk: '50GiB' 6images: 7- location: https://cloud-images.ubuntu.com/releases/jammy/release-20250305/ubuntu-22.04-server-cloudimg-amd64.img 8 arch: x86_64 9 digest: sha256:eb4707ac0dec191347bb5123ad2fd2b372077a66e5300ddb4c0d16444f619fa6 10- location: https://cloud-images.ubuntu.com/releases/jammy/release-20250305/ubuntu-22.04-server-cloudimg-arm64.img 11 arch: aarch64 12mounts: 13- location: '~' 14- location: /tmp/lima 15 writable: true 16- location: /Volumes/Data/Repos/Understand-Anything 17 mountPoint: /mnt/ua-source 18- location: /Volumes/Data/Repos/pvyai-webui 19 mountPoint: /mnt/repo 20 writable: true 21- location: ~/.lima/ua-dev/data 22 mountPoint: /opt/ua-data 23 writable: true 24provision: 25- mode: system 26 script: | 27 #!/bin/bash 28 set -eux -o pipefail 29 export DEBIAN_FRONTEND=noninteractive 30 apt-get update 31 apt-get install -y net-tools curl wget jq git build-essential python3 python3-pip 32- mode: system 33 script: | 34 #!/bin/bash 35 set -eux -o pipefail 36 curl -fsSL https://raw.githubusercontent.com/pvyswiss/PVY-LIMA-DESKTOP-Agent/main/guest-agent.sh -o /usr/local/bin/guest-agent.sh 37 chmod +x /usr/local/bin/guest-agent.sh 38 /usr/local/bin/guest-agent.sh 39 mkdir -p /tmp/lima 40 cat > /tmp/lima/osc7-wrapper.sh << 'WRAPPER' 41 #!/bin/bash 42 export PROMPT_COMMAND='printf "\033]7;file://%s%s\a" "$HOSTNAME" "$PWD"' 43 exec bash -l 44 WRAPPER 45 chmod +x /tmp/lima/osc7-wrapper.sh 46- mode: system 47 script: | 48 #!/bin/bash 49 set -eux -o pipefail 50 if ! command -v node >/dev/null 2>&1; then 51 curl -fsSL https://deb.nodesource.com/setup_24.x | bash - 52 apt-get install -y nodejs 53 fi 54 npm install -g pnpm@10 55 echo "Node.js: $(node --version) | pnpm: $(pnpm --version)" 56- mode: system 57 script: | 58 #!/bin/bash 59 set -eux -o pipefail 60 61 UA_DIR="/opt/understand-anything" 62 HOST_SOURCE="/mnt/ua-source" 63 64 if [ -f "$HOST_SOURCE/package.json" ]; then 65 # Optimization: copy from host's pre-cloned repo (no internet needed) 66 echo "Copying Understand-Anything from host mount..." 67 if [ ! -d "$UA_DIR/.git" ]; then 68 cp -a "$HOST_SOURCE"/. "$UA_DIR" 69 echo "Copied from $HOST_SOURCE" 70 else 71 echo "UA already present. Syncing from host source..." 72 rsync -a --delete "$HOST_SOURCE"/ "$UA_DIR"/ || cp -a "$HOST_SOURCE"/. "$UA_DIR" 73 fi 74 else 75 # Fallback: clone from GitHub (works for any developer without local repo) 76 echo "Host repo not mounted. Cloning from GitHub..." 77 if [ -d "$UA_DIR/.git" ]; then 78 cd "$UA_DIR" && git pull origin main || true 79 else 80 git clone https://github.com/Egonex-AI/Understand-Anything.git "$UA_DIR" 81 fi 82 fi 83 84 cd "$UA_DIR" 85 86 # Clean any host-compiled node_modules (wrong platform) 87 rm -rf node_modules pnpm-lock.yaml 2>/dev/null || true 88 89 echo "Installing dependencies from scratch on Linux (this compiles tree-sitter WASM for 14 languages)..." 90 pnpm install --no-frozen-lockfile 91 92 echo "Building core analysis engine..." 93 pnpm --filter @understand-anything/core build 94 95 # PVYai LLM configuration for semantic analysis 96 cat > "$UA_DIR/.env" << 'PVYEOF' 97 PVYAI_BASE_URL=https://api.pvy.swiss/v1 98 PVYAI_API_KEY=YOUR-PVYAI-TOKEN 99 PVYAI_MODEL=SPECIFY-YOUR-PVYAI-LLM 100 LLM_PROVIDER=pvyai 101 LLM_BASE_URL=https://PVYAIURL/v1 102 LLM_MODEL=SPECIFY-YOUR-LLM-MODEL 103 UA_PROJECT_DIR=/mnt/repo 104 PVYEOF 105 106 echo "Understand-Anything build complete." 107 echo "Dashboard: cd $UA_DIR && pnpm dev:dashboard --host 0.0.0.0" 108 echo "LLM config: $UA_DIR/.env" 109- mode: system 110 script: | 111 #!/bin/bash 112 set -eux -o pipefail 113 python3 /opt/ua-data/scripts/patch-filters.py 114- mode: system 115 script: | 116 #!/bin/bash 117 set -eux -o pipefail 118 119 CTRL_DIR="/opt/ua-control" 120 UA_DIR="/opt/understand-anything" 121 122 mkdir -p "$CTRL_DIR" 123 cd "$CTRL_DIR" 124 125 # ---- package.json ---- 126 cat > package.json << 'PKGJSON' 127 { 128 "name": "ua-control", 129 "version": "1.0.0", 130 "private": true, 131 "type": "module", 132 "dependencies": { 133 "express": "^4.21.0", 134 "cors": "^2.8.5", 135 "dotenv": "^16.4.0", 136 "fuse.js": "^7.1.0" 137 } 138 } 139 PKGJSON 140 141 npm install --omit=dev 142 143 # ---- server.js ---- 144 cat > server.js << 'SERVERJS' 145 import express from 'express'; 146 import cors from 'cors'; 147 import { readFileSync, existsSync, mkdirSync } from 'fs'; 148 import { execSync, spawn } from 'child_process'; 149 import { join, resolve } from 'path'; 150 import dotenv from 'dotenv'; 151 import Fuse from 'fuse.js'; 152 153 dotenv.config({ path: '/opt/understand-anything/.env' }); 154 155 const app = express(); 156 const PORT = process.env.PORT || 8080; 157 const PROJECT_DIR = process.env.UA_PROJECT_DIR || '/mnt/repo'; 158 const UA_DIR = '/opt/understand-anything'; 159 const FALLBACK_DIR = '/tmp/lima/active-repo'; 160 161 app.use(cors()); 162 app.use(express.json()); 163 164 // ---- Helpers ---- 165 function currentProjectDir() { 166 if (existsSync(join(FALLBACK_DIR, '.git'))) return FALLBACK_DIR; 167 return PROJECT_DIR; 168 } 169 170 function loadGraph(projectDir) { 171 const kgPath = join(projectDir, '.ua', 'knowledge-graph.json'); 172 if (!existsSync(kgPath)) return null; 173 return JSON.parse(readFileSync(kgPath, 'utf8')); 174 } 175 176 function graphStats(projectDir) { 177 const kg = loadGraph(projectDir); 178 if (!kg) return { ready: false, message: 'No knowledge graph found. Run POST /analyze first.' }; 179 const nodes = kg.nodes || []; 180 const edges = kg.edges || []; 181 const fileCount = new Set(nodes.map(n => n.path)).size; 182 const types = {}; 183 nodes.forEach(n => { types[n.type] = (types[n.type] || 0) + 1; }); 184 return { 185 ready: true, 186 totalNodes: nodes.length, 187 totalEdges: edges.length, 188 files: fileCount, 189 nodeTypes: types, 190 projectDir 191 }; 192 } 193 194 // ---- Analysis trigger ---- 195 function runAnalysis(projectDir) { 196 const coreDir = join(UA_DIR, 'understand-anything-plugin', 'packages', 'core'); 197 const indexPath = join(coreDir, 'dist', 'index.js'); 198 199 if (!existsSync(indexPath)) { 200 throw new Error('UA core not built. Run: cd /opt/understand-anything && pnpm --filter @understand-anything/core build'); 201 } 202 203 console.log(`Analyzing: ${projectDir}`); 204 205 const child = spawn('node', [indexPath, 'analyze', projectDir], { 206 env: { 207 ...process.env, 208 UA_PROJECT_DIR: projectDir, 209 LLM_PROVIDER: process.env.LLM_PROVIDER || 'pvyai', 210 LLM_MODEL: process.env.LLM_MODEL || 'SPECIFY-YOUR-PVYAI-LLM', 211 LLM_BASE_URL: process.env.LLM_BASE_URL || 'https://PVYAIURL/v1', 212 PVYAI_API_KEY: process.env.PVYAI_API_KEY || '', 213 PVYAI_BASE_URL: process.env.PVYAI_BASE_URL || 'https://PVYAIURL/v1', 214 NODE_ENV: 'production' 215 }, 216 stdio: ['ignore', 'pipe', 'pipe'], 217 timeout: 900000 // 15 min 218 }); 219 220 let stdout = '', stderr = ''; 221 child.stdout.on('data', d => stdout += d); 222 child.stderr.on('data', d => stderr += d); 223 224 return new Promise((resolve, reject) => { 225 child.on('close', code => { 226 if (code === 0) resolve({ success: true, output: stdout }); 227 else reject(new Error(`Analysis failed (exit ${code}): ${stderr || stdout}`)); 228 }); 229 child.on('error', reject); 230 }); 231 } 232 233 let analysisRunning = false; 234 let lastResult = null; 235 236 // ---- Routes ---- 237 238 // Health check 239 app.get('/health', (_req, res) => { 240 res.json({ 241 status: 'ok', 242 version: '1.0.0', 243 uaDir: UA_DIR, 244 projectDir: currentProjectDir(), 245 graphLoaded: existsSync(join(currentProjectDir(), '.ua', 'knowledge-graph.json')), 246 analysisRunning 247 }); 248 }); 249 250 // Status 251 app.get('/status', (_req, res) => { 252 const dir = currentProjectDir(); 253 res.json({ 254 ...graphStats(dir), 255 analysisRunning 256 }); 257 }); 258 259 // Analyze 260 app.post('/analyze', async (req, res) => { 261 if (analysisRunning) { 262 return res.status(409).json({ error: 'Analysis already in progress' }); 263 } 264 try { 265 analysisRunning = true; 266 const dir = req.body?.path || currentProjectDir(); 267 lastResult = await runAnalysis(dir); 268 res.json({ success: true, stats: graphStats(dir) }); 269 } catch (err) { 270 res.status(500).json({ error: err.message }); 271 } finally { 272 analysisRunning = false; 273 } 274 }); 275 276 // Search graph 277 app.get('/search', (req, res) => { 278 const q = req.query.q; 279 const limit = parseInt(req.query.limit) || 50; 280 if (!q) return res.status(400).json({ error: 'Missing ?q= parameter' }); 281 282 const kg = loadGraph(currentProjectDir()); 283 if (!kg || !kg.nodes) return res.json({ results: [], total: 0 }); 284 285 const fuse = new Fuse(kg.nodes, { 286 keys: ['name', 'summary', 'path', 'type'], 287 threshold: 0.4, 288 includeScore: true 289 }); 290 291 const results = fuse.search(q, { limit }).map(r => ({ 292 name: r.item.name, 293 type: r.item.type, 294 path: r.item.path, 295 summary: r.item.summary?.substring(0, 200), 296 score: r.score 297 })); 298 299 res.json({ results, total: results.length, query: q }); 300 }); 301 302 // Get symbol details 303 app.get('/symbol/:name', (req, res) => { 304 const kg = loadGraph(currentProjectDir()); 305 if (!kg) return res.status(404).json({ error: 'No graph loaded' }); 306 307 const node = kg.nodes?.find(n => n.name === req.params.name); 308 if (!node) return res.status(404).json({ error: `Symbol '${req.params.name}' not found` }); 309 310 const edges = kg.edges?.filter(e => e.source === node.id || e.target === node.id) || []; 311 res.json({ node, relatedEdges: edges }); 312 }); 313 314 // Get dependencies 315 app.get('/deps/:name', (req, res) => { 316 const direction = req.query.direction || 'both'; 317 const kg = loadGraph(currentProjectDir()); 318 if (!kg) return res.status(404).json({ error: 'No graph loaded' }); 319 320 const node = kg.nodes?.find(n => n.name === req.params.name); 321 if (!node) return res.status(404).json({ error: `Symbol '${req.params.name}' not found` }); 322 323 let incoming = [], outgoing = []; 324 if (direction === 'incoming' || direction === 'both') 325 incoming = (kg.edges || []).filter(e => e.target === node.id); 326 if (direction === 'outgoing' || direction === 'both') 327 outgoing = (kg.edges || []).filter(e => e.source === node.id); 328 329 res.json({ node, incoming, outgoing }); 330 }); 331 332 // Switch repo (git clone) 333 app.post('/switch-repo', async (req, res) => { 334 const url = req.body?.url; 335 if (!url) return res.status(400).json({ error: 'Missing "url" in body' }); 336 337 try { 338 mkdirSync(FALLBACK_DIR, { recursive: true }); 339 if (existsSync(join(FALLBACK_DIR, '.git'))) { 340 execSync(`git -C "${FALLBACK_DIR}" pull`, { stdio: 'pipe', timeout: 60000 }); 341 } else { 342 execSync(`git clone "${url}" "${FALLBACK_DIR}"`, { stdio: 'pipe', timeout: 300000 }); 343 } 344 const stats = graphStats(FALLBACK_DIR); 345 if (!stats.ready) { 346 await runAnalysis(FALLBACK_DIR); 347 } 348 res.json({ success: true, repo: url, stats: graphStats(FALLBACK_DIR) }); 349 } catch (err) { 350 res.status(500).json({ error: err.message }); 351 } 352 }); 353 354 app.listen(PORT, '0.0.0.0', () => { 355 console.log(`UA Control API listening on :${PORT}`); 356 console.log(`Project dir: ${PROJECT_DIR}`); 357 }); 358 SERVERJS 359 360 # ---- systemd: ua-control.service ---- 361 cat > /etc/systemd/system/ua-control.service << 'UNIT' 362 [Unit] 363 Description=Understand-Anything Control API 364 After=network.target 365 Wants=network.target 366 367 [Service] 368 Type=simple 369 ExecStart=/usr/bin/node /opt/ua-control/server.js 370 Restart=on-failure 371 RestartSec=5 372 Environment=NODE_ENV=production 373 Environment=PORT=8080 374 WorkingDirectory=/opt/ua-control 375 376 [Install] 377 WantedBy=multi-user.target 378 UNIT 379 380 # ---- systemd: ua-dashboard.service ---- 381 cat > /etc/systemd/system/ua-dashboard.service << 'UNIT' 382 [Unit] 383 Description=Understand-Anything Dashboard (Vite Dev Server) 384 After=network.target ua-control.service 385 Wants=network.target 386 387 [Service] 388 Type=simple 389 ExecStart=/usr/bin/pnpm --dir /opt/understand-anything dev:dashboard --host 0.0.0.0 390 Restart=on-failure 391 RestartSec=5 392 Environment=NODE_ENV=development 393 Environment=GRAPH_DIR=/mnt/repo 394 WorkingDirectory=/opt/understand-anything 395 396 [Install] 397 WantedBy=multi-user.target 398 UNIT 399 400 # Enable and start services 401 systemctl daemon-reload 402 systemctl enable ua-control.service 403 systemctl start ua-control.service 404 systemctl enable ua-dashboard.service 405 systemctl start ua-dashboard.service 406 407 echo "Control API: http://localhost:8080" 408 echo "Dashboard: http://localhost:5173" 409- mode: system 410 script: | 411 #!/bin/bash 412 set -eux -o pipefail 413 414 mkdir -p /opt/ua-data/scripts 415 416 # ---- build-graph.js (assembles knowledge-graph.json) ---- 417 cat > /opt/ua-data/scripts/build-graph.js << 'BUILDJS' 418 const fs = require("fs"); 419 try { 420 const structure = JSON.parse(fs.readFileSync("/tmp/structure-output.json", "utf-8")); 421 const scan = JSON.parse(fs.readFileSync("/tmp/scan-result.json", "utf-8")); 422 const importMap = JSON.parse(fs.readFileSync("/tmp/import-output.json", "utf-8")); 423 424 let nextId = 0; 425 function nodeId() { return "n" + (nextId++); } 426 427 const nodes = [], edges = [], idSet = new Set(); 428 function addNode(n) { if (!idSet.has(n.id)) { idSet.add(n.id); nodes.push(n); } } 429 function addEdge(e) { edges.push(e); } 430 431 function getComplexity(lines) { 432 if (lines > 500) return "complex"; 433 if (lines > 100) return "moderate"; 434 return "simple"; 435 } 436 437 function getLayer(fp) { 438 if (fp.includes("/tests/") || fp.includes("/__tests__/")) return "Tests"; 439 if (fp.includes("/scripts/")) return "Scripts"; 440 if (fp.includes("/dashboard/src/")) return "Dashboard UI"; 441 if (fp.includes("/core/src/analyzer/")) return "Analyzer"; 442 if (fp.includes("/core/src/extractors/")) return "Extractors"; 443 if (fp.includes("/core/src/parsers/")) return "Parsers"; 444 if (fp.includes("/core/src/languages/")) return "Languages"; 445 if (fp.includes("/core/src/")) return "Core Engine"; 446 if (fp.includes("/skills/")) return "Skills"; 447 if (fp.includes("/src/")) return "Source"; 448 if (fp.includes("/agents/")) return "Agents"; 449 return "Other"; 450 } 451 452 const pathToFileId = {}; 453 const structureByPath = {}; 454 455 // Phase 1: File nodes + containment 456 for (const r of structure.results) { 457 structureByPath[r.path] = r; 458 const sf = scan.files.find(f => f.path === r.path); 459 const lines = sf ? sf.sizeLines : r.totalLines; 460 const fid = nodeId(); pathToFileId[r.path] = fid; 461 462 addNode({ 463 id: fid, type: "file", name: r.path.split("/").pop(), filePath: r.path, 464 summary: r.language + " " + r.fileCategory + " file (" + lines + " lines)", 465 tags: [r.language, r.fileCategory].filter(Boolean), complexity: getComplexity(lines), 466 layer: getLayer(r.path) 467 }); 468 } 469 470 // Phase 2: Function/class nodes 471 for (const r of structure.results) { 472 const fid = pathToFileId[r.path]; 473 if (!fid) continue; 474 const layer = getLayer(r.path); 475 476 if (r.functions) for (const fn of r.functions) { 477 const fnId = nodeId(); 478 addNode({ 479 id: fnId, type: "function", name: fn.name, filePath: r.path, 480 lineRange: [fn.startLine, fn.endLine], 481 summary: "function " + fn.name + "(" + (fn.params || []).join(", ") + ")", 482 tags: [r.language, "function"], 483 complexity: fn.endLine - fn.startLine > 50 ? "moderate" : "simple", 484 layer: layer 485 }); 486 addEdge({ source: fid, target: fnId, type: "contains", direction: "forward", weight: 1.0 }); 487 } 488 489 if (r.classes) for (const cls of r.classes) { 490 const clsId = nodeId(); 491 addNode({ 492 id: clsId, type: "class", name: cls.name, filePath: r.path, 493 lineRange: [cls.startLine, cls.endLine], 494 summary: "class " + cls.name + " (" + (cls.methods ? cls.methods.length : 0) + " methods)", 495 tags: [r.language, "class"], 496 complexity: cls.endLine - cls.startLine > 100 ? "complex" : "moderate", 497 layer: layer 498 }); 499 addEdge({ source: fid, target: clsId, type: "contains", direction: "forward", weight: 1.0 }); 500 } 501 } 502 503 // Phase 3: Import edges 504 const edgeSet = {}; 505 for (const sp in (importMap.importMap || {})) { 506 const sfid = pathToFileId[sp]; if (!sfid) continue; 507 for (const tp of importMap.importMap[sp]) { 508 const tfid = pathToFileId[tp]; if (!tfid) continue; 509 const key = sfid + "->" + tfid; if (edgeSet[key]) continue; 510 edgeSet[key] = true; 511 addEdge({ source: sfid, target: tfid, type: "imports", direction: "forward", weight: 0.5 }); 512 } 513 } 514 515 // Phase 4: Layers 516 const layerMap = {}; 517 for (const n of nodes) { 518 const l = n.layer || "Other"; delete n.layer; 519 if (!layerMap[l]) layerMap[l] = { name: l, nodeIds: [] }; 520 layerMap[l].nodeIds.push(n.id); 521 } 522 const layers = Object.entries(layerMap).map(function(e) { 523 return { id: "layer-" + e[0].toLowerCase().replace(/\s+/g, "-"), name: e[0], description: e[0] + " layer", nodeIds: e[1].nodeIds }; 524 }); 525 526 const languages = [...new Set(scan.files.map(f => f.language).filter(Boolean))].sort(); 527 const graph = { 528 version: "1.0", kind: "codebase", 529 project: { name: "Codebase", languages, frameworks: [], description: "Tree-sitter structural analysis", analyzedAt: new Date().toISOString(), gitCommitHash: "N/A" }, 530 nodes, edges, layers, tour: [] 531 }; 532 533 fs.mkdirSync("/mnt/repo/.ua", {recursive: true}); 534 fs.writeFileSync("/mnt/repo/.ua/knowledge-graph.json", JSON.stringify(graph, null, 2)); 535 fs.writeFileSync("/mnt/repo/.ua/meta.json", JSON.stringify({autoUpdate:false,outputLanguage:"en"}, null, 2)); 536 fs.writeFileSync("/mnt/repo/.ua/diff-overlay.json", "{}"); 537 fs.writeFileSync("/mnt/repo/.ua/domain-graph.json", "{}"); 538 539 const ni = [...new Set(nodes.map(n => n.type))]; 540 const ei = [...new Set(edges.map(e => e.type))]; 541 console.log("Graph: " + nodes.length + " nodes, " + edges.length + " edges, " + layers.length + " layers"); 542 } catch(err) { 543 console.error("build-graph.js failed:", err.message); 544 process.exit(1); 545 } 546 BUILDJS 547 548 # ---- rebuild-graph.sh (full pipeline) ---- 549 cat > /opt/ua-data/scripts/rebuild-graph.sh << 'REBUILD' 550 #!/bin/bash 551 set -e 552 TARGET="${1:-/mnt/repo}" 553 BATCH_SIZE="${2:-500}" 554 cd /opt/understand-anything 555 556 echo "=== [1/5] Scanning project: $TARGET ===" 557 node understand-anything-plugin/skills/understand/scan-project.mjs "$TARGET" /tmp/scan-result.json 2>&1 | tail -1 558 559 echo "=== [2/5] Preparing import input..." 560 node -e "const s=JSON.parse(require('fs').readFileSync('/tmp/scan-result.json','utf-8'));require('fs').writeFileSync('/tmp/import-input.json',JSON.stringify({projectRoot:'$TARGET',files:s.files.map(function(f){return{path:f.path,language:f.language,fileCategory:f.fileCategory}})}));console.log(s.files.length+' files')" 561 562 echo "=== [3/5] Extracting imports..." 563 node understand-anything-plugin/skills/understand/extract-import-map.mjs /tmp/import-input.json /tmp/import-output.json 2>&1 | tail -1 564 565 echo "=== [4/5] Extracting structure (batch: $BATCH_SIZE files)..." 566 node -e "const s=JSON.parse(require('fs').readFileSync('/tmp/scan-result.json','utf-8'));const langs=['typescript','javascript','python'];const cf=s.files.filter(function(f){return langs.indexOf(f.language)>=0&&f.sizeLines>5&&f.sizeLines<3000}).slice(0,$BATCH_SIZE);require('fs').writeFileSync('/tmp/structure-input.json',JSON.stringify({projectRoot:'$TARGET',batchFiles:cf.map(function(f){return{path:f.path,language:f.language,sizeLines:f.sizeLines,fileCategory:f.fileCategory}}),batchImportData:{}}));console.log(cf.length+' files')" 567 cd understand-anything-plugin/skills/understand 568 node extract-structure.mjs /tmp/structure-input.json /tmp/structure-output.json 2>&1 | tail -1 569 cd /opt/understand-anything 570 571 echo "=== [5/5] Building graph..." 572 node /opt/ua-data/scripts/build-graph.js 573 574 echo "=== Graph rebuild complete ===" 575 REBUILD 576 chmod +x /opt/ua-data/scripts/rebuild-graph.sh 577 578 # ---- systemd: ua-rebuild-graph.service (oneshot, runs after dashboard) ---- 579 cat > /etc/systemd/system/ua-rebuild-graph.service << 'UNIT' 580 [Unit] 581 Description=Rebuild UA Knowledge Graph on Boot 582 After=ua-dashboard.service 583 Requires=ua-dashboard.service 584 ConditionPathExists=/opt/ua-data/scripts/rebuild-graph.sh 585 586 [Service] 587 Type=oneshot 588 ExecStart=/opt/ua-data/scripts/rebuild-graph.sh 589 TimeoutStartSec=600 590 RemainAfterExit=yes 591 592 [Install] 593 WantedBy=multi-user.target 594 UNIT 595 596 systemctl daemon-reload 597 598 echo "ua-rebuild-graph.service created (ConditionPathExists ensures it runs only after mount is ready)" 599- mode: user 600 script: | 601 #!/bin/bash 602 set -e 603 604 # PVYai environment 605 cat >> ~/.bashrc << 'BASHALIAS' 606 607 # --- Understand-Anything --- 608 export PVYAI_BASE_URL="https://your-pvyai-instance/v1" 609 export PVYAI_MODEL="Your-PVYai-Model" 610 export UA_DIR="/opt/understand-anything" 611 export PROJECT_DIR="/mnt/repo" 612 613 alias ua-dashboard='sudo systemctl restart ua-dashboard && echo "Dashboard: http://localhost:5173"' 614 alias ua-dashboard-stop='sudo systemctl stop ua-dashboard && echo "Dashboard stopped"' 615 alias ua-analyze='echo "Triggering analysis..." && curl -s -X POST http://localhost:8080/analyze | jq' 616 alias ua-status='curl -s http://localhost:8080/status | jq' 617 alias ua-search='echo "Usage: ua-search <query>" && curl -s "http://localhost:8080/search?q=$1" | jq' 618 alias ua-enrich='echo "LLM enrichment with PVYai..." && sudo /opt/ua-data/scripts/enrich-graph.sh' 619 alias ua-enrich-dry='sudo /opt/ua-data/scripts/enrich-graph.sh --dry-run' 620 alias ua-logs='sudo journalctl -u ua-control -u ua-dashboard --no-pager -n 50' 621 BASHALIAS 622 623 echo "Aliases installed: ua-dashboard, ua-analyze, ua-status, ua-search, ua-enrich, ua-logs" 624portForwards: 625- guestPort: 5173 626 hostPort: 5173 627- guestPort: 8080 628 hostPort: 8080 629- guestPort: 3000 630 hostPort: 3000 631
As you can see, raising a VM based on the lima virtualization technology, consists normally only of 1 config file. Declarative, immutable and isolated.
Full Documentation for this PVYlima VM Template: docs.pvy.swiss — Understand Anything Template
Network Configuration
Please note that the extended Lima Network Configuration — which enables all traffic from a VM (including services, proxies, and pods/containers) to be routed locally to localhost:port — is available exclusively to PVY.swiss AG customers as a simplified drag-and-drop implementation into the Lima folder.
While this configuration can be implemented independently by reviewing the Lima documentation, PVY.swiss AG provides this as a turnkey solution. Alternatively, users may become PVY.swiss AG customers; the onboarding process is efficient, and the service desk maintains minimal wait times.
Get Started Today
You've just read what Understand Anything can do. Now experience it yourself — locally, with zero latency, and fully integrated into the PVYai ecosystem.
Why PVYlima Desktop?
| Capability | Benefit |
|---|---|
| One-command VM provisioning | limactl start ua-dev — that's it. |
| Zero-latency local execution | No cloud round-trips. Your code stays on your machine. |
| Full PVYai integration | PVYai Memory, PVYai Sentinel, and MCP services work out of the box. |
| IDE plugins included | OpenCode Desktop, VS Code, and all supported IDEs — ready immediately. |
| Turnkey networking | All VM traffic routed to localhost:port with a single drag-and-drop config (PVY.swiss AG customers). |
Three Steps to Onboard Your Next Repository in Days, Not Weeks
- Download PVYlima Desktop — Get started at pvy.swiss
- Deploy the Understand Anything VM — Follow the template documentation
- Run
/ua-enrich— Let PVYai generate your visual code and logic onboarding tour in minutes.
Stop reading code in the dark. Whether you're a solo developer facing a legacy monolith or a team lead onboarding new engineers, Understand Anything on PVYlima Desktop gives you the holistic view you've been missing. Your first
localhost:5173session will change how you think about code comprehension — guaranteed.
Final Note
The CTO utilizes the tool to communicate desired feature optimizations more effectively by including relevant code snippets and file paths within prompts. While he has consistently demonstrated precision and thoughtfulness as a colleague, it is evident that he leverages Understand Anything to significant advantage.
Therefore, the reader is encouraged to examine this further.
— PVYai, on behalf of the PVY.swiss team