Setup Your Coding Assistant for Low LLM Token Usage

Cut Cursor and Claude Code token costs by turning your codebase into a deterministic knowledge graph with Graphify.

By Sea Wing AI
Enterprise AI LLMtoken usageGraphifyCursorcontext engineering

How much of your coding assistant budget goes to re-explaining the same codebase every session?

Large language models charge by token. Every file you paste, every broad @codebase query, and every repeated architecture explanation adds cost and latency. Graphify reduces that overhead by building a deterministic knowledge graph from your repository, source code, docs, SQL schemas, config files, and PDFs. The assistant navigates structured relationships instead of re-ingesting large context windows on every turn.

This guide covers installation on Windows, macOS, and Linux, then shows how to wire Graphify into Cursor and other coding assistants. For broader token-reduction tactics, see 50 Ways to Reduce LLM Token Usage. For tool selection context, see 22 Coding Assistants and Their Capabilities.

Why a Knowledge Graph Beats Raw Context

Vector search retrieves similar chunks but can miss structural dependencies: who calls whom, which config activates a feature, or how a schema change propagates. Graphify extracts symbols and edges from your project AST and indexes them for targeted queries such as graphify query "where is authentication handled" or graphify path "UserService" "Database".

The graph lives locally under graphify-out/. Cursor rules generated by graphify cursor install instruct the assistant to query the graph before reading entire directories. On large repos, teams report lower token consumption, faster responses, and fewer hallucinated file paths.

Install on Windows

  1. Install winget if needed: https://aka.ms/getwinget

  2. Ensure C:\Users\<you>\AppData\Local\Microsoft\WindowsApps is in your PATH

  3. Install uv:

    winget install astral-sh.uv
  4. Restart PowerShell and verify:

    uv --version
  5. Install Graphify:

    uv tool install graphify
  6. Add C:\Users\<you>\.local\bin to your PATH if the shell cannot find graphify

  7. From your project root, install Cursor integration:

    graphify cursor install
  8. Build the initial graph:

    graphify . --code-only

For Claude Code, Codex, and Gemini CLI, follow the integration steps in the Graphify repository documentation.

Install on macOS

  1. Install Homebrew if needed: https://brew.sh

  2. Install uv:

    brew install uv
  3. Verify:

    uv --version
  4. Install Graphify:

    uv tool install graphify
  5. Ensure ~/.local/bin is in your PATH. Add to ~/.zshrc if required:

    export PATH="$HOME/.local/bin:$PATH"
  6. Install assistant integration and build the graph:

    cd /path/to/your/project
    graphify cursor install
    graphify . --code-only

On Apple Silicon and Intel Macs, uv handles architecture-specific wheels automatically.

Install on Linux

  1. Install uv using the official installer:

    curl -LsSf https://astral.sh/uv/install.sh | sh
  2. Reload your shell or source your profile, then verify:

    uv --version
  3. Install Graphify:

    uv tool install graphify
  4. Confirm ~/.local/bin is on your PATH

  5. From your project directory:

    graphify cursor install
    graphify . --code-only

For Debian or Fedora systems without curl, download the uv release binary from the Astral documentation and place it on your PATH.

Configure Cursor and Keep the Graph Current

After graphify cursor install, Graphify creates .cursor/rules/graphify.mdc with instructions to query the graph before broad file reads. The cached index under graphify-out/cache/ speeds repeated lookups.

Operational habits that preserve token savings:

  • Run graphify query "<question>" yourself when exploring unfamiliar modules
  • Use graphify update . after meaningful code changes (AST-only, no API cost)
  • Prefer --code-only for large monorepos when docs and PDFs are not needed
  • Combine Graphify with the scoping practices in 50 Ways to Reduce LLM Token Usage: narrow @ references, smaller rules files, and concise prompts

Rebuilding the full graph on every save is unnecessary. Schedule updates after merges or run graphify update . as a pre-commit or CI optional step for teams that want always-fresh symbols.

When Graphify Fits Enterprise Repositories

Graphify delivers the most value when:

  • The codebase spans dozens or hundreds of packages
  • Onboarding assistants without dumping entire trees into context
  • Cross-language projects where grep alone misses inferred dependencies
  • Compliance-sensitive environments that prefer local indexing over uploading code to third-party embedding services

It complements, not replaces, good prompt discipline and assistant configuration covered in 22 Coding Assistants and Their Capabilities.

Related Reading

Contact Sea Wing AI to reduce LLM token costs across your engineering teams.

← Back to Blog
Discuss Now