Cordon integrates with Claude Code so your AI agent can make authenticated API calls without holding real credentials.Documentation Index
Fetch the complete documentation index at: https://docs.codezero.io/llms.txt
Use this file to discover all available pages before exploring further.
Scope
Claude Code setup defaults to project scope:cordon.toml lives in $CWD, and settings are written to $CWD/.claude/settings.local.json. This keeps credentials and proxy configuration isolated per repository and per checkout — settings.local.json is Claude Code’s gitignored-by-convention override file, so git worktrees do not inherit stale proxy env vars from a tracked settings.json.
To share a single cordon configuration across all projects, use user scope:
$HOME/.claude/settings.json and stores config at $XDG_CONFIG_HOME/cordon/cordon.toml. See Scopes for path details and trade-offs.
Automated setup
The fastest way to get started:- Generates CA certificates (if not already present)
- Creates a scaffold
cordon.toml - Generates the standard proxy and CA env vars from
cordon env - Configures Claude Code’s settings file (
.claude/settings.local.jsonfor project scope,~/.claude/settings.jsonfor user scope) and addsNODE_OPTIONSwhen the Node bootstrap loader is discoverable - Installs a health-check hook that blocks Claude Code when cordon is not running
- Installs a cordon agent skill (
.claude/skills/cordon/SKILL.mdfor project scope,~/.claude/skills/cordon/SKILL.mdfor user scope) - Offers to add routes and store secrets interactively (post-setup wizard)
<name>.cordon.bak before any changes are made. If setup detects cordon env vars in a project’s tracked settings.json (from a pre-fix install), they are migrated into settings.local.json automatically during the next cordon setup claude-code run.
To run cordon as a background service, run cordon service install after setup (add --scope user if you set up Claude Code with --scope user).
Remove the setup
Sandbox configuration (macOS)
Claude Code runs tools in a macOS sandbox that manages proxy env var propagation to subprocesses. The sandbox must be enabled forHTTP_PROXY/HTTPS_PROXY env vars (set in your settings file) to reach tools like curl, wget, and gh. When the sandbox is disabled, these env vars are not propagated — requests bypass cordon entirely and no credential injection occurs.
cordon setup claude-code configures these settings automatically. The resulting sandbox configuration in your Claude Code settings file (.claude/settings.local.json for project scope, ~/.claude/settings.json for user scope) looks like:
enabled: trueactivates the sandbox and its proxy env var propagation pipeline. Without this, subprocesses will not receive proxy env vars and cordon credential injection will silently fail.autoAllowBashIfSandboxed: trueallows Bash commands to run without individual permission prompts when the sandbox is active.allowLocalBinding: trueandallowedDomains: ["127.0.0.1"]permit sandboxed processes to connect to Cordon’s loopback listener.
Go-based tools (gh, terraform, kubectl, gcloud)
If you use Go-based CLI tools through Claude Code’s sandbox, you also need enableWeakerNetworkIsolation. Go binaries use Apple’s Security.framework for TLS certificate verification, which delegates to the trustd daemon via Mach IPC. The sandbox blocks this by default, causing OSStatus -26276 errors. This must be added manually — cordon setup claude-code does not set it by default because it reduces sandbox isolation.
enableWeakerNetworkIsolation allows sandboxed processes to communicate with com.apple.trustd.agent. It is strictly more secure than disabling the entire sandbox with dangerouslyDisableSandbox: true, but it does reduce isolation by opening access to the system TLS trust service. Only add it if you need Go-based tools to work through the proxy.
Users who only use curl, npm, or Node.js tools through the sandbox do not need enableWeakerNetworkIsolation.
Adding routes
The
cordon route, cordon start, and cordon service commands below default to project scope. If you set up Claude Code with --scope user, append --scope user to each of these commands so they target ~/.config/cordon/cordon.toml instead of ./cordon.toml.x-api-key:
x-api-key header. For bearer-style APIs, set the Authorization header with a scheme. For example, to add a GitHub API route:
API key setup
Claude Code needs an API key env var set so it selects the API key auth path. Add a placeholder to your settings file —.claude/settings.local.json for project scope or ~/.claude/settings.json for user scope:
Manual setup
Prefercordon setup claude-code for Claude Code configuration. It writes the proxy, CA, sandbox, and health-check settings consistently and backs up existing files before changing them. If setup cannot cover your environment, add the values from cordon env to Claude Code’s env settings. For project scope, write .claude/settings.local.json; for user scope, write ~/.claude/settings.json.
The settings shape is:
Workflow
Once configured, the workflow is:- Start cordon:
cordon start(or use the background service) - Start Claude Code as usual
- When Claude Code makes API calls to configured hosts, cordon transparently injects credentials
- Claude Code never sees or logs real API keys
Health-check hook
Whencordon setup claude-code runs, it installs a UserPromptSubmit hook that checks whether cordon is responding before every message you send. If cordon is configured but not running, the hook blocks the message and shows an error — preventing you from sitting through repeated ConnectionRefused retries with no explanation.
The hook runs cordon status -q, a fast health check (50ms timeout with one retry) that exits 0 if cordon is healthy and 1 if not.
What you see when cordon is down
! prefix runs shell commands directly from Claude Code’s prompt without going through the AI — use it to start cordon or remove the integration even while the hook is blocking.
Recovery options
| Option | Command | Notes |
|---|---|---|
| Start as service | ! cordon service start | Requires prior cordon service install. Runs in background. |
| Start manually | cordon start (separate terminal) | Foreground process — keeps running until you Ctrl+C. |
| Remove integration | ! cordon integration disable claude-code --yes | Removes proxy env vars, hook, and skill. Restart session with claude --continue. |
Hooks are loaded when Claude Code starts. If you install or remove the hook mid-session, restart with
claude --continue for the change to take effect.Hook details
- Project scope: script is installed at
.claude/cordon-status-hook.shin the project directory - User scope: script is installed at
~/.config/cordon/hooks/claude-code-status.sh - The hook entry is added to
settings.local.json(project) or~/.claude/settings.json(user) underhooks.UserPromptSubmit - The hook appends to existing hooks — it does not overwrite any
UserPromptSubmithooks you already have - Running setup again is idempotent — if the hook is already installed, it prints “Hook already installed” and moves on
cordon integration disable claude-coderemoves both the hook entry from settings and the script file- The hook script is scope-aware: if setup was given an explicit
--config <path>, the hook passes--config <path>tocordon status -q. For user scope (without explicit config), it passes--scope user. This ensures the hook checks the correct cordon instance.
Troubleshooting
Cordon proxy is not running
Cordon proxy is not running
This message comes from the health-check hook. It means cordon’s proxy env vars are set in your Claude Code settings, but
cordon status -q could not reach the health endpoint.- Start cordon: type
! cordon service startin the Claude Code prompt, or runcordon startin another terminal - Check status:
! cordon statusshows whether the proxy is running, stopped, or blocked by another process - Remove the integration: if you no longer want cordon for this project, type
! cordon integration disable claude-code --yes, then restart withclaude --continue
Certificate errors
Certificate errors
Claude Code uses the same proxy and CA env vars documented in
cordon env. Check TLS troubleshooting, then verify those values are present in .claude/settings.local.json or ~/.claude/settings.json.OSStatus -26276 / TLS failures in Go tools (macOS sandbox)
OSStatus -26276 / TLS failures in Go tools (macOS sandbox)
If Go-based tools (This means Claude Code’s macOS sandbox is blocking See Sandbox configuration for details and trade-offs. Restart Claude Code after changing sandbox settings.Python tools may also encounter TLS errors in the sandbox, but these are more commonly resolved by ensuring
gh, terraform, kubectl, gcloud) fail with:com.apple.trustd.agent Mach IPC. Go uses Apple’s Security.framework for TLS certificate verification, which communicates with the trustd daemon. The sandbox blocks this by default.Add enableWeakerNetworkIsolation to your sandbox settings:SSL_CERT_FILE and REQUESTS_CA_BUNDLE point to the combined CA bundle — see the Certificate errors accordion above.Proxy not being picked up
Proxy not being picked up
Verify the env vars are in Claude Code’s settings file. Project scope writes If the vars are set but Claude Code isn’t routing through the proxy, use the shared proxy not running checks.
.claude/settings.local.json; user scope writes ~/.claude/settings.json.Proxy env vars not reaching subprocesses (sandbox disabled)
Proxy env vars not reaching subprocesses (sandbox disabled)
If Restart Claude Code after changing sandbox settings.
HTTP_PROXY/HTTPS_PROXY are set in your settings file but subprocesses (curl, wget, gh) don’t see them — requests go directly to the internet and cordon credential injection silently fails.Cause: The sandbox is disabled ("enabled": false or absent). Claude Code’s sandbox manages proxy env var propagation to subprocesses. When the sandbox is off, the proxy env vars from your settings file are not passed through, even though other env vars (like CA cert paths) may be.Diagnosis: Run env | grep HTTP_PROXY in a Claude Code Bash tool call. If the proxy vars are missing but CA cert vars are present, the sandbox is likely disabled.Fix: Ensure sandbox.enabled is true in your settings file:MCP servers not using the proxy
MCP servers not using the proxy
MCP servers launched by Claude Code inherit the env vars written by
cordon setup claude-code. If a server is launched outside Claude Code, or its config replaces rather than inherits the parent environment, follow the MCP server guide.Routes not appearing in cordon logs (Node.js)
Routes not appearing in cordon logs (Node.js)
Node.js built-in
fetch needs the Cordon bootstrap loader. cordon setup claude-code sets this automatically when register.mjs is discoverable; otherwise follow SDK Compatibility: Node register import.New routes not taking effect
New routes not taking effect
Restart Cordon after adding or editing route definitions. See Routes: route changes and secret rotation.
401 Unauthorized errors
401 Unauthorized errors