Skip to content

Commit 7cec2f5

Browse files
authored
Merge pull request #42 from zloeber/zloeber/claw_integration
feat: agent adopt for Hermes and OpenClaw installs
2 parents 23d41c4 + 876d213 commit 7cec2f5

29 files changed

Lines changed: 1925 additions & 19 deletions

.mex/ROUTER.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ edges:
1414
condition: when setting up the dev environment or running the project for the first time
1515
- target: patterns/INDEX.md
1616
condition: when starting a task — check the pattern index for a matching pattern file
17-
last_updated: 2026-05-22
17+
last_updated: 2026-05-27
1818
---
1919

2020
# Session Bootstrap
@@ -54,7 +54,8 @@ Then read this file fully before doing anything else in this session.
5454
- **Safe provider retrieval CLI:** `secretzero get` now retrieves via provider bundle methods (`SyncEngine.get_provider_secret`) with metadata-first output by default; plaintext requires `--reveal`. Sandbox policy guards retrieval when `SZ_SANDBOX=true` unless explicitly overridden by `SZ_ALLOW_GET_IN_SANDBOX=true`, and command-level policy preflight blocks on policy errors.
5555
- **GitNexus / MetaGit relational intel:** `secretzero sync` and `secretzero get` write `.gitnexus/secrets_overlay.json` (Ladybug-oriented JSON linking manifest secret names to symbol IDs / FQNs from `.gitnexus/discovery_bindings.json`). Optional `SZ_METAGIT_REGISTRY=1` merges inventory into `~/.metagit.yml`. `secretzero discover` persists bindings and extends LLM output with parent symbol / FQN fields. `secretzero gitnexus blast-radius --symbol <FQN>` wraps GitNexus impact; `secretzero rotate --trigger-reindex` runs `gitnexus analyze --skills` after success. Per-secret `process_tags` labels execution-flow sensitivity (schema + docs updated).
5656
- **Terraform static-variable behavior:** Terraform export now always emits sensitive input variables for static-like secrets (`static` and bundle kinds with `PROMPTS_LIKE_STATIC`, such as `azure_app_reg`). `--include-static-secrets` now controls whether static defaults are embedded as Terraform variable defaults.
57-
- **Agent skill guidance split:** SecretZero guidance is now split into focused skills — `skills/secretzero-author/SKILL.md` (schema-compliant Secretfile authoring, safe contextless discovery, `.szvar` lane breakout, and policy-bound targets), `skills/secretzero-agent/SKILL.md` (agentic vectors, runtime/API workflows, and installation/onboarding), and `skills/secretzero-handle/SKILL.md` (`SZ_AGENT_MODE`, `.env`/ingest preseed, spill-safe CLI).
57+
- **Agent skill guidance split:** SecretZero guidance is now split into focused skills — `skills/secretzero-author/SKILL.md` (schema-compliant Secretfile authoring, safe contextless discovery, `.szvar` lane breakout, and policy-bound targets), `skills/secretzero-agent/SKILL.md` (agentic vectors, runtime/API workflows, and installation/onboarding), `skills/secretzero-handle/SKILL.md` (`SZ_AGENT_MODE`, `.env`/ingest preseed, spill-safe CLI), and `skills/secretzero-agent-adopt/SKILL.md` (Hermes/OpenClaw `agent list` / `agent adopt` bootstrap and restore loops).
58+
- **`secretzero agent list` / `agent adopt`:** Discover local Hermes/OpenClaw installs (read-only) and bootstrap SecretZero environments from **present** catalog credentials without emitting values. `agent adopt` writes `Secretfile.yml` into `--output-dir` (default: agent install path); `agent backup` is an alias. Supports `--template`, `--preseed-lockfile`, autodetect (Hermes then OpenClaw), and idempotent merge on re-adopt. See `docs/superpowers/specs/2026-05-27-agent-adopt-design.md`, `.mex/patterns/agent-adopt.md`.
5859
- **`secretzero agent instructions`:** Read-only Rich/JSON report of `agent_instructions` (summary + numbered steps). Default scope is pending manual secrets (same semantics as `agent sync`); `--all` lists every secret with instructions; `--detailed` adds optional metadata. See `.mex/patterns/agent-instructions-report.md`.
5960
- **Environment-map lanes + target profiles:** Secretfile now supports top-level `environments` and `target_profiles`; CLI (`sync`, `agent sync`, `web`) and API (`/sync`, `/agent/sync`) resolve lane-specific var files/lockfiles/profile defaults with runtime flags taking precedence. `secretzero web` now renders an environment dropdown and recomputes lane context on selection.
6061
- **CLI-wide environment propagation:** Secretfile-backed CLI commands now share root-aware `--environment` resolution. `secretzero -e <env> ...` flows into manifest/list/status/render/drift/terraform-style commands, while subcommand-local `--environment` overrides the root selection when both are present.

.mex/patterns/INDEX.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Lookup table for all pattern files in this directory. Check here before starting
55
| Pattern | Use when |
66
|---------|----------|
77
| [agent-sync.md](agent-sync.md) | Changing unified `agent sync` / `POST /agent/sync` (three vectors, CLI+API parity) |
8+
| [agent-adopt.md](agent-adopt.md) | `secretzero agent list` / `agent adopt` / Hermes-OpenClaw install bootstrap |
89
| [agent-instructions-report.md](agent-instructions-report.md) | `secretzero agent instructions` pending/all report output |
910
| [add-bundle.md](add-bundle.md) | Adding a provider/generator/target through bundle manifest registration |
1011
| [add-cli-command.md](add-cli-command.md) | Adding or changing `secretzero` CLI commands/options |

.mex/patterns/agent-adopt.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
name: agent-adopt
3+
description: Agent runtime adopt/list workflows for Hermes, OpenClaw, and future claw-like installs.
4+
triggers:
5+
- "agent adopt"
6+
- "agent list"
7+
- "agent backup"
8+
- "hermes adopt"
9+
- "openclaw adopt"
10+
edges:
11+
- target: patterns/add-cli-command.md
12+
condition: when changing CLI flags or output shapes
13+
- target: patterns/sz-agent-mode-spill-guard.md
14+
condition: when touching agent-safe JSON or spill guards
15+
- target: patterns/docs-entrypoint-parity.md
16+
condition: when updating README/skills onboarding
17+
last_updated: 2026-05-27
18+
---
19+
20+
# Agent Adopt Workflow
21+
22+
## Context
23+
24+
`secretzero agent list` and `secretzero agent adopt` (alias `agent backup`) bootstrap SecretZero
25+
environments from local agent installs. This is **not** `secretzero backup create` (encrypted value DR).
26+
27+
Implementation lives under `src/secretzero/integrations/`.
28+
29+
## Steps
30+
31+
1. Add or extend an adapter in `integrations/<target>/` with `catalog.yaml` + `adapter.py`.
32+
2. Register the adapter in `integrations/registry.py` with autodetect order.
33+
3. Keep scans **presence-only** — never attach secret values to result models or JSON.
34+
4. Generated manifests use `default: null` on static secrets; target paths point at agent `.env` (absolute when GitOps output dir differs from install root).
35+
5. `--preseed-lockfile` must call `run_lockfile_import` via the ingest-preseed path (hash-only).
36+
6. Update skills (`secretzero-agent-adopt`), README `agent-entrypoint` comment, and ROUTER.md together.
37+
38+
## Gotchas
39+
40+
- `agent backup` wording collides mentally with `secretzero backup create` — document the distinction in help and skills.
41+
- Re-adopt merges new catalog matches into an existing Secretfile unless `--force`.
42+
- `--force` rebuilds from scratch (drops merge behavior).
43+
- Autodetect failure must not write partial artifacts.
44+
- Default `--output-dir` is the resolved agent install path.
45+
46+
## Verify
47+
48+
- Run `tests/test_agent_adopt.py`.
49+
- Confirm JSON output never contains fixture secret strings.
50+
- Run fast pre-commit gate.
51+
52+
## Update Scaffold
53+
54+
- [ ] Update `.mex/ROUTER.md` when adopt behavior changes
55+
- [ ] Keep `docs/superpowers/specs/2026-05-27-agent-adopt-design.md` aligned

README.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
11
# SecretZero™
2+
<!-- agent-entrypoint:
3+
intent: executable-tool
4+
primary_workflow: usage-first
5+
install: uv tool install -U "secretzero[all]"
6+
7+
bootstrap:
8+
- export SZ_AGENT_MODE=true
9+
- secretzero agent list --format json
10+
- secretzero agent adopt --dry-run --format json
11+
12+
authoritative:
13+
- ./AGENTS.md
14+
15+
usage:
16+
- ./README.md#agent-quick-start
17+
- ./skills/secretzero-agent-adopt/SKILL.md
18+
19+
agent_targets:
20+
discover: secretzero agent list --format json
21+
adopt: secretzero agent adopt --format json
22+
adopt_gitops: secretzero agent adopt --output-dir ./agents/hermes --template --format json
23+
sync: secretzero agent sync --json
24+
skills:
25+
- skills/secretzero-agent-adopt/SKILL.md
26+
- skills/secretzero-agent/SKILL.md
27+
- skills/secretzero-handle/SKILL.md
28+
-->
29+
[test](./AGENTS.md)
230
<div align="center">
331
<a href="https://secret0.com/">
432
<img src="docs/inc/secret0_angel_small.png" width="520" alt="Secret0 logo">
@@ -29,8 +57,22 @@ SecretZero is a secrets as code management tool that automates the creation, see
2957
If you are an agent reading this repository remotely through `gh`, `curl`, or a GitHub/MCP client,
3058
start here.
3159

60+
**Agent runtime integration (Hermes / OpenClaw):**
61+
62+
```bash
63+
export SZ_AGENT_MODE=true
64+
secretzero agent list --format json
65+
secretzero agent adopt --dry-run --format json
66+
secretzero agent adopt --preseed-lockfile --format json
67+
secretzero agent sync --json -f ~/.hermes/Secretfile.yml
68+
```
69+
70+
See `skills/secretzero-agent-adopt/SKILL.md` for the full adopt/restore loop. `secretzero agent backup`
71+
is an alias of `agent adopt` (not `secretzero backup create`).
72+
3273
Skill files:
3374

75+
- `https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-agent-adopt/SKILL.md`
3476
- `https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-agent/SKILL.md`
3577
- `https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-author/SKILL.md`
3678
- `https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-handle/SKILL.md`
@@ -53,6 +95,7 @@ Use that downloader like this:
5395
Direct Hermes install:
5496

5597
```bash
98+
hermes skills install https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-agent-adopt/SKILL.md
5699
hermes skills install https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-agent/SKILL.md
57100
hermes skills install https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-author/SKILL.md
58101
hermes skills install https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-handle/SKILL.md
@@ -176,8 +219,9 @@ uv tool install "secretzero[all]"
176219

177220
### Agent Skills
178221

179-
SecretZero ships three focused skills for agentic workflows:
222+
SecretZero ships four focused skills for agentic workflows:
180223

224+
- [`secretzero-agent-adopt`](./skills/secretzero-agent-adopt/SKILL.md) for Hermes/OpenClaw adopt/list, restore, and GitOps capture
181225
- [`secretzero-agent`](./skills/secretzero-agent/SKILL.md) for runtime bootstrap, `agent sync`, and secure human-in-the-loop operations
182226
- [`secretzero-author`](./skills/secretzero-author/SKILL.md) for `Secretfile.yml` authoring, review, and safe discovery workflows
183227
- [`secretzero-handle`](./skills/secretzero-handle/SKILL.md) for `.env` / file-target workflows, `SZ_AGENT_MODE`, and spill-safe CLI usage
@@ -195,6 +239,7 @@ secretzero agent sync --help
195239
If you are running Hermes Agent, install the skills directly from this repository:
196240

197241
```bash
242+
hermes skills install https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-agent-adopt/SKILL.md
198243
hermes skills install https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-agent/SKILL.md
199244
hermes skills install https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-author/SKILL.md
200245
hermes skills install https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-handle/SKILL.md
@@ -213,6 +258,7 @@ If you are running OpenClaw, opening this repository as the agent workspace is e
213258

