interplane.Get Omega
Read in your language

synapse

A component of the AienOS ecosystem.

Brought by drakestapleton

GitHub aien-dev/synapse#80 (code only)

closed derived 31bd704288c31b4b #80

Imported from GitHub aien-dev/synapse#80 (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 bd2bfcc3352e2c4a98fda8215743691859d62af2 · Head 4542ee75b58fd980a2550e19bb89f46a206fd248

Apply it

git checkout -b patch-31bd704288c31b4b bd2bfcc3352e2c4a98fda8215743691859d62af2
curl -fsSL https://interplane.io/drakestapleton/synapse/patches/31bd704288c31b4b.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/synapse
80
4542ee75b58fd980a2550e19bb89f46a206fd248
{"kind":"github-import","owner":"aien-dev","repo":"synapse","number":80,"url":"https://github.com/aien-dev/synapse/pull/80","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:39:18Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.aien/always b/.aien/always
new file mode 100644
index 0000000..2278de4
--- /dev/null
+++ b/.aien/always
@@ -0,0 +1,4 @@
+# Gates that run on every commit regardless of changed paths (ADR 0033 Decision 12
+# allow-list; inventory contract C6). One gate name per line. Read from the base ref.
+CRUMB-VERIFY
+SYNAPSE-ZERO-DISK-SECRETS
diff --git a/.aien/unmapped-ok b/.aien/unmapped-ok
new file mode 100644
index 0000000..6a7f209
--- /dev/null
+++ b/.aien/unmapped-ok
@@ -0,0 +1,8 @@
+# Changed paths matching these globs need only the always-run set (.aien/always).
+# Everything else must be covered by a manifest's inputs or the commit is NOT_RUN.
+# Conservative: the hosted portable workflow has no path filter, so only pure
+# documentation is listed. Read from the base ref.
+docs/**
+*.md
+LICENSE
+.gitignore
diff --git a/.aien/verify.pub b/.aien/verify.pub
new file mode 100644
index 0000000..3e65411
--- /dev/null
+++ b/.aien/verify.pub
@@ -0,0 +1 @@
+01368e0b02dc1113ae7425ad6ab00fdf5aa7dd97e0690745918a52f051d5cf68
diff --git a/.crumb b/.crumb
index f234f97..495a32d 100644
--- a/.crumb
+++ b/.crumb
@@ -1,8 +1,4 @@
 {
-  "schema_version": "1.0.0",
-  "name": "synapse",
-  "layer": "root",
-  "purpose": "Synapse agent-native changeset service with Git and Radicle interoperability (aien-sovereign-core#515)",
   "below": [
     {
       "name": "synapse-core",
@@ -45,27 +41,43 @@
       "role": "Binary wire frames with a fuzzed decoder, have-want chunk negotiation, and stream transports (ADR 0003 step G1)"
     }
   ],
-  "invariants": [],
   "extensions": {
+    "generated": {
+      "children": [],
+      "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+      "compiled_at": "2026-10-16T09:12:08Z",
+      "compiler": "crumb-compile/1",
+      "digest": "sha256:279410a8da95ac0a5c9e9cf32a56684e2ca85469ad52267efcce5e6dbbbef821",
+      "evidence_files": 241,
+      "evidence_root": "sha256:f103bd6c7728e5a399cede51d9c64e4d42afc97e0d48dd424536b6cc72e48314",
+      "files": 411,
+      "generated_at_commit": "5d287e0e4ab4439f79711243518c0a83cce56eff",
+      "source_tree": "sha256:07947598e29d8d8fca9b546541ebe7e575c954cf18901eeb74304d2a9f594e2b"
+    },
     "synapse": {
-      "repository": "aien-spark/synapse",
-      "tracker": "aien-sovereign-core#515",
       "component_paths": {
-        "synapse-core": "crates/synapse-core",
-        "synapse-store": "crates/synapse-store",
-        "synapse-auth": "crates/synapse-auth",
         "synapse-api": "crates/synapse-api",
-        "synapse-git": "crates/synapse-git",
-        "synapse-radicle": "crates/synapse-radicle",
+        "synapse-auth": "crates/synapse-auth",
         "synapse-bench": "crates/synapse-bench",
-        "synapse-crumb": "crates/synapse-crumb",
         "synapse-coord": "crates/synapse-coord",
+        "synapse-core": "crates/synapse-core",
+        "synapse-crumb": "crates/synapse-crumb",
+        "synapse-git": "crates/synapse-git",
+        "synapse-radicle": "crates/synapse-radicle",
+        "synapse-store": "crates/synapse-store",
         "synapse-wire": "crates/synapse-wire"
       },
       "migrated_from": {
         "dialect": "D3 (schema: \"crumb/v1\", ADR 0004)",
         "updated_at": "2026-10-14T15:35:01Z"
-      }
+      },
+      "repository": "aien-spark/synapse",
+      "tracker": "aien-sovereign-core#515"
     }
-  }
+  },
+  "invariants": [],
+  "layer": "root",
+  "name": "synapse",
+  "purpose": "Synapse agent-native changeset service with Git and Radicle interoperability (aien-sovereign-core#515)",
+  "schema_version": "1.0.0"
 }
diff --git a/.github/workflows/aien-verification.yml b/.github/workflows/aien-verification.yml
new file mode 100644
index 0000000..3f670af
--- /dev/null
+++ b/.github/workflows/aien-verification.yml
@@ -0,0 +1,199 @@
+# AIEN Verification: the GitHub thin gate (ADR 0033 Decision 11, inventory contract C5).
+#
+# PHASE 3 (2026-10-16, Drake's agreement 2026-10-15: "the Spark becomes the only test judge").
+# This is a required check. The Spark worker (aien-test worker) runs the tests and signs a
+# bundle; tools/aien-local-ci/pipeline.sh in aien-sovereign-core publishes it to aien-receipts
+# and reruns this workflow once it is there. A missing bundle fails this check (NOT_RUN) until
+# the rerun. Pull requests labeled ready-to-merge are merged by the pipeline (docs/PIPELINE.md).
+#
+# What it does: checkout; read the trust anchors from the BASE ref (origin/main), never from
+# the head under test (amendment A1); crumb verify; fetch <repo>/<sha>/bundle.json from
+# aien-dev/aien-receipts; verify the bundle signature and content with the pinned aien-test
+# build; run the repository's portable smoke set (gates whose requires is only "portable").
+#
+# GitHub-hosted compute: this workflow compiles only the two pinned verifier tools (the crumb
+# checker, and aien-test once the repository is enrolled). It never builds or tests this
+# repository's own code; the portable smoke set is text scans and format checks only.
+#
+# PHASE 3 rules (marked "PHASE3" below): a missing bundle is NOT_RUN (this check fails; the
+# pipeline reruns it after publication), and a trust-surface change fails unless the verified
+# bundle's signed plan shows the operator ran it by hand (plan.blocked == null).
+name: AIEN Verification
+
+on:
+  pull_request:
+  push:
+    branches: [main]
+
+permissions:
+  contents: read
+
+jobs:
+  verify:
+    name: AIEN Verification
+    runs-on: ubuntu-latest
+    timeout-minutes: 30
+    env:
+      REPO_SLUG: aien-spark/synapse
+      AIEN_TEST_PIN: c26f4d7ac3156088469b27462390f5b08ef4f436
+      RECEIPTS_RAW: https://raw.githubusercontent.com/aien-dev/aien-receipts/main
+    steps:
+      - name: Checkout the head under test
+        uses: actions/checkout@v4
+        with:
+          fetch-depth: 0
+
+      - name: Resolve the commit under test and the base ref
+        id: ids
+        run: |
+          if [ "${{ github.event_name }}" = pull_request ]; then
+            sha="${{ github.event.pull_request.head.sha }}"
+          else
+            sha="${{ github.sha }}"
+          fi
+          git fetch -q origin main
+          echo "sha=$sha" >> "$GITHUB_OUTPUT"
+          echo "base=$(git rev-parse origin/main)" >> "$GITHUB_OUTPUT"
+          echo "commit under test: $sha"
+          echo "base (trust anchors): $(git rev-parse origin/main)"
+
+      - name: "Trust anchors from the base ref (A1: never from the head under test)"
+        id: anchors
+        run: |
+          mkdir -p "$RUNNER_TEMP/anchors"
+          base="${{ steps.ids.outputs.base }}"
+          if git show "$base:.aien/verify.pub" > "$RUNNER_TEMP/anchors/verify.pub" 2>/dev/null; then
+            echo "enrolled=true" >> "$GITHUB_OUTPUT"
+            git show "$base:.aien/always" > "$RUNNER_TEMP/anchors/always" 2>/dev/null || : > "$RUNNER_TEMP/anchors/always"
+            git show "$base:.aien/unmapped-ok" > "$RUNNER_TEMP/anchors/unmapped-ok" 2>/dev/null || : > "$RUNNER_TEMP/anchors/unmapped-ok"
+            echo "verify.pub (base): $(cat "$RUNNER_TEMP/anchors/verify.pub")"
+          else
+            echo "enrolled=false" >> "$GITHUB_OUTPUT"
+            # PHASE3: an enrolled repository whose base ref lost its key cannot verify anything.
+            echo "::error::.aien/verify.pub is not on the base ref: no trusted key, nothing can be verified."
+            exit 1
+          fi
+          # Trust-surface changes are run by the operator by hand (A1): BLOCKED_OPERATOR.
+          changed=$(git diff --name-only "$base...${{ steps.ids.outputs.sha }}" -- .aien tests/gates .github/workflows .forgejo tools/aien-test || true)
+          if [ -n "$changed" ]; then
+            echo "blocked=true" >> "$GITHUB_OUTPUT"
+            echo "::notice::BLOCKED_OPERATOR: this head changes the trust surface (the bundle must show an operator run):"; echo "$changed"
+            # PHASE3: enforced in the verify step: the verified bundle's signed plan must say blocked == null.
+          else
+            echo "blocked=false" >> "$GITHUB_OUTPUT"
+          fi
+
+      - name: Checkout the pinned crumb tool source (aien-architecture @ d0f0b95d344b4c6628c3d868346932fd247ce168)
+        uses: actions/checkout@v4
+        with:
+          repository: aien-spark/aien-architecture
+          ref: d0f0b95d344b4c6628c3d868346932fd247ce168
+          path: .crumb-tool-src
+
+      - name: Build the crumb tool, then remove its source from this tree
+        run: |
+          make -C .crumb-tool-src/tools/crumb crumb
+          mkdir -p "$RUNNER_TEMP/bin" && cp .crumb-tool-src/tools/crumb/crumb "$RUNNER_TEMP/bin/crumb"
+          rm -rf .crumb-tool-src
+          echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
+
+      - name: Crumbs must be exactly what the compiler produces now (stays GitHub-hosted, D11)
+        run: crumb verify .
+
+      - name: Install Stable Rust Toolchain (for the pinned aien-test build and the smoke set)
+        if: steps.anchors.outputs.enrolled == 'true'
+        uses: dtolnay/rust-toolchain@stable
+        with:
+          components: rustfmt
+
+      - name: Checkout the pinned aien-test source (aien-sovereign-core @ ${{ env.AIEN_TEST_PIN }})
+        if: steps.anchors.outputs.enrolled == 'true'
+        uses: actions/checkout@v4
+        with:
+          repository: aien-spark/aien-sovereign-core
+          ref: ${{ env.AIEN_TEST_PIN }}
+          path: .aien-test-src
+
+      - name: Cache the pinned aien-test build
+        if: steps.anchors.outputs.enrolled == 'true'
+        uses: actions/cache@v4
+        with:
+          path: |
+            ~/.cargo/registry
+            ~/.cargo/git
+            .aien-test-src/target
+          key: aien-test-${{ runner.os }}-${{ env.AIEN_TEST_PIN }}
+
+      - name: Build aien-test from the pin (never from the tree under test), then remove the source
+        if: steps.anchors.outputs.enrolled == 'true'
+        run: |
+          cargo build --release -p aien-test --manifest-path .aien-test-src/Cargo.toml
+          cp .aien-test-src/target/release/aien-test "$RUNNER_TEMP/bin/aien-test" 2>/dev/null || { mkdir -p "$RUNNER_TEMP/bin"; cp .aien-test-src/target/release/aien-test "$RUNNER_TEMP/bin/aien-test"; }
+          echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
+          rm -rf .aien-test-src
+          git status --porcelain --untracked-files=normal
+
+      - name: Fetch the signed verification bundle for this commit
+        id: bundle
+        run: |
+          url="$RECEIPTS_RAW/synapse/${{ steps.ids.outputs.sha }}/bundle.json"
+          echo "bundle url: $url"
+          if curl -fsSL "$url" -o "$RUNNER_TEMP/bundle.json"; then
+            echo "present=true" >> "$GITHUB_OUTPUT"
+          else
+            echo "present=false" >> "$GITHUB_OUTPUT"
+            # PHASE3: NOT_RUN. The Spark pipeline reruns this workflow after it publishes the bundle.
+            echo "::error::NOT_RUN: no signed Spark bundle for ${{ steps.ids.outputs.sha }} yet. The Spark pipeline reruns this check once the bundle is published."
+            exit 2
+          fi
+
+      - name: Verify the bundle with the base-ref public key
+        if: steps.bundle.outputs.present == 'true' && steps.anchors.outputs.enrolled == 'true'
+        run: |
+          required=$(grep -v '^#' "$RUNNER_TEMP/anchors/always" | grep -v '^$' | paste -sd, -)
+          set +e
+          aien-test verify-bundle "$RUNNER_TEMP/bundle.json" \
+            --repo "github.com/$REPO_SLUG" \
+            --commit "${{ steps.ids.outputs.sha }}" \
+            --pubkey "$RUNNER_TEMP/anchors/verify.pub" \
+            ${required:+--require "$required"}
+          rc=$?
+          set -e
+          echo "verify-bundle exit $rc (0 PASS, 1 FAIL, 2 NOT_RUN, 3 REJECTED)"
+          [ "$rc" = 0 ] || exit "$rc"
+          # PHASE3: a trust-surface head passes only on an operator run: the plan member is inside
+          # the signed bytes just verified, and only an operator run of such a head has blocked == null.
+          if [ "${{ steps.anchors.outputs.blocked }}" = true ]; then
+            if jq -e '.plan.blocked == null' "$RUNNER_TEMP/bundle.json" >/dev/null; then
+              echo "trust-surface change: the signed bundle shows an operator run (plan.blocked == null)"
+            else
+              echo "::error::BLOCKED_OPERATOR: this head changes the trust surface and the bundle is not from an operator run"; exit 1
+            fi
+          fi
+
+      - name: Portable smoke set (gates whose requires is only portable, named at the base ref)
+        if: steps.anchors.outputs.enrolled == 'true' && steps.anchors.outputs.blocked == 'false'
+        run: |
+          base="${{ steps.ids.outputs.base }}"
+          names=$(for f in $(git ls-tree -r --name-only "$base" -- tests/gates | grep '\.gate$'); do
+            git show "$base:$f" | awk '
+              /^gate:/ {g=$2}
+              /^requires:/ {inr=1; next}
+              inr && /^  - / { if ($2 != "portable") other=1; next }
+              /^[a-z]/ {inr=0}
+              END { if (g != "" && !other) print g }'
+          done)
+          echo "portable smoke set: $(echo $names)"
+          mkdir -p "$RUNNER_TEMP/evidence"
+          fail=0
+          for g in $names; do
+            echo "::group::$g"
+            if timeout 600 aien-test run "$g" --evidence-dir "$RUNNER_TEMP/evidence"; then echo "$g: PASS"; else echo "::error::$g: not PASS"; fail=1; fi
+            echo "::endgroup::"
+          done
+          exit $fail
+
+      - name: "Trust-surface change: the portable smoke set is skipped (the operator ran this head on the Spark)"
+        if: steps.anchors.outputs.blocked == 'true'
+        run: |
+          echo "AIEN Verification: trust-surface head, accepted on the verified operator-run bundle above."
diff --git a/crumb.lock b/crumb.lock
new file mode 100644
index 0000000..3dea07e
--- /dev/null
+++ b/crumb.lock
@@ -0,0 +1 @@
+d0f0b95d344b4c6628c3d868346932fd247ce168
diff --git a/docs/PIPELINE.md b/docs/PIPELINE.md
new file mode 100644
index 0000000..6861053
--- /dev/null
+++ b/docs/PIPELINE.md
@@ -0,0 +1,55 @@
+# The Spark pipeline: how a pull request gets tested and merged
+
+Since 2026-10-16 the DGX Spark is the only test judge for this repository (ADR 0033 Decision 11,
+phase 3, agreed by Drake on 2026-10-15). The hosted Synapse portable CI workflow no longer runs on
+pull requests or pushes (manual trigger only); its two jobs are the Spark gates in `tests/gates/`:
+
+| Spark gate | Mirrors | Pool |
+| --- | --- | --- |
+| `SYNAPSE-WORKSPACE` | `portable-workspace`: `bash scripts/ci/portable.sh workspace` (fmt, clippy `-D warnings`, tests) | host |
+| `SYNAPSE-CONFORMANCE` | `portable-conformance`: `bash scripts/ci/portable.sh conformance` with aien-architecture at `29780e5` | host (sibling `../aien-architecture`) |
+| `CRUMB-VERIFY` | the thin gate's `crumb verify .` with the tool built from `crumb.lock` | host (sibling `../aien-architecture`), always-run |
+| `SYNAPSE-ZERO-DISK-SECRETS` | no hosted step; no plaintext `.env*` files in the tree | portable, always-run |
+
+## What happens to every pull request
+
+1. The Spark worker (`aien-test worker`, aien-sovereign-core `tools/aien-test`) runs the gates in
+   `tests/gates/` that the change touches plus `.aien/always`, inside the Spark sandbox, and signs
+   a bundle with the Spark key. Until the continuous worker is live for this repository, the
+   operator starts each head by hand: `aien-local-ci once synapse <sha>`.
+2. The pipeline (`tools/aien-local-ci/pipeline.sh` in aien-sovereign-core) checks the bundle
+   against `.aien/verify.pub` on `main` and publishes it to `aien-dev/aien-receipts` at
+   `synapse/<sha>/bundle.json`.
+3. It then reruns the `AIEN Verification` workflow on that head. That workflow downloads the
+   bundle and verifies it on GitHub. Until the bundle is published the check is red with
+   `NOT_RUN`; that is expected and clears on the rerun.
+
+## How to get a pull request merged
+
+Add the label **`ready-to-merge`** when the pull request is finished. The pipeline merges it
+(merge commit) only when all of these hold for the current head:
+
+- the label is exactly `ready-to-merge` and the pull request is not a draft;
+- the Spark bundle for that head verifies as PASS, including every gate in `.aien/always`;
+- the published copy in aien-receipts is byte-identical to the Spark's copy;
+- every required check on `main` is green on that head, and no `AIEN Verification` run is pending.
+
+Pushing a new commit moves the head; the pipeline tests the new head before it merges anything.
+Without the label nothing is merged. Remove the label to stop a merge.
+
+To add the label from a terminal use the REST call (`gh pr edit --add-label` can fail on
+repositories with a Projects (classic) error):
+`gh api -X POST repos/aien-spark/synapse/issues/<number>/labels -f 'labels[]=ready-to-merge'`.
+
+## Changes to the pipeline itself
+
+A head that changes `.aien/`, `tests/gates/`, `.github/workflows/`, `.forgejo/` or
+`tools/aien-test/` is `BLOCKED_OPERATOR`: the worker does not run it on its own. The operator runs
+it by hand on the Spark (`aien-local-ci once synapse <sha> --operator`); the signed bundle then
+records the operator run and the checks pass.
+
+## Where to look
+
+- Spark state: `aien-local-ci status`, journal `~/.local/state/aien-local-ci/journal.jsonl`,
+  pipeline journal `~/.local/state/aien-local-ci/pipeline.jsonl`.
+- Published bundles: <https://github.com/aien-dev/aien-receipts/tree/main/synapse>.
diff --git a/tests/gates/crumb.gate b/tests/gates/crumb.gate
new file mode 100644
index 0000000..2160b58
--- /dev/null
+++ b/tests/gates/crumb.gate
@@ -0,0 +1,25 @@
+# tests/gates/crumb.gate
+# Mirrors hosted: aien-verification.yml step 'crumb verify .' with the tool built from crumb.lock
+# (the same commit the thin gate pins). synapse had no hosted crumb job before phase 3.
+# requires host, not portable: the step builds crumb from the sibling ../aien-architecture checkout at the
+# crumb.lock commit, and a gate that needs a sibling is a host gate (LOCAL_VERIFICATION.md, sibling checkouts).
+# cache: never because the check reads the sibling checkout; it is sub-second.
+gate: CRUMB-VERIFY
+manifest_version: 2
+owner: synapse
+requires:
+  - host
+inputs:
+  - .crumb
+  - crumb.lock
+  - tests/gates/
+run:
+  exec: tests/gates/run.sh
+  args: ["crumb-verify"]
+expects:
+  exit: 0
+  verdict: PASS
+timeout: 5m
+exactness: EXACT
+cache_scope: machine
+cache: never
diff --git a/tests/gates/run.sh b/tests/gates/run.sh
new file mode 100755
index 0000000..3365276
--- /dev/null
+++ b/tests/gates/run.sh
@@ -0,0 +1,70 @@
+#!/usr/bin/env bash
+# tests/gates/run.sh: the one entry point for the local verification gates of synapse.
+# Every step runs the SAME command as the hosted job it mirrors (.github/workflows/portable.yml,
+# matrix gate workspace|conformance: `bash scripts/ci/portable.sh <gate>`; and the thin gate's
+# `crumb verify .`). Manifests under tests/gates/ name this script plus one step word, so no
+# manifest needs shell expansion (ADR 0028 P6). Observations print as "AIEN-OBS <name> <json>".
+#
+# Sibling checkout: the hosted conformance job checks out aien-spark/aien-architecture at the pin
+# below as .ci-architecture. Here the worker provides ../aien-architecture (main, read-only); this
+# script makes a local clone of it at the pin in a temp dir (no network), so the pinned checkout
+# portable.sh insists on (HEAD == pin) exists without touching the sibling.
+set -euo pipefail
+ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+cd "$ROOT"
+step="${1:?usage: tests/gates/run.sh <step>}"
+obs() { printf 'AIEN-OBS %s %s\n' "$1" "$2"; }
+ARCH_PIN=29780e56c9e6b9111d884e0d4b146737228c19f6
+tmp=$(mktemp -d)
+trap 'rm -rf "$tmp"' EXIT
+# Evidence goes outside the tree (hosted: target/ci-evidence, uploaded as an artifact).
+export CI_EVIDENCE_DIR="$tmp/ci-evidence"
+export CARGO_TERM_COLOR=never
+
+need_sibling() {
+  local name="$1"
+  if [ ! -d "../$name" ]; then
+    echo "run.sh: ../$name is missing; the hosted job checks out aien-spark/$name as a sibling" >&2
+    exit 3
+  fi
+  obs "sibling_${name//-/_}_commit" "\"$(git -C "../$name" rev-parse HEAD 2>/dev/null || echo unknown)\""
+}
+
+case "$step" in
+  crumb-verify)
+    # Thin gate (aien-verification.yml): crumb tool built from the aien-architecture commit in
+    # crumb.lock. Same here: build that exact commit from the sibling checkout into a temp dir
+    # outside the tree, so a newer crumb on PATH can never change the verdict.
+    need_sibling aien-architecture
+    pin=$(tr -d '[:space:]' < crumb.lock)
+    git -C ../aien-architecture archive "$pin" tools/crumb | tar -x -C "$tmp"
+    make -s -C "$tmp/tools/crumb" crumb
+    obs crumb_tool_commit "\"$pin\""
+    "$tmp/tools/crumb/crumb" verify .
+    ;;
+  workspace)
+    bash scripts/ci/portable.sh workspace
+    ;;
+  conformance)
+    need_sibling aien-architecture
+    git clone -q --no-checkout ../aien-architecture "$tmp/arch"
+    git -C "$tmp/arch" checkout -q --detach "$ARCH_PIN"
+    obs architecture_pin "\"$ARCH_PIN\""
+    AIEN_ARCHITECTURE_REPO="$tmp/arch" bash scripts/ci/portable.sh conformance
+    ;;
+  zero-disk-secrets)
+    # Not a hosted step in this repository; the same invariant the Rust repos enforce.
+    echo "Auditing repository for prohibited plaintext secret files..."
+    if find . -maxdepth 4 -name ".env*" -not -path "*/.git/*" -not -path "*/target/*" | grep -q .; then
+      echo "::error::Prohibited plaintext .env file found. Use an approved AIEN SecretProvider."
+      obs env_files_found true
+      exit 1
+    fi
+    obs env_files_found false
+    echo "Zero plaintext .env files verified."
+    ;;
+  *)
+    echo "run.sh: unknown step '$step'" >&2
+    exit 2
+    ;;
+esac
diff --git a/tests/gates/synapse-conformance.gate b/tests/gates/synapse-conformance.gate
new file mode 100644
index 0000000..2c8f16c
--- /dev/null
+++ b/tests/gates/synapse-conformance.gate
@@ -0,0 +1,27 @@
+# tests/gates/synapse-conformance.gate
+# Mirrors hosted: portable.yml matrix gate 'conformance' (bash scripts/ci/portable.sh conformance, Rust 1.98.1)
+# requires host: needs ../aien-architecture (the pinned commit is cloned from it locally, no network).
+# cache: never because the gate reads the sibling aien-architecture checkout.
+gate: SYNAPSE-CONFORMANCE
+manifest_version: 2
+owner: synapse
+requires:
+  - host
+inputs:
+  - .crumb
+  - Cargo.toml
+  - Cargo.lock
+  - crates/
+  - scripts/
+  - evidence/
+  - tests/gates/
+run:
+  exec: tests/gates/run.sh
+  args: ["conformance"]
+expects:
+  exit: 0
+  verdict: PASS
+timeout: 30m
+exactness: EXACT
+cache_scope: machine
+cache: never
diff --git a/tests/gates/synapse-workspace.gate b/tests/gates/synapse-workspace.gate
new file mode 100644
index 0000000..6e06585
--- /dev/null
+++ b/tests/gates/synapse-workspace.gate
@@ -0,0 +1,25 @@
+# tests/gates/synapse-workspace.gate
+# Mirrors hosted: portable.yml matrix gate 'workspace' (bash scripts/ci/portable.sh workspace, Rust 1.98.1)
+# .crumb is an input: crates/synapse-crumb/tests/repo_root.rs parses the root crumb.
+gate: SYNAPSE-WORKSPACE
+manifest_version: 2
+owner: synapse
+requires:
+  - host
+inputs:
+  - .crumb
+  - Cargo.toml
+  - Cargo.lock
+  - crates/
+  - scripts/
+  - evidence/
+  - tests/gates/
+run:
+  exec: tests/gates/run.sh
+  args: ["workspace"]
+expects:
+  exit: 0
+  verdict: PASS
+timeout: 30m
+exactness: EXACT
+cache_scope: machine
diff --git a/tests/gates/synapse-zero-disk-secrets.gate b/tests/gates/synapse-zero-disk-secrets.gate
new file mode 100644
index 0000000..0659f5c
--- /dev/null
+++ b/tests/gates/synapse-zero-disk-secrets.gate
@@ -0,0 +1,19 @@
+# tests/gates/synapse-zero-disk-secrets.gate
+# Mirrors hosted: no hosted step; the zero-disk-secrets invariant of the Rust repos (always-run)
+gate: SYNAPSE-ZERO-DISK-SECRETS
+manifest_version: 2
+owner: synapse
+requires:
+  - portable
+inputs:
+  - tests/gates/
+run:
+  exec: tests/gates/run.sh
+  args: ["zero-disk-secrets"]
+expects:
+  exit: 0
+  observe: ["env_files_found == false"]
+  verdict: PASS
+timeout: 2m
+exactness: EXACT
+cache_scope: portable