Skip to content

Search & orient

Once you’ve run graft init, you have a graft/ directory full of linked Markdown nodes describing your codebase. This tutorial shows you how to explore and orient yourself.

  1. View the codebase map

    Terminal window
    graft map

    graft map is a token-budgeted first look at a repo — directory clusters with file/symbol counts, each dir’s local hubs, and the global hotspots — all ranked by in-degree, no LLM, no key:

    repo map — 113 files · 687 symbols · 2186 edges · typescript
    src/ 63 files · 527 symbols hubs: contextDirFor (node-file.ts, 21←), wiringPath (write.ts, 14←)
    test/ 43 files · 102 symbols hubs: edge (graph-traverse.test.ts, 4←)
  2. Search the graph

    Terminal window
    graft grep "authentication"

    graft grep is exhaustive over every indexed file and groups hits by enclosing symbol, ranked by the same in-edge coupling graft map uses:

    "NEEDLE" — 2 hits in 2 symbols across 1 files (searched 1 indexed files)
    heavilyCalled · function · src/a.ts:L1-L3 · 3 in-edges
    L2: console.log("NEEDLE hit in heavilyCalled");
  3. Trace call sites

    Terminal window
    graft callers MyFunction

    Find out who calls, references, imports, implements, or extends a symbol.

  4. Check graph health

    Terminal window
    graft check

    Verifies if the graft/ directory has drifted from the code (never auto-refreshes — it’s the drift report).

  5. Visualize the graph

    Terminal window
    graft viz

    Serves an interactive viewer on localhost so you can visually explore the nodes and dependencies.

The generated graph lives in graft/ and consists of:

  • Markdown node files (graft/*.md) — One per subsystem or concept, with typed wikilinks between them.
  • Wiring graph (graft/.graph/wiring.json) — Per-symbol code graph built by tree-sitter.
  • Per-file wiring cards — Mirror your source tree with structural information.