r/opencodeCLI • • 12h ago

I built a small Mac CLI so Codex / Claude Code / Cursor can use API keys without seeing them

1 Upvotes

6 comments sorted by

1

u/kantorcodes1 6h ago

Your setup keeps keys out of chat, which is where they usually leak into transcripts. The keys are stored in iCloud Keychain. The tool just uses a key without actually seeing it.

HOL Guard (the agent firewall I'm working on) has command extensions written by the authors of each tool. Would you want to write the ichain one?

1

u/the__repeat 6h ago

Let’s do this!

1

u/kantorcodes1 5h ago

Great, here is what to build. The extension source is a new file, contributions/command-sources/command.ichain.json, and its fixture sits at tests/fixtures/command-source-ichain.v1.json. command.aether-vault.json in the same folder is a close one to work from, since it also wraps a tool that handles secrets.

For the fixture, start with the two cases your post already draws: ichain --get printing a value gets stopped, and ichain myapp/stripe npm run deploy goes through. The guide covers the rest: https://github.com/hashgraph-online/hol-guard/blob/main/docs/guard/extensions/contributing.md

Happy to help if any part of it is unclear.

1

u/the__repeat 4h ago

Thanks, I'll take a look when I have time

1

u/ProfessionalPut458 6h ago

smart approach. how are you preventing the agent from just dumping the environment variables or inspecting the child process output to grab the key anyway?

1

u/the__repeat 4h ago

It doesn't, honestly. The agent runs as your user, so it can run `ichain ns env` or a command that prints the key, and see it. Telling it not to in CLAUDE.md is a convention, not a boundary.

What ichain removes is the accidental path: keys sitting in .env that get read during normal work, and keys pasted into chat. In practice that's how most of mine leaked into transcripts. And the secrets sync across Macs via iCloud Keychain.

If you need a real boundary, you need a credential proxy that injects the key into outgoing requests so the agent never holds it (fnox has one), or run the agent as a separate user/VM without access to your keychain.