r/PromptEngineering • • 17h ago

Tools and Projects Built Keylo with Claude Code — it lets Claude Code use your API keys without ever seeing them (free)

What it is. Keylo is a secrets vault for people who let AI agents run real commands. It's an MCP server plus a desktop app (Windows/macOS/Linux) and CLI. The core idea: the agent names a secret, Keylo runs the command with it, and returns only the exit code and output — with the secret value scrubbed to `[keylo:name]`. There's deliberately no tool that returns a value, so Claude Code can use your prod DB password or API key without being able to read it. Anything outside an agent's scoped, run-only key triggers a Touch ID / Windows Hello approval, you can mark prod "always ask," and every use is logged.

Claude Code setup is one line: `keylo keys create "Claude Code" --category dev --add-to-claude`

It's free — free to try and free to use, no account, local-first (nothing goes to a cloud). Source-available so you can audit the security-critical code.

How Claude Code helped (in detail). I built the whole thing in Claude Code (Opus), and it did most of the actual engineering:

* Wrote the Rust across three crates — the core vault (AES-256-GCM, authenticated so tampering is detected), the per-OS keystore layer, and the CLI/MCP server.

* Implemented the hard cross-platform bits: Windows DPAPI + Windows Hello via KeyCredentialManager (TPM), the macOS login-Keychain seal + Secure Enclave Touch ID, and the Linux Secret Service keyring with a passphrase-wrapped file vault for headless servers.

* Designed the MCP tool surface and the two mechanisms that make the "never read" guarantee real: the output redactor and the run-only access-key model.

* Debugged genuinely nasty platform issues with me — e.g. macOS errSecInteractionNotAllowed when unlocking over SSH — and then built the headless fallback vault. It drove the tests too: a real Mac over SSH, Linux in Docker.

* Wrote the docs, and built the project's website and the writeup of how the concealment works, with references into the source.

Honest limits. Redaction catches accidental echoes, not a command deliberately transforming a value; a command you approve gets the real secret, so sandbox your agent and don't approve things you don't understand. It's a single-developer tool, not a team secrets platform.

Site: https://keylo.dev Code: https://github.com/tulde23/keylo

Happy to answer questions about the MCP design or the cross-platform keystore work.

1 Upvotes

2 comments sorted by

1

u/TheScreechingJoseph 17h ago

This is a neat approach to the agent-secrets problem. I've been thinking about this exact tension, you want the agent to be able to actually do things but handing it raw credentials feels wrong no matter how much you trust the sandbox. The run-only model with output scrubbing is clever.

How do you handle cases where the command legitimately needs to output something derived from the secret? Like if an API returns a token that the agent needs for subsequent calls, does that get caught in the redactor too or is there a way to mark certain outputs as safe?

The cross-platform keystore work sounds like it was a proper headache. Getting Touch ID to behave over SSH is the kind of thing that makes you question your life choices mid-debug.

1

u/Comfortable-Mix-6102 1h ago

Derived tokens pass straight through — that case just works.

Keylo's redaction is value-based: it only knows the exact secret values it

injected for that run, and replaces those with [keylo:name] if they show up

in output. A token an API hands back in exchange for your key is a brand-new

string that was never injected, so it's not in the redactor's set and the

agent gets it in plaintext for subsequent calls. No "mark as safe" flag

needed — the default is pass-through unless it's one of your stored secrets.

The flip side: that means Keylo conceals the long-lived credential you

stored, not the ephemeral token derived from it. If you don't want the agent

holding that derived token either, run the whole chain (token exchange + the

call that uses it) inside one run_with_secrets command so the token lives and

dies in the child process and never surfaces.

(And redaction only catches verbatim echoes of your stored secret — it's a

guardrail against accidental leaks, not an adversarial boundary. The real

boundary is that the value only ever exists in the child process's env/temp

files, never in a tool return.)