[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6X0ZRCT2PZP1XQFN57TNASD":3,"skill-same:01M6X0ZRCT2PZP1XQFN57TNASD":95},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":71,"commitSha":72,"skillDirectory":73,"forksCount":74,"repositoryHtmlUrl":75,"repositoryHomepageUrl":76,"ownerHtmlUrl":77,"ownerBlogUrl":78,"ownerDescription":79,"updatedAt":80,"install":81,"resources":94},"01M6X0ZRCT2PZP1XQFN57TNASD","gh-aw-enlistment",null,"Enlist a repository into Squad by installing the supported GitHub Agentic Workflows (gh-aw) bootstrap — with strict compilation, an explicit safe-update allowlist, and a human-reviewed bootstrap PR. Never auto-merges.","github\u002Fsquad","github","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F9919?v=4","01M6AC83DS133TPXFSP1DHNCC6","GitHub","01M6X0MZ6B0WYMMDPK3Q61KER6",3375,"MIT","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad\u002Fblob\u002Fdev\u002F.squad-templates\u002Fskills\u002Fgh-aw-enlistment\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"gh aw enlistment","gh","preflight","lock","github cli","pr creation","human","files","auto","guide","safe","Safety","ci","actions","compiling","update","squad","identity","agentic workflows","workflows","2026-11-10 10:12:30",false,"---\nname: \"gh-aw-enlistment\"\ndescription: \"Enlist a repository into Squad by installing the supported GitHub Agentic Workflows (gh-aw) bootstrap — with strict compilation, an explicit safe-update allowlist, and a human-reviewed bootstrap PR. Never auto-merges.\"\ndomain: \"github-integration, agentic-workflows, ci-bootstrap, safety-gated-automation\"\nconfidence: \"high\"\nsource: \"Operationalized from the authoritative Squad gh-aw guide (docs\u002Fsrc\u002Fcontent\u002Fdocs\u002Fguide\u002Fgh-aw.md) covering the supported install → compile → validate → bootstrap-PR path.\"\ntriggers: [set up Squad agentic workflows, enlist this repo in Squad, enlist my repository in Squad, install Squad gh-aw workflows, install Squad agentic workflows, add Squad gh aw workflows, bootstrap Squad in this repo, onboard this repo to Squad, set up \u002Fsquad slash commands, gh aw add squad]\ntools:\n  - name: \"gh\"\n    description: \"GitHub CLI — repo identity, Issues and Actions settings, PR creation, review request, and check watching.\"\n    when: \"Every step: preflight identity\u002Fauth, requiring Issues, enabling Actions-created PRs, opening and watching the bootstrap PR.\"\n  - name: \"gh aw\"\n    description: \"GitHub Agentic Workflows extension (github\u002Fgh-aw) — installs and strictly compiles the Squad workflow set.\"\n    when: \"Installing the immutable native Squad package and compiling its eight workflows into deterministic .lock.yml files.\"\n---\n\n## Context\n\nUse this skill when a user wants to **enlist a repository into Squad** through\n**GitHub Agentic Workflows (`gh aw`)** — e.g. \"set up Squad agentic workflows\",\n\"enlist this repo in Squad\", or \"install Squad gh-aw workflows\". The end state is\nthe `\u002Fsquad` slash command being live on the repo, delivered as a **human-reviewed\nbootstrap pull request** — never an auto-merge.\n\nThis skill **operationalizes** the supported bootstrap path. It does not summarize\nit: each step below is a gate with explicit success evidence and **STOP conditions**.\nThe authoritative source is `docs\u002Fsrc\u002Fcontent\u002Fdocs\u002Fguide\u002Fgh-aw.md` (mirrored at\n`https:\u002F\u002Fgithub.github.com\u002Fsquad\u002Fdocs\u002Fguide\u002Fgh-aw\u002F`). If that guide and this\nskill ever disagree, the guide wins — re-read it before proceeding.\n\nGitHub Issues are a hard prerequisite: `\u002Fsquad` commands arrive as issue\ncomments, and the merged bootstrap creates a research\u002Fproposals issue. Detect\nand enable Issues before creating the bootstrap branch or installing workflows,\nso the install cannot produce a PR whose post-merge bootstrap is unable to\ncomplete.\n\n**Portability contract:** resolve every target repository identifier (owner, repo,\ndefault branch) **at runtime**. Never hardcode a placeholder like `{owner}\u002F{repo}`.\nResolve the supported Squad channel once to a 40-character commit SHA, then use\nthat one immutable revision for the complete package.\n\n**Idempotency contract:** the bootstrap is re-runnable. Never clobber existing\nworkflows, prefer detecting prior state over duplicating it, and **stop clearly** on\nany unsafe or ambiguous condition rather than guessing.\n\n## Patterns\n\nRun these steps in order. Treat every \"STOP\" as a hard halt: report the exact\ncondition and wait for a human decision — do not work around it.\n\n### 0. Preflight — verify before you touch anything\n\n```bash\n# gh is authenticated on github.com\ngh auth status --hostname github.com\n\n# Prove the exact package-capable compiler version before creating artifacts\n# gh-aw-exact-version-start\nrequired_gh_aw_version=\"v0.91.5\"\ngh_aw_version_output=\"$(gh aw --version 2>&1)\" || gh_aw_version_output=\"\"\ngh_aw_version=\"$(printf '%s\\n' \"${gh_aw_version_output}\" | awk 'END {print $NF}')\"\n\nif [ \"${gh_aw_version}\" != \"${required_gh_aw_version}\" ]; then\n  echo \"Installing exact supported gh-aw ${required_gh_aw_version}.\"\n  gh extension remove gh-aw >\u002Fdev\u002Fnull 2>&1 || true\n  gh extension install --pin \"${required_gh_aw_version}\" github\u002Fgh-aw\n  gh_aw_version_output=\"$(gh aw --version 2>&1)\" || {\n    echo \"STOP: gh-aw version could not be verified after clean installation.\" >&2\n    exit 1\n  }\n  gh_aw_version=\"$(printf '%s\\n' \"${gh_aw_version_output}\" | awk 'END {print $NF}')\"\nfi\n\ntest \"${gh_aw_version}\" = \"${required_gh_aw_version}\" || {\n  echo \"STOP: required gh-aw v0.91.5, but found ${gh_aw_version:-unavailable} after clean installation.\" >&2\n  exit 1\n}\n# gh-aw-exact-version-end\n\n# Capture repository identity and default branch AT RUNTIME\nowner_repo=\"$(gh repo view --json nameWithOwner --jq '.nameWithOwner')\"\ndefault_branch=\"$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')\"\necho \"Repo: ${owner_repo}  Default branch: ${default_branch}\"\n\n# Git state must be understood and clean enough to isolate the install\ngit status --short\n```\n\n> **Portability — compiler check:** use the equivalent PowerShell commands to\n> capture both output streams from `gh aw --version`. On any mismatch, remove\n> `github\u002Fgh-aw`, cleanly install the exact `v0.91.5` pin, and verify both\n> streams again. Stop before branch creation or file generation unless that\n> second check proves exactly `v0.91.5`; never select a newer release.\n\n- **STOP** if `gh auth status --hostname github.com` is not logged in, or is logged in as the wrong\n  identity for this repo (see the `gh-auth-isolation` skill to operate as a\n  specific account without switching the global default).\n- **STOP** if `owner_repo` or `default_branch` cannot be resolved.\n- **STOP** if exact gh-aw `v0.91.5` cannot be proven after the clean pinned\n  reinstall. Do not create a branch or generate repository files.\n- **STOP** if the working tree has unrelated uncommitted changes you cannot\n  account for — the bootstrap must land as an isolated, reviewable change.\n- Confirm Copilot is enabled for the repository where checkable; the activation\n  run and the requested `@copilot` review both depend on it.\n\n### 1. Require GitHub Issues, then allow Actions-created PRs with a read-only token\n\nCheck the REST API's `has_issues` field first. If Issues are disabled, enable\nthem before touching the install:\n\n```bash\nissues_enabled=\"$(gh api \"repos\u002F${owner_repo}\" --jq '.has_issues')\"\nif [ \"${issues_enabled}\" != \"true\" ]; then\n  echo \"GitHub Issues are disabled; enabling them before workflow installation.\"\n  if ! gh api --method PATCH \"repos\u002F${owner_repo}\" \\\n    -F has_issues=true --silent; then\n    echo \"STOP: GitHub Issues are disabled and could not be enabled.\" >&2\n    echo \"A repository administrator must enable Settings > General > Features > Issues, then rerun enlistment.\" >&2\n    exit 1\n  fi\nfi\n\ntest \"$(gh api \"repos\u002F${owner_repo}\" --jq '.has_issues')\" = \"true\" || {\n  echo \"STOP: GitHub Issues must be enabled before installing Squad workflows.\" >&2\n  exit 1\n}\n```\n\nReading `.has_issues` is non-mutating. Updating it through\n`PATCH \u002Frepos\u002F{owner}\u002F{repo}` requires repository administration permission.\nIf the PATCH fails, **STOP before branch creation or `gh aw add`** and ask an\nadministrator to enable **Settings → General → Features → Issues**. Do not\ncontinue with a bootstrap PR that cannot complete after merge.\n\nSquad also opens PRs through GitHub Actions. Enable that **without** widening\nthe default workflow token:\n\n```bash\ngh api --method PUT \"repos\u002F${owner_repo}\u002Factions\u002Fpermissions\u002Fworkflow\" \\\n  -f default_workflow_permissions=read \\\n  -F can_approve_pull_request_reviews=false\n```\n\n`can_approve_pull_request_reviews` is a single, combined GitHub toggle: it\ndoes not just govern whether `GITHUB_TOKEN` can *submit an approving review*\n— the same switch also gates whether `GITHUB_TOKEN` is permitted to *create*\npull requests at all (GitHub returns the literal error \"GitHub Actions is not\npermitted to create or approve pull requests\" for both operations; they\ncannot be separated via job-level `permissions:` alone). GitHub's own API\nreference calls enabling it a security risk, so Squad keeps it `false` for\nleast privilege and never relies on `GITHUB_TOKEN` to self-approve.\n\nWith it `false`, the bootstrap job's own `github.rest.pulls.create` call will\nfail with that exact error. Squad's bootstrap workflow catches only that\nspecific error and falls back automatically: it still pushes the\n`squad\u002Fbootstrap-cast` branch (the Cast PR's own branch — distinct from the\n`chore\u002Fsquad-gh-aw-bootstrap` branch you create by hand in step 2 below),\nthen opens (or, on a rerun, reuses) a tracking issue containing a\nready-to-click GitHub compare URL\n(`...\u002Fcompare\u002F\u003Cbase>...squad\u002Fbootstrap-cast?expand=1&title=...`) so a\nhuman can open the PR manually in one click. Any other pull-request creation\nerror (for example, a PR that already exists) still fails the job normally —\nonly this one documented, exact permission error is treated as expected.\nEvery bootstrap and Cast PR, whichever way it is opened, still requires an\nindependent human (or `@copilot`) approving review before merge. Keep\n`default_workflow_permissions=read`; do not set it to `write`.\n\n### 2. Isolate the install on a bootstrap branch (preserve existing workflows)\n\n```bash\ngit switch -c chore\u002Fsquad-gh-aw-bootstrap\n```\n\n- If the branch already exists (a re-run), switch to it instead of recreating it.\n- **Never overwrite** an existing `.github\u002Fworkflows\u002F*.md` or `*.lock.yml` that is\n  not part of the Squad set. `gh aw add` is additive; if you see it about to\n  replace an unrelated workflow, **STOP**.\n\n### 3. Install the native package at an explicit, maintainer-approved revision\n\n`SQUAD_SHA` must be supplied by the caller before this step — a specific,\nalready-reviewed 40-character commit SHA. Never derive it by resolving the\n`dev` branch's current tip: `dev` is a continuously moving integration branch,\nso resolving it at install time installs whatever happens to be on it at that\nexact moment, with no maintainer vetting of that specific revision. Obtain the\ncurrent supported revision from the Squad maintainers or the project's\npublished release guidance, then set it once:\n\n```bash\n# SQUAD_SHA=\"\u003C40-character commit SHA supplied by the maintainers>\"\n: \"${SQUAD_SHA:?STOP: set SQUAD_SHA to an explicit, maintainer-approved 40-character Squad commit SHA before installing.}\"\n[[ \"${SQUAD_SHA}\" =~ ^[0-9a-f]{40}$ ]] || {\n  echo \"STOP: SQUAD_SHA must be the exact 40-character commit SHA, not a branch name or shortened hash.\" >&2\n  exit 1\n}\n# squad-package-identity-start\nsquad_package=\"$(gh api --hostname github.com -H 'Accept: application\u002Fvnd.github.raw+json' \\\n  \"repos\u002Fgithub\u002Fsquad\u002Fcontents\u002Fworkflows\u002Fsquad-workflows.manifest.json?ref=${SQUAD_SHA}\" \\\n  --jq '.package')\" || squad_package=\"\"\ntest \"${squad_package}\" = \"github\u002Fsquad\u002Fworkflows\" || {\n  if [ -z \"${squad_package}\" ]; then\n    echo \"STOP: cannot read workflows\u002Fsquad-workflows.manifest.json from github\u002Fsquad at ${SQUAD_SHA}.\" >&2\n    echo \"Check gh auth status --hostname github.com and network access, and confirm SQUAD_SHA is a github\u002Fsquad commit that has this manifest, then retry.\" >&2\n  else\n    echo \"STOP: Squad ${SQUAD_SHA} does not declare the github\u002Fsquad\u002Fworkflows package (found '${squad_package}').\" >&2\n    echo \"Use a revision whose manifest declares github\u002Fsquad\u002Fworkflows, or ask the Squad maintainers for one. Older revisions download the Squad CLI from the bradygaster\u002Fsquad fork, which has no releases.\" >&2\n  fi\n  exit 1\n}\n# squad-package-identity-end\ngh aw add \"github\u002Fsquad\u002Fworkflows@${SQUAD_SHA}\"\nrm -f .github\u002Fskills\u002Fagentic-workflows\u002FSKILL.md\n```\n\n`github\u002Fsquad\u002Fworkflows` verifies only at Squad revisions whose\n`workflows\u002Fsquad-workflows.manifest.json` declares\n`\"package\": \"github\u002Fsquad\u002Fworkflows\"`. The identity check above reads that\nmanifest at `SQUAD_SHA` and stops on any other revision. Do not install an\nolder revision under `bradygaster\u002Fsquad\u002Fworkflows` instead: its activation\ndownloads the Squad CLI from the separately controlled `bradygaster\u002Fsquad`\nfork, which has no releases. Use a revision whose manifest declares\n`github\u002Fsquad\u002Fworkflows`, or ask the Squad maintainers for one.\n\nThe nested `workflows\u002Faw.yml` is the only supported distribution registration.\nIt isolates package auto-discovery from unrelated repository skills and agents,\nand installs exactly eight workflows, seventeen runtime resources, and one\n`gh-aw-enlistment` skill at the same resolved revision:\n\n- `squad.md` + `squad.lock.yml`\n- `squad-implement-worker.md` + `squad-implement-worker.lock.yml`\n- `squad-review.md` + `squad-review.lock.yml`\n- `squad-deps-worker.md` + `squad-deps-worker.lock.yml`\n- `squad-retro.md` + `squad-retro.lock.yml`\n- `squad-improvement-worker.md` + `squad-improvement-worker.lock.yml`\n- `squad-bootstrap.md` + `squad-bootstrap.lock.yml`\n- `squad-command-router.md` + `squad-command-router.lock.yml`\n\n`squad-improvement-worker` is part of the standard, coherent install above —\nnot a separate opt-in add-on. It stays dormant until a maintainer approves a\ngovernance-scoped retrospective proposal (see the gh-aw guide's retrospective\nauto-implementation section); installing it alongside the other seven keeps the\nfull stack consistent and avoids a second bootstrap pass later.\n\ngh-aw v0.91.5 also materializes\n`.github\u002Fskills\u002Fagentic-workflows\u002FSKILL.md`. That generic tool-owned router is\nnot part of the Squad package and directs agents to mutable prompts from the\ncurrent `github\u002Fgh-aw` repository rather than the pinned Squad revision. Remove\nthat exact file after every `gh aw add`. Keep\n`.github\u002Fskills\u002Fgh-aw-enlistment\u002FSKILL.md`: it is the one Squad-owned skill and\nthe verifier requires its exact package bytes. Do not adopt or vendor the rest\nof gh-aw's generic scaffold.\n\nRevisions whose `workflows\u002Fsquad-workflows.manifest.json` declares\n`\"package\": \"github\u002Fsquad\u002Fworkflows\"` verify that identity and the legacy\n`bradygaster\u002Fsquad\u002Fworkflows` identity. Earlier revisions, including ones\ncommitted after the repository moved to `github\u002Fsquad`, declare and verify only\n`bradygaster\u002Fsquad\u002Fworkflows`, and installations made from them carry it in\ntheir ownership record, workflow `source:` lines, and locks. Those revisions\ndownload the Squad CLI from the separately controlled `bradygaster\u002Fsquad` fork,\nwhich has no releases, so move such an installation to a revision that declares\n`github\u002Fsquad\u002Fworkflows` with the block below. gh-aw keeps the superseded\n`.github\u002Faw\u002Fpackages\u002Fbradygaster-squad-workflows-3632054824e8.json` after the\nforced reinstall, so the block deletes exactly that file before verifying; the\nverifier fails closed while both ownership records exist. If the forced\nreinstall fails, the block stops before it removes anything. That first upgrade\nalso makes `gh aw add` report one safe-update change: action\n`github\u002Fsquad\u002F.github\u002Factions\u002Fsquad-init` added and\n`bradygaster\u002Fsquad\u002F.github\u002Factions\u002Fsquad-init` removed. It is the same\nsquad-init action under the repository's new owner; list it in the PR's\nsecurity review note. **STOP** on any other new secret or action. Until the\nupgrade is committed, every strict compile repeats that change as four\nwarnings, which step 5 allows only for this migration. Verifiers of revisions\nthat declare `github\u002Fsquad\u002Fworkflows` still accept the legacy identity, so an\nexisting installation keeps verifying while it moves, and they print a notice\nthat says to move it.\n\n```bash\n: \"${SQUAD_SHA:?STOP: set SQUAD_SHA to an explicit, maintainer-approved 40-character Squad commit SHA before upgrading.}\"\n[[ \"${SQUAD_SHA}\" =~ ^[0-9a-f]{40}$ ]] || {\n  echo \"STOP: SQUAD_SHA must be the exact 40-character commit SHA, not a branch name or shortened hash.\" >&2\n  exit 1\n}\nsquad_package=\"$(gh api --hostname github.com -H 'Accept: application\u002Fvnd.github.raw+json' \\\n  \"repos\u002Fgithub\u002Fsquad\u002Fcontents\u002Fworkflows\u002Fsquad-workflows.manifest.json?ref=${SQUAD_SHA}\" \\\n  --jq '.package')\" || squad_package=\"\"\ntest \"${squad_package}\" = \"github\u002Fsquad\u002Fworkflows\" || {\n  if [ -z \"${squad_package}\" ]; then\n    echo \"STOP: cannot read workflows\u002Fsquad-workflows.manifest.json from github\u002Fsquad at ${SQUAD_SHA}.\" >&2\n    echo \"Check gh auth status --hostname github.com and network access, and confirm SQUAD_SHA is a github\u002Fsquad commit that has this manifest, then retry.\" >&2\n  else\n    echo \"STOP: Squad ${SQUAD_SHA} does not declare the github\u002Fsquad\u002Fworkflows package (found '${squad_package}').\" >&2\n    echo \"Use a revision whose manifest declares github\u002Fsquad\u002Fworkflows, or ask the Squad maintainers for one. Older revisions download the Squad CLI from the bradygaster\u002Fsquad fork, which has no releases.\" >&2\n  fi\n  exit 1\n}\ngh aw add \"github\u002Fsquad\u002Fworkflows@${SQUAD_SHA}\" --force || {\n  echo \"STOP: gh aw add --force failed, so this block removed nothing. Fix the error above, then rerun the block.\" >&2\n  exit 1\n}\nrm -f .github\u002Fskills\u002Fagentic-workflows\u002FSKILL.md\nrm -f .github\u002Faw\u002Fpackages\u002Fbradygaster-squad-workflows-3632054824e8.json\nnode .github\u002Fworkflows\u002Fshared\u002Fsquad-install-verifier.mjs --materialize-runtime\ngh aw compile --strict\nnode .github\u002Fworkflows\u002Fshared\u002Fsquad-install-verifier.mjs \\\n  --verify-install \\\n  --source-revision \"${SQUAD_SHA}\" \\\n  --strict-compile\n```\n\nApply step 5's warning check, including its legacy-identity migration allowlist, to the compile output above, then stage and verify as in step 7.\n\nReport\u002Fproposal-only is the default. Ordinary fixes require the explicit\n`\"squadRetroAutoImplement\": \"allow\"` setting in `.squad\u002Fconfig.json`;\nfive action issues and three dispatches per wake-up remain separate caps.\nAn improvement requires `\u002Fsquad approve-improvement`, `Approved-Revision:`\nand exact `Approved-Path:` lines from a human with write\u002Fmaintain\u002Fadmin access.\nThe dispatcher sends nested issue and approval-comment IDs to the worker;\nmanual retries use those same IDs. `\u002Fsquad revoke-improvement` is reserved\nwithout dispatch and is rechecked before outputs. Draft PRs and human merge\nremain mandatory; closed-unmerged PRs never cause automatic replacements.\nSee the guide for content-hash calculation and the one-retry recovery policy.\n\n`SQUAD_SHA` is supplied explicitly by the caller, never resolved from `dev`'s\nmoving tip; the install itself only ever installs that one immutable,\nalready-approved revision.\n\n### 4. Review the first-install safe-update report — approve ONLY the documented entries\n\nOn a clean repo, `gh aw add` reports these expected safe updates and **nothing else**:\n\n\u003C!-- allowlist-start -->\n- Restricted secrets: **`GH_AW_GITHUB_READ_APP_PRIVATE_KEY`**, **`SQUAD_GITHUB_APP_PRIVATE_KEY`**, and **`SQUAD_GITHUB_TOKEN`**\n- Action: **`github\u002Fsquad\u002F.github\u002Factions\u002Fsquad-init`**\n\u003C!-- allowlist-end -->\n\n> **These are referenced names, not prerequisites.** `gh aw add` lists the secrets\n> the workflows *reference* so you can approve that surface — it is not asking you\n> to supply them. All three secrets are optional, they need not exist, and none is\n> required to enlist a repository. Single-repo activation runs on the built-in\n> `github.token`. Configure them only for cross-repo access, elevated\n> permissions, or optional CAO evidence collection. Auth precedence: GitHub App token, then the PAT, then\n> `github.token`. Never block an enlistment waiting for a credential.\n\nIf — and only if — the report contains exactly those documented entries, complete\nthe one-time approval:\n\n```bash\ngh aw compile --strict --approve   # first install only, when the safe-update warning appears\n```\n\n- **STOP** if the report lists **any other secret** or **any other action**. Do not\n  approve. Report the unexpected entry verbatim and wait for a human.\n- This `--approve` step is *only* the first-install unblock. It is **not** a\n  substitute for the final strict compile in the next step.\n\n### 5. Always run the final strict compile WITHOUT `--approve`\n\n```bash\nnode .github\u002Fworkflows\u002Fshared\u002Fsquad-install-verifier.mjs --materialize-runtime\ngh aw compile --strict\nnode .github\u002Fworkflows\u002Fshared\u002Fsquad-install-verifier.mjs \\\n  --verify-install \\\n  --source-revision \"${SQUAD_SHA}\" \\\n  --strict-compile\n```\n\nThis must run after any first-install approval and before committing. Success\ncriteria:\n\n- All eight workflows compile successfully.\n- With gh-aw v0.91.5, require exactly two warnings, one occurrence of each\n  exact diagnostic header below (including its workflow path):\n\n\u003C!-- compile-warning-allowlist-start -->\n```text\n.github\u002Fworkflows\u002Fsquad-review.md: warning: pull_request_target is a very dangerous trigger.\n.github\u002Fworkflows\u002Fsquad.md: warning: Both slash_command and bots triggers are configured. If a bot listed in bots: posts a comment that starts with the slash command text (e.g., \u002Fcommand-name), it will trigger the workflow and occupy the concurrency slot, potentially blocking simultaneous manual invocations. To ensure the workflow only runs on explicit user commands, remove the 'bots:' field.\n```\n\u003C!-- compile-warning-allowlist-end -->\n\nThe native review advisory includes the compiler's standard explanation and\nSecurity Lab link. The following guard-policy dry-run lines are informational,\nnot another warning. The bot-trigger warning is expected because\n`github-actions[bot]` enables controlled worker-continuation dispatches.\n\nAccept the native review advisory **only while all existing controls remain**:\nsame-repository head restriction, base-controlled workflow source,\n`checkout: false` agent path, API-only inspection, exact run\u002Fhead\u002Fattempt guard,\nleast-privilege jobs, advisory verdict, and independent human approval.\n`pull_request_target` is not generally safe; this narrow exception neither\nweakens those controls nor authorizes PR-head execution.\n\n**Legacy-identity migration only.** While step 3's upgrade block moves an\ninstallation whose locks committed at `HEAD` still use\n`bradygaster\u002Fsquad\u002F.github\u002Factions\u002Fsquad-init`, gh-aw v0.91.5 compares safe\nupdates against those committed locks, and `--approve` cannot clear that\ncomparison before the upgrade is committed. During that migration, also\nrequire exactly these four warnings, one occurrence of each exact diagnostic\nheader:\n\n\u003C!-- compile-warning-migration-allowlist-start -->\n```text\n.github\u002Fworkflows\u002Fsquad.md: warning: safe update mode detected unapproved changes\n.github\u002Fworkflows\u002Fsquad-implement-worker.md: warning: safe update mode detected unapproved changes\n.github\u002Fworkflows\u002Fsquad-deps-worker.md: warning: safe update mode detected unapproved changes\n.github\u002Fworkflows\u002Fsquad-retro.md: warning: safe update mode detected unapproved changes\n```\n\u003C!-- compile-warning-migration-allowlist-end -->\n\nEach of these four warnings must report exactly this squad-init owner\nreplacement, with no other secret, action, redirect, or change:\n\n\u003C!-- compile-warning-migration-changes-start -->\n```text\nNew unapproved action(s):\n  - github\u002Fsquad\u002F.github\u002Factions\u002Fsquad-init\nPreviously-approved action(s) removed:\n  - bradygaster\u002Fsquad\u002F.github\u002Factions\u002Fsquad-init\n```\n\u003C!-- compile-warning-migration-changes-end -->\n\nThe remediation text under each warning and the closing `SECURITY REVIEW\nREQUIRED` prompts belong to these four warnings; they are not additional\nwarnings. The summary is then `Compiled 8 workflows: 8 succeeded, 6 warnings`.\nName the replacement in the PR's security review note. The four warnings no\nlonger appear once the upgrade is committed.\n\n**STOP** on any error, or on **any additional warning** beyond these two exact\ndocumented diagnostics and, during that migration only, the four exact\nsquad-init replacement warnings. Also STOP if an allowed warning is missing,\nduplicated, changed, or attributed to another path, if the summary is not\n`Compiled 8 workflows: 8 succeeded, 2 warnings` (`6 warnings` during that\nmigration), or if any required control is absent. Do not suppress warnings or\nuse `--approve` to bypass this gate.\n\n### 6. Require the verifier to prove the complete consumer contract\n\n- **STOP** if the verifier reports a missing source\u002Flock pair, missing package\n  ownership record, stale source\u002Fresource digest, incomplete eight-workflow\n  registration, or mixed revision.\n- Use only the recovery commands printed by the verifier. They reinstall the\n  complete package at one immutable revision; never repair one workflow or\n  resource in isolation.\n\n### 7. Inspect generated files, then stage only the documented surfaces\n\nDownloaded workflow audit data is local diagnostic output — **do not commit it**.\nIf `.github\u002Faw\u002Flogs\u002F` lacks a `.gitignore`, add one there:\n\n```gitignore\n# Ignore all downloaded workflow logs\n*\n\n# But keep this file\n!.gitignore\n```\n\n`gh aw add` may also create `.vscode\u002Fsettings.json` (enables Copilot for Markdown\nworkflow files). This is an **optional editor setting** — the stage command below\nintentionally leaves it untracked. Delete it if unwanted, or stage it explicitly\nif your team wants to share it. Decide deliberately; do not stage it by accident.\n\nStage **only** the documented generated surfaces, then verify the staged set:\n\n```bash\ngit add -- .gitattributes .github\u002Faw\u002F .github\u002Fworkflows\u002F .github\u002Fskills\u002F\nnode .github\u002Fworkflows\u002Fshared\u002Fsquad-install-verifier.mjs \\\n  --verify-staged-install --stage-ownership --source-revision \"${SQUAD_SHA}\" || exit 1\ngit diff --cached --stat\nunexpected_deletions=\"$(\n  git diff --cached --diff-filter=D --name-only |\n    grep -vxF -e '.github\u002Fskills\u002Fagentic-workflows\u002FSKILL.md' |\n    while IFS= read -r path; do\n      # Also allowed: any Squad ownership record except the one gh-aw writes for github\u002Fsquad\u002Fworkflows.\n      if [[ \"${path}\" =~ ^\\.github\u002Faw\u002Fpackages\u002F[^\u002F]+\\.json$ ]] &&\n        [ \"${path}\" != '.github\u002Faw\u002Fpackages\u002Fgithub-squad-workflows-23a7638f599e.json' ] &&\n        git show \"HEAD:${path}\" | node -e '\n          const accepted = [\"github\u002Fsquad\u002Fworkflows\", \"bradygaster\u002Fsquad\u002Fworkflows\"];\n          let text = \"\";\n          process.stdin.on(\"data\", chunk => { text += chunk; }).on(\"end\", () => {\n            let name;\n            try { name = JSON.parse(text).package; } catch {}\n            process.exit(typeof name === \"string\" && accepted.includes(name.toLowerCase()) ? 0 : 1);\n          });'; then\n        continue\n      fi\n      printf '%s\\n' \"${path}\"\n    done || true\n)\"\ntest -z \"${unexpected_deletions}\" || {\n  printf 'STOP: unexpected staged deletions:\\n%s\\n' \"${unexpected_deletions}\" >&2\n  exit 1\n}\n```\n\n- The only permitted staged deletions are\n  `.github\u002Fskills\u002Fagentic-workflows\u002FSKILL.md`, when upgrading a repository that\n  previously committed gh-aw's mutable router, and a `.github\u002Faw\u002Fpackages\u002F*.json`\n  ownership record whose `package` is `github\u002Fsquad\u002Fworkflows` or\n  `bradygaster\u002Fsquad\u002Fworkflows` in any letter case, other than\n  `.github\u002Faw\u002Fpackages\u002Fgithub-squad-workflows-23a7638f599e.json`, the record gh-aw\n  writes for `github\u002Fsquad\u002Fworkflows`. Those are the records the verifier tells\n  you to delete, such as the superseded\n  `.github\u002Faw\u002Fpackages\u002Fbradygaster-squad-workflows-3632054824e8.json` when moving\n  an existing installation off the legacy `bradygaster\u002Fsquad\u002Fworkflows` identity.\n- **STOP** if the staged diff shows any other **unexpected deletions**, **unexpected secrets**,\n  edits to **unrelated files**, or committed **log\u002Fdiagnostic output**. Re-scope with\n  explicit `git add -- \u003Cpath>` — never `git add .`, `git add -A`, or `git commit -a`.\n\nConsumer rules such as `packages\u002F` can silently ignore the required ownership\nJSON under `.github\u002Faw\u002Fpackages\u002F`. The staged verifier force-adds only the exact\nnative package ownership JSON when it is ignored and untracked. It then verifies\nevery manifest-required source, lock, runtime, skill, manifest and ownership\nfile against the validated working-tree bytes in a snapshot of the Git index.\n**STOP before commit\u002Fpush** on missing metadata, a staging failure, an omitted\nrequired file or a staged digest mismatch. Never force-add a directory or glob.\nRerun this gate after changing or restaging any installation file.\n\n### 8. Commit, push, and open the bootstrap PR to the captured default branch\n\n```bash\ngit commit -m \"ci: add Squad agentic workflow\"\ngit push -u origin HEAD\ngh pr create \\\n  --base \"${default_branch}\" \\\n  --title \"ci: add Squad agentic workflow\" \\\n  --body \"Installs and strictly compiles the supported Squad GH-AW workflows.\"\n\n# Copilot's review identity is a GraphQL Bot, not a User\u002FTeam — the REST\n# `gh pr edit --add-reviewer @copilot` path silently no-ops for it. Request the\n# review through the verified GraphQL path instead:\npr_node_id=\"$(gh pr view --json id --jq '.id')\"\ngh api graphql -f query='\n  mutation($pr: ID!) {\n    requestReviewsByLogin(input: { pullRequestId: $pr, botLogins: [\"copilot-pull-request-reviewer\"] }) {\n      pullRequest { number }\n    }\n  }' -f pr=\"${pr_node_id}\" || echo \"Could not request a Copilot review via GraphQL; open the PR in the GitHub UI and add Copilot as a reviewer manually (Reviewers -> Copilot).\" >&2\ngh pr checks --watch\n```\n\n- Open the PR against the **runtime-captured** `${default_branch}`, not a hardcoded\n  `main`.\n- Request Copilot review via the GraphQL `requestReviewsByLogin` mutation\n  (never the REST `--add-reviewer` shortcut, which silently no-ops for the\n  Copilot Bot reviewer), address feedback, and wait for required checks. If\n  the GraphQL call fails, add Copilot as a reviewer manually from the PR's\n  GitHub UI.\n\n### 9. Verify the native review contract after merge\n\nThe installation PR remains an explicit human trust boundary. After a human\nmerges it, inspect the Cast PR — automatically opened, or manually opened by a\nhuman from the bootstrap fallback issue's compare-URL link when\n`GITHUB_TOKEN` cannot create it directly — and require the native\n`Squad Review \u002F review` job from the base-controlled `pull_request_target`\nworkflow to succeed. Verify the exact workflow path, immutable base\u002Fworkflow\nSHA, PR base\u002Fhead, run ID and attempt, successful `review` job, and exact-head\nGitHub Actions check-run binding.\n\nThis review path uses only the native GitHub Actions\u002Fgh-aw runtime identity.\nNever request or provision a reviewer PAT, GitHub App, private key, secret,\nenvironment, hosted attestor, callback, or external service. The optional\n`SQUAD_GITHUB_APP_*` and `SQUAD_GITHUB_TOKEN` activation credentials remain\nunrelated to reviewer authority.\n\nFor authoritative merge enforcement, use a source-bound required-workflow or\nequivalent ruleset when available. A context-only requirement for\n`Squad Review \u002F review` is advisory because a PR-controlled workflow may be\nable to emit the same workflow\u002Fjob name through the shared GitHub Actions\nidentity. If source-bound enforcement is unavailable, retain independent human\nreview rather than relying on that context alone or adding a credential-based\npublisher. Require branches to be up to date before merge (or use an equivalent\nmerge-queue freshness guarantee), and enable the required context only after\nthe workflow installation is merged and the post-merge Cast canary succeeds.\n\n### 10. Never auto-merge — and explain what comes next\n\n- **Never** merge the bootstrap PR yourself. Merge happens **only** after human\n  approval.\n- Make the two-PR flow explicit to the user: after the workflow-installation PR\n  reaches the default branch, `squad-bootstrap` normally creates one **draft,\n  human-reviewed Cast PR** and one linked\n  `[Agentic Research] owner\u002Frepo — initial proposals` issue (using the runtime\n  repository and retaining any committed reset suffix) from the\n  same validated repository analysis. This is a proposal agenda, not completed\n  research. Update and verify the complete package before optionally renaming\n  an existing bootstrap issue; legacy exact titles remain recognized, and\n  completed bootstrap does not auto-rename them. Preserve its reset suffix,\n  body, comments, and provenance. If `can_approve_pull_request_reviews`\n  is `false` (the recommended, least-privilege setting from step 4),\n  `GITHUB_TOKEN` cannot open that PR either; `squad-bootstrap` instead opens a\n  **bot-authored fallback issue** carrying a signed provenance record and a\n  ready-to-click compare URL, and Squad Review accepts the resulting\n  manually-opened PR in that one narrowly-scoped case (see \"Optional: PAT\n  fallback\" and the fallback-issue provenance contract in\n  `docs\u002Fsrc\u002Fcontent\u002Fdocs\u002Fguide\u002Fgh-aw.md` for the exact trust conditions).\n  On the fallback path, no automatic trigger re-runs `squad-bootstrap` at any\n  point — **not** when the human opens that compare-URL PR, and **not** when\n  they later merge it either: `squad-bootstrap`'s push trigger only watches\n  the Squad workflow-source paths (for example `.github\u002Fworkflows\u002Fsquad*.md`),\n  and the manually-opened PR never touches any of those paths. The fallback\n  issue itself tells the user to manually re-run the Squad Bootstrap workflow\n  (`workflow_dispatch`) — either now, while the PR is still open, or anytime\n  after merging it — which deterministically detects the PR (open or merged)\n  and creates the linked research-proposals issue; no automatic trigger ever\n  does this for them. Either way, the user reviews and merges the Cast PR, then follows the\n  research issue's `\u002Fsquad research`, `\u002Fsquad triage`, `\u002Fsquad plan`, and\n  `\u002Fsquad activate` instructions until assignable implementation issues exist.\n\n## Examples\n\n### ✓ Correct: runtime-resolved identity, allowlist honored, human-reviewed\n\n```bash\nowner_repo=\"$(gh repo view --json nameWithOwner --jq '.nameWithOwner')\"\ndefault_branch=\"$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')\"\n\nissues_enabled=\"$(gh api \"repos\u002F${owner_repo}\" --jq '.has_issues')\"\nif [ \"${issues_enabled}\" != \"true\" ]; then\n  if ! gh api --method PATCH \"repos\u002F${owner_repo}\" \\\n    -F has_issues=true --silent; then\n    echo \"STOP: GitHub Issues are disabled and could not be enabled.\" >&2\n    echo \"A repository administrator must enable Settings > General > Features > Issues, then rerun enlistment.\" >&2\n    exit 1\n  fi\nfi\n\ntest \"$(gh api \"repos\u002F${owner_repo}\" --jq '.has_issues')\" = \"true\" || {\n  echo \"STOP: GitHub Issues must be enabled before installing Squad workflows.\" >&2\n  exit 1\n}\n\ngh api --method PUT \"repos\u002F${owner_repo}\u002Factions\u002Fpermissions\u002Fworkflow\" \\\n  -f default_workflow_permissions=read -F can_approve_pull_request_reviews=false\n\ngit switch -c chore\u002Fsquad-gh-aw-bootstrap\n# SQUAD_SHA is supplied explicitly (maintainer-approved), never resolved from dev's tip\n: \"${SQUAD_SHA:?STOP: set SQUAD_SHA to an explicit, maintainer-approved 40-character Squad commit SHA.}\"\n[[ \"${SQUAD_SHA}\" =~ ^[0-9a-f]{40}$ ]] || {\n  echo \"STOP: SQUAD_SHA must be an explicit, maintainer-approved 40-character lowercase hex commit SHA.\" >&2\n  exit 1\n}\nsquad_package=\"$(gh api --hostname github.com -H 'Accept: application\u002Fvnd.github.raw+json' \\\n  \"repos\u002Fgithub\u002Fsquad\u002Fcontents\u002Fworkflows\u002Fsquad-workflows.manifest.json?ref=${SQUAD_SHA}\" \\\n  --jq '.package')\" || squad_package=\"\"\ntest \"${squad_package}\" = \"github\u002Fsquad\u002Fworkflows\" || {\n  if [ -z \"${squad_package}\" ]; then\n    echo \"STOP: cannot read workflows\u002Fsquad-workflows.manifest.json from github\u002Fsquad at ${SQUAD_SHA}.\" >&2\n    echo \"Check gh auth status --hostname github.com and network access, and confirm SQUAD_SHA is a github\u002Fsquad commit that has this manifest, then retry.\" >&2\n  else\n    echo \"STOP: Squad ${SQUAD_SHA} does not declare the github\u002Fsquad\u002Fworkflows package (found '${squad_package}').\" >&2\n    echo \"Use a revision whose manifest declares github\u002Fsquad\u002Fworkflows, or ask the Squad maintainers for one. Older revisions download the Squad CLI from the bradygaster\u002Fsquad fork, which has no releases.\" >&2\n  fi\n  exit 1\n}\ngh aw add \"github\u002Fsquad\u002Fworkflows@${SQUAD_SHA}\"\nrm -f .github\u002Fskills\u002Fagentic-workflows\u002FSKILL.md\n\n# Safe-update report shows ONLY the three documented secrets + squad-init → approve once\ngh aw compile --strict --approve\nnode .github\u002Fworkflows\u002Fshared\u002Fsquad-install-verifier.mjs --materialize-runtime\ngh aw compile --strict           # final, no --approve; exactly the two documented warnings remain\nnode .github\u002Fworkflows\u002Fshared\u002Fsquad-install-verifier.mjs \\\n  --verify-install --source-revision \"${SQUAD_SHA}\" --strict-compile\n\ngit add -- .gitattributes .github\u002Faw\u002F .github\u002Fworkflows\u002F .github\u002Fskills\u002F\nnode .github\u002Fworkflows\u002Fshared\u002Fsquad-install-verifier.mjs \\\n  --verify-staged-install --stage-ownership --source-revision \"${SQUAD_SHA}\" || exit 1\ngit commit -m \"ci: add Squad agentic workflow\"\ngit push -u origin HEAD\ngh pr create --base \"${default_branch}\" \\\n  --title \"ci: add Squad agentic workflow\" \\\n  --body \"Installs and strictly compiles the supported Squad GH-AW workflows.\"\npr_node_id=\"$(gh pr view --json id --jq '.id')\"\ngh api graphql -f query='\n  mutation($pr: ID!) {\n    requestReviewsByLogin(input: { pullRequestId: $pr, botLogins: [\"copilot-pull-request-reviewer\"] }) {\n      pullRequest { number }\n    }\n  }' -f pr=\"${pr_node_id}\"   # Bot-aware review request; then wait for review + checks; DO NOT merge\n```\n\n### ✓ Correct: STOP on an undocumented safe-update entry\n\n```text\ngh aw add reports an undocumented secret: `ACME_DEPLOY_KEY`.\n→ This is NOT in the allowlist (GH_AW_GITHUB_READ_APP_PRIVATE_KEY, SQUAD_GITHUB_APP_PRIVATE_KEY, SQUAD_GITHUB_TOKEN)\n  and is NOT the squad-init action. Do NOT run `--approve`.\n  Halt, report \"unexpected safe-update entry: ACME_DEPLOY_KEY\", and wait.\n```\n\n### ✗ Incorrect: hardcoded target and blanket staging\n\n```bash\n# BAD: hardcoded owner\u002Frepo and default branch\ngh api --method PUT \"repos\u002Facme\u002Fwidgets\u002Factions\u002Fpermissions\u002Fworkflow\" ...\ngh pr create --base main ...        # wrong if the default branch isn't `main`\n\n# BAD: blanket staging captures logs, editor settings, and unrelated changes\n# Stage only the generated bootstrap paths listed above.\n```\n\n### ✗ Incorrect: skipping the final strict compile or auto-merging\n\n```bash\ngh aw compile --strict --approve    # approved first install...\n# ...then committed WITHOUT the final `gh aw compile --strict` (no --approve). WRONG.\ngh pr merge --squash                # auto-merge before human review. NEVER.\n```\n\n## Anti-Patterns\n\n- ❌ **Hardcoding repository identifiers.** Always resolve `owner\u002Frepo` and the\n  default branch at runtime with `gh repo view`.\n- ❌ **Installing while GitHub Issues are disabled.** `\u002Fsquad` commands and the\n  bootstrap research\u002Fproposals issue require Issues. Enable them first, or stop\n  before installation if repository administration permission is unavailable.\n- ❌ **Blanket staging** (`git add .` \u002F `-A` \u002F `git commit -a`). Stage only\n  `.gitattributes`, `.github\u002Faw\u002F`, `.github\u002Fworkflows\u002F`, `.github\u002Fskills\u002F`, by path.\n- ❌ **Committing gh-aw's mutable router.** Remove only\n  `.github\u002Fskills\u002Fagentic-workflows\u002FSKILL.md`; keep the exact Squad-owned\n  `.github\u002Fskills\u002Fgh-aw-enlistment\u002FSKILL.md`.\n- ❌ **Approving unknown safe updates.** Approve ONLY `GH_AW_GITHUB_READ_APP_PRIVATE_KEY`, `SQUAD_GITHUB_APP_PRIVATE_KEY`,\n  `SQUAD_GITHUB_TOKEN`, and `github\u002Fsquad\u002F.github\u002Factions\u002Fsquad-init`. Anything\n  else is a STOP.\n- ❌ **Treating `--approve` as the final compile.** Always finish with a plain\n  `gh aw compile --strict` (no `--approve`).\n- ❌ **Tolerating extra warnings.** Only the documented `squad-review.md`\n  `pull_request_target` advisory and `squad.md` bot-trigger warning are allowed,\n  plus step 5's four squad-init replacement warnings during the legacy-identity\n  migration only; every other warning or error halts the run.\n- ❌ **Committing diagnostics.** Never commit `.github\u002Faw\u002Flogs\u002F` output; add the\n  log `.gitignore` if missing.\n- ❌ **Clobbering existing workflows.** The install is additive; preserve unrelated\n  `.github\u002Fworkflows\u002F` files.\n- ❌ **Widening the default token.** Keep `default_workflow_permissions=read`.\n- ❌ **Auto-merging.** The workflow-installation PR and the Cast PR (automatic\n  or manually opened from the fallback issue) are both human-reviewed. The\n  dedicated bootstrap wakes only after installation lands on the default\n  branch.\n- ❌ **Opening the PR before the package verifier and strict compile pass.**\n","## Context\n\nUse this skill when a user wants to **enlist a repository into Squad** through\n**GitHub Agentic Workflows (`gh aw`)** — e.g. \"set up Squad agentic workflows\",\n\"enlist this repo in Squad\", or \"install Squad gh-aw workflows\". The end state is\nthe `\u002Fsquad` slash command being live on the repo, delivered as a **human-reviewed\nbootstrap pull request** — never an auto-merge.\n\nThis skill **operationalizes** the supported bootstrap path. It does not summarize\nit: each step below is a gate with explicit success evidence and **STOP conditions**.\nThe authoritative source is `docs\u002Fsrc\u002Fcontent\u002Fdocs\u002Fguide\u002Fgh-aw.md` (mirrored at\n`https:\u002F\u002Fgithub.github.com\u002Fsquad\u002Fdocs\u002Fguide\u002Fgh-aw\u002F`). If that guide and this\nskill ever disagree, the guide wins — re-read it before proceeding.\n\nGitHub Issues are a hard prerequisite: `\u002Fsquad` commands arrive as issue\ncomments, and the merged bootstrap creates a research\u002Fproposals issue. Detect\nand enable Issues before creating the bootstrap branch or installing workflows,\nso the install cannot produce a PR whose post-merge bootstrap is unable to\ncomplete.\n\n**Portability contract:** resolve every target repository identifier (owner, repo,\ndefault branch) **at runtime**. Never hardcode a placeholder like `{owner}\u002F{repo}`.\nResolve the supported Squad channel once to a 40-character commit SHA, then use\nthat one immutable revision for the complete package.\n\n**Idempotency contract:** the bootstrap is re-runnable. Never clobber existing\nworkflows, prefer detecting prior state over duplicating it, and **stop clearly** on\nany unsafe or ambiguous condition rather than guessing.\n\n## Patterns\n\nRun these steps in order. Treat every \"STOP\" as a hard halt: report the exact\ncondition and wait for a human decision — do not work around it.\n\n### 0. Preflight — verify before you touch anything\n\n```bash\n# gh is authenticated on github.com\ngh auth status --hostname github.com\n\n# Prove the exact package-capable compiler version before creating artifacts\n# gh-aw-exact-version-start\nrequired_gh_aw_version=\"v0.91.5\"\ngh_aw_version_output=\"$(gh aw --version 2>&1)\" || gh_aw_version_output=\"\"\ngh_aw_version=\"$(printf '%s\\n' \"${gh_aw_version_output}\" | awk 'END {print $NF}')\"\n\nif [ \"${gh_aw_version}\" != \"${required_gh_aw_version}\" ]; then\n  echo \"Installing exact supported gh-aw ${required_gh_aw_version}.\"\n  gh extension remove gh-aw >\u002Fdev\u002Fnull 2>&1 || true\n  gh extension install --pin \"${required_gh_aw_version}\" github\u002Fgh-aw\n  gh_aw_version_output=\"$(gh aw --version 2>&1)\" || {\n    echo \"STOP: gh-aw version could not be verified after clean installation.\" >&2\n    exit 1\n  }\n  gh_aw_version=\"$(printf '%s\\n' \"${gh_aw_version_output}\" | awk 'END {print $NF}')\"\nfi\n\ntest \"${gh_aw_version}\" = \"${required_gh_aw_version}\" || {\n  echo \"STOP: required gh-aw v0.91.5, but found ${gh_aw_version:-unavailable} after clean installation.\" >&2\n  exit 1\n}\n# gh-aw-exact-version-end\n\n# Capture repository identity and default branch AT RUNTIME\nowner_repo=\"$(gh repo view --json nameWithOwner --jq '.nameWithOwner')\"\ndefault_branch=\"$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')\"\necho \"Repo: ${owner_repo}  Default branch: ${default_branch}\"\n\n# Git state must be understood and clean enough to isolate the install\ngit status --short\n```\n\n> **Portability — compiler check:** use the equivalent PowerShell commands to\n> capture both output streams from `gh aw --version`. On any mismatch, remove\n> `github\u002Fgh-aw`, cleanly install the exact `v0.91.5` pin, and verify both\n> streams again. Stop before branch creation or file generation unless that\n> second check proves exactly `v0.91.5`; never select a newer release.\n\n- **STOP** if `gh auth status --hostname github.com` is not logged in, or is logged in as the wrong\n  identity for this repo (see the `gh-auth-isolation` skill to operate as a\n  specific account without switching the global default).\n- **STOP** if `owner_repo` or `default_branch` cannot be resolved.\n- **STOP** if exact gh-aw `v0.91.5` cannot be proven after the clean pinned\n  reinstall. Do not create a branch or generate repository files.\n- **STOP** if the working tree has unrelated uncommitted changes you cannot\n  account for — the bootstrap must land as an isolated, reviewable change.\n- Confirm Copilot is enabled for the repository where checkable; the activation\n  run and the requested `@copilot` review both depend on it.\n\n### 1. Require GitHub Issues, then allow Actions-created PRs with a read-only token\n\nCheck the REST API's `has_issues` field first. If Issues are disabled, enable\nthem before touching the install:\n\n```bash\nissues_enabled=\"$(gh api \"repos\u002F${owner_repo}\" --jq '.has_issues')\"\nif [ \"${issues_enabled}\" != \"true\" ]; then\n  echo \"GitHub Issues are disabled; enabling them before workflow installation.\"\n  if ! gh api --method PATCH \"repos\u002F${owner_repo}\" \\\n    -F has_issues=true --silent; then\n    echo \"STOP: GitHub Issues are disabled and could not be enabled.\" >&2\n    echo \"A repository administrator must enable Settings > General > Features > Issues, then rerun enlistment.\" >&2\n    exit 1\n  fi\nfi\n\ntest \"$(gh api \"repos\u002F${owner_repo}\" --jq '.has_issues')\" = \"true\" || {\n  echo \"STOP: GitHub Issues must be enabled before installing Squad workflows.\" >&2\n  exit 1\n}\n```\n\nReading `.has_issues` is non-mutating. Updating it through\n`PATCH \u002Frepos\u002F{owner}\u002F{repo}` requires repository administration permission.\nIf the PATCH fails, **STOP before branch creation or `gh aw add`** and ask an\nadministrator to enable **Settings → General → Features → Issues**. Do not\ncontinue with a bootstrap PR that cannot complete after merge.\n\nSquad also opens PRs through GitHub Actions. Enable that **without** widening\nthe default workflow token:\n\n```bash\ngh api --method PUT \"repos\u002F${owner_repo}\u002Factions\u002Fpermissions\u002Fworkflow\" \\\n  -f default_workflow_permissions=read \\\n  -F can_approve_pull_request_reviews=false\n```\n\n`can_approve_pull_request_reviews` is a single, combined GitHub toggle: it\ndoes not just govern whether `GITHUB_TOKEN` can *submit an approving review*\n— the same switch also gates whether `GITHUB_TOKEN` is permitted to *create*\npull requests at all (GitHub returns the literal error \"GitHub Actions is not\npermitted to create or approve pull requests\" for both operations; they\ncannot be separated via job-level `permissions:` alone). GitHub's own API\nreference calls enabling it a security risk, so Squad keeps it `false` for\nleast privilege and never relies on `GITHUB_TOKEN` to self-approve.\n\nWith it `false`, the bootstrap job's own `github.rest.pulls.create` call will\nfail with that exact error. Squad's bootstrap workflow catches only that\nspecific error and falls back automatically: it still pushes the\n`squad\u002Fbootstrap-cast` branch (the Cast PR's own branch — distinct from the\n`chore\u002Fsquad-gh-aw-bootstrap` branch you create by hand in step 2 below),\nthen opens (or, on a rerun, reuses) a tracking issue containing a\nready-to-click GitHub compare URL\n(`...\u002Fcompare\u002F\u003Cbase>...squad\u002Fbootstrap-cast?expand=1&title=...`) so a\nhuman can open the PR manually in one click. Any other pull-request creation\nerror (for example, a PR that already exists) still fails the job normally —\nonly this one documented, exact permission error is treated as expected.\nEvery bootstrap and Cast PR, whichever way it is opened, still requires an\nindependent human (or `@copilot`) approving review before merge. Keep\n`default_workflow_permissions=read`; do not set it to `write`.\n\n### 2. Isolate the install on a bootstrap branch (preserve existing workflows)\n\n```bash\ngit switch -c chore\u002Fsquad-gh-aw-bootstrap\n```\n\n- If the branch already exists (a re-run), switch to it instead of recreating it.\n- **Never overwrite** an existing `.github\u002Fworkflows\u002F*.md` or `*.lock.yml` that is\n  not part of the Squad set. `gh aw add` is additive; if you see it about to\n  replace an unrelated workflow, **STOP**.\n\n### 3. Install the native package at an explicit, maintainer-approved revision\n\n`SQUAD_SHA` must be supplied by the caller before this step — a specific,\nalready-reviewed 40-character commit SHA. Never derive it by resolving the\n`dev` branch's current tip: `dev` is a continuously moving integration branch,\nso resolving it at install time installs whatever happens to be on it at that\nexact moment, with no maintainer vetting of that specific revision. Obtain the\ncurrent supported revision from the Squad maintainers or the project's\npublished release guidance, then set it once:\n\n```bash\n# SQUAD_SHA=\"\u003C40-character commit SHA supplied by the maintainers>\"\n: \"${SQUAD_SHA:?STOP: set SQUAD_SHA to an explicit, maintainer-approved 40-character Squad commit SHA before installing.}\"\n[[ \"${SQUAD_SHA}\" =~ ^[0-9a-f]{40}$ ]] || {\n  echo \"STOP: SQUAD_SHA must be the exact 40-character commit SHA, not a branch name or shortened hash.\" >&2\n  exit 1\n}\n# squad-package-identity-start\nsquad_package=\"$(gh api --hostname github.com -H 'Accept: application\u002Fvnd.github.raw+json' \\\n  \"repos\u002Fgithub\u002Fsquad\u002Fcontents\u002Fworkflows\u002Fsquad-workflows.manifest.json?ref=${SQUAD_SHA}\" \\\n  --jq '.package')\" || squad_package=\"\"\ntest \"${squad_package}\" = \"github\u002Fsquad\u002Fworkflows\" || {\n  if [ -z \"${squad_package}\" ]; then\n    echo \"STOP: cannot read workflows\u002Fsquad-workflows.manifest.json from github\u002Fsquad at ${SQUAD_SHA}.\" >&2\n    echo \"Check gh auth status --hostname github.com and network access, and confirm SQUAD_SHA is a github\u002Fsquad commit that has this manifest, then retry.\" >&2\n  else\n    echo \"STOP: Squad ${SQUAD_SHA} does not declare the github\u002Fsquad\u002Fworkflows package (found '${squad_package}').\" >&2\n    echo \"Use a revision whose manifest declares github\u002Fsquad\u002Fworkflows, or ask the Squad maintainers for one. Older revisions download the Squad CLI from the bradygaster\u002Fsquad fork, which has no releases.\" >&2\n  fi\n  exit 1\n}\n# squad-package-identity-end\ngh aw add \"github\u002Fsquad\u002Fworkflows@${SQUAD_SHA}\"\nrm -f .github\u002Fskills\u002Fagentic-workflows\u002FSKILL.md\n```\n\n`github\u002Fsquad\u002Fworkflows` verifies only at Squad revisions whose\n`workflows\u002Fsquad-workflows.manifest.json` declares\n`\"package\": \"github\u002Fsquad\u002Fworkflows\"`. The identity check above reads that\nmanifest at `SQUAD_SHA` and stops on any other revision. Do not install an\nolder revision under `bradygaster\u002Fsquad\u002Fworkflows` instead: its activation\ndownloads the Squad CLI from the separately controlled `bradygaster\u002Fsquad`\nfork, which has no releases. Use a revision whose manifest declares\n`github\u002Fsquad\u002Fworkflows`, or ask the Squad maintainers for one.\n\nThe nested `workflows\u002Faw.yml` is the only supported distribution registration.\nIt isolates package auto-discovery from unrelated repository skills and agents,\nand installs exactly eight workflows, seventeen runtime resources, and one\n`gh-aw-enlistment` skill at the same resolved revision:\n\n- `squad.md` + `squad.lock.yml`\n- `squad-implement-worker.md` + `squad-implement-worker.lock.yml`\n- `squad-review.md` + `squad-review.lock.yml`\n- `squad-deps-worker.md` + `squad-deps-worker.lock.yml`\n- `squad-retro.md` + `squad-retro.lock.yml`\n- `squad-improvement-worker.md` + `squad-improvement-worker.lock.yml`\n- `squad-bootstrap.md` + `squad-bootstrap.lock.yml`\n- `squad-command-router.md` + `squad-command-router.lock.yml`\n\n`squad-improvement-worker` is part of the standard, coherent install above —\nnot a separate opt-in add-on. It stays dormant until a maintainer approves a\ngovernance-scoped retrospective proposal (see the gh-aw guide's retrospective\nauto-implementation section); installing it alongside the other seven keeps the\nfull stack consistent and avoids a second bootstrap pass later.\n\ngh-aw v0.91.5 also materializes\n`.github\u002Fskills\u002Fagentic-workflows\u002FSKILL.md`. That generic tool-owned router is\nnot part of the Squad package and directs agents to mutable prompts from the\ncurrent `github\u002Fgh-aw` repository rather than the pinned Squad revision. Remove\nthat exact file after every `gh aw add`. Keep\n`.github\u002Fskills\u002Fgh-aw-enlistment\u002FSKILL.md`: it is the one Squad-owned skill and\nthe verifier requires its exact package bytes. Do not adopt or vendor the rest\nof gh-aw's generic scaffold.\n\nRevisions whose `workflows\u002Fsquad-workflows.manifest.json` declares\n`\"package\": \"github\u002Fsquad\u002Fworkflows\"` verify that identity and the legacy\n`bradygaster\u002Fsquad\u002Fworkflows` identity. Earlier revisions, including ones\ncommitted after the repository moved to `github\u002Fsquad`, declare and verify only\n`bradygaster\u002Fsquad\u002Fworkflows`, and installations made from them carry it in\ntheir ownership record, workflow `source:` lines, and locks. Those revisions\ndownload the Squad CLI from the separately controlled `bradygaster\u002Fsquad` fork,\nwhich has no releases, so move such an installation to a revision that declares\n`github\u002Fsquad\u002Fworkflows` with the block below. gh-aw keeps the superseded\n`.github\u002Faw\u002Fpackages\u002Fbradygaster-squad-workflows-3632054824e8.json` after the\nforced reinstall, so the block deletes exactly that file before verifying; the\nverifier fails closed while both ownership records exist. If the forced\nreinstall fails, the block stops before it removes anything. That first upgrade\nalso makes `gh aw add` report one safe-update change: action\n`github\u002Fsquad\u002F.github\u002Factions\u002Fsquad-init` added and\n`bradygaster\u002Fsquad\u002F.github\u002Factions\u002Fsquad-init` removed. It is the same\nsquad-init action under the repository's new owner; list it in the PR's\nsecurity review note. **STOP** on any other new secret or action. Until the\nupgrade is committed, every strict compile repeats that change as four\nwarnings, which step 5 allows only for this migration. Verifiers of revisions\nthat declare `github\u002Fsquad\u002Fworkflows` still accept the legacy identity, so an\nexisting installation keeps verifying while it moves, and they print a notice\nthat says to move it.\n\n```bash\n: \"${SQUAD_SHA:?STOP: set SQUAD_SHA to an explicit, maintainer-approved 40-character Squad commit SHA before upgrading.}\"\n[[ \"${SQUAD_SHA}\" =~ ^[0-9a-f]{40}$ ]] || {\n  echo \"STOP: SQUAD_SHA must be the exact 40-character commit SHA, not a branch name or shortened hash.\" >&2\n  exit 1\n}\nsquad_package=\"$(gh api --hostname github.com -H 'Accept: application\u002Fvnd.github.raw+json' \\\n  \"repos\u002Fgithub\u002Fsquad\u002Fcontents\u002Fworkflows\u002Fsquad-workflows.manifest.json?ref=${SQUAD_SHA}\" \\\n  --jq '.package')\" || squad_package=\"\"\ntest \"${squad_package}\" = \"github\u002Fsquad\u002Fworkflows\" || {\n  if [ -z \"${squad_package}\" ]; then\n    echo \"STOP: cannot read workflows\u002Fsquad-workflows.manifest.json from github\u002Fsquad at ${SQUAD_SHA}.\" >&2\n    echo \"Check gh auth status --hostname github.com and network access, and confirm SQUAD_SHA is a github\u002Fsquad commit that has this manifest, then retry.\" >&2\n  else\n    echo \"STOP: Squad ${SQUAD_SHA} does not declare the github\u002Fsquad\u002Fworkflows package (found '${squad_package}').\" >&2\n    echo \"Use a revision whose manifest declares github\u002Fsquad\u002Fworkflows, or ask the Squad maintainers for one. Older revisions download the Squad CLI from the bradygaster\u002Fsquad fork, which has no releases.\" >&2\n  fi\n  exit 1\n}\ngh aw add \"github\u002Fsquad\u002Fworkflows@${SQUAD_SHA}\" --force || {\n  echo \"STOP: gh aw add --force failed, so this block removed nothing. Fix the error above, then rerun the block.\" >&2\n  exit 1\n}\nrm -f .github\u002Fskills\u002Fagentic-workflows\u002FSKILL.md\nrm -f .github\u002Faw\u002Fpackages\u002Fbradygaster-squad-workflows-3632054824e8.json\nnode .github\u002Fworkflows\u002Fshared\u002Fsquad-install-verifier.mjs --materialize-runtime\ngh aw compile --strict\nnode .github\u002Fworkflows\u002Fshared\u002Fsquad-install-verifier.mjs \\\n  --verify-install \\\n  --source-revision \"${SQUAD_SHA}\" \\\n  --strict-compile\n```\n\nApply step 5's warning check, including its legacy-identity migration allowlist, to the compile output above, then stage and verify as in step 7.\n\nReport\u002Fproposal-only is the default. Ordinary fixes require the explicit\n`\"squadRetroAutoImplement\": \"allow\"` setting in `.squad\u002Fconfig.json`;\nfive action issues and three dispatches per wake-up remain separate caps.\nAn improvement requires `\u002Fsquad approve-improvement`, `Approved-Revision:`\nand exact `Approved-Path:` lines from a human with write\u002Fmaintain\u002Fadmin access.\nThe dispatcher sends nested issue and approval-comment IDs to the worker;\nmanual retries use those same IDs. `\u002Fsquad revoke-improvement` is reserved\nwithout dispatch and is rechecked before outputs. Draft PRs and human merge\nremain mandatory; closed-unmerged PRs never cause automatic replacements.\nSee the guide for content-hash calculation and the one-retry recovery policy.\n\n`SQUAD_SHA` is supplied explicitly by the caller, never resolved from `dev`'s\nmoving tip; the install itself only ever installs that one immutable,\nalready-approved revision.\n\n### 4. Review the first-install safe-update report — approve ONLY the documented entries\n\nOn a clean repo, `gh aw add` reports these expected safe updates and **nothing else**:\n\n\u003C!-- allowlist-start -->\n- Restricted secrets: **`GH_AW_GITHUB_READ_APP_PRIVATE_KEY`**, **`SQUAD_GITHUB_APP_PRIVATE_KEY`**, and **`SQUAD_GITHUB_TOKEN`**\n- Action: **`github\u002Fsquad\u002F.github\u002Factions\u002Fsquad-init`**\n\u003C!-- allowlist-end -->\n\n> **These are referenced names, not prerequisites.** `gh aw add` lists the secrets\n> the workflows *reference* so you can approve that surface — it is not asking you\n> to supply them. All three secrets are optional, they need not exist, and none is\n> required to enlist a repository. Single-repo activation runs on the built-in\n> `github.token`. Configure them only for cross-repo access, elevated\n> permissions, or optional CAO evidence collection. Auth precedence: GitHub App token, then the PAT, then\n> `github.token`. Never block an enlistment waiting for a credential.\n\nIf — and only if — the report contains exactly those documented entries, complete\nthe one-time approval:\n\n```bash\ngh aw compile --strict --approve   # first install only, when the safe-update warning appears\n```\n\n- **STOP** if the report lists **any other secret** or **any other action**. Do not\n  approve. Report the unexpected entry verbatim and wait for a human.\n- This `--approve` step is *only* the first-install unblock. It is **not** a\n  substitute for the final strict compile in the next step.\n\n### 5. Always run the final strict compile WITHOUT `--approve`\n\n```bash\nnode .github\u002Fworkflows\u002Fshared\u002Fsquad-install-verifier.mjs --materialize-runtime\ngh aw compile --strict\nnode .github\u002Fworkflows\u002Fshared\u002Fsquad-install-verifier.mjs \\\n  --verify-install \\\n  --source-revision \"${SQUAD_SHA}\" \\\n  --strict-compile\n```\n\nThis must run after any first-install approval and before committing. Success\ncriteria:\n\n- All eight workflows compile successfully.\n- With gh-aw v0.91.5, require exactly two warnings, one occurrence of each\n  exact diagnostic header below (including its workflow path):\n\n\u003C!-- compile-warning-allowlist-start -->\n```text\n.github\u002Fworkflows\u002Fsquad-review.md: warning: pull_request_target is a very dangerous trigger.\n.github\u002Fworkflows\u002Fsquad.md: warning: Both slash_command and bots triggers are configured. If a bot listed in bots: posts a comment that starts with the slash command text (e.g., \u002Fcommand-name), it will trigger the workflow and occupy the concurrency slot, potentially blocking simultaneous manual invocations. To ensure the workflow only runs on explicit user commands, remove the 'bots:' field.\n```\n\u003C!-- compile-warning-allowlist-end -->\n\nThe native review advisory includes the compiler's standard explanation and\nSecurity Lab link. The following guard-policy dry-run lines are informational,\nnot another warning. The bot-trigger warning is expected because\n`github-actions[bot]` enables controlled worker-continuation dispatches.\n\nAccept the native review advisory **only while all existing controls remain**:\nsame-repository head restriction, base-controlled workflow source,\n`checkout: false` agent path, API-only inspection, exact run\u002Fhead\u002Fattempt guard,\nleast-privilege jobs, advisory verdict, and independent human approval.\n`pull_request_target` is not generally safe; this narrow exception neither\nweakens those controls nor authorizes PR-head execution.\n\n**Legacy-identity migration only.** While step 3's upgrade block moves an\ninstallation whose locks committed at `HEAD` still use\n`bradygaster\u002Fsquad\u002F.github\u002Factions\u002Fsquad-init`, gh-aw v0.91.5 compares safe\nupdates against those committed locks, and `--approve` cannot clear that\ncomparison before the upgrade is committed. During that migration, also\nrequire exactly these four warnings, one occurrence of each exact diagnostic\nheader:\n\n\u003C!-- compile-warning-migration-allowlist-start -->\n```text\n.github\u002Fworkflows\u002Fsquad.md: warning: safe update mode detected unapproved changes\n.github\u002Fworkflows\u002Fsquad-implement-worker.md: warning: safe update mode detected unapproved changes\n.github\u002Fworkflows\u002Fsquad-deps-worker.md: warning: safe update mode detected unapproved changes\n.github\u002Fworkflows\u002Fsquad-retro.md: warning: safe update mode detected unapproved changes\n```\n\u003C!-- compile-warning-migration-allowlist-end -->\n\nEach of these four warnings must report exactly this squad-init owner\nreplacement, with no other secret, action, redirect, or change:\n\n\u003C!-- compile-warning-migration-changes-start -->\n```text\nNew unapproved action(s):\n  - github\u002Fsquad\u002F.github\u002Factions\u002Fsquad-init\nPreviously-approved action(s) removed:\n  - bradygaster\u002Fsquad\u002F.github\u002Factions\u002Fsquad-init\n```\n\u003C!-- compile-warning-migration-changes-end -->\n\nThe remediation text under each warning and the closing `SECURITY REVIEW\nREQUIRED` prompts belong to these four warnings; they are not additional\nwarnings. The summary is then `Compiled 8 workflows: 8 succeeded, 6 warnings`.\nName the replacement in the PR's security review note. The four warnings no\nlonger appear once the upgrade is committed.\n\n**STOP** on any error, or on **any additional warning** beyond these two exact\ndocumented diagnostics and, during that migration only, the four exact\nsquad-init replacement warnings. Also STOP if an allowed warning is missing,\nduplicated, changed, or attributed to another path, if the summary is not\n`Compiled 8 workflows: 8 succeeded, 2 warnings` (`6 warnings` during that\nmigration), or if any required control is absent. Do not suppress warnings or\nuse `--approve` to bypass this gate.\n\n### 6. Require the verifier to prove the complete consumer contract\n\n- **STOP** if the verifier reports a missing source\u002Flock pair, missing package\n  ownership record, stale source\u002Fresource digest, incomplete eight-workflow\n  registration, or mixed revision.\n- Use only the recovery commands printed by the verifier. They reinstall the\n  complete package at one immutable revision; never repair one workflow or\n  resource in isolation.\n\n### 7. Inspect generated files, then stage only the documented surfaces\n\nDownloaded workflow audit data is local diagnostic output — **do not commit it**.\nIf `.github\u002Faw\u002Flogs\u002F` lacks a `.gitignore`, add one there:\n\n```gitignore\n# Ignore all downloaded workflow logs\n*\n\n# But keep this file\n!.gitignore\n```\n\n`gh aw add` may also create `.vscode\u002Fsettings.json` (enables Copilot for Markdown\nworkflow files). This is an **optional editor setting** — the stage command below\nintentionally leaves it untracked. Delete it if unwanted, or stage it explicitly\nif your team wants to share it. Decide deliberately; do not stage it by accident.\n\nStage **only** the documented generated surfaces, then verify the staged set:\n\n```bash\ngit add -- .gitattributes .github\u002Faw\u002F .github\u002Fworkflows\u002F .github\u002Fskills\u002F\nnode .github\u002Fworkflows\u002Fshared\u002Fsquad-install-verifier.mjs \\\n  --verify-staged-install --stage-ownership --source-revision \"${SQUAD_SHA}\" || exit 1\ngit diff --cached --stat\nunexpected_deletions=\"$(\n  git diff --cached --diff-filter=D --name-only |\n    grep -vxF -e '.github\u002Fskills\u002Fagentic-workflows\u002FSKILL.md' |\n    while IFS= read -r path; do\n      # Also allowed: any Squad ownership record except the one gh-aw writes for github\u002Fsquad\u002Fworkflows.\n      if [[ \"${path}\" =~ ^\\.github\u002Faw\u002Fpackages\u002F[^\u002F]+\\.json$ ]] &&\n        [ \"${path}\" != '.github\u002Faw\u002Fpackages\u002Fgithub-squad-workflows-23a7638f599e.json' ] &&\n        git show \"HEAD:${path}\" | node -e '\n          const accepted = [\"github\u002Fsquad\u002Fworkflows\", \"bradygaster\u002Fsquad\u002Fworkflows\"];\n          let text = \"\";\n          process.stdin.on(\"data\", chunk => { text += chunk; }).on(\"end\", () => {\n            let name;\n            try { name = JSON.parse(text).package; } catch {}\n            process.exit(typeof name === \"string\" && accepted.includes(name.toLowerCase()) ? 0 : 1);\n          });'; then\n        continue\n      fi\n      printf '%s\\n' \"${path}\"\n    done || true\n)\"\ntest -z \"${unexpected_deletions}\" || {\n  printf 'STOP: unexpected staged deletions:\\n%s\\n' \"${unexpected_deletions}\" >&2\n  exit 1\n}\n```\n\n- The only permitted staged deletions are\n  `.github\u002Fskills\u002Fagentic-workflows\u002FSKILL.md`, when upgrading a repository that\n  previously committed gh-aw's mutable router, and a `.github\u002Faw\u002Fpackages\u002F*.json`\n  ownership record whose `package` is `github\u002Fsquad\u002Fworkflows` or\n  `bradygaster\u002Fsquad\u002Fworkflows` in any letter case, other than\n  `.github\u002Faw\u002Fpackages\u002Fgithub-squad-workflows-23a7638f599e.json`, the record gh-aw\n  writes for `github\u002Fsquad\u002Fworkflows`. Those are the records the verifier tells\n  you to delete, such as the superseded\n  `.github\u002Faw\u002Fpackages\u002Fbradygaster-squad-workflows-3632054824e8.json` when moving\n  an existing installation off the legacy `bradygaster\u002Fsquad\u002Fworkflows` identity.\n- **STOP** if the staged diff shows any other **unexpected deletions**, **unexpected secrets**,\n  edits to **unrelated files**, or committed **log\u002Fdiagnostic output**. Re-scope with\n  explicit `git add -- \u003Cpath>` — never `git add .`, `git add -A`, or `git commit -a`.\n\nConsumer rules such as `packages\u002F` can silently ignore the required ownership\nJSON under `.github\u002Faw\u002Fpackages\u002F`. The staged verifier force-adds only the exact\nnative package ownership JSON when it is ignored and untracked. It then verifies\nevery manifest-required source, lock, runtime, skill, manifest and ownership\nfile against the validated working-tree bytes in a snapshot of the Git index.\n**STOP before commit\u002Fpush** on missing metadata, a staging failure, an omitted\nrequired file or a staged digest mismatch. Never force-add a directory or glob.\nRerun this gate after changing or restaging any installation file.\n\n### 8. Commit, push, and open the bootstrap PR to the captured default branch\n\n```bash\ngit commit -m \"ci: add Squad agentic workflow\"\ngit push -u origin HEAD\ngh pr create \\\n  --base \"${default_branch}\" \\\n  --title \"ci: add Squad agentic workflow\" \\\n  --body \"Installs and strictly compiles the supported Squad GH-AW workflows.\"\n\n# Copilot's review identity is a GraphQL Bot, not a User\u002FTeam — the REST\n# `gh pr edit --add-reviewer @copilot` path silently no-ops for it. Request the\n# review through the verified GraphQL path instead:\npr_node_id=\"$(gh pr view --json id --jq '.id')\"\ngh api graphql -f query='\n  mutation($pr: ID!) {\n    requestReviewsByLogin(input: { pullRequestId: $pr, botLogins: [\"copilot-pull-request-reviewer\"] }) {\n      pullRequest { number }\n    }\n  }' -f pr=\"${pr_node_id}\" || echo \"Could not request a Copilot review via GraphQL; open the PR in the GitHub UI and add Copilot as a reviewer manually (Reviewers -> Copilot).\" >&2\ngh pr checks --watch\n```\n\n- Open the PR against the **runtime-captured** `${default_branch}`, not a hardcoded\n  `main`.\n- Request Copilot review via the GraphQL `requestReviewsByLogin` mutation\n  (never the REST `--add-reviewer` shortcut, which silently no-ops for the\n  Copilot Bot reviewer), address feedback, and wait for required checks. If\n  the GraphQL call fails, add Copilot as a reviewer manually from the PR's\n  GitHub UI.\n\n### 9. Verify the native review contract after merge\n\nThe installation PR remains an explicit human trust boundary. After a human\nmerges it, inspect the Cast PR — automatically opened, or manually opened by a\nhuman from the bootstrap fallback issue's compare-URL link when\n`GITHUB_TOKEN` cannot create it directly — and require the native\n`Squad Review \u002F review` job from the base-controlled `pull_request_target`\nworkflow to succeed. Verify the exact workflow path, immutable base\u002Fworkflow\nSHA, PR base\u002Fhead, run ID and attempt, successful `review` job, and exact-head\nGitHub Actions check-run binding.\n\nThis review path uses only the native GitHub Actions\u002Fgh-aw runtime identity.\nNever request or provision a reviewer PAT, GitHub App, private key, secret,\nenvironment, hosted attestor, callback, or external service. The optional\n`SQUAD_GITHUB_APP_*` and `SQUAD_GITHUB_TOKEN` activation credentials remain\nunrelated to reviewer authority.\n\nFor authoritative merge enforcement, use a source-bound required-workflow or\nequivalent ruleset when available. A context-only requirement for\n`Squad Review \u002F review` is advisory because a PR-controlled workflow may be\nable to emit the same workflow\u002Fjob name through the shared GitHub Actions\nidentity. If source-bound enforcement is unavailable, retain independent human\nreview rather than relying on that context alone or adding a credential-based\npublisher. Require branches to be up to date before merge (or use an equivalent\nmerge-queue freshness guarantee), and enable the required context only after\nthe workflow installation is merged and the post-merge Cast canary succeeds.\n\n### 10. Never auto-merge — and explain what comes next\n\n- **Never** merge the bootstrap PR yourself. Merge happens **only** after human\n  approval.\n- Make the two-PR flow explicit to the user: after the workflow-installation PR\n  reaches the default branch, `squad-bootstrap` normally creates one **draft,\n  human-reviewed Cast PR** and one linked\n  `[Agentic Research] owner\u002Frepo — initial proposals` issue (using the runtime\n  repository and retaining any committed reset suffix) from the\n  same validated repository analysis. This is a proposal agenda, not completed\n  research. Update and verify the complete package before optionally renaming\n  an existing bootstrap issue; legacy exact titles remain recognized, and\n  completed bootstrap does not auto-rename them. Preserve its reset suffix,\n  body, comments, and provenance. If `can_approve_pull_request_reviews`\n  is `false` (the recommended, least-privilege setting from step 4),\n  `GITHUB_TOKEN` cannot open that PR either; `squad-bootstrap` instead opens a\n  **bot-authored fallback issue** carrying a signed provenance record and a\n  ready-to-click compare URL, and Squad Review accepts the resulting\n  manually-opened PR in that one narrowly-scoped case (see \"Optional: PAT\n  fallback\" and the fallback-issue provenance contract in\n  `docs\u002Fsrc\u002Fcontent\u002Fdocs\u002Fguide\u002Fgh-aw.md` for the exact trust conditions).\n  On the fallback path, no automatic trigger re-runs `squad-bootstrap` at any\n  point — **not** when the human opens that compare-URL PR, and **not** when\n  they later merge it either: `squad-bootstrap`'s push trigger only watches\n  the Squad workflow-source paths (for example `.github\u002Fworkflows\u002Fsquad*.md`),\n  and the manually-opened PR never touches any of those paths. The fallback\n  issue itself tells the user to manually re-run the Squad Bootstrap workflow\n  (`workflow_dispatch`) — either now, while the PR is still open, or anytime\n  after merging it — which deterministically detects the PR (open or merged)\n  and creates the linked research-proposals issue; no automatic trigger ever\n  does this for them. Either way, the user reviews and merges the Cast PR, then follows the\n  research issue's `\u002Fsquad research`, `\u002Fsquad triage`, `\u002Fsquad plan`, and\n  `\u002Fsquad activate` instructions until assignable implementation issues exist.\n\n## Examples\n\n### ✓ Correct: runtime-resolved identity, allowlist honored, human-reviewed\n\n```bash\nowner_repo=\"$(gh repo view --json nameWithOwner --jq '.nameWithOwner')\"\ndefault_branch=\"$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')\"\n\nissues_enabled=\"$(gh api \"repos\u002F${owner_repo}\" --jq '.has_issues')\"\nif [ \"${issues_enabled}\" != \"true\" ]; then\n  if ! gh api --method PATCH \"repos\u002F${owner_repo}\" \\\n    -F has_issues=true --silent; then\n    echo \"STOP: GitHub Issues are disabled and could not be enabled.\" >&2\n    echo \"A repository administrator must enable Settings > General > Features > Issues, then rerun enlistment.\" >&2\n    exit 1\n  fi\nfi\n\ntest \"$(gh api \"repos\u002F${owner_repo}\" --jq '.has_issues')\" = \"true\" || {\n  echo \"STOP: GitHub Issues must be enabled before installing Squad workflows.\" >&2\n  exit 1\n}\n\ngh api --method PUT \"repos\u002F${owner_repo}\u002Factions\u002Fpermissions\u002Fworkflow\" \\\n  -f default_workflow_permissions=read -F can_approve_pull_request_reviews=false\n\ngit switch -c chore\u002Fsquad-gh-aw-bootstrap\n# SQUAD_SHA is supplied explicitly (maintainer-approved), never resolved from dev's tip\n: \"${SQUAD_SHA:?STOP: set SQUAD_SHA to an explicit, maintainer-approved 40-character Squad commit SHA.}\"\n[[ \"${SQUAD_SHA}\" =~ ^[0-9a-f]{40}$ ]] || {\n  echo \"STOP: SQUAD_SHA must be an explicit, maintainer-approved 40-character lowercase hex commit SHA.\" >&2\n  exit 1\n}\nsquad_package=\"$(gh api --hostname github.com -H 'Accept: application\u002Fvnd.github.raw+json' \\\n  \"repos\u002Fgithub\u002Fsquad\u002Fcontents\u002Fworkflows\u002Fsquad-workflows.manifest.json?ref=${SQUAD_SHA}\" \\\n  --jq '.package')\" || squad_package=\"\"\ntest \"${squad_package}\" = \"github\u002Fsquad\u002Fworkflows\" || {\n  if [ -z \"${squad_package}\" ]; then\n    echo \"STOP: cannot read workflows\u002Fsquad-workflows.manifest.json from github\u002Fsquad at ${SQUAD_SHA}.\" >&2\n    echo \"Check gh auth status --hostname github.com and network access, and confirm SQUAD_SHA is a github\u002Fsquad commit that has this manifest, then retry.\" >&2\n  else\n    echo \"STOP: Squad ${SQUAD_SHA} does not declare the github\u002Fsquad\u002Fworkflows package (found '${squad_package}').\" >&2\n    echo \"Use a revision whose manifest declares github\u002Fsquad\u002Fworkflows, or ask the Squad maintainers for one. Older revisions download the Squad CLI from the bradygaster\u002Fsquad fork, which has no releases.\" >&2\n  fi\n  exit 1\n}\ngh aw add \"github\u002Fsquad\u002Fworkflows@${SQUAD_SHA}\"\nrm -f .github\u002Fskills\u002Fagentic-workflows\u002FSKILL.md\n\n# Safe-update report shows ONLY the three documented secrets + squad-init → approve once\ngh aw compile --strict --approve\nnode .github\u002Fworkflows\u002Fshared\u002Fsquad-install-verifier.mjs --materialize-runtime\ngh aw compile --strict           # final, no --approve; exactly the two documented warnings remain\nnode .github\u002Fworkflows\u002Fshared\u002Fsquad-install-verifier.mjs \\\n  --verify-install --source-revision \"${SQUAD_SHA}\" --strict-compile\n\ngit add -- .gitattributes .github\u002Faw\u002F .github\u002Fworkflows\u002F .github\u002Fskills\u002F\nnode .github\u002Fworkflows\u002Fshared\u002Fsquad-install-verifier.mjs \\\n  --verify-staged-install --stage-ownership --source-revision \"${SQUAD_SHA}\" || exit 1\ngit commit -m \"ci: add Squad agentic workflow\"\ngit push -u origin HEAD\ngh pr create --base \"${default_branch}\" \\\n  --title \"ci: add Squad agentic workflow\" \\\n  --body \"Installs and strictly compiles the supported Squad GH-AW workflows.\"\npr_node_id=\"$(gh pr view --json id --jq '.id')\"\ngh api graphql -f query='\n  mutation($pr: ID!) {\n    requestReviewsByLogin(input: { pullRequestId: $pr, botLogins: [\"copilot-pull-request-reviewer\"] }) {\n      pullRequest { number }\n    }\n  }' -f pr=\"${pr_node_id}\"   # Bot-aware review request; then wait for review + checks; DO NOT merge\n```\n\n### ✓ Correct: STOP on an undocumented safe-update entry\n\n```text\ngh aw add reports an undocumented secret: `ACME_DEPLOY_KEY`.\n→ This is NOT in the allowlist (GH_AW_GITHUB_READ_APP_PRIVATE_KEY, SQUAD_GITHUB_APP_PRIVATE_KEY, SQUAD_GITHUB_TOKEN)\n  and is NOT the squad-init action. Do NOT run `--approve`.\n  Halt, report \"unexpected safe-update entry: ACME_DEPLOY_KEY\", and wait.\n```\n\n### ✗ Incorrect: hardcoded target and blanket staging\n\n```bash\n# BAD: hardcoded owner\u002Frepo and default branch\ngh api --method PUT \"repos\u002Facme\u002Fwidgets\u002Factions\u002Fpermissions\u002Fworkflow\" ...\ngh pr create --base main ...        # wrong if the default branch isn't `main`\n\n# BAD: blanket staging captures logs, editor settings, and unrelated changes\n# Stage only the generated bootstrap paths listed above.\n```\n\n### ✗ Incorrect: skipping the final strict compile or auto-merging\n\n```bash\ngh aw compile --strict --approve    # approved first install...\n# ...then committed WITHOUT the final `gh aw compile --strict` (no --approve). WRONG.\ngh pr merge --squash                # auto-merge before human review. NEVER.\n```\n\n## Anti-Patterns\n\n- ❌ **Hardcoding repository identifiers.** Always resolve `owner\u002Frepo` and the\n  default branch at runtime with `gh repo view`.\n- ❌ **Installing while GitHub Issues are disabled.** `\u002Fsquad` commands and the\n  bootstrap research\u002Fproposals issue require Issues. Enable them first, or stop\n  before installation if repository administration permission is unavailable.\n- ❌ **Blanket staging** (`git add .` \u002F `-A` \u002F `git commit -a`). Stage only\n  `.gitattributes`, `.github\u002Faw\u002F`, `.github\u002Fworkflows\u002F`, `.github\u002Fskills\u002F`, by path.\n- ❌ **Committing gh-aw's mutable router.** Remove only\n  `.github\u002Fskills\u002Fagentic-workflows\u002FSKILL.md`; keep the exact Squad-owned\n  `.github\u002Fskills\u002Fgh-aw-enlistment\u002FSKILL.md`.\n- ❌ **Approving unknown safe updates.** Approve ONLY `GH_AW_GITHUB_READ_APP_PRIVATE_KEY`, `SQUAD_GITHUB_APP_PRIVATE_KEY`,\n  `SQUAD_GITHUB_TOKEN`, and `github\u002Fsquad\u002F.github\u002Factions\u002Fsquad-init`. Anything\n  else is a STOP.\n- ❌ **Treating `--approve` as the final compile.** Always finish with a plain\n  `gh aw compile --strict` (no `--approve`).\n- ❌ **Tolerating extra warnings.** Only the documented `squad-review.md`\n  `pull_request_target` advisory and `squad.md` bot-trigger warning are allowed,\n  plus step 5's four squad-init replacement warnings during the legacy-identity\n  migration only; every other warning or error halts the run.\n- ❌ **Committing diagnostics.** Never commit `.github\u002Faw\u002Flogs\u002F` output; add the\n  log `.gitignore` if missing.\n- ❌ **Clobbering existing workflows.** The install is additive; preserve unrelated\n  `.github\u002Fworkflows\u002F` files.\n- ❌ **Widening the default token.** Keep `default_workflow_permissions=read`.\n- ❌ **Auto-merging.** The workflow-installation PR and the Cast PR (automatic\n  or manually opened from the fallback issue) are both human-reviewed. The\n  dedicated bootstrap wakes only after installation lands on the default\n  branch.\n- ❌ **Opening the PR before the package verifier and strict compile pass.**\n",{"name":5,"tools":49,"domain":57,"source":58,"triggers":59,"confidence":70,"description":7},[50,53],{"name":25,"when":51,"description":52},"Every step: preflight identity\u002Fauth, requiring Issues, enabling Actions-created PRs, opening and watching the bootstrap PR.","GitHub CLI — repo identity, Issues and Actions settings, PR creation, review request, and check watching.",{"name":54,"when":55,"description":56},"gh aw","Installing the immutable native Squad package and compiling its eight workflows into deterministic .lock.yml files.","GitHub Agentic Workflows extension (github\u002Fgh-aw) — installs and strictly compiles the Squad workflow set.","github-integration, agentic-workflows, ci-bootstrap, safety-gated-automation","Operationalized from the authoritative Squad gh-aw guide (docs\u002Fsrc\u002Fcontent\u002Fdocs\u002Fguide\u002Fgh-aw.md) covering the supported install → compile → validate → bootstrap-PR path.",[60,61,62,63,64,65,66,67,68,69],"set up Squad agentic workflows","enlist this repo in Squad","enlist my repository in Squad","install Squad gh-aw workflows","install Squad agentic workflows","add Squad gh aw workflows","bootstrap Squad in this repo","onboard this repo to Squad","set up \u002Fsquad slash commands","gh aw add squad","high","dev","675c9e97bd5e5e9d3906b175147ddb7eff997499",".squad-templates\u002Fskills\u002Fgh-aw-enlistment",516,"https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad","https:\u002F\u002Fgithub.github.io\u002Fsquad\u002F","https:\u002F\u002Fgithub.com\u002Fgithub","https:\u002F\u002Fgithub.com\u002Fabout","How people build software.","2026-11-11 05:58:32",{"source":8,"skillName":5,"commands":82,"prompt":92,"zipAvailable":93},[83,86,89],{"tool":84,"command":85},"npx","npx skills add github\u002Fsquad --skill gh-aw-enlistment",{"tool":87,"command":88},"bunx","bunx skills add github\u002Fsquad --skill gh-aw-enlistment",{"tool":90,"command":91},"pnpm","pnpm dlx skills add github\u002Fsquad --skill gh-aw-enlistment","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad\u002Fblob\u002Fdev\u002F.squad-templates\u002Fskills\u002Fgh-aw-enlistment\u002FSKILL.md",true,[],[96,102,114,123,140,164],{"skillNo":97,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":101,"publishedAt":44},"01M6X287DVJK1S91END9DSHETN","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad\u002Fblob\u002Fdev\u002Fworkflows\u002Fskills\u002Fgh-aw-enlistment\u002FSKILL.md",[100],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[24,25,34,43,42,41,40,39,38,37,36,35,26,33,32,31,30,29,28,27],{"skillNo":103,"name":104,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":108,"publishedAt":44},"01M6X27Y5119CSRQFFJCV6432R","My Skill","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad\u002Fblob\u002Fdev\u002Ftest-fixtures\u002Fskills-test-abb30454\u002Fmy-skill\u002FSKILL.md",[107],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[109,110,111,112,113],"my","my skill","testing","vitest","tester",{"skillNo":115,"name":116,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":120,"publishedAt":44},"01M6X27RWAYB2X9ER0MVRRKXGA","bad-skill","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad\u002Fblob\u002Fdev\u002Ftest-fixtures\u002Fskills-test-abb30454\u002Fbad-skill\u002FSKILL.md",[119],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[121,122],"bad","bad skill",{"skillNo":124,"name":125,"nameZh":6,"description":126,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":127,"categories":128,"keywords":129,"publishedAt":44},"01M6X27HBWM6V81KXYW5XQSWFJ","windows-compatibility","Cross-platform path handling and command patterns","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad\u002Fblob\u002Fdev\u002Ftemplates\u002Fskills\u002Fwindows-compatibility\u002FSKILL.md",[],[130,131,132,70,133,134,135,136,137,138,139],"windows compatibility","compatibility","windows","platform","path","bugs","git","command","patterns","cross-platform",{"skillNo":141,"name":142,"nameZh":6,"description":143,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":144,"categories":145,"keywords":146,"publishedAt":44},"01M6X278Z6PF2YQN406RHJJWHG","versioning-policy","SemVer rules for Squad's stable, preview, insider, and local package versions","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad\u002Fblob\u002Fdev\u002Ftemplates\u002Fskills\u002Fversioning-policy\u002FSKILL.md",[],[147,148,149,150,151,40,152,153,154,155,36,156,157,158,159,160,161,162,70,163],"versioning","versioning policy","policy","preview","pr","release","semver","npm","package","workspace","Rules","incident","local","resolution","channels","insider","for",{"skillNo":165,"name":166,"nameZh":6,"description":167,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":168,"categories":169,"keywords":174,"publishedAt":44},"01M6X26XS6T23E81XNP51HMQAT","tiered-memory","Three-tier agent memory model (hot\u002Fcold\u002Fwiki) for context reduction per spawn","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad\u002Fblob\u002Fdev\u002Ftemplates\u002Fskills\u002Ftiered-memory\u002FSKILL.md",[170,173],{"categoryNo":171,"categoryName":172,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000015","视觉设计",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[175,176,177,178,179,180,181,182,163,183,184,185,186,187,188,189],"memory","tiered memory","model","wiki","agent memory","performance","cold","memory-management","runtime","three","spawn","proposal","management","design","context"]