HivemindOS manual
Token And Cost Savings
HivemindOS saves tokens by making agents search, reuse, and remember before they generate. Instead of pasting whole folders or chat histories into every prompt, agents pull only the context a task needs.
For recall accuracy, speed, and scale results, see Shared Brain Memory Benchmarks.
Where the savings come from
| Layer | How it saves tokens and cost |
|---|---|
| Shared Brain Memory | Retrieves relevant memories or vault notes instead of pasting the whole vault, long chat history, or repeated instructions. |
hive-brain answer and hive-brain recall |
Give any agent a local search path: the app first, then the local vault index. |
| Context index | Finds skills, API routes, tools, docs, and apps as targeted hits instead of loading whole file trees. |
karpathy-guidelines |
Pushes agents toward small, verifiable changes, avoiding costly rework. |
hive-assimilate |
Reuses existing code, tests, and project knowledge before building anything new. |
hive-capability-search |
Builds a compact map of which tool, app, skill, or runtime fits, so agents stop re-searching. |
| Hive Fusion skills | Turn repeated work into saved skills and workflows, so future runs load a short recipe. |
| Runtime and provider controls | Let you route suitable work to local or cheaper models and keep stronger paid models for tasks that need them. |
| Usage analytics | Show real token use by model, runtime, session, and source, so a cheap wrong answer isn’t counted as a saving. |
The best habit: keep lasting context in Hive Superbrain, reuse a reviewed skill for repeated work, and attach only the sources the current task needs.
Search the shared brain
hive-brain answer "query"
hive-brain recall "query" --scope full-vault --limit 8
Use hive-brain answer for a short grounded answer and hive-brain recall for a ranked list of hits with paths. Recall checks typed Agent Memory first and only searches the full vault when that isn’t enough, which is far cheaper than filling the prompt with broad context.
Reuse before you build
karpathy-guidelinesasks agents to read the relevant code first, make small changes, avoid speculative abstractions, define how to verify, and stop when the task is done. Most token spikes come from fixing avoidable bugs and untangling unrequested changes, not from the first attempt.hive-assimilatesearches, in order: your pinned repos, paths, notes, or skills; the shared brain; the current workspace; your project folders; local indexes; and public GitHub. It also logs what was rejected, so the next agent doesn’t repeat dead ends.hive-capability-searchanswers “what can this hive already do for this task?” It returns the chosen components, alternatives, delivery channels, required credential names, side effects, and gaps. For example, “build this with parallel agents” maps to the/swarm-goalslash command, which creates a Work Board task that agents can pick up and act on.- Hive Fusion:
hive-skill-fusionsaves a useful procedure as a shared skill,hive-workflow-fusionplans multi-step work with dry runs and approval gates, andhive-aeon-fusionturns recurring work into a background duty that reuses a saved plan.
Practical Rule
For expensive tasks, the intended order is:
- Recall with
hive-brain. - Map capabilities with
hive-capability-search. - Reuse source with
hive-assimilate. - Follow
karpathy-guidelineswhile editing. - Turn repeated work into a skill or workflow with Hive Fusion.
- Check runtime usage afterward.
That order is the cost-control loop: retrieve less, choose better, reuse more, edit smaller, and remember the result.
Evidence
In a live run on June 7, 2026, the same question (“Explain how HivemindOS shared brain memory works and which command a raw agent should use before relying on prior context.”) was sent to openai/gpt-4.1-mini through OpenRouter twice: once with a broad context pack and once with a targeted Hive recall pack. Both answers named hive-brain answer "<query>". Provider-reported usage:
| Run | Prompt tokens | Completion tokens | Total tokens |
|---|---|---|---|
| Baseline | 43,655 | 99 | 43,754 |
| Hive | 286 | 84 | 370 |
| Saved | 43,369, 99.3% | 15, 15.2% | 43,384, 99.2% |
A June 8, 2026 chatbot-build run used 87.5% fewer tokens with Hive context (42,571 versus 5,307 total), but it does not count as a saving: the Hive answer named files and tests that don’t exist in the repository, so it failed the outcome check. Token counts only qualify when the answer is also correct.
Run the benchmarks yourself
These commands run from a HivemindOS source checkout:
| Command | What it measures |
|---|---|
pnpm benchmark:context-savings |
A deterministic local estimate of broad versus targeted Hive context packs. No provider call. |
pnpm benchmark:e2e-token-savings |
Real chat completion calls with outcome grading and provider-reported token usage. Comparative claims require at least three runs per condition. |
Live provider run
./scripts/hive-env-run -- pnpm benchmark:e2e-token-savings
./scripts/hive-env-run -- pnpm benchmark:e2e-token-savings -- --provider openrouter --model openai/gpt-4.1-mini
./scripts/hive-env-run -- pnpm benchmark:e2e-token-savings -- --scenario brain-recall --repeats 3
It needs a provider key in your shared hive env and supports --provider openai, --provider openrouter, and --provider usepod. Results are saved under .outputs/benchmarks/ with usage counts, timings, response ids, context hashes, and outcome grades, but never API keys or full prompts. If a broad context pack is cut to fit the cap, the result is marked context.truncated: true. A comparison is marked claim-ready only when both conditions meet the repeat threshold and outcomes are comparable.
Deterministic context budget
pnpm benchmark:context-savings
node scripts/benchmark-context-savings.mjs --input-price-per-million 2.50
node scripts/benchmark-context-savings.mjs --json
This estimates prompt size as max(characters / 4, lexical tokens) for broad loading versus targeted Hive recall, skills, and source paths. It is not a live E2E provider-billing benchmark: it isn’t an invoice and doesn’t judge answer quality. The old pnpm benchmark:token-savings name still works. Add --input-price-per-million with a current provider price for a dollar estimate.
Example run on the HivemindOS repository:
| Scenario | Baseline | Hive | Saved |
|---|---|---|---|
brain-recall |
48,182 | 172 | 99.6% |
software-build |
855,226 | 5,335 | 99.4% |
workflow-reuse |
27,112 | 3,909 | 85.6% |
The exact percentage matters less than the repeatable gap between loading broadly and retrieving the smallest useful evidence.