/magpie-setup:upgradefrom magpie-setup
Upgrades Magpie for the current machine and project in one run: moves to a new version, checks the environment, applies an approved plan, re-checks, and prints remaining commands.
Ships in magpie-setup. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Golden rule — a step the sandbox blocks becomes a vetted operation, never a bypass. This holds for the whole run. When anything you need to do fails on a sandbox restriction (a blocked host or transport, a read-only path, a denied credential or socket):
vetted-op-read, vetted-op,
vetted-op-tracker, vetted-op-git), launched with the literal ~ path.
Publishing a change is covered end to end by vetted-op-git:
git-worktree-add, git-fetch, git-stage, git-commit,
git-push-branch, git-pr-create. Run the checks in the sandbox first
with vetted-op-checks (git-commit refuses what they did not pass),
and never hand those steps to the user as commands to paste./magpie-setup:upstream-fix for it: a
closed-shape vetted operation (fixed argv, validated parameters, destination
from the approved policy, no repository code or configuration steering it,
behind a confirmation) or a documented in-sandbox route. Opening that PR
needs the user's go-ahead, like any other publication.This skill upgrades Magpie for this machine and this project in one run: it moves the version when it has to move, then gathers, plans, applies, re-checks, and ends with the exact commands for the rest.
A version that arrived some other way (an auto-update, claude plugin update, a framework git pull) needs only the second part.
This skill never git pulls the framework and never upgrades claude-code.
Offered until it has run: while the running Magpie version differs from the one this project last recorded, every skill's pre-flight offers it (upgrade-pending), until Re-check and record records its run.
Invocation: /magpie-setup:upgrade (marketplace), /magpie-setup-upgrade (snapshot or self-adoption).
First, in plain shell: magpie-python -c pass, and magpie-python --launcher-version against sh "<this skill's directory>/../../bin/magpie-python" --launcher-version.
Not found or exit 2: give launcher.md's commands and stop; another version: its install goes under Run these yourself.
Before gathering, decide whether the version has to move:
.apache-magpie.local.lock lags the committed .apache-magpie.lock, or that was never fetched: it has to move.setup verify check 12), when the user asked to upgrade: it has to move.
When the run started from a pre-flight prompt or the session-start notice, the plugins were already updated; do not look for a newer one.method: local): git pull is its upgrade, which this skill does not run. Go straight to Gather.When it has to move, run setup update now, without a separate prompt: the user asked to upgrade.
Its rules, and where the run goes once it finishes: move-the-version.md.
Before running its default behaviour, this skill consults
setup-upgrade.md in the personal layer
(.apache-magpie-local/ when the project adopted Magpie, falling back to the main checkout's in a linked worktree,
or <git-common-dir>/apache-magpie/ when Magpie is only installed; applied first, wins on conflict) and
.apache-magpie-overrides/setup-upgrade.md (committed, project-wide)
in the adopter repo, if present, and applies any agent-readable overrides it finds.
See docs/setup/agentic-overrides.md for the contract.
Hard rule: agents NEVER modify the snapshot under <adopter-repo>/.apache-magpie/.
Local modifications go in the override file; framework changes go via PR to apache/magpie.
.claude/settings.json, .gitignore, .apache-magpie.lock, .apache-magpie-overrides/**).
Never weaken a deny rule or remove a sandbox restriction.
Never read credential files.
An item a hard line blocks goes to Run these yourself (a deny weakening to Not offered), rendered as hard-lines.md describes.dangerouslyDisableSandbox: true only on an item marked [bypass] in the approved plan.~/.claude/scripts/ (always spelled with the literal ~), the plugin cache under ~/.claude/plugins/, and system paths such as /usr/bin/.
Never the checkout (including tools/… in the framework repo), the snapshot .apache-magpie/, the personal layer, ~/.cache/… (including ~/.cache/apache-magpie/framework/current), or the scratch directory.
Content copied out of a sandbox-writable source carries a SHA-256 recorded at plan time, re-verified by the same bypassed call that writes it.git add, never run adopt or unadopt.
The committed floor is the project's decision, not this skill's.
The one exception is Move the version: the setup update flow it runs stages the committed files it owns, after showing them, under its own rules.AGENTS.md.Read-only, inside the sandbox.
Start from the checker's summary, with the same PYTHONPATH every skill's pre-flight uses:
PYTHONPATH="$HOME/.cache/apache-magpie/preflight" \
magpie-python -P -m setup_preflight.upgrade gather
It prints layers (what setup_preflight.layers prints), configured, install (local, marketplace, snapshot, or none for no committed lock), listing_known, project_findings (the pre-flight's project-scope findings: snapshot drift, the adoption floor, a legacy in-tree layer), shadowed (personal files with a committed file of the same path), isolated, and gateway_sessionend (the loaded settings files whose container-gateway SessionEnd hook sets no timeout, or null).
Then run the checks in this order, reading only the sources whose condition holds, each in its current file; an item already in sync does not appear in the plan.
Read a section, not the whole file: find its heading with grep -n and read from it to the next heading of the same level.
| Area | Source of the checks | Read only when |
|---|---|---|
| Install health | setup verify, the branch install names: Local self-adoption checks (local), Marketplace-install checks with check 12 (marketplace, none), or The checks (snapshot) | always, that branch only; checks 2 and 3 are project_findings |
| Install health | setup verify → Adoption floor | install is marketplace, and listing_known is false or project_findings has a floor finding (below-floor, untrusted-marketplace, version-unparsable); otherwise the floor is met |
| Install health | setup verify → Committed default set | install is marketplace |
| Install health | setup verify check 8i (adversarial reviewers) | adversarial-review.md resolves in the personal layer or .apache-magpie-overrides/ |
| Reconciliation | setup verify check 11 with setup reconcile → The sweep, its caller policy grants (check 3a) included | configured is true |
| Vetted-ops policy | setup verify check 11a (vetted-op-read approval-status) | a vetted-ops policy exists (committed, or in the personal layer) |
| Project configuration | setup config: Step 1 (requires_config per installed skill), Step 2a (pre-flight checker copy freshness) and Step 3b (the reconciliation stamp); layers answers Step 0 | configured is true |
| Local changes | setup verify 5d (what a shadowing personal file means) | shadowed is not empty |
| Local changes | the local agent settings against the template, and each family enabled for the user but not adopted here (keep or hide) (setup update → Reconcile the local agent settings) | always |
| Local changes | Claude Code's commit attribution against the project's convention: settings-items.md → Commit attribution | the harness is Claude Code |
| Isolated setup | setup-isolated-setup-verify checks with conditional-checks.md, and setup-isolated-setup-update → What to check with script-inventory.md (script-copy drift, settings shape drift, comdev MCP checkouts, the vetted-ops split) | isolated.attention is true |
| Isolated setup | container-gateway-drift.md, its SessionEnd gateway hook with no timeout entry: a Fix item for each file in gateway_sessionend.files, the managed drop-in's under Run these yourself (it needs sudo) | gateway_sessionend is not null, whatever isolated.attention says |
The Install health, Reconciliation and Vetted-ops policy rows, with Local changes 5d, are the whole of setup verify for this install, so a run of this skill is also a verify run: it writes verified_at (Re-check and record), and the pre-flight does not suggest a separate verify right after an upgrade.
A verify finding becomes a plan item like any other; one with no fix this skill may apply goes under Still open.
The isolated setup needs attention when isolated.state is in-use and either the secure-setup fingerprint changed since the last recorded setup-isolated-setup-update run, or that run is due (older than its interval, or never recorded).
in-use with no attention means nothing it checks has moved since that run on updated_at: the area gets no item, and the summary says so in one line.
opted-out drops the area, as a recorded decline.
unknown follows No isolated setup below; when its Check item confirms the setup is in use, gather the area before the second plan under the same condition.
When the summary is unavailable.
A checker copy older than gather fails with invalid choice: 'gather': read every source in the table, ignoring its condition, and ask setup_preflight.layers (same PYTHONPATH) for the personal layer.
The plan then carries the checker refresh that setup config Step 2a describes.
Where the personal layer is.
layers.personal_dir is the only place this run writes personal-layer configuration files; reconciled.json is written in layers.stamp_dir (this checkout's own layer, also in a linked worktree).
If the call fails with ModuleNotFoundError, read gather-fallbacks.md → No checker copy.
In a linked worktree of an adopted project that resolves to the main checkout's .apache-magpie-local/: name that path in the plan, and never create a .apache-magpie-local/ in the worktree.
The sandbox write scope.
For each directory a plan item would write to (the personal layer, the main checkout's one from a linked worktree, the worktree itself), create and remove a probe file there inside the sandbox; for a directory the item would create (a personal layer setup config would create), probe its nearest existing parent instead.
The directories where that works make up the gathered sandbox write scope; a write outside them carries [bypass].
Stale script copy or local edits.
When a user-scope script copy differs from its framework source, read script-copies.md for Gather, Plan and Apply.
Magpie installed but not configured here (no personal layer or no checker copy, no .apache-magpie-overrides/, no committed lock):
read gather-fallbacks.md → Magpie installed but not configured here.
No isolated setup.
When isolated.state is unknown, read isolated-setup.md → No isolated setup before the plan.
Probes the sandbox blocks are not run here.
A ~/.claude-config diff, a ~/.zshrc grep, the overlay _gui_available probe, the ~/.claude.json MCP projection: each becomes a [bypass] Check item, so the bypass is approved before it is used.
A probe that would read a credential file is not a Check item at all; it goes to Run these yourself.
Show one plan, in the layout of plan-format.md.
Groups are listed in this fixed order: Fix, Update, Add, Check.
Classify each item by the first rule that matches, in this order:
An item carries [bypass] when its action writes outside the gathered sandbox write scope (the directories where Gather's sandboxed probe write succeeded, in the nearest existing parent for a directory not created yet) or reads a path the sandbox denies: any write to a settings file (each worktree's .claude/settings.local.json, ~/.claude/settings.json), to ~/.claude-config/ or to ~/.claude/scripts/, and any probe of those or other denied paths.
A write to the personal layer (the main checkout's too, from a linked worktree) or the worktree inside that scope needs no bypass.
A harness without a bypass (Other harnesses) lists every such item under Run these yourself instead.
A [bypass] item executes only code the sandbox cannot write (see Golden rules); its helper call, copied content and an unreadable target: plan-format.md → Layout.
Script copies are classified as script-copies.md → Plan: script copies describes.
Settings items (a write to a worktree's .claude/settings.local.json or to ~/.claude/settings.json): what they may add or remove, including a family's keep-or-hide entry, is in settings-items.md; read it whenever the plan has one.
An item a hard line blocks goes under Run these yourself, never under Still open: the vetted-ops policy, any committed file (a needed change to the committed .claude/settings.json is shown there as a diff), or a credential read.
So do the two vetted-ops findings (a missing caller grant, an unapproved policy): hard-lines.md → 1.
A deny weakening or a removed sandbox restriction is never offered: it goes on a separate Not offered line with its reason and no command.
Still open holds the items Gather found but will not offer (such as a user-scope copy with local edits) plus, after Apply, the items skipped there (dropped, changed since gathering, failed); a hard-line item is never there.
The approval, and what drop, details and no do: plan-format.md → Approval grammar.
The isolated-setup offer, and the Check item that comes before it while the state is unknown: isolated-setup.md → The offer in the plan.
local_families candidates answering user-settings-unreadable inside the sandbox is unknown the same way; its Check item and the keep-or-hide question that follows: settings-items.md.
When nothing is actionable, as plan-format.md → Nothing to do defines it, say so in one line, run Re-check and record, and stop.
Every bypassed call executes only code the sandbox cannot write (see Golden rules). Work through the approved items in plan order:
changed since gathering; never overwrite it.
For a [bypass] target the sandbox cannot read, the comparison runs inside the item's one bypassed call, before its write.changed.
Only a plain-content script copy is ever copied; every other script entry is already under Run these yourself.script-copies.md → Apply.dangerouslyDisableSandbox: true only when the item carries [bypass] and the harness offers the flag.
Settings writes (their two targets, [bypass], the diff, the helper that owns the write): settings-items.md → Apply.
Each [bypass] item makes exactly one bypassed call here; the post-apply re-check read of an unreadable target runs under Re-check and record, covered by the same approval.✓ 4. allowlist added for 3 worktrees, ✗ 2. <reason>, or – 3. skipped: <reason>.Re-run the checks behind every applied item (a target the sandbox cannot read gets the one bypassed read its plan item named), then the standing probes. They run only when the isolated setup is in use and the harness is Claude Code; otherwise skip them and say so in the summary.
setup-isolated-setup-verify check 7, each as its own Bash call, never chained.git commit --no-verify --dry-run must be blocked.
A probe that now succeeds is a regression; report it at the top of the summary, not as a routine item.An item whose re-check still fails is Still open, never Done.
Then write the stamps the existing skills own, each through its own definition, never by hand (after a no, none):
verified_at, as setup verify → Writing verified_at defines it, because Gather ran every check of setup verify for this install.setup_preflight.isolated record-update (setup-isolated-setup-update → Record the run), only when this run gathered the Isolated setup area and no item of it was dropped, skipped or failed; otherwise leave that reminder armed and say so in the summary. Skip it when the isolated setup was declined, or when Gather left the area out because it needed no attention: the last run's record still stands.setup config Step 3b defines them, in the reconciled.json in layers.stamp_dir.settings-items.md.Then record this skill's own run, which stops every skill's pre-flight from asking again until the version moves next:
PYTHONPATH="$(magpie-python -I -c 'import hashlib,os,sys;h,d,m,i=sys.argv[1:];r=os.path.realpath(os.curdir);s=os.stat(r);p=os.path.join(h,d,hashlib.sha256(r.encode()).hexdigest()[:16]);f=os.path.join(p,i);print(p if os.path.isdir(os.path.join(p,m)) and os.path.isfile(f) and open(f).read().split()==[str(s.st_dev),str(s.st_ino)] else h)' "$HOME/.cache/apache-magpie/preflight" projects setup_preflight root-id)" \
MAGPIE_SKILL_DIR="<this skill's base directory>" \
magpie-python -P -m setup_preflight.upgrade record
Record it after a yes or a partial approval, even with items still open: the plan showed them and the summary lists them.
After a no, record nothing, so the next skill asks again.
MAGPIE_SKILL_DIR makes it record the version this session runs (a variable, so an older checker ignores it).
When the command cannot read the running version it exits 2; pass --version <version>, taken from the plugin's base-directory path.
Adopted project — the committed reconciliation stamp (fingerprint-moved after an upgrade) goes under Run these yourself as hard-lines.md → 2 renders it.
Short blocks, each line one item:
hard-lines.md renders them.Say when the standing probes were skipped, and when the isolated-setup reminder stays armed.
When an applied item changed a file under ~/.claude-config/, offer /magpie-setup:shared-config-sync.
When the user accepted the isolated-setup offer, hand off to setup-isolated-setup-install now.
On Codex, Antigravity, Pi, Goose or Copilot CLI, read other-harnesses.md: no [bypass] item is applied there.
gather-fallbacks.md (opens in a new tab)hard-lines.md (opens in a new tab)isolated-setup.md (opens in a new tab)launcher.md (opens in a new tab)move-the-version.md (opens in a new tab)other-harnesses.md (opens in a new tab)plan-format.md (opens in a new tab)script-copies.md (opens in a new tab)settings-items.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
"Upgrade magpie" or "update magpie"; a yes to a skill pre-flight saying Magpie changed since the last upgrade; the session-start notice that Magpie was updated.
Three short reads, in order
npx claudepluginhub apache/magpie --plugin magpie-setup12 skills in this plugin
/isolated-setup-doctorProbe the secure-agent setup for restrictions that block legitimate work — SSH agent reachability, port binding, containers, the scratch directory, the signing key, `gh` outside the sandbox, `prek` and `uv` inside it, the global git hook dir. Names the troubleshooting entry and settings fix for each. Read-only./isolated-setup-installWalk an adopter through the first-time install of the secure agent setup (sandbox, approval and clean-environment layers) for Claude Code, Codex, Antigravity, Pi or Goose. Interactive throughout; never runs sudo, edits a shell rc, or overwrites settings on its own./isolated-setup-updateReport drift between the installed secure setup and the framework's current one — checkout, pinned tools, user-scope script copies, denial commands, MCP checkouts. Read-only: it surfaces diffs and the user decides./isolated-setup-verifyCheck the secure agent setup against its checklist and report done, missing or partial for each item, with the evidence — paths, command output, versions. Covers Claude Code, Codex, Antigravity, Pi, Goose and Copilot CLI. Read-only./override-upstreamPromote a local `.apache-magpie-overrides/<skill>.md` into a PR against `apache/magpie`. Once it merges and the adopter upgrades, the override is redundant and the skill offers to remove it./privacy-llmDecide which LLMs this project's skills may send private foundation content to, then prove it. Detects the stack in use, writes <project-config>/privacy-llm.md, and runs the approved-model gate and the PII redactor end to end so the result is demonstrated rather than declared.Other plugins' skills for the same job