214259
```bash
215260
mkdir -p ~/.agents/skills
261+
cp -R skills/secretzero-agent-adopt ~/.agents/skills/
216262
cp -R skills/secretzero-agent ~/.agents/skills/
217263
cp -R skills/secretzero-author ~/.agents/skills/
218264
cp -R skills/secretzero-handle ~/.agents/skills/

agents/hermes/.gitsecrets.lock

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{
2+
"version": "1.0",
3+
"secrets": {
4+
"slack_bot_token": {
5+
"hash": "883ba1bbba18a308675a68dbc4748bb1f6776828c09b74509e09453f3619cf6b",
6+
"created_at": "2026-05-29T16:17:54.178698+00:00",
7+
"updated_at": "2026-05-29T16:17:54.178698+00:00",
8+
"last_rotated": null,
9+
"rotation_count": 0,
10+
"targets": {
11+
"local/file//Users/zacharyloeber/.hermes/.env": "883ba1bbba18a308675a68dbc4748bb1f6776828c09b74509e09453f3619cf6b"
12+
},
13+
"target_provenance": {
14+
"local/file//Users/zacharyloeber/.hermes/.env": [
15+
{
16+
"updated_at": "2026-05-29T16:17:54.179156+00:00",
17+
"actor": {
18+
"operation": "lockfile_import",
19+
"client": "cli"
20+
}
21+
}
22+
]
23+
}
24+
},
25+
"slack_app_token": {
26+
"hash": "44f8da714c12516fd267eca3dbd8dfa05e7a2e3eeec653b1ca503f67a7e3120e",
27+
"created_at": "2026-05-29T16:17:54.179248+00:00",
28+
"updated_at": "2026-05-29T16:17:54.179248+00:00",
29+
"last_rotated": null,
30+
"rotation_count": 0,
31+
"targets": {
32+
"local/file//Users/zacharyloeber/.hermes/.env": "44f8da714c12516fd267eca3dbd8dfa05e7a2e3eeec653b1ca503f67a7e3120e"
33+
},
34+
"target_provenance": {
35+
"local/file//Users/zacharyloeber/.hermes/.env": [
36+
{
37+
"updated_at": "2026-05-29T16:17:54.179253+00:00",
38+
"actor": {
39+
"operation": "lockfile_import",
40+
"client": "cli"
41+
}
42+
}
43+
]
44+
}
45+
},
46+
"telegram_bot_token": {
47+
"hash": "dc2180c7edb6c480df54cea330d1a28e8104b2abf9c70089fced93b44ee33371",
48+
"created_at": "2026-05-29T16:17:54.179336+00:00",
49+
"updated_at": "2026-05-29T16:17:54.179336+00:00",
50+
"last_rotated": null,
51+
"rotation_count": 0,
52+
"targets": {
53+
"local/file//Users/zacharyloeber/.hermes/.env": "dc2180c7edb6c480df54cea330d1a28e8104b2abf9c70089fced93b44ee33371"
54+
},
55+
"target_provenance": {
56+
"local/file//Users/zacharyloeber/.hermes/.env": [
57+
{
58+
"updated_at": "2026-05-29T16:17:54.179340+00:00",
59+
"actor": {
60+
"operation": "lockfile_import",
61+
"client": "cli"
62+
}
63+
}
64+
]
65+
}
66+
}
67+
},
68+
"secretfile": {
69+
"filename": "Secretfile.yml",
70+
"hash": "a301c5974a64ddd6981cbe4809cbd34b05add6a7e54e210816e2a045ea64720b",
71+
"synced_at": "2026-05-29T16:17:54.179346+00:00",
72+
"var_files": [],
73+
"variables_hash": "01b6fd0f13b7bc98a6b163ba9ff4dc2fe87cbe864faba9400722a10ca61471bc",
74+
"sync_identity": null,
75+
"manifest_spec_version": "1"
76+
},
77+
"metadata": {}
78+
}

agents/hermes/Secretfile.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# yaml-language-server: $schema=https://github.com/zloeber/SecretZero/raw/refs/heads/main/Secretfile.schema.json
2+
metadata:
3+
project: hermes-agent
4+
owner: agent-operator
5+
annotations:
6+
secretzero.integration.target: hermes
7+
secretzero.integration.source: /Users/zacharyloeber/.hermes
8+
variables:
9+
agent_home: /Users/zacharyloeber/.hermes
10+
providers:
11+
local:
12+
kind: local
13+
config: {}
14+
secrets:
15+
- name: slack_bot_token
16+
kind: static
17+
description: hermes credential for SLACK_BOT_TOKEN
18+
config:
19+
default: null
20+
targets:
21+
- provider: local
22+
kind: file
23+
config:
24+
path: /Users/zacharyloeber/.hermes/.env
25+
format: dotenv
26+
key: SLACK_BOT_TOKEN
27+
merge: true
28+
- name: slack_app_token
29+
kind: static
30+
description: hermes credential for SLACK_APP_TOKEN
31+
config:
32+
default: null
33+
targets:
34+
- provider: local
35+
kind: file
36+
config:
37+
path: /Users/zacharyloeber/.hermes/.env
38+
format: dotenv
39+
key: SLACK_APP_TOKEN
40+
merge: true
41+
- name: telegram_bot_token
42+
kind: static
43+
description: hermes credential for TELEGRAM_BOT_TOKEN
44+
config:
45+
default: null
46+
targets:
47+
- provider: local
48+
kind: file
49+
config:
50+
path: /Users/zacharyloeber/.hermes/.env
51+
format: dotenv
52+
key: TELEGRAM_BOT_TOKEN
53+
merge: true

agents/hermes/agent.env.template

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# SecretZero agent.env.template — safe to commit (no values)
2+
# Generated from present credentials at adopt time.
3+
4+
# messaging: slack_app_token
5+
# SLACK_APP_TOKEN=
6+
7+
# messaging: slack_bot_token
8+
# SLACK_BOT_TOKEN=
9+
10+
# messaging: telegram_bot_token
11+
# TELEGRAM_BOT_TOKEN=

docs/index.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,21 @@ SecretZero is a secrets management tool that automates the creation, seeding, an
5353
If you are an agent reading this project remotely through `gh`, `curl`, or a GitHub/MCP client,
5454
start here.
5555

56+
**Agent runtime integration (Hermes / OpenClaw):**
57+
58+
```bash
59+
export SZ_AGENT_MODE=true
60+
secretzero agent list --format json
61+
secretzero agent adopt --dry-run --format json
62+
secretzero agent adopt --preseed-lockfile --format json
63+
```
64+
65+
See `skills/secretzero-agent-adopt/SKILL.md`. `secretzero agent backup` is an alias of `agent adopt`
66+
(not `secretzero backup create`).
67+
5668
Skill files:
5769

70+
- `https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-agent-adopt/SKILL.md`
5871
- `https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-agent/SKILL.md`
5972
- `https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-author/SKILL.md`
6073
- `https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-handle/SKILL.md`
@@ -77,6 +90,7 @@ Use that downloader like this:
7790
Direct Hermes install:
7891

7992
```bash
93+
hermes skills install https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-agent-adopt/SKILL.md
8094
hermes skills install https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-agent/SKILL.md
8195
hermes skills install https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-author/SKILL.md
8296
hermes skills install https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-handle/SKILL.md
@@ -230,6 +244,7 @@ secretzero agent sync --help
230244
If you are running Hermes Agent, install the skills directly from this repository:
231245

232246
```bash
247+
hermes skills install https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-agent-adopt/SKILL.md
233248
hermes skills install https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-agent/SKILL.md
234249
hermes skills install https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-author/SKILL.md
235250
hermes skills install https://raw.githubusercontent.com/zloeber/SecretZero/main/skills/secretzero-handle/SKILL.md

docs/user-guide/agent-adopt.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Agent adopt (Hermes / OpenClaw)
2+
3+
Bootstrap a SecretZero environment from a local agent install without exposing secret values.
4+
5+
## Commands
6+
7+
```bash
8+
secretzero agent list --format json
9+
secretzero agent adopt --dry-run --format json
10+
secretzero agent adopt --preseed-lockfile --format json
11+
```
12+
13+
`secretzero agent backup` is an alias of `agent adopt`. It is **not** `secretzero backup create`.
14+
15+
## Defaults
16+
17+
- `--output-dir` defaults to the resolved agent install path (`~/.hermes`, `~/.openclaw`, …).
18+
- `--target` autodetects **Hermes**, then **OpenClaw**.
19+
- Only **present** catalog credentials become manifest secrets.
20+
21+
## GitOps capture
22+
23+
```bash
24+
secretzero agent adopt \
25+
--target hermes \
26+
--source-dir ~/.hermes \
27+
--output-dir ./agents/hermes \
28+
--template
29+
```
30+
31+
## Restore loop
32+
33+
1. `secretzero agent adopt --preseed-lockfile`
34+
2. `secretzero validate -f <Secretfile>`
35+
3. `secretzero agent sync --json -f <Secretfile>`
36+
4. `secretzero sync -f <Secretfile>`
37+
38+
See `skills/secretzero-agent-adopt/SKILL.md` and
39+
`docs/superpowers/specs/2026-05-27-agent-adopt-design.md`.

0 commit comments

Comments
 (0)