context-size

context-size is a command for coding agents from atuljha23/holocron. It costs 36 tokens per session (601 once invoked), scanned A, original, MIT.

A command that measures what is taking up the current coding session's context window, including the transcript, instruction files, tool definitions, and files read during the session.

In plain words
What is it for?
Use it to inspect transcript size, estimate instruction and tool-schema costs, find persistent injected context, and list large files already read.
Why use it?
Long sessions can leave less room for new code and instructions. This snapshot helps identify large inputs that may be worth trimming or avoiding next time.

Command

Part of the holocron plugin — 11 skills, 24 commands, 14 agents, 6 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/atuljha23/holocron/context-size
Clone the repo
git clone --depth 1 https://github.com/atuljha23/holocron

Or install holocron, the plugin that ships this one along with the rest of its 11 skills, 24 commands, 14 agents, 6 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for context-size

README.md
[![agentmods](https://agentmods.dev/badge/commands/atuljha23/holocron/context-size.svg)](https://agentmods.dev/commands/atuljha23/holocron/context-size)
Your own site
<a href="https://agentmods.dev/commands/atuljha23/holocron/context-size"><img src="https://agentmods.dev/badge/commands/atuljha23/holocron/context-size.svg" alt="Measured on agentmods" height="20"></a>
Per session 36 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 601 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00036 $0.00601
Opus 5 $0.00018 $0.00300
Sonnet 5 $0.00007 $0.00120
Haiku 4.5 $0.00004 $0.00060

Measured 4d ago against content hash a96c6bbbf815, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

context-size scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/context-size.md · 56 lines

What it actually says

/holocron:context-size

Inspect where the context-window money is going.

Gather

  1. Transcript size — if the session has a transcript_path, report its size. Otherwise estimate from turn count × avg-turn-size.

  2. CLAUDE.md contributions — each of these, if it exists, contributes tokens to every turn:

    • ~/.claude/CLAUDE.md (user scope)
    • ./CLAUDE.md or ./.claude/CLAUDE.md (project scope)
    • ~/.claude/memory/MEMORY.md and the indexed memory files Report: file path, byte size, approximate tokens (bytes / 4).
  3. MCP schemas — list the MCP tools in the current session's tool list and estimate their combined schema token cost.

  4. Plugin hook additionalContext — note any persistent injections (e.g., holocron's SessionStart learnings, UserPromptSubmit matches). These live in the transcript.

  5. Open file reads — list files you've Read in this session. Big unread-again files are candidates for trimming in the next session.

Output

## Context footprint (snapshot)

- Transcript:        <size> (~<tokens> tokens)
- CLAUDE.md (user):  <size> (~<tokens> tokens) — <path>
- CLAUDE.md (proj):  <size> (~<tokens> tokens) — <path>  or "(none)"
- Memory index:      <size> (~<tokens> tokens)  or "(none)"
- MCP schemas:       ~<tokens> tokens across <N> tools
- Big file reads:
  - <file> (<lines> lines, ~<tokens>)
  - ...

## Biggest offenders (trim candidates)
1. <item> — ~<tokens> tokens — trim by <action>
2. ...

Actions to suggest

  • CLAUDE.md > 1k lines → split into role-scoped files (planned for v0.3.0+).
  • MCP schemas > 8k tokens → /holocron:mcp-audit for pruning.
  • Session transcript > 150k tokens → run /holocron:handoff and start fresh.
  • One file re-read multiple times → Grep + targeted Read(offset, limit) next time.

Do not

  • Guess sizes. If you don't know, say so.
  • Recommend a rewrite of CLAUDE.md without reading it first.
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 56 lines · 36 tokens per session scan A a96c6bbbf815

Subscribe to this mod's changes

context-size is a command published in the GitHub repository atuljha23/holocron (2 stars, last pushed 4mo ago), licensed MIT. It adds 36 tokens to every session and 601 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.