<!-- zibby-template-version: 4 -->
# /zibby-memory-cost — show real LLM token spend across past test runs

You are helping the user see how many input/output/cache tokens their tests have actually burned, broken down per spec and per domain. This is real measured spend (read off run records in `.zibby/memory/.dolt/`), not an estimate.

Canonical docs: **https://docs.zibby.app/tests/memory**

## What the command shows

```
Bash(zibby memory cost)
```

Per-spec and per-domain rollup of:
- Input tokens
- Output tokens
- Cache hit / cache write tokens (when the agent supports prompt caching)
- Estimated $ cost (uses current public model pricing)
- Recent-runs trend, so you can see if a spec is getting cheaper or more expensive over time

The numbers are pulled from `test_runs` rows in the Dolt DB — every test run records the agent's actual usage on completion.

## When to invoke

- User asks "how much are my tests costing me?" or "which spec is the expensive one?"
- After enabling prompt caching to confirm cache hits are landing
- When deciding whether to swap to a cheaper agent on hot specs (`--agent` per run)
- When triaging a regression in test runtime — high token counts often correlate with the agent retrying

## Caveats

- **Only counts what's in local memory.** Runs on machines that haven't pulled from the team remote won't appear. Run `/zibby-memory-pull` first if you want the full team picture.
- **Pricing is informational.** Public API pricing changes; treat the $ column as a guide, not a bill. The token counts themselves are exact.
- **Empty if you've never run a test with memory enabled.** Confirm the runs are in there with `/zibby-memory-stats` first.

## Related

- `/zibby-memory-stats` — what's in the DB at all
- `/zibby-memory-pull` — refresh from team remote before reading cost
