Skip to content

Add guidance to SKILL.md on when building a graph is (and isn't) worth it #4829

Closed

Description

@curl-man

Ran the skill end-to-end today (sample corpus + a real ~200-file project) and it delivered genuinely good results — correct AST extraction, accurate cross-referencing between code and doc semantic layers, and the cohesion/god-node/surprising-connections analysis surfaced real findings (an architectural smell, a cross-doc duplicate derivation, etc.).

One gap: the skill has no guidance on when the full pipeline is worth its cost vs. when a plain code search would do. In practice:

  • A single targeted lookup ("what calls X", "where is Y defined") on an ordinary-sized codebase is answered just as well, instantly and for free, by grep/ripgrep/Read. Building the graph first is pure overhead for that case — AST extraction is fast and free, but semantic extraction on docs dispatches subagents and can take minutes and tens of thousands of tokens, even for a modest doc set.
  • The graph earns its cost when: there will be many repeated questions (amortized build cost), the corpus is large/unfamiliar and the user needs orientation, the question needs cross-file/cross-type links text search can't see (doc ↔ code, cross-doc semantic duplicates), or the question is structural (cohesion, bridging nodes, import cycles) rather than textual.

Right now the skill (reasonably) defaults to building on /graphify <path>, which is fine when the user explicitly asks for that — but when an agent is deciding on its own whether to reach for graphify vs. a direct search for a one-off question, there's no steering in SKILL.md toward the cheaper option first.

Suggested addition: a short "is a graph worth it here" section before the build steps, something like:

Building costs real time and tokens: AST extraction on code is free and fast, but semantic extraction on docs/papers/images dispatches subagents (minutes, tens of thousands of tokens), and a full pipeline run is overhead you pay once per corpus state. Don't pay it reflexively.

If graphify-out/graph.json already exists for this corpus, always query it rather than re-deriving the answer by reading files or rebuilding — that cost is already sunk and querying is cheap.

If no graph exists yet, check whether the request is a single, targeted lookup a plain code search would answer just as well — "where is X defined", "what calls Y", "find the function that does Z" on a codebase of ordinary size. For these, grep/ripgrep/Read is faster, free, and exact. Say so and just search directly; offer to build the full graph instead only if the user wants it.

Building (or updating) the graph earns its cost when:

  • You expect many future questions against this corpus — the build cost amortizes.
  • The corpus is large or unfamiliar and the user needs orientation (god nodes, communities).
  • The question needs cross-file or cross-type connections text search can't see.
  • The question is structural/architectural, not textual.

Happy to turn this into a PR against SKILL.md if that's useful.

Separately filed one small fix noticed during testing as a PR: #4830 (graphify query --help ran a literal query instead of showing usage). The other thing I initially flagged (hyperedge members/nodes field mismatch) turned out to already be intentionally handled in build.py (#1561) — not a bug, so no PR for that one.

Activity

  1. github-actions commented on Oct 27, 2026

    @github-actions

    Thanks for opening this issue, @curl-man. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions