interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

GitHub aien-dev/aien-sovereign-core-mv#407 (code only)

closed derived 6b4c18aded1faec6 #407

Imported from GitHub aien-dev/aien-sovereign-core-mv#407 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base f8d8c72e7a5517103dd120983933a6773ce81e18 · Head 4e648b9b8810e224c6de893e301e9dd4455df0fd

Apply it

git checkout -b patch-6b4c18aded1faec6 f8d8c72e7a5517103dd120983933a6773ce81e18
curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/6b4c18aded1faec6.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/aien-sovereign-core-mv
407
4e648b9b8810e224c6de893e301e9dd4455df0fd
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":407,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/407","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:05Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index 60232364..b7797c15 100644
--- a/.crumb
+++ b/.crumb
@@ -64,8 +64,8 @@
     "generated": {
       "children": [
         {
-          "digest": "da02b290ccbade3c314008569855264df7c1fe419d4cd6762517cc1f3b179dcf",
-          "last_commit": "b097a56",
+          "digest": "bc6f40b1151875289060253262a789e03563c9df036f500dec18ae21532324e2",
+          "last_commit": "19c00d4",
           "name": "scripts",
           "purpose": ""
         },
@@ -76,15 +76,15 @@
           "purpose": ""
         }
       ],
-      "children_root": "sha256:e5ff31069bcf711289819b6c09c3c96378cb1367e38f236992f113ca6a2dac23",
-      "compiled_at": "2026-10-11T01:25:50Z",
+      "children_root": "sha256:fde3a06dc77578e424777f1f6eee824390049694aff805601f603269f26db25d",
+      "compiled_at": "2026-10-11T01:37:05Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:8ceab18b92e0028b2a68c92d42d25d4888c70ef0cfd3c5a7697d1f6b5b13f755",
+      "digest": "sha256:182beb26b1a6b5e53650a03a20069567fb5b116a66112c0abb5e8961bf8cf33b",
       "evidence_files": 187,
       "evidence_root": "sha256:27ee0353cb4d4aae2b7dbce2bfe0d9f4ef2a94cd7a4555b84684d59372503280",
-      "files": 2411,
-      "generated_at_commit": "a88a55b6bd130ed94585442e94ed6444131ed195",
-      "source_tree": "sha256:04335bea60499db7ac7b2e6d4b8a40415531068fefc99412fd67246c9b8738f5"
+      "files": 2418,
+      "generated_at_commit": "66374c8aa2e6b45e9f808b38133b80c388ff0841",
+      "source_tree": "sha256:b16a97005fa59f346bfaddda0067fbee2f0962b9e9872304a21f73e08fa30507"
     }
   },
   "history": [],
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1ca242e9..371ae216 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -30,6 +30,9 @@ jobs:
       - name: Verify Signed Release Install
         run: bash scripts/test-install-release.sh
 
+      - name: Offline-signing handoff (ceremony rehearsal, offline sign, publish gate; throwaway keys only)
+        run: bash scripts/test-offline-signing.sh
+
       - name: Release gate negative tests (pins, digests, model inputs, signatures)
         run: bash scripts/test-release-checks.sh
 
diff --git a/.github/workflows/release-dry-run.yml b/.github/workflows/release-dry-run.yml
index 2cd62ba5..76dec126 100644
--- a/.github/workflows/release-dry-run.yml
+++ b/.github/workflows/release-dry-run.yml
@@ -24,6 +24,9 @@ jobs:
       - name: Tag release gate stays fail-closed (static guard)
         run: bash scripts/test-release-gate-wiring.sh
 
+      - name: No release key in CI; release.yml only drafts; publish only after the offline-signature gate (static guard)
+        run: bash scripts/test-release-signing-workflow.sh
+
       # Report only: main may move ahead of the candidate's omega-commit. A release is cut from a commit whose tree
       # passes this gate; release.yml enforces it on tag push (guarded by scripts/test-release-gate-wiring.sh).
       - name: Tree gate on this revision (report, does not block)
diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml
new file mode 100644
index 00000000..abc12f86
--- /dev/null
+++ b/.github/workflows/release-publish.yml
@@ -0,0 +1,47 @@
+name: "Release publish (stage 3: verify the offline signature, then publish the draft)"
+
+# Offline-signing handoff, stage 3 (Drake ruling 1, sc#385; docs/release/RELEASE_SIGNING.md). Run by hand after the
+# operator has uploaded SHA256SUMS.txt.sig, made offline with the public-release key, to the draft release that
+# release.yml drafted for the tag. This workflow holds no key and signs nothing: it checks out the tagged commit (so the
+# key it trusts is the one pinned in that commit), downloads the draft's assets, runs scripts/release-publish-gate.sh,
+# and publishes only when the gate passes. Unsigned, mismatched, dry-run, internal-test-key and placeholder-key releases
+# are refused. Static guard: scripts/test-release-signing-workflow.sh.
+on:
+  workflow_dispatch:
+    inputs:
+      tag:
+        description: "The v* tag whose draft release now carries SHA256SUMS.txt.sig"
+        required: true
+        type: string
+
+permissions:
+  contents: write
+
+jobs:
+  verify-and-publish:
+    name: Verify the offline signature and publish
+    runs-on: ubuntu-latest
+    env:
+      TAG: ${{ inputs.tag }}
+      GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+    steps:
+      - name: Check the tag name
+        run: |
+          printf '%s\n' "$TAG" | grep -qxE 'v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?' || { echo "not a release tag: $TAG" >&2; exit 1; }
+
+      - name: Checkout the tagged commit (its docs/release/allowed_signers is the key this release is checked against)
+        uses: actions/checkout@v4
+        with:
+          ref: refs/tags/${{ inputs.tag }}
+
+      - name: Download the draft release assets
+        run: |
+          [ "$(gh release view "$TAG" --json isDraft --jq .isDraft)" = true ] || { echo "$TAG is not a draft release; nothing to publish" >&2; exit 1; }
+          gh release download "$TAG" --dir release-assets
+          ls -l release-assets
+
+      - name: Publish gate (offline signature valid for the pinned release key, every asset matches, no dry-run asset)
+        run: bash scripts/release-publish-gate.sh release-assets docs/release/allowed_signers
+
+      - name: Publish the verified draft
+        run: gh release edit "$TAG" --draft=false
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 4d929bcb..f3716f85 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -122,8 +122,13 @@ jobs:
             aien-cli-sha256-${{ matrix.target }}.txt
             DRY-RUN-STATUS-${{ matrix.target }}.txt
 
+  # Offline-signing handoff (Drake ruling 1, sc#385; docs/release/RELEASE_SIGNING.md). No private release key is ever
+  # in CI, a secret, or this repository. Stage 1 (draft-release, below) builds and publishes checksums to a DRAFT
+  # release. Stage 2 is the operator, offline: sign SHA256SUMS.txt and upload SHA256SUMS.txt.sig to the draft.
+  # Stage 3 (.github/workflows/release-publish.yml) verifies that signature against docs/release/allowed_signers and
+  # only then publishes. Static guard: scripts/test-release-signing-workflow.sh.
   dry-run-sign:
-    name: "Dry run: sign with a throwaway key and verify"
+    name: "Dry run: label, sign with a throwaway key made in this job, verify (signature_check dry-run-key)"
     needs: build-release
     if: github.event_name == 'workflow_dispatch' && inputs.dry_run
     runs-on: ubuntu-latest
@@ -139,17 +144,32 @@ jobs:
           path: release-artifacts
           merge-multiple: true
 
-      - name: Checksums, throwaway signature, verification
+      - name: "Label, checksums, throwaway signature, verification (DRY RUN, not a release)"
         working-directory: release-artifacts
         run: |
+          for a in sovereign-*.tar.gz; do
+            tar -xzOf "$a" ./release.toml | grep -qx 'dry-run = true' || { echo "$a: release.toml is not labelled dry-run" >&2; exit 1; }
+          done
+          echo "DRY RUN: signed with a throwaway key generated in this job and deleted (signature_check dry-run-key). Not the AIEN release key. Not a release. Never publish." > DRY-RUN-NOT-A-RELEASE.txt
           cat aien-cli-sha256-*.txt > aien-cli-digests.txt
-          sha256sum sovereign-* aien-cli-digests.txt > SHA256SUMS.txt
-          ssh-keygen -q -t ed25519 -N "" -C aien-dry-run-throwaway -f ../dry_key
-          printf "aien-release %s\n" "$(cut -d" " -f1,2 ../dry_key.pub)" > ../dry_signers
-          ssh-keygen -Y sign -f ../dry_key -n aien-release SHA256SUMS.txt
-          ../scripts/verify-release-assets.sh . ../dry_signers
-          rm -f ../dry_key
-          echo "DRY RUN: signed with a throwaway key generated in this job. Not the AIEN release key. Not a release." > DRY-RUN-NOT-A-RELEASE.txt
+          sha256sum sovereign-* aien-cli-digests.txt DRY-RUN-*.txt > SHA256SUMS.txt
+          umask 077
+          ssh-keygen -q -t ed25519 -N "" -C aien-dry-run-throwaway -f "$RUNNER_TEMP/dry_key"
+          printf "aien-release %s\n" "$(cut -d" " -f1,2 "$RUNNER_TEMP/dry_key.pub")" > dry-run-signers
+          ssh-keygen -Y sign -f "$RUNNER_TEMP/dry_key" -n aien-release SHA256SUMS.txt
+          rm -f "$RUNNER_TEMP/dry_key" "$RUNNER_TEMP/dry_key.pub"
+          ../scripts/verify-release-assets.sh . dry-run-signers
+          cat SHA256SUMS.txt
+
+      - name: "Negative control: the publish gate refuses this dry run, under the pinned key and under its own key"
+        run: |
+          if bash scripts/release-publish-gate.sh release-artifacts docs/release/allowed_signers; then
+            echo "publish gate accepted a dry run under docs/release/allowed_signers" >&2; exit 1
+          fi
+          if bash scripts/release-publish-gate.sh release-artifacts release-artifacts/dry-run-signers; then
+            echo "publish gate accepted a dry run under its own throwaway key" >&2; exit 1
+          fi
+          echo "publish gate refused the dry run, as it must"
 
       - name: Upload dry-run artifacts (workflow artifacts only, no release)
         uses: actions/upload-artifact@v4
@@ -157,8 +177,9 @@ jobs:
           name: dry-run-signed-assets
           path: release-artifacts
 
-  publish-release:
-    name: Publish Release and Checksums
+  # Stage 1. Never signs and never publishes: it creates a DRAFT release holding the archives and SHA256SUMS.txt.
+  draft-release:
+    name: "Stage 1: checksums and a draft release (unsigned; the operator signs offline)"
     needs: build-release
     if: github.event_name == 'push' || inputs.dry_run == false
     runs-on: ubuntu-latest
@@ -166,6 +187,13 @@ jobs:
       - name: Checkout Source
         uses: actions/checkout@v4
 
+      - name: Refuse anything but a v* tag
+        run: |
+          if [ "$GITHUB_REF_TYPE" != tag ] || [ "${GITHUB_REF_NAME#v}" = "$GITHUB_REF_NAME" ]; then
+            echo "A release is drafted only from a v* tag (this run is on $GITHUB_REF_TYPE $GITHUB_REF_NAME). Nothing was drafted." >&2
+            exit 1
+          fi
+
       - name: Download Build Artifacts
         uses: actions/download-artifact@v4
         with:
@@ -179,39 +207,19 @@ jobs:
           sha256sum sovereign-* aien-cli-digests.txt > SHA256SUMS.txt
           cat SHA256SUMS.txt
 
-      - name: Sign Checksums (fails the job when the release key secret is absent)
-        working-directory: release-artifacts
-        env:
-          AIEN_RELEASE_SIGNING_KEY: ${{ secrets.AIEN_RELEASE_SIGNING_KEY }}
-        run: |
-          if [ -z "$AIEN_RELEASE_SIGNING_KEY" ]; then
-            echo "AIEN_RELEASE_SIGNING_KEY secret is not configured. Refusing to publish an unsigned release." >&2
-            exit 1
-          fi
-          umask 077
-          printf "%s\n" "$AIEN_RELEASE_SIGNING_KEY" > ../release_key
-          ssh-keygen -Y sign -f ../release_key -n aien-release SHA256SUMS.txt
-          rm -f ../release_key
-          ../scripts/verify-release-assets.sh . ../docs/release/allowed_signers
-
-      - name: Publish GitHub Release
+      - name: Create the draft release (no signature; not public until release-publish.yml verifies the offline signature)
         env:
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          TAG: ${{ github.ref_name }}
         run: |
-          TAG="${GITHUB_REF_NAME}"
-          if [ -z "$TAG" ] || [ "$TAG" = "main" ]; then
-            TAG="v0.1.0"
-          fi
-
-          NOTES_FILE="RELEASE_NOTES.md"
-          if [ ! -f "$NOTES_FILE" ]; then
-            echo "# AIEN Sovereign Core ${TAG}" > "$NOTES_FILE"
-            echo "" >> "$NOTES_FILE"
-            echo "Official release of the AIEN Sovereign Native Systems Architecture." >> "$NOTES_FILE"
+          if gh release view "$TAG" >/dev/null 2>&1; then
+            echo "A release named $TAG already exists. Refusing to replace it." >&2
+            exit 1
           fi
-
           {
-            cat "$NOTES_FILE"
+            echo "> DRAFT, AWAITING THE OFFLINE SIGNATURE. Not published. See docs/release/RELEASE_SIGNING.md."
+            echo
+            if [ -f RELEASE_NOTES.md ]; then cat RELEASE_NOTES.md; else echo "# AIEN Sovereign Core ${TAG}"; fi
             echo
             echo "## aien-cli digests (compare with the candidate manifest [executables] aien-cli-native-release)"
             echo
@@ -221,15 +229,7 @@ jobs:
             cat release-artifacts/aien-cli-digests.txt
             echo '```'
           } > release-notes-with-digests.md
-          NOTES_FILE=release-notes-with-digests.md
-
           cd release-artifacts
-          SIG=""
-          [ -f SHA256SUMS.txt.sig ] || { echo "SHA256SUMS.txt.sig is missing; refusing to publish" >&2; exit 1; }
-          SIG="SHA256SUMS.txt.sig"
-          gh release create "$TAG" sovereign-* aien-cli-digests.txt SHA256SUMS.txt $SIG \
+          gh release create "$TAG" --draft --verify-tag sovereign-* aien-cli-digests.txt SHA256SUMS.txt \
             --title "AIEN Sovereign Core ${TAG}" \
-            --notes-file ../"$NOTES_FILE" \
-            --draft=false \
-            --prerelease=false || \
-          gh release upload "$TAG" sovereign-* aien-cli-digests.txt SHA256SUMS.txt $SIG --clobber
+            --notes-file ../release-notes-with-digests.md
diff --git a/docs/release/BUILD_RECIPE.md b/docs/release/BUILD_RECIPE.md
index b723af04..918f4dd2 100644
--- a/docs/release/BUILD_RECIPE.md
+++ b/docs/release/BUILD_RECIPE.md
@@ -45,18 +45,26 @@ package aien-proof or aien-test.
   `[executables] aien-cli-native-release`, and each helper binary must equal its `sc-<name>` entry. A package without `--native` is refused (no candidate digest for that kind); the release matrix builds only the native target.
 - `scripts/verify-release-assets.sh <dir> <allowed_signers>`: signature on `SHA256SUMS.txt` valid for the pinned
   signer, every listed file matches, every `sovereign-*` archive is covered.
+- `scripts/release-publish-gate.sh <dir> <allowed_signers>`: the stage-3 publish decision (see `RELEASE_SIGNING.md`).
 - `scripts/test-release-checks.sh` (also in CI) proves each of these rejects: wrong omega.lock or Cargo.lock pins,
   executable digest mismatch, model input mismatch, missing, corrupt or foreign signature, tampered files.
 
 ## Release workflow modes
 
-- Tag push `v*`: build, check, sign with the `AIEN_RELEASE_SIGNING_KEY` secret (job fails if absent), verify against
-  `docs/release/allowed_signers`, publish. Until the public-release key steps in `RELEASE_SIGNING.md` are done, what this
-  publishes is an internal test release signed with the old key, never a public release.
-- Manual run (`workflow_dispatch`): input `dry_run`, default true. Builds, packages, checks, signs with a throwaway key
-  generated in the job (labelled in `DRY-RUN-NOT-A-RELEASE.txt`), verifies, uploads workflow artifacts only. Gate or
-  package-check failures are recorded in `DRY-RUN-STATUS-<target>.txt` instead of stopping the run. It never creates a
-  release. With `dry_run` set to false a manual run publishes like a tag push.
+- Tag push `v*` (stage 1 of the offline-signing handoff, `RELEASE_SIGNING.md`): build, check, write `SHA256SUMS.txt`
+  and create a DRAFT release holding the archives and checksums. No signature is made in CI and no key is in CI or a
+  secret. The draft is not public. A manual run with `dry_run` false does the same, and only from a `v*` tag.
+- Stage 2, the operator, offline: sign `SHA256SUMS.txt` with the public-release key (`scripts/key-ceremony.sh sign`)
+  and attach `SHA256SUMS.txt.sig` to the draft.
+- Stage 3, `release-publish.yml` (manual, input `tag`): checks out the tag, downloads the draft, runs
+  `scripts/release-publish-gate.sh` against that commit's `docs/release/allowed_signers` and publishes only if it
+  passes. It refuses unsigned, mismatched, dry-run, internal-test-key and placeholder-key releases.
+- Manual run (`workflow_dispatch`): input `dry_run`, default true. Builds, packages with the manifest labelled
+  `dry-run = true`, checks, writes `DRY-RUN-NOT-A-RELEASE.txt` into the signed checksum list, signs with a throwaway
+  key generated in the job (public half uploaded as `dry-run-signers`, private half deleted), verifies, shows that the
+  publish gate refuses it, uploads workflow artifacts only. Gate or package-check failures are recorded in
+  `DRY-RUN-STATUS-<target>.txt` instead of stopping the run. It never creates a release. Installed with
+  `AIEN_DRY_RUN_SIGNERS=dry-run-signers`, it is recorded as `signature_check: dry-run-key`.
 - Pull requests (`release-dry-run.yml`): the publish guard, `scripts/test-release-gate-wiring.sh` and the refusal suite
   (`scripts/test-release-real-tree.sh`, run on a fixture tree pinned to the candidate) block. The tree gate on the PR's
   own revision only reports "IS / is NOT releasable as <candidate>" in the step summary: main may move ahead of the
diff --git a/docs/release/KEY_CEREMONY.md b/docs/release/KEY_CEREMONY.md
new file mode 100644
index 00000000..796a2cb4
--- /dev/null
+++ b/docs/release/KEY_CEREMONY.md
@@ -0,0 +1,82 @@
+# Release key ceremony (plain-English guide)
+
+This is how the AIEN public-release key gets made. It happens once. Drake (the operator) does it with one witness
+watching. The script `scripts/key-ceremony.sh` walks through every step on screen and stops if anything is wrong.
+Operator checklist: sc#118. Ruling: Drake ruling 1, sc#385.
+
+**What the key is.** A digital seal. Every public release gets a small seal file (`SHA256SUMS.txt.sig`). Anyone's
+computer can check that seal against the public half of the key, which is published in this repository. Only the
+private half can make a seal, so the private half must never touch the internet.
+
+**What is human-only.** Everything in this guide. No AI, CI job or server makes, holds or uses this key. The steps an
+AI may do are listed at the end.
+
+## What you need
+
+- One computer that will stay **offline** for the ceremony: network cable out, Wi-Fi off. A spare laptop is fine.
+  It needs `ssh-keygen` (part of OpenSSH; on a Mac or Linux it is already there) and a copy of this repository's
+  `scripts/key-ceremony.sh` (copy it on a USB stick before you unplug the network).
+- Two USB sticks for the backups (label them "AIEN KEY BACKUP 1" and "2"), and a third for carrying public files out.
+- A witness, a pen and paper.
+- A passphrase you can remember: long, written nowhere the key is kept.
+
+## Practise first (optional, five minutes, safe anywhere)
+
+```sh
+bash scripts/key-ceremony.sh ceremony --rehearsal --out /tmp/practice --backup /tmp/practice-b1 --backup /tmp/practice-b2
+```
+
+It makes a throwaway key labelled REHEARSAL everywhere. It is never a release key. Delete `/tmp/practice*` after.
+
+## The ceremony
+
+1. **Go offline.** Unplug the network cable and turn Wi-Fi off. Plug in the two backup sticks. The witness watches the
+   screen from here on.
+2. **Start the script** in a terminal, in the folder holding the script:
+   ```sh
+   bash key-ceremony.sh ceremony --out ~/aien-key --backup /media/BACKUP1/aien-key --backup /media/BACKUP2/aien-key
+   ```
+   (On a Mac the sticks appear under `/Volumes/` instead of `/media/`.) If the computer still has a network route, or
+   any folder is inside a code checkout, the script stops and tells you why. Nothing is made yet.
+3. **Confirm and give names.** Type `yes` to confirm you are offline and the witness is watching, then type your name
+   and the witness's name.
+4. **Make the key.** `ssh-keygen` asks for the passphrase twice. The witness does not look at the keyboard.
+5. **Fingerprint.** The screen shows a line like `SHA256:Ab3...xYz`. The witness copies it onto paper by hand, then
+   types its last 8 characters back in. If they do not match, the script stops.
+6. **Public-key verification test (automatic).** The key seals a fresh test file, the seal is checked against the
+   public key, and then a copy of the file with one letter changed must be **refused**. You will see:
+   `good signature verifies: yes` and `altered file is refused: yes`. You type the passphrase once here.
+7. **Verified backups.** For each stick, type `yes` when it is plugged in. The key is copied, compared byte for byte,
+   and the copy on the stick must seal and verify on its own (passphrase again). You will see
+   `backup 1 is an exact copy: yes` and the two test lines, then the same for backup 2.
+8. **The public record.** The script prints the record and saves it with the public key in `~/aien-key/public/`
+   (`allowed_signers` and `ceremony-record.txt`). Nothing secret is in that folder. The witness signs the paper
+   with the fingerprint, date and both names.
+9. **Carry out the public half only.** Copy the folder `~/aien-key/public` to the third stick. Never copy the key
+   file itself. Store the two backup sticks in two different safe places.
+
+## After the ceremony
+
+- Hand `public/allowed_signers` and `public/ceremony-record.txt` to the orchestrator. It opens one pull request that
+  puts that key line into `docs/release/allowed_signers` and `install.sh` (`AIEN_RELEASE_SIGNER`), and the tests prove
+  a release sealed with it installs as `signature_check: release`. You check the fingerprint in that pull request
+  against your paper before it is merged.
+- Any time later, check a backup still works (offline machine, stick plugged in):
+  `bash key-ceremony.sh verify-backup /media/BACKUP1/aien-key/aien_release_ed25519 ~/aien-key/public/allowed_signers`
+  You should see `backup OK`.
+
+## Signing a release (each release, human only)
+
+1. CI drafts the release and its `SHA256SUMS.txt` (not public yet).
+2. Copy `SHA256SUMS.txt` to a stick, take it to the offline machine and run
+   `bash key-ceremony.sh sign ~/aien-key/aien_release_ed25519 ~/aien-key/public/allowed_signers SHA256SUMS.txt`.
+   It lists the files the seal vouches for; type `yes` if they are the release you mean, then the passphrase. You
+   should see `signed and verified: SHA256SUMS.txt.sig`.
+3. Carry `SHA256SUMS.txt.sig` back and attach it to the draft release on GitHub. Then the publish workflow checks the
+   seal and publishes; if anything does not match, it refuses and nothing is published.
+
+## What an AI may do, and what it never does
+
+May: write and test this script with throwaway REHEARSAL keys, prepare the pull request that pins the public key,
+run the publish workflow after you have attached the seal. Never: make, see, copy, store or use the real private key;
+claim a ceremony happened; create a public release tag.
diff --git a/docs/release/RELEASE_SIGNING.md b/docs/release/RELEASE_SIGNING.md
index bb3f431e..83cc92fe 100644
--- a/docs/release/RELEASE_SIGNING.md
+++ b/docs/release/RELEASE_SIGNING.md
@@ -1,36 +1,80 @@
 # Release signing
 
-## Status of this key and of v0.1.0 / v0.1.1 (Drake decision, 2026-10-08)
+## Where things stand (Drake ruling 1, 2026-10-10, sc#385 and arch#190)
 
-- **v0.1.0 and v0.1.1 are internal test releases.** They are not public releases, whatever their release pages say. v0.1.0 carries only `SHA256SUMS.txt` and has no signature. v0.1.1 carries `SHA256SUMS.txt.sig`, made with the key pinned below (verified 2026-10-08).
-- **The key pinned below is the old release-signing key.** It is NOT the dedicated offline release key that a public release requires (aien-architecture `CURRENT_EXECUTION_PLAN.md`, addendum 2026-10-06 (late), D1). The 2026-10-06 decision keeps the operator's home-server and login keys out of release signing; this key does not satisfy that gate.
-- **It stays pinned for internal compatibility.** The pinned public key stays in `allowed_signers` and in `install.sh` (`AIEN_PINNED_SIGNER`), so internal installs, upgrades, the release gate and the existing receipts keep verifying. Anything signed with it is an internal test release.
-- **A public release requires three steps.** Each needs Drake's separate go-ahead when it is done:
-  1. a documented key-generation ceremony for the dedicated offline release key;
-  2. custody verification of that key;
-  3. a signature-verification test showing a release signed with the new key verifies against the newly pinned public key.
-- **No key is generated now.** No ceremony date is set. Nothing in this repository counts the old key as the public-release key.
+- **No public-release key exists yet.** A public release needs a new, dedicated, offline Ed25519 key. Its private half
+  never exists on GitHub, in CI, in a secret, on a production machine, or in this repository. A CI secret does not
+  qualify. It is made at a witnessed key ceremony with a verified backup and a public-key verification test
+  (`KEY_CEREMONY.md`, operator checklist sc#118). Until then `allowed_signers` is a labelled **PLACEHOLDER** with no key
+  line, `install.sh` has an empty `AIEN_RELEASE_SIGNER`, and nothing can verify or be recorded as a public release.
+- **The old key is the internal test key.** It signed v0.1.1. It is not reused for public releases. Its public half
+  moved to `internal_test_signers` (and `AIEN_INTERNAL_TEST_SIGNER` in `install.sh`), so internal installs keep
+  working; anything it verifies is recorded as `signature_check: internal-test-key`.
+- **v0.1.0 and v0.1.1 are internal test releases** (Drake decision 2026-10-08). v0.1.0 has only `SHA256SUMS.txt`;
+  v0.1.1 carries `SHA256SUMS.txt.sig` made with the internal test key.
+- Physical rollback is also required before any public tag (public-release gates, 2026-10-06); this file covers signing
+  only.
 
-Every release carries `SHA256SUMS.txt` (one line per asset) and
-`SHA256SUMS.txt.sig`, an OpenSSH signature made with the AIEN release key.
-The public half of that key is `allowed_signers` in this folder, so the key a
-release is checked against is pinned in the same commit the release is cut from.
+## The three stages of a release (offline-signing handoff)
 
-Verify a download:
+1. **CI builds and publishes checksums, unsigned.** A `v*` tag push runs `.github/workflows/release.yml`: build the
+   reproducible archive, run the release gate, write `SHA256SUMS.txt`, and create a **draft** release holding the
+   archives and `SHA256SUMS.txt`. The draft is not public. CI holds no signing key.
+2. **The operator signs offline.** Carry `SHA256SUMS.txt` (only that file) to the offline machine on a USB stick and run
+   `scripts/key-ceremony.sh sign <key> <allowed_signers> SHA256SUMS.txt`. It shows the files the signature vouches
+   for, signs, and verifies the signature before anything leaves the machine. Carry `SHA256SUMS.txt.sig` back and
+   attach it to the draft release (GitHub release page, "Edit", drop the file in; or `gh release upload <tag>
+   SHA256SUMS.txt.sig`). **Human only.**
+3. **CI verifies, then publishes.** Run `.github/workflows/release-publish.yml` by hand with the tag. It checks out the
+   tagged commit, downloads the draft, and runs `scripts/release-publish-gate.sh` against that commit's
+   `allowed_signers`. It publishes only if the signature is valid for the pinned release key, every asset matches its
+   checksum, and nothing is a dry run. Unsigned, mismatched, dry-run, internal-test-key and placeholder-key releases
+   are refused.
+
+The release key is pinned in `allowed_signers` (and `install.sh`) **before** the tag is cut, so the key a release is
+checked against is fixed in the same commit the release is built from.
+
+## What `install.sh` records
+
+`install.sh` release mode (`AIEN_RELEASE_TAG=vX.Y.Z`) verifies `SHA256SUMS.txt.sig` with `ssh-keygen -Y verify`, then the
+archive checksum, then every file in the package's `release.toml`. The class is decided by which key verified, never by
+what the artifact claims, and is written to `installed.toml` (`signature-check`) and to `install-receipt.json`
+(`signature_check`, plus `artifact_sha256`, `files_verified`, `cli_sha256`, `daemon_sha256`):
+
+| `signature_check` | verified by | meaning |
+|---|---|---|
+| `release` | `AIEN_RELEASE_SIGNER` = `allowed_signers` | a public release (impossible until the ceremony) |
+| `internal-test-key` | `AIEN_INTERNAL_TEST_SIGNER` = `internal_test_signers` | internal test release, never public |
+| `dry-run-key` | a throwaway signer file named in `AIEN_DRY_RUN_SIGNERS` | dry run or test, never a release |
+
+A package whose `release.toml` says `dry-run = true` (or candidate `NOT-RELEASABLE`) is refused if it ever verifies as
+`release`. A missing signature, a one-byte change, an edited checksum list and a wrong key are each refused by name and
+install nothing (`scripts/test-install-release.sh`).
+
+Install a dry-run artifact (the `dry-run-signed-assets` workflow artifact of a manual `release.yml` run, unzipped into a
+folder):
 
 ```sh
-sha256sum -c SHA256SUMS.txt
-ssh-keygen -Y verify -f docs/release/allowed_signers -I aien-release -n aien-release \
-  -s SHA256SUMS.txt.sig < SHA256SUMS.txt
+AIEN_RELEASE_TAG=dry-run AIEN_RELEASE_BASE_URL="file:///path/to/folder" \
+AIEN_DRY_RUN_SIGNERS=/path/to/folder/dry-run-signers bash install.sh
 ```
 
-Sign (release author, on the machine that holds the private key; with the key pinned today this makes an internal test release only, see the status above):
+## Verify a download by hand
 
 ```sh
-ssh-keygen -Y sign -f ~/.ssh/id_ed25519_aien -n aien-release SHA256SUMS.txt
+sha256sum -c SHA256SUMS.txt
+ssh-keygen -Y verify -f docs/release/allowed_signers -I aien-release -n aien-release \
+  -s SHA256SUMS.txt.sig < SHA256SUMS.txt
 ```
 
 A GB10 release also carries `release_golden_path.json`, the artifact the
 `release_golden_path_records_whether_gb10_ran` test prints on the Spark. A
 release is only a GB10 release when that file says `"skipped": false`; it is
 listed in `SHA256SUMS.txt` and therefore covered by the signature.
+
+## Tests (all offline, throwaway keys only)
+
+- `scripts/test-install-release.sh`: signature classes, receipts, negative install rows.
+- `scripts/test-offline-signing.sh`: ceremony rehearsal, offline sign, publish gate refusals.
+- `scripts/test-release-signing-workflow.sh`: no release key in CI; release.yml only drafts; publish only after the gate.
+- `scripts/test-release-checks.sh`: signature and checksum verification, placeholder refusal.
diff --git a/docs/release/allowed_signers b/docs/release/allowed_signers
index d095e3c2..6e544c33 100644
--- a/docs/release/allowed_signers
+++ b/docs/release/allowed_signers
@@ -1 +1,6 @@
-aien-release ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID6WDVy2x8aV80ag10iPonS4J8k4seWrgsi5cuq8AIZJ
+# AIEN public-release signing key (ssh-keygen allowed_signers format, principal aien-release).
+# PLACEHOLDER: no public-release key exists yet. This file deliberately holds no key line, so `ssh-keygen -Y verify`
+# against it rejects every signature and nothing can pass as a public release by accident.
+# The key line is added only after Drake's witnessed key ceremony (docs/release/KEY_CEREMONY.md, sc#118), in the
+# same pull request that sets AIEN_RELEASE_SIGNER in install.sh. Only that one public key may ever be listed here.
+# The old internal test key is NOT reused (Drake ruling 1, sc#385); it lives in internal_test_signers.
diff --git a/docs/release/internal_test_signers b/docs/release/internal_test_signers
new file mode 100644
index 00000000..d4889aba
--- /dev/null
+++ b/docs/release/internal_test_signers
@@ -0,0 +1,4 @@
+# INTERNAL TEST KEY. Not a public-release key and never to be used for one (Drake ruling 1, sc#385).
+# It signed the internal test release v0.1.1. install.sh accepts it only to keep internal installs working and records
+# anything it verifies as signature_check internal-test-key, never release.
+aien-release ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID6WDVy2x8aV80ag10iPonS4J8k4seWrgsi5cuq8AIZJ
diff --git a/install.sh b/install.sh
index 45d70085..6650b3bc 100755
--- a/install.sh
+++ b/install.sh
@@ -133,7 +133,7 @@ link_bins() {
 
 # write_record <current-id> <previous-id|""> <action>: rewrite installed.toml atomically.
 write_record() {
-    local cur="$1" prev="$2" action="$3" now id at tmp="$CONFIG_DIR/.installed.toml.new.$$"
+    local cur="$1" prev="$2" action="$3" now id at sc tmp="$CONFIG_DIR/.installed.toml.new.$$"
     now="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
     {
         echo 'schema = "AienInstalledV1"'
@@ -149,6 +149,9 @@ write_record() {
             echo "candidate = \"$(toml_get "$REL_DIR/$id/release.toml" "" candidate)\""
             echo "aien-cli-sha256 = \"$(toml_get "$REL_DIR/$id/release.toml" "" aien-cli-sha256)\""
             echo "installed-at = \"${at:-$now}\""
+            sc="$(toml_get "$RECORD" "version.$id" signature-check)"
+            [[ "$action" != install || "$id" != "$cur" || -z "${SIG_CHECK:-}" ]] || sc="$SIG_CHECK"
+            [[ -z "$sc" ]] || echo "signature-check = \"$sc\""
             if [[ -n "$(toml_lines "$REL_DIR/$id/release.toml" model)" ]]; then
                 echo
                 echo "[version.$id.model]"
@@ -247,10 +250,15 @@ if [[ "$ACTION" == "rollback" ]]; then
     exit 0
 fi
 
-# Release signing key, pinned here so a release can be verified with nothing but
-# this file and the assets (offline). Must equal docs/release/allowed_signers;
-# scripts/test-install-release.sh checks that they match.
-AIEN_PINNED_SIGNER='aien-release ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID6WDVy2x8aV80ag10iPonS4J8k4seWrgsi5cuq8AIZJ'
+# Release signing keys, pinned here so a release can be verified with nothing but this file and the assets
+# (offline). scripts/test-install-release.sh checks both lines against their files in docs/release/.
+# AIEN_RELEASE_SIGNER is the dedicated offline public-release key (Drake ruling 1, sc#385). It equals the key line of
+# docs/release/allowed_signers. PLACEHOLDER: it is empty until the key ceremony (docs/release/KEY_CEREMONY.md)
+# produces the key, so until then nothing can verify, or be recorded, as a public release.
+AIEN_RELEASE_SIGNER=''
+# AIEN_INTERNAL_TEST_SIGNER is the old key that signed internal test release v0.1.1. It equals
+# docs/release/internal_test_signers. Anything it signs installs as signature_check internal-test-key, never release.
+AIEN_INTERNAL_TEST_SIGNER='aien-release ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID6WDVy2x8aV80ag10iPonS4J8k4seWrgsi5cuq8AIZJ'
 
 # Run from a checkout, or bootstrap one when the script is piped to Bash for a
 # source build. Release mode runs without a checkout.
@@ -300,11 +308,51 @@ RELEASE_ARCH="$TARGET_ARCH"
 
 # Release mode (AIEN_RELEASE_TAG=vX.Y.Z): install a published, signed release
 # instead of building from source. Fails closed: nothing is installed unless
-# SHA256SUMS.txt carries a valid signature from the key pinned in
-# docs/release/allowed_signers and the archive matches its listed checksum.
+# SHA256SUMS.txt carries a valid signature and the archive matches its listed checksum.
+# The signature class is decided by WHICH key verified, never by what the artifact says:
+#   release            the public-release key pinned above (AIEN_RELEASE_SIGNER; empty until the key ceremony)
+#   internal-test-key  the old internal test key (AIEN_INTERNAL_TEST_SIGNER)
+#   dry-run-key        a throwaway signer file the caller names in AIEN_DRY_RUN_SIGNERS (AIEN_ALLOWED_SIGNERS is the
+#                      older name of the same switch); only for dry runs and tests
+# A package whose release.toml says dry-run = true is refused when it verifies as release.
+# The class is written to installed.toml (signature-check) and to $CONFIG_DIR/install-receipt.json.
+
+SIG_CHECK=""
+# verify_sums <signers-file> <dir>: true when SHA256SUMS.txt.sig is a valid aien-release signature for that file.
+verify_sums() {
+    ssh-keygen -Y verify -f "$1" -I aien-release -n aien-release -s "$2/SHA256SUMS.txt.sig" < "$2/SHA256SUMS.txt" >/dev/null 2>&1
+}
+
+# write_receipt <tag> <asset> <dir> <files-verified>: install-receipt.json for the live release (atomic).
+write_receipt() {
+    local tag="$1" asset="$2" d="$3" n="$4" id cli dry tmp="$CONFIG_DIR/.install-receipt.json.new.$$"
+    id="$(readlink "$REL_DIR/current")"
+    cli="$(toml_get "$REL_DIR/$id/release.toml" "" aien-cli-sha256)"
+    dry=false; [[ "$(toml_get "$REL_DIR/$id/release.toml" "" dry-run)" != true ]] || dry=true
+    {
+        echo '{'
+        echo '  "schema": "AienInstallReceiptV1",'
+        echo "  \"signature_check\": \"$SIG_CHECK\","
+        echo "  \"dry_run\": $dry,"
+        echo "  \"tag\": \"$tag\","
+        echo "  \"artifact\": \"$asset\","
+        echo "  \"artifact_sha256\": \"$(sha256_of "$d/$asset")\","
+        echo "  \"sha256sums_sha256\": \"$(sha256_of "$d/SHA256SUMS.txt")\","
+        echo "  \"signer_fingerprint\": \"$SIGNER_FP\","
+        echo "  \"release_id\": \"$id\","
+        echo "  \"candidate\": \"$(toml_get "$REL_DIR/$id/release.toml" "" candidate)\","
+        echo "  \"files_verified\": $n,"
+        echo "  \"cli_sha256\": \"$cli\","
+        echo "  \"daemon_sha256\": \"$cli\","
+        echo "  \"installed_at\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\""
+        echo '}'
+    } > "$tmp"
+    mv -f "$tmp" "$CONFIG_DIR/install-receipt.json"
+}
 
 install_release() {
     local tag="$1"
+    [[ "$tag" =~ ^[A-Za-z0-9._-]+$ ]] || { echo "Error: release tag '$tag' has characters other than letters, digits, dot, dash, underscore" >&2; exit 1; }
     command -v ssh-keygen >/dev/null 2>&1 || { echo "Error: ssh-keygen is required to verify the release signature" >&2; exit 1; }
     command -v curl >/dev/null 2>&1 || { echo "Error: curl is required to download the release" >&2; exit 1; }
     local base="${AIEN_RELEASE_BASE_URL:-https://github.com/aien-dev/aien-sovereign-core/releases/download/$tag}"
@@ -312,26 +360,38 @@ install_release() {
     DL_DIR=""
     DL_DIR="$(mktemp -d "${TMPDIR:-/tmp}/aien-release.XXXXXX")"
     trap 'rm -rf "$DL_DIR"; [[ -z "$INSTALL_WORKSPACE" ]] || rm -rf "$INSTALL_WORKSPACE"' EXIT
-    # Signer file: explicit override, else the checkout's copy, else the key pinned above.
-    local signers="${AIEN_ALLOWED_SIGNERS:-}"
-    if [[ -z "$signers" && -n "$SOURCE_ROOT" && -f "$SOURCE_ROOT/docs/release/allowed_signers" ]]; then
-        signers="$SOURCE_ROOT/docs/release/allowed_signers"
-    fi
-    if [[ -z "$signers" ]]; then
-        signers="$DL_DIR/allowed_signers"
-        printf '%s\n' "$AIEN_PINNED_SIGNER" > "$signers"
-    fi
-    [[ -f "$signers" ]] || { echo "Error: pinned signer file not found: $signers" >&2; exit 1; }
+    local dry_signers="${AIEN_DRY_RUN_SIGNERS:-${AIEN_ALLOWED_SIGNERS:-}}"
+    [[ -z "$dry_signers" || -f "$dry_signers" ]] || { echo "Error: dry-run signer file not found: $dry_signers" >&2; exit 1; }
     echo "[*] Downloading $tag: $asset, SHA256SUMS.txt, SHA256SUMS.txt.sig"
     local f
     for f in SHA256SUMS.txt SHA256SUMS.txt.sig "$asset"; do
-        curl --proto '=https,file' --fail --silent --show-error --location -o "$DL_DIR/$f" "$base/$f" \
-            || { echo "Error: could not download $f from $base" >&2; exit 1; }
+        if ! curl --proto '=https,file' --fail --silent --show-error --location -o "$DL_DIR/$f" "$base/$f" 2> "$DL_DIR/.curl.err"; then
+            [[ "$f" != SHA256SUMS.txt.sig ]] || { echo "Error: SHA256SUMS.txt.sig is missing: refusing an unsigned release (no signature). Nothing was installed." >&2; exit 1; }
+            cat "$DL_DIR/.curl.err" >&2; echo "Error: could not download $f from $base" >&2; exit 1
+        fi
     done
-    echo "[*] Verifying signature against $signers"
-    ssh-keygen -Y verify -f "$signers" -I aien-release -n aien-release \
-        -s "$DL_DIR/SHA256SUMS.txt.sig" < "$DL_DIR/SHA256SUMS.txt" >/dev/null \
-        || { echo "Error: SHA256SUMS.txt signature is NOT valid. Nothing was installed." >&2; exit 1; }
+    echo "[*] Verifying the signature on SHA256SUMS.txt"
+    SIG_CHECK=""; SIGNER_FP=""
+    local kf="$DL_DIR/.signer"
+    if [[ -n "$AIEN_RELEASE_SIGNER" ]]; then
+        printf '%s\n' "$AIEN_RELEASE_SIGNER" > "$kf"
+        ! verify_sums "$kf" "$DL_DIR" || SIG_CHECK=release
+    fi
+    if [[ -z "$SIG_CHECK" ]]; then
+        printf '%s\n' "$AIEN_INTERNAL_TEST_SIGNER" > "$kf"
+        ! verify_sums "$kf" "$DL_DIR" || SIG_CHECK=internal-test-key
+    fi
+    if [[ -z "$SIG_CHECK" && -n "$dry_signers" ]]; then
+        cp "$dry_signers" "$kf"
+        ! verify_sums "$kf" "$DL_DIR" || SIG_CHECK=dry-run-key
+    fi
+    if [[ -z "$SIG_CHECK" ]]; then
+        [[ -n "$AIEN_RELEASE_SIGNER" ]] || echo "    (no public-release key is pinned yet: the key ceremony has not happened, see docs/release/KEY_CEREMONY.md)" >&2
+        echo "Error: SHA256SUMS.txt signature is NOT valid for any accepted key. Nothing was installed." >&2; exit 1
+    fi
+    SIGNER_FP="$(awk 'NF >= 3 && $1 !~ /^#/ { print $2" "$3; exit }' "$kf" | ssh-keygen -lf - 2>/dev/null | awk '{ print $2 }' || true)"
+    rm -f "$kf"
+    echo "[+] signature_check: $SIG_CHECK"
     local want got
     want="$(awk -v a="$asset" '$2 == a || $2 == "*" a { print $1 }' "$DL_DIR/SHA256SUMS.txt")"
     [[ "$(printf '%s\n' "$want" | grep -c .)" -eq 1 ]] \
@@ -343,8 +403,15 @@ install_release() {
     mkdir -p "$DL_DIR/x" "$BIN_DIR"
     tar -xzf "$DL_DIR/$asset" -C "$DL_DIR/x"
     [[ -d "$DL_DIR/x/bin" ]] || { echo "Error: archive has no bin/ directory" >&2; exit 1; }
+    if [[ "$SIG_CHECK" == release && ( "$(toml_get "$DL_DIR/x/release.toml" "" dry-run)" == true \
+          || "$(toml_get "$DL_DIR/x/release.toml" "" candidate)" == NOT-RELEASABLE ) ]]; then
+        echo "Error: this package is labelled dry-run but carries a release signature; a dry run is never a release. Nothing was installed." >&2
+        exit 1
+    fi
     [[ ! -d "$DL_DIR/x/imprints/en2-trinity" ]] || IMPRINT_SRC="$DL_DIR/x/imprints/en2-trinity"
     activate_release "$DL_DIR/x"
+    write_receipt "$tag" "$asset" "$DL_DIR" "$(toml_lines "$REL_DIR/current/release.toml" files | grep -c .)"
+    echo "[+] Install receipt: $CONFIG_DIR/install-receipt.json (signature_check: $SIG_CHECK)"
 }
 
 # Verify Rust Toolchain (source builds only)
diff --git a/scripts/.crumb b/scripts/.crumb
index 8698d069..fe4e0a98 100644
--- a/scripts/.crumb
+++ b/scripts/.crumb
@@ -4,14 +4,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-10T15:24:44Z",
+      "compiled_at": "2026-10-11T01:11:10Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:da02b290ccbade3c314008569855264df7c1fe419d4cd6762517cc1f3b179dcf",
+      "digest": "sha256:bc6f40b1151875289060253262a789e03563c9df036f500dec18ae21532324e2",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 29,
-      "generated_at_commit": "337bc85d7d10343c43c582af471a3065c453aab2",
-      "source_tree": "sha256:04241044e63606984c4aecbb83373dddadb7ab9cd698674b17bea0249c655e58"
+      "files": 33,
+      "generated_at_commit": "ef1fe354ef36e3aaad36671ab5a6c155f69634c9",
+      "source_tree": "sha256:30b5b39351d56d227d89dab480acac96fd08a113d2de0267cc8cbac813e050ee"
     }
   },
   "parent": {
diff --git a/scripts/key-ceremony.sh b/scripts/key-ceremony.sh
new file mode 100755
index 00000000..b1001e0d
--- /dev/null
+++ b/scripts/key-ceremony.sh
@@ -0,0 +1,174 @@
+#!/usr/bin/env bash
+# AIEN public-release key ceremony and offline signing (Drake ruling 1, sc#385; operator checklist sc#118).
+# Plain-English guide: docs/release/KEY_CEREMONY.md. This script walks the operator through it on an OFFLINE machine.
+#
+#   scripts/key-ceremony.sh ceremony --out DIR --backup DIR1 --backup DIR2 [--rehearsal]
+#       make the dedicated offline Ed25519 release key, show its fingerprint for the witness, run the public-key
+#       verification test (a good signature verifies, an altered file does not), copy the key to two backups and prove
+#       each backup signs, and write DIR/public/ (allowed_signers line + ceremony record: public data only)
+#   scripts/key-ceremony.sh verify-backup KEY ALLOWED_SIGNERS [--rehearsal]
+#       prove a backup copy of the key still signs and matches the pinned public key (run any time)
+#   scripts/key-ceremony.sh sign KEY ALLOWED_SIGNERS SHA256SUMS.txt [--rehearsal]
+#       stage 2 of a release: sign the checksum file offline and verify the signature before it leaves the machine
+#
+# --rehearsal: a throwaway key with no passphrase, labelled REHEARSAL everywhere, for practice and for the tests
+# (scripts/test-offline-signing.sh). A rehearsal key is never a release key. Without --rehearsal the script refuses to
+# run on a machine with a network route, under CI, or with any output inside a git checkout.
+# AIEN_CEREMONY_ASSUME_YES=1 answers the prompts; it is honoured only with --rehearsal.
+set -euo pipefail
+NS=aien-release
+die() { echo; echo "STOPPED: $*" >&2; exit 1; }
+say() { printf '\n== %s\n' "$*"; }
+REHEARSAL=0; OUT=""; BACKUPS=(); ARGS=()
+while [[ $# -gt 0 ]]; do
+    case "$1" in
+        --rehearsal) REHEARSAL=1 ;;
+        --out) OUT="${2:?--out needs a directory}"; shift ;;
+        --backup) BACKUPS+=("${2:?--backup needs a directory}"); shift ;;
+        *) ARGS+=("$1") ;;
+    esac
+    shift
+done
+set -- "${ARGS[@]+"${ARGS[@]}"}"
+CMD="${1:-}"; shift || true
+YES=0; [[ "$REHEARSAL" == 1 && "${AIEN_CEREMONY_ASSUME_YES:-}" == 1 ]] && YES=1
+LABEL=""; [[ "$REHEARSAL" == 0 ]] || LABEL="REHEARSAL "
+
+ask() { # ask <question>: the operator types yes to go on
+    [[ "$YES" == 0 ]] || { echo "$1 [rehearsal: yes]"; return 0; }
+    local a; read -r -p "$1 Type yes to continue: " a < /dev/tty
+    [[ "$a" == yes ]] || die "the operator did not type yes"
+}
+answer() { # answer <prompt> <rehearsal default>
+    [[ "$YES" == 0 ]] || { echo "$2"; return 0; }
+    local a; read -r -p "$1 " a < /dev/tty; [[ -n "$a" ]] || die "an answer is required"; echo "$a"
+}
+in_git() { local d="$1"; while [[ ! -d "$d" ]]; do d="$(dirname "$d")"; done; git -C "$d" rev-parse --is-inside-work-tree >/dev/null 2>&1; }
+preflight() {
+    command -v ssh-keygen >/dev/null || die "ssh-keygen is not installed (it comes with OpenSSH)"
+    echo "ssh-keygen: $(ssh -V 2>&1)"
+    if [[ "$REHEARSAL" == 1 ]]; then echo "REHEARSAL: throwaway key, not a release key; the offline checks are skipped"; return 0; fi
+    [[ -z "${CI:-}${GITHUB_ACTIONS:-}" ]] || die "this looks like a CI machine; the release key is never made or used in CI"
+    if command -v ip >/dev/null 2>&1; then
+        [[ -z "$(ip route show default 2>/dev/null)$(ip -6 route show default 2>/dev/null)" ]] \
+            || die "this machine has a network route. Unplug the network cable and turn Wi-Fi off, then start again"
+    elif command -v route >/dev/null 2>&1 && route -n get default >/dev/null 2>&1; then
+        die "this machine has a network route. Unplug the network cable and turn Wi-Fi off, then start again"
+    fi
+    ask "Is this machine offline (no cable, Wi-Fi off) and is the witness watching the screen?"
+}
+# selftest <key> <allowed_signers> <workdir>: a fresh file signed by key verifies; the same file with one byte
+# changed does not. Prints two result lines.
+selftest() {
+    local k="$1" s="$2" w="$3"
+    printf 'AIEN key check %s %s\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$RANDOM$RANDOM" > "$w/challenge.txt"
+    rm -f "$w/challenge.txt.sig"
+    ssh-keygen -q -Y sign -f "$k" -n "$NS" "$w/challenge.txt" || die "the key could not sign (wrong passphrase?)"
+    ssh-keygen -q -Y verify -f "$s" -I "$NS" -n "$NS" -s "$w/challenge.txt.sig" < "$w/challenge.txt" >/dev/null \
+        || die "a signature made by this key does NOT verify against $s"
+    echo "  good signature verifies: yes"
+    sed -i.bak '1s/^A/B/' "$w/challenge.txt"; rm -f "$w/challenge.txt.bak"
+    if ssh-keygen -q -Y verify -f "$s" -I "$NS" -n "$NS" -s "$w/challenge.txt.sig" < "$w/challenge.txt" >/dev/null 2>&1; then
+        die "an ALTERED file verified; this verification setup is broken"
+    fi
+    echo "  altered file is refused: yes"
+    rm -f "$w/challenge.txt" "$w/challenge.txt.sig"
+}
+
+ceremony() {
+    [[ -n "$OUT" ]] || die "give --out DIR (an empty folder on the offline machine)"
+    [[ "${#BACKUPS[@]}" -ge 2 ]] || die "give two --backup folders (for example two USB sticks)"
+    local d
+    for d in "$OUT" "${BACKUPS[@]}"; do ! in_git "$d" || die "$d is inside a git checkout; the private key must never be near a repository"; done
+    [[ ! -e "$OUT" || -z "$(ls -A "$OUT")" ]] || die "$OUT is not empty"
+    preflight
+    say "${LABEL}Step 1 of 6: who is here"
+    local op wit; op="$(answer "Operator's full name:" "REHEARSAL operator")"; wit="$(answer "Witness's full name:" "REHEARSAL witness")"
+    say "${LABEL}Step 2 of 6: make the key"
+    mkdir -p "$OUT/public"; chmod 700 "$OUT"
+    local stamp key comment
+    stamp="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
+    if [[ "$REHEARSAL" == 1 ]]; then
+        key="$OUT/REHEARSAL-aien_release_ed25519"; comment="aien-REHEARSAL-throwaway-NOT-A-RELEASE-KEY"
+        ssh-keygen -q -t ed25519 -N '' -C "$comment" -f "$key"
+    else
+        key="$OUT/aien_release_ed25519"; comment="aien-release-key-${stamp%%T*}"
+        echo "ssh-keygen will now ask for a passphrase twice. Choose a long one; the witness does not see it."
+        ssh-keygen -t ed25519 -a 100 -C "$comment" -f "$key"
+    fi
+    chmod 600 "$key"
+    local fp line; fp="$(ssh-keygen -lf "$key.pub" | awk '{ print $2 }')"
+    line="$NS $(cut -d' ' -f1,2 "$key.pub")"
+    say "${LABEL}Step 3 of 6: fingerprint for the witness"
+    echo "  Fingerprint: $fp"
+    echo "  The witness writes this down on paper, by hand."
+    local tail8; tail8="$(answer "Witness: type the LAST 8 characters you wrote down:" "${fp: -8}")"
+    [[ "$tail8" == "${fp: -8}" ]] || die "the witness's copy does not match the fingerprint on screen"
+    { [[ "$REHEARSAL" == 0 ]] || echo "# REHEARSAL KEY: throwaway, NOT a release key. Never pin this line."; echo "$line"; } > "$OUT/public/allowed_signers"
+    say "${LABEL}Step 4 of 6: public-key verification test"
+    selftest "$key" "$OUT/public/allowed_signers" "$OUT"
+    say "${LABEL}Step 5 of 6: backups (each copy must sign and verify on its own)"
+    local b i=0 results=""
+    for b in "${BACKUPS[@]}"; do
+        i=$((i + 1))
+        ask "Backup $i goes to $b. Is that medium plugged in?"
+        mkdir -p "$b"; chmod 700 "$b"
+        cp "$key" "$key.pub" "$b/"; chmod 600 "$b/$(basename "$key")"; sync
+        cmp -s "$key" "$b/$(basename "$key")" || die "backup $i is not an exact copy"
+        echo "  backup $i is an exact copy: yes"
+        selftest "$b/$(basename "$key")" "$OUT/public/allowed_signers" "$b"
+        results="${results}backup-$i: exact copy yes; signs and verifies yes; altered file refused yes"$'\n'
+    done
+    say "${LABEL}Step 6 of 6: the public record"
+    {
+        [[ "$REHEARSAL" == 0 ]] || echo "REHEARSAL: throwaway key, not a release key, not a ceremony."
+        echo "AIEN public-release key ceremony record"
+        echo "date-utc: $stamp"
+        echo "mode: $([[ "$REHEARSAL" == 1 ]] && echo rehearsal || echo ceremony)"
+        echo "operator: $op"
+        echo "witness: $wit"
+        echo "tool: $(ssh -V 2>&1)"
+        echo "key-type: ed25519"
+        echo "key-comment: $comment"
+        echo "fingerprint: $fp"
+        echo "allowed_signers: $line"
+        echo "public-key verification test: good signature verifies yes; altered file refused yes"
+        printf '%s' "$results"
+        echo "private key: stays on the offline machine and the backups; it is not in this record"
+    } > "$OUT/public/ceremony-record.txt"
+    cat "$OUT/public/ceremony-record.txt"
+    echo
+    echo "Copy ONLY the folder $OUT/public to a USB stick for the connected computer. Never copy the key file."
+}
+
+verify_backup() {
+    local k="${1:?KEY}" s="${2:?ALLOWED_SIGNERS}" w
+    [[ -f "$k" && -f "$s" ]] || die "key or signer file missing"
+    w="$(mktemp -d)"; trap 'rm -rf "$w"' RETURN
+    echo "${LABEL}checking backup $k against $s"
+    selftest "$k" "$s" "$w"
+    echo "backup OK"
+}
+
+sign_sums() {
+    local k="${1:?KEY}" s="${2:?ALLOWED_SIGNERS}" f="${3:?SHA256SUMS.txt}"
+    [[ -f "$k" && -f "$s" && -f "$f" ]] || die "key, signer file or checksum file missing"
+    preflight
+    grep -qvE '^[0-9a-f]{64}  \*?[A-Za-z0-9._-]+$' "$f" && die "$f has a line that is not '<sha256>  <file name>'"
+    [[ -s "$f" ]] || die "$f is empty"
+    say "${LABEL}Files this signature will vouch for"
+    awk '{ print "  " $2 }' "$f"
+    ask "Are these exactly the files of the release you mean to sign?"
+    rm -f "$f.sig"
+    ssh-keygen -q -Y sign -f "$k" -n "$NS" "$f" || die "signing failed (wrong passphrase?)"
+    ssh-keygen -q -Y verify -f "$s" -I "$NS" -n "$NS" -s "$f.sig" < "$f" >/dev/null || { rm -f "$f.sig"; die "the new signature does not verify against $s; nothing to upload"; }
+    echo "${LABEL}signed and verified: $f.sig"
+    echo "Carry $f.sig (only that file) to the connected computer and attach it to the draft release."
+}
+
+case "$CMD" in
+    ceremony) ceremony ;;
+    verify-backup) verify_backup "$@" ;;
+    sign) sign_sums "$@" ;;
+    *) sed -n '2,20p' "$0"; exit 2 ;;
+esac
diff --git a/scripts/package-release.sh b/scripts/package-release.sh
index b6e6f287..72419ca4 100755
--- a/scripts/package-release.sh
+++ b/scripts/package-release.sh
@@ -4,7 +4,8 @@
 #   scripts/package-release.sh <output.tar.gz>
 #
 # Environment:
-#   AIEN_DRY_RUN=1        package even when the release gate fails (candidate "NOT-RELEASABLE"); never for a release
+#   AIEN_DRY_RUN=1        label the package dry-run (release.toml `dry-run = true`) and package even when the release
+#                         gate fails (candidate "NOT-RELEASABLE"); never for a release
 #   AIEN_RELEASE_BIN_DIR  directory holding the built binaries (default target/release)
 #   SOURCE_DATE_EPOCH     mtime for every entry (default 0)
 #
@@ -56,6 +57,8 @@ chmod 755 "$PACKAGE_DIR/bin/"* "$PACKAGE_DIR/install.sh"
     echo 'schema = "AienReleaseV1"'
     echo "candidate = \"$CANDIDATE\""
     echo "aien-cli-sha256 = \"$(sha "$PACKAGE_DIR/bin/aien")\""
+    # A dry-run package says so in its manifest; install.sh refuses it under the release key (sc#385).
+    [[ "${AIEN_DRY_RUN:-}" != 1 ]] || echo 'dry-run = true'
     if [[ -n "${AIEN_MODEL_INPUTS:-}" ]]; then
         echo
         grep -q '^\[model\]' "$AIEN_MODEL_INPUTS" || { echo "AIEN_MODEL_INPUTS must start with [model]" >&2; exit 1; }
diff --git a/scripts/release-publish-gate.sh b/scripts/release-publish-gate.sh
new file mode 100755
index 00000000..ca2f8ca2
--- /dev/null
+++ b/scripts/release-publish-gate.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+# Stage 3 of the offline-signing handoff (sc#385, docs/release/RELEASE_SIGNING.md): decide whether a draft release may
+# be published. Run by .github/workflows/release-publish.yml on the downloaded draft assets, and by hand.
+#   scripts/release-publish-gate.sh <asset-dir> <allowed_signers>
+# Passes only when ALL hold:
+#   - <allowed_signers> pins a key (the PLACEHOLDER refuses) and that key is not the internal test key
+#   - nothing in <asset-dir> is a dry-run asset (DRY-RUN-* files, dry-run-signers) and no packaged release.toml says
+#     dry-run = true or candidate NOT-RELEASABLE
+#   - scripts/verify-release-assets.sh: SHA256SUMS.txt.sig (made offline by the operator) is valid for the pinned key,
+#     every listed file matches, every sovereign-* archive is covered
+# The private key is never needed here and never present: this only verifies.
+set -euo pipefail
+ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+d="${1:?asset directory}"; signers="${2:?allowed_signers file}"
+die() { echo "publish gate: REFUSED: $*" >&2; exit 1; }
+[[ -d "$d" ]] || die "asset directory $d is missing"
+[[ -f "$signers" ]] || die "signer file $signers is missing"
+key="$(grep -vE '^[[:space:]]*(#|$)' "$signers" || true)"
+[[ -n "$key" ]] || die "no public-release key is pinned in $signers (PLACEHOLDER until the key ceremony)"
+[[ "$(printf '%s\n' "$key" | grep -c .)" -eq 1 ]] || die "$signers must pin exactly one key"
+internal="$ROOT/docs/release/internal_test_signers"
+if [[ -f "$internal" ]]; then
+    ik="$(grep -vE '^[[:space:]]*(#|$)' "$internal" | awk '{ print $3 }')"
+    [[ -z "$ik" || "$key" != *"$ik"* ]] || die "$signers pins the internal test key, which is not a release key"
+fi
+for f in "$d"/DRY-RUN-* "$d"/dry-run-signers; do
+    [[ ! -e "$f" ]] || die "$(basename "$f") is a dry-run asset; a dry run is never published"
+done
+# Signature and checksums first, so nothing unverified is unpacked.
+bash "$ROOT/scripts/verify-release-assets.sh" "$d" "$signers" || die "signature or checksums do not verify (see above)"
+for a in "$d"/sovereign-*.tar.gz; do
+    [[ -e "$a" ]] || continue
+    m="$(tar -xzOf "$a" ./release.toml 2>/dev/null || true)"
+    [[ -n "$m" ]] || die "$(basename "$a") has no release.toml"
+    ! grep -qx 'dry-run = true' <<<"$m" || die "$(basename "$a") is labelled dry-run in its release.toml"
+    ! grep -qx 'candidate = "NOT-RELEASABLE"' <<<"$m" || die "$(basename "$a") is a NOT-RELEASABLE package"
+done
+echo "publish gate: PASSED: signed offline by the pinned release key, every asset matches, no dry-run asset"
diff --git a/scripts/test-install-release.sh b/scripts/test-install-release.sh
index 88acf172..a6608865 100755
--- a/scripts/test-install-release.sh
+++ b/scripts/test-install-release.sh
@@ -21,18 +21,28 @@ case "$(uname -m)" in x86_64|amd64) ARCH=x86_64 ;; aarch64|arm64) ARCH=aarch64 ;
 [[ "$OS-$ARCH" != macos-aarch64 ]] || ARCH=arm64
 ASSET="sovereign-$OS-$ARCH.tar.gz"
 
-# 1. pinned key consistency
-PINNED="$(sed -n "s/^AIEN_PINNED_SIGNER='\(.*\)'\$/\1/p" "$ROOT/install.sh")"
-[[ -n "$PINNED" ]] || fail "install.sh has no AIEN_PINNED_SIGNER line"
-grep -qxF "$PINNED" "$ROOT/docs/release/allowed_signers" \
-    || fail "AIEN_PINNED_SIGNER in install.sh is not a line of docs/release/allowed_signers"
+# 1. pinned keys: install.sh AIEN_RELEASE_SIGNER equals the key lines of docs/release/allowed_signers (both empty
+#    while the placeholder stands); AIEN_INTERNAL_TEST_SIGNER equals docs/release/internal_test_signers; the
+#    internal test key is never in allowed_signers (Drake ruling 1, sc#385: the old key is not reused)
+keylines() { grep -vE "^[[:space:]]*(#|\$)" "$1" || true; }
+pinned() { sed -n "s/^$1='\(.*\)'\$/\1/p" "$ROOT/install.sh"; }
+grep -qE "^AIEN_RELEASE_SIGNER=" "$ROOT/install.sh" || fail "install.sh has no AIEN_RELEASE_SIGNER line"
+[[ "$(pinned AIEN_RELEASE_SIGNER)" == "$(keylines "$ROOT/docs/release/allowed_signers")" ]] \
+    || fail "AIEN_RELEASE_SIGNER in install.sh differs from the key lines of docs/release/allowed_signers"
+INTERNAL="$(pinned AIEN_INTERNAL_TEST_SIGNER)"
+[[ -n "$INTERNAL" && "$INTERNAL" == "$(keylines "$ROOT/docs/release/internal_test_signers")" ]] \
+    || fail "AIEN_INTERNAL_TEST_SIGNER in install.sh differs from docs/release/internal_test_signers"
+! grep -qF "${INTERNAL#aien-release }" "$ROOT/docs/release/allowed_signers" || fail "the internal test key is in allowed_signers"
+if [[ -z "$(pinned AIEN_RELEASE_SIGNER)" ]]; then
+    grep -q "PLACEHOLDER" "$ROOT/docs/release/allowed_signers" || fail "allowed_signers holds no key and no PLACEHOLDER label"
+fi
 
 ssh-keygen -q -t ed25519 -N '' -C test -f "$WORK/key"
 ssh-keygen -q -t ed25519 -N '' -C other -f "$WORK/other"
 printf 'aien-release %s\n' "$(cut -d' ' -f1,2 "$WORK/key.pub")" > "$WORK/allowed_signers"
 
-make_release() { # dir signing-key [candidate] [variant]
-    local d="$1" k="$2" cand="${3:-CAND-1}" variant="${4:-a}" f aien
+make_release() { # dir signing-key [candidate] [variant] [dry: label the manifest dry-run]
+    local d="$1" k="$2" cand="${3:-CAND-1}" variant="${4:-a}" dry="${5:-}" f aien
     rm -rf "$WORK/pkg"
     mkdir -p "$d" "$WORK/pkg/bin" "$WORK/pkg/imprints/en2-trinity"
     printf '#!/bin/sh\necho aien-%s\nexit 0\n' "$variant" > "$WORK/pkg/bin/aien"
@@ -41,7 +51,9 @@ make_release() { # dir signing-key [candidate] [variant]
     chmod 755 "$WORK/pkg/bin/"*
     aien="$(sha256sum "$WORK/pkg/bin/aien" 2>/dev/null | cut -d' ' -f1 || shasum -a 256 "$WORK/pkg/bin/aien" | cut -d' ' -f1)"
     {
-        printf 'schema = "AienReleaseV1"\ncandidate = "%s"\naien-cli-sha256 = "%s"\n\n[files]\n' "$cand" "$aien"
+        printf 'schema = "AienReleaseV1"\ncandidate = "%s"\naien-cli-sha256 = "%s"\n' "$cand" "$aien"
+        [[ -z "$dry" ]] || printf 'dry-run = true\n'
+        printf '\n[files]\n'
         (cd "$WORK/pkg" && find . -type f ! -name release.toml | LC_ALL=C sort | sed 's|^\./||') | while read -r f; do
             printf '"%s" = "%s"\n' "$f" "$(sha256sum "$WORK/pkg/$f" | cut -d' ' -f1)"
         done
@@ -62,7 +74,7 @@ run_install() { # release-dir bin-dir config-dir installer [VAR=value ...]
 # 2. valid release, from the checkout
 make_release "$WORK/good" "$WORK/key"
 run_install "$WORK/good" "$WORK/bin-good" "$WORK/cfg-good" "$ROOT/install.sh" \
-    AIEN_SOURCE_DIR="$ROOT" AIEN_ALLOWED_SIGNERS="$WORK/allowed_signers" \
+    AIEN_SOURCE_DIR="$ROOT" AIEN_DRY_RUN_SIGNERS="$WORK/allowed_signers" \
     || { cat "$WORK/log" >&2; fail "valid signed release did not install"; }
 [[ -x "$WORK/bin-good/aien" && -x "$WORK/bin-good/cortex" ]] || fail "binaries missing after valid install"
 
@@ -70,7 +82,7 @@ run_install "$WORK/good" "$WORK/bin-good" "$WORK/cfg-good" "$ROOT/install.sh" \
 make_release "$WORK/tamper" "$WORK/key"
 printf 'x' >> "$WORK/tamper/$ASSET"
 if run_install "$WORK/tamper" "$WORK/bin-tamper" "$WORK/cfg-tamper" "$ROOT/install.sh" \
-    AIEN_SOURCE_DIR="$ROOT" AIEN_ALLOWED_SIGNERS="$WORK/allowed_signers"; then
+    AIEN_SOURCE_DIR="$ROOT" AIEN_DRY_RUN_SIGNERS="$WORK/allowed_signers"; then
     fail "tampered archive was installed"
 fi
 grep -q "checksum mismatch" "$WORK/log" || fail "tampered archive not rejected for checksum"
@@ -79,7 +91,7 @@ grep -q "checksum mismatch" "$WORK/log" || fail "tampered archive not rejected f
 # 4. signature from another key
 make_release "$WORK/forged" "$WORK/other"
 if run_install "$WORK/forged" "$WORK/bin-forged" "$WORK/cfg-forged" "$ROOT/install.sh" \
-    AIEN_SOURCE_DIR="$ROOT" AIEN_ALLOWED_SIGNERS="$WORK/allowed_signers"; then
+    AIEN_SOURCE_DIR="$ROOT" AIEN_DRY_RUN_SIGNERS="$WORK/allowed_signers"; then
     fail "release signed by another key was installed"
 fi
 grep -q "signature is NOT valid" "$WORK/log" || fail "forged signature not rejected"
@@ -89,7 +101,7 @@ grep -q "signature is NOT valid" "$WORK/log" || fail "forged signature not rejec
 mkdir -p "$WORK/standalone" "$WORK/home"
 cp "$ROOT/install.sh" "$WORK/standalone/install.sh"
 run_install "$WORK/good" "$WORK/bin-alone" "$WORK/cfg-alone" "$WORK/standalone/install.sh" \
-    HOME="$WORK/home" AIEN_ALLOWED_SIGNERS="$WORK/allowed_signers" \
+    HOME="$WORK/home" AIEN_DRY_RUN_SIGNERS="$WORK/allowed_signers" \
     || { cat "$WORK/log" >&2; fail "standalone offline install did not install"; }
 grep -q "Release mode without a source tree" "$WORK/log" || fail "standalone install used a source tree"
 [[ -x "$WORK/bin-alone/aien" && -x "$WORK/bin-alone/cortex" ]] || fail "binaries missing after standalone install"
@@ -107,7 +119,7 @@ grep -q "signature is NOT valid" "$WORK/log" || fail "pinned-signer fallback did
 
 # 7. upgrade: a newer candidate installs over the first; one previous release is kept; the
 #    record names both; operator.toml is untouched
-SIGN_ENV=(AIEN_SOURCE_DIR="$ROOT" AIEN_ALLOWED_SIGNERS="$WORK/allowed_signers")
+SIGN_ENV=(AIEN_SOURCE_DIR="$ROOT" AIEN_DRY_RUN_SIGNERS="$WORK/allowed_signers")
 live() { readlink "$1/releases/current"; }
 inst_args() { # bin cfg args... : run install.sh with arguments in explicit dirs
     local bin="$1" cfg="$2"; shift 2
@@ -175,7 +187,7 @@ for point in mid-copy after-copy before-swap; do
     OLD="$(live "$WORK/cfg-good")"
     env AIEN_TEST_PAUSE_AT="$point" AIEN_RELEASE_TAG=v0.0.0-test AIEN_RELEASE_BASE_URL="file://$WORK/rel3" \
         AIEN_BIN_DIR="$WORK/bin-good" AIEN_CONFIG_DIR="$WORK/cfg-good" AIEN_INSTALL_NO_PROFILE=1 \
-        AIEN_SOURCE_DIR="$ROOT" AIEN_ALLOWED_SIGNERS="$WORK/allowed_signers" \
+        AIEN_SOURCE_DIR="$ROOT" AIEN_DRY_RUN_SIGNERS="$WORK/allowed_signers" \
         bash "$ROOT/install.sh" > "$WORK/log-int" 2>&1 &
     IPID=$!
     for _ in $(seq 1 100); do grep -q "paused at $point" "$WORK/log-int" 2>/dev/null && break; sleep 0.1; done
@@ -191,7 +203,7 @@ OLD="$(live "$WORK/cfg-good")"
 [[ "$OLD" != "$ID_NEW" ]] || fail "setup for the after-swap case failed"
 env AIEN_TEST_PAUSE_AT=after-swap AIEN_RELEASE_TAG=v0.0.0-test AIEN_RELEASE_BASE_URL="file://$WORK/rel3" \
     AIEN_BIN_DIR="$WORK/bin-good" AIEN_CONFIG_DIR="$WORK/cfg-good" AIEN_INSTALL_NO_PROFILE=1 \
-    AIEN_SOURCE_DIR="$ROOT" AIEN_ALLOWED_SIGNERS="$WORK/allowed_signers" \
+    AIEN_SOURCE_DIR="$ROOT" AIEN_DRY_RUN_SIGNERS="$WORK/allowed_signers" \
     bash "$ROOT/install.sh" > "$WORK/log-int" 2>&1 &
 IPID=$!
 for _ in $(seq 1 100); do grep -q "paused at after-swap" "$WORK/log-int" 2>/dev/null && break; sleep 0.1; done
@@ -227,7 +239,7 @@ kill_at() { # point release-dir [install.sh args...]: run install.sh held at poi
     shift 2
     env AIEN_TEST_PAUSE_AT="$point" AIEN_RELEASE_TAG=v0.0.0-test AIEN_RELEASE_BASE_URL="file://$rel" \
         AIEN_BIN_DIR="$WORK/bin-good" AIEN_CONFIG_DIR="$WORK/cfg-good" AIEN_INSTALL_NO_PROFILE=1 \
-        AIEN_SOURCE_DIR="$ROOT" AIEN_ALLOWED_SIGNERS="$WORK/allowed_signers" HOME="$WORK/home" \
+        AIEN_SOURCE_DIR="$ROOT" AIEN_DRY_RUN_SIGNERS="$WORK/allowed_signers" HOME="$WORK/home" \
         bash "$ROOT/install.sh" "$@" > "$WORK/log-int" 2>&1 &
     ipid=$!
     for _ in $(seq 1 100); do grep -q "paused at $point" "$WORK/log-int" 2>/dev/null && break; sleep 0.1; done
@@ -293,4 +305,67 @@ sed -i 's/^candidate = .*/candidate = "unknown"/' "$GT/release/candidate.toml"
 if gate; then fail "gate accepted candidate unknown"; fi
 rm "$GT/release/candidate.toml"
 if gate; then fail "gate accepted a missing candidate file"; fi
-echo "PASS: release gate fails closed, release install verifies signature, checksum and every package file, rejects tampered and forged releases, installs standalone offline, pinned key matches allowed_signers, upgrades atomically, keeps one previous release, rolls back, refuses downgrades, survives an interrupted install (including kill -9 just before the rename, just after it, and during rollback)"
+
+# 14. offline-signing handoff (sc#385): signature classes, labelled receipts, negative rows. Every key here is a
+#     throwaway made above; nothing in this section touches a real key.
+rcpt() { sed -n "s/^  \"$2\": \"\{0,1\}\([^\",]*\)\"\{0,1\},\{0,1\}\$/\1/p" "$1/install-receipt.json"; }
+#   A. a dry-run artifact (manifest labelled dry-run, signed by a throwaway key given explicitly) installs and is
+#      recorded as signature_check dry-run-key in installed.toml and in install-receipt.json
+make_release "$WORK/dry" "$WORK/key" CAND-1 a dry
+run_install "$WORK/dry" "$WORK/bin-dry" "$WORK/cfg-dry" "$ROOT/install.sh" "${SIGN_ENV[@]}" \
+    || { cat "$WORK/log" >&2; fail "dry-run artifact did not install with the throwaway signer"; }
+grep -q '^signature-check = "dry-run-key"$' "$WORK/cfg-dry/installed.toml" || fail "installed.toml does not record dry-run-key"
+[[ "$(rcpt "$WORK/cfg-dry" signature_check)" == dry-run-key ]] || fail "install receipt does not record signature_check dry-run-key"
+[[ "$(rcpt "$WORK/cfg-dry" dry_run)" == true ]] || fail "install receipt does not record the dry-run manifest label"
+[[ "$(rcpt "$WORK/cfg-dry" artifact_sha256)" == "$(sha256sum "$WORK/dry/$ASSET" | cut -d' ' -f1)" ]] || fail "receipt artifact_sha256 is not the artifact's digest"
+[[ "$(rcpt "$WORK/cfg-dry" files_verified)" =~ ^[1-9][0-9]*$ ]] || fail "receipt files_verified is not a positive count"
+[[ "$(rcpt "$WORK/cfg-dry" cli_sha256)" =~ ^[0-9a-f]{64}$ ]] || fail "receipt cli_sha256 missing"
+grep -q 'signature_check: dry-run-key' "$WORK/log" || fail "installer output does not say dry-run-key"
+#   B. one byte changed in the middle of the archive (same size): refused, names the checksum, nothing installed
+make_release "$WORK/flip" "$WORK/key" CAND-1 a dry
+SZ="$(wc -c < "$WORK/flip/$ASSET")"; OFF=$((SZ / 2))
+B="$(dd if="$WORK/flip/$ASSET" bs=1 skip="$OFF" count=1 2>/dev/null | od -An -tu1 | tr -d ' ')"
+printf "$(printf '\\%03o' $(( (B + 1) % 256 )))" | dd of="$WORK/flip/$ASSET" bs=1 seek="$OFF" count=1 conv=notrunc 2>/dev/null
+[[ "$(wc -c < "$WORK/flip/$ASSET")" == "$SZ" ]] || fail "byte flip changed the size"
+if run_install "$WORK/flip" "$WORK/bin-flip" "$WORK/cfg-flip" "$ROOT/install.sh" "${SIGN_ENV[@]}"; then fail "artifact with one byte changed was installed"; fi
+grep -qi "checksum" "$WORK/log" || fail "one-byte change not refused by name (checksum)"
+[[ ! -e "$WORK/bin-flip/aien" && ! -e "$WORK/cfg-flip/install-receipt.json" ]] || fail "one-byte refusal left a binary or a receipt"
+#   C. one byte changed in the signed checksum list: refused, names the signature
+make_release "$WORK/flipsum" "$WORK/key" CAND-1 a dry
+C1="$(head -c1 "$WORK/flipsum/SHA256SUMS.txt")"; [[ "$C1" == 0 ]] && R=1 || R=0; sed -i "1s/^./$R/" "$WORK/flipsum/SHA256SUMS.txt"
+if run_install "$WORK/flipsum" "$WORK/bin-fs" "$WORK/cfg-fs" "$ROOT/install.sh" "${SIGN_ENV[@]}"; then fail "edited checksum list was installed"; fi
+grep -q "signature" "$WORK/log" || fail "edited checksum list not refused by name (signature)"
+[[ ! -e "$WORK/bin-fs/aien" ]] || fail "edited checksum list left a binary"
+#   D. missing signature: refused, says unsigned, nothing installed
+make_release "$WORK/nosig" "$WORK/key" CAND-1 a dry
+rm -f "$WORK/nosig/SHA256SUMS.txt.sig"
+if run_install "$WORK/nosig" "$WORK/bin-ns" "$WORK/cfg-ns" "$ROOT/install.sh" "${SIGN_ENV[@]}"; then fail "release without a signature was installed"; fi
+grep -q "SHA256SUMS.txt.sig is missing" "$WORK/log" || fail "missing signature not refused by name"
+[[ ! -e "$WORK/bin-ns/aien" && ! -e "$WORK/cfg-ns/install-receipt.json" ]] || fail "missing-signature refusal left a binary or a receipt"
+#   E. wrong key: a dry-run artifact signed by another throwaway key is refused
+make_release "$WORK/wrong" "$WORK/other" CAND-1 a dry
+if run_install "$WORK/wrong" "$WORK/bin-wk" "$WORK/cfg-wk" "$ROOT/install.sh" "${SIGN_ENV[@]}"; then fail "wrong-key artifact was installed"; fi
+grep -q "signature is NOT valid" "$WORK/log" || fail "wrong key not refused by name"
+#   F. a dry-run artifact can never be recorded as a release. Simulate a pinned release key with a copy of install.sh
+#      whose AIEN_RELEASE_SIGNER is the throwaway key: an unlabelled package signed by it records release (positive
+#      control); a dry-run-labelled package signed by the same key is refused and leaves no receipt.
+mkdir -p "$WORK/pinned-sim"
+sed "s|^AIEN_RELEASE_SIGNER=.*|AIEN_RELEASE_SIGNER='$(cat "$WORK/allowed_signers")'|" "$ROOT/install.sh" > "$WORK/pinned-sim/install.sh"
+grep -q "^AIEN_RELEASE_SIGNER='aien-release ssh-ed25519 " "$WORK/pinned-sim/install.sh" || fail "release-key simulation did not apply"
+run_install "$WORK/good" "$WORK/bin-rel" "$WORK/cfg-rel" "$WORK/pinned-sim/install.sh" HOME="$WORK/home" \
+    || { cat "$WORK/log" >&2; fail "simulated release did not install"; }
+[[ "$(rcpt "$WORK/cfg-rel" signature_check)" == release ]] || fail "release-key signature not recorded as release (control)"
+if run_install "$WORK/dry" "$WORK/bin-dryrel" "$WORK/cfg-dryrel" "$WORK/pinned-sim/install.sh" HOME="$WORK/home"; then
+    fail "dry-run artifact signed by the release key was installed"
+fi
+grep -q "labelled dry-run" "$WORK/log" || fail "dry-run artifact under the release key not refused by name"
+[[ ! -e "$WORK/cfg-dryrel/install-receipt.json" ]] || fail "refused dry-run artifact left a receipt"
+#   G. with the placeholder in place (no release key pinned) and no throwaway signer, nothing verifies as a release
+if [[ -z "$(pinned AIEN_RELEASE_SIGNER)" ]]; then
+    if run_install "$WORK/good" "$WORK/bin-ph" "$WORK/cfg-ph" "$ROOT/install.sh" HOME="$WORK/home"; then fail "placeholder accepted a release"; fi
+    grep -q "no public-release key is pinned" "$WORK/log" || fail "placeholder refusal does not say no release key is pinned"
+fi
+#   H. a release signed by the internal test key would be labelled internal-test-key (classification is by the
+#      verifying key; checked by grepping the installer, because that private key is not on this machine)
+grep -q 'SIG_CHECK=internal-test-key' "$ROOT/install.sh" || fail "install.sh has no internal-test-key class"
+echo "PASS: release gate fails closed, release install verifies signature, checksum and every package file, labels the signature class (release, internal-test-key, dry-run-key) in installed.toml and install-receipt.json, never records a dry-run artifact as a release, refuses a one-byte change, an edited checksum list, a missing signature and a wrong key, rejects tampered and forged releases, installs standalone offline, pinned key matches allowed_signers, upgrades atomically, keeps one previous release, rolls back, refuses downgrades, survives an interrupted install (including kill -9 just before the rename, just after it, and during rollback)"
diff --git a/scripts/test-offline-signing.sh b/scripts/test-offline-signing.sh
new file mode 100755
index 00000000..8ab0df2b
--- /dev/null
+++ b/scripts/test-offline-signing.sh
@@ -0,0 +1,93 @@
+#!/usr/bin/env bash
+# The offline-signing handoff end to end, offline, with throwaway keys only (Drake ruling 1, sc#385):
+#   1. key ceremony rehearsal (scripts/key-ceremony.sh --rehearsal): key, fingerprint, public-key verification test,
+#      two backups that each sign; a corrupted backup is caught by verify-backup
+#   2. stage 1 draft (archive + SHA256SUMS.txt, no signature): the publish gate refuses it (unsigned)
+#   3. stage 2 operator signs offline with the rehearsal key (key-ceremony.sh sign)
+#   4. stage 3 publish gate (scripts/release-publish-gate.sh): passes under the key that signed; refuses under the real
+#      docs/release/allowed_signers while it is the PLACEHOLDER, under the internal test key, under another key, after a
+#      one-byte change, and for dry-run assets or a dry-run-labelled package even when the signature is valid
+# No real key is made, read or needed. Every key lives in a temp folder that is deleted on exit.
+set -euo pipefail
+ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+W="$(mktemp -d "${TMPDIR:-/tmp}/aien-test-offline-signing.XXXXXX")"
+trap 'rm -rf "$W"' EXIT
+fail() { echo "FAIL: $*" >&2; exit 1; }
+pass() { echo "ok: $*"; }
+KC=(env AIEN_CEREMONY_ASSUME_YES=1 bash "$ROOT/scripts/key-ceremony.sh")
+GATE=(bash "$ROOT/scripts/release-publish-gate.sh")
+
+# 1. ceremony rehearsal
+"${KC[@]}" ceremony --rehearsal --out "$W/offline" --backup "$W/usb1" --backup "$W/usb2" > "$W/cer.log" 2>&1 \
+    || { tail -20 "$W/cer.log" >&2; fail "ceremony rehearsal failed"; }
+K="$W/offline/REHEARSAL-aien_release_ed25519"; S="$W/offline/public/allowed_signers"
+[[ -f "$K" && -f "$S" && -f "$W/offline/public/ceremony-record.txt" ]] || fail "ceremony outputs missing"
+grep -q '^REHEARSAL: throwaway key' "$W/offline/public/ceremony-record.txt" || fail "rehearsal record not labelled REHEARSAL"
+grep -q '^# REHEARSAL KEY' "$S" || fail "rehearsal allowed_signers not labelled"
+[[ "$(grep -c 'signs and verifies yes' "$W/offline/public/ceremony-record.txt")" -eq 2 ]] || fail "record does not show two verified backups"
+! grep -rqs 'PRIVATE KEY' "$W/offline/public" || fail "private key material in the public folder"
+grep -q 'altered file is refused: yes' "$W/cer.log" || fail "public-key verification test has no negative row"
+pass "ceremony rehearsal: key, witness fingerprint check, verification test, two backups that sign, public folder only public"
+"${KC[@]}" verify-backup "$W/usb2/$(basename "$K")" "$S" --rehearsal > "$W/vb.log" 2>&1 || fail "intact backup failed verify-backup"
+BK="$W/usb2/$(basename "$K")"; C3="$(sed -n 3p "$BK" | cut -c20)"; [[ "$C3" == A ]] && R=B || R=A
+sed -i "3s/^\(.\{19\}\)./\1$R/" "$BK"   # one character of the key body changed
+if "${KC[@]}" verify-backup "$W/usb2/$(basename "$K")" "$S" --rehearsal > "$W/vb.log" 2>&1; then fail "corrupted backup passed verify-backup"; fi
+pass "verify-backup accepts an intact backup and refuses a corrupted one"
+if "${KC[@]}" ceremony --rehearsal --out "$ROOT/docs/release/x" --backup "$W/b1" --backup "$W/b2" > "$W/cer2.log" 2>&1; then
+    rm -rf "$ROOT/docs/release/x"; fail "ceremony wrote a key inside a git checkout"
+fi
+grep -q 'inside a git checkout' "$W/cer2.log" || fail "in-repo refusal not named"
+[[ ! -e "$ROOT/docs/release/x" ]] || fail "ceremony left files in the repository"
+pass "ceremony refuses to put a key inside a git checkout"
+if env CI=true bash "$ROOT/scripts/key-ceremony.sh" ceremony --out "$W/ci" --backup "$W/c1" --backup "$W/c2" < /dev/null > "$W/cer3.log" 2>&1; then
+    fail "real-mode ceremony ran under CI"
+fi
+grep -qE 'CI machine|network route' "$W/cer3.log" || fail "real-mode ceremony on this machine not refused by name"
+pass "real (non-rehearsal) mode refuses to run on a CI or networked machine"
+
+# fixture release package (no dry-run label), as stage 1 drafts it
+mk_assets() { # dir [dry]
+    local d="$1" p="$W/pkg"; rm -rf "$d" "$p"; mkdir -p "$d" "$p/bin"
+    printf '#!/bin/sh\necho aien\n' > "$p/bin/aien"
+    { echo 'schema = "AienReleaseV1"'; echo 'candidate = "CAND-1"'; [[ -z "${2:-}" ]] || echo 'dry-run = true'; } > "$p/release.toml"
+    tar -czf "$d/sovereign-linux-aarch64.tar.gz" -C "$p" .
+    (cd "$d" && sha256sum sovereign-* > SHA256SUMS.txt)
+}
+# 2. stage 1 draft is unsigned: refused
+mk_assets "$W/draft"
+if "${GATE[@]}" "$W/draft" "$S" > "$W/g.log" 2>&1; then fail "unsigned draft passed the publish gate"; fi
+grep -q "SHA256SUMS.txt.sig is missing" "$W/g.log" || fail "unsigned draft not refused by name"
+pass "stage 3 refuses an unsigned draft"
+# 3. stage 2: the operator signs offline
+"${KC[@]}" sign "$K" "$S" "$W/draft/SHA256SUMS.txt" --rehearsal > "$W/s.log" 2>&1 || { cat "$W/s.log" >&2; fail "offline sign failed"; }
+[[ -f "$W/draft/SHA256SUMS.txt.sig" ]] || fail "no signature produced"
+pass "stage 2 signs offline and verifies before upload"
+# 4. stage 3 publish gate
+"${GATE[@]}" "$W/draft" "$S" > "$W/g.log" 2>&1 || { cat "$W/g.log" >&2; fail "signed draft refused under the key that signed it"; }
+pass "stage 3 passes a draft signed by the pinned key"
+if "${GATE[@]}" "$W/draft" "$ROOT/docs/release/allowed_signers" > "$W/g.log" 2>&1; then fail "gate passed under docs/release/allowed_signers"; fi
+if ! grep -qvE '^[[:space:]]*(#|$)' "$ROOT/docs/release/allowed_signers"; then
+    grep -q "PLACEHOLDER" "$W/g.log" || fail "placeholder refusal not named"
+    pass "stage 3 refuses everything while allowed_signers is the PLACEHOLDER"
+fi
+if "${GATE[@]}" "$W/draft" "$ROOT/docs/release/internal_test_signers" > "$W/g.log" 2>&1; then fail "gate passed under the internal test key"; fi
+grep -q "internal test key" "$W/g.log" || fail "internal test key refusal not named"
+pass "stage 3 refuses the internal test key as a release key"
+ssh-keygen -q -t ed25519 -N '' -f "$W/other"; printf 'aien-release %s\n' "$(cut -d' ' -f1,2 "$W/other.pub")" > "$W/other_signers"
+if "${GATE[@]}" "$W/draft" "$W/other_signers" > "$W/g.log" 2>&1; then fail "gate passed under another key"; fi
+grep -q "NOT valid" "$W/g.log" || fail "wrong key not refused by name"
+pass "stage 3 refuses a signature from a key that is not pinned"
+cp -r "$W/draft" "$W/flip"; A="$W/flip/sovereign-linux-aarch64.tar.gz"; SZ=$(wc -c < "$A"); OFF=$((SZ / 2))
+B="$(dd if="$A" bs=1 skip="$OFF" count=1 2>/dev/null | od -An -tu1 | tr -d ' ')"
+printf "$(printf '\\%03o' $(( (B + 1) % 256 )))" | dd of="$A" bs=1 seek="$OFF" count=1 conv=notrunc 2>/dev/null
+if "${GATE[@]}" "$W/flip" "$S" > "$W/g.log" 2>&1; then fail "gate passed an archive with one byte changed"; fi
+grep -q "does not match the signed checksum" "$W/g.log" || fail "one-byte change not refused by name (checksum)"
+pass "stage 3 refuses an archive with one byte changed (checksum)"
+cp -r "$W/draft" "$W/dryfile"; echo "DRY RUN" > "$W/dryfile/DRY-RUN-NOT-A-RELEASE.txt"
+if "${GATE[@]}" "$W/dryfile" "$S" > "$W/g.log" 2>&1; then fail "gate passed a draft holding a DRY-RUN file"; fi
+grep -q "dry-run asset" "$W/g.log" || fail "dry-run file refusal not named"
+mk_assets "$W/drypkg" dry; "${KC[@]}" sign "$K" "$S" "$W/drypkg/SHA256SUMS.txt" --rehearsal > /dev/null 2>&1
+if "${GATE[@]}" "$W/drypkg" "$S" > "$W/g.log" 2>&1; then fail "gate passed a dry-run-labelled package with a valid signature"; fi
+grep -q "labelled dry-run" "$W/g.log" || fail "dry-run package refusal not named"
+pass "stage 3 refuses dry-run assets and dry-run-labelled packages even with a valid signature"
+echo "PASS: offline-signing handoff: ceremony rehearsal with verified backups, unsigned draft refused, offline signature verified, publish gate refuses placeholder, internal test key, wrong key, one-byte change and dry runs"
diff --git a/scripts/test-release-checks.sh b/scripts/test-release-checks.sh
index 266d1fd5..c072245e 100755
--- a/scripts/test-release-checks.sh
+++ b/scripts/test-release-checks.sh
@@ -86,6 +86,9 @@ if (cd "$T" && AIEN_RELEASE_BIN_DIR="$W/bins" bash scripts/package-release.sh "$
 (cd "$T" && AIEN_DRY_RUN=1 AIEN_RELEASE_BIN_DIR="$W/bins" bash scripts/package-release.sh "$W/dry.tar.gz" >/dev/null 2>&1) || fail "dry-run packaging failed"
 write_locks
 must_fail "names candidate 'NOT-RELEASABLE'" --package "$W/dry.tar.gz"; pass "dry-run package is not a releasable package"
+tar -xzOf "$W/dry.tar.gz" ./release.toml | grep -qx 'dry-run = true' || fail "dry-run package manifest is not labelled dry-run"
+! tar -xzOf "$W/good.tar.gz" ./release.toml | grep -q '^dry-run' || fail "release package manifest carries a dry-run label"
+pass "dry-run package manifest labelled dry-run = true; release package is not"
 
 # executable digest mismatch: a different aien binary against the candidate's pinned digest
 mkdir "$W/bins2"; cp "$W/bins/"* "$W/bins2/"; printf '#!/bin/sh\necho other build\n' > "$W/bins2/aien-cli"
@@ -133,6 +136,14 @@ assets; sign "$W/key"; echo tamper >> "$W/a/SHA256SUMS.txt"; vfail "NOT valid";
 assets; sign "$W/key"; echo x >> "$W/a/sovereign-linux-aarch64.tar.gz"; vfail "does not match the signed checksum"; pass "tampered archive rejected"
 assets; (cd "$W/a" && cp sovereign-linux-aarch64.tar.gz sovereign-macos-arm64.tar.gz); sign "$W/key"; vfail "not covered"; pass "archive missing from signed list rejected"
 assets; : > "$W/empty"; if bash "$ROOT/scripts/verify-release-assets.sh" "$W/a" "$W/empty" >/dev/null 2>&1; then fail "empty signer file accepted"; fi; pass "empty signer file rejected"
-# the production signer file is a real, non-empty key line
-grep -q '^aien-release ssh-ed25519 ' "$ROOT/docs/release/allowed_signers" || fail "docs/release/allowed_signers has no aien-release key"
+# the production signer file holds exactly one aien-release key, or (until the key ceremony) only a labelled
+# PLACEHOLDER that verify-release-assets.sh refuses by name; the internal test key is never in it
+PROD="$ROOT/docs/release/allowed_signers"; KEYS="$(grep -cvE '^[[:space:]]*(#|$)' "$PROD" || true)"
+if [[ "$KEYS" -eq 0 ]]; then
+    grep -q PLACEHOLDER "$PROD" || fail "allowed_signers has no key and no PLACEHOLDER label"
+    assets; sign "$W/key"; cp "$PROD" "$W/signers"; vfail "PLACEHOLDER"; pass "placeholder allowed_signers refuses a signed release by name"
+else
+    [[ "$KEYS" -eq 1 ]] && grep -qE '^aien-release ssh-ed25519 [A-Za-z0-9+/=]+$' "$PROD" || fail "allowed_signers must hold exactly one aien-release ed25519 key"
+fi
+! grep -qF "$(grep -vE '^[[:space:]]*(#|$)' "$ROOT/docs/release/internal_test_signers" | cut -d' ' -f3)" "$PROD" || fail "the internal test key is in allowed_signers"
 echo "PASS: release gate rejects inconsistent source pins, executable digest and model input mismatches, missing or invalid signatures"
diff --git a/scripts/test-release-signing-workflow.sh b/scripts/test-release-signing-workflow.sh
new file mode 100755
index 00000000..4c888903
--- /dev/null
+++ b/scripts/test-release-signing-workflow.sh
@@ -0,0 +1,89 @@
+#!/usr/bin/env bash
+# Static guard for the offline-signing handoff (Drake ruling 1, sc#385): no private release key in CI, ever.
+#   scripts/test-release-signing-workflow.sh [release.yml] [release-publish.yml]
+# release.yml: no AIEN_RELEASE_SIGNING_KEY and no secret other than GITHUB_TOKEN; `ssh-keygen -Y sign` only inside the
+#   dry-run-sign job (a throwaway key made in that job), which runs only on a manual dry run; every `gh release create`
+#   makes a --draft; release.yml never publishes, edits or uploads to a release.
+# release-publish.yml: manual trigger only; no secret other than GITHUB_TOKEN; never signs; the publish gate
+#   (scripts/release-publish-gate.sh) runs before the only `gh release edit`; nothing in it can be skipped or made
+#   non-blocking (no if:, no continue-on-error); the tag input reaches shell only through env.
+# Mutation note: the self-checks below inject each forbidden pattern into a copy; each must turn this guard red.
+set -euo pipefail
+ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+REL="${1:-$ROOT/.github/workflows/release.yml}"
+PUB="${2:-$ROOT/.github/workflows/release-publish.yml}"
+err() { echo "FAIL: $*" >&2; return 1; }
+code() { grep -nvE '^[[:space:]]*#' "$1" || true; }   # numbered lines that are not comments
+# job_lines <file> <pattern>: "<job>\t<line>" for each non-comment line matching pattern, inside jobs:
+job_lines() {
+    awk -v pat="$2" '
+        /^[a-z]/ { injobs = ($0 ~ /^jobs:/); job = ""; next }
+        injobs && /^  [a-zA-Z_-]+:[[:space:]]*$/ { job = $1; sub(/:$/, "", job); next }
+        $0 ~ /^[[:space:]]*#/ { next }
+        $0 ~ pat { printf "%s\t%s\n", job, $0 }' "$1"
+}
+check_rel() {
+    local f="$1" bad
+    ! grep -q 'AIEN_RELEASE_SIGNING_KEY' "$f" || { err "$f names AIEN_RELEASE_SIGNING_KEY"; return 1; }
+    bad="$(code "$f" | grep -E 'secrets\.' | grep -vE 'secrets\.GITHUB_TOKEN' || true)"
+    [[ -z "$bad" ]] || { err "$f uses a secret other than GITHUB_TOKEN: $bad"; return 1; }
+    bad="$(job_lines "$f" 'ssh-keygen[[:space:]].*-Y[[:space:]]+sign' | awk -F'\t' '$1 != "dry-run-sign"' || true)"
+    [[ -z "$bad" ]] || { err "$f signs outside the dry-run-sign job: $bad"; return 1; }
+    job_lines "$f" '^    if:' | grep -E '^dry-run-sign	' | grep -q "github.event_name == 'workflow_dispatch' && inputs.dry_run$" \
+        || { err "$f dry-run-sign job is not limited to a manual dry run"; return 1; }
+    bad="$(code "$f" | grep -E 'gh release create' | grep -vE -- '--draft( |$)' || true)"
+    [[ -z "$bad" ]] || { err "$f creates a release that is not a draft: $bad"; return 1; }
+    bad="$(code "$f" | grep -E -- '--draft=false|gh release (edit|upload)|gh api .*releases|action-gh-release|upload-release' || true)"
+    [[ -z "$bad" ]] || { err "$f publishes, edits or uploads to a release: $bad"; return 1; }
+}
+check_pub() {
+    local f="$1" bad gate edit
+    awk '/^on:/ { on = 1; next } on && /^[a-z]/ { on = 0 } on && /^  [a-z_]+:/ { print $1 }' "$f" | grep -vxq 'workflow_dispatch:' \
+        && { err "$f has a trigger other than workflow_dispatch"; return 1; }
+    bad="$(code "$f" | grep -E 'secrets\.' | grep -vE 'secrets\.GITHUB_TOKEN' || true)"
+    [[ -z "$bad" ]] || { err "$f uses a secret other than GITHUB_TOKEN: $bad"; return 1; }
+    ! code "$f" | grep -qE 'ssh-keygen[[:space:]].*-Y[[:space:]]+sign' || { err "$f signs"; return 1; }
+    ! code "$f" | grep -qE '^[0-9]+:[[:space:]]*(- )?(if|continue-on-error):' || { err "$f has an if: or continue-on-error"; return 1; }
+    gate="$(code "$f" | grep -E 'run: bash scripts/release-publish-gate\.sh release-assets docs/release/allowed_signers$' | head -1 | cut -d: -f1)"
+    edit="$(code "$f" | grep -E 'gh release edit' | cut -d: -f1)"
+    [[ -n "$gate" ]] || { err "$f does not run the publish gate against docs/release/allowed_signers"; return 1; }
+    [[ "$(printf '%s\n' "$edit" | grep -c .)" -eq 1 && "$edit" -gt "$gate" ]] || { err "$f publishes before (or without) the gate"; return 1; }
+    bad="$(code "$f" | grep -E '\$\{\{ *inputs\.' | grep -vE '^[0-9]+:[[:space:]]+(TAG|ref):' || true)"
+    [[ -z "$bad" ]] || { err "$f interpolates an input outside env/ref: $bad"; return 1; }
+}
+check_rel "$REL"
+check_pub "$PUB"
+
+M="$(mktemp -d)"; trap 'rm -rf "$M"' EXIT
+n=0
+must_refuse() { local what="$1" kind="$2" src="$3" mut="$4"
+    cmp -s "$src" "$mut" && { echo "FAIL: mutation did not apply ($what); update this guard" >&2; exit 1; }
+    if "$kind" "$mut" 2>/dev/null; then echo "FAIL: guard does not catch: $what" >&2; exit 1; fi
+    n=$((n + 1)); }
+sed '/^      - name: Generate Checksums$/i\      - name: sign\n        env:\n          K: ${{ secrets.AIEN_RELEASE_SIGNING_KEY }}\n        run: echo' "$REL" > "$M/r1"
+must_refuse "release key secret back in release.yml" check_rel "$REL" "$M/r1"
+sed '/^      - name: Generate Checksums$/i\      - name: sign\n        env:\n          K: ${{ secrets.SOME_KEY }}\n        run: echo' "$REL" > "$M/r2"
+must_refuse "another secret in release.yml" check_rel "$REL" "$M/r2"
+sed 's/^          sha256sum sovereign-\* aien-cli-digests.txt > SHA256SUMS.txt$/&\n          ssh-keygen -Y sign -f k -n aien-release SHA256SUMS.txt/' "$REL" > "$M/r3"
+must_refuse "signing in the draft-release job" check_rel "$REL" "$M/r3"
+sed 's/gh release create "$TAG" --draft --verify-tag/gh release create "$TAG" --verify-tag/' "$REL" > "$M/r4"
+must_refuse "non-draft gh release create" check_rel "$REL" "$M/r4"
+sed 's/^            --notes-file ..\/release-notes-with-digests.md$/&\n          gh release edit "$TAG" --draft=false/' "$REL" > "$M/r5"
+must_refuse "release.yml publishing the draft" check_rel "$REL" "$M/r5"
+sed "s/^    if: github.event_name == 'workflow_dispatch' \&\& inputs.dry_run\$/    if: always()/" "$REL" > "$M/r6"
+must_refuse "dry-run-sign job runs outside a manual dry run" check_rel "$REL" "$M/r6"
+sed 's/^  workflow_dispatch:$/  push:\n    tags: ["v*"]\n&/' "$PUB" > "$M/p1"
+must_refuse "publish workflow on push" check_pub "$PUB" "$M/p1"
+sed 's/^        run: bash scripts\/release-publish-gate.sh release-assets docs\/release\/allowed_signers$/        continue-on-error: true\n&/' "$PUB" > "$M/p2"
+must_refuse "publish gate made non-blocking" check_pub "$PUB" "$M/p2"
+grep -v 'run: bash scripts/release-publish-gate.sh' "$PUB" > "$M/p3"
+must_refuse "publish gate removed" check_pub "$PUB" "$M/p3"
+sed 's/^      - name: Check the tag name$/      - name: early\n        run: gh release edit "$TAG" --draft=false\n&/' "$PUB" > "$M/p4"
+must_refuse "publish before the gate" check_pub "$PUB" "$M/p4"
+sed 's/^      GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}$/&\n      K: ${{ secrets.AIEN_RELEASE_SIGNING_KEY }}/' "$PUB" > "$M/p5"
+must_refuse "release key secret in the publish workflow" check_pub "$PUB" "$M/p5"
+sed 's/^        run: gh release edit "$TAG" --draft=false$/        run: echo ${{ inputs.tag }}; gh release edit "$TAG" --draft=false/' "$PUB" > "$M/p6"
+must_refuse "input interpolated into a run line" check_pub "$PUB" "$M/p6"
+sed 's/^        run: bash scripts\/release-publish-gate.sh release-assets docs\/release\/allowed_signers$/        run: bash scripts\/release-publish-gate.sh release-assets release-assets\/dry-run-signers/' "$PUB" > "$M/p7"
+must_refuse "publish gate pointed at a signer file other than allowed_signers" check_pub "$PUB" "$M/p7"
+echo "ok: no release key in CI; release.yml signs only in the manual dry run and only drafts; release-publish.yml is manual, keyless and publishes only after the blocking publish gate; $n mutants refused"
diff --git a/scripts/verify-release-assets.sh b/scripts/verify-release-assets.sh
index a8907f1f..cb0061ff 100755
--- a/scripts/verify-release-assets.sh
+++ b/scripts/verify-release-assets.sh
@@ -10,6 +10,7 @@ die() { echo "release assets: $*" >&2; exit 1; }
 [[ -f "$d/SHA256SUMS.txt" ]] || die "SHA256SUMS.txt is missing"
 [[ -f "$d/SHA256SUMS.txt.sig" ]] || die "SHA256SUMS.txt.sig is missing: refusing an unsigned release"
 [[ -s "$signers" ]] || die "allowed signers file $signers is missing or empty"
+grep -qvE '^[[:space:]]*(#|$)' "$signers" || die "no key is pinned in $signers (PLACEHOLDER until the key ceremony, docs/release/KEY_CEREMONY.md): refusing"
 ssh-keygen -Y verify -f "$signers" -I aien-release -n aien-release -s "$d/SHA256SUMS.txt.sig" < "$d/SHA256SUMS.txt" >/dev/null 2>&1 \
     || die "SHA256SUMS.txt signature is NOT valid for $signers"
 n=0