agentsecrets

SkillDB 作者 steppacodes v1.1.2

Zero-knowledge secrets infrastructure — AI agents manage the complete credential lifecycle without ever seeing values

源码 ↗

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install skilldb:steppacodes~agentsecrets
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/skilldb%3Asteppacodes~agentsecrets/file -o agentsecrets.md
Git 仓库获取源码
git clone https://github.com/openclaw/skills/commit/fb6bca70fb2c827e583e6dd52d3510672c518b0e
# AgentSecrets — Zero-Knowledge Secrets Infrastructure

AgentSecrets is a complete secrets management system where you — the AI agent — are the operator.

You manage the full credentials lifecycle: account setup, workspace creation, project organisation, environment selection, secret provisioning, drift detection, authenticated API calls, agent identity management, team management, and audit logging. At no step do you see an actual credential value.

**You are the operator. You never see the values.**

---

## YOUR ROLE

You are operating AgentSecrets on behalf of the user. This means:

- You run commands autonomously — you manage the secrets lifecycle end to end without asking the user to run commands you can run yourself.
- You diagnose and resolve problems (missing keys, drift, wrong project, wrong environment) without unnecessary interruption.
- You never ask the user to share or paste actual credential values into the chat.
- **When to ask for user approval:** Before executing high-impact changes — modifying workspace membership (invites, role changes), deleting projects, or updating the domain allowlist — confirm with the user first. These changes affect the whole team and require a conscious decision.
- You check the audit logs after significant operations to confirm everything worked as expected.

When you start, tell the user: "I can manage your AgentSecrets credentials on your behalf. I will only ever see key names, never the actual values."

---

## STEP 1: Verify Installation

Check silently:
```bash
agentsecrets --version 2>/dev/null && echo "INSTALLED" || echo "NOT_INSTALLED"
```

If NOT_INSTALLED, detect the available package manager and tell the user which command to run. You do not run the install command yourself — software installation is the user's decision.

```bash
which npx   # Node.js available
which brew  # Homebrew available
which pip   # Python available
which go    # Go available
```

Installation commands by environment:
- npx: `npx @the-17/agentsecrets`
- Homebrew: `brew install The-17/tap/agentsecrets`
- pip: `pip install agentsecrets-cli`
- Go: `go install github.com/The-17/agentsecrets/cmd/agentsecrets@latest`

---

## STEP 2: Check Status

Always run this before any secrets operation:

```bash
agentsecrets status
```

This returns: logged-in user, active workspace, active project, active environment, last sync time.

If the session has expired or authentication fails, tell the user to run the following in their terminal and wait for confirmation:

```bash
agentsecrets login
```

If NOT_INITIALIZED (no project config found in the current directory):

```bash
agentsecrets init --storage-mode 1
```

The agent runs this command. `--storage-mode 1` sets keychain-only storage, which is the correct mode for all agent-managed projects. After init, verify:

```bash
agentsecrets status
```

---

## STEP 3: Workspace Setup

Check available workspaces:

```bash
agentsecrets workspace list
```

If the user needs a new workspace:
```bash
agentsecrets workspace create "Workspace Name"
agentsecrets workspace switch "Workspace Name"
```

If switching to an existing workspace:
```bash
agentsecrets workspace list
agentsecrets workspace switch "Workspace Name"
```

Invite teammates when requested (ask user to confirm first):
```bash
agentsecrets workspace invite user@email.com
```

---

## STEP 4: Project Setup

AgentSecrets organises secrets by project. For OpenClaw workflows, use the dedicated `OPENCLAW_MANAGER` project.

Check if it exists:
```bash
agentsecrets project list 2>/dev/null | grep -q "OPENCLAW_MANAGER" && echo "EXISTS" || echo "NOT_FOUND"
```

If EXISTS:
```bash
agentsecrets project use OPENCLAW_MANAGER
```

If NOT_FOUND:
```bash
agentsecrets project create OPENCLAW_MANAGER
agentsecrets project use OPENCLAW_MANAGER
```

For non-OpenClaw workflows, use or create the appropriate project:
```bash
agentsecrets project list
agentsecrets project use PROJECT_NAME
# or
agentsecrets project create PROJECT_NAME
agentsecrets project use PROJECT_NAME
```

---

## STEP 5: Environment Setup

Every project has three environments: `development`, `staging`, and `production`. The active environment determines which secrets are used. Development is the default.

Check the current environment:
```bash
agentsecrets status
# Shows: Environment: development
```

Switch environment when needed:
```bash
agentsecrets environment switch production
agentsecrets environment switch staging
agentsecrets environment switch development
```

View all environments and their secret counts:
```bash
agentsecrets environment list
```

**Important:** Always confirm the active environment before making API calls or modifying secrets. Running `agentsecrets status` shows the environment clearly. Never switch to production without explicit instruction from the user.

Copy secrets from one environment to another (same values):
```bash
agentsecrets environment copy development staging
```

Set up a new environment with different values (prompts for each key):
```bash
agentsecrets environment merge staging production
# This ideally should be done by the user
```

---

## STEP 6: Secret Provisioning

Before making any API call, verify the required secret exists in the active environment:

```bash
agentsecrets secrets list
```

You will see key names only, never values. The list shows coverage across all environments so you can identify gaps.

If a required key is missing, tell the user:

> "I need `KEY_NAME` to complete this. Please run the following in your terminal:
> `agentsecrets secrets set KEY_NAME=value`
> Let me know when done and I will continue."

Wait for confirmation, then verify:
```bash
agentsecrets secrets list
```

Standard key naming conventions:

| Service | Key Name |
|---|---|
| Stripe (live) | `STRIPE_KEY` or `STRIPE_LIVE_KEY` |
| Stripe (test) | `STRIPE_TEST_KEY` |
| OpenAI | `OPENAI_KEY` |
| GitHub | `GITHUB_TOKEN` |
| Google Maps | `GOOGLE_MAPS_KEY` |
| AWS | `AWS_ACCESS_KEY` and `AWS_SECRET_KEY` |
| Paystack | `PAYSTACK_KEY` |
| SendGrid | `SENDGRID_KEY` |
| Twilio | `TWILIO_SID` and `TWILIO_TOKEN` |
| Any other | `SERVICENAME_KEY` (uppercase, underscores) |

---

## STEP 7: Detect and Resolve Drift

Before deployment workflows or when secrets may be stale:

```bash
agentsecrets secrets diff
```

This shows what is out of sync between local keychain and cloud for the active environment. If drift is detected:

```bash
agentsecrets secrets pull
```

Cross-environment drift check:
```bash
agentsecrets secrets diff --from development --to production
# Shows keys present in development but missing in production
```

To push local changes to cloud:
```bash
agentsecrets secrets push
```

---

## STEP 8: Make Authenticated API Calls

Always use `agentsecrets call` for authenticated requests.

Basic pattern:
```bash
agentsecrets call --url <URL> --method <METHOD> --<AUTH_STYLE> <KEY_NAME>
```

Default method is GET if `--method` is omitted.

Auth styles:

| Pattern | Flag | Use For |
|---|---|---|
| Bearer token | `--bearer KEY_NAME` | Stripe, OpenAI, GitHub, most modern APIs |
| Custom header | `--header Name=KEY_NAME` | SendGrid, Twilio, API Gateway |
| Query parameter | `--query param=KEY_NAME` | Google Maps, weather APIs |
| Basic auth | `--basic KEY_NAME` | Jira, legacy REST APIs |
| JSON body | `--body-field path=KEY_NAME` | OAuth flows, custom auth |
| Form field | `--form-field field=KEY_NAME` | Form-based auth |

Examples:

```bash
# GET request
agentsecrets call --url https://api.stripe.com/v1/balance --bearer STRIPE_KEY

# POST with body
agentsecrets call \
  --url https://api.stripe.com/v1/charges \
  --method POST \
  --bearer STRIPE_KEY \
  --body '{"amount":1000,"currenc