Repository navigation
feat: add codegraph walk (M21) - #50
Merged
Merged
Conversation
Which entities a filter names, in core's vocabulary (PLAN §22.3, M21b): one AST with a text surface (id:, kind:, trait:, lang:, name:GLOB, module:GLOB, file:GLOB, edge:KIND[>TERM], edge-in:KIND[<TERM]) and a JSON surface (all / any / not). A selector is compiled against a view, so edges are read through it; an unknown kind or trait is a usage error. Hand-counted on the Java fixture and held by properties. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVgyRgXptvGiT9iooEcs
The bottom-up walk asks its question through one seam (WalkSpec); explain is the built-in spec and its default output is pinned byte for byte by a golden suite on the five fixtures (PLAN §22, M21). insights: - a codegraph.walk/1 definition is data: a task per level, instructions, entity instructions, a closed field grammar compiled to Zod; its fingerprint hashes what the definition says - a selection (analyzer selectors, nearest-container rule, exclude wins, closure, trivial members) picks the units asked, never the units walked - one store per walk, <model>.N.walk.db and its .walk.jsonl export (codegraph.walkRecords/1), refused to another walk or another answer shape with its bytes untouched; no migration of explain's store - a read-only reader for a walk's store cli: - walk: --prompt, --prompt-file, --instructions, --walk FILE, --name, --include/--exclude/--levels/--closure, --print-definition, and every run flag of explain, through one shared runner - explain takes the selection flags, --instructions and --walk FILE; --scope is --include id:; its task, blocks and store are unchanged - insights --walk N and serve --insights read a walk's store - a walk's output estimate uses per-level figures measured on a live PetClinic run (operation 500, type 620; module takes the type's) The two packages change together: the CLI does not compile against the seam without its own half. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVgyRgXptvGiT9iooEcs
When serve --insights points at a walk's store, the Navigate panel shows the answer as an inference: the badge "LLM answer", the walk's name, the model and its claimed confidence, then the answer, each declared field by its name, and the description (PLAN §22.5). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVgyRgXptvGiT9iooEcs
docs/insights.md (IN-9), docs/cli.md, README and CLAUDE.md; on the site a how-to, three reference pages (walk, insights, the walk definition and its selectors) and the pages that named explain alone. The cost passages state the PetClinic run the output figures come from and the estimate's error on it. A test parses every codegraph.walk/1 block and every --include and --exclude term of the docs through the real parsers, so an example cannot rot. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVgyRgXptvGiT9iooEcs
§22: the seam, the definition, selection, one store per walk, the CLI, the eight steps with their verification and the as-built notes, including the live PetClinic walk (83 calls, 0 failed, $0.94) and the measured output figures. Milestones and decisions move to §23 and §24; the two references outside the plan follow. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVgyRgXptvGiT9iooEcs
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
codegraph | 93d5c7c | Commit Preview URL Branch Preview URL |
Nov 23 2026, 07:35 AM |
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.
What this does
codegraph explainasked one fixed question of every unit. This addscodegraph walk: the same bottom-up walk (operations → types → modules, each prompt shown what was already answered about its dependencies), with your question, of the units you select, into its own store.explainbecomes the built-in walk, and takes the same selection flags and instructions.Plan and decisions:
PLAN.md§22 (Phase 19, M21a–M21d), with an "As built" note per step.The commits
feat(analyzer): add entity selectorsid:,kind:,trait:,lang:,name:,module:,file:,edge:,edge-in:as flag terms; the same plusall/any/notas JSON), pure computation over the graph, with a property suite.feat(insights,cli): add codegraph walkWalkSpec; explain is the built-in spec, acodegraph.walk/1definition is another. A selection picks the units asked, never the units walked. One store per walk (<model>.N.walk.db/.walk.jsonl, headercodegraph.walkRecords/1), refused to any other walk. Thewalkcommand,explain's new flags,insights --walk N.feat(navigator-ui): show a walk's answersserve --insightspoints at a walk's store.docs: document walk and walk definitionsdocs/insights.md,docs/cli.md, README, CLAUDE.md, four new site pages and the pages they touch; a test runs every definition the docs print.docs(plan): add M21, the generalized walkPLAN.md§22 and the two cross-references it renumbers.Insights and the CLI are one commit:
main's CLI does not typecheck against the new insights package alone, so splitting them would leave a commit that does not build.What must not change, and how it was checked
packages/cli/test/golden/explain, 37 files) pins explain's plan, estimate, prompts and JSON output from before the seam; it passes unchanged.explain --dry-run --jsonis byte-identical before and after, and the store file's sha256 is unchanged.decode → import → exportof a walk's side-car is the identity (tested property); a walk's store is refused to explain and to any other walk, bytes untouched.Verification
Run on the tree these commits hold, before committing:
pnpm -r build,pnpm run typecheck, eslint: clean@codegraph/insights: 467 passed, 1 skipped ·@codegraph/cli: 1238 passed (56 files) ·@codegraph/navigator-ui: 124 passedhugo --minify --gc, 206 pages, no warningNot re-run after committing, and CI has not run on this branch yet.
One live run
One paid walk on a copy of Spring PetClinic (
sonnetthrough Claude Code, controllers and their dependencies): 139 units, 83 calls, 0 failed, 127 s, 200 779 prompt + 43 814 completion tokens, $0.94. A second run planned 0 calls.The output estimate was a flat guess of 500 tokens per block; it is now the means of that run: 500 per operation block, 620 per type block. Module takes the type's figure.
Against the bill, the estimate was 12.4 % above on input (operations 21.6 % above, types 7.0 % below) and, with the old flat 500, 5.3 % below on output (types 19.3 % below).
Known limits
setAllowedFields, an@InitBindermethod."trivial": "ask"in the definition asks them all.WEBSITE.md§4 does not list the four new site pages yet.e2e-exit-codes.test.ts(near vitest's 60 s worker timeout) and oneimport.test.tscase when a temp directory name containsMB.🤖 Generated with Claude Code
https://claude.ai/code/session_01PKCVgyRgXptvGiT9iooEcs