Skip to content

feat: optional intercepting proxy for agent traffic (#50)#86

Merged
itscooleric merged 1 commit intodevfrom
feat/intercept-proxy-50
Mar 17, 2026
Merged

feat: optional intercepting proxy for agent traffic (#50)#86
itscooleric merged 1 commit intodevfrom
feat/intercept-proxy-50

Conversation

@itscooleric
Copy link
Copy Markdown
Owner

Summary

mitmproxy-based HTTP(S) interceptor for deep agent traffic analysis.

  • intercept-proxy.py — mitmproxy addon that logs request/response metadata to JSONL
  • intercept-start.sh — starts the proxy, exports HTTP(S)_PROXY env vars
  • Auto-starts from claude-entrypoint.sh when CLIDE_INTERCEPT=1
  • Secret redaction on API keys, tokens, auth headers
  • Optional body capture with CLIDE_INTERCEPT_BODIES=1
  • mitmproxy 11.1.3 added to Dockerfile (in pyenv)

Example output

{"event": "intercept_request", "method": "POST", "url": "https://api.anthropic.com/v1/messages",
 "host": "api.anthropic.com", "status_code": 200, "request_size": 4521, "response_size": 1893,
 "duration_ms": 2341, "request_headers": {"authorization": "[REDACTED:Bearer...]"}}

Observability stack now

Feature Env var Output
Session logging (always on) events.jsonl + conversation.jsonl
Token/cost tracking (always on) session_end event
Egress audit CLIDE_EGRESS_AUDIT=1 egress.jsonl
Intercept proxy CLIDE_INTERCEPT=1 intercept.jsonl

Closes #50

Test plan

  • CI checks pass
  • Build with mitmproxy doesn't bloat image excessively
  • Claude session works with proxy enabled
  • intercept.jsonl captures API calls with redacted secrets

🤖 Generated with Claude Code

mitmproxy-based HTTP(S) interceptor that logs all agent traffic to
.clide/logs/intercept.jsonl with:
- Method, URL, host, path, status code
- Request/response headers (secrets auto-redacted)
- Request/response sizes, duration
- Optional body capture (CLIDE_INTERCEPT_BODIES=1)

Opt-in via CLIDE_INTERCEPT=1 in .env. Starts automatically before
the agent in claude-entrypoint.sh, sets HTTP(S)_PROXY env vars so
agent tools route through the proxy transparently.

Includes secret redaction for API keys, tokens, and auth headers.

Closes #50

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@itscooleric itscooleric merged commit 6f018e8 into dev Mar 17, 2026
4 checks passed
@itscooleric itscooleric deleted the feat/intercept-proxy-50 branch March 17, 2026 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant