Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

Offer: keychain-backed secrets storage behind a single setting

Open jbmml opened this issue 3 months ago • 1 comments

First, thank you. LifeOS is the most useful thing I've added to my computing life in years. Probably ever. I run it every day, it has changed how I work, and I'd rather contribute something back than only consume what you've built. This issue is an offer and a question, not a request for you to build anything.

What I wanted to solve for my own install

My API keys lived in ~/.claude/.env as plaintext (and other locations previously). The 7.40.4 deny rules do a good job of keeping the agent out of that file. But the file itself is still plaintext on disk, readable by backup tools, sync clients, and any process running as me. I've spent most of my career in cybersecurity and development, and that one file was the thing I most wanted to fix. (#949 asked about this; #124 settled where secrets live. This picks up the encrypted-at-rest half.)

What we built (my PAI/LifeOS DA and I)

A secrets skill and CLI ("lifeos-secrets") that stores keys in the macOS Keychain, and, more important, keeps secret values away from the model entirely:

  • The model only ever handles secret names. Values never enter the conversation, so they are never sent up to the inference provider. The library's public API has no "give me the plaintext" function, and a test fails the suite if anyone adds one.
  • secrets call <name> --to <url>: the tool resolves the key and makes the HTTPS request itself. Every secret carries an allowlist of hostnames, the destination is checked before the value is read, and the value travels only in a header. Never in a URL, argv, or output.
  • secrets exec <name> -- <command>: injects the value into the child process environment only, and scrubs it from the output before the model sees it. (We label this honestly: convenience, not confinement. call is the strong path.)
  • A PreToolUse hook catches bare $API_KEY usage and steers the model to the wrapper.
  • 112 tests, including hostile-value roundtrips against the real Keychain.

The part that might fit core

Storage is pluggable behind one setting: .env (the default, so a fresh install behaves exactly as today), macOS Keychain, or OpenBao for Linux/servers. I mapped the integration against a current install: one shared getSecret() resolver and about 46 call-site edits, almost all one to three lines each. Linux loses nothing. macOS users gain keys encrypted at rest. The provider interface is small, so adding libsecret, pass, or similar is a contained contribution someone else could make.

The ask

I want to contribute this back. Before I do, I'll finish the integration and test it end to end on my real install, so porting it costs you as little as possible. So far I've deliberately avoided deviating from upstream LifeOS, so I haven't replaced .env broadly; I just remind the model to use secrets and live with a little friction. I'm checking interest first: is this a direction you'd want for core? A simple "interested" or "no thanks" is all I'm after. No pressure either way, and a pass costs me nothing but this issue.

Either way, thank you for LifeOS.

jbmml avatar Aug 20 '26 15:08 jbmml

No thanks, but only because the direction got decided differently on 08-21: the plaintext .env is local-only forever, git carries an age-sealed .env.age, and the identity lives in the macOS Keychain (Secrets.ts). That solved the encrypted-at-rest half with zero call-site changes. A pluggable provider plus ~90 call-site edits is abstraction for a swap I don't intend to make. Ships next release. Appreciate the offer.

danielmiessler avatar Sep 03 '26 23:09 danielmiessler