Video summary
Github Top Trending Tool Just Fixed The AI Agent’s Biggest Problem
Main summary
Key takeaways
Technological problem (why AI coding agents get expensive/slow)
Coding agents (e.g., Claude, Code, Codex) often use a multi-turn “search-and-then-edit” loop:
- They must find the relevant files/lines by running terminal searches for related terms.
- Models typically don’t locate the correct target immediately, so they call tools repeatedly to narrow the scope.
- Each decision point sends the model the full conversation so far, including tool responses, which grows the context window.
Consequences
- Token burn increases → you hit usage limits faster, especially with high-end/slow models.
- Latency increases because the agent waits on repeated tool calls.
- Output quality can worsen since the model has too much irrelevant context to focus on a single operation.
Why existing approaches fall short (vector search gap)
Prior tools often use vector search: convert code sections into embeddings and retrieve “semantically similar” snippets.
The limitation is that similarity doesn’t capture how parts of an app connect. For example, account creation and account deletion may both “match” accounts semantically, but behave differently.
As a result, agents can retrieve the wrong file/section, making this approach less reliable—so many coding agents avoid it.
Solution: Graft (GitHub trending tool)
What it does
Graft is a terminal command/tool that changes how coding agents locate project code.
Core mechanism: it builds a knowledge graph of the project:
- Nodes = code parts (and their locations/names)
- Edges = dependencies/relationships between parts
Instead of searching by keywords/embeddings each time, the agent consults the graph to:
- find exactly which code is connected
- understand what else depends on it
- reduce unnecessary tool calls and context growth
Reported benefits (benchmarks + impact)
- Cost: “best case” reported as ~4× cheaper in token usage.
Their benchmarks (their own tests) report:
- Tasks took ~60% less time on average across 162 runs
- Tool usage reduced ~46%
- Tokens reduced ~42%
- Cost reduced ~32% on average
Scaling note
Biggest savings come from avoiding repeated searching. On small projects, there’s less searching to remove, so gains may look smaller initially.
Implementation/compatibility details
- Works with Claude Code and Codex, plus other agents that use terminal commands or MCP.
- Map format and viewing:
- Saves the graph as a JSON file
- Includes a browser-based viewer to explore nodes/edges
- Update strategy:
- Keeps the map current as code changes:
- Before answering, it checks if code changed and can update the graph without using the model
- Helps prevent working off stale project state
- Keeps the map current as code changes:
How it integrates with the agent (two modes)
-
CLI/Prompt-attached mode
- Graft attaches up to three matching locations to each prompt (based on word matches to the map).
- The model sees the correct file/lines early, so it needs fewer turns and less context.
-
MCP mode
- The agent requests lookups only when needed (less prompt payload).
- Their tests:
- MCP was slightly more accurate
- CLI was faster
- Both modes are available after installation.
Optional documentation layer
Graft includes an optional step where it can generate plain-language pages describing what code parts do and how they fit together.
The video claims this is not necessary because the dependency graph already encodes relationships; the extra text mainly improves understanding.
Tutorial-style installation/setup workflow (key steps)
Installation
Install from their site via:
- Copy/paste an install command, or
- Copy a setup prompt tailored to your coding agent
Per-project initialization
- Run
graft initinside the project folder (so project-specific instructions are stored correctly). - Choose the coding agent (example: Claude code).
Project “skill” / hooks
After init:
- A Graft skill appears in the project folder.
- It installs hooks that:
- Provide map instructions at session start
- Attach matching locations to prompts
- Update the map after the agent edits files
Starting from scratch vs existing code
- Starting from scratch: map begins with 0 nodes and grows as files are are created.
- Existing codebase: run
graft buildto generate the graph from current code.
Practical test described
They test on a booking/scheduling app similar to Calendly (for independent providers) using Fable 5.1:
Initial build
- With Graft: 39 minutes, ~31% context window
- Without Graft: 47 minutes, ~35% context window
- Functionality: similar
Later changes
Differences grow because Graft already has the project map.
Example change:
- Landing page revamp:
- <2 minutes with Graft
- Without Graft: would take “a lot more time”
Map update behavior
After each change, Graft updates the map and reports token savings for that turn.
Limitation noted (only maps code)
Graft maps code only, not other context files like:
- PRD
- learnings.md
- other planning/area files
So when the agent needs those, it falls back to the default methods.
Sponsor (Hydra) — unrelated to Graft, but product described
Hydra provides an API/runtime for AI generation in production:
- Avoids building infrastructure, job queues, and model runtime manually
- Returns a trackable job with status updates
- Offers CLI + SDK and a “try free” link
Main speakers/sources
- Channel: AI Labs (host speaking; first-person narration)
- Tool authors/maintainers: Graft team (benchmarks and design claims attributed to “their own tests”)
- Sponsor: Hydra (described as part of the video sponsorship)