From 85a2d46083b5a5872af42cd7b0381d4219866f88 Mon Sep 17 00:00:00 2001 From: "Claude Opus 5.5 (claude-opus-5-5)" Date: Sun, 1 Nov 2026 14:44:50 +0100 Subject: [PATCH 1/5] feat(core): add the DeclareSecrets rule The stack declares secrets with secretspec now: each repository from the skeleton has a secretspec.toml, rune launch reads its credentials through ~/.config/rune/secretspec.toml, and provision stores new keys in the Keychain. The rule tells an agent to declare each secret with a description, read it only through secretspec, keep values out of the conversation and off argv, and give every call a reason. The delivery cast selects it. Change declare-secrets-per-repository. Co-Authored-By: Martin Zeman --- casts/delivery.yaml | 1 + .../proposal.md | 24 +++++++++++++++++++ .../declare-secrets-per-repository/spec.md | 20 ++++++++++++++++ .../declare-secrets-per-repository/tasks.md | 15 ++++++++++++ runes/core/rules/DeclareSecrets.md | 7 ++++++ 5 files changed, 67 insertions(+) create mode 100644 docs/changes/declare-secrets-per-repository/proposal.md create mode 100644 docs/changes/declare-secrets-per-repository/specs/declare-secrets-per-repository/spec.md create mode 100644 docs/changes/declare-secrets-per-repository/tasks.md create mode 100644 runes/core/rules/DeclareSecrets.md diff --git a/casts/delivery.yaml b/casts/delivery.yaml index cb765007..901121d1 100644 --- a/casts/delivery.yaml +++ b/casts/delivery.yaml @@ -9,6 +9,7 @@ runes: - core/rules/AnchorWorkingDirectory - core/rules/PreferTrash - core/rules/CaptureOnTouch + - core/rules/DeclareSecrets - development/skills/MergeTrain - development/skills/ForgeCycle - development/skills/AgentTeam diff --git a/docs/changes/declare-secrets-per-repository/proposal.md b/docs/changes/declare-secrets-per-repository/proposal.md new file mode 100644 index 00000000..baf0769e --- /dev/null +++ b/docs/changes/declare-secrets-per-repository/proposal.md @@ -0,0 +1,24 @@ +--- +status: proposed +--- + +# Declare secrets per repository + +## Why + +The runedeck stack now declares secrets with SecretSpec ([SecretSpec][SECRETSPEC]). The skeleton gives each repository a `secretspec.toml`. Rune launch reads its credentials through `~/.config/rune/secretspec.toml`, and provision stores new keys in the Keychain. An agent that does not know this still reads `~/.env` or puts a key on a command line. A core rule tells every session how to declare, read, and pass a secret. + +## What Changes + +- `runes/core/rules/DeclareSecrets.md` tells an agent to declare each secret in the repository's `secretspec.toml` and to read it only through secretspec. Values stay out of the conversation and off argv, and every call gives a reason. +- The `delivery` cast selects the rule. The `core` cast selects it through `core/**`. + +## Capabilities + +- declare-secrets-per-repository (new) + +## Impact + +- One new rule and one cast entry. The rule enters without a provenance sidecar, because it is first-party content. + +[SECRETSPEC]: https://github.com/cachix/secretspec diff --git a/docs/changes/declare-secrets-per-repository/specs/declare-secrets-per-repository/spec.md b/docs/changes/declare-secrets-per-repository/specs/declare-secrets-per-repository/spec.md new file mode 100644 index 00000000..d1fdbe3f --- /dev/null +++ b/docs/changes/declare-secrets-per-repository/specs/declare-secrets-per-repository/spec.md @@ -0,0 +1,20 @@ +## ADDED Requirements + +### Requirement: Agent declares each secret + +The deck MUST hold a rule about secrets. The rule MUST tell an agent to declare every secret a repository reads in that repository's secret declaration, with a description of its purpose. + +#### Scenario: Script needs a new token + +- **WHEN** an agent adds a script that reads a token the repository did not use before +- **THEN** the agent adds the token to the repository's secret declaration with a description + +### Requirement: Secret values stay out of the conversation + +The rule MUST tell an agent to read a secret only through the secret manager. It MUST forbid printing a value or reading one into the conversation. It MUST tell the agent to pass a value to a program on stdin and to give every read a reason. + +#### Scenario: Command needs a credential + +- **WHEN** an agent runs a command that needs a credential +- **THEN** the agent runs the command under the secret manager and reports only its result +- **AND** no credential value appears in the transcript or in a process argument diff --git a/docs/changes/declare-secrets-per-repository/tasks.md b/docs/changes/declare-secrets-per-repository/tasks.md new file mode 100644 index 00000000..15950d7d --- /dev/null +++ b/docs/changes/declare-secrets-per-repository/tasks.md @@ -0,0 +1,15 @@ +# Tasks + +## 1. Authoring + +- [x] 1.1 Add `runes/core/rules/DeclareSecrets.md` +- [x] 1.2 Add the rule to the `delivery` cast + +## 2. Verification + +- [x] 2.1 `rune validate` passes with the rule present +- [ ] 2.2 One bench run against a baseline with no rule (BenchArtifact): an agent asked to call an authenticated API reads the key through secretspec and prints no value + +## 3. Record + +- [ ] 3.1 Archive merges the delta into `docs/specs/` diff --git a/runes/core/rules/DeclareSecrets.md b/runes/core/rules/DeclareSecrets.md new file mode 100644 index 00000000..cfa26f70 --- /dev/null +++ b/runes/core/rules/DeclareSecrets.md @@ -0,0 +1,7 @@ +Declare every secret a repository reads in `secretspec.toml` at the repository root, each with a description. Add one with `secretspec add --description ""`. Read a secret only through `secretspec run -- ` or `secretspec get `, never from a dotenv file or a shell profile. + +Never print a secret value, and never read one into the conversation. When a command needs a secret, run it under `secretspec run` and report the result. Pass a value to a program on stdin, because a process list shows every argument. Store a value with `secretspec set --from-file -`. + +Give every call a reason with `--reason ""`. SecretSpec refuses an agent session that gives none, and its audit log keeps the reason beside the read. + +The harness credentials live in `~/.config/rune/secretspec.toml`. `rune launch` and `rune run` read an unset `from_env` key from it. Do not export a credential in the shell to start a launch. From 02ebb4dffba17db5590d54849df61066ba4094af Mon Sep 17 00:00:00 2001 From: "Claude Opus 5.5 (claude-opus-5-5)" Date: Sun, 1 Nov 2026 14:46:29 +0100 Subject: [PATCH 2/5] docs(changes): add the pull request body for declare-secrets-per-repository Co-Authored-By: Martin Zeman --- .../pull-request.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 docs/changes/declare-secrets-per-repository/pull-request.md diff --git a/docs/changes/declare-secrets-per-repository/pull-request.md b/docs/changes/declare-secrets-per-repository/pull-request.md new file mode 100644 index 00000000..e647251d --- /dev/null +++ b/docs/changes/declare-secrets-per-repository/pull-request.md @@ -0,0 +1,19 @@ +Adds the DeclareSecrets rule: declare each secret in `secretspec.toml`, read it only through secretspec, and keep values out of the conversation. + +## Plan + +Change `declare-secrets-per-repository`: proposal, one ADDED delta (`declare-secrets-per-repository`), and tasks under `docs/changes/declare-secrets-per-repository/`. + +## Changes + +- Adds `runes/core/rules/DeclareSecrets.md`: declare with `secretspec add`, read with `secretspec run` or `secretspec get`, pass values on stdin, give every call a `--reason`, and use `~/.config/rune/secretspec.toml` for harness credentials. +- Adds the rule to `casts/delivery.yaml`. The `core` cast selects it through `core/**`. + +## Testing + +- `rune validate`: 0 errors, `core/rules/DeclareSecrets.md` passes. +- `rune spec validate declare-secrets-per-repository` passes. The guarded push pipeline passed on this head. + +## Release Notes + +- New core rule DeclareSecrets for declaring and reading secrets through secretspec. From bfe8fc2bc9f80383bb260c3d938f0fcdd033f191 Mon Sep 17 00:00:00 2001 From: "Claude Opus 5.5 (claude-opus-5-5)" Date: Tue, 24 Nov 2026 01:09:13 +0100 Subject: [PATCH 3/5] fix(core): point DeclareSecrets at the provision manifest The rule names ~/.config/provision/secretspec.toml, which runedeck/provision publishes, as the declaration of the machine credentials, with one profile for each account. A repository reads such a credential from that manifest and does not declare it again. The rule also limits `secretspec get` to a pipe or a command substitution, and keeps the error text of secretspec out of the transcript, because a parse error quotes the value. Co-Authored-By: Martin Zeman --- docs/changes/declare-secrets-per-repository/proposal.md | 2 +- docs/changes/declare-secrets-per-repository/pull-request.md | 2 +- runes/core/rules/DeclareSecrets.md | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/changes/declare-secrets-per-repository/proposal.md b/docs/changes/declare-secrets-per-repository/proposal.md index baf0769e..cc292370 100644 --- a/docs/changes/declare-secrets-per-repository/proposal.md +++ b/docs/changes/declare-secrets-per-repository/proposal.md @@ -6,7 +6,7 @@ status: proposed ## Why -The runedeck stack now declares secrets with SecretSpec ([SecretSpec][SECRETSPEC]). The skeleton gives each repository a `secretspec.toml`. Rune launch reads its credentials through `~/.config/rune/secretspec.toml`, and provision stores new keys in the Keychain. An agent that does not know this still reads `~/.env` or puts a key on a command line. A core rule tells every session how to declare, read, and pass a secret. +The runedeck stack now declares secrets with SecretSpec ([SecretSpec][SECRETSPEC]). The skeleton gives each repository a `secretspec.toml`. Provision declares the machine's credentials and publishes the manifest at `~/.config/provision/secretspec.toml`. The owner's keys stay in the Keychain, and rune launch reads its credentials through that manifest. An agent that does not know this still reads `~/.env` or puts a key on a command line. A core rule tells every session how to declare, read, and pass a secret. ## What Changes diff --git a/docs/changes/declare-secrets-per-repository/pull-request.md b/docs/changes/declare-secrets-per-repository/pull-request.md index e647251d..9c6af9b5 100644 --- a/docs/changes/declare-secrets-per-repository/pull-request.md +++ b/docs/changes/declare-secrets-per-repository/pull-request.md @@ -6,7 +6,7 @@ Change `declare-secrets-per-repository`: proposal, one ADDED delta (`declare-sec ## Changes -- Adds `runes/core/rules/DeclareSecrets.md`: declare with `secretspec add`, read with `secretspec run` or `secretspec get`, pass values on stdin, give every call a `--reason`, and use `~/.config/rune/secretspec.toml` for harness credentials. +- Adds `runes/core/rules/DeclareSecrets.md`: declare with `secretspec add`, read with `secretspec run` or `secretspec get`, pass values on stdin, give every call a `--reason`, and use `~/.config/provision/secretspec.toml`, with the profile of the account, for the machine's credentials. - Adds the rule to `casts/delivery.yaml`. The `core` cast selects it through `core/**`. ## Testing diff --git a/runes/core/rules/DeclareSecrets.md b/runes/core/rules/DeclareSecrets.md index cfa26f70..4b61872b 100644 --- a/runes/core/rules/DeclareSecrets.md +++ b/runes/core/rules/DeclareSecrets.md @@ -1,7 +1,9 @@ Declare every secret a repository reads in `secretspec.toml` at the repository root, each with a description. Add one with `secretspec add --description ""`. Read a secret only through `secretspec run -- ` or `secretspec get `, never from a dotenv file or a shell profile. -Never print a secret value, and never read one into the conversation. When a command needs a secret, run it under `secretspec run` and report the result. Pass a value to a program on stdin, because a process list shows every argument. Store a value with `secretspec set --from-file -`. +Never print a secret value, and never read one into the conversation. When a command needs a secret, run it under `secretspec run` and report the result. Use `secretspec get` only where a pipe or a command substitution takes its output. A bare call prints the value into the transcript. Pass a value to a program on stdin, because a process list shows every argument. Never type or paste a value yourself. Ask the owner to store a new secret with `secretspec set `, which prompts and does not echo. A program that makes a value pipes it into `secretspec set --from-file -`. + +Never show secretspec's own error text: a dotenv parse error quotes the line, value included. Send the stderr of `secretspec get` to `/dev/null` and report its exit code. Give every call a reason with `--reason ""`. SecretSpec refuses an agent session that gives none, and its audit log keeps the reason beside the read. -The harness credentials live in `~/.config/rune/secretspec.toml`. `rune launch` and `rune run` read an unset `from_env` key from it. Do not export a credential in the shell to start a launch. +runedeck/provision declares the machine's credentials, the harness keys among them, and publishes that manifest at `~/.config/provision/secretspec.toml`. A repository that reads one of these credentials reads it from that manifest and does not declare it again. Each account reads its own profile: `owner` on the owner's machines, `agents` for the agent user on Cortex. For example: `secretspec get --file ~/.config/provision/secretspec.toml --profile owner --reason ""`. `rune launch` and `rune run` read an unset `from_env` key from that manifest. Do not export a credential in the shell to start a launch. From 2e2f2c6078b667aefdd4e08b618973e94a6e389f Mon Sep 17 00:00:00 2001 From: "Claude Opus 5.5 (claude-opus-5-5)" Date: Tue, 24 Nov 2026 01:24:47 +0100 Subject: [PATCH 4/5] fix(core): show DeclareSecrets reads under secretspec run The example for the provision manifest was a bare `secretspec get`, the call the same rule forbids because it prints the value into the transcript. It is now a `secretspec run` call. The reason sentence names what secretspec 0.21.1 does: by default it refuses an agent session without --reason, and only a provider that keeps an audit log records the reason. The comment in secretspec.toml shows the read with a reason. Resolves-Thread: https://github.com/runedeck/deck/pull/86#discussion_r4673853894 Resolves-Thread: https://github.com/runedeck/deck/pull/86#discussion_r4673853903 Co-Authored-By: Martin Zeman --- runes/core/rules/DeclareSecrets.md | 4 ++-- secretspec.toml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runes/core/rules/DeclareSecrets.md b/runes/core/rules/DeclareSecrets.md index 4b61872b..e740d37c 100644 --- a/runes/core/rules/DeclareSecrets.md +++ b/runes/core/rules/DeclareSecrets.md @@ -4,6 +4,6 @@ Never print a secret value, and never read one into the conversation. When a com Never show secretspec's own error text: a dotenv parse error quotes the line, value included. Send the stderr of `secretspec get` to `/dev/null` and report its exit code. -Give every call a reason with `--reason ""`. SecretSpec refuses an agent session that gives none, and its audit log keeps the reason beside the read. +Give every call a reason with `--reason ""`. By default SecretSpec refuses an agent session that gives none, and a provider that keeps an audit log writes the reason into it. -runedeck/provision declares the machine's credentials, the harness keys among them, and publishes that manifest at `~/.config/provision/secretspec.toml`. A repository that reads one of these credentials reads it from that manifest and does not declare it again. Each account reads its own profile: `owner` on the owner's machines, `agents` for the agent user on Cortex. For example: `secretspec get --file ~/.config/provision/secretspec.toml --profile owner --reason ""`. `rune launch` and `rune run` read an unset `from_env` key from that manifest. Do not export a credential in the shell to start a launch. +runedeck/provision declares the machine's credentials, the harness keys among them, and publishes that manifest at `~/.config/provision/secretspec.toml`. A repository that reads one of these credentials reads it from that manifest and does not declare it again. Each account reads its own profile: `owner` on the owner's machines, `agents` for the agent user on Cortex. A command that needs one runs as `secretspec run --file ~/.config/provision/secretspec.toml --profile owner --reason "" -- `. `rune launch` and `rune run` read an unset `from_env` key from that manifest. Do not export a credential in the shell to start a launch. diff --git a/secretspec.toml b/secretspec.toml index 644add28..02edbe8c 100644 --- a/secretspec.toml +++ b/secretspec.toml @@ -1,8 +1,8 @@ #:schema https://secretspec.dev/schema/secretspec.schema.json # The secrets this repository's scripts and checks read. Declare a new one with # `secretspec add --description ""`, and read it with -# `secretspec run -- ` or `secretspec get `. No value ever enters -# the repository. On a workstation, values come from the provider the owner's +# `secretspec run --reason "" -- `. An agent session must give a +# reason. No value ever enters the repository. On a workstation, values come from the provider the owner's # secretspec config names, the Keychain by default. The ci profile reads them # from the job environment only. # Reference: https://secretspec.dev/reference/configuration/ From 9754ae71982f1fd5c234946cd5ae4cd5d5b332a6 Mon Sep 17 00:00:00 2001 From: "Claude Opus 5.5 (claude-opus-5-5)" Date: Wed, 25 Nov 2026 01:17:37 +0100 Subject: [PATCH 5/5] merge-seal: {"reviewed_sha":"2e2f2c6078b667aefdd4e08b618973e94a6e389f","generation":2,"digest":"a1c60ba7ee8bf4798a2c44eb9a0b2b94233f7c0803e8874dd1ddec41d48e6e95"}