use-native-credential-proxy
Skill1 starsChanged 40 days agoMITView on GitHub
Opt out of the OneCLI gateway and supply Anthropic credentials from .env instead. For users who want simple .env-based credential management without the OneCLI agent vault. Reads the API key or OAuth token from .env and injects it into the container's API requests.
- Reads credentials
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- microsoft/amplifier-app-nanoclawedited, first seen Jun 12, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- microsoft/amplifier-app-nanoclaw★ 515% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository54 other files it gives its agents.
- container/AGENTS.mdAGENTS.md
- container/CLAUDE.mdCLAUDE.md
- add-atomic-chat-toolSkill
- add-codexSkill
- add-dashboardSkill
- add-deltachatSkill
- add-discordSkill
- add-emacsSkill
- add-gcal-toolSkill
- add-gchatSkill
- add-githubSkill
- add-gmail-toolSkill
- add-imessageSkill
- add-karpathy-llm-wikiSkill
- add-linearSkill
- add-macos-statusbarSkill
- add-matrixSkill
- add-mnemonSkill
- add-ollama-providerSkill
- add-ollama-toolSkill
- add-opencodeSkill
- add-piSkill
- add-resendSkill
- add-rtkSkill
- add-signalSkill
- add-slackSkill
- add-teamsSkill
- add-telegramSkill
- add-vercelSkill
- add-webexSkill
- add-wechatSkill
- add-whatsapp-cloudSkill
- add-whatsappSkill
- archive-tripSkill
- customizeSkill
- debugSkill
- get-qodo-rulesSkill
- init-first-agentSkill
- init-onecliSkill
- learnSkill
- manage-channelsSkill
- manage-mountsSkill
- migrate-from-openclawSkill
- migrate-from-v1Skill
- migrate-memorySkill
- migrate-nanoclawSkill
- nano-pvt-hubSkill
- new-knowledge-graph-tutorSkill
- new-tripSkill
- qodo-pr-resolverSkill
- reflectSkill
- setupSkill
- update-nanoclawSkill
- update-skillsSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
All gating lives inside that function: it returns an empty array unless NANOCLAW_NATIVE_CREDENTIALS=true.
- Very specific: line 28
If it prints applied, the native proxy is already wired — skip to Phase 3 (Configure).
- Very specific: line 53
Add this import alongside the other local imports (e.g.
- Distinctive: line 97
Ask the user (multiple choice): do they want to use their Claude subscription (Pro/Max) or an Anthropic API key?
- Distinctive: line 132
Run from your NanoClaw project root:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Use Native Credential Proxy
This skill adds a native, .env-based credential path for the container agent — an explicit opt-out of the OneCLI gateway. With it enabled, NanoClaw reads the Anthropic credential straight from .env and threads it into the container as standard environment variables, which the Claude Agent SDK reads natively. No OneCLI vault, no HTTPS proxy, no certificates.
Credential-home inversion — read this first. NanoClaw's default is that credentials live in the OneCLI agent vault and are injected per request, never threaded into the container via
-e. This skill deliberately inverts that: the credential lives in.envon the host and is passed into the container's environment. That inversion is the entire point of this skill (simple.envcredentials without OneCLI). Use it only if you accept that tradeoff; everywhere else in NanoClaw, env-threaded credentials are an anti-pattern.
The skill is additive: it ships its proxy logic and tests in this folder, copies them into src/, and makes a single one-line reach-in at the container-spawn seam (gated by an env flag). It does not remove or rewrite the OneCLI gateway — when the flag is unset, the gateway path is exactly as it was, and the native proxy is a no-op.
How it works
src/native-credential-proxy.tsexportsnativeCredentialEnvArgs(). It readsANTHROPIC_API_KEY/ANTHROPIC_AUTH_TOKEN/CLAUDE_CODE_OAUTH_TOKEN(and optionalANTHROPIC_BASE_URL) from.envvia core'sreadEnvFile, and returns the Docker-e VAR=valuearguments.- All gating lives inside that function: it returns an empty array unless
NANOCLAW_NATIVE_CREDENTIALS=true. So the reach-in in core is a single unconditionalargs.push(...nativeCredentialEnvArgs()). - The seam is
buildContainerArgsinsrc/container-runner.ts, right after theTZenv line — the same place container env vars are assembled, just before the OneCLI gateway is applied. With the flag on, the direct credential env vars take precedence in the container; with it off, nothing changes.
Phase 1: Pre-flight
Check if already applied
test -f src/native-credential-proxy.ts && grep -q 'nativeCredentialEnvArgs' src/container-runner.ts && echo applied || echo not-appliedIf it prints applied, the native proxy is already wired — skip to Phase 3 (Configure).
Confirm the seam exists
grep -n "args.push('-e', \`TZ=" src/container-runner.tsThis should print the TZ env line inside buildContainerArgs. If it does not, the file has drifted — read buildContainerArgs in src/container-runner.ts and find the spot where container -e env vars are first pushed; the reach-in goes there.
Phase 2: Apply code changes
Copy the skill's source and tests into src/
S=.claude/skills/use-native-credential-proxy
cp $S/native-credential-proxy.ts src/native-credential-proxy.ts
cp $S/native-credential-proxy.test.ts src/native-credential-proxy.test.ts
cp $S/native-credential-proxy-wiring.test.ts src/native-credential-proxy-wiring.test.tsnative-credential-proxy.test.ts is the behavior test (it drives nativeCredentialEnvArgs() against a real .env read through core's readEnvFile). native-credential-proxy-wiring.test.ts asserts the one-line reach-in is present in buildContainerArgs.
Import the proxy in src/container-runner.ts
Add this import alongside the other local imports (e.g. right after the ./container-config.js import):
import { nativeCredentialEnvArgs } from './native-credential-proxy.js';Make the one-line reach-in
In buildContainerArgs, find the TZ env line and add the call right after it:
args.push('-e', `TZ=${TIMEZONE}`);
args.push(...nativeCredentialEnvArgs());That is the only edit to core. native-credential-proxy-wiring.test.ts asserts this args.push(...nativeCredentialEnvArgs()) call exists inside buildContainerArgs — delete the reach-in and it goes red.
Add the env flag stub to .env.example
Append to .env.example:
# Native credential proxy (.claude/skills/use-native-credential-proxy)
# Opt out of the OneCLI gateway and supply Anthropic credentials from .env.
# When true, the credential below is injected into the container env directly.
# NANOCLAW_NATIVE_CREDENTIALS=true
# One of the following is required when the flag is true:
# ANTHROPIC_API_KEY=
# CLAUDE_CODE_OAUTH_TOKEN=
# Optional custom endpoint:
# ANTHROPIC_BASE_URL=https://api.anthropic.comValidate
pnpm run build
pnpm exec vitest run src/native-credential-proxy.test.ts src/native-credential-proxy-wiring.test.tsThe build must be clean and both tests must pass. The build leg confirms the proxy's import of core's readEnvFile still resolves; the behavior test confirms the .env → -e injection; the wiring test confirms the reach-in into buildContainerArgs is in place.
Phase 3: Configure credentials
Ask the user (multiple choice): do they want to use their Claude subscription (Pro/Max) or an Anthropic API key?
- Claude subscription (Pro/Max) — uses an existing Claude Pro or Max subscription. They run
claude setup-tokenin another terminal to mint a token. - Anthropic API key — pay-per-use API key from console.anthropic.com.
Subscription path
Tell the user to run claude setup-token in another terminal and copy the token it outputs. Do NOT collect the token in chat.
Once they have it, add it to .env along with the opt-out flag:
grep -q '^NANOCLAW_NATIVE_CREDENTIALS=' .env && sed -i.bak 's/^NANOCLAW_NATIVE_CREDENTIALS=.*/NANOCLAW_NATIVE_CREDENTIALS=true/' .env && rm -f .env.bak || echo 'NANOCLAW_NATIVE_CREDENTIALS=true' >> .env
echo 'CLAUDE_CODE_OAUTH_TOKEN=<token>' >> .envANTHROPIC_AUTH_TOKEN is also accepted as an alternative to CLAUDE_CODE_OAUTH_TOKEN.
API key path
Tell the user to get an API key from https://console.anthropic.com/settings/keys if they don't have one, then:
grep -q '^NANOCLAW_NATIVE_CREDENTIALS=' .env && sed -i.bak 's/^NANOCLAW_NATIVE_CREDENTIALS=.*/NANOCLAW_NATIVE_CREDENTIALS=true/' .env && rm -f .env.bak || echo 'NANOCLAW_NATIVE_CREDENTIALS=true' >> .env
echo 'ANTHROPIC_API_KEY=<key>' >> .envOptional custom endpoint
For a custom API endpoint, add ANTHROPIC_BASE_URL=<url> to .env (it is forwarded into the container when present; defaults to https://api.anthropic.com).
Phase 4: Restart and verify
Restart the service
Run from your NanoClaw project root:
source setup/lib/install-slug.sh
launchctl kickstart -k gui/$(id -u)/$(launchd_label) # macOS
# Linux: systemctl --user restart $(systemd_unit)
# WSL/manual: stop and re-run bash start-nanoclaw.shVerify
Send a test message in a registered chat and confirm the agent responds. If the container starts and the agent answers, the credential is reaching the API.
Troubleshooting
Container fails to spawn with "no Anthropic credential found in .env": NANOCLAW_NATIVE_CREDENTIALS=true is set but none of ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, or CLAUDE_CODE_OAUTH_TOKEN is present in .env. Add one.
401 errors from the API: The credential in .env is invalid or expired. For a subscription token, re-run claude setup-token and update CLAUDE_CODE_OAUTH_TOKEN. For an API key, check it at console.anthropic.com.
Agent still goes through OneCLI: Confirm NANOCLAW_NATIVE_CREDENTIALS=true is in .env and the service was restarted. With the flag unset, nativeCredentialEnvArgs() is a no-op and the OneCLI gateway remains the credential source.
Removal
See REMOVE.md — it deletes the copied files, removes the reach-in and import, strips the .env keys, and restarts.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

