Getting it into your agent
This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.
/plugin marketplace add athola/claude-night-market/plugin install conserveWrote 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.
[](https://agentmods.dev/commands/athola/claude-night-market/optimize-context)<a href="https://agentmods.dev/commands/athola/claude-night-market/optimize-context"><img src="https://agentmods.dev/badge/commands/athola/claude-night-market/optimize-context.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00014 | $0.00624 |
| Opus 5 | $0.00007 | $0.00312 |
| Sonnet 5 | $0.00003 | $0.00125 |
| Haiku 4.5 | $0.00001 | $0.00062 |
Grade A, and why
optimize-context 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.
How it starts
The opening of the file, as written. The whole thing — 104 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Optimize Context Usage
Analyzes context window usage and provides optimization recommendations based on Maximum Effective Context Window (MECW) principles.
Usage
# Analyze current session context
/optimize-context
# Analyze specific skill or directory
/optimize-context skills/my-skill
# Deep analysis with recommendations
/optimize-context --detailed
What It Does
- Context Pressure Assessment: Evaluates current context utilization
- MECW Compliance Check: Validates against MECW principles
- Optimization Recommendations: Suggests specific improvements
- Token Budget Analysis: Breaks down token usage by component
MECW Thresholds
| Utilization | Status | Action |
|---|---|---|
| < 30% | Optimal | No action needed |
| 30-50% | Good | Monitor growth |
| 50-70% | Warning | Consider optimization |
| > 70% | Critical | Immediate action required |
Examples
/optimize-context
# Output:
# Context Optimization Report
# ==========================
# Current Usage: 45% (Good)
# Estimated Tokens: 12,500
#
# Recommendations:
# - Consider extracting code examples to scripts/
# - 3 skills exceed recommended token budget
/optimize-context skills/context-optimization --detailed
# Full breakdown with per-module analysis
Headless Mode (Non-Interactive)
For reading context in headless/automated Claude Code sessions:
# Get context breakdown with JSON output
claude -p "run /context" --verbose --output-format json
# Two-call pattern for reliable execution
# (Claude doesn't always execute /context on first prompt)
SESSION_ID=$(claude -p "ready" --output-format json | jq -r '.session_id')
claude --continue "$SESSION_ID" -p "/context" --verbose --output-format json
Key flags:
--verbose: Includes categorical token breakdown--output-format json: Machine-parseable output--continue: Resumes existing session for reliable command execution
Example JSON output:
{
"context": {
"total_tokens": 45000,
"usage_percent": 22.5,
"breakdown": {
"system": 8000,
"conversation": 32000,
"tools": 5000
}
}
}
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.
- 4d ago First seen · 104 lines · 14 tokens per session scan A 789de9e5a743
optimize-context is a command published in the GitHub repository athola/claude-night-market (335 stars, last pushed yesterday), licensed MIT. It adds 14 tokens to every session and 624 once invoked, about $0.0001 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-09-03.
Other commands, from other repositories
analyze-codebase
Generate comprehensive analysis and documentation of entire codebase.
prompt
System instructions for writing effective prompts. Apply when generating commands, skills, agents, or any LLM instructions.
anti-slop-designer
Use when a UI looks machine-made rather than decided. Violet gradients, glassmorphism everywhere, identical cards in a grid, untouched shadcn or Material defaults, emoji bullets, or copy stuffed with seamless and unlock.
debug-session
Start a comprehensive debugging session.
plan
For easy problems, start here. For harder problems, do this after Explore.
design-critic
Use when you want an honest read on a design instead of encouragement. What is wrong, ranked by severity, with the reason attached. Works on a screenshot, a mockup, or a described screen.