explaingit

pivanov/ctx-wire

20GoAudience · developerComplexity · 2/5Setup · easy

TLDR

ctx-wire sits between your AI coding agent and shell command output, automatically trimming noise and removing secrets before they reach the agent, saving tokens and money without changing how you work.

Mindmap

mindmap
  root((ctx-wire))
    What it does
      Intercepts shell output
      Trims noise and secrets
      Saves full output to disk
    Filters
      142 built-in patterns
      326 conformance tests
      Custom project filters
    Integrations
      Claude Cursor Codex
      Gemini Copilot others
      MCP run-command tool
    Analytics
      Token savings tracking
      ASCII bar charts
      JSON and CSV export
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Reduce your monthly OpenAI or Claude API bill by filtering out verbose build logs before they reach your AI agent

USE CASE 2

Stop credentials and API keys from leaking into AI agent context windows when running shell commands

USE CASE 3

Track cumulative token savings over time and compare them against a monthly budget with a built-in reporting dashboard

Tech stack

GoMCP

Getting it running

Difficulty · easy Time to first run · 5min
No license information is stated in the repository.

In plain English

ctx-wire is a small Go program that sits between an AI coding agent and the output of shell commands. When an AI agent like Claude, Cursor, or Codex runs a command on your computer, the full raw output gets sent back to the agent as text. That text consumes tokens, which costs money and eats into the agent's context window. ctx-wire intercepts that output, trims it down using configurable filters, removes any secrets or credentials that appear in the text, and hands the agent a shorter version. The full unedited output stays saved on disk so you can look at it if something goes wrong. The project describes this as "cutting the noise on the wire." The idea is that most command output contains progress bars, redundant paths, timestamps, and other noise that the agent does not actually need to make decisions. Built-in filters cover 142 common command patterns and are tested against 326 conformance cases. You can also write your own filters per project in a local configuration file. Installation is a one-line curl command that downloads the binary to your local bin folder. After that you run ctx-wire init with the name of your agent to wire it in. The tool supports Claude, Codex, Cursor, Gemini, Copilot, and several others. Once set up, it works automatically without changing how you use your agent. The tool also tracks how much token savings you accumulate over time. You can query that history by time period, see it as an ASCII bar chart, export it as JSON or CSV, and compare it against a monthly token budget. There are diagnostic commands to explain how any given shell command would be handled, find commands that escaped filtering, and suggest filter improvements based on your actual usage history. It also supports the Model Context Protocol, exposing a run_command tool that agents can call directly over MCP rather than through shell hooks. The project is released and includes a full Go test suite plus a smoke test script that exercises the main end-to-end flows.

Copy-paste prompts

Prompt 1
I just installed pivanov/ctx-wire. Walk me through writing a custom filter file for my Go project to strip Docker build layer output before it reaches my AI agent.
Prompt 2
Using ctx-wire with Claude Code, how do I use the diagnostic command to see exactly how a specific shell command like npm install would be filtered before Claude sees it?
Prompt 3
I want to export my ctx-wire token savings history for the last 30 days as CSV and import it into a spreadsheet. Show me the exact command sequence.
Prompt 4
Show me how to configure ctx-wire's MCP server so an AI agent can call run_command directly over MCP instead of through shell hooks.
Open on GitHub → Explain another repo

← pivanov on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.