liaohch3/claude-tap

Intercept and inspect Coding Agent API traffic from Claude Code, Codex CLI, Gemini CLI, Cursor CLI, OpenCode, Kimi/Kimi Code, Pi, and Hermes in a local trace viewer.

What it solves

claude-tap provides a way to inspect the internal workings of AI coding agents. It solves the "black box" problem where users cannot see the exact system prompts, tool calls, and conversation history being sent to the LLM by CLI-based agents like Claude Code, Codex, or Gemini CLI.

How it works

It acts as a local proxy and trace viewer. By running an AI agent CLI through claude-tap, the tool intercepts the API traffic between the agent and the LLM provider. It can operate in reverse-proxy mode (redirecting the agent's base URL to localhost) or forward-proxy mode (injecting HTTPS_PROXY and a local CA certificate). The captured traffic is then presented in a live browser-based viewer or exported as a portable HTML file for review.

Who it’s for

  • Developers using AI coding agents who want to debug agent behavior.
  • Prompt Engineers who need to see exactly how system prompts and tool schemas are constructed.
  • Researchers archiving versioned system prompt snapshots from various agent CLIs.

Highlights

  • Broad Client Support: Works with a wide array of agents including Claude Code, Codex, Gemini CLI, Grok Build, Kimi, Cursor CLI, and others.
  • Deep Inspection: Captures system prompts, tool definitions, tool calls, streaming responses, and token usage.
  • Request Diffing: Allows users to compare adjacent requests to pinpoint exactly what changed in the prompt or context between turns.
  • Privacy-Focused: Traces are stored locally on the user's machine, and common authentication headers are redacted before recording.
  • Portable Artifacts: Sessions can be exported as self-contained HTML files for easy sharing or archiving.