Skip to content

Add: precomputed-code-graph-lookup - #151

Open
muthuishere wants to merge 1 commit into
nibzard:mainfrom
muthuishere:add-precomputed-code-graph-lookup
Open

muthuishere wants to merge 1 commit into
nibzard:mainfrom
muthuishere:add-precomputed-code-graph-lookup

Conversation

@muthuishere

Copy link
Copy Markdown

One new pattern file: patterns/precomputed-code-graph-lookup.md. No other files touched.

What the pattern documents

Answering an agent's structural code questions — who calls this, what depends on it, what breaks if I change this signature — from a graph that was built before the question, and exposing it as verbs shaped like the agent's intent (locate, symbol card, reverse impact, path, "I'm about to change X") rather than as a search box. Every fact carries file:line provenance, and freshness comes from content-hashed re-parsing rather than from abandoning the index.

Why this isn't a recombination of the neighbours

I checked the closest existing patterns before writing, and the write-up links them rather than restating them:

  • agentic-search-over-vector-embeddings — argues to drop the index and search at query time with grep. This pattern is the counter-position: keep an index, but a deterministic structural one, so the staleness objection is answered by cheap re-parsing instead of by removing the index. Same category on purpose.
  • curated-code-context-window / curated-file-context-window — a search subagent selects files at query time; the mechanism is an LLM call and inherits its non-determinism. Here nothing infers at query time.
  • agent-powered-codebase-qa-onboarding — a use case (human onboarding Q&A) that mentions embeddings and code graphs among its ingredients; this is the mechanism, aimed at the pre-edit impact question rather than at exploration.
  • semantic-context-filtering / progressive-disclosure-large-files — about shrinking what enters context; this is about not running the search loop at all.

The novel claim, stated plainly: reverse-impact questions are graph traversals, and text search cannot answer them soundly for non-unique names — so the interesting design move is a composed, intent-shaped verb returning callers + blast radius + covering tests in one call, with ambiguity reported as ambiguity instead of guessed.

python3 scripts/pattern_similarity_checker.py reports no existing pattern at >= 0.5 similarity.

Disclosure

  • Affiliation: I maintain ctx-optimize, one implementation of this shape. It is disclosed in authors, appears once at the end of References explicitly labelled as a disclosed known implementation, and is not the source. The source and the rest of the references are neutral prior art: Aider's repo map, SCIP/LSIF, Glean, tree-sitter, universal-ctags. Happy to drop the ctx-optimize line entirely if you would rather the pattern carried no self-reference — it does not change the write-up.
  • Honest limits, in the pattern itself: evidence graded low; token savings explicitly stated as not established (they did not materialise in my own measurements); speed claims called implementation-specific and left unquoted; static resolution called out as incomplete for dynamic dispatch, reflection and generated code. No numbers or benchmarks are cited, because I have none that are independently reproducible.
  • AI assistance (per AI_POLICY.md): drafted with Claude Code (Claude Opus 5) against CONTRIBUTING/SCHEMA/TEMPLATE and the neighbouring patterns; I chose the framing, the prior art and the trade-offs, read every line, and can defend all of it in review. Commit carries an Assisted-by: trailer.

Validation

  • bun scripts/validate-patterns.ts patterns/precomputed-code-graph-lookup.md --check-content → clean (exit 0). The warnings in a full run are pre-existing on other files.

Documents answering an agent's structural code questions (callers,
reverse impact, "what breaks if I change this") from a precomputed,
deterministic graph queried by intent-shaped verbs, instead of a
retrieval-time grep-and-read loop.

Assisted-by: Claude Opus 5 (Claude Code)
@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown

@muthuishere is attempting to deploy a commit to the nkkko's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant