Mcp Context Monitor — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Mcp Context Monitor (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Context window usage estimation for AI coding agents via MCP.
Parses your session transcript to estimate how close you are to context compaction, so agents can proactively save important state before it's lost. Supports Claude Code and Codex CLI backends with auto-detection.
AI coding agents accumulate context through conversation, tool calls, and file reads. When the context window fills up, compaction discards older content. Agents that know compaction is coming can write key insights to persistent storage first — memory queues, documents, knowledge graphs — instead of losing them silently.
Requires Python 3.11+ and uv.
git clone https://github.com/sophia-labs/mcp-context-monitor.git
cd mcp-context-monitor
uv syncAdd to ~/.claude.json:
{
"mcpServers": {
"context-monitor": {
"type": "stdio",
"command": "uv",
"args": ["run", "--directory", "/path/to/mcp-context-monitor", "python", "server.py"]
}
}
}Add to ~/.codex/config.toml:
[mcp_servers.context-monitor]
command = "uv"
args = ["run", "--directory", "/path/to/mcp-context-monitor", "python", "server.py"]The backend is auto-detected based on which CLI has the most recent transcript.
Call context_status() from your agent:
{
"status": "HIGH",
"usage_percent": 73.9,
"compaction_percent": 88.5,
"estimated_tokens_used": 147780,
"estimated_tokens_remaining": 19220
}| Status | Compaction % | Recommended Action |
|---|---|---|
| OK | < 50% | Normal operation |
| MODERATE | 50–75% | Be aware, no action needed |
| HIGH | 75–90% | Start saving important state to persistent storage |
| CRITICAL | 90%+ | Save everything immediately — compaction is imminent |
context_status() periodically during long sessionscompaction_percent measures distance to the compaction trigger, not the total windowCreate ~/.config/context-monitor/config.toml:
# Backend selection: "auto", "claude-code", or "codex-cli"
[backend]
type = "auto"
# Claude Code settings
[claude-code]
context_window = 200000
autocompact_buffer = 33000
static_overhead = 43500
bytes_per_token = 3.2
# transcript_dir = "~/.claude/projects"
# Codex CLI settings
[codex-cli]
context_window = 400000
max_output_tokens = 128000
autocompact_ratio = 0.95
static_overhead = 30000
bytes_per_token = 3.2
# transcript_dir = "~/.codex/sessions"| Variable | Description |
|---|---|
CONTEXT_MONITOR_BACKEND | Force backend: claude-code or codex-cli |
CONTEXT_MONITOR_WINDOW | Context window size (tokens) |
CONTEXT_MONITOR_BUFFER | Autocompact buffer (tokens) |
CONTEXT_MONITOR_OVERHEAD | Static overhead estimate (tokens) |
CONTEXT_MONITOR_BPT | Bytes-per-token ratio |
CONTEXT_MONITOR_TRANSCRIPT | Explicit transcript file path |
CONTEXT_MONITOR_PROJECT_DIR | Transcript directory |
turn_complete events when availableMIT — see LICENSE.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.