Skip to content

Integrate with Claude Code

Graft’s deepest integration is with Claude Code. Once wired in, Graft rides along in every session: pulling relevant nodes into prompts and rebuilding the graph in the background.

Graft terminal output showing init and claude code synced

  1. Run init targeting Claude Code

    Terminal window
    graft init --agents claude

    This drops a statusline and hooks into .claude/, skipping the agent selection prompt.

  2. Commit the wiring

    Terminal window
    git add .claude && git commit -m "wire in graft"

    Your teammates get the wiring when they pull. They run graft build once to generate their local graph.

  3. Start a Claude Code session

    From the next session on, Graft automatically:

    • Loads matching context nodes into each prompt
    • Syncs the graph in the background after every agent turn
    • Tracks uncommitted, unstaged, and staged changes

The hooks in .claude/ tell Claude Code to:

  1. Inject the relevant graft/ nodes as context before each prompt
  2. Run a lightweight structural refresh (~3ms) after each turn to detect file changes
  3. Rebuild only the changed nodes (the LLM is never called during refresh — it’s pure tree-sitter)

graft’s post-edit hook Edit a file → blast radius appears inline → graph auto-resyncs → confirmed in graft viz