agentleFS
joelhooksjoelhooks/agent-secrets/AGENTS.md

agent-secrets

AGENTS.md115 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 code style.

    Of the AGENTS.md files we read, the 35,266 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 repositoryOne other file it gives its agents.

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
  1. Very specific:

    Use secrets lease <name> --json when you need lease metadata and next_actions.

    line 81
  2. Very specific:

    Pre-release: Use -alpha, -beta, -rc1 suffixes (e.g., v0.2.0-alpha)

    line 120
  3. Distinctive:

    Before creating a release:

    line 124

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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 installer

Tech Stack

  • Language: Go 1.22+
  • Encryption: filippo.io/age (X25519)
  • CLI: Cobra
  • IPC: Unix socket with JSON-RPC
  • CI: GitHub Actions + GoReleaser

CLI Commands

CommandDescription
secretsShow self-documenting command tree with next actions
secrets initInitialize encrypted store (~/.agent-secrets/)
secrets add <name>Add a secret (interactive, stdin, or with rotation hook)
secrets listList 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 --allKILLSWITCH: revoke all leases
secrets statusShow daemon status and active leases
secrets daemon restartAsk a supervised daemon to exit and wait for its replacement
secrets auditView append-only audit log
secrets envGenerate .env file from .secrets.json config
secrets exec -- <cmd>Run command with secrets loaded, auto-cleanup
secrets cleanupRemove 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> --json when you need lease metadata and next_actions.
  • Error responses include a fix field with a concrete remediation command.

Development

# Build
make build

# Test
make test

# Lint
make lint

# Run locally
./secrets

Release 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 checksums

Version 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 --clean

Agent 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 --all

Project 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 cleanup

One-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 production

Agent Integration Points

For agents using this tool:

  1. Check if installed: which secrets || echo "Not installed"
  2. Initialize if needed: secrets init
  3. Choose workflow:
    • Single secret → secrets lease <name>
    • Multiple secrets → create .secrets.json + secrets env
    • One-shot command → secrets exec -- <command>
  4. Revoke when done: secrets cleanup or secrets revoke --all

For agents modifying this repo:

  1. Run tests after changes: make test
  2. Check types: go build ./...
  3. Lint before commit: make lint
  4. Don't modify release tags — create new versions instead

Key Files for Common Tasks

TaskFiles
Add CLI commandcmd/secrets/
Modify encryptioninternal/store/
Change lease logicinternal/lease/
Update audit formatinternal/audit/
Fix daemon IPCinternal/daemon/
Update install scriptinstall.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 --all for 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 restart exits cleanly so launchd/systemd can replace the process without broad sudo access

Contact

Repository: https://github.com/joelhooks/agent-secrets

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.