You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@magpie.apache.org by po...@apache.org on 2026/09/22 19:18:21 UTC
(magpie) branch main updated: fix(utilities): a moved heading takes its references, and split isolated-setup-verify (#1334)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/magpie.git
The following commit(s) were added to refs/heads/main by this push:
new 2c996290 fix(utilities): a moved heading takes its references, and split isolated-setup-verify (#1334)
2c996290 is described below
commit 2c996290f46996c443690fbbc390ef9b9cdc24c2
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Tue Sep 22 21:18:15 2026 +0200
fix(utilities): a moved heading takes its references, and split isolated-setup-verify (#1334)
* fix(utilities): teach the split pass that a moved heading takes its references
Splitting `isolated-setup-install` broke two of its four eval suites and
nothing caught it until the suites ran. A suite builds its prompt live
from `skill_md` plus `step_heading`, so a heading that moves to a
sibling leaves the suite extracting from a file that no longer contains
it. The validator was green. `prek` was green.
Step 3 now says to follow every reference to a moved heading before
calling the pass done: eval `step-config.json` (with the grep that finds
them), anchor links anywhere in the tree, and the heading level itself —
a block cut from mid-body starts at `###`, cannot open a new file, and
so shifts a level, which changes both the anchor and the string an eval
matches on. That makes it the one byte a split may change, and the hard
rule now says so rather than leaving "identical bytes" to be read
literally and then quietly violated.
This is also the concrete argument for Step 4 running the suites at all:
of the three reference classes, `lychee` catches the anchors, the
validator catches neither of the others, and only the suite catches the
eval configs.
Generated-by: Claude Opus 5
* refactor(setup): split isolated-setup-verify, 8,428 to 4,966 tokens
The twelve checks *are* the run, so moving them wholesale would have
bought a read and saved nothing — the trap the pre-flight block taught.
Four of them are conditional, and those move: the vetted-ops split (9),
the hardware key (10), the container gateway (12) and the eval-harness
exclusion (13), plus check 8's whole-user scope detection, which only
applies when `core.hooksPath` is set. Each leaves its condition and the
**n/a** answer in the body, so a run without vetted-ops, without a
signing key, without podman and in per-project scope reads none of them.
That is 3,916 tokens in `conditional-checks.md`. Checks 5 and 8 were
then tightened in place to land the body under budget at 4,966: the
below-floor branching says the same three things in fewer words, and the
hard-fail rule is untouched, still saying not to downgrade it to a ⚠.
**Eval evidence, because a split can break a suite invisibly.**
Baseline on unmodified `main`: 11/14, three failures including
`step-2-recommend/case-5-multiple`. After the split: 9/14 — and
`step-1-classify/case-7` was mine, grading sub-check 10a against a body
that now held only a stub. That suite builds its prompt from `## The 12
checks`, so it needs the sibling too; `also_include` supplies it. With
that, 12/14 — above baseline — and both survivors are
`step-2-recommend`, whose section is byte-identical to `main` and which
failed on the baseline run as well.
Generated-by: Claude Opus 5
---
docs/mode-economics.md | 6 +-
.../skills/isolated-setup-verify/SKILL.md | 319 +++------------------
.../isolated-setup-verify/conditional-checks.md | 271 +++++++++++++++++
.../skills/optimize-skill/SKILL.md | 25 +-
.../step-1-classify/fixtures/step-config.json | 5 +-
5 files changed, 344 insertions(+), 282 deletions(-)
diff --git a/docs/mode-economics.md b/docs/mode-economics.md
index 8e97cb4a..a1fa9493 100644
--- a/docs/mode-economics.md
+++ b/docs/mode-economics.md
@@ -122,7 +122,7 @@ special-token spellings counted as ordinary text.
Coverage: **75 of 75 local `skills/*/SKILL.md` files**.
External `source.md` redirects and harness symlinks are excluded.
-Measurement manifest SHA-256: `54fe049753b9b1cf76372d32236d677eb85c8e8e5794dc0ca60571d26e6b7dae`.
+Measurement manifest SHA-256: `7b7896bb2028f7135dd95e4961e19d7395d90faa4dfc6ec0a6fa7b6b9590ee0f`.
| Skill file | Measured tokens | Source SHA-256 (first 16 characters) |
|---|---:|---|
@@ -151,7 +151,7 @@ Measurement manifest SHA-256: `54fe049753b9b1cf76372d32236d677eb85c8e8e5794dc0ca
| [mentoring-welcome](../skills/mentoring-welcome/SKILL.md) | 3,225 | `f161921dad9f993a` |
| [newcomer-issue-explainer](../skills/newcomer-issue-explainer/SKILL.md) | 3,495 | `f7602d5903d35353` |
| [onboarding-concierge](../skills/onboarding-concierge/SKILL.md) | 3,374 | `12ef0454669ab5bb` |
-| [optimize-skill](../skills/optimize-skill/SKILL.md) | 3,050 | `c02cfac5d75a5471` |
+| [optimize-skill](../skills/optimize-skill/SKILL.md) | 3,343 | `f27cbca69682b108` |
| [pairing-multi-agent-review](../skills/pairing-multi-agent-review/SKILL.md) | 3,767 | `c174ba4705277f17` |
| [pairing-self-review](../skills/pairing-self-review/SKILL.md) | 3,517 | `0d901c3344f6cee3` |
| [pr-management-code-review](../skills/pr-management-code-review/SKILL.md) | 8,957 | `7ffe3135ee18b887` |
@@ -192,7 +192,7 @@ Measurement manifest SHA-256: `54fe049753b9b1cf76372d32236d677eb85c8e8e5794dc0ca
| [setup-isolated-setup-doctor](../skills/setup-isolated-setup-doctor/SKILL.md) | 7,859 | `23d6b94d2ffcd718` |
| [setup-isolated-setup-install](../skills/setup-isolated-setup-install/SKILL.md) | 3,879 | `9c7d49c9e7ff947d` |
| [setup-isolated-setup-update](../skills/setup-isolated-setup-update/SKILL.md) | 5,512 | `55fe1d5e957c9128` |
-| [setup-isolated-setup-verify](../skills/setup-isolated-setup-verify/SKILL.md) | 8,428 | `a8e53bf6abd44923` |
+| [setup-isolated-setup-verify](../skills/setup-isolated-setup-verify/SKILL.md) | 4,967 | `2de9c2cd4bf4d24b` |
| [setup-override-upstream](../skills/setup-override-upstream/SKILL.md) | 3,960 | `8ab7b08f5fe58452` |
| [setup-privacy-llm](../skills/setup-privacy-llm/SKILL.md) | 2,055 | `b89f1f5e421df5cc` |
| [setup-shared-config-sync](../skills/setup-shared-config-sync/SKILL.md) | 4,185 | `716c989013526bf0` |
diff --git a/plugins/magpie-setup/skills/isolated-setup-verify/SKILL.md b/plugins/magpie-setup/skills/isolated-setup-verify/SKILL.md
index 90ef6bfc..6ccad5f8 100644
--- a/plugins/magpie-setup/skills/isolated-setup-verify/SKILL.md
+++ b/plugins/magpie-setup/skills/isolated-setup-verify/SKILL.md
@@ -16,7 +16,7 @@ when_to_use: >-
have started working — that is the canary for a denial having
silently become an allow.
capability: capability:platform
-surface_hash: sha256:bda5d0cc6087b0fd
+surface_hash: sha256:b3582f9511e28ef0
license: Apache-2.0
---
@@ -175,24 +175,19 @@ Walk each in order:
table declares a `min_version` floor. Determine the running
claude-code version (`claude --version`) and compare it to
`min_version`:
- - **At or above the floor** → ✓ (note the version; recommend
- `npm install -g --no-save @anthropic-ai/claude-code@latest`
- if it is not already the newest, since latest carries the
- freshest security fixes — but this is a note, not a ⚠).
- - **Below the floor, and this verify is running under Claude
- Code** → **HARD FAIL (✗)**. The secure setup's permission-rule
- / sandbox / prompt-injection guarantees depend on runtime
- behaviour present from `min_version` onward; on an older build
- they may silently not hold. Do **not** downgrade this to a ⚠.
- Stop and tell the operator to upgrade
- (`npm install -g --no-save @anthropic-ai/claude-code@latest`)
- and re-run — the run cannot certify the setup on a
- below-floor runtime. This applies whenever the current harness
- is Claude Code (the common case for this skill).
- - **Below the floor, but the harness is not Claude Code** (e.g.
- an OpenCode-driven run that cannot introspect a claude-code
- version) → ⚠ with a note that the floor could not be enforced
- as a hard gate for this runtime.
+ - **At or above the floor** → ✓. Note the version, and suggest
+ `@latest` if it is not already newest — a note, not a ⚠.
+ - **Below the floor, under Claude Code** → **HARD FAIL (✗)**, and
+ do not downgrade it to a ⚠. The permission-rule, sandbox and
+ prompt-injection guarantees depend on runtime behaviour present
+ from `min_version` onward, and on an older build they may
+ silently not hold, so the run cannot certify the setup at all.
+ Stop, tell the operator to upgrade
+ (`npm install -g --no-save @anthropic-ai/claude-code@latest`),
+ and re-run.
+ - **Below the floor, under another harness** that cannot
+ introspect a claude-code version → ⚠, noting the floor could
+ not be enforced as a hard gate here.
6. Status-line prefix in this session is `[sandbox]`, not
`[NO SANDBOX]`. Resolve the precedence:
`<cwd>/.claude/settings.local.json` →
@@ -244,187 +239,30 @@ Walk each in order:
exists to defend against. ✗ on either failure; remediation
as above.
- The check is cheap (read of a known file, write of a single
- temp file) and the false-negative cost (a session that can't
- read the project) is high, so it runs every time
- `setup-isolated-setup-verify` is invoked — no flag needed to
- opt in.
-
- Note: this check looks at **project-local**
- (`<worktree>/.claude/settings.local.json`), not user-scope.
- The fix lives there deliberately — see
- [`docs/setup/secure-agent-setup.md` → *Project-root coverage in the sandbox allowlists*](../../../../docs/setup/secure-agent-setup.md#project-root-coverage-in-the-sandbox-allowlists)
- for why.
-
- **Scope detection (per-project vs whole-user).** The install
- skill offers two scopes. Detect which one is in effect:
-
- ```bash
- git config --global --get core.hooksPath
- ```
-
- If the output equals `$HOME/.claude/git-hooks` (or its tilde-
- resolved form), the operator is in **whole-user** scope:
-
- - ✓ if `~/.claude/git-hooks/post-checkout` exists, is
- executable, and matches the framework's
- `tools/agent-isolation/git-global-post-checkout.sh` content.
- - ⚠ if the hook is missing or non-executable — the `core.hooksPath`
- pointer is set but the hook content is gone. Remediation:
- re-run `setup-isolated-setup-install` Step P.3-whole-user,
- or `setup-isolated-setup-update` to refresh the script copy.
- - ⚠ if the hook content drifted from the framework's source-of-
- truth — surface the diff, propose `setup-isolated-setup-update`.
- - **Loud reminder** (every run, not a ✗): when in whole-user
- scope, surface a one-line note that per-repo `.git/hooks/*`
- are inert across the host (per [`docs/setup/secure-agent-setup.md` → *Per-project vs whole-user scope*](../../../../docs/setup/secure-agent-setup.md#per-project-vs-whole-user-scope)).
- This is informational, not a failure — the operator chose it
- deliberately during install. Surface so a future self
- debugging "why didn't my pre-commit fire" recognises the
- cause.
-
- If `core.hooksPath` is unset (or points elsewhere), the
- operator is in **per-project** scope (the default). No further
- sub-check needed — the per-project mode is fully covered by
- the static + live-probe checks above.
-
-9. **The vetted-ops split and exclusion.** Only meaningful when the
- adopter routes forge operations through the `vetted-ops`
- dispatcher; if the repo has no
+ It runs every time, no flag: the check is two file operations and
+ the thing it catches is a session that cannot read its own project.
+ It reads **project-local** `settings.local.json`, not user-scope —
+ [why](../../../../docs/setup/secure-agent-setup.md#project-root-coverage-in-the-sandbox-allowlists).
+
+ **Scope detection.** `git config --global --get core.hooksPath`
+ equal to `$HOME/.claude/git-hooks` means **whole-user** scope, which
+ has its own sub-checks and a reminder that per-repo `.git/hooks/*`
+ are inert host-wide:
+ [`conditional-checks.md`](conditional-checks.md#check-8--whole-user-scope-detection).
+ Unset or pointing elsewhere means per-project scope, the default,
+ fully covered by the two sub-checks above.
+
+9. **The vetted-ops split and exclusion.** Only when the adopter
+ routes forge operations through the `vetted-ops` dispatcher. No
`.apache-magpie-overrides/tools/vetted-ops/config.toml` and no
- `vetted-op` rule, report **n/a** and move on.
-
- **9a — which dispatcher is allowlisted.** This is the check that
- matters. `permissions.allow` may contain `vetted-op-read` and
- must **not** contain `vetted-op`. Finding the write dispatcher in
- `allow` is ✗ and worth stopping the report to say so plainly: it
- grants every operation in the catalogue, including `issue-close`
- and every `pr-review-*`, with no confirmation. It looks safe
- because the policy declares a read-only caller — but `--caller`
- is an argv string chosen by whoever runs the command, so the
- caller name in an example constrains nothing. Verify by
- inspection, not by trusting a comment next to the rule.
-
- `vetted-op` in `ask` (or absent) is correct.
-
- **9b — the exclusion.** `permissions.deny` covers both surfaces,
- each with an `Edit` rule:
-
- - `~/.claude/plugins/cache/apache-magpie/magpie-vetted-ops/**` —
- the operation catalogue. The read dispatcher's `allow` rests on
- its shape, so an editable catalogue dissolves that `allow`.
- - `.apache-magpie-overrides/tools/vetted-ops/**` — the policy.
-
- Either one missing is ✗. One `Edit` rule per surface is the whole
- coverage — in `permissions`, `Edit(path)` binds every file-editing
- tool, and a `Write(path)` rule is not matched by the file
- permission check at all. A `Write(…)` line beside an `Edit(…)` is
- therefore a note, not a pass: it protects nothing and reads as a
- second layer that is not there.
-
- Report two things as **notes**, not failures. The policy's
- protection stops at the agent's editing tools — it sits in the
- sandbox-writable project root, so a Bash-level write is not
- covered; this is survivable only because the read dispatcher
- refuses writes without consulting policy. And per-caller scoping
- is least-privilege, not isolation: if the report describes it as
- a boundary, correct that, because it is the misreading that
- produces a `vetted-op` `allow` in the first place.
+ `vetted-op` rule → report **n/a** and move on. Otherwise:
+ [`conditional-checks.md`](conditional-checks.md#check-9--the-vetted-ops-split-and-exclusion).
10. **Hardware-key touch overlay and the signing key.** Only when
- commits are signed (`git config --get commit.gpgsign` is
- `true`) or a remote is reached over ssh through gpg-agent
- (`SSH_AUTH_SOCK` names its socket); otherwise report **n/a**.
- Four sub-checks, plus a note: the key's own touch policies
- (`ykman openpgp info`, run by the user — the sandbox does not
- see the device) are what make the overlay matter; report them
- as seen, and suggest `cached` on the `sig` and `aut` slots
- where either is `Off`, per
- [`docs/setup/secure-agent-setup.md` → Hardware security keys](../../../../docs/setup/secure-agent-setup.md#hardware-security-keys--signing-and-authentication).
-
- **10a — wiring and scripts.** User-scope `~/.claude/settings.json`
- has a `PreToolUse` `Bash` hook running
- `gpg-touch-overlay.sh arm` and a `gpg-touch-overlay.sh disarm`
- `Bash` hook on each of `PostToolUse`, `PermissionDenied` and
- `PostToolUseFailure`. A missing `PostToolUse` disarm is ✗; a
- missing `PermissionDenied` or `PostToolUseFailure` disarm is ⚠
- with the reason — the overlay still works, but a rejected or
- failed command leaves its watcher armed until `MAX_WAIT`, and any
- unrelated signature in that window raises the window with nothing
- pending. The scripts must also be present and
- executable: `~/.claude/scripts/gpg-touch-overlay.sh`, plus
- `gpg-touch-overlay-window.py` (Linux) or
- `gpg-touch-overlay-window-macos.py` (macOS) beside it. Compare
- each against `tools/agent-isolation/` in the framework checkout:
- a copy that differs is ⚠ (stale — the watcher's behaviour has
- changed more than once, and a stale copy fails silently), a
- missing file or hook is ✗. Install steps and rationale:
- [`docs/setup/secure-agent-setup.md` → Hardware-key touch overlay](../../../../docs/setup/secure-agent-setup.md#hardware-key-touch-overlay).
-
- **10b — the window can draw.** The window needs a toolkit —
- PyGObject or `zenity` on Linux, a python with Tk 8.6 or newer
- on macOS — and the script carries its own probe:
- `~/.claude/scripts/gpg-touch-overlay.sh _gui_available` (exit 0
- means a window can be shown). It must run **outside the
- sandbox**, where the hook itself runs: from inside the sandbox
- no display or window server is reachable, so an in-sandbox run
- says nothing. Do not reach for the bypass; surface the command
- for the user to run with the `!` prefix and read the exit code
- back. Non-zero is ✗, naming the platform's toolkit.
-
- **10c — the signing key is readable in the sandbox.** Only with
- `git config --get gpg.format` = `ssh`; otherwise n/a. The file
- `git config --get user.signingkey` names must open from a
- sandboxed Bash: `head -c 1 "$(git config --get user.signingkey)"
- >/dev/null`. `Operation not permitted` / `Permission denied` is
- ✗: the sandbox denies `~/.ssh/` wholesale and that one public
- key needs its own `sandbox.filesystem.allowRead` entry. Without
- it every commit fails before the key is asked for a touch, and
- the overlay — which shows once `ssh-keygen` has blocked on the
- key — has nothing to show. Remediation:
- [`docs/setup/sandbox-troubleshooting.md` → Signed commit fails before any touch when git signs with ssh](../../../../docs/setup/sandbox-troubleshooting.md#signed-commit-fails-before-any-touch-when-git-signs-with-ssh).
-
- **10d — git's own programs point at the wrapper.** The hook
- covers only git commands the agent runs; for the commits and
- pushes the user makes from a terminal, git itself has to be
- pointed at the script's `wrap` mode.
- `git config --global --get gpg.ssh.program` (or `gpg.program`,
- when `git config --get gpg.format` is not `ssh`) must name a
- `gpg-touch-wrap-<program>` symlink that resolves to
- `~/.claude/scripts/gpg-touch-overlay.sh`, and
- `git config --global --get core.sshCommand` must end in
- `gpg-touch-overlay.sh wrap ssh`. Either missing is ⚠, not ✗:
- the hook still covers the agent's own commands, and only the
- user's terminal commits and pushes go without a window. A value
- that names something else entirely (a company ssh wrapper, say)
- is ⚠ with the current value shown — the user decides. Rationale
- and the two lines to set:
- [`docs/setup/secure-agent-setup.md` → From your own terminal](../../../../docs/setup/secure-agent-setup.md#from-your-own-terminal--gits-program-config).
-
- When git *does* name the wrapper, both of its files must also
- open from a sandboxed Bash —
- `head -c 1 ~/.claude/scripts/gpg-touch-overlay.sh` and the same
- for the `gpg-touch-wrap-*` symlink git names. `Operation not
- permitted` is ✗, not ⚠: the git the agent runs reads the same
- global config, and every sandboxed signed commit then fails at
- once with `cannot exec`. The two files belong in
- `sandbox.filesystem.allowRead`, and nothing wider under
- `~/.claude/`:
- [`docs/setup/sandbox-troubleshooting.md` → Signed commit fails with "cannot exec" of the touch-overlay wrapper](../../../../docs/setup/sandbox-troubleshooting.md#signed-commit-fails-with-cannot-exec-of-the-touch-overlay-wrapper).
-
- **10e — the ssh shim directory, if the user wants one.** `ssh`,
- `scp`, `sftp` and `rsync` typed into a terminal have no program
- setting to point anywhere, so only a `PATH` shim puts the wrapper
- in front of them. Absent entirely is **n/a**, not a gap — it is
- opt-in. When `~/.claude/scripts/shims/` exists, every link in it
- must resolve to `~/.claude/scripts/gpg-touch-overlay.sh`
- (`readlink -f`) and be named for a command the script dispatches
- on — a link named anything else never wraps and is ⚠ with the
- name shown. The directory must also appear in `PATH` ahead of
- `/usr/bin`: compare `command -v ssh` against the shim path, and
- report ⚠ with both paths when the real binary wins, since the
- links are then inert. Rationale and the `PATH` line:
- [`docs/setup/secure-agent-setup.md` → Beyond git](../../../../docs/setup/secure-agent-setup.md#beyond-git--ssh-scp-sftp-and-rsync-you-type-yourself).
+ commits are signed (`git config --get commit.gpgsign` is `true`)
+ or a remote is reached over ssh through gpg-agent (`SSH_AUTH_SOCK`
+ names its socket); otherwise **n/a**. Four sub-checks:
+ [`conditional-checks.md`](conditional-checks.md#check-10--hardware-key-touch-overlay-and-the-signing-key).
11. **`gh` runs outside the sandbox.** `sandbox.excludedCommands`
must contain `"gh *"` in the project `.claude/settings.json` or
@@ -459,88 +297,17 @@ Walk each in order:
that alias installed, say so; it is a convenience, not a
requirement.
-12. **Container gateway wired.** Only meaningful when `podman` or
- `docker` is on `PATH`; if neither is installed, report **n/a**
- for the whole check. Four sub-checks:
-
- - **12a — hooks wired.** User-scope `~/.claude/settings.json`
- has a `SessionStart` hook running
- `container-gateway-hook.sh start` and a `SessionEnd` hook
- running `container-gateway-hook.sh stop`. Either missing is
- ✗.
- - **12b — hook script present.** `~/.claude/scripts/container-gateway-hook.sh`
- exists and is executable. Missing or non-executable is ✗.
- - **12c — project wiring.** The gitignored
- `.claude/settings.local.json` has `env.CONTAINER_HOST` and
- `env.DOCKER_HOST`, and both gateway sockets appear in
- `sandbox.network.allowUnixSockets`. Either half missing
- (the `env` pair or the socket allow-list pair) is ✗; report
- which half. All four values must be **absolute** paths: the
- CLIs read a `unix://` URL's authority as a host component, so
- a project-relative `unix://./…` value dials a path that does
- not exist. A relative `env` value — including one left in the
- committed `.claude/settings.json` by an older install — is ✗,
- quoting it and pointing at
- [Container gateway](../../../../docs/setup/secure-agent-setup.md#container-gateway).
- - **12d — no raw daemon socket in any scope's `allowUnixSockets`.**
- Scan project, project-local, and user scope
- (`.claude/settings.json`, `.claude/settings.local.json`,
- `~/.claude/settings.json`) for an entry whose basename is
- `docker.sock`, `podman.sock`, or ends in `-api.sock`, unless
- its parent directory is `.apache-magpie-local/run`. Any hit
- is ✗, quoting the offending entry, with this exact note —
- it is the same invariant `tools/sandbox-lint` enforces:
-
- > `sandbox.network.allowUnixSockets: <entry> names a
- > container daemon socket; route through the container
- > gateway (<project>/.apache-magpie-local/run/*.sock)
- > instead`
-
- Install detail:
- [`docs/setup/secure-agent-setup.md` → Container gateway](../../../../docs/setup/secure-agent-setup.md#container-gateway).
- On any ✗, point at
- [`docs/setup/sandbox-troubleshooting.md` → Docker / Podman command fails with a socket error](../../../../docs/setup/sandbox-troubleshooting.md#docker--podman-command-fails-with-a-socket-error)
- rather than re-explaining the fix.
+12. **Container gateway wired.** Only when `podman` or `docker` is on
+ `PATH`; neither installed → **n/a** for the whole check. Four
+ sub-checks:
+ [`conditional-checks.md`](conditional-checks.md#check-12--container-gateway-wired).
13. **Eval-harness exclusion, if installed.** Optional (step M of
- `setup-isolated-setup-install`): report **n/a** when
+ `setup-isolated-setup-install`). **n/a** when
`sandbox.excludedCommands` has no
- `~/.claude/scripts/magpie-run-evals.sh *` entry *and*
- `~/.claude/scripts/magpie-run-evals.sh` is absent. Not running
- eval suites is a normal posture, not a gap.
-
- When either is present, all of it must be:
-
- - **13a — both halves, or neither.** The exclusion entry and the
- installed wrapper must agree. An exclusion naming a script that
- is not there is dead config; an installed script with no
- exclusion silently runs sandboxed and reports `Not logged in`
- for every case. Either alone is ✗, naming which half is missing.
- - **13b — the package is beside the wrapper.**
- `~/.claude/scripts/skill-evals/src/skill_evals/` exists.
- Missing is ✗: the wrapper exits 2 without it, so no suite can
- run.
- - **13c — the copies match the repository.** Hash-compare
- `~/.claude/scripts/magpie-run-evals.sh` against
- `tools/skill-evals/magpie-run-evals.sh`, and every `*.py` under
- `~/.claude/scripts/skill-evals/src/skill_evals/` against
- `tools/skill-evals/src/skill_evals/` (ignore `__pycache__`).
- Any difference is ⚠, not ✗, and names the drifted files: the
- harness still runs, it just runs an older grader than the one
- in the tree. Remedy is re-running install step M.1.
- - **13d — the deny is present.** `permissions.deny` contains
- `Edit(~/.claude/scripts/**)`. Missing is ✗ — without it the
- agent can edit the very code the exclusion runs outside the
- sandbox, which is the whole bargain of the step.
-
- Report as a **note**, not a failure: the eval *fixtures* stay
- agent-writable in the repository by design. They are data the
- runner reads, never code it executes, so a fixture edit is a
- review problem visible in the diff rather than a sandbox escape.
- If a report describes the fixtures as protected, correct it.
-
- Rationale:
- [`tools/skill-evals/README.md` → Running from inside the sandbox](../../../../tools/skill-evals/README.md#running-from-inside-the-sandbox).
+ `~/.claude/scripts/magpie-run-evals.sh *` entry *and* the script is
+ absent. Otherwise:
+ [`conditional-checks.md`](conditional-checks.md#check-13--eval-harness-exclusion-if-installed).
## After the report
diff --git a/plugins/magpie-setup/skills/isolated-setup-verify/conditional-checks.md b/plugins/magpie-setup/skills/isolated-setup-verify/conditional-checks.md
new file mode 100644
index 00000000..0758bd56
--- /dev/null
+++ b/plugins/magpie-setup/skills/isolated-setup-verify/conditional-checks.md
@@ -0,0 +1,271 @@
+<!-- SPDX-License-Identifier: Apache-2.0
+ https://www.apache.org/licenses/LICENSE-2.0 -->
+
+# The conditional checks: 9, 10, 12 and 13
+
+Four of the checks only apply when the install has the feature they
+cover. `SKILL.md` carries the condition and reports **n/a** without
+reading this file; read the section for a check whose condition holds.
+
+## Check 8 — whole-user scope detection
+
+ **Scope detection (per-project vs whole-user).** The install
+ skill offers two scopes. Detect which one is in effect:
+
+ ```bash
+ git config --global --get core.hooksPath
+ ```
+
+ If the output equals `$HOME/.claude/git-hooks` (or its tilde-
+ resolved form), the operator is in **whole-user** scope:
+
+ - ✓ if `~/.claude/git-hooks/post-checkout` exists, is
+ executable, and matches the framework's
+ `tools/agent-isolation/git-global-post-checkout.sh` content.
+ - ⚠ if the hook is missing or non-executable — the `core.hooksPath`
+ pointer is set but the hook content is gone. Remediation:
+ re-run `setup-isolated-setup-install` Step P.3-whole-user,
+ or `setup-isolated-setup-update` to refresh the script copy.
+ - ⚠ if the hook content drifted from the framework's source-of-
+ truth — surface the diff, propose `setup-isolated-setup-update`.
+ - **Loud reminder** (every run, not a ✗): when in whole-user
+ scope, surface a one-line note that per-repo `.git/hooks/*`
+ are inert across the host (per [`docs/setup/secure-agent-setup.md` → *Per-project vs whole-user scope*](../../../../docs/setup/secure-agent-setup.md#per-project-vs-whole-user-scope)).
+ This is informational, not a failure — the operator chose it
+ deliberately during install. Surface so a future self
+ debugging "why didn't my pre-commit fire" recognises the
+ cause.
+
+ If `core.hooksPath` is unset (or points elsewhere), the
+ operator is in **per-project** scope (the default). No further
+ sub-check needed — the per-project mode is fully covered by
+ the static + live-probe checks above.
+
+## Check 9 — the vetted-ops split and exclusion
+
+9. **The vetted-ops split and exclusion.** Only meaningful when the
+ adopter routes forge operations through the `vetted-ops`
+ dispatcher; if the repo has no
+ `.apache-magpie-overrides/tools/vetted-ops/config.toml` and no
+ `vetted-op` rule, report **n/a** and move on.
+
+ **9a — which dispatcher is allowlisted.** This is the check that
+ matters. `permissions.allow` may contain `vetted-op-read` and
+ must **not** contain `vetted-op`. Finding the write dispatcher in
+ `allow` is ✗ and worth stopping the report to say so plainly: it
+ grants every operation in the catalogue, including `issue-close`
+ and every `pr-review-*`, with no confirmation. It looks safe
+ because the policy declares a read-only caller — but `--caller`
+ is an argv string chosen by whoever runs the command, so the
+ caller name in an example constrains nothing. Verify by
+ inspection, not by trusting a comment next to the rule.
+
+ `vetted-op` in `ask` (or absent) is correct.
+
+ **9b — the exclusion.** `permissions.deny` covers both surfaces,
+ each with an `Edit` rule:
+
+ - `~/.claude/plugins/cache/apache-magpie/magpie-vetted-ops/**` —
+ the operation catalogue. The read dispatcher's `allow` rests on
+ its shape, so an editable catalogue dissolves that `allow`.
+ - `.apache-magpie-overrides/tools/vetted-ops/**` — the policy.
+
+ Either one missing is ✗. One `Edit` rule per surface is the whole
+ coverage — in `permissions`, `Edit(path)` binds every file-editing
+ tool, and a `Write(path)` rule is not matched by the file
+ permission check at all. A `Write(…)` line beside an `Edit(…)` is
+ therefore a note, not a pass: it protects nothing and reads as a
+ second layer that is not there.
+
+ Report two things as **notes**, not failures. The policy's
+ protection stops at the agent's editing tools — it sits in the
+ sandbox-writable project root, so a Bash-level write is not
+ covered; this is survivable only because the read dispatcher
+ refuses writes without consulting policy. And per-caller scoping
+ is least-privilege, not isolation: if the report describes it as
+ a boundary, correct that, because it is the misreading that
+ produces a `vetted-op` `allow` in the first place.
+
+## Check 10 — hardware-key touch overlay and the signing key
+
+10. **Hardware-key touch overlay and the signing key.** Only when
+ commits are signed (`git config --get commit.gpgsign` is
+ `true`) or a remote is reached over ssh through gpg-agent
+ (`SSH_AUTH_SOCK` names its socket); otherwise report **n/a**.
+ Four sub-checks, plus a note: the key's own touch policies
+ (`ykman openpgp info`, run by the user — the sandbox does not
+ see the device) are what make the overlay matter; report them
+ as seen, and suggest `cached` on the `sig` and `aut` slots
+ where either is `Off`, per
+ [`docs/setup/secure-agent-setup.md` → Hardware security keys](../../../../docs/setup/secure-agent-setup.md#hardware-security-keys--signing-and-authentication).
+
+ **10a — wiring and scripts.** User-scope `~/.claude/settings.json`
+ has a `PreToolUse` `Bash` hook running
+ `gpg-touch-overlay.sh arm` and a `gpg-touch-overlay.sh disarm`
+ `Bash` hook on each of `PostToolUse`, `PermissionDenied` and
+ `PostToolUseFailure`. A missing `PostToolUse` disarm is ✗; a
+ missing `PermissionDenied` or `PostToolUseFailure` disarm is ⚠
+ with the reason — the overlay still works, but a rejected or
+ failed command leaves its watcher armed until `MAX_WAIT`, and any
+ unrelated signature in that window raises the window with nothing
+ pending. The scripts must also be present and
+ executable: `~/.claude/scripts/gpg-touch-overlay.sh`, plus
+ `gpg-touch-overlay-window.py` (Linux) or
+ `gpg-touch-overlay-window-macos.py` (macOS) beside it. Compare
+ each against `tools/agent-isolation/` in the framework checkout:
+ a copy that differs is ⚠ (stale — the watcher's behaviour has
+ changed more than once, and a stale copy fails silently), a
+ missing file or hook is ✗. Install steps and rationale:
+ [`docs/setup/secure-agent-setup.md` → Hardware-key touch overlay](../../../../docs/setup/secure-agent-setup.md#hardware-key-touch-overlay).
+
+ **10b — the window can draw.** The window needs a toolkit —
+ PyGObject or `zenity` on Linux, a python with Tk 8.6 or newer
+ on macOS — and the script carries its own probe:
+ `~/.claude/scripts/gpg-touch-overlay.sh _gui_available` (exit 0
+ means a window can be shown). It must run **outside the
+ sandbox**, where the hook itself runs: from inside the sandbox
+ no display or window server is reachable, so an in-sandbox run
+ says nothing. Do not reach for the bypass; surface the command
+ for the user to run with the `!` prefix and read the exit code
+ back. Non-zero is ✗, naming the platform's toolkit.
+
+ **10c — the signing key is readable in the sandbox.** Only with
+ `git config --get gpg.format` = `ssh`; otherwise n/a. The file
+ `git config --get user.signingkey` names must open from a
+ sandboxed Bash: `head -c 1 "$(git config --get user.signingkey)"
+ >/dev/null`. `Operation not permitted` / `Permission denied` is
+ ✗: the sandbox denies `~/.ssh/` wholesale and that one public
+ key needs its own `sandbox.filesystem.allowRead` entry. Without
+ it every commit fails before the key is asked for a touch, and
+ the overlay — which shows once `ssh-keygen` has blocked on the
+ key — has nothing to show. Remediation:
+ [`docs/setup/sandbox-troubleshooting.md` → Signed commit fails before any touch when git signs with ssh](../../../../docs/setup/sandbox-troubleshooting.md#signed-commit-fails-before-any-touch-when-git-signs-with-ssh).
+
+ **10d — git's own programs point at the wrapper.** The hook
+ covers only git commands the agent runs; for the commits and
+ pushes the user makes from a terminal, git itself has to be
+ pointed at the script's `wrap` mode.
+ `git config --global --get gpg.ssh.program` (or `gpg.program`,
+ when `git config --get gpg.format` is not `ssh`) must name a
+ `gpg-touch-wrap-<program>` symlink that resolves to
+ `~/.claude/scripts/gpg-touch-overlay.sh`, and
+ `git config --global --get core.sshCommand` must end in
+ `gpg-touch-overlay.sh wrap ssh`. Either missing is ⚠, not ✗:
+ the hook still covers the agent's own commands, and only the
+ user's terminal commits and pushes go without a window. A value
+ that names something else entirely (a company ssh wrapper, say)
+ is ⚠ with the current value shown — the user decides. Rationale
+ and the two lines to set:
+ [`docs/setup/secure-agent-setup.md` → From your own terminal](../../../../docs/setup/secure-agent-setup.md#from-your-own-terminal--gits-program-config).
+
+ When git *does* name the wrapper, both of its files must also
+ open from a sandboxed Bash —
+ `head -c 1 ~/.claude/scripts/gpg-touch-overlay.sh` and the same
+ for the `gpg-touch-wrap-*` symlink git names. `Operation not
+ permitted` is ✗, not ⚠: the git the agent runs reads the same
+ global config, and every sandboxed signed commit then fails at
+ once with `cannot exec`. The two files belong in
+ `sandbox.filesystem.allowRead`, and nothing wider under
+ `~/.claude/`:
+ [`docs/setup/sandbox-troubleshooting.md` → Signed commit fails with "cannot exec" of the touch-overlay wrapper](../../../../docs/setup/sandbox-troubleshooting.md#signed-commit-fails-with-cannot-exec-of-the-touch-overlay-wrapper).
+
+ **10e — the ssh shim directory, if the user wants one.** `ssh`,
+ `scp`, `sftp` and `rsync` typed into a terminal have no program
+ setting to point anywhere, so only a `PATH` shim puts the wrapper
+ in front of them. Absent entirely is **n/a**, not a gap — it is
+ opt-in. When `~/.claude/scripts/shims/` exists, every link in it
+ must resolve to `~/.claude/scripts/gpg-touch-overlay.sh`
+ (`readlink -f`) and be named for a command the script dispatches
+ on — a link named anything else never wraps and is ⚠ with the
+ name shown. The directory must also appear in `PATH` ahead of
+ `/usr/bin`: compare `command -v ssh` against the shim path, and
+ report ⚠ with both paths when the real binary wins, since the
+ links are then inert. Rationale and the `PATH` line:
+ [`docs/setup/secure-agent-setup.md` → Beyond git](../../../../docs/setup/secure-agent-setup.md#beyond-git--ssh-scp-sftp-and-rsync-you-type-yourself).
+
+## Check 12 — container gateway wired
+
+12. **Container gateway wired.** Only meaningful when `podman` or
+ `docker` is on `PATH`; if neither is installed, report **n/a**
+ for the whole check. Four sub-checks:
+
+ - **12a — hooks wired.** User-scope `~/.claude/settings.json`
+ has a `SessionStart` hook running
+ `container-gateway-hook.sh start` and a `SessionEnd` hook
+ running `container-gateway-hook.sh stop`. Either missing is
+ ✗.
+ - **12b — hook script present.** `~/.claude/scripts/container-gateway-hook.sh`
+ exists and is executable. Missing or non-executable is ✗.
+ - **12c — project wiring.** The gitignored
+ `.claude/settings.local.json` has `env.CONTAINER_HOST` and
+ `env.DOCKER_HOST`, and both gateway sockets appear in
+ `sandbox.network.allowUnixSockets`. Either half missing
+ (the `env` pair or the socket allow-list pair) is ✗; report
+ which half. All four values must be **absolute** paths: the
+ CLIs read a `unix://` URL's authority as a host component, so
+ a project-relative `unix://./…` value dials a path that does
+ not exist. A relative `env` value — including one left in the
+ committed `.claude/settings.json` by an older install — is ✗,
+ quoting it and pointing at
+ [Container gateway](../../../../docs/setup/secure-agent-setup.md#container-gateway).
+ - **12d — no raw daemon socket in any scope's `allowUnixSockets`.**
+ Scan project, project-local, and user scope
+ (`.claude/settings.json`, `.claude/settings.local.json`,
+ `~/.claude/settings.json`) for an entry whose basename is
+ `docker.sock`, `podman.sock`, or ends in `-api.sock`, unless
+ its parent directory is `.apache-magpie-local/run`. Any hit
+ is ✗, quoting the offending entry, with this exact note —
+ it is the same invariant `tools/sandbox-lint` enforces:
+
+ > `sandbox.network.allowUnixSockets: <entry> names a
+ > container daemon socket; route through the container
+ > gateway (<project>/.apache-magpie-local/run/*.sock)
+ > instead`
+
+ Install detail:
+ [`docs/setup/secure-agent-setup.md` → Container gateway](../../../../docs/setup/secure-agent-setup.md#container-gateway).
+ On any ✗, point at
+ [`docs/setup/sandbox-troubleshooting.md` → Docker / Podman command fails with a socket error](../../../../docs/setup/sandbox-troubleshooting.md#docker--podman-command-fails-with-a-socket-error)
+ rather than re-explaining the fix.
+
+## Check 13 — eval-harness exclusion, if installed
+
+13. **Eval-harness exclusion, if installed.** Optional (step M of
+ `setup-isolated-setup-install`): report **n/a** when
+ `sandbox.excludedCommands` has no
+ `~/.claude/scripts/magpie-run-evals.sh *` entry *and*
+ `~/.claude/scripts/magpie-run-evals.sh` is absent. Not running
+ eval suites is a normal posture, not a gap.
+
+ When either is present, all of it must be:
+
+ - **13a — both halves, or neither.** The exclusion entry and the
+ installed wrapper must agree. An exclusion naming a script that
+ is not there is dead config; an installed script with no
+ exclusion silently runs sandboxed and reports `Not logged in`
+ for every case. Either alone is ✗, naming which half is missing.
+ - **13b — the package is beside the wrapper.**
+ `~/.claude/scripts/skill-evals/src/skill_evals/` exists.
+ Missing is ✗: the wrapper exits 2 without it, so no suite can
+ run.
+ - **13c — the copies match the repository.** Hash-compare
+ `~/.claude/scripts/magpie-run-evals.sh` against
+ `tools/skill-evals/magpie-run-evals.sh`, and every `*.py` under
+ `~/.claude/scripts/skill-evals/src/skill_evals/` against
+ `tools/skill-evals/src/skill_evals/` (ignore `__pycache__`).
+ Any difference is ⚠, not ✗, and names the drifted files: the
+ harness still runs, it just runs an older grader than the one
+ in the tree. Remedy is re-running install step M.1.
+ - **13d — the deny is present.** `permissions.deny` contains
+ `Edit(~/.claude/scripts/**)`. Missing is ✗ — without it the
+ agent can edit the very code the exclusion runs outside the
+ sandbox, which is the whole bargain of the step.
+
+ Report as a **note**, not a failure: the eval *fixtures* stay
+ agent-writable in the repository by design. They are data the
+ runner reads, never code it executes, so a fixture edit is a
+ review problem visible in the diff rather than a sandbox escape.
+ If a report describes the fixtures as protected, correct it.
+
+ Rationale:
+ [`tools/skill-evals/README.md` → Running from inside the sandbox](../../../../tools/skill-evals/README.md#running-from-inside-the-sandbox).
diff --git a/plugins/magpie-utilities/skills/optimize-skill/SKILL.md b/plugins/magpie-utilities/skills/optimize-skill/SKILL.md
index b9030116..668852d5 100644
--- a/plugins/magpie-utilities/skills/optimize-skill/SKILL.md
+++ b/plugins/magpie-utilities/skills/optimize-skill/SKILL.md
@@ -207,6 +207,25 @@ rewire — stop and take it through normal review.
carries paragraphs one at a time and applies what it has learned from
their earlier edits to the ones that follow.
+**A moved heading breaks things that point at it.** Before calling a
+restructure pass done, follow every reference to the headings you moved:
+
+- **Eval `step-config.json`** — a suite builds its prompt live from
+ `skill_md` plus `step_heading`, so a heading that moved to a sibling
+ leaves the suite extracting from a file that no longer contains it.
+ Update both fields. `grep -rl '<heading text>'
+ tools/skill-evals/evals/` finds them.
+- **Anchor links** — `other.md#the-heading` anywhere in the tree.
+ `lychee` catches these, which is why it runs over the whole tree
+ rather than the diff.
+- **Heading levels.** A block cut from mid-body starts at `###` and
+ cannot open a new file, so it shifts a level. That changes the anchor
+ *and* the `step_heading` string an eval matches on — so it is the one
+ byte a split is allowed to change, and every reference has to follow.
+
+Neither the validator nor `prek` sees the first of these. Only running
+the suite does, which is the argument for Step 4 running it at all.
+
After each pass, regenerate the TOC if headings moved and re-run the
validator. One pass per commit.
@@ -256,8 +275,10 @@ If it was a sweep, restate what is still on the list.
- **Structure changes, behaviour does not.** Except in the rewrite
pass, where wording changes and the maintainer writes every word.
-- **Moved bytes are identical bytes.** A paraphrase during a move is a
- behaviour change in disguise.
+- **Moved bytes are identical bytes**, heading level excepted. A
+ paraphrase during a move is a behaviour change in disguise.
+- **A heading that moves takes its references with it** — eval
+ `step-config.json`, anchor links, anything matching on the string.
- **Propose before applying**, every pass, never a batch.
- **The validator is the gate**, green before and after. A pass that
needs it relaxed is not an optimization.
diff --git a/tools/skill-evals/evals/setup-isolated-setup-verify/step-1-classify/fixtures/step-config.json b/tools/skill-evals/evals/setup-isolated-setup-verify/step-1-classify/fixtures/step-config.json
index c33714ea..7e88fc22 100644
--- a/tools/skill-evals/evals/setup-isolated-setup-verify/step-1-classify/fixtures/step-config.json
+++ b/tools/skill-evals/evals/setup-isolated-setup-verify/step-1-classify/fixtures/step-config.json
@@ -1,4 +1,7 @@
{
"skill_md": "skills/setup-isolated-setup-verify/SKILL.md",
- "step_heading": "## The 12 checks"
+ "step_heading": "## The 12 checks",
+ "also_include": [
+ "skills/setup-isolated-setup-verify/conditional-checks.md"
+ ]
}