Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

refactor(privacy): move public-release gate engine to scripts/ci, keep skill local-only

Ruben Lütke0d138604ab1c
diff --git a/.claude/agents/docs-privacy-reviewer.md b/.claude/agents/docs-privacy-reviewer.md
index 72176936ed..1d040c77c2 100644
--- a/.claude/agents/docs-privacy-reviewer.md
+++ b/.claude/agents/docs-privacy-reviewer.md
@@ -8,13 +8,13 @@ domain: generic
phase: docs
must_read:
- AGENTS.md
- - .claude/skills/ship-public-release/references/pii-scrub.tsv
+ - scripts/ci/privacy_gate/references/pii-scrub.tsv
when_to_use: After a Write/Edit under docs/ — the deterministic hook flagged a hit, or a substantial new/changed doc needs a semantic privacy pass before it could ship publicly.
---
You are the documentation privacy reviewer for Personal Jarvis. The project ships from ONE public repo whose history is world-readable forever (see `CLAUDE.md` §2): one leaked key, real name, personal path, private email, or Windows SID in a single commit is permanent. Your job is to read a documentation file end-to-end and report everything personal or secret that must not ship. You write NO fixes — you find problems with `file:line` evidence; the main agent applies the masking.
-You are the *semantic* half of a two-layer defence. The *deterministic* half is `scripts/ci/docs_privacy_scan.py`, which reuses the canonical masking manifest `.claude/skills/ship-public-release/references/pii-scrub.tsv`. Always run it first, then read for what a regex cannot judge.
+You are the *semantic* half of a two-layer defence. The *deterministic* half is `scripts/ci/docs_privacy_scan.py`, which reuses the canonical masking manifest `scripts/ci/privacy_gate/references/pii-scrub.tsv`. Always run it first, then read for what a regex cannot judge.
## Procedure
diff --git a/.claude/skills/publish-new-version/SKILL.md b/.claude/skills/publish-new-version/SKILL.md
index f73e52285a..0ed1a8d566 100644
--- a/.claude/skills/publish-new-version/SKILL.md
+++ b/.claude/skills/publish-new-version/SKILL.md
@@ -17,8 +17,9 @@ One public repo, infrequent releases. This is the maintainer's **single entry
point** to put the CURRENT folder state — **all features, none of the personal
data** — onto the public GitHub repo as a clean, versioned update, and to **prove
it actually landed**. It does NOT reimplement the privacy machinery; it runs the
-quality checks the maintainer cares about, then drives the tested
-`ship-public-release` skill, then verifies.
+quality checks the maintainer cares about, then drives the local
+`security-github` skill (the depersonalized public-release privacy gate), then
+verifies.
## Context you must hold (the mental model)
@@ -50,7 +51,7 @@ Verify each, **with evidence**, before anything is shipped:
Report every item as **PASS** or **STOP** with the evidence. No silent skips.
### 2. Privacy gate + push (the engine — do NOT duplicate it here)
-**REQUIRED:** run the `ship-public-release` skill in **RELEASE** mode. It performs the
+**REQUIRED:** run the local `security-github` skill in **RELEASE** mode. It performs the
full fail-closed privacy gate (tracked-files-only export → distribution denylist →
deterministic PII scrub → **mandatory sub-agent privacy review** → secret/PII scan →
human review) plus the SemVer bump + git tag + CHANGELOG entry, from a separate clean
diff --git a/.githooks/pre-push b/.githooks/pre-push
index 582f8ddfdb..007ffdc1fa 100755
--- a/.githooks/pre-push
+++ b/.githooks/pre-push
@@ -1,8 +1,8 @@
#!/bin/sh
# >>> guard_no_raw_public_push (managed by scripts/ci/install_git_hooks.py) >>>
# Hard-block a raw push to the PUBLIC flagship repo PersonalJarvis/PersonalJarvis.
-# That repo only ever receives a depersonalized snapshot via the
-# ship-public-release skill (CLAUDE.md rule 2). git passes: pre-push <name> <url>.
+# That repo only ever receives a depersonalized snapshot via the public-release
+# privacy gate (CLAUDE.md rule 2). git passes: pre-push <name> <url>.
__pj_guard="scripts/ci/guard_no_raw_public_push.py"
if [ -f "$__pj_guard" ]; then
__pj_py="/c/Program Files/Python311/python.exe"
@@ -123,9 +123,9 @@ fi
# the maintainer's real name, private email/handle, personal Windows paths,
# machine/account ids. This is the docs-content half the privacy_pre_push gate
# above does NOT cover (it checks commit author emails + real secrets, not the
-# name/path text inside docs/). Same canonical manifest the ship-public-release
-# scrub uses (.claude/skills/ship-public-release/references/pii-scrub.tsv), so
-# the two never drift. Read-only scan over tracked docs/; exit 1 on any hit.
+# name/path text inside docs/). Same canonical manifest the public-release
+# scrub uses (scripts/ci/privacy_gate/references/pii-scrub.tsv), so the two
+# never drift. Read-only scan over tracked docs/; exit 1 on any hit.
docs_privacy_gate="scripts/ci/docs_privacy_scan.py"
if [ -f "$docs_privacy_gate" ]; then
"$PY" "$docs_privacy_gate" </dev/null
@@ -195,7 +195,7 @@ if [ "$status" -ne 0 ]; then
echo ""
if [ "$privacy_hit" -ne 0 ]; then
echo "pre-push BLOCKED: PRIVACY gate (public target / private email / secret)."
- echo " See the findings above. Public releases go via the ship-public-release skill."
+ echo " See the findings above. Public releases go via the depersonalized release snapshot."
fi
if [ "$language_hit" -ne 0 ]; then
echo "pre-push BLOCKED: LANGUAGE gate (newly added German text)."
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c1838e3e03..762499bd10 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -309,8 +309,8 @@ jobs:
# Docs privacy gate (layer-3 backstop for the .githooks/pre-push docs scan,
# which `--no-verify` can skip). Scans the tracked docs/ tree for the
# maintainer's real name, private email/handle, personal Windows paths, and
- # machine/account ids, using the SAME manifest the ship-public-release scrub
- # uses (.claude/skills/ship-public-release/references/pii-scrub.tsv) so the two
+ # machine/account ids, using the SAME manifest the public-release scrub
+ # uses (scripts/ci/privacy_gate/references/pii-scrub.tsv) so the two
# never drift. Unlike privacy-gate above, this DOES check the real name — but
# ONLY inside docs/, where (maintainer decision 2026-06-29) it must never
# appear, so it cannot false-positive on code where the name lives
diff --git a/.gitignore b/.gitignore
index d6c35aecb1..f503ce3ba9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -128,6 +128,11 @@ Desktop.ini
!.claude/agents/
!.claude/commands/
!.claude/skills/
+# ...except the security-github skill: a LOCAL-ONLY maintainer tool. It orchestrates
+# the depersonalized public-release push and must never itself be versioned or
+# pushed to any GitHub repo. Its deterministic engine lives (versioned) under
+# scripts/ci/privacy_gate/, so CI and the pre-push hook keep working without it.
+.claude/skills/security-github/
.playwright-mcp/
# TypeScript incremental build cache (regenerated on every `tsc --build`)
diff --git a/AGENTS.md b/AGENTS.md
index 9c85b5ddf7..8dde19c683 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -62,7 +62,7 @@ This governs what Jarvis **speaks/writes back to the user** (a multilingual prod
5. **Deterministic secret/PII scan** — a final regex sweep tuned to real credential shapes/lengths (catches an actual key, not every random hex string), fail-closed.
6. **Human review** — an explicit maintainer go-ahead before any byte crosses the network. No silent auto-publish.
-**Isolation (so the gate can't be bypassed by accident):** the push runs from a **separate clean clone**, never your live working tree — the working tree is never touched and the raw, un-scrubbed state physically cannot leak through. As a hard backstop, the pre-push guard (`scripts/ci/guard_no_raw_public_push.py` + `privacy_pre_push.py`, wired via `.githooks/pre-push`, `core.hooksPath=.githooks`) HARD-BLOCKS any attempt to `git push` raw working state straight to the public repo. Do not remove or weaken it — it has already caught a real leak (a Windows SID that reached public history was blocked, then purged with filter-repo). This whole gate is the `ship-public-release` skill.
+**Isolation (so the gate can't be bypassed by accident):** the push runs from a **separate clean clone**, never your live working tree — the working tree is never touched and the raw, un-scrubbed state physically cannot leak through. As a hard backstop, the pre-push guard (`scripts/ci/guard_no_raw_public_push.py` + `privacy_pre_push.py`, wired via `.githooks/pre-push`, `core.hooksPath=.githooks`) HARD-BLOCKS any attempt to `git push` raw working state straight to the public repo. Do not remove or weaken it — it has already caught a real leak (a Windows SID that reached public history was blocked, then purged with filter-repo). This whole gate is the depersonalized public-release process; its deterministic engine is versioned under `scripts/ci/privacy_gate/`.
**Two volumes, same gate:** *Discreet (DEFAULT)* — "push", "sichere den Stand", "update GitHub" → clean snapshot through the gate, **no version bump / tag / release / announcement**. *Release (explicit only)* — "Mach ein Release", "Publish release" → the same gate **plus** a SemVer bump + git tag + CHANGELOG entry. <!-- i18n-allow: quoted German maintainer trigger phrases --> When ambiguous, default to discreet.
diff --git a/CLAUDE.md b/CLAUDE.md
index 9c85b5ddf7..8dde19c683 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -62,7 +62,7 @@ This governs what Jarvis **speaks/writes back to the user** (a multilingual prod
5. **Deterministic secret/PII scan** — a final regex sweep tuned to real credential shapes/lengths (catches an actual key, not every random hex string), fail-closed.
6. **Human review** — an explicit maintainer go-ahead before any byte crosses the network. No silent auto-publish.
-**Isolation (so the gate can't be bypassed by accident):** the push runs from a **separate clean clone**, never your live working tree — the working tree is never touched and the raw, un-scrubbed state physically cannot leak through. As a hard backstop, the pre-push guard (`scripts/ci/guard_no_raw_public_push.py` + `privacy_pre_push.py`, wired via `.githooks/pre-push`, `core.hooksPath=.githooks`) HARD-BLOCKS any attempt to `git push` raw working state straight to the public repo. Do not remove or weaken it — it has already caught a real leak (a Windows SID that reached public history was blocked, then purged with filter-repo). This whole gate is the `ship-public-release` skill.
+**Isolation (so the gate can't be bypassed by accident):** the push runs from a **separate clean clone**, never your live working tree — the working tree is never touched and the raw, un-scrubbed state physically cannot leak through. As a hard backstop, the pre-push guard (`scripts/ci/guard_no_raw_public_push.py` + `privacy_pre_push.py`, wired via `.githooks/pre-push`, `core.hooksPath=.githooks`) HARD-BLOCKS any attempt to `git push` raw working state straight to the public repo. Do not remove or weaken it — it has already caught a real leak (a Windows SID that reached public history was blocked, then purged with filter-repo). This whole gate is the depersonalized public-release process; its deterministic engine is versioned under `scripts/ci/privacy_gate/`.
**Two volumes, same gate:** *Discreet (DEFAULT)* — "push", "sichere den Stand", "update GitHub" → clean snapshot through the gate, **no version bump / tag / release / announcement**. *Release (explicit only)* — "Mach ein Release", "Publish release" → the same gate **plus** a SemVer bump + git tag + CHANGELOG entry. <!-- i18n-allow: quoted German maintainer trigger phrases --> When ambiguous, default to discreet.
diff --git a/CLOUD.md b/CLOUD.md
index db330dbdcb..8dbe3dbd3f 100644
--- a/CLOUD.md
+++ b/CLOUD.md
@@ -13,15 +13,15 @@ This project lives in **two private GitHub repos under the `PersonalJarvis` org*
| Remote | URL | What it is | Who writes to it |
|---|---|---|---|
| **`origin`** | `github.com/PersonalJarvis/personal-jarvis` — lower-case repo name (the old `personal-jarvis/personal-jarvis` 301-redirects here) | **THE working repo.** All day-to-day development, commits, branches, and `main` live here. | Every dev session — this is where `git push origin` goes. |
-| `public` | `github.com/PersonalJarvis/PersonalJarvis` — PascalCase repo name | The **depersonalized public distribution repo** (still private until the public launch, ~end of June). A clean, secrets-/PII-scrubbed snapshot of the working tree. | **Only** the `ship-public-release` skill. |
+| `public` | `github.com/PersonalJarvis/PersonalJarvis` — PascalCase repo name | The **depersonalized public distribution repo** (still private until the public launch, ~end of June). A clean, secrets-/PII-scrubbed snapshot of the working tree. | **Only** the depersonalized public-release process (privacy gate under `scripts/ci/privacy_gate/`). |
**Binding rule for every agent (human or cloud-code):**
-1. **The maintainer's "push / commit / save to GitHub / sichere den Stand" goes to the PUBLIC flagship `PersonalJarvis/PersonalJarvis` via the `ship-public-release` skill** — a clean depersonalized snapshot through the full privacy gate (incl. the mandatory sub-agent review), NOT a raw `git push origin`. The lowercase `origin` (`personal-jarvis`) is kept ONLY as a silent local backup / dev safety net; automatic raw dev commits may land there as infrastructure, but that is never what the maintainer means by "push". Never ask "which repo" — the deliverable is always the public flagship. <!-- i18n-allow: quoted German maintainer trigger phrase -->
-2. **`PersonalJarvis/PersonalJarvis` (the `public` remote) is written EXCLUSIVELY by the `ship-public-release` skill** — never by a manual `git push`, never with raw working state, never with secrets/PII. Pushing day-to-day work there is a defect.
+1. **The maintainer's "push / commit / save to GitHub / sichere den Stand" goes to the PUBLIC flagship `PersonalJarvis/PersonalJarvis` via the depersonalized public-release process** — a clean depersonalized snapshot through the full privacy gate (incl. the mandatory sub-agent review), NOT a raw `git push origin`. The lowercase `origin` (`personal-jarvis`) is kept ONLY as a silent local backup / dev safety net; automatic raw dev commits may land there as infrastructure, but that is never what the maintainer means by "push". Never ask "which repo" — the deliverable is always the public flagship. <!-- i18n-allow: quoted German maintainer trigger phrase -->
+2. **`PersonalJarvis/PersonalJarvis` (the `public` remote) is written EXCLUSIVELY by the depersonalized public-release process** — never by a manual `git push`, never with raw working state, never with secrets/PII. Pushing day-to-day work there is a defect.
3. **Do NOT rename the local pip package name or the keyring service `personal-jarvis`** — those identifiers are independent of the GitHub org rename and changing them breaks credential lookup.
4. **Flagship framing (the maintainer's standing decision — 2026-06-09).** Treat `PersonalJarvis/PersonalJarvis` as **THE one repository that *is* "the project"** — the public-facing flagship, the OpenClaw / Peter-Steinberger model: a single clean public repo that never contains personal data. `PersonalJarvis/personal-jarvis` (origin) is **not a second project** to reason about — it is the private *backstage*: the working-tree history plus the maintainer's secrets / `jarvis.toml` / `.env` / `data/` / Vault live there and **never** leave it. Do **not** make the maintainer re-explain this or re-pick a target; do not resurrect "which of the two repos" as an open question.
-5. **Push "volume" — one public repo, two ceremonies (UPDATED 2026-06-19; supersedes the 2026-06-09/15 rules).** Everything reaches `PersonalJarvis/PersonalJarvis` through the `ship-public-release` skill's fail-closed privacy gate: tracked-files export → distribution denylist → deterministic PII scrub → **mandatory sub-agent privacy review** → deterministic secret/PII scan → human review. Raw working state NEVER goes there (the pre-push guard hard-blocks it; the skill pushes from a separate clean clone). Two ceremonies on the SAME gate: a **DISCREET** snapshot (DEFAULT — "push", "Push nach GitHub", "commit and push", "sichere den Stand"; a clean snapshot, **no version bump, no git tag, no GitHub Release, no announcement**) and an explicit **RELEASE** ("Neue Version shippen", "Mach ein Release", "veröffentliche eine neue Version"; the same gate **plus** a MAJOR/MINOR/PATCH bump + tag + CHANGELOG). When the volume is ambiguous, default to **discreet**. The skill NEVER flips repo visibility — that stays the maintainer's manual call. Full contract: `CLAUDE.md` § "THE GitHub repository". <!-- i18n-allow: quoted German maintainer trigger phrases -->
+5. **Push "volume" — one public repo, two ceremonies (UPDATED 2026-06-19; supersedes the 2026-06-09/15 rules).** Everything reaches `PersonalJarvis/PersonalJarvis` through the depersonalized public-release fail-closed privacy gate: tracked-files export → distribution denylist → deterministic PII scrub → **mandatory sub-agent privacy review** → deterministic secret/PII scan → human review. Raw working state NEVER goes there (the pre-push guard hard-blocks it; the skill pushes from a separate clean clone). Two ceremonies on the SAME gate: a **DISCREET** snapshot (DEFAULT — "push", "Push nach GitHub", "commit and push", "sichere den Stand"; a clean snapshot, **no version bump, no git tag, no GitHub Release, no announcement**) and an explicit **RELEASE** ("Neue Version shippen", "Mach ein Release", "veröffentliche eine neue Version"; the same gate **plus** a MAJOR/MINOR/PATCH bump + tag + CHANGELOG). When the volume is ambiguous, default to **discreet**. The release process NEVER flips repo visibility — that stays the maintainer's manual call. Full contract: `CLAUDE.md` § "THE GitHub repository". <!-- i18n-allow: quoted German maintainer trigger phrases -->
---
diff --git a/docs/handoffs/report-tutorial-review-answers.md b/docs/handoffs/report-tutorial-review-answers.md
index b1ca1fba47..5a6a825624 100644
--- a/docs/handoffs/report-tutorial-review-answers.md
+++ b/docs/handoffs/report-tutorial-review-answers.md
@@ -68,7 +68,7 @@ That tutorial-that-demos-a-report is the "Report" + "Tutorial" combination.
- Tracked: 115 files under `video/` (TSX, JSON, screenshots, VO audio, analysis
frames).
- Withheld from public ship: `video/**` is on the distribution denylist —
- `.claude/skills/ship-public-release/references/distribution-denylist.txt:134`
+ `scripts/ci/privacy_gate/references/distribution-denylist.txt:134`
(rationale lines 126–133).
- Additionally `.gitignore`d (never tracked at all): the rendered films
(`git check-ignore video/out/onboarding.mp4` → IGNORED) and the stray ShareX
@@ -104,7 +104,7 @@ rendered film = intentionally public (that is its whole purpose).
**Both.**
- Denylist: `video/**` —
- `.claude/skills/ship-public-release/references/distribution-denylist.txt:134`.
+ `scripts/ci/privacy_gate/references/distribution-denylist.txt:134`.
- `.gitignore`: rendered `video/out/*.mp4` and root-level `video/*.png`
screenshots are ignored (confirmed via `git check-ignore`).
diff --git a/docs/superpowers/specs/2026-06-21-jarvis-cli-design.md b/docs/superpowers/specs/2026-06-21-jarvis-cli-design.md
index 75bc8c89d6..01c3ca6169 100644
--- a/docs/superpowers/specs/2026-06-21-jarvis-cli-design.md
+++ b/docs/superpowers/specs/2026-06-21-jarvis-cli-design.md
@@ -355,7 +355,7 @@ guarantee.
### 9.3 Scaffolding skill (the ergonomics)
`.claude/skills/generate-cli-command/SKILL.md` — a project skill a coding agent
-runs at "definition of done", modeled on `ship-public-release`:
+runs at "definition of done", modeled on the public-release privacy gate:
1. Diff routes since `main` (`git diff main...HEAD` over `*_routes.py`).
2. For each new route, verify OpenAPI metadata (so the gate will pass).
diff --git a/scripts/ci/docs_privacy_scan.py b/scripts/ci/docs_privacy_scan.py
index d07e59f9cc..445939d347 100644
--- a/scripts/ci/docs_privacy_scan.py
+++ b/scripts/ci/docs_privacy_scan.py
@@ -3,7 +3,7 @@
This is the *fast, deterministic* half of the docs privacy defence (the slow,
semantic half is the ``docs-privacy-reviewer`` sub-agent). It reuses the single
-source of truth for masking — the ``ship-public-release`` skill's
+source of truth for masking — the public-release privacy gate's
``pii-scrub.tsv`` — so a hit here means exactly the same thing it means at ship
time: a personal identifier reached a file that is world-readable forever once
pushed.
@@ -40,7 +40,7 @@ import sys
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[2]
-MANIFEST = REPO_ROOT / ".claude" / "skills" / "ship-public-release" / "references" / "pii-scrub.tsv"
+MANIFEST = REPO_ROOT / "scripts" / "ci" / "privacy_gate" / "references" / "pii-scrub.tsv"
# Where a private maintainer email gets masked inside docs (the real addresses
# live only in the manifest + .mailmap; this script never spells one out).
diff --git a/scripts/ci/german-allowlist.txt b/scripts/ci/german-allowlist.txt
index bf640f8514..0fcd678204 100644
--- a/scripts/ci/german-allowlist.txt
+++ b/scripts/ci/german-allowlist.txt
@@ -78,10 +78,6 @@ docs/plans/ai-pointer/DESIGN.md
docs/superpowers/plans/2026-06-02-configurable-keybinds.md
docs/superpowers/specs/2026-06-02-configurable-keybinds-design.md
-# --- Skill that needs bilingual trigger phrases in its description so a
-# German-speaking user can invoke it (trigger-matching data, like i18n) ---
-.claude/skills/ship-public-release/SKILL.md
-
# Implementation plan for plugin<->skill pairing (2026-06-07): an internal
# reference doc that quotes illustrative German voice-input test utterances
# (intentional — they demonstrate the German speech path the tests exercise).
@@ -325,7 +321,7 @@ scripts/config-soll.json
# German maintainer trigger phrases in YAML folded-scalar frontmatter (bucket 3-analog)
.claude/skills/publish-new-version/SKILL.md
# glob pattern references the German-named config-soll.json (matching data)
-.claude/skills/ship-public-release/references/distribution-denylist.txt
+scripts/ci/privacy_gate/references/distribution-denylist.txt
# verbatim German brain-output leak quoted as forensic evidence in a code block (bucket 4)
docs/persona-audit-report.md
# German voice-output example inside a multi-line code span (bucket 1/4)
diff --git a/scripts/ci/guard_no_raw_public_push.py b/scripts/ci/guard_no_raw_public_push.py
index 9a9df1729a..c17389a4f6 100644
--- a/scripts/ci/guard_no_raw_public_push.py
+++ b/scripts/ci/guard_no_raw_public_push.py
@@ -3,7 +3,7 @@
Doctrine (CLAUDE.md "THE GitHub repository", CLOUD.md "Canonical repositories"):
the public **`PersonalJarvis/PersonalJarvis`** repo is written EXCLUSIVELY by the
-`ship-public-release` skill — a depersonalized, secrets-/PII-scrubbed snapshot.
+depersonalized public-release process — a secrets-/PII-scrubbed snapshot.
A plain `git push` of raw working state to it is a defect (it would leak the
maintainer's name, paths, `jarvis.toml`, `.env`, `data/`, Vault, …).
@@ -11,7 +11,7 @@ This guard makes rule 2 *enforced*, not just documented. It is invoked by the
`pre-push` hook with git's standard args (`<remote-name> <remote-url>`) and exits
non-zero — aborting the push — when the destination is the public flagship.
-Why this never blocks the legitimate release: `ship-public-release` pushes from a
+Why this never blocks the legitimate release: the release pushes from a
*separate, fresh clone* (its own `.git`), so this working-repo hook is not on that
push path at all. Normal `git push origin` to a non-flagship working repo is
allowed. Only a raw push from THIS working tree to `PersonalJarvis/PersonalJarvis`
@@ -78,7 +78,7 @@ def main(argv: list[str]) -> int:
sys.stderr.write(
"guard_no_raw_public_push: ALLOW_PUBLIC_RAW_PUSH=1 set - allowing a raw "
"push to PersonalJarvis/PersonalJarvis. This is almost never correct; "
- "the depersonalized release goes through the ship-public-release skill.\n"
+ "the depersonalized release goes through the public-release privacy gate.\n"
)
return 0
@@ -92,9 +92,9 @@ def main(argv: list[str]) -> int:
" That repo only ever receives a DEPERSONALIZED release snapshot —\n"
" never raw working state (it would leak name/paths/secrets/PII).\n"
"\n"
- " To publish the maintainer's work, use the skill instead:\n"
- " ship-public-release (builds a scrubbed snapshot, scans it,\n"
- " shows a diff, pushes only on approval)\n"
+ " To publish the maintainer's work, build the depersonalized snapshot\n"
+ " via the privacy gate under scripts/ci/privacy_gate (scrub + scan +\n"
+ " diff, pushed only on approval) instead of a raw push.\n"
"\n"
" Day-to-day dev pushes go to: git push origin (the private repo).\n"
" See CLAUDE.md \"THE GitHub repository\" + CLOUD.md \"Canonical repositories\".\n"
diff --git a/scripts/ci/install_git_hooks.py b/scripts/ci/install_git_hooks.py
index e21fa8fc1a..31f0ed4112 100644
--- a/scripts/ci/install_git_hooks.py
+++ b/scripts/ci/install_git_hooks.py
@@ -29,8 +29,8 @@ MARKER_END = "# <<< guard_no_raw_public_push <<<"
GUARD_BLOCK = f"""{MARKER_BEGIN}
# Hard-block a raw push to the PUBLIC flagship repo PersonalJarvis/PersonalJarvis.
-# That repo only ever receives a depersonalized snapshot via the
-# ship-public-release skill (CLAUDE.md rule 2). git passes: pre-push <name> <url>.
+# That repo only ever receives a depersonalized snapshot via the public-release
+# privacy gate (CLAUDE.md rule 2). git passes: pre-push <name> <url>.
__pj_guard="scripts/ci/guard_no_raw_public_push.py"
if [ -f "$__pj_guard" ]; then
__pj_py="/c/Program Files/Python311/python.exe"
diff --git a/scripts/ci/privacy_gate/references/dist-only-keep.txt b/scripts/ci/privacy_gate/references/dist-only-keep.txt
new file mode 100644
index 0000000000..db24f8102c
--- /dev/null
+++ b/scripts/ci/privacy_gate/references/dist-only-keep.txt
@@ -0,0 +1,12 @@
+# Files that exist in the distribution repo but NOT in the working tree, and
+# must be PRESERVED during reconcile (one gitignore-ish glob per line).
+#
+# The reconcile step makes the distribution tree match the staged tree by
+# deleting its tracked files and copying the staged ones in. Any file listed
+# here is skipped by that deletion so a deliberately dist-only file is not wiped
+# every release.
+#
+# AGENTS.md: public-facing contributor guide that lives only in the public repo
+# (the working tree uses CLAUDE.md instead). Verified as the only dist-only file
+# on 2026-05-31; re-checked each run by the skill's reconcile diff.
+AGENTS.md
diff --git a/scripts/ci/privacy_gate/references/distribution-denylist.txt b/scripts/ci/privacy_gate/references/distribution-denylist.txt
new file mode 100644
index 0000000000..4d942c87b8
--- /dev/null
+++ b/scripts/ci/privacy_gate/references/distribution-denylist.txt
@@ -0,0 +1,214 @@
+# Distribution denylist — paths that must NEVER ship to the public repo.
+#
+# This is a CURATED DENYLIST, not a working-vs-dist diff. New feature code is
+# never listed here, so it ships automatically; only personal / secret /
+# internal-process artifacts are withheld. Each line is a gitignore-ish glob
+# matched against the posix, repo-relative path of every git-TRACKED file.
+# Globs: `**` = any depth, `*` = within a path segment, `?` = one char.
+# Lines starting with `#` and blank lines are ignored.
+#
+# Decision record: the maintainer chose (2026-05-31) to keep withholding all
+# internal dev docs (OpenClaw-style clean public repo) and the encrypted
+# release-signing keys (forks generate their own). Confirmed in the skill plan.
+#
+# WHY a denylist and not the file diff: the working↔dist diff conflates two
+# different things — deliberately-withheld files AND files merely newer than the
+# last release. Baking the diff into "always exclude" would freeze out real
+# features (e.g. jarvis/state/*, jarvis/plugins/tts/fallback_tts.py). So those
+# are intentionally ABSENT from this list and ship normally.
+
+# --- .claude/ contributor toolchain: SHIP it (like OpenClaw), minus the
+# maintainer's own release skill (2026-06-27, revised) ----------------------
+# REVISED: .claude/ is Claude-Code CONTRIBUTOR tooling — subagent definitions,
+# slash-commands, dev skills — exactly what a fork needs to keep developing with
+# the same AI workflow. The reference project openclaw/openclaw (380k+ stars)
+# ships .agents/ + AGENTS.md + CLAUDE.md publicly; this is a professionalism
+# signal, not clutter. NOTHING in the runtime jarvis/ package loads it, so it is
+# product-safe. (The single personal path in phase6-adr-update/SKILL.md is
+# depersonalized by the PII scrub, not withheld.)
+#
+# The privacy gate itself is personal: scripts/ci/privacy_gate/references/
+# (pii-scrub.tsv, secret-allowlist.tsv) carry the maintainer's real name +
+# emails as scrub *patterns* — shipping them would leak exactly what they exist
+# to remove, and a fork generates its own. So withhold that whole subtree.
+scripts/ci/privacy_gate/**
+
+# --- .mailmap: full-depersonalization decision (2026-06-01) ------------------
+# The dist repo's history is already 100% noreply-authored (no real-email
+# commits exist there), so .mailmap maps nothing and is NOT load-bearing in the
+# distribution — it only ships the maintainer's two private emails + full name
+# as file data. Per the maintainer's "full depersonalization" choice for the
+# v0.1.0 release, drop it from the snapshot entirely (cleanest cut: removes both
+# real emails and the full name with zero scrub artifacts). reconcile deletes it
+# from the dist tree.
+.mailmap
+
+# --- Encrypted release-signing keys (maintainer identity) -------------------
+install/keys/*.key.enc
+
+# --- Wave-2 demo passphrase carriers (2026-06-17) ---------------------------
+# The encrypted key above is withheld, but the passphrase that decrypts it is
+# committed in plain text in install/TRUST_ROOT.md (§3.3) and in these two
+# ceremony docs (the `WAVE2_CEREMONY_PASSPHRASE=...` / `-pass "pass:..."`
+# lines). Withhold the passphrase too so a public release never ships either
+# half of the offline-ceremony key. (Private repo keeps both — Foundation-demo
+# posture, rotation deferred to the documented v0.5.0 cut.)
+install/TRUST_ROOT.md
+docs/supply-chain/wave2-key-ceremony.md
+docs/supply-chain/wave4-distribution.md
+
+# --- Internal scratch scripts (underscore-prefixed convention) --------------
+scripts/_*.py
+
+# --- Dead WhisperBar dev-probe scripts (2026-06-30) -------------------------
+# Standalone desktop-capture probes that still `import jarvis.ui.whisperbar`,
+# a module renamed to jarvis.ui.jarvisbar (whisperbar->jarvisbar rename,
+# 2026-06-30). The import is dead, so the scripts are broken dev-only probes
+# with no downstream value — and the release verify gate (top-level unresolved
+# import) correctly refuses to ship them. They are not product code; a fork has
+# no use for them.
+scripts/whisperbar_live_probe.py
+scripts/whisperbar_thinking_preview.py
+
+# --- Personal operational state + scratch (2026-06-19 privacy review) -------
+# config-soll.json is the maintainer's PRIVATE drift-guard desired-state pin # i18n-allow
+# (internal _reason changelog re: GCP/billing/model mandates) — a fork generates
+# its own. .tmp_research/ is scratch probing. Neither has downstream value.
+# drift-guard-task.xml is a generated Windows Task-Scheduler export carrying the
+# maintainer's Windows account SID (S-1-5-21-...-500) + local paths — a fork
+# regenerates it from the .ps1; it must never ship (2026-06-19 scan BLOCK).
+scripts/config-soll.json
+scripts/drift-guard-task.xml
+.tmp_research/**
+# Root-level optimization/loop ledgers — internal dev scratchpads (the running
+# notes of a /loop session: measurements, reasoning, file paths). Like the
+# untracked progress.md, they have no downstream product value. boot-progress.md
+# was committed (so it is tracked) and would otherwise ship; withhold it.
+boot-progress.md
+
+# --- Internal dev-process docs: whole subtrees ------------------------------
+docs/superpowers/**
+docs/plans/**
+docs/phase-b1-wiki-curator/**
+docs/diagnostics/**
+
+# --- Contributor doctrine now SHIPS (2026-06-27, revised) -------------------
+# CLAUDE.md + CLOUD.md are the binding contributor doctrine. AGENTS.md is the
+# byte-twin of CLAUDE.md and ALREADY ships, so withholding CLAUDE.md was
+# inconsistent — its content was public via AGENTS.md regardless. OpenClaw ships
+# CLAUDE.md + VISION.md publicly; matching that is the professional move. Both
+# are depersonalized by the PII scrub on the way out. (docs/BUGS.md stays
+# withheld below — that is the internal bug log, not contributor doctrine.)
+
+# --- BUGS.md now SHIPS (2026-06-27): the recurring-bug "journey" log is strong
+# --- contributor/reader material. VERIFIED — applying the PII scrub to it leaves
+# --- 0 personal paths (5 -> <USER_HOME>), 0 real name, 0 private mail; only
+# --- 127.0.0.1 (loopback) + hardware names (RTX / headset) remain, which are
+# --- non-identifying. The fail-closed scrub+scan re-checks on every ship. -----
+
+# --- Internal dev-process docs: individual files ----------------------------
+docs/adr/0009-self-healing-worker-critic.md
+docs/agents-self-verification.md
+docs/deepgram-stt-research-2026-05-20.md
+docs/openclaw-bridge.md
+docs/openclaw-spawn-failure-analysis-2026-05-18.md
+docs/persona-audit-report.md
+docs/persona-refactor-results.md
+docs/persona-research.md
+docs/phase1c-test-results.md
+docs/phase2-integration-test-results.md
+docs/phase6-handoff-2026-04-26.md
+docs/phase6-test-report.md
+docs/spike-results-openclaw.md
+docs/voice-acceptance-brief.md
+docs/bug-019-spawn-failure-report.html
+docs/jarvis-board/PHASE_A_DONE.md
+
+# --- The whole video/ Remotion build project (2026-06-27) -------------------
+# video/ is the Remotion source project used to RENDER the YouTube onboarding
+# film; it is a generator tool, not a runtime asset. The frontend embeds the
+# finished film straight from youtube-nocookie.com (IntroVideoScreen.tsx) and
+# loads nothing from this dir; .dockerignore already excludes video/. This
+# subsumes the earlier video/analysis/** entry: those frames are review/debug
+# artifacts that can carry personalized demo text in pixels (caught by semantic
+# image scanners, not file-text scanners), so the whole tree stays out.
+video/**
+
+# --- Standalone side-projects: ship in their OWN repos, not the flagship (2026-06-27) ---
+# Self-contained projects that merely co-live in this monorepo. The runtime
+# jarvis/ package imports NOTHING from them (verified 2026-06-27 — 0 import
+# sites). Patterns are ^-anchored, so each hits ONLY the top-level dir, never a
+# same-named subdir (e.g. src/** does not touch jarvis/ui/web/frontend/src/).
+# - skillbook/ : independent decentralized agent-memory research project
+# (own CLAUDE.md / ADRs / tests; unrelated to the product)
+# - keyproxy/ : standalone LLM-key reverse proxy ("zero dependency on jarvis")
+# - src/ : orphaned duplicate of the web-search skill; the LIVE tool is
+# jarvis/plugins/tool/search_web.py (no sys.path/loader points here)
+# DELIBERATELY KEPT (verified load-bearing, do NOT add): board-backend/
+# (jarvis/board/sync.py + federation_proxy_routes.py import board_backend.crypto),
+# OS-Level/ (jarvis/overlay/schema.py re-exports OS-Level/src/overlay), ui/
+# (the Orb overlay is imported at runtime), conductor/ (3 import sites).
+skillbook/**
+keyproxy/**
+src/**
+
+# --- Internal maintainer demo / perf scripts (2026-06-27) -------------------
+# tools/ holds board_demo.py / board_pentest.py / board_perf.py — internal
+# bring-up & perf probes for the Board, not product code. A fork has no use for
+# them (the product's own tooling lives inside the jarvis/ package).
+tools/**
+
+# --- Internal QA protocols (2026-06-27) -------------------------------------
+# docs/qa/ is the maintainer's internal voice-QA checklist — same internal-
+# process class as docs/superpowers/** / docs/plans/** already withheld above.
+docs/qa/**
+
+# --- Internal privacy/red-team agent spec (2026-06-30) ----------------------
+# docs-privacy-reviewer.md is the maintainer's OWN depersonalization red-team
+# guide: in source it enumerates the real maintainer identity (real name in
+# every spelling incl. the accented 'Rubén', alt name 'Harald Herz', the private
+# email shapes, GitHub login) and the entire scrub scheme. Shipping the doc that
+# lists what to hide is itself the leak (2026-06-30 sub-agent review). It is an
+# internal dev tool with no downstream value; a fork writes its own.
+.claude/agents/docs-privacy-reviewer.md
+
+# --- Internal handoff notes carrying the maintainer's private email (2026-06-30) ---
+# docs/handoffs/ holds internal review-answer handoffs. report-tutorial-review-
+# answers.md is a meta-note ABOUT the depersonalization scheme: it quotes the
+# maintainer's private email in plain text (lines 30/142/242) as a pattern to
+# protect — same self-leak class as docs-privacy-reviewer.md and the pii-scrub
+# map already withheld above. The email is a block-only scrub rule, so leaving
+# the file in would fail-close the ship anyway; withhold the whole subtree so a
+# valid snapshot never depends on a last-minute abort. Internal process doc with
+# no downstream value; a fork writes its own.
+docs/handoffs/**
+
+# --- Voice-session transcripts (2026-06-30) ---------------------------------
+# voice-session-*.{md,txt} are raw transcripts of the maintainer talking to
+# Jarvis (e.g. "was-geht-ab…") — personal speech content with no downstream
+# value, occasionally git-tracked by accident (an auto-save / `git add -A` in a
+# parallel session). Withhold every voice-session transcript, at any depth, so a
+# stray one never reaches public history.
+voice-session-*
+**/voice-session-*
+
+# --- Internal pick-up / handoff prompt notes (2026-06-30) -------------------
+# reporttutorialpickupprompt*.md is a loose top-level "pick-up" prompt: an
+# internal instruction to a Claude session to run the §2 privacy review. It
+# names the maintainer real name ("Ruben", "Lütke / Luetke") and enumerates the # i18n-allow
+# private categories to hunt for — the same self-leak class as
+# docs-privacy-reviewer.md and docs/handoffs/** already withheld above (shipping
+# the doc that lists what to hide IS the leak). Internal process artifact, zero
+# downstream value, occasionally git-tracked by accident. Withhold any such loose
+# pick-up/handoff prompt at the repo root.
+reporttutorialpickupprompt*
+**/reporttutorialpickupprompt*
+*pickupprompt*.md
+
+# --- Launch-marketing drafts (2026-07-02) ------------------------------------
+# marketing/launch/* holds the maintainer's pre-launch drafts (Show-HN post,
+# Reddit/X threads, hero one-liners, a manual GitHub-setup checklist). Internal
+# process artifacts: publishing the launch plan before the launch IS the leak,
+# and none of it is product content a downstream user needs. A fork writes its
+# own marketing. Withhold the whole subtree.
+marketing/**
diff --git a/scripts/ci/privacy_gate/references/pii-scrub.tsv b/scripts/ci/privacy_gate/references/pii-scrub.tsv
new file mode 100644
index 0000000000..8f50685b19
--- /dev/null
+++ b/scripts/ci/privacy_gate/references/pii-scrub.tsv
@@ -0,0 +1,83 @@
+# PII scrub manifest. Tab-separated: action <TAB> pattern <TAB> replacement <TAB> note
+#
+# action = scrub -> applied as a regex substitution during `build`
+# block-only -> never substituted, but BLOCKS the ship if found in a
+# non-exempt file during `scan` (defence in depth)
+# warn -> surfaced in the review, never blocks (FP-prone)
+#
+# `pattern` is a Python regex (it is fed straight to re.compile). All rows are
+# re-checked during `scan`: scrub+block-only must be 0 in non-exempt files, else
+# the ship is blocked (a scrub gap is treated as a leak, fail-closed). Matches
+# inside scrub-exempt paths (.mailmap) are downgraded to warnings.
+#
+# Footprint verified 2026-05-31 against the live working tree: personal Windows
+# paths = 0 hits (already cleaned in place); private emails = .mailmap only
+# (intentional, exempt); real name = ~7 shipping files; GCP id = 0 (kept as a
+# regression guard). The scan double-checks regardless.
+
+# --- maintainer GitHub login + entity slug (MUST precede the bare-name rules
+# --- below, else the bare "ruben" rule would fragment them) -----------------
+scrub rubenluetke10-beep octocat maintainer github login (appears in a stream-evidence test fixture)
+scrub ruben-luetke personal-jarvis-maintainer maintainer entity slug (= slugify of full name; keeps name->slug test couplings consistent)
+
+# --- maintainer real name (order matters: full name before surname) ---------
+scrub Ruben Lütke Personal Jarvis Maintainer maintainer real name (full)
+scrub Lütke Maintainer maintainer surname
+scrub Luetke Maintainer maintainer surname (ascii-fold)
+
+scrub luetke maintainer maintainer surname (lowercase residue in slugs)
+scrub lütke maintainer maintainer surname (lowercase umlaut residue)
+
+# --- maintainer bare first names: full-depersonalization (2026-06-01). Two
+# --- distinct neutral names preserve router-prompt semantics where "Ruben" is
+# --- the user (address) and "Harald" is an example third person mentioned. ---
+scrub Ruben Alex maintainer first name (sample/address user) -> neutral
+scrub ruben alex maintainer first name lowercase (config defaults, slugs, branch tags)
+# Accented spelling 'Rubén' — the ASCII 'Ruben' rules above do NOT match the é,
+# so the accented real first name shipped through (2026-06-30 sub-agent review:
+# docs/phase-b1-wiki-curator/*, tests/unit/memory/wiki/test_page.py, etc.).
+scrub Rubén Alex maintainer first name accented (é) -> neutral
+scrub rubén alex maintainer first name accented lowercase
+scrub RUBÉN ALEX maintainer first name accented all-caps (regression guard)
+scrub Harald Sam maintainer alt first name (example person in prompts/tests)
+scrub harald sam maintainer alt first name lowercase (ADR owner field, slugs, test emails)
+
+# --- all-caps identifier residue: the case-sensitive scrub above misses
+# --- SCREAMING_CASE used in JS test constants (e.g. HARALD_PAGE) and slug-fn
+# --- test inputs (e.g. person_slug("RUBEN")). Preserve the all-caps style in
+# --- the replacement so the depersonalized test stays internally consistent. -
+scrub HARALD SAM maintainer alt first name all-caps (JS test constants, e.g. HARALD_PAGE)
+scrub RUBEN ALEX maintainer first name all-caps (slug-fn test input, e.g. person_slug("RUBEN"))
+scrub LÜTKE MAINTAINER maintainer surname all-caps (regression guard; 0 current hits)
+scrub LUETKE MAINTAINER maintainer surname all-caps ascii-fold (regression guard)
+
+# --- personal paths ---------------------------------------------------------
+# `.` matches the path separator on any OS, so no backslash escaping is needed.
+# The `[\\/]+` rule below additionally catches ESCAPED / double-separator forms
+# (e.g. "C:\\Users\\Administrator" in source string literals & docstrings) that
+# the single-`.` pattern misses; it is a strict superset and runs as defence.
+scrub C:.Users.Administrator <USER_HOME> windows personal home path
+scrub C:[\\/]+Users[\\/]+Administrator <USER_HOME> windows personal home path (escaped/double-separator variant in source literals & docstrings)
+scrub C--Users-Administrator-Desktop-Personal-Jarvis <your-claude-project-dir> personal .claude memory dir
+
+# --- cloud project identifier (regression guard; 0 current hits) ------------
+scrub gen-lang-client-0108934957 <GCP_PROJECT_ID> personal GCP project id
+
+# --- windows account SID (2026-06-19 privacy review) ------------------------
+# The maintainer's machine/account SID leaked via scripts/drift-guard-task.xml
+# (the -500 RID = builtin Administrator). Mask the unique machine-identifier
+# prefix; any RID suffix is preserved so the XML stays SID-shaped as a template.
+scrub S-1-5-21-420352953-976713421-1014275510 S-1-5-21-0-0-0 windows account SID machine identifier (maintainer box)
+
+# --- private emails: never auto-edited (would break the .mailmap mechanism), --
+# --- but BLOCK if they appear in any non-exempt shipping file ----------------
+block-only harald\.herz@gmx\.de private email (must only live in .mailmap)
+block-only ruben\.luetke10@gmail\.com private email (must only live in .mailmap)
+
+# --- any other consumer-mailbox address: surface for a human look -----------
+warn [A-Za-z0-9._%+-]+@(?:gmail|gmx|outlook|hotmail|yahoo|protonmail|proton|web)\.[a-z.]+ consumer email address
+# "Herz" scrub REMOVED 2026-06-27 by maintainer decision: @Ruben_Herz is the
+# INTENTIONAL public build-in-public X handle (README social link + socials seed +
+# tests), kept public on purpose. Do NOT re-add a Herz scrub — it would anonymize
+# the maintainer's own chosen public project identity. (The real surname "Lütke"
+# stays scrubbed above; "Herz" is the deliberately-public brand handle.)
diff --git a/scripts/ci/privacy_gate/references/scrub-exempt.txt b/scripts/ci/privacy_gate/references/scrub-exempt.txt
new file mode 100644
index 0000000000..8512f09d2f
--- /dev/null
+++ b/scripts/ci/privacy_gate/references/scrub-exempt.txt
@@ -0,0 +1,23 @@
+# Paths exempt from the PII scrub (one gitignore-ish glob per line).
+#
+# .mailmap MUST contain the maintainer's real emails as the left-hand mapping
+# keys — that is how git rewrites them to the GitHub noreply form in the web UI
+# and API (spam-scraping defence). The file documents this trade-off in its own
+# header, and the public repo already ships it by deliberate decision. Scrubbing
+# it would BREAK the protection it provides, so it is exempt from substitution.
+# During `scan` its email/name matches are downgraded to warnings (surfaced in
+# the review) instead of blocking the ship.
+.mailmap
+
+# Maintainer's intentional authorship attribution (explicit decision 2026-06-26):
+# the personal X/Twitter profile @Ruben_Herz is kept REAL in the public socials
+# seed, the README socials line, and the seed's test — an open-source author
+# credit, not an accidental leak. These three files were verified to carry NO
+# other personal data, so exempting them keeps ONLY the handle and leaks nothing
+# else. During `scan` the handle/name matches here downgrade to warnings (shown
+# in the review) instead of blocking. Trade-off: any FUTURE personal data added
+# to README would warn rather than block — the sub-agent + human review remain
+# the backstop. Re-evaluate at the public-visibility flip.
+jarvis/ui/web/socials_routes.py
+tests/unit/ui/test_socials_routes.py
+README.md
diff --git a/scripts/ci/privacy_gate/references/secret-allowlist.tsv b/scripts/ci/privacy_gate/references/secret-allowlist.tsv
new file mode 100644
index 0000000000..760ee598f0
--- /dev/null
+++ b/scripts/ci/privacy_gate/references/secret-allowlist.tsv
@@ -0,0 +1,17 @@
+# Secret-scan allowlist. Tab-separated: value <TAB> path <TAB> reason
+#
+# A finding is suppressed ONLY when BOTH the exact literal value AND the exact
+# repo-relative path match a row here. Never path-only (would blind the scan to a
+# real key added to that file later); never value-only; never a substring rule.
+#
+# Note: the blocking secret patterns in strip_and_scan.py use REAL credential
+# lengths, so most of this repo's intentional test fakes (deliberately short /
+# hyphenated, e.g. "sk-leakable-XYZ-789", "test-key-xxx", "TESTTOKEN") do not
+# match at all and need no entry. List here only fakes that happen to match a
+# blocking shape, so the gate stays quiet on a clean release.
+
+AIzaSyB1234567890abcdefXYZ tests/unit/plugins/tool/test_app_control_tools.py intentional fake Google API key (26 chars, documented inline)
+sk-ant-oat01-deadbeef-cafe-1234567890 tests/missions/test_env.py intentional fake Anthropic OAuth token (deadbeef/cafe fixture)
+sk-ant-api03-classicclassic1234567890 tests/missions/test_env.py intentional fake Anthropic API key fixture
+-----BEGIN RSA PRIVATE KEY----- tests/unit/memory/wiki/test_secret_guard.py intentional fake: bare PEM header line (no key body), parametrized fixture proving the wiki secret-guard detects PEM blocks
+-----BEGIN RSA PRIVATE KEY----- scripts/ci/privacy_gate/references/secret-allowlist.tsv this allowlist's own PEM-header row above — the file documenting the fixture must not trip the scanner itself
diff --git a/scripts/ci/privacy_gate/scripts/strip_and_scan.py b/scripts/ci/privacy_gate/scripts/strip_and_scan.py
new file mode 100644
index 0000000000..474d656ebf
--- /dev/null
+++ b/scripts/ci/privacy_gate/scripts/strip_and_scan.py
@@ -0,0 +1,744 @@
+#!/usr/bin/env python3
+"""Deterministic privacy gate for the depersonalized public-release snapshot.
+
+This script is the *deterministic core* of the public-release workflow —
+everything that decides *what leaves the machine* lives here so it is
+reproducible and not subject to LLM improvisation. The human-facing parts
+(choosing the version bump, showing the review, committing, tagging, pushing)
+are driven separately by the maintainer.
+
+Three subcommands:
+
+ build Export the working tree's git-tracked files into a clean staging dir:
+ apply the distribution denylist, run the deterministic PII scrub,
+ write a build report. (Layers A+B+C of the gate.)
+
+ scan Run the blocking secret/PII scan over a tree (the staging tree, and
+ again over the reconciled distribution tree before commit). Exits
+ non-zero if any BLOCKING finding survives the allowlist. (Layer D.)
+
+ set-version Set the version string in pyproject.toml + jarvis/__init__.py
+ inside a staged tree and assert the two agree.
+
+Design rules:
+ * stdlib only (cloud-first: must run on a bare python:3.11-slim container).
+ * fail-closed: anything uncertain is reported and, for `scan`, blocks.
+ * the LLM may only ADD findings on top of this, never clear what this blocks.
+
+Reports are JSON so the human review can summarise them.
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import re
+import subprocess
+import sys
+from pathlib import Path
+
+# ----------------------------------------------------------------------------
+# Block-tier secret patterns (security logic — intentionally hardcoded, not in
+# a data file, so they cannot be silently weakened by editing a reference file).
+#
+# Lengths are tuned to REAL credential shapes. Intentional test fixtures in this
+# repo (e.g. "sk-leakable-XYZ-789", "AIzaSyB1234567890abcdefXYZ", "test-key-xxx")
+# are deliberately shorter/hyphenated and do NOT match these — so they don't
+# train the user to ignore the gate. A genuinely leaked key is always full length
+# and WILL match.
+# ----------------------------------------------------------------------------
+SECRET_PATTERNS: dict[str, str] = {
+ "openai_legacy": r"\bsk-[A-Za-z0-9]{48}\b",
+ "openai_project": r"\bsk-proj-[A-Za-z0-9_-]{40,}\b",
+ "anthropic": r"\bsk-ant-[A-Za-z0-9_-]{60,}\b",
+ "google_api_key": r"\bAIza[0-9A-Za-z_-]{35}\b",
+ "github_token": r"\bgh[pousr]_[A-Za-z0-9]{36}\b",
+ "aws_access_key": r"\bAKIA[0-9A-Z]{16}\b",
+ "slack_token": r"\bxox[baprs]-[0-9A-Za-z-]{10,}\b",
+ "groq_key": r"\bgsk_[A-Za-z0-9]{40,}\b",
+ "google_oauth_secret": r"\bGOCSPX-[A-Za-z0-9_-]{20,}\b",
+ "private_key_block": r"-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY-----",
+}
+
+# Filenames that must never appear in a shipping tree even if some path slips the
+# .gitignore / denylist (defence in depth). Matched on the basename.
+FORBIDDEN_BASENAMES = (
+ ".env",
+ "jarvis.toml",
+ "mcp.json",
+)
+FORBIDDEN_SUFFIXES = (".pem", ".key", ".sqlite", ".sqlite3", ".db")
+
+# How many bytes to sniff for a NUL byte when deciding text vs binary.
+_SNIFF = 8192
+
+# Text types the English-only artifact gate inspects (mirrors
+# scripts/ci/check_no_new_german.py SCAN_EXT). Data blobs / binaries are skipped.
+_GERMAN_EXT = frozenset(
+ {
+ ".py", ".md", ".txt", ".rst", ".ts", ".tsx", ".js", ".jsx",
+ ".json", ".toml", ".yaml", ".yml", ".html", ".css", ".cfg", ".ini",
+ }
+)
+
+
+# ----------------------------------------------------------------------------
+# Small helpers
+# ----------------------------------------------------------------------------
+def _eprint(*a: object) -> None:
+ print(*a, file=sys.stderr)
+
+
+def _git_tracked(repo: Path) -> list[str]:
+ """Return tracked paths (posix, repo-relative), sorted, via `git ls-files`."""
+ out = subprocess.run(
+ ["git", "-C", str(repo), "ls-files", "-z"],
+ check=True,
+ capture_output=True,
+ ).stdout
+ paths = [p for p in out.decode("utf-8", "surrogateescape").split("\0") if p]
+ return sorted(paths)
+
+
+def _compile_glob(pattern: str) -> re.Pattern[str]:
+ """Translate a gitignore-ish glob into an anchored regex over posix relpaths.
+
+ Supports `**` (any depth, incl. zero dirs), `*` (within a segment), `?`.
+ A trailing `/**` matches the directory's whole subtree.
+ """
+ pattern = pattern.strip().replace("\\", "/")
+ out: list[str] = ["^"]
+ i = 0
+ while i < len(pattern):
+ c = pattern[i]
+ if pattern.startswith("**/", i):
+ out.append("(?:.*/)?")
+ i += 3
+ elif pattern.startswith("**", i):
+ out.append(".*")
+ i += 2
+ elif c == "*":
+ out.append("[^/]*")
+ i += 1
+ elif c == "?":
+ out.append("[^/]")
+ i += 1
+ else:
+ out.append(re.escape(c))
+ i += 1
+ out.append("$")
+ return re.compile("".join(out))
+
+
+def _matches_any(relpath: str, regexes: list[re.Pattern[str]]) -> bool:
+ return any(rx.match(relpath) for rx in regexes)
+
+
+def _read_lines(path: Path) -> list[str]:
+ if not path.exists():
+ return []
+ return [
+ ln.rstrip("\n")
+ for ln in path.read_text("utf-8").splitlines()
+ if ln.strip() and not ln.lstrip().startswith("#")
+ ]
+
+
+def _load_denylist(skill_dir: Path) -> list[re.Pattern[str]]:
+ raw = _read_lines(skill_dir / "references" / "distribution-denylist.txt")
+ return [_compile_glob(p) for p in raw]
+
+
+def _load_scrub(skill_dir: Path) -> list[dict]:
+ """Load pii-scrub.tsv → list of {action, pattern, replacement, note}.
+
+ Columns (tab-separated): action <TAB> pattern <TAB> replacement <TAB> note
+ action ∈ {scrub, block-only, warn}. `scrub` rows are substituted during
+ build; all rows are residual checks during scan.
+ """
+ rows: list[dict] = []
+ for ln in _read_lines(skill_dir / "references" / "pii-scrub.tsv"):
+ parts = ln.split("\t")
+ if len(parts) < 2:
+ continue
+ action = parts[0].strip()
+ pattern = parts[1]
+ replacement = parts[2] if len(parts) > 2 else ""
+ note = parts[3] if len(parts) > 3 else ""
+ rows.append(
+ {
+ "action": action,
+ "pattern": pattern,
+ "replacement": replacement,
+ "note": note,
+ "rx": re.compile(pattern),
+ }
+ )
+ return rows
+
+
+def _load_allowlist(skill_dir: Path) -> set[tuple[str, str]]:
+ """Load secret-allowlist.tsv → set of (exact_value, exact_relpath)."""
+ allow: set[tuple[str, str]] = set()
+ for ln in _read_lines(skill_dir / "references" / "secret-allowlist.tsv"):
+ parts = ln.split("\t")
+ if len(parts) >= 2:
+ allow.add((parts[0], parts[1].replace("\\", "/")))
+ return allow
+
+
+def _load_scrub_exempt(skill_dir: Path) -> list[re.Pattern[str]]:
+ raw = _read_lines(skill_dir / "references" / "scrub-exempt.txt")
+ return [_compile_glob(p) for p in raw]
+
+
+def _load_keep(skill_dir: Path) -> list[re.Pattern[str]]:
+ raw = _read_lines(skill_dir / "references" / "dist-only-keep.txt")
+ return [_compile_glob(p) for p in raw]
+
+
+def _is_text(data: bytes) -> bool:
+ return b"\x00" not in data[:_SNIFF]
+
+
+def _decode(data: bytes) -> tuple[str, str]:
+ """Return (text, marker) so we can write back faithfully.
+
+ marker ∈ {"", "bom", "latin1"}. latin-1 is a lossless byte<->char bijection,
+ so a file that is not valid UTF-8 still round-trips (decode+encode latin-1)
+ and we never crash on an odd encoding (real distribution clones have them).
+ """
+ if data.startswith(b"\xef\xbb\xbf"):
+ try:
+ return data[3:].decode("utf-8"), "bom"
+ except UnicodeDecodeError:
+ return data.decode("latin-1"), "latin1"
+ try:
+ return data.decode("utf-8"), ""
+ except UnicodeDecodeError:
+ return data.decode("latin-1"), "latin1"
+
+
+def _encode(text: str, marker: str) -> bytes:
+ if marker == "latin1":
+ return text.encode("latin-1")
+ out = text.encode("utf-8")
+ return b"\xef\xbb\xbf" + out if marker == "bom" else out
+
+
+def _iter_text_files(tree: Path):
+ for p in sorted(tree.rglob("*")):
+ if ".git" in p.parts: # never scan/scrub git internals
+ continue
+ if not p.is_file():
+ continue
+ try:
+ data = p.read_bytes()
+ except OSError:
+ continue
+ if _is_text(data):
+ yield p, data
+
+
+# ----------------------------------------------------------------------------
+# build
+# ----------------------------------------------------------------------------
+def cmd_build(args: argparse.Namespace) -> int:
+ working = Path(args.working).resolve()
+ staging = Path(args.staging).resolve()
+ skill_dir = Path(args.skill_dir).resolve()
+
+ if staging.exists() and any(staging.iterdir()):
+ _eprint(f"ERROR: staging dir {staging} is not empty; refusing to build.")
+ return 1
+ staging.mkdir(parents=True, exist_ok=True)
+
+ denylist = _load_denylist(skill_dir)
+ scrub_rows = _load_scrub(skill_dir)
+ scrub_exempt = _load_scrub_exempt(skill_dir)
+
+ tracked = _git_tracked(working)
+ denied: list[str] = []
+ missing: list[str] = []
+ staged = 0
+
+ for rel in tracked:
+ if _matches_any(rel, denylist):
+ denied.append(rel)
+ continue
+ src = working / rel
+ if not src.exists():
+ missing.append(rel)
+ continue
+ dst = staging / rel
+ dst.parent.mkdir(parents=True, exist_ok=True)
+ dst.write_bytes(src.read_bytes())
+ staged += 1
+
+ # --- deterministic PII scrub over staged text files ----------------------
+ scrubbed: dict[str, int] = {}
+ exempted: list[str] = []
+ scrub_only = [r for r in scrub_rows if r["action"] == "scrub"]
+ for path, data in _iter_text_files(staging):
+ rel = path.relative_to(staging).as_posix()
+ if _matches_any(rel, scrub_exempt):
+ exempted.append(rel)
+ continue
+ text, marker = _decode(data)
+ total = 0
+ for row in scrub_only:
+ text, n = row["rx"].subn(row["replacement"], text)
+ total += n
+ if total:
+ path.write_bytes(_encode(text, marker))
+ scrubbed[rel] = total
+
+ report = {
+ "working": str(working),
+ "staging": str(staging),
+ "tracked_total": len(tracked),
+ "staged": staged,
+ "denylisted_count": len(denied),
+ "denylisted": denied,
+ "missing_on_disk": missing,
+ "scrub_exempt": sorted(set(exempted)),
+ "scrubbed_files": scrubbed,
+ "scrub_total_substitutions": sum(scrubbed.values()),
+ }
+ _write_report(args.report, report)
+ print(
+ f"build: staged {staged} files, withheld {len(denied)} (denylist), "
+ f"scrubbed {len(scrubbed)} files "
+ f"({report['scrub_total_substitutions']} substitutions), "
+ f"exempt {len(report['scrub_exempt'])}."
+ )
+ if missing:
+ _eprint(f"WARNING: {len(missing)} tracked files missing on disk (skipped).")
+ return 0
+
+
+# ----------------------------------------------------------------------------
+# English-only artifact gate (loaded from the SHIPPED tree, so detector +
+# allowlist can never drift from what actually ships)
+# ----------------------------------------------------------------------------
+def _load_german_gate(tree: Path):
+ """Return (looks_german_fn | None, allowlist_patterns).
+
+ Loads the shipped detector + allowlist from the tree itself. Fail-OPEN
+ (None) if the detector is absent, so a privacy scan never crashes on a tree
+ that predates the gate — an actual German finding still blocks below.
+ """
+ import importlib.util
+
+ detect = tree / "scripts" / "ci" / "_german_detect.py"
+ allow = tree / "scripts" / "ci" / "german-allowlist.txt"
+ if not detect.exists():
+ return None, []
+ # Never let importing the detector drop a __pycache__/*.pyc into the tree we
+ # are about to ship (that .pyc would be copied into the release otherwise).
+ prev = sys.dont_write_bytecode
+ sys.dont_write_bytecode = True
+ try:
+ spec = importlib.util.spec_from_file_location("_german_detect_ship", detect)
+ mod = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(mod) # type: ignore[union-attr]
+ fn = mod.looks_german
+ except Exception:
+ return None, []
+ finally:
+ sys.dont_write_bytecode = prev
+ return fn, (_read_lines(allow) if allow.exists() else [])
+
+
+def _german_allowlisted(relpath: str, patterns: list[str]) -> bool:
+ import fnmatch
+
+ norm = relpath.replace("\\", "/")
+ for pat in patterns:
+ if fnmatch.fnmatch(norm, pat):
+ return True
+ if pat.endswith("/*") and (norm == pat[:-2] or norm.startswith(pat[:-1])):
+ return True
+ return False
+
+
+# ----------------------------------------------------------------------------
+# scan (fail-closed) — secrets + PII + English-only artifacts
+# ----------------------------------------------------------------------------
+def cmd_scan(args: argparse.Namespace) -> int:
+ tree = Path(args.tree).resolve()
+ skill_dir = Path(args.skill_dir).resolve()
+
+ allow = _load_allowlist(skill_dir)
+ scrub_rows = _load_scrub(skill_dir)
+ scrub_exempt = _load_scrub_exempt(skill_dir)
+ secret_rx = {name: re.compile(p) for name, p in SECRET_PATTERNS.items()}
+ german_check, german_patterns = _load_german_gate(tree)
+
+ blocking: list[dict] = []
+ warnings: list[dict] = []
+ suppressed: list[dict] = []
+
+ # forbidden filenames anywhere in the tree
+ for p in sorted(tree.rglob("*")):
+ if ".git" in p.parts:
+ continue
+ if not p.is_file():
+ continue
+ name = p.name
+ rel = p.relative_to(tree).as_posix()
+ suffix = p.suffix.lower()
+ # Unambiguous secret files block hard.
+ if name in FORBIDDEN_BASENAMES:
+ blocking.append({"kind": "forbidden_file", "path": rel, "detail": name})
+ continue
+ # Public / encrypted key material is allowed to ship.
+ if suffix in (".enc", ".pub") or name.endswith(".pub.pem"):
+ continue
+ # Other key/db extensions only WARN — actual private-key *material* is
+ # caught by the private_key_block content pattern regardless of suffix,
+ # so this avoids false-blocking public certs or test fixtures.
+ if suffix in FORBIDDEN_SUFFIXES:
+ warnings.append({"kind": "sensitive_suffix", "path": rel, "detail": name})
+
+ for path, data in _iter_text_files(tree):
+ rel = path.relative_to(tree).as_posix()
+ text, _ = _decode(data)
+ exempt = _matches_any(rel, scrub_exempt)
+
+ # high-confidence secret shapes
+ for name, rx in secret_rx.items():
+ for m in rx.finditer(text):
+ value = m.group(0)
+ if (value, rel) in allow:
+ suppressed.append({"path": rel, "pattern": name, "value": value})
+ elif exempt:
+ warnings.append(
+ {"kind": "secret_in_exempt", "path": rel,
+ "pattern": name, "value": value}
+ )
+ else:
+ blocking.append(
+ {"kind": "secret", "path": rel, "pattern": name,
+ "value": value}
+ )
+
+ # residual PII (scrub + block-only rows must be 0 in non-exempt files)
+ for row in scrub_rows:
+ if row["action"] == "warn":
+ continue
+ for m in row["rx"].finditer(text):
+ value = m.group(0)
+ if (value, rel) in allow:
+ suppressed.append({"path": rel, "pattern": row["note"], "value": value})
+ elif exempt:
+ warnings.append(
+ {"kind": "pii_in_exempt", "path": rel,
+ "note": row["note"], "value": value}
+ )
+ else:
+ blocking.append(
+ {"kind": "pii_residual", "path": rel,
+ "note": row["note"], "value": value}
+ )
+
+ # warn-tier PII heuristics
+ for row in scrub_rows:
+ if row["action"] != "warn":
+ continue
+ for m in row["rx"].finditer(text):
+ if (m.group(0), rel) not in allow:
+ warnings.append(
+ {"kind": "pii_warn", "path": rel,
+ "note": row["note"], "value": m.group(0)}
+ )
+
+ # English-only artifact gate (CLAUDE.md rule 1): no German outside the
+ # allowlist may ship. `i18n-allow` inline marks and the path allowlist are
+ # the only escapes — same contract as the CI/pre-commit language gate.
+ if (
+ german_check is not None
+ and Path(rel).suffix.lower() in _GERMAN_EXT
+ and not _german_allowlisted(rel, german_patterns)
+ ):
+ for lineno, line in enumerate(text.splitlines(), start=1):
+ if "i18n-allow" in line:
+ continue
+ if german_check(line):
+ blocking.append(
+ {"kind": "german", "path": rel, "line": lineno,
+ "value": line.strip()[:120]}
+ )
+
+ report = {
+ "tree": str(tree),
+ "blocking_count": len(blocking),
+ "blocking": blocking,
+ "warning_count": len(warnings),
+ "warnings": warnings,
+ "suppressed_count": len(suppressed),
+ "suppressed": suppressed,
+ }
+ _write_report(args.report, report)
+ print(
+ f"scan: {len(blocking)} BLOCKING, {len(warnings)} warnings, "
+ f"{len(suppressed)} allowlisted-suppressed."
+ )
+ for b in blocking[:50]:
+ _eprint(f" BLOCK [{b['kind']}] {b['path']}: {b.get('value', b.get('detail',''))}")
+ # fail-closed: any blocking finding => non-zero exit
+ return 2 if blocking else 0
+
+
+# ----------------------------------------------------------------------------
+# reconcile (make the dist working tree equal the staged tree)
+# ----------------------------------------------------------------------------
+def cmd_reconcile(args: argparse.Namespace) -> int:
+ staging = Path(args.staging).resolve()
+ dist = Path(args.dist).resolve()
+ skill_dir = Path(args.skill_dir).resolve()
+
+ if not (dist / ".git").exists():
+ _eprint(f"ERROR: {dist} is not a git clone.")
+ return 1
+
+ keep = _load_keep(skill_dir)
+ dist_tracked = _git_tracked(dist)
+ staging_files = sorted(
+ p.relative_to(staging).as_posix()
+ for p in staging.rglob("*")
+ if p.is_file()
+ )
+ staging_set = set(staging_files)
+
+ # Deletions: dist-tracked files that are NOT in the staged tree and are not
+ # on the dist-only keep list. Files present in both are overwritten by copy.
+ deletes = [
+ r for r in dist_tracked
+ if r not in staging_set and not _matches_any(r, keep)
+ ]
+ kept = [r for r in dist_tracked if _matches_any(r, keep)]
+
+ # Mass-deletion guard: a build that went wrong (empty/partial staging) shows
+ # up as a huge delete set. Refuse unless explicitly forced.
+ threshold = max(50, int(0.10 * max(1, len(dist_tracked))))
+ if len(deletes) > threshold and not args.force:
+ _eprint(
+ f"ERROR: reconcile would delete {len(deletes)} files "
+ f"(> guard threshold {threshold}). Refusing — staging looks wrong. "
+ f"Re-run with --force only after confirming this is intended."
+ )
+ _write_report(
+ args.report,
+ {"aborted": "mass_deletion_guard", "would_delete": len(deletes),
+ "threshold": threshold, "dist_tracked": len(dist_tracked)},
+ )
+ return 3
+
+ for r in deletes:
+ (dist / r).unlink(missing_ok=True)
+
+ adds = 0
+ mods = 0
+ for rel in staging_files:
+ dst = dist / rel
+ if dst.exists():
+ mods += 1
+ else:
+ adds += 1
+ dst.parent.mkdir(parents=True, exist_ok=True)
+ dst.write_bytes((staging / rel).read_bytes())
+
+ report = {
+ "dist_tracked_before": len(dist_tracked),
+ "staged_files": len(staging_files),
+ "planned_adds": adds,
+ "planned_mods": mods,
+ "deletes": deletes,
+ "delete_count": len(deletes),
+ "kept_dist_only": kept,
+ }
+ _write_report(args.report, report)
+ print(
+ f"reconcile: ~{adds} adds, ~{mods} overwrites, {len(deletes)} deletes, "
+ f"{len(kept)} dist-only kept. Run `git -C <dist> add -A && git status` "
+ f"for the authoritative diff."
+ )
+ return 0
+
+
+# ----------------------------------------------------------------------------
+# verify (integrity: nothing got silently dropped; imports resolve)
+# ----------------------------------------------------------------------------
+_INTERNAL_IMPORT_RX = re.compile(
+ r"^([ \t]*)(?:from|import)[ \t]+(jarvis(?:\.[A-Za-z0-9_]+)+)", re.MULTILINE
+)
+
+
+def _module_candidates(dotted: str) -> list[str]:
+ """jarvis.state.chat_store -> ['jarvis/state/chat_store.py',
+ 'jarvis/state/chat_store/__init__.py']."""
+ base = dotted.replace(".", "/")
+ return [base + ".py", base + "/__init__.py"]
+
+
+def cmd_verify(args: argparse.Namespace) -> int:
+ """Catch the 'ship-broken-release' failure (Risk R2).
+
+ Two checks, both fail-closed:
+ 1. Completeness — every file in the clean staged tree must actually be
+ committed in the dist clone. The classic trap is `git add -A` honouring
+ the dist .gitignore and SILENTLY dropping files that are tracked in the
+ working repo only because they were force-added there (e.g. jarvis/state
+ vs the unanchored `state/` ignore rule). Run AFTER `git add`.
+ 2. Internal-import resolution — every `import jarvis.x.y` in the staged
+ tree must resolve to a file that is actually in the staged tree. Catches
+ a module that is imported but untracked (so it never shipped) or
+ denylisted-yet-imported.
+ """
+ staging = Path(args.staging).resolve()
+ dist = Path(args.dist).resolve()
+
+ staged = sorted(
+ p.relative_to(staging).as_posix() for p in staging.rglob("*") if p.is_file()
+ )
+ staged_set = set(staged)
+ committed = set(_git_tracked(dist))
+
+ missing_from_commit = [s for s in staged if s not in committed]
+
+ # Top-level unresolved imports break at import/boot time => BLOCK.
+ # Indented (lazy, inside a function/try) ones only fail when that path runs
+ # and are usually pre-existing working-repo dead imports => WARN, so an
+ # unrelated latent bug doesn't make the repo permanently un-shippable.
+ unresolved_block: list[dict] = []
+ unresolved_warn: list[dict] = []
+ for path, data in _iter_text_files(staging):
+ if path.suffix != ".py":
+ continue
+ rel = path.relative_to(staging).as_posix()
+ text, _ = _decode(data)
+ seen: set[tuple[str, bool]] = set()
+ for m in _INTERNAL_IMPORT_RX.finditer(text):
+ indent, mod = m.group(1), m.group(2)
+ top_level = indent == ""
+ key = (mod, top_level)
+ if key in seen:
+ continue
+ seen.add(key)
+ if not any(c in staged_set for c in _module_candidates(mod)):
+ row = {"file": rel, "module": mod, "top_level": top_level}
+ (unresolved_block if top_level else unresolved_warn).append(row)
+
+ report = {
+ "staged_files": len(staged),
+ "committed_files": len(committed),
+ "missing_from_commit_count": len(missing_from_commit),
+ "missing_from_commit": missing_from_commit,
+ "unresolved_toplevel_count": len(unresolved_block),
+ "unresolved_toplevel": unresolved_block,
+ "unresolved_lazy_count": len(unresolved_warn),
+ "unresolved_lazy": unresolved_warn,
+ }
+ _write_report(args.report, report)
+
+ ok = not missing_from_commit and not unresolved_block
+ print(
+ f"verify: {len(missing_from_commit)} staged files MISSING from the commit, "
+ f"{len(unresolved_block)} top-level broken imports (BLOCK), "
+ f"{len(unresolved_warn)} lazy broken imports (warn)."
+ )
+ for x in missing_from_commit[:30]:
+ _eprint(f" DROPPED (in staging, not committed): {x}")
+ for u in unresolved_block[:30]:
+ _eprint(f" BROKEN IMPORT (top-level): {u['file']} -> {u['module']}")
+ for u in unresolved_warn[:30]:
+ _eprint(f" warn lazy import: {u['file']} -> {u['module']}")
+ return 0 if ok else 2
+
+
+# ----------------------------------------------------------------------------
+# set-version
+# ----------------------------------------------------------------------------
+def cmd_set_version(args: argparse.Namespace) -> int:
+ tree = Path(args.tree).resolve()
+ version = args.version.lstrip("v")
+ if not re.fullmatch(r"\d+\.\d+\.\d+", version):
+ _eprint(f"ERROR: version '{version}' is not X.Y.Z")
+ return 1
+
+ targets = {
+ tree / "pyproject.toml": (
+ re.compile(r'^(version\s*=\s*")[^"]*(")', re.MULTILINE),
+ rf'\g<1>{version}\g<2>',
+ ),
+ tree / "jarvis" / "__init__.py": (
+ re.compile(r'^(__version__\s*=\s*")[^"]*(")', re.MULTILINE),
+ rf'\g<1>{version}\g<2>',
+ ),
+ }
+ changed = []
+ for path, (rx, repl) in targets.items():
+ if not path.exists():
+ _eprint(f"ERROR: expected version file missing: {path}")
+ return 1
+ text, marker = _decode(path.read_bytes())
+ new, n = rx.subn(repl, text, count=1)
+ if n != 1:
+ _eprint(f"ERROR: could not find version line in {path}")
+ return 1
+ path.write_bytes(_encode(new, marker))
+ changed.append(str(path.relative_to(tree)))
+
+ print(f"set-version: {version} written to {', '.join(changed)}")
+ return 0
+
+
+def _write_report(report_path: str | None, payload: dict) -> None:
+ if report_path:
+ Path(report_path).write_text(json.dumps(payload, indent=2), "utf-8")
+
+
+# ----------------------------------------------------------------------------
+def main(argv: list[str] | None = None) -> int:
+ parser = argparse.ArgumentParser(description=__doc__)
+ sub = parser.add_subparsers(dest="cmd", required=True)
+
+ b = sub.add_parser("build", help="export + denylist + scrub into a staging dir")
+ b.add_argument("--working", required=True, help="working repo root")
+ b.add_argument("--staging", required=True, help="empty staging dir to fill")
+ b.add_argument("--skill-dir", required=True, help="this skill's directory")
+ b.add_argument("--report", help="write build report JSON here")
+ b.set_defaults(func=cmd_build)
+
+ s = sub.add_parser("scan", help="fail-closed secret/PII scan over a tree")
+ s.add_argument("--tree", required=True, help="tree to scan (staging or dist)")
+ s.add_argument("--skill-dir", required=True, help="this skill's directory")
+ s.add_argument("--report", help="write scan report JSON here")
+ s.set_defaults(func=cmd_scan)
+
+ r = sub.add_parser("reconcile", help="make the dist tree equal the staged tree")
+ r.add_argument("--staging", required=True, help="clean staged tree")
+ r.add_argument("--dist", required=True, help="fresh distribution clone")
+ r.add_argument("--skill-dir", required=True, help="this skill's directory")
+ r.add_argument("--report", help="write reconcile report JSON here")
+ r.add_argument("--force", action="store_true", help="override mass-deletion guard")
+ r.set_defaults(func=cmd_reconcile)
+
+ vf = sub.add_parser("verify", help="integrity: staged files committed + imports resolve")
+ vf.add_argument("--staging", required=True, help="clean staged tree")
+ vf.add_argument("--dist", required=True, help="dist clone (after git add)")
+ vf.add_argument("--report", help="write verify report JSON here")
+ vf.set_defaults(func=cmd_verify)
+
+ v = sub.add_parser("set-version", help="set version in a staged tree")
+ v.add_argument("--tree", required=True, help="staged tree root")
+ v.add_argument("--version", required=True, help="X.Y.Z (leading v ok)")
+ v.set_defaults(func=cmd_set_version)
+
+ args = parser.parse_args(argv)
+ return args.func(args)
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/scripts/ci/privacy_pre_push.py b/scripts/ci/privacy_pre_push.py
index c1734979b0..4e56e738c9 100644
--- a/scripts/ci/privacy_pre_push.py
+++ b/scripts/ci/privacy_pre_push.py
@@ -10,7 +10,7 @@ It enforces exactly three things on an ordinary push:
(A) Public-repo guard. A direct push to the PUBLIC distribution repo
(PersonalJarvis/PersonalJarvis) is hard-blocked. The only sanctioned path
- to public is the `ship-public-release` skill, which depersonalizes the
+ to public is the depersonalized public-release snapshot, which scrubs the
tree first. Detected by remote name == "public" OR a remote URL
containing (case-insensitive) "personaljarvis/personaljarvis".
@@ -174,17 +174,17 @@ def load_private_emails() -> set[str]:
def load_secret_scanner(repo_root: Path) -> tuple[dict | None, set, set]:
- """Import the ship skill's strip_and_scan.py and return its scan ingredients.
+ """Import the privacy gate's strip_and_scan.py and return its scan ingredients.
Returns (compiled_patterns, forbidden_basenames, allowlist). On ANY failure
- (skill missing, import error, attribute missing) returns (None, set(), set())
+ (file missing, import error, attribute missing) returns (None, set(), set())
so the caller fails OPEN for the secret checks — layer 3 (CI) is the backstop.
"""
try:
- skill_dir = (
- repo_root / ".claude" / "skills" / "ship-public-release"
+ gate_dir = (
+ repo_root / "scripts" / "ci" / "privacy_gate"
)
- script = skill_dir / "scripts" / "strip_and_scan.py"
+ script = gate_dir / "scripts" / "strip_and_scan.py"
spec = importlib.util.spec_from_file_location(
"ship_strip_and_scan", script
)
@@ -197,7 +197,7 @@ def load_secret_scanner(repo_root: Path) -> tuple[dict | None, set, set]:
name: re.compile(p) for name, p in module.SECRET_PATTERNS.items()
}
forbidden = set(module.FORBIDDEN_BASENAMES)
- allowlist = module._load_allowlist(skill_dir)
+ allowlist = module._load_allowlist(gate_dir)
return compiled, forbidden, allowlist
except Exception as exc: # pragma: no cover - defensive fail-open path
print(
@@ -284,10 +284,11 @@ def main(argv: list[str], stdin) -> int:
f" remote: {remote_name!r} url: {remote_url!r}\n"
"\n"
" The public distribution repo (PersonalJarvis/PersonalJarvis) is\n"
- " populated ONLY by the depersonalizing `ship-public-release` skill.\n"
+ " populated ONLY by the depersonalized public-release snapshot.\n"
" A raw push would leak your config, identity and personal data.\n"
"\n"
- " Run the ship-public-release skill instead.\n"
+ " Build the depersonalized snapshot (privacy gate under\n"
+ " scripts/ci/privacy_gate) instead of pushing raw.\n"
"==================================================================",
file=sys.stderr,
)
diff --git a/tests/unit/ci/test_privacy_pre_push.py b/tests/unit/ci/test_privacy_pre_push.py
index efa9601645..db9d6be494 100644
--- a/tests/unit/ci/test_privacy_pre_push.py
+++ b/tests/unit/ci/test_privacy_pre_push.py
@@ -36,9 +36,9 @@ import privacy_pre_push as gate # noqa: E402
def _load_strip_and_scan():
path = (
_REPO_ROOT
- / ".claude"
- / "skills"
- / "ship-public-release"
+ / "scripts"
+ / "ci"
+ / "privacy_gate"
/ "scripts"
/ "strip_and_scan.py"
)