One vault. Every key, .env value, service-account file and certs folder lives in one
age-encrypted vault on your machine, named project@env:NAME (the project comes from your git
remote). Everything else is a copy of it or a use of it:
- your team shares it through a hub you run (
sec login,sec load,sec save) — ssh or https, login is your ssh key; - your repo gets it back as
.env, files and folders (sec add,sec load) — git-ignored, 0600; - your servers, CI, pods get placed copies (
sec push,sec sync) thatsec rotateupdates in one verb; - your agents use it without reading it: they write
{{NAME}},secfills it in a child process and scrubs the value out of everything that comes back.
sec init # age keypair → ~/.config/sec
printf '%s' "$VALUE" | sec set STRIPE_KEY --source https://dashboard.stripe.com/apikeys
sec exec -- curl -H "Authorization: Bearer {{STRIPE_KEY}}" https://api.stripe.com/v1/balance
sec env list # environment → file → key count
sec gen --save APP_DB_PW --env production=DB_PASSWORD # an environment NAME, not a guessed .env
sec push APP_DB_PW gh://muthuishere/app:production # a GitHub Actions secret
sec push APP_DB_PW gcp://my-project # GCP Secret Manager
sec rotate APP_DB_PW --gen --hook hooks/postgres-rotate.sh # → re-pushed to .env, GitHub, GCP
sec where APP_DB_PW # the compromise-day question
sec set TLS --from ./certs # a whole file or folder (modes kept)
sec push DB_PW,API_KEY ./app/.env # put it where the program reads it…
sec push TLS ssh://hetzner/etc/myapp/certs # …a server, a volume, docker://ctr/path
sec sync DB_PW,API_KEY ssh://hetzner # another sec: sealed for its key, nothing on disk
sec sync DB_PW docker://api --install # …or a container / k8s://ns/pod; --install puts sec there
sec sync DB_PW ssh://web+docker://api # ssh in, then into a container (+podman://, +k8s://)
sec sync DB_PW --from ssh://hetzner # …and back
sec export --only DB_PW --for age1… --out x.sec # another sec with no connection → sec import x.sec
sec remote status ssh://hetzner # sec there: version vs this one, vault y/n
sec remote upgrade ssh://hetzner # bring it to this build; keeps sec.prev, rolls back on failure
# (install/upgrade/sync --install also put the agent skill there)
sec help move # which of sync / push / export / remote to use
sec keys # what .env.example needs that the vault lacks
sec logs DB_PW --since 7d # what happened
sec ok # check everything, re-push stale copiesMore worked examples — env vars, .env, Docker volumes, servers, another sec, containers, templates:
docs/examples.md. Full reference: the docs page; task-first flows: recipes.
| tool | secrets out of the model | works for argv/config files, not just env | placement ledger → one-verb rotate | no daemon / SaaS |
|---|---|---|---|---|
Doppler doppler run |
✅ | env only | ✗ | SaaS |
| secretctl / agent-secrets | ✅ | env only | ✗ | MCP server / daemon |
| OneCLI / agentsecrets | ✅ | HTTP only (proxy) | rotate in vault only | proxy + dashboard |
| sops + age | ✅ | ✗ | ✗ | ✅ |
| sec | ✅ + output redaction | ✅ exec / render |
✅ | ✅ single binary |
Everything above is a thing the agent has to remember. The installer removes the remembering:
sec skill install (run by install.sh, refreshed by every sec run) adds to Claude Code's
settings deny rules for .env / the vault / sec get / sec export and a PreToolUse hook,
sec hook, that keeps every Bash, Read, Grep and Glob call out of secret files. cat .env, grep KEY .env,
reading the vault — refused before they run. Plain claude, no wrapper.
# Taskfile.yml
version: '3'
dotenv: ['.env']sec load && task build # this repo's project@env (from .sec.toml) → .env (0600, git-ignored)
sec load prod .env.prod # another env, another filesec load writes the project's values with the env's on top; when a hub is configured the team's copy
wins. Only names are printed — the values never reach the terminal or an agent.
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/muthuishere/sec/main/install.sh | sh:: Windows (cmd)
curl.exe -fsSL https://raw.githubusercontent.com/muthuishere/sec/main/install.cmd -o "%TEMP%\sec-install.cmd" && "%TEMP%\sec-install.cmd"Both install sec and, on first run, the agent skill (the skills/sec/ folder: SKILL.md plus
references/). Re-run to upgrade. After that, any sec run refreshes an installed skill by itself
when the binary is newer.
Site: index · docs · recipes · compare.
From a checkout:
task install # builds, copies to ~/.local/bin, links the agent skill, adds harness deny rules
sec initsec skill install writes the skill built into the binary to ~/.claude/skills/sec (and $CLAUDE_CONFIG_DIR/skills/sec when set) and
~/.agents/skills/sec (--from skills/sec symlinks a checkout instead) and merges
Read(~/.config/sec/**), Read(**/.env*), Bash(sec get:*), Bash(sec export:*) into
~/.claude/settings.json permissions.deny — so the harness, not the model, refuses.
sec sync is deliberately not denied: it never shows a value, only the remote vault can open what
it sends, and its own trust check (below) gates it.
Every command has sec help CMD / sec CMD --help — syntax, examples, owner-only flags, what to
run next — and a wrong usage prints the closest correct command.
-
Vault:
~/.config/sec/vault/NAME.age(age X25519,filippo.io/age) +NAME.jsonmetadata. Ciphertext + names only → commit it to a private repo orrclone syncit. Sync is not sec's job. -
Projects & environments: identity is (project, env, NAME), both optional. Address
reqsume:NAME,reqsume@production:NAME,@dev:NAME(projects nest with/:reqsume/api) anywhere a NAME goes, including{{reqsume@production:DB_PW}}andsec run reqsume@production:DB_PW=PGPASSWORD -- …. Scoped secrets live invault/_projects/<project>/@<env>/NAME.{age,json}; the global namespace stays the flatvault/NAME.*every older vault already has, so nothing migrates. Bare names resolve in the current context —project@env, thenproject, then global — set bysec use P [--env E](saved incontext.json), overridden bySEC_PROJECT/SEC_ENV, overridden by--project/--envon any command or a qualified name. Writes (set,gen,import) go to the context. A repo names its project in.sec.tomlat its root (project = "billing",envs = ["dev", "prod"],default_env = "dev"; no secrets, commit it): inside the repo bare names resolve in project@env first.sec use prodinside the repo switches your env there (kept locally).sec import .envwrites the file when missing, named after the repo/folder or--project NAME. explicit:sec import .env.production --project reqsume --env production.sec lsshows PROJECT/ENV,sec project lscounts per project and env.sync/pushto another sec carry the scope (the far end needs this version to accept a scoped name). -
Files:
sec set NAME --from PATHstores a whole file or folder,sec get NAME --out PATHgives it back (a new 0600 file; a folder is extracted),sec lsshows the TYPE. -
Read-only vaults:
SEC_READONLY=1(CI jobs, e2e test runs) allows only commands that use values —ls run exec render seal keys where logs env id use project— and refuses every write, in the CLI and in the Go package. -
Go package:
github.com/muthuishere/sec/pkg/vault—Open/OpenAs(caller),Get,Set,List,Has,Redact,NewRedactor. Same vault, identity and headless rules as the CLI; no export path; everyGet/Setaudited with the caller label. -
sec get NAME --out FILE: for a program/daemon with no TTY — the raw value goes to a new 0600 file (O_EXCL: an existing file or symlink is refused), never to stdout; open to agents likerender, audited asget.out. -
Identity: pluggable, the same three backends
Bun.secretsgives JS, plus a file:SEC_IDENTITYenv (CI/containers) > OS keyring (macOS Keychain / Windows Credential Manager / Linux Secret Service, viago-keyring) >identity.txt(0400).situation default why macOS / Windows desktop session keyring local API, answers immediately, no prompt anything headless — SSH, container, CI, no DISPLAY/DBusfile (0400) every credential store assumes a logged-in desktop; without one it prompts where nobody can answer, and a prompt is a hung agent Linux desktop file, opt in with --backend keyringgnome-keyring/KWallet works, but it's DBus, and the same config in cron or CI would block Headless is detected from
SSH_CONNECTION/SSH_TTY,/.dockerenv+ cgroups, CI env vars, and (on unix) a missingDISPLAY/WAYLAND_DISPLAY/DBUS_SESSION_BUS_ADDRESS. Override withSEC_HEADLESS=0|1. Every keyring call — probe, read, and the write's read-back — is bounded by a 3s timeout, so a locked keychain can never wedge the process.Resolution is automatic and never needs a flag. Reads try
SEC_IDENTITY, then the keyring (if the vault prefers it and this session can reach it), thenidentity.txt, and use the first that answers — so one home directory works from the desktop that created it and from a cron job or SSH session that can't reach the credential store. Falling back prints one line on stderr so it's never a silent downgrade.sec identity adopt key.txtgives a machine its own file copy without changing where the vault prefers to keep the key.Two things are refused rather than guessed:
sec initon a directory that already holds encrypted secrets but no key (generating a fresh one would orphan them forever), and adopting a key whose public key doesn't match the vault's.sec identityshows which;sec identity move --to keyring|fileswitches (verifies the new location reads back before removing the old copy);sec identity export --out f --confirmmakes a backup for a password manager. Another machine:sec sync NAMES WHEREorsec export --for KEY. What the keyring buys: no plaintext key on disk, so a disk image, a Time Machine backup or anrcloneof the wrong directory doesn't carry it. It does not stop a process running as you from asking the keyring — that exposure is identical to a 0600 file. -
Owner vs agent: a TTY on stdin or
SEC_OWNER=1is the owner.get --print,export,--allow-output-onlyneed it. Agent harnesses run with a piped stdin, so they never have it. -
sec sync: one transport — run a command there with stdin piped (ssh host,docker|podman exec -i ctr,kubectl exec -i [--context] [-n] pod [-c] --).sec idthere names the remote key; values are sealed for it in memory and streamed intosec import -;--fromrunssec export --for <this vault> --out -there. The remote key is TOFU-pinned per target (known_secs.json): an agent may sync only to a pinned or saved (sec target add NAME age1…) key, first contact is the owner's, a changed key is refused until the owner--repins. Hops chain with+(ssh://web+docker://api,ssh://bastion+ssh://db+k8s://ns/pod): one builder, quoted once per ssh hop, used by bothsyncandpush.--install(owner) detects the far end (uname -sm, or PowerShell on Windows), streams a checksum-verified binary into that user's own folder (~/.local/bin, or%LOCALAPPDATA%\Programs\secadded to the user PATH) — never root, sudo or Administrator — and runssec initthere. Both sides audit. -
sec remote install|upgrade|status|uninstall WHERE: the sec binary on any sync route, no secrets moved. Upgrade compares sha256 (same build = no-op), keepssec.prev, never touches the vault or identity, and rolls back if the new binary failssec versionor the vault's name count changes. Uninstall keeps the vault and says where it is;--purgedeletes it only for the owner typing at a real terminal, after listing the names and typing the remote fingerprint back, and refuses secrets that exist nowhere else unless--force. -
No prompts, ever: sec never triggers an OS dialog — with no login keychain (a moved
HOME, a sandbox) the keyring is simply not used. -
Redaction:
exec/runscrub each value plus its base64 (with/without trailing newline), hex, url-encoded and JSON-escaped forms from stdout/stderr. Matching is newline-tolerant — the stream is also searched with\r/\nremoved, because ordinary tools wrap long output (xxd -pat 60 columns, GNUbase64at 76,fold) and a value in three pieces is still the value. The tail is held back briefly so a match cannot slip through the seam. -
Placement ledger:
push,render,import,gen --envrecord where a value went.rotatere-applies to all of them and prints what must be done by hand. -
Audit:
~/.config/sec/audit.ndjson— action, names, agent, cwd, template. Never values.
sec hub serve --data DIR --admin you=you.pub runs one ssh-only server a team shares. Users are
ssh keys with read/write per project (optionally per env). sec login ssh://host once per machine
(kept in your sec home, never in the repo). Day to day: sec load writes the team's project@env into
.env (and puts back every file or folder you kept with sec add config/sa.json certs/); edit
them, then sec save puts the changes back and merges them into the hub. The hub speaks ssh or
https (sec login https://hub…), and the project is named from the git remote. Also
sec hub pull [ENV] / sec hub push [ENV]; admins manage sec hub user add|rm|ls. In CI put a
read key in SEC_HUB_KEY and sec run / sec exec pull in memory with no sec init. Values are
encrypted at rest with the server's key — not blind. Log: names only. See docs/team-sync.md.
Web UI, only through the hub's ssh. Start the hub once with --firebase-project ID --firebase-api-key KEY --admin-email [email protected],[email protected] (saved in DIR/web.json). The UI
opens no web port: sec hub ui opens an ssh forward over the hub's port 2222 (your key must be one the
hub knows) and the browser on http://localhost:8091, then you sign in with Google. The Google email
is bound to that key on first sign-in, and every later sign-in must match it. Admins (the listed
emails) add people (email + ssh public key), grant read/write per project@env, revoke, remove, and
read the log. Members see their grants and the names (never values) they can load. To keep it
running: deploy/sec-hub.service (systemd, Restart=always).
Defends against sloppiness and logs: secrets in transcripts, guides, commits, test output, chat.
Does not defend against a hostile agent with network access (it could curl a value to a webhook
through exec); neither does any tool in this category. The refusal of output-only commands and the
audit line for every use make the silly attempt visible, not impossible.
cmd/sec · internal/{store,tmpl,redact,execx,gen,envfile,cert,place,owner,cli,detect,agentpty} ·
skills/sec/ (SKILL.md is a short index; references/*.md hold commands, moving, permissions, projects, identity and scenarios.md (worked flows)) · hooks/ (rotation hooks: postgres, aws-iam) · scripts/smoke.sh.