Skip to content

Benchmarks

AI coding assistants typically load context statically: CLAUDE.md files, project docs, and convention guides are injected into the context window at session start, paying the full token cost every time regardless of whether the content is relevant. A moderately sized knowledge base (500+ files) can consume tens of thousands of tokens before a single question is asked.

Hive replaces static loading with on-demand vault queries. Context is fetched only when needed, scoped to the relevant project and section. The benchmarks below quantify the token savings across different usage patterns and calibrate the max_lines parameter for optimal signal-to-noise ratio.

  • Synthetic vault matching real-world distribution: P25=37 lines, median=77 lines, P90=262 lines, max=878 lines per file.
  • Real Obsidian vault: 228 files, 493K tokens total.
  • Token estimation: 1 token ~ 4 characters (standard approximation for English text and code).
  • Signal-to-noise (S/N): percentage of returned lines containing useful content vs. boilerplate (YAML frontmatter, empty headers, separators, blank lines).
  • Test suite: pytest tests/test_benchmark.py -v -s

Synthetic vault with 51K tokens as the static baseline (loading everything at session start):

Session typeQueriesTokens usedSavings vs static
Bug fix (focused)22,64594.8%
Feature dev (broad)413,08274.4%
Exploration (heavy)627,54946.0%

Real vault (493K tokens): 5 project context queries consumed 2,925 tokens total, yielding 99.4% savings over static loading.

vault_query on a real file (878 lines, 15K tokens):

max_linesTokensContent capturedSignal/Noise
503572.3%48%
1001,1037.2%49%
2002,79718.2%51%
3004,57029.8%49%
5007,62549.7%52%
100015,355100%52%

vault_search on real vault (query=“deploy”):

max_linesTokensContent capturedS/NMatches found
1002,21416.7%97%47/312
3006,49449.0%99%159/312
50013,03998.5%99%304/312
750+13,244100%100%312/312
ToolS/N ratioBest for
vault_search98.8%Targeted queries — minimal noise
vault_search (ranked)98.4%Ranked search results
vault_query87-90%Full section reads
session_briefing78.5%Cold start context assembly

Wall-clock cost of vault writes with and without the commit coalescer and the commit=False opt-in. Measured against the git_vault test fixture (fresh repo, 10 writes per scenario, pytest tests/test_benchmark.py::TestWriteThroughputBenchmark -v -s). Absolute numbers vary with repo size and disk speed; the ratios are the load-bearing signal.

ScenarioTotal wall-clockPer call (avg)vs baseline
10 writes, commit=True (baseline)71.7 ms7.2 ms1.0x
10 writes, commit=False + 1 vault_commit flush15.1 ms (4.9 writes + 10.1 flush)1.5 ms4.8x
10 sequential vault_patch calls, one edit each72.3 ms7.2 ms1.0x
1 vault_patch call with 10 patches (coalescer)7.0 ms0.7 ms10.4x

The 10.4x multi-patch result lands automatically — no API change is required; passing patches=[{...}, {...}] already issues exactly one git add and one git commit since HIVE-104. The 4.8x opt-in batching requires passing commit=False and calling vault_commit at the end; pair it with the obsidian-git plugin to push the flush off the synchronous tool path entirely (see Configuration → Recommended configuration).

On a vault under contention (multiple Hive processes, large .git/index, slow disk), the baseline per-call cost can climb to ~150 ms; the same speed-up ratios still apply.

Based on these results:

  1. Default max_lines = 500 — captures 98.5% of search results with 99% S/N. The previous default (100) missed 83% of content in large files.
  2. Use vault_search for precision — highest S/N ratio (98.8%). Prefer over vault_query when you know what you are looking for.
  3. session_briefing for cold starts — despite lower S/N (78.5%), it assembles context, tasks, and health in one call (~1,300 tokens).
  4. Saturation at 500-1000 lines — values above 1000 add zero benefit with current vault sizes. The largest real vault file is 878 lines.
  5. Override max_lines per query — for quick lookups, pass max_lines=200. For comprehensive reads, use max_lines=0 (unlimited).
  6. Batch bulk writes — for any flow that performs more than two vault writes in sequence, pass commit=False and finish with a single vault_commit. The multi-patch form of vault_patch is always batched.
Terminal window
# Synthetic vault benchmarks (no external deps)
pytest tests/test_benchmark.py -v -s
# Real vault benchmarks (requires Obsidian vault)
pytest tests/test_benchmark.py -m smoke -v -s