Skip to content

Graphify is not reducing tokens, at all? (thorough testing) #5640

Backlog

Description

@jbovard2016

Hi Graphify team and community,

Are we doing something wrong? Graphify does not appear to reduce tokens, quite the opposite.

I ran a controlled 24-build experiment on a private ~5,700-file JavaScript/Node.js repository to measure whether local Graphify CLI (0.9.119) saves tokens, turns, or improves correctness on real multi-file feature tasks compared with plain grep/glob/read.

We tested both a legacy custom setup and Graphify's official Oh My Pi (OMP) integration (graphify/pi/index.ts, strict mode on, code-only graph, surgical CLI commands). Even on the clean official setup, plain search beat Graphify on both discovery tokens and total session tokens with identical test pass rates.

We're sharing the full numbers here because we genuinely want to know if we missed a recommended configuration, flag, or workflow — or whether local CLI graph queries aren't expected to beat parallel grep/rg on active feature-implementation loops in JavaScript.

Environment & Controls

  • Graphify version: 0.9.119 (local CLI, offline)
  • Agent harness: Oh My Pi (OMP) 19.3.0 (-p --mode json --no-lsp, same frontier lead model + same subagent roles across every run, advisor disabled)
  • Repository: ~5,700 tracked files (primarily JavaScript/CommonJS + React/Next.js + Node tests), single-commit shallow clone per run (zero git history leakage, fresh working tree per build)
  • Tasks: 3 multi-layer backend feature tasks (each requiring coordinated changes across 4–5 production files + tests). 12 of the 13 modified production files were NOT named in the task prompts (only existing test filenames were referenced), so the agent had to discover the codebase structure from scratch in every run.
  • Grading: Pre-registered hidden automated test suites (19 hidden tests across the 3 tasks) + all existing regression tests for each area.
  • Repetitions: 2 repetitions × 3 tasks × 4 arms = 24 complete end-to-end builds (20-minute cap per build).

The 4 Arms Tested

  1. No Graphify (OFF): Graphify graph, extensions, skills, rules, and MCP completely removed; agent uses built-in grep/glob/read.
  2. Graphify Tool-Only (No Hooks): Full graph + MCP + AGENTS.md instruction present, all hooks/guards disabled.
  3. Legacy Custom Guard (3-layer): Older custom pre-search gate + third-party community graphify-pi plugin + read-interrupt rule + full graph (including Markdown docs).
  4. Graphify Official + Strict + Clean Code-Only Map (following docs.graphify.com):
    • Fresh code-only graph built with graphify extract . --code-only --no-label + graphify cluster-only . --no-viz --no-label → 34,878 nodes, 82,674 edges, 1,096 communities, 0 Markdown doc nodes.
    • Loaded Graphify's official bundled OMP guard (graphify/pi/index.ts) with GRAPHIFY_HOOK_STRICT=1, GRAPHIFY_HOOK_NUDGE_CAP=5, GRAPHIFY_HOOK_STRICT_TTL=1800 (all custom/third-party plugins disabled).
    • Local MCP disabled so agents ran official CLI commands directly (which write graphify-out/cache/last_query_stamp).
    • Concise <15-line AGENTS.md instruction directing agents to surgical commands: graphify explain "<symbol>", graphify affected "<symbol>" --relation calls, graphify path "<A>" "<B>", and narrow graphify query "<subsystem>" --depth 2 --budget 1500 (using --seed / --context calls), keeping grep for exact literals.
    • Verified in a live dry-run first: official guard denied the first raw grep once, graphify explain wrote last_query_stamp, and subsequent grep/read ran cleanly with zero extra nag messages.

Results (24 Builds — 6 Matched Pairs per Arm)

Arm Hidden Tests Passed Mean Wall Time Mean Total Tokens Mean Discovery Tokens (Turn 1 → First Edit) Mean Turns (Discovery / Edit / Subagents) Mean grep/glob + read Calls Blocks / Official Hints
No Graphify (OFF) 38/38 (100%) 1,179s 5.78M 775k 85 (11.7 / 22.2 / 51.2) 19.2 / 51.5 0 / 0
Tool-Only (No Hooks) 38/38 (100%) 1,094s 6.37M (+10.2%) 717k 94 (10.8 / 21.7 / 61.3) 20.3 / 59.8 0 / 0 (0 queries)
Legacy Custom 3-Layer 38/38 (100%) 1,162s 7.04M (+21.6%) 899k (+16.0%) 96 (14.2 / 24.8 / 56.5) 16.5 / 54.5 4.3 / (60 3rd-party nags)
Official + Strict + Code-Only 38/38 (100%) 1,135s 7.95M (+37.5%) 889k (+14.7%) 106 (13.3 / 27.3 / 65.5) 22.2 / 56.0 1.2 / 2.7 (0 3rd-party nags)

