mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-06-13 11:41:22 +08:00
fix: context-size /compact trigger, Codex marketplace plugin path, live README badges (#2237)
- suggest-compact hook now reads the latest usage record from the session transcript and suggests /compact at a window-scaled token threshold (160k/200k window, 250k/1M window; COMPACT_CONTEXT_THRESHOLD and COMPACT_CONTEXT_INTERVAL overridable), re-firing per 60k-token growth bucket; tool-call count stays as the secondary signal (#2155) - Codex repo marketplace now points at ./plugins/ecc instead of ./ — Codex never discovers plugins whose local marketplace source.path is the marketplace root (verified on Codex CLI 0.137.0); plugins/ecc is a thin folder referencing root skills/.mcp.json per maintainer direction on #2097; docs flag plugin mode as experimental with the upstream blocker openai/codex#26037 linked (#2128) - README badges for installs/stars/forks now use shields endpoint badges backed by api.ecc.tools (live install count 3,712 vs the stale static 150), which also eliminates shields' 'Unable to select next GitHub token from pool' render in the stars badge Closes #2155 Closes #2128
This commit is contained in:
@@ -30,11 +30,12 @@ Strategic compaction at logical boundaries:
|
||||
|
||||
## How It Works
|
||||
|
||||
The `suggest-compact.js` script runs on PreToolUse (Edit/Write) and:
|
||||
The `suggest-compact.js` script runs on PreToolUse (Edit/Write) and combines two signals:
|
||||
|
||||
1. **Tracks tool calls** — Counts tool invocations in session
|
||||
2. **Threshold detection** — Suggests at configurable threshold (default: 50 calls)
|
||||
3. **Periodic reminders** — Reminds every 25 calls after threshold
|
||||
1. **Context size (primary)** — Reads the latest `usage` record from the session transcript (`transcript_path` in the hook payload) and sums `input_tokens + cache_read_input_tokens + cache_creation_input_tokens` (the true context size of the turn). Suggests `/compact` at a window-scaled threshold — 160k tokens on a 200k window, 250k on a 1M window (detected from a `[1m]` model marker, or inferred when observed tokens already exceed 200k) — and re-reminds after every additional 60k tokens of context growth
|
||||
2. **Tool-call count (secondary)** — Counts tool invocations in session; suggests at a configurable threshold (default: 50 calls), then every 25 calls after
|
||||
|
||||
Tool count alone is a weak proxy for window pressure: a few large file reads or MCP responses can fill the window in very few calls, while many tiny calls can cross 50 with a near-empty window. The context-size signal fires when it actually matters.
|
||||
|
||||
## Hook Setup
|
||||
|
||||
@@ -61,6 +62,9 @@ Add to your `~/.claude/settings.json`:
|
||||
|
||||
Environment variables:
|
||||
- `COMPACT_THRESHOLD` — Tool calls before first suggestion (default: 50)
|
||||
- `COMPACT_CONTEXT_THRESHOLD` — Context tokens before the context-size suggestion (default: 160000 on a 200k window, 250000 on a 1M window; `0` disables the context signal)
|
||||
- `COMPACT_CONTEXT_INTERVAL` — Additional context tokens before the suggestion repeats (default: 60000)
|
||||
- `COMPACT_STATE_TTL_DAYS` — Days before stale per-session state files in the temp dir are swept (default: 14)
|
||||
|
||||
## Compaction Decision Guide
|
||||
|
||||
|
||||
Reference in New Issue
Block a user