context-compress 2026.5.0 → 2026.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
3
+ "name": "context-compress",
4
+ "description": "MCP server and hook toolkit that keeps large tool output searchable instead of dumping it into context.",
5
+ "owner": {
6
+ "name": "Open330",
7
+ "url": "https://github.com/Open330"
8
+ },
9
+ "plugins": [
10
+ {
11
+ "name": "context-compress",
12
+ "description": "Compress Bash, Read, WebFetch, logs, tests, and API output before it reaches the context window.",
13
+ "source": "./",
14
+ "category": "productivity"
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "context-compress",
3
+ "version": "2026.6.0",
4
+ "description": "Keep large tool output searchable without flooding the agent context window.",
5
+ "author": {
6
+ "name": "Open330",
7
+ "url": "https://github.com/Open330"
8
+ },
9
+ "skills": "./skills/",
10
+ "hooks": "./hooks/claude-codex-hooks.json",
11
+ "mcpServers": "./.mcp.json"
12
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "context-compress",
3
+ "version": "2026.6.0",
4
+ "description": "Keep large tool output searchable without flooding the agent context window.",
5
+ "author": {
6
+ "name": "Open330",
7
+ "url": "https://github.com/Open330"
8
+ },
9
+ "homepage": "https://github.com/Open330/context-compress",
10
+ "repository": "https://github.com/Open330/context-compress",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "mcp",
14
+ "claude-code",
15
+ "context-window",
16
+ "token-optimization",
17
+ "developer-tools"
18
+ ],
19
+ "skills": "./skills/",
20
+ "mcpServers": "./.mcp.json",
21
+ "interface": {
22
+ "displayName": "Context Compress",
23
+ "shortDescription": "Compress tool output before it enters context.",
24
+ "longDescription": "Run commands, fetch pages, index large outputs, and search the retained data through an MCP server so agents see concise answers instead of raw logs.",
25
+ "developerName": "Open330",
26
+ "category": "Productivity",
27
+ "capabilities": [
28
+ "MCP",
29
+ "Skills",
30
+ "Token optimization"
31
+ ],
32
+ "websiteURL": "https://github.com/Open330/context-compress",
33
+ "brandColor": "#2563EB",
34
+ "defaultPrompt": [
35
+ "Run tests through context-compress and summarize failures.",
36
+ "Index this large output and search it for root causes.",
37
+ "Audit this session for raw tool output waste."
38
+ ]
39
+ }
40
+ }
package/.mcp.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "mcpServers": {
3
+ "context-compress": {
4
+ "cwd": ".",
5
+ "command": "node",
6
+ "args": [
7
+ "./dist/index.js"
8
+ ]
9
+ }
10
+ }
11
+ }
package/README.md CHANGED
@@ -3,16 +3,17 @@
3
3
  # context-compress
4
4
 
5
5
  **Stop drowning your AI agent in shell output.**
6
- Compress tool output before it hits the context window through an MCP server, a drop-in CLI, or both.
6
+ Large tool output stays searchablenot stuffed into the context window.
7
+ Use it through an MCP server, a drop-in CLI, agent plugins, or all three.
7
8
 
8
9
  [![CI](https://github.com/Open330/context-compress/actions/workflows/ci.yml/badge.svg)](https://github.com/Open330/context-compress/actions/workflows/ci.yml)
9
10
  [![npm version](https://img.shields.io/npm/v/context-compress?color=cb3837&logo=npm)](https://www.npmjs.com/package/context-compress)
10
11
  [![Node.js](https://img.shields.io/badge/node-%E2%89%A518-brightgreen?logo=nodedotjs&logoColor=white)](https://nodejs.org)
11
12
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
12
13
  [![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178C6?logo=typescript&logoColor=white)](tsconfig.json)
13
- [![Tests](https://img.shields.io/badge/tests-213%20passing-success)](#contributing)
14
+ [![Tests](https://img.shields.io/badge/tests-unit%20%2B%20integration-success)](#contributing)
14
15
 
15
- [Quickstart](#quickstart) · [Compression Modes](#compression-modes) · [vs RTK](#head-to-head-with-rtk) · [How It Works](#how-it-works) · [Configuration](#configuration) · [CLI](#cli) · [Changelog](CHANGELOG.md)
16
+ [Quickstart](#quickstart) · [Plugin Support](#plugin-support) · [Compression Modes](#compression-modes) · [vs RTK](#head-to-head-with-rtk) · [How It Works](#how-it-works) · [Configuration](#configuration) · [CLI](#cli) · [Changelog](CHANGELOG.md)
16
17
 
17
18
  </div>
18
19
 
@@ -27,9 +28,9 @@ Compress tool output before it hits the context window — through an MCP server
27
28
  </td>
28
29
  <td align="center" width="25%">
29
30
 
30
- **+10.5pp**
31
- <br>over RTK
32
- <br><sub>same commands</sub>
31
+ **Searchable**
32
+ <br>raw data retained
33
+ <br><sub>FTS5 + BM25</sub>
33
34
 
34
35
  </td>
35
36
  <td align="center" width="25%">
@@ -41,9 +42,9 @@ Compress tool output before it hits the context window — through an MCP server
41
42
  </td>
42
43
  <td align="center" width="25%">
43
44
 
44
- **8 MCP tools**
45
- <br>+ standalone CLI
46
- <br><sub>RTK-compatible wrap</sub>
45
+ **Plugins**
46
+ <br>Codex + Claude
47
+ <br><sub>MCP • hooks • skills</sub>
47
48
 
48
49
  </td>
49
50
  </tr>
@@ -121,6 +122,18 @@ It works in two modes that compose freely:
121
122
  npm install -g context-compress
122
123
  ```
123
124
 
125
+ ### Plugin Support
126
+
127
+ context-compress now ships plugin metadata for agent hosts:
128
+
129
+ | Host | Files | What they enable |
130
+ |:--|:--|:--|
131
+ | **Codex** | `.codex-plugin/plugin.json`, `.mcp.json`, `skills/` | MCP server registration plus skills in plugin-aware Codex flows. |
132
+ | **Claude Code** | `.claude-plugin/plugin.json`, `.claude-plugin/marketplace.json`, `hooks/claude-codex-hooks.json` | PreToolUse routing, skills, and MCP config from a plugin install. |
133
+ | **Manual / fallback** | `context-compress setup --auto` | Writes `~/.claude/settings.json` directly when plugin installation is not available. |
134
+
135
+ The plugin manifests are designed for built package/archive installs where `dist/`, `hooks/`, and `skills/` are present together. For a raw source checkout, run `npm install && npm run build` before testing the plugin locally, or use the global npm setup above.
136
+
124
137
  ### One-line setup
125
138
 
126
139
  ```bash
@@ -290,6 +303,8 @@ Without context-compress, 12 operations consume **133% of the 200K context windo
290
303
 
291
304
  **[Read the full Token Reduction Report](docs/token-reduction-report.md)** — includes cost analysis, architecture deep-dive, and FAQ on context loss trade-offs.
292
305
 
306
+ **[Read the Agentic Benchmark Plan](docs/agentic-benchmark.md)** — defines the fair on/off benchmark for real Claude Code sessions, including baseline isolation, task success checks, and reporting limits.
307
+
293
308
  ---
294
309
 
295
310
  ## What Changed from context-mode
@@ -335,8 +350,8 @@ CONTEXT_COMPRESS_NUDGE_GREP=0
335
350
  # Compression mode: conservative | balanced (default) | aggressive | auto
336
351
  CONTEXT_COMPRESS_MODE=balanced
337
352
 
338
- # Auto mode prefers the Anthropic API when this is set (faster than `claude -p` fallback)
339
- ANTHROPIC_API_KEY=sk-ant-...
353
+ # Auto mode prefers the Anthropic API when ANTHROPIC_API_KEY is set
354
+ # in your shell or secret manager (faster than `claude -p` fallback)
340
355
 
341
356
  # RTK-style transparent Bash wrapping (default: off)
342
357
  CONTEXT_COMPRESS_FILTER_BASH=1
@@ -448,7 +463,7 @@ context-compress/
448
463
  │ ├── doctor.ts # `doctor` — diagnostics
449
464
  │ └── uninstall.ts # `uninstall` — clean removal
450
465
  ├── tests/
451
- │ ├── unit/ # 18 unit test files (213 tests, all passing)
466
+ │ ├── unit/ # 18 unit test files
452
467
  │ └── integration/ # 3 integration test files
453
468
  ├── scripts/
454
469
  │ ├── benchmark.ts # Synthetic compression benchmark
@@ -516,6 +531,8 @@ RTK_BIN=... tsx scripts/benchmark-vs-rtk.ts --auto # also run LLM-judged auto
516
531
  RTK_BIN=... tsx scripts/benchmark-vs-rtk.ts --json # machine-readable
517
532
  ```
518
533
 
534
+ For real agent sessions, use [docs/agentic-benchmark.md](docs/agentic-benchmark.md) to compare baseline, MCP-only, hook-balanced, and hook-aggressive arms with isolated settings.
535
+
519
536
  ---
520
537
 
521
538
  ## License
@@ -0,0 +1,110 @@
1
+ # Agentic Benchmark Plan
2
+
3
+ This benchmark measures context-compress in real agent sessions, not synthetic command output alone.
4
+
5
+ The claim to test:
6
+
7
+ > Large tool output should stay searchable outside the conversation, while the agent still solves the same task with less context pressure.
8
+
9
+ ## Why This Exists
10
+
11
+ `docs/token-reduction-report.md` measures byte and token reduction for common operations. That is necessary, but it does not fully answer whether an agent remains effective across a real coding task.
12
+
13
+ This benchmark adds the missing layer: run the same task with and without context-compress, isolate each arm, and compare context usage, task success, cost, and time.
14
+
15
+ ## Arms
16
+
17
+ | Arm | Setup | Purpose |
18
+ | --- | --- | --- |
19
+ | `baseline` | No context-compress MCP, no hook | Measures normal agent behavior. |
20
+ | `mcp-only` | MCP server registered, no PreToolUse hook | Measures explicit tool adoption. |
21
+ | `hook-balanced` | MCP plus PreToolUse hook, `CONTEXT_COMPRESS_MODE=balanced` | Default recommended setup. |
22
+ | `hook-aggressive` | MCP plus PreToolUse hook, `CONTEXT_COMPRESS_MODE=aggressive` | Maximum compression trade-off. |
23
+
24
+ Each arm must run in a fresh workspace with isolated agent settings. Do not allow global plugins, global MCP servers, or previous conversation state to leak into the run.
25
+
26
+ ## Task Set
27
+
28
+ Use tasks that naturally produce large outputs:
29
+
30
+ 1. Diagnose a failing test suite and patch the root cause.
31
+ 2. Review a multi-commit diff and summarize risky changes.
32
+ 3. Inspect a large API response and implement one missing field mapping.
33
+ 4. Analyze a generated Playwright snapshot and fix one selector bug.
34
+ 5. Audit dependency output and identify one vulnerable or outdated package.
35
+ 6. Search a large log file and explain the first recurring failure.
36
+
37
+ Pin every input repository and fixture by commit hash. Preserve every run directory so metrics can be recomputed.
38
+
39
+ ## Metrics
40
+
41
+ | Metric | How to collect |
42
+ | --- | --- |
43
+ | Context bytes returned by tools | Sum raw tool payloads in agent logs. |
44
+ | Compressed bytes returned | Sum context-compress tool responses. |
45
+ | Indexed bytes | Use `stats` output and session DB stats. |
46
+ | Task success | Deterministic test, assertion, or scorer per task. |
47
+ | Cost/time | Agent runner JSON output when available. |
48
+ | Follow-up retrieval quality | Count whether the final answer cites indexed/search results when needed. |
49
+
50
+ Report raw numbers and relative deltas. Do not only report the best percentage.
51
+
52
+ ## Isolation Rules
53
+
54
+ - Use a new temp workspace for every `(task, arm, run)` cell.
55
+ - Disable user/global plugin sources for the baseline arm.
56
+ - Install exactly the intended plugin or MCP config for non-baseline arms.
57
+ - Clear persistent context-compress DBs between runs unless the task explicitly tests persistence.
58
+ - Keep model, prompt, timeout, and working tree identical across arms.
59
+ - Record the exact agent version, model, OS, Node version, and context-compress version.
60
+
61
+ ## Safety Checks
62
+
63
+ Compression must not hide important failures. Every task needs one deterministic scorer:
64
+
65
+ - tests pass after the agent patch,
66
+ - expected files changed and unrelated files did not,
67
+ - security-relevant details are still retrievable with `search`,
68
+ - final answer includes the actual root cause, not just a compressed summary.
69
+
70
+ If an arm uses fewer tokens but fails the scorer, mark it as a failure, not a win.
71
+
72
+ ## Reporting Template
73
+
74
+ ```md
75
+ # Agentic benchmark: context-compress on real coding tasks
76
+
77
+ Date:
78
+ Agent:
79
+ Model:
80
+ context-compress:
81
+ Repo/fixture commits:
82
+
83
+ ## Summary
84
+
85
+ | Arm | Success | Tool bytes in context | Indexed bytes | Cost | Time |
86
+ | --- | ---: | ---: | ---: | ---: | ---: |
87
+
88
+ ## Per-task Results
89
+
90
+ | Task | Arm | Success | Tool bytes | Indexed bytes | Notes |
91
+ | --- | --- | ---: | ---: | ---: | --- |
92
+
93
+ ## Failures And Limits
94
+
95
+ - What failed:
96
+ - What this benchmark does not prove:
97
+ - Known nondeterminism:
98
+ ```
99
+
100
+ ## Reproduce
101
+
102
+ Until this harness is automated, run the benchmark manually with:
103
+
104
+ ```bash
105
+ npm run build
106
+ context-compress setup --auto
107
+ CONTEXT_COMPRESS_MODE=balanced context-compress doctor
108
+ ```
109
+
110
+ Then run each task in isolated agent settings and attach the resulting logs plus `context-compress stats` output to the benchmark result.
@@ -0,0 +1,19 @@
1
+ {
2
+ "description": "context-compress PreToolUse hooks for Claude-compatible plugin hosts",
3
+ "hooks": {
4
+ "PreToolUse": [
5
+ {
6
+ "matcher": "Bash|Read|Grep|WebFetch|Task",
7
+ "hooks": [
8
+ {
9
+ "type": "command",
10
+ "command": "command -v node >/dev/null 2>&1 && CONTEXT_COMPRESS_FILTER_BASH=1 CONTEXT_COMPRESS_BIN=\"node ${CLAUDE_PLUGIN_ROOT}/dist/cli/index.js\" node \"${CLAUDE_PLUGIN_ROOT}/hooks/pretooluse.mjs\" || exit 0",
11
+ "commandWindows": "if (Get-Command node -ErrorAction SilentlyContinue) { $env:CONTEXT_COMPRESS_FILTER_BASH='1'; $env:CONTEXT_COMPRESS_BIN='context-compress'; node \"$env:CLAUDE_PLUGIN_ROOT\\hooks\\pretooluse.mjs\" }",
12
+ "timeout": 5,
13
+ "statusMessage": "Protecting context window..."
14
+ }
15
+ ]
16
+ }
17
+ ]
18
+ }
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-compress",
3
- "version": "2026.5.0",
3
+ "version": "2026.6.0",
4
4
  "description": "Context-aware MCP server that compresses tool output for Claude Code",
5
5
  "type": "module",
6
6
  "main": "dist/server.js",
@@ -38,6 +38,9 @@
38
38
  "typescript": "^5.7.0"
39
39
  },
40
40
  "files": [
41
+ ".codex-plugin/",
42
+ ".claude-plugin/",
43
+ ".mcp.json",
41
44
  "dist/",
42
45
  "docs/",
43
46
  "hooks/",
@@ -46,10 +49,10 @@
46
49
  "README.md"
47
50
  ],
48
51
  "license": "MIT",
49
- "repository": {
50
- "type": "git",
51
- "url": "https://github.com/Open330/context-compress"
52
- },
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "git+https://github.com/Open330/context-compress.git"
55
+ },
53
56
  "keywords": [
54
57
  "mcp",
55
58
  "claude",
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: context-compress-audit
3
+ description: Audit a repository, plugin setup, or agent session for raw Bash, Read, WebFetch, and MCP outputs that should be routed through context-compress instead. Use when asked to find context waste, raw tool output waste, missing plugin routing, or places where large command/file/web output still enters the agent context window.
4
+ ---
5
+
6
+ # Context-Compress Audit
7
+
8
+ Find places where large raw output can still enter the agent context window.
9
+
10
+ ## Procedure
11
+
12
+ 1. Run `mcp__context-compress__stats` first if the tool is available.
13
+ 2. Inspect setup surfaces that control routing:
14
+ - `.codex-plugin/plugin.json`
15
+ - `.claude-plugin/plugin.json`
16
+ - `.mcp.json`
17
+ - `hooks/`
18
+ - `skills/`
19
+ - README install instructions
20
+ 3. Search for risky guidance or examples that encourage raw output:
21
+ - `Bash` for tests, logs, `git log`, `git diff`, `curl`, `kubectl`, `docker`, `npm test`
22
+ - `Read` for large logs, bundled files, snapshots, CSV/JSON dumps
23
+ - `WebFetch` for documentation pages that should use `fetch_and_index`
24
+ - Playwright snapshots without a file/index/search path
25
+ 4. Report only actionable findings. Prefer one-line fixes that route work through:
26
+ - `batch_execute` for several commands plus searches
27
+ - `execute` for command/API output that must be analyzed first
28
+ - `execute_file` for large local files
29
+ - `fetch_and_index` plus `search` for web documentation
30
+
31
+ ## Output
32
+
33
+ Use this format:
34
+
35
+ ```md
36
+ ## Context-Compress Audit
37
+
38
+ - [severity] file:line - raw-output risk. Replace with <tool/workflow>.
39
+ - [severity] file:line - missing install/routing coverage. Add <specific fix>.
40
+
41
+ Summary: <N> findings, estimated impact <low|medium|high>.
42
+ ```
43
+
44
+ Severity:
45
+ - `high`: large output can enter context by default.
46
+ - `medium`: docs/examples teach a wasteful path.
47
+ - `low`: minor wording, missing cross-link, or optional setup gap.
48
+
49
+ If nothing meaningful is found, say `No raw-output waste found. Routing looks covered.`
@@ -0,0 +1,13 @@
1
+ interface:
2
+ display_name: "Context Compress Audit"
3
+ short_description: "Find raw-output context waste."
4
+ default_prompt: "Use $context-compress-audit to audit this project for raw tool output waste and missing routing."
5
+
6
+ dependencies:
7
+ tools:
8
+ - type: "mcp"
9
+ value: "context-compress"
10
+ description: "Context-compress MCP server for stats and indexed search."
11
+
12
+ policy:
13
+ allow_implicit_invocation: true