agent-secrets
AGENTS.md109 starsChanged 10 months agoMITView on GitHub
This file provides context for AI agents working on this codebase. agent-secrets is a Go CLI for portable credential management for AI agents. It provides secure, time-bounded access to API keys and tokens without exposing plaintext secrets. Core features: - Age encryption for secrets at rest - Session-scoped leases with TTL (auto-expiration) - Auto-rotation hooks for dynamic credentials - Multi-factor killswitch for emergency revocation - Append-only audit logging Releases are automated via GitHub Actions. To publish a new version: Version…
- Reads credentials
- Commits and pushes
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,736 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- secret-managementSkill
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 81
Use secrets lease <name> --json when you need lease metadata and next_actions.
- Very specific: line 120
Pre-release: Use -alpha, -beta, -rc1 suffixes (e.g., v0.2.0-alpha)
- Distinctive: line 124
Before creating a release:
≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md 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
Agent Instructions for agent-secrets
This file provides context for AI agents working on this codebase.
Project Overview
agent-secrets is a Go CLI for portable credential management for AI agents. It provides secure, time-bounded access to API keys and tokens without exposing plaintext secrets.
Core features:
- Age encryption for secrets at rest
- Session-scoped leases with TTL (auto-expiration)
- Auto-rotation hooks for dynamic credentials
- Multi-factor killswitch for emergency revocation
- Append-only audit logging
Repository Structure
agent-secrets/
├── cmd/secrets/ # CLI entry point (Cobra commands)
│ ├── main.go
│ ├── root.go
│ ├── init.go
│ ├── add.go
│ ├── lease.go
│ ├── revoke.go
│ ├── audit.go
│ └── status.go
├── internal/
│ ├── types/ # Shared types and errors
│ ├── config/ # Configuration management
│ ├── store/ # Age-encrypted secret storage
│ ├── audit/ # Append-only audit log
│ ├── lease/ # TTL-based lease manager
│ ├── rotation/ # Auto-rotation hook executor
│ ├── killswitch/ # Emergency revocation + heartbeat
│ └── daemon/ # Unix socket daemon (JSON-RPC)
├── skills/ # Agent Skills (Claude Code, OpenCode)
│ └── secret-management/
│ └── SKILL.md
├── .openclaw/ # OpenClaw plugin
│ └── extensions/
│ └── secrets.ts
├── .github/workflows/ # CI/CD
│ ├── ci.yml # Tests, lint, goreleaser check
│ └── release.yml # Automated releases on v* tags
├── .goreleaser.yml # Multi-platform binary builds
└── install.sh # Cross-platform installerTech Stack
- Language: Go 1.22+
- Encryption: filippo.io/age (X25519)
- CLI: Cobra
- IPC: Unix socket with JSON-RPC
- CI: GitHub Actions + GoReleaser
CLI Commands
| Command | Description |
secrets | Show self-documenting command tree with next actions |
secrets init | Initialize encrypted store (~/.agent-secrets/) |
secrets add <name> | Add a secret (interactive, stdin, or with rotation hook) |
secrets list | List stored secret names for discovery |
secrets lease <name> | Get time-bounded lease (returns raw secret value by default) |
secrets revoke <id> | Revoke specific lease |
secrets revoke --all | KILLSWITCH: revoke all leases |
secrets status | Show daemon status and active leases |
secrets daemon restart | Ask a supervised daemon to exit and wait for its replacement |
secrets audit | View append-only audit log |
secrets env | Generate .env file from .secrets.json config |
secrets exec -- <cmd> | Run command with secrets loaded, auto-cleanup |
secrets cleanup | Remove expired lease environment files |
Output Conventions
- CLI responses are JSON envelopes by default (
ok,command,result,next_actions). secrets lease <name>is the exception: it returns the raw secret value by default for shell export.- Use
secrets lease <name> --jsonwhen you need lease metadata andnext_actions. - Error responses include a
fixfield with a concrete remediation command.
Development
# Build
make build
# Test
make test
# Lint
make lint
# Run locally
./secretsRelease Process
Releases are automated via GitHub Actions. To publish a new version:
# 1. Ensure all changes are committed and pushed
git status # Should be clean
# 2. Create and push a version tag
git tag -a v0.1.1 -m "v0.1.1 - Description of changes"
git push origin v0.1.1
# 3. GitHub Actions will automatically:
# - Build binaries for linux/darwin (amd64/arm64)
# - Create GitHub Release with assets
# - Generate checksumsVersion format: Semantic versioning (vMAJOR.MINOR.PATCH)
Pre-release: Use -alpha, -beta, -rc1 suffixes (e.g., v0.2.0-alpha)
Testing Changes
Before creating a release:
# Run full test suite
make test
# Check goreleaser config
goreleaser check
# Build locally to verify
goreleaser build --snapshot --cleanAgent Workflows
Quick Workflow (Single Secret)
# 1. Lease credential
export GITHUB_TOKEN=$(secrets lease github_token)
# 2. Do work
git push origin main
# 3. Cleanup
secrets revoke --allProject Workflow (.secrets.json)
# 1. Create .secrets.json in project
cat > .secrets.json <<'EOF'
{
"secrets": [
{"name": "github_token", "env_var": "GITHUB_TOKEN"},
{"name": "vercel_token", "env_var": "VERCEL_TOKEN", "ttl": "30m"}
],
"client_id": "deploy-task"
}
EOF
# 2. Generate .env
secrets env
# 3. Work (credentials auto-loaded from .env)
source .env
npm run deploy
# 4. Cleanup
secrets cleanupOne-Shot Execution (Recommended for Agents)
# Auto-load secrets, run command, auto-cleanup
secrets exec -- npm run deploy
secrets exec -- pytest tests/
secrets exec -- ./deploy.sh productionAgent Integration Points
For agents using this tool:
- Check if installed:
which secrets || echo "Not installed" - Initialize if needed:
secrets init - Choose workflow:
- Single secret →
secrets lease <name> - Multiple secrets → create
.secrets.json+secrets env - One-shot command →
secrets exec -- <command>
- Single secret →
- Revoke when done:
secrets cleanuporsecrets revoke --all
For agents modifying this repo:
- Run tests after changes:
make test - Check types:
go build ./... - Lint before commit:
make lint - Don't modify release tags — create new versions instead
Key Files for Common Tasks
| Task | Files |
| Add CLI command | cmd/secrets/ |
| Modify encryption | internal/store/ |
| Change lease logic | internal/lease/ |
| Update audit format | internal/audit/ |
| Fix daemon IPC | internal/daemon/ |
| Update install script | install.sh |
| Modify release process | .goreleaser.yml, .github/workflows/release.yml |
Security Considerations
- Never log secret values — only log metadata (name, lease ID, timestamps)
- Secrets are encrypted at rest — identity.age file has 0600 permissions
- Leases have mandatory TTL — max 24h by default
- Killswitch exists —
revoke --allfor emergencies - Audit log is append-only — tampering is detectable
- Service-account deployment — keep the store private to the service account; grant clients access only to a group-owned Unix socket
- Routine restart is RPC-driven —
secrets daemon restartexits cleanly so launchd/systemd can replace the process without broad sudo access
Contact
Repository: https://github.com/joelhooks/agent-secrets
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.