Paired statistics (Official + Strict vs No Graphify OFF, 6 matched pairs):

  • Total tokens: +2.17M (+37.5%), 95% bootstrap CI [+357k, +3.82M] — No Graphify lower in 5 of 6 pairs.
  • Discovery phase only (Turn 1 → first code edit): +114k tokens (+14.7%), +1.6 turns (13.3 vs 11.7) — No Graphify faster to first edit in 5 of 6 pairs (eliminating subagent debugging variance).
  • Quality: 100% hidden-test and regression pass rate across all 24 builds (0 pp difference).

Specific Failure Modes We Observed in the Official Arm

  1. Zero voluntary adoption without strict enforcement: In Tool-Only, agents ran 0 Graphify queries across 6/6 builds despite graphify-out/graph.json and explicit AGENTS.md instructions.
  2. Ambiguous symbol exit code 3 (explain / affected) breaks chained commands and doesn't stamp orientation: In multiple builds, agents ran e.g. graphify explain "<helperName>" && graphify explain "<otherHelper>". When the first symbol existed in two files, graphify explain exited 3 (Ambiguous: matches 2 nodes in different files), short-circuiting the chain and leaving cache/last_query_stamp unwritten — which then caused subagents spawned later to hit strict denials as well (related to CLI affected and god-nodes never refresh the strict hook's orientation stamp nor write the query ledger #3053).
  3. Graphify sat on top of grep/read instead of replacing them: Even in the clean code-only official arm, agents made slightly more grep/glob calls (22.2 vs 19.2) and read calls (56.0 vs 51.5) than when Graphify was off. On a well-named JS/Node repo, 4 parallel grep calls in Turn 2 located all 5 unnamed files in <50ms, whereas explain/query still required reading the same files and checking grep for completeness (especially given JS dynamic/namespace/nested-arrow gaps like [Bug]: TS/JS: calls through a namespace import (import * as ns; ns.fn()) produce no calls edge (deferred half of #3346) #4619 and TypeScript extraction emits internal edges whose endpoint nodes are absent #2143).
  4. Discovery is only ~13% of a coding build's token bill: In our runs, finding the files took ~775k–889k tokens out of a 5.8M–8.0M token session. The remaining ~87% is editing, running tests, and reviewing diffs, where extra early turns compound across the cached conversation prefix.

Questions for the Maintainers

  1. Configuration / workflow: For active multi-file JS/Node feature builds with OMP (graphify/pi/index.ts), is there a recommended flag combination or instruction pattern (beyond --code-only, GRAPHIFY_HOOK_STRICT=1, and surgical explain/affected/query --budget 1500) that measurably beats parallel grep on full-session tokens?
  2. Exit code 3 & orientation stamp: When graphify explain or graphify affected returns exit code 3 (listing exact candidate file paths and node IDs), should that count as orienting the session and touch last_query_stamp — and should graphify affected also touch last_query_stamp?
  3. MCP vs hook-guard: Are there plans for local graphify-mcp (serve.py) to write last_query_stamp so teams using the MCP server can also use graphify/pi/index.ts strict mode without double-blocking?
  4. Intended sweet spot: Is local open-source Graphify CLI primarily aimed at cold-start repo onboarding / cross-repo architecture / mixed docs+code rather than token reduction during routine feature edits in an already-indexed single JS repo?

Happy to share sanitized synthetic reproduction fixtures if helpful. Thanks for building and maintaining Graphify!

Activity

  1. github-actions commented on Nov 30, 2026

    @github-actions

    Thanks for opening this issue, @jbovard2016. 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.

  2. changed the title [-]24-build controlled benchmark on a ~5,700-file JS/Node repo (OMP 19.3.0 + Graphify 0.9.119 official Pi guard): zero quality gain, +15% discovery tokens (+37.5% session tokens) vs plain grep — are we missing a recommended workflow?[/-] [+]Graphify is not reducing tokens, at all? (thorough testing)[/+] on Nov 30, 2026
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