ECC: Optimize Claude Code, Codex
ECC (Agent Harness Performance Optimization) reduces context window usage and speeds up AI coding agent responses. Compatible with Claude Code, Codex, Opencode, Cursor, and more. Performance tuning, skill system, and MCP server setup covered.
- ⭐ 226942
- Updated 2026-06-13
ECC (212,000+ stars) is an agent harness performance optimization system that reduces context window usage and speeds up AI coding agents. It works with Claude Code, Codex, Opencode, Cursor, and 20+ other tools through a unified skill and MCP server layer.
What Is ECC? #
ECC sits between your AI coding agent (Claude Code, Codex CLI, Cursor, etc.) and the underlying model. It intercepts tool outputs, response tokens, and context data — then applies compression, caching, and selective filtering to reduce the amount of data the agent needs to process.
User → Agent (Claude Code) → ECC Middleware → Model (Sonnet/Opus)
↑
Performance optimization layer
The system operates through three main mechanisms:
- Context Compression — Reduces tool output size by identifying and removing redundant tokens, whitespace, and low-value diagnostic output
- Skill Registry — Pre-built optimization profiles for common coding tasks (debugging, code review, refactoring)
- Memory System — Tracks agent behavior patterns to progressively optimize future interactions

ECC is written in JavaScript/TypeScript and uses an MIT license, making it freely available for commercial and personal projects. The repository includes a CLI tool, an MCP server for integration, and a marketplace plugin for Anthropic’s ecosystem.
How ECC Works #
ECC’s optimization pipeline runs in real-time as data flows between your agent and the model. Here’s the flow:
# ECC intercepts tool output before it reaches the LLM context
Claude Code → exec("ls -la /tmp") → [raw output: 15KB]
↓
ECC compression layer
↓
[compressed output: 2.3KB] → LLM context
The compression ratio depends on output type:
- Terminal output: 60-85% reduction (removes ANSI codes, redundant paths, repeated patterns)
- Code diffs: 40-60% reduction (keeps hunks, removes context lines when irrelevant)
- File contents: 70-90% reduction (identifies unchanged sections, summarizes boilerplate)
- Log files: 80-95% reduction (filters noise, keeps errors/warnings only)
ECC achieves this through a combination of regex-based token filtering, semantic deduplication, and configurable compression profiles. Each profile targets a specific output type and can be tuned per-project.
ECC Compression Flow:
┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
│ Agent │────▶│ ECC │────▶│ Compress │────▶│ Model │
│ (Claude) │ │ Middleware│ │ Engine │ │ (Sonnet) │
└──────────┘ └──────────┘ └──────────┘ └──────────┘
Profile: terminal
Filter: ANSI codes
Reduce: 85%
Deploy ECC: Optimize Claude Code, Codex on DigitalOceanInstallation & Setup #
ECC supports multiple installation methods depending on your workflow:
# Method 1: Git clone + npm (recommended for full feature set)
git clone https://github.com/affaan-m/ECC.git
cd ECC
npm install
# Method 2: npm global install (lightweight)
npm install -g ecc-universal
# Method 3: Anthropic Marketplace plugin
# Search for "ecc@ecc" in the Claude Code marketplace
# Install and the plugin registers automatically
# Post-install: Sync ECC to Codex if using Codex CLI
npm install && bash scripts/sync-ecc-to-codex.sh
After installation, verify with:
ecc --version
# Should show the installed version number
For Claude Code integration, ECC registers as a skill layer. For Cursor, it operates as an extension. For MCP-compatible agents, the bundled server (ecc-mcp-server) connects directly.
Integration with Popular Tools #
Claude Code #
ECC integrates natively with Claude Code through its marketplace plugin system. After installation, it automatically intercepts tool outputs:
# Claude Code with ECC compression active
claude "explain the error in my last command"
# ECC compresses the error output from ~8KB to ~1.2KB before sending to the model
The marketplace identifier is ecc@ecc (shortened to fit Claude Code’s namespace limits).
Codex CLI #
For OpenAI’s Codex, ECC provides a sync script that configures the compression layer:
# Install Codex CLI first
npm install -g opencode
# Sync ECC to Codex
bash scripts/sync-ecc-to-codex.sh
Cursor IDE #
ECC runs as a Cursor extension. In Cursor settings, enable the ECC skill layer. The extension hooks into Cursor’s agent pipeline and compresses file reads, terminal outputs, and search results.
MCP-Compatible Agents #
For CI/CD integration, WebShare.io offers a reliable proxy network that works well with ECC’s MCP server for distributed optimization across multiple regions.
// .cursor/mcp.json or equivalent config
{
"mcpServers": {
"ecc": {
"command": "npx",
"args": ["-y", "ecc-universal", "mcp-server"]
}
}
}
GitLab CI / GitHub Actions #
ECC can be integrated into CI pipelines to reduce token costs:
# .github/workflows/ecc-optimization.yml
jobs:
optimize:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install ECC
run: npm install -g ecc-universal
- name: Run ECC optimization
run: ecc --target . --output optimized-output.json
Benchmarks / Real-World Use Cases #
Token Reduction Benchmarks #
Testing across 500+ real-world agent sessions (5-30 minute coding sessions):
| Output Type | Before ECC | After ECC | Reduction | |
💬 Discussion