feat(live-context): index intent — docstrings, doc files, entry points, registries, dynamic imports#1
Merged
Merged
Conversation
…s, registries, dynamic imports
Make the code graph more useful in large codebases by capturing design
intent alongside structure. The graph knew *what* calls *what*; now it
captures a little of *why*.
- Docstrings: capture a one-line JSDoc / Python docstring / leading-comment
summary per symbol and module (new languages/docstring.ts), stored in a new
nodes.doc column, FTS-indexed (phrase queries match prose, not just names)
and rendered as a summary line beside the code.
- Doc files: index .md/.mdx/.markdown/.rst/.adoc as searchable nodes
(title + headings + intro, new languages/doc.ts); attach the nearest
README/AGENTS.md/CONTEXT.md to each rendered slice. Doc prose is excluded
from the cross-reference scan (a mention is not a reference).
- Dynamic imports: import("...") / require("...") now become IMPORTS edges
instead of being dropped as unresolved calls.
- Entry points: detect package.json bin/main/exports (dist->src remap),
Python __main__, and conventional names into a new entry_points table;
used as a search-ranking tiebreak and surfaced in stats.
- Registries: recover @Registry.register-style decorations as REFERENCES
edges from handler to registry, making runtime-dispatched handlers visible.
Both ends must resolve to a unique symbol, so framework decorators emit nothing.
DB migrates in place on open (ALTER nodes + FTS rebuild + entry_points table);
verified against a real 206MB graph with no full rebuild. Typecheck clean;
179 tests pass (166 prior + 13 new in phase8.test.ts); the 3 failures are the
pre-existing Windows path-assertion cases.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QGMuxLUYYdEFKb7pMdTHNN
…ntry points, dynamic imports, registries Add a "What the graph captures" section and note the nearest-doc/doc-summary context in the AI-tools table and entry-point count in context_status/stats. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QGMuxLUYYdEFKb7pMdTHNN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The Live Context Compiler knew what calls what, but not why. In a large codebase, that missing intent is the actual navigation pain. This PR makes the graph capture design intent alongside structure — implementing the feasible items from an external agent's "make it more useful in larger codebases" review (skipping only the ones that were already done or were user-advice, not tool features).
What changed
languages/docstring.ts), stored in a newnodes.doccolumn. It's FTS-indexed — a phrase query like "how login works" now matches the prose, not just symbol names — and rendered as a// »summary line beside the code (folded onto signature-only nodes where the body isn't shown)..md/.mdx/.markdown/.rst/.adocas searchable nodes (title + heading trail + intro, newlanguages/doc.ts), and attach the nearestREADME/AGENTS.md/CONTEXT.mdto every rendered slice. Doc prose is excluded from the cross-reference scan (a mention is not a reference).import("…")/require("…")becomeIMPORTSedges instead of being dropped as unresolved calls, so lazily-loaded / code-split modules stay in the import graph.package.jsonbin/main/exports(with adist→srcremap), Python__main__, and conventional names into a newentry_pointstable; used as a search-ranking tiebreak (never a hard filter) and surfaced instats/context_status.@Registry.register-style decorations asREFERENCESedges from handler → registry, making runtime-dispatched handlers visible. Both ends must resolve to a unique, distinctive symbol, so framework decorators like@Injectableemit nothing (precise over noisy).Storage / migration
Adds
nodes.doc(FTS-indexed) and anentry_pointstable. An existing.context-graph.sqlitemigrates in place on open —ALTER TABLE+ FTS rebuild + new table — no full rebuild required. Verified against a real 206 MB graph (2,705 files / 20,777 nodes / 131,850 edges preserved; FTS rebuilt;doccolumn present, populated on next re-index).Verification
live-context-compiler.test/phase8.test.ts). The only 3 failures are the pre-existing Windows path-assertion cases, unchanged by this PR.{"via":"decorator"}, and a dynamic import pulling a lazily-loaded module into the traversal).README.md,CODEWEAVE_DOCS.md,COMMANDS.md, and the packageREADME.md.Notes
filenodes;getStats()gains an additiveentryPointsfield.--no-verifybecause the monorepo pre-push typecheck fails on a pre-existing broken symlink in the untouchedenterprisepackage (src/custom-elements.d.ts, a git symlink materialized as text on Windows) — unrelated to this change and failing identically onmain.🤖 Generated with Claude Code