You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -243,6 +243,33 @@ Combine vector similarity with keyword matching.
243
243
244
244
**Affected files:**`src/embedder.js`, `src/db.js`
245
245
246
+
### 3.4 — Build-time Semantic Metadata
247
+
248
+
Enrich nodes with LLM-generated metadata beyond descriptions. Computed incrementally at build time (only for changed nodes), stored as columns on the `nodes` table.
- Cascade invalidation: when a node changes, mark dependents for re-enrichment
258
+
259
+
**Depends on:** 3.1 (LLM provider abstraction)
260
+
261
+
### 3.5 — Module Summaries
262
+
263
+
Aggregate function descriptions + dependency direction into file-level narratives.
264
+
265
+
-`module_summaries` table — one entry per file, re-rolled when any contained node changes
266
+
- MCP tool: `explain_module <file>` — returns module purpose, key exports, role in the system
267
+
-`naming_conventions` metadata per module — detected patterns (camelCase, snake_case, verb-first), flag outliers
268
+
269
+
**Depends on:** 3.1 (function-level descriptions must exist first)
270
+
271
+
> **Full spec:** See [llm-integration.md](./llm-integration.md) for detailed architecture, infrastructure table, and prompt design.
272
+
246
273
---
247
274
248
275
## Phase 4 — Natural Language Queries
@@ -297,6 +324,32 @@ Enables AI coding agents (Claude Code, Cursor, etc.) to ask codegraph questions
297
324
298
325
**Affected files:**`src/mcp.js`
299
326
327
+
### 4.4 — LLM-Narrated Graph Queries
328
+
329
+
Graph traversal + LLM narration for questions that require both structural data and natural-language explanation. Each query walks the graph first, then sends the structural result to the LLM for narration.
330
+
331
+
| Query | Graph operation | LLM adds |
332
+
|-------|----------------|----------|
333
+
|`trace_flow <entry>`| BFS from entry point to leaves | Sequential narrative: "1. handler validates → 2. calls createOrder → 3. writes DB" |
334
+
|`trace_upstream <name>`| Recursive caller walk | Ranked suspects: "most likely cause is X because it modifies the same state" |
335
+
|`effect_analysis <name>`| Full callee tree walk, aggregate `side_effects`| "Calling X will: write to DB (via Y), send email (via Z)" |
336
+
|`dependency_path <A> <B>`| Shortest path(s) between two symbols | Narrates each hop: "A imports X from B because A needs to validate tokens" |
337
+
338
+
Pre-computed `flow_narratives` table caches results for key entry points at build time, invalidated when any node in the chain changes.
339
+
340
+
**Depends on:** 3.4 (`side_effects` metadata), 3.1 (descriptions for narration context)
341
+
342
+
### 4.5 — Onboarding & Navigation Tools
343
+
344
+
Help new contributors and AI agents orient in an unfamiliar codebase.
LLM-generated docstrings aware of callers, callees, and types. Diff-aware: only regenerate for functions whose code or dependencies changed. Stores in `docstrings` column on nodes table — does not modify source files unless explicitly requested.
> **Full spec:** See [llm-integration.md](./llm-integration.md) for detailed architecture, infrastructure tables, and prompt design for all LLM-powered features.
565
+
455
566
---
456
567
457
568
## Verification Strategy
@@ -462,11 +573,11 @@ Each phase includes targeted verification:
462
573
|-------|-------------|
463
574
|**1**| Benchmark native vs WASM parsing on a large repo, verify identical output from both engines |
464
575
|**2**|`npm test`, manual MCP client test for all tools, config loading tests |
465
-
|**3**| Compare `codegraph search` quality before/after descriptions on a real repo|
466
-
|**4**|`codegraph ask "How does import resolution work?"` against codegraph itself |
576
+
|**3**| Compare `codegraph search` quality before/after descriptions; verify `side_effects` and `risk_score` populated for LLM-enriched builds|
577
+
|**4**|`codegraph ask "How does import resolution work?"` against codegraph itself; verify `trace_flow` and `get_started` produce coherent narration|
467
578
|**5**| Parse sample files for each new language, verify definitions/calls/imports |
468
-
|**6**| Test PR in a fork, verify GitHub Action comment is posted |
469
-
|**7**|`codegraph viz` loads, nodes are interactive, search works|
579
+
|**6**| Test PR in a fork, verify GitHub Action comment with Mermaid graph and risk labels is posted |
0 commit comments