forge-context-status

A read-only command that reports estimated conversation-context usage, cache status, and whether the session may need compaction. Context is the amount of conversation and project information the agent can keep available.

In plain words
What is it for?
Use it to inspect approximate context consumption, cache health, recent session edits, and the recommendation for continuing or compacting the session.
Why use it?
It helps identify when a session is becoming too large or tool reads may be slower, before that affects the agent’s work.

Command

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/luiseiman/dotforge/forge-context-status
Clone the repo
git clone --depth 1 https://github.com/luiseiman/dotforge
Per session 26 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 508 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00026 $0.00508
Opus 5 $0.00013 $0.00254
Sonnet 5 $0.00005 $0.00102
Haiku 4.5 $0.00003 $0.00051

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

Security

Grade B, and why

forge-context-status scanned grade B with 1 finding 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 2d 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

Detect model from `~/.claude/settings.json` `model` field if available, default to 1M.
global/commands/forge-context-status.md · 38 lines

What it actually says

Read the current session transcript file (path is in the runtime — check $CLAUDE_TRANSCRIPT_PATH env var, or fall back to .claude/session/last-startup.md for the working tree state). Estimate context usage with this approach:

  1. Token estimation (proxy): use wc -c on the transcript file (if accessible), divide bytes by 5 for rough token count. This is approximate — actual context = transcript content + system prompt + memory injections.

  2. Context limit by model:

    • Sonnet 4.6 / Opus 4.7: 1M tokens → 80% threshold = 800K
    • Haiku 4.5: 200K tokens → 80% threshold = 160K Detect model from ~/.claude/settings.json model field if available, default to 1M.
  3. Cache health proxy: read /tmp/claude-tool-latency-<hash> (the project hash file written by tool-latency.sh). Latency p50 << 100ms on Read/Edit suggests hot cache. p50 > 500ms suggests cache miss / cold reads.

  4. Recent edits volume: count modifications in .claude/session/ and .git/index.lock recency.

Output a tight report:

═══ CONTEXT STATUS ═══
Model:               Sonnet 4.6 (1M context)
Estimated usage:     ~XX% (≈Y tokens)
Cache health proxy:  hot | warm | cold (based on tool latency p50)
Files modified:      N this session
Last compact:        <timestamp from .claude/session/last-compact.md, or "none">
Behaviors disabled:  <list from session state>

── RECOMMENDATION ──
< 70%:  Continue working
70-80%: Monitor; consider /forge compact-task at next task break
> 80%:  /forge compact-task NOW (evidence-based threshold)
> 90%:  /forge compact-task URGENT or risk auto-compact mid-task

Be honest about the estimation — token count is a proxy, not exact. If estimate seems off, mention it.

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. 2d ago First seen · 38 lines · 26 tokens per session scan B 6a205b217375

Subscribe to this mod's changes

forge-context-status is a command published in the GitHub repository luiseiman/dotforge (8 stars, last pushed 2mo ago), licensed MIT. It adds 26 tokens to every session and 508 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other commands, from other repositories