This directory is for local system-prompt captures from Claude Code and OpenCode via HTTPS traffic interception. These captures are useful for understanding what each tool actually sends to the Anthropic API, comparing differences, and ensuring our proxy transforms are accurate.
Extracted capture text and raw mitmproxy flow files are local diagnostics and are ignored by git.
Naming convention: <tool>-v<version>.txt
- Install mitmproxy:
brew install mitmproxy- Generate the CA certificate (run once, then Ctrl-C):
mitmdump- Optionally trust the cert in the macOS system keychain (needed for browser-based OAuth flows):
sudo security add-trusted-cert -d -r trustRoot \
-k /Library/Keychains/System.keychain \
~/.mitmproxy/mitmproxy-ca-cert.pemThe capture script sets NODE_EXTRA_CA_CERTS automatically, so Node-based CLIs (Claude Code, OpenCode) will trust the cert without the system keychain step.
Use scripts/capture-with-mitmproxy.sh to run a CLI command through the proxy:
# Capture OpenCode traffic
./scripts/capture-with-mitmproxy.sh -o opencode.flow -- opencode run "say hello"
# Capture Claude Code traffic
./scripts/capture-with-mitmproxy.sh -o claude.flow -- claude -p "say hello"This starts a local mitmproxy instance, routes the child command's HTTPS traffic through it, and writes captured flows to a .flow file. The proxy shuts down when the child command exits.
Use scripts/extract-system-prompt.ts to pull the system prompt text from a .flow file:
bun run scripts/extract-system-prompt.ts opencode.flow -o captures/opencode-v1.4.0.txt
bun run scripts/extract-system-prompt.ts claude.flow -o captures/claude-code-v2.1.87.txtThe script finds the /v1/messages request with the largest system prompt (skipping title generators and other small requests), concatenates all system text blocks, and writes the result.
Before committing, redact personal info with obvious placeholders:
| Pattern | Replacement |
|---|---|
/Users/<username> |
/Users/REDACTED |
| OAuth tokens | sk-ant-REDACTED |
Session IDs (ses_...) |
ses_REDACTED |
| Org/account UUIDs | 00000000-0000-0000-0000-000000000000 |
| Branch names containing usernames | REDACTED/example-branch |
| Memory paths with encoded usernames | Replace username with REDACTED |
The goal is to make redactions obviously fake so nobody mistakes them for real credentials.
If you still have the .flow files (they're gitignored), you can inspect them with mitmproxy's tools:
# Web UI
mitmweb -r claude.flow
# Text dump filtered to /v1/messages, full detail
mitmdump -nr claude.flow --flow-detail 4 "~u /v1/messages"
# Side-by-side diff of two captures
diff <(mitmdump -nr claude.flow --flow-detail 4 "~u /v1/messages" 2>/dev/null) \
<(mitmdump -nr opencode.flow --flow-detail 4 "~u /v1/messages" 2>/dev/null)