[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7358HCQBTV0SF4DBB6HX9NV":3,"skill-same:01M7358HCQBTV0SF4DBB6HX9NV":49},{"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":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":28,"commitSha":29,"skillDirectory":30,"forksCount":31,"repositoryHtmlUrl":32,"repositoryHomepageUrl":33,"ownerHtmlUrl":34,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":35,"install":36,"resources":48},"01M7358HCQBTV0SF4DBB6HX9NV","refresh-claude-token",null,"Rotate CLAUDE_CODE_OAUTH_TOKEN.","Morrison-Lab\u002Fai-config","Morrison-Lab","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F104235520?v=4","01M734G0451S2G35MN4HFQK7XP","Morrison Lab","01M734G059BYFDFQA8YTPDGPMH",4,"MIT","https:\u002F\u002Fgithub.com\u002FMorrison-Lab\u002Fai-config\u002Fblob\u002Fmain\u002Fskills\u002Frefresh-claude-token\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: refresh-claude-token\ndescription: \"Rotate CLAUDE_CODE_OAUTH_TOKEN.\"\nuser-invocable: true\nallowed-tools:\n  - Bash\n  - Read\n---\n\n# refresh-claude-token\n\nReplace `CLAUDE_CODE_OAUTH_TOKEN` on the repos that already carry it,\nand confirm the replacement actually works.\n\n`\u002Finstall-github-app` is the only built-in that writes this secret,\nand it bundles that write with installing the GitHub App\nand committing workflow files.\nWhen the token is the only thing that needs replacing,\nthat command does far more than the job requires,\nand re-running it against a repo whose workflows are already customized\nrisks scaffolding over them.\n\nThis skill is a thin wrapper.\nThe work is done by `scripts\u002Frotate-claude-token.py`,\nwhich already discovers its targets, previews by default,\nkeeps the token out of `argv`,\nand confirms each write landed.\nRead that script's docstring before changing anything here.\n\n## When this fires\n\n- \"refresh the claude token\", \"rotate the claude token\", \"rct\"\n- \"update CLAUDE_CODE_OAUTH_TOKEN\", \"the claude token expired\"\n- A review job whose log carries an explicit credential rejection:\n  a 401, an `OAuth token has expired`, or an `Invalid bearer token`.\n\n**A short failing run is not on that list, deliberately.**\nIt is tempting to add one, because a rejected credential does produce a fast\n`is_error: true` run with no verdict.\nSo do a checkout failure, an App-token exchange failure,\nand a workflow-validation refusal,\nwhich step 4 below and\n[`fully-clean`](..\u002F..\u002Fshared\u002Fworkflow\u002Ffully-clean.md) both say cannot be told\napart by duration.\n\nSince this skill's whole output is a secret rewrite,\nfiring it on the ambiguous signal spends a rotation on a problem a rotation\ncannot fix,\nand then credits the rotation when the real cause clears on its own.\nRead the log and find the rejection line first.\nNo line, no rotation.\n\n## What this is not\n\nInstalling the GitHub App,\ncommitting or editing anything under `.github\u002Fworkflows\u002F`,\nor provisioning the secret into a repo that has never had it.\n\nThat last one is a hard limit of the script, not a policy choice.\n\n`--repos` bypasses **discovery**, not **secret discovery** --- and since ai-config#2371 that includes the org-level sweep, so an explicit repo list never rotates the org secret.\n`find_targets()` keeps a repo only when `secret_updated_at()` returns non-`None`, so a repo lacking the secret is dropped even when named explicitly.\nOn the default discovery path the script now checks each org for an **org-level** copy of the secret too (the estate's primary scope since ai-config#2360), rotates it with an explicit `--visibility` preserving what it had, and reports the two scopes separately.\nA fully-discovered estate carrying the secret in NO scope is a hard error (exit 1), not a quiet no-op --- that reading is indistinguishable from a broken sweep (#2371 point 4);\nthe benign `Nothing to rotate in the named repos.` no-op remains only on the `--repos` path, where the caller deliberately narrowed the query.\n\nThe script's docstring says the same, so provision with `gh secret set`\ndirectly instead:\n\n```bash\ngh secret set CLAUDE_CODE_OAUTH_TOKEN --repo \u003Cowner>\u002F\u003Crepo>   # SET_SECRET\ngh secret set CLAUDE_CODE_OAUTH_TOKEN --org \u003Corg> --visibility all   # SET_ORG_SECRET\n```\n\nDo that deliberately, since it decides which account's quota that scope spends.\n\nFor authoring or changing the workflows themselves,\nuse `claude-agent-workflow` or `claude-review-workflow`.\n\n## Procedure\n\n### 1. Preview, and read the target list\n\n```bash\npython3 scripts\u002Frotate-claude-token.py            # preview; changes nothing\n```\n\nThis prints the owners swept, the number of repos inspected,\nand every repo carrying the secret with its current `updated_at`.\n\nRead the count before going further.\nA number far below the last known sweep\nmeans the discovery step failed rather than that the estate shrank,\nand rotating against a truncated list\nleaves the untouched repos on the old token with nothing reporting it.\nThe script prints unreadable repos to stderr for exactly this reason,\nso a run reporting errors has understated its own target list.\n\n### 2. Mint the token -- the human runs this step\n\n`claude setup-token` is interactive,\nand an agent session cannot complete it.\nRun non-interactively it does not fail fast:\nwith stdin closed it printed nothing and was still running when killed at 8\nseconds,\nso an agent that calls it hangs rather than getting an error to report.\n\nThe gate is a post-authorize read, established by inspecting the blocked\nprocess rather than inferred:\n\n```bash\nps -o pid=,stat= -p \u003Cpid>        # S, still alive after the browser authorize\nlsof -p \u003Cpid> -a -d 0            # fd 0 is a unix socket, not a TTY\n```\n\nIt opens a browser, and after you authorize it blocks reading an\nauthorization code from stdin.\nAn agent-spawned process has a socket on fd 0, so that read can never be\nsatisfied.\nThe full record is in\n[`memories\u002Fclaude-code.md`](..\u002F..\u002Fmemories\u002Fclaude-code.md).\n\n**Never have the user run it through `!`, bare or piped.**\nIt prints a live, long-lived OAuth token,\nso a bare `! claude setup-token` puts that credential into the agent's\ncontext and the persisted session transcript.\nPiped through `!` it never finishes either.\nClaude Code runs `!` commands with stdin set to `\u002Fdev\u002Fnull` and no terminal,\nand on 2026-09-29 the pipeline was still running minutes later (ai-config#4127).\nWhy a `\u002Fdev\u002Fnull` stdin hangs rather than failing on EOF is not established.\n\nPiping its stdout into a consumer is not safe either.\nIt writes its whole screen to stdout, not just the token,\nand on 2026-09-29 that stored 2039 characters of prose as the org secret,\nbreaking review on every repo reading it (ai-config#4129).\n`rotate-claude-token.py` now refuses any value that is not one `sk-ant-...` token.\n\nHave the user run the wrapper **in a real terminal**:\n\n```bash\nscripts\u002Frefresh-claude-org-token.sh [org]     # org defaults to Morrison-Lab\n```\n\nIt runs `claude setup-token` on the terminal,\nthen asks for the token at a hidden prompt,\nrejoins a token that wrapped across lines,\nand rotates through the script.\n\n**Mind which account is logged in, without minting anything to find out.**\nThe command mints from whichever account the local CLI is currently\nauthenticated as,\nwith no account picker and no confirmation naming it.\n`claude auth status` answers that on its own,\nso run it *before* deciding to rotate rather than minting a token to\ndiscover the answer:\n\n```bash\nclaude auth status\n```\n\n`scripts\u002Frotate-claude-token.py` automatically reads the active account identity via\n`claude auth status` (or `--account \u003Cemail>`) and sets the companion GitHub Actions\nvariable `CLAUDE_CODE_ACCOUNT_EMAIL` at the org\u002Frepo level alongside the secret, so\nreusable review workflows (gha#1018) can name which account quota was hit when a\nreview is skipped.\n\n### 3. Rotate\n\nNever pass the token as an argument:\n`argv` is visible to anyone who can run `ps`,\nand it lands in shell history.\nThe user runs the wrapper from step 2, which covers this step too.\nAcross every owner rather than one org, the equivalent is:\n\n```bash\nclaude setup-token\npython3 scripts\u002Frotate-claude-token.py --apply    # prompts for the token, hidden\n```\n\nWhen the token is already in the environment, the agent can run:\n\n```bash\npython3 scripts\u002Frotate-claude-token.py --apply     # reads $CLAUDE_CODE_OAUTH_TOKEN\n```\n\nThe script re-reads each repo's `updated_at` after writing\nand fails the repo if the timestamp did not move,\nso a silent no-op cannot pass for a rotation.\n\n### 4. Verify the new token authenticates\n\n**This is the step the script cannot do, and the reason this skill exists.**\n\n`gh secret set` succeeds against any value.\nA garbage token bumps `updated_at` exactly like a good one,\nso step 3 finishing clean proves the secret **changed**\nand says nothing about whether it **works**.\n\nSettle it on the artifact rather than on the write.\nPick one **non-draft** PR, record what already exists, then dispatch:\n\nFirst find the reviewer's login **in this repo**, rather than assuming it.\nIt differs by repo:\n`Morrison-Lab\u002Fai-config` posts as `claude`,\nwhile `Morrison-Lab\u002Fgha` posts as `github-actions[bot]`.\nA hardcoded login matches nothing, which reads as \"posted nothing\":\n\n```bash\ngh pr view \u003CN> --repo \u003Cowner>\u002F\u003Crepo> --json comments \\\n  --jq '[.comments[].author.login] | unique'      # pick the reviewer's login\n```\n\nThen record the current state and dispatch:\n\n```bash\nBOT=claude                                        # from the query above\nBEFORE=$(gh pr view \u003CN> --repo \u003Cowner>\u002F\u003Crepo> --json comments \\\n  | jq -r --arg bot \"$BOT\" '[.comments[] | select(.author.login == $bot)] | last | .id \u002F\u002F \"none\"')\ngh workflow run claude-review.yml --repo \u003Cowner>\u002F\u003Crepo> \\\n  --ref \u003Cbranch> --field pr_number=\u003CN>            # RUN_WORKFLOW\n```\n\n**Pipe into standalone `jq`; do not pass `--arg` to `gh`'s own `--jq`.**\n`gh`'s `--jq` takes exactly one argument, the filter, and has no\n`--arg`\u002F`--argjson` passthrough\n([cli\u002Fcli#10263](https:\u002F\u002Fgithub.com\u002Fcli\u002Fcli\u002Fissues\u002F10263) is the open request).\nPassing them makes `gh` read each as a positional argument and refuse:\n\n```\naccepts at most 1 arg(s), received 4\n```\n\nThis corpus already records that, in\n[`skills\u002Fardi\u002FSKILL.md`](..\u002Fardi\u002FSKILL.md) and\n[`memories\u002Fgh-cli.md`](..\u002F..\u002Fmemories\u002Fgh-cli.md).\n\nOnce the run completes, evaluate it in **one** filter that names every\noutcome:\n\n```bash\ngh pr view \u003CN> --repo \u003Cowner>\u002F\u003Crepo> --json comments \\\n  | jq -r --arg bot \"$BOT\" --arg before \"$BEFORE\" '\n    [.comments[] | select(.author.login == $bot)] | last\n    | if   . == null      then \"BROKEN: no comment from \\($bot) at all\"\n      elif .id == $before then \"BROKEN: newest comment unchanged; this run posted nothing\"\n      elif (.body | test(\"(?i)###\\\\s*verdict\")) then \"WORKING: new verdict \\(.id)\"\n      else \"INCONCLUSIVE: new comment \\(.id), no verdict heading\"\n      end'\n```\n\n**Use one filter, never a `BEFORE` capture compared against a\ndifferently-shaped read.**\nThat two-command form is the trap, and it is subtle enough to have shipped\nhere once already.\n`.id \u002F\u002F \"none\"` yields `none` on an empty result,\nwhile `\"\\(.id) \\(.createdAt)\"` on the same empty result yields the string\n`null null`.\nThose two differ, so a PR with **no** prior review reports the token\n**working** whatever the run did --\na false pass in the one step that exists to prevent false passes.\nMeasured on this repo, against a PR with no reviews:\n`none` versus `null null`.\n\nNote what the `.body` test buys as well.\nWithout it the check accepts any new comment,\nincluding a cost tally or a quota-exhausted notice,\nneither of which is a review.\n\nTake the run's length from its own `createdAt` and `updatedAt` once it has\ncompleted, never from a `status` field read mid-flight.\n`status` lags, so a finished job can still read `in_progress`,\nand inferring elapsed time from that measures the API's freshness\nrather than the job's runtime.\n\nTwo cautions on reading a short run.\n\nA short run means the job stopped before reaching the model.\nIt does not by itself mean the credential is why.\nCheckout failures, App-token exchange failures,\nand workflow-validation refusals all die in the same few-tens-of-seconds band.\nOpen the log and quote the line the job actually died on\nbefore blaming the token.\n\nAnd a draft PR is not a test.\nThis repo's `claude-review` skips on drafts,\nso dispatching against one produces a fast, green, review-free run\nthat looks exactly like the failure you are checking for.\nUse a non-draft PR.\n\n### 5. Report\n\nSay how many repos rotated, which failed, and which repo the verification ran on.\nName the account if step 2 established it.\nA rotation reported without a verification repo\nis a write that nobody confirmed authenticates.\n\n## Why write-verified is not auth-verified\n\nWorth stating plainly, because the script's own verification is good\nand that is exactly what makes it easy to over-read.\n\n`rotate()` compares `updated_at` before and after,\nwhich answers \"did GitHub store something different\".\nThe question a user actually cares about\nis \"will the reviewer be able to authenticate\",\nand no property of the secrets API can answer that:\nthe endpoint returns only name, `created_at`, and `updated_at`,\nand the action's logs mask the value as `***`.\n\nSo the only instrument is behavioural,\nand the only positive evidence is a run that reached the model.\nThis is the failure recorded in\n[`review-verdict-pitfalls`](..\u002F..\u002Fshared\u002Fworkflow\u002Freview-verdict-pitfalls.md)'s\neighth case and its cross-repo variant:\nseven `claude-review` runs on `d-morrison\u002Faltdoc` #95 and #96\nfailing in the 26-to-35-second band\nwith `is_error: true`, `total_cost_usd: 0`, and no permission denials,\nwhile the same reviewer returned a full verdict on another owner's repo\nminutes later.\nNo number of re-runs would have shown that;\nonly a working control on a different credential did.\n\n## Edge cases\n\n- **A repo that has never had the secret.**\n  The script cannot reach it at all, with or without `--repos`,\n  for the reason in \"What this is not\" above.\n  Use `gh secret set` directly.\n- **Re-running with an unchanged token.**\n  If GitHub does not bump `updated_at` when the value is identical,\n  the script reports the write as unverified.\n  That is a false alarm rather than a false pass,\n  which is the safe direction.\n- **`gh` not on `PATH`.**\n  The script exits with that message rather than proceeding.\n- **Org-level secrets.**\n  `gh secret set \u003Cname> --org \u003Corg> --visibility selected --repos \u003Crepo1>,\u003Crepo2>`\n  sets one secret for several repos.\n  `--repos` takes **bare** repo names, comma-separated, not `owner\u002Fname`:\n  the owner is already fixed by `--org`.\n  Note that a sweep of 324 admin repos in 2026-07 found\n  zero org-level Claude secrets and 35 repo-level ones,\n  so the estate is repo-level today\n  and moving it is a change of shape, not a rotation.\n\n## Anti-patterns\n\n- Running `\u002Finstall-github-app` to fix an expired token,\n  which reinstalls the App and rescaffolds workflows to change one secret.\n- Passing the token as a command-line argument or via `--body`,\n  putting it in `ps` output and shell history.\n- Reporting a rotation as done on the strength of step 3 alone,\n  which verifies the write and not the credential.\n- Reading a short, green, review-free run on a **draft** PR\n  as evidence the token is broken.\n- Diagnosing a short run as a credential failure\n  without opening the log,\n  when checkout, App-token exchange, and workflow validation\n  fail in the same duration band.\n- Rotating against a preview whose error count was not read,\n  leaving unreadable repos silently on the old token.\n- Hardcoding a repo list into a rotation\n  instead of letting the script discover it,\n  per [`avoid-hardcoding-external-data`](..\u002F..\u002Fshared\u002Fcoding\u002Favoid-hardcoding-external-data.md).\n\n## Relationship to other skills\n\n- **`claude-agent-workflow` \u002F `claude-review-workflow`** author and modify the\n  workflows that consume this secret.\n  This skill only replaces the secret and never edits a workflow file.\n- **`permission-check`** covers what a workflow token is allowed to do;\n  this covers whether the Claude credential authenticates at all.\n  A job can fail for either reason with a similar-looking short run.\n- **`ardi`** is what resumes once reviews work again.\n  A reviewer that never posts is not a clean verdict,\n  per [`fully-clean`](..\u002F..\u002Fshared\u002Fworkflow\u002Ffully-clean.md)'s\n  \"no findings\" versus \"no verdict\" distinction.\n- **`cdu`** audits stale pinned dependencies.\n  A stale credential is a different kind of staleness and is not in its sweep.\n","# refresh-claude-token\n\nReplace `CLAUDE_CODE_OAUTH_TOKEN` on the repos that already carry it,\nand confirm the replacement actually works.\n\n`\u002Finstall-github-app` is the only built-in that writes this secret,\nand it bundles that write with installing the GitHub App\nand committing workflow files.\nWhen the token is the only thing that needs replacing,\nthat command does far more than the job requires,\nand re-running it against a repo whose workflows are already customized\nrisks scaffolding over them.\n\nThis skill is a thin wrapper.\nThe work is done by `scripts\u002Frotate-claude-token.py`,\nwhich already discovers its targets, previews by default,\nkeeps the token out of `argv`,\nand confirms each write landed.\nRead that script's docstring before changing anything here.\n\n## When this fires\n\n- \"refresh the claude token\", \"rotate the claude token\", \"rct\"\n- \"update CLAUDE_CODE_OAUTH_TOKEN\", \"the claude token expired\"\n- A review job whose log carries an explicit credential rejection:\n  a 401, an `OAuth token has expired`, or an `Invalid bearer token`.\n\n**A short failing run is not on that list, deliberately.**\nIt is tempting to add one, because a rejected credential does produce a fast\n`is_error: true` run with no verdict.\nSo do a checkout failure, an App-token exchange failure,\nand a workflow-validation refusal,\nwhich step 4 below and\n[`fully-clean`](..\u002F..\u002Fshared\u002Fworkflow\u002Ffully-clean.md) both say cannot be told\napart by duration.\n\nSince this skill's whole output is a secret rewrite,\nfiring it on the ambiguous signal spends a rotation on a problem a rotation\ncannot fix,\nand then credits the rotation when the real cause clears on its own.\nRead the log and find the rejection line first.\nNo line, no rotation.\n\n## What this is not\n\nInstalling the GitHub App,\ncommitting or editing anything under `.github\u002Fworkflows\u002F`,\nor provisioning the secret into a repo that has never had it.\n\nThat last one is a hard limit of the script, not a policy choice.\n\n`--repos` bypasses **discovery**, not **secret discovery** --- and since ai-config#2371 that includes the org-level sweep, so an explicit repo list never rotates the org secret.\n`find_targets()` keeps a repo only when `secret_updated_at()` returns non-`None`, so a repo lacking the secret is dropped even when named explicitly.\nOn the default discovery path the script now checks each org for an **org-level** copy of the secret too (the estate's primary scope since ai-config#2360), rotates it with an explicit `--visibility` preserving what it had, and reports the two scopes separately.\nA fully-discovered estate carrying the secret in NO scope is a hard error (exit 1), not a quiet no-op --- that reading is indistinguishable from a broken sweep (#2371 point 4);\nthe benign `Nothing to rotate in the named repos.` no-op remains only on the `--repos` path, where the caller deliberately narrowed the query.\n\nThe script's docstring says the same, so provision with `gh secret set`\ndirectly instead:\n\n```bash\ngh secret set CLAUDE_CODE_OAUTH_TOKEN --repo \u003Cowner>\u002F\u003Crepo>   # SET_SECRET\ngh secret set CLAUDE_CODE_OAUTH_TOKEN --org \u003Corg> --visibility all   # SET_ORG_SECRET\n```\n\nDo that deliberately, since it decides which account's quota that scope spends.\n\nFor authoring or changing the workflows themselves,\nuse `claude-agent-workflow` or `claude-review-workflow`.\n\n## Procedure\n\n### 1. Preview, and read the target list\n\n```bash\npython3 scripts\u002Frotate-claude-token.py            # preview; changes nothing\n```\n\nThis prints the owners swept, the number of repos inspected,\nand every repo carrying the secret with its current `updated_at`.\n\nRead the count before going further.\nA number far below the last known sweep\nmeans the discovery step failed rather than that the estate shrank,\nand rotating against a truncated list\nleaves the untouched repos on the old token with nothing reporting it.\nThe script prints unreadable repos to stderr for exactly this reason,\nso a run reporting errors has understated its own target list.\n\n### 2. Mint the token -- the human runs this step\n\n`claude setup-token` is interactive,\nand an agent session cannot complete it.\nRun non-interactively it does not fail fast:\nwith stdin closed it printed nothing and was still running when killed at 8\nseconds,\nso an agent that calls it hangs rather than getting an error to report.\n\nThe gate is a post-authorize read, established by inspecting the blocked\nprocess rather than inferred:\n\n```bash\nps -o pid=,stat= -p \u003Cpid>        # S, still alive after the browser authorize\nlsof -p \u003Cpid> -a -d 0            # fd 0 is a unix socket, not a TTY\n```\n\nIt opens a browser, and after you authorize it blocks reading an\nauthorization code from stdin.\nAn agent-spawned process has a socket on fd 0, so that read can never be\nsatisfied.\nThe full record is in\n[`memories\u002Fclaude-code.md`](..\u002F..\u002Fmemories\u002Fclaude-code.md).\n\n**Never have the user run it through `!`, bare or piped.**\nIt prints a live, long-lived OAuth token,\nso a bare `! claude setup-token` puts that credential into the agent's\ncontext and the persisted session transcript.\nPiped through `!` it never finishes either.\nClaude Code runs `!` commands with stdin set to `\u002Fdev\u002Fnull` and no terminal,\nand on 2026-09-29 the pipeline was still running minutes later (ai-config#4127).\nWhy a `\u002Fdev\u002Fnull` stdin hangs rather than failing on EOF is not established.\n\nPiping its stdout into a consumer is not safe either.\nIt writes its whole screen to stdout, not just the token,\nand on 2026-09-29 that stored 2039 characters of prose as the org secret,\nbreaking review on every repo reading it (ai-config#4129).\n`rotate-claude-token.py` now refuses any value that is not one `sk-ant-...` token.\n\nHave the user run the wrapper **in a real terminal**:\n\n```bash\nscripts\u002Frefresh-claude-org-token.sh [org]     # org defaults to Morrison-Lab\n```\n\nIt runs `claude setup-token` on the terminal,\nthen asks for the token at a hidden prompt,\nrejoins a token that wrapped across lines,\nand rotates through the script.\n\n**Mind which account is logged in, without minting anything to find out.**\nThe command mints from whichever account the local CLI is currently\nauthenticated as,\nwith no account picker and no confirmation naming it.\n`claude auth status` answers that on its own,\nso run it *before* deciding to rotate rather than minting a token to\ndiscover the answer:\n\n```bash\nclaude auth status\n```\n\n`scripts\u002Frotate-claude-token.py` automatically reads the active account identity via\n`claude auth status` (or `--account \u003Cemail>`) and sets the companion GitHub Actions\nvariable `CLAUDE_CODE_ACCOUNT_EMAIL` at the org\u002Frepo level alongside the secret, so\nreusable review workflows (gha#1018) can name which account quota was hit when a\nreview is skipped.\n\n### 3. Rotate\n\nNever pass the token as an argument:\n`argv` is visible to anyone who can run `ps`,\nand it lands in shell history.\nThe user runs the wrapper from step 2, which covers this step too.\nAcross every owner rather than one org, the equivalent is:\n\n```bash\nclaude setup-token\npython3 scripts\u002Frotate-claude-token.py --apply    # prompts for the token, hidden\n```\n\nWhen the token is already in the environment, the agent can run:\n\n```bash\npython3 scripts\u002Frotate-claude-token.py --apply     # reads $CLAUDE_CODE_OAUTH_TOKEN\n```\n\nThe script re-reads each repo's `updated_at` after writing\nand fails the repo if the timestamp did not move,\nso a silent no-op cannot pass for a rotation.\n\n### 4. Verify the new token authenticates\n\n**This is the step the script cannot do, and the reason this skill exists.**\n\n`gh secret set` succeeds against any value.\nA garbage token bumps `updated_at` exactly like a good one,\nso step 3 finishing clean proves the secret **changed**\nand says nothing about whether it **works**.\n\nSettle it on the artifact rather than on the write.\nPick one **non-draft** PR, record what already exists, then dispatch:\n\nFirst find the reviewer's login **in this repo**, rather than assuming it.\nIt differs by repo:\n`Morrison-Lab\u002Fai-config` posts as `claude`,\nwhile `Morrison-Lab\u002Fgha` posts as `github-actions[bot]`.\nA hardcoded login matches nothing, which reads as \"posted nothing\":\n\n```bash\ngh pr view \u003CN> --repo \u003Cowner>\u002F\u003Crepo> --json comments \\\n  --jq '[.comments[].author.login] | unique'      # pick the reviewer's login\n```\n\nThen record the current state and dispatch:\n\n```bash\nBOT=claude                                        # from the query above\nBEFORE=$(gh pr view \u003CN> --repo \u003Cowner>\u002F\u003Crepo> --json comments \\\n  | jq -r --arg bot \"$BOT\" '[.comments[] | select(.author.login == $bot)] | last | .id \u002F\u002F \"none\"')\ngh workflow run claude-review.yml --repo \u003Cowner>\u002F\u003Crepo> \\\n  --ref \u003Cbranch> --field pr_number=\u003CN>            # RUN_WORKFLOW\n```\n\n**Pipe into standalone `jq`; do not pass `--arg` to `gh`'s own `--jq`.**\n`gh`'s `--jq` takes exactly one argument, the filter, and has no\n`--arg`\u002F`--argjson` passthrough\n([cli\u002Fcli#10263](https:\u002F\u002Fgithub.com\u002Fcli\u002Fcli\u002Fissues\u002F10263) is the open request).\nPassing them makes `gh` read each as a positional argument and refuse:\n\n```\naccepts at most 1 arg(s), received 4\n```\n\nThis corpus already records that, in\n[`skills\u002Fardi\u002FSKILL.md`](..\u002Fardi\u002FSKILL.md) and\n[`memories\u002Fgh-cli.md`](..\u002F..\u002Fmemories\u002Fgh-cli.md).\n\nOnce the run completes, evaluate it in **one** filter that names every\noutcome:\n\n```bash\ngh pr view \u003CN> --repo \u003Cowner>\u002F\u003Crepo> --json comments \\\n  | jq -r --arg bot \"$BOT\" --arg before \"$BEFORE\" '\n    [.comments[] | select(.author.login == $bot)] | last\n    | if   . == null      then \"BROKEN: no comment from \\($bot) at all\"\n      elif .id == $before then \"BROKEN: newest comment unchanged; this run posted nothing\"\n      elif (.body | test(\"(?i)###\\\\s*verdict\")) then \"WORKING: new verdict \\(.id)\"\n      else \"INCONCLUSIVE: new comment \\(.id), no verdict heading\"\n      end'\n```\n\n**Use one filter, never a `BEFORE` capture compared against a\ndifferently-shaped read.**\nThat two-command form is the trap, and it is subtle enough to have shipped\nhere once already.\n`.id \u002F\u002F \"none\"` yields `none` on an empty result,\nwhile `\"\\(.id) \\(.createdAt)\"` on the same empty result yields the string\n`null null`.\nThose two differ, so a PR with **no** prior review reports the token\n**working** whatever the run did --\na false pass in the one step that exists to prevent false passes.\nMeasured on this repo, against a PR with no reviews:\n`none` versus `null null`.\n\nNote what the `.body` test buys as well.\nWithout it the check accepts any new comment,\nincluding a cost tally or a quota-exhausted notice,\nneither of which is a review.\n\nTake the run's length from its own `createdAt` and `updatedAt` once it has\ncompleted, never from a `status` field read mid-flight.\n`status` lags, so a finished job can still read `in_progress`,\nand inferring elapsed time from that measures the API's freshness\nrather than the job's runtime.\n\nTwo cautions on reading a short run.\n\nA short run means the job stopped before reaching the model.\nIt does not by itself mean the credential is why.\nCheckout failures, App-token exchange failures,\nand workflow-validation refusals all die in the same few-tens-of-seconds band.\nOpen the log and quote the line the job actually died on\nbefore blaming the token.\n\nAnd a draft PR is not a test.\nThis repo's `claude-review` skips on drafts,\nso dispatching against one produces a fast, green, review-free run\nthat looks exactly like the failure you are checking for.\nUse a non-draft PR.\n\n### 5. Report\n\nSay how many repos rotated, which failed, and which repo the verification ran on.\nName the account if step 2 established it.\nA rotation reported without a verification repo\nis a write that nobody confirmed authenticates.\n\n## Why write-verified is not auth-verified\n\nWorth stating plainly, because the script's own verification is good\nand that is exactly what makes it easy to over-read.\n\n`rotate()` compares `updated_at` before and after,\nwhich answers \"did GitHub store something different\".\nThe question a user actually cares about\nis \"will the reviewer be able to authenticate\",\nand no property of the secrets API can answer that:\nthe endpoint returns only name, `created_at`, and `updated_at`,\nand the action's logs mask the value as `***`.\n\nSo the only instrument is behavioural,\nand the only positive evidence is a run that reached the model.\nThis is the failure recorded in\n[`review-verdict-pitfalls`](..\u002F..\u002Fshared\u002Fworkflow\u002Freview-verdict-pitfalls.md)'s\neighth case and its cross-repo variant:\nseven `claude-review` runs on `d-morrison\u002Faltdoc` #95 and #96\nfailing in the 26-to-35-second band\nwith `is_error: true`, `total_cost_usd: 0`, and no permission denials,\nwhile the same reviewer returned a full verdict on another owner's repo\nminutes later.\nNo number of re-runs would have shown that;\nonly a working control on a different credential did.\n\n## Edge cases\n\n- **A repo that has never had the secret.**\n  The script cannot reach it at all, with or without `--repos`,\n  for the reason in \"What this is not\" above.\n  Use `gh secret set` directly.\n- **Re-running with an unchanged token.**\n  If GitHub does not bump `updated_at` when the value is identical,\n  the script reports the write as unverified.\n  That is a false alarm rather than a false pass,\n  which is the safe direction.\n- **`gh` not on `PATH`.**\n  The script exits with that message rather than proceeding.\n- **Org-level secrets.**\n  `gh secret set \u003Cname> --org \u003Corg> --visibility selected --repos \u003Crepo1>,\u003Crepo2>`\n  sets one secret for several repos.\n  `--repos` takes **bare** repo names, comma-separated, not `owner\u002Fname`:\n  the owner is already fixed by `--org`.\n  Note that a sweep of 324 admin repos in 2026-07 found\n  zero org-level Claude secrets and 35 repo-level ones,\n  so the estate is repo-level today\n  and moving it is a change of shape, not a rotation.\n\n## Anti-patterns\n\n- Running `\u002Finstall-github-app` to fix an expired token,\n  which reinstalls the App and rescaffolds workflows to change one secret.\n- Passing the token as a command-line argument or via `--body`,\n  putting it in `ps` output and shell history.\n- Reporting a rotation as done on the strength of step 3 alone,\n  which verifies the write and not the credential.\n- Reading a short, green, review-free run on a **draft** PR\n  as evidence the token is broken.\n- Diagnosing a short run as a credential failure\n  without opening the log,\n  when checkout, App-token exchange, and workflow validation\n  fail in the same duration band.\n- Rotating against a preview whose error count was not read,\n  leaving unreadable repos silently on the old token.\n- Hardcoding a repo list into a rotation\n  instead of letting the script discover it,\n  per [`avoid-hardcoding-external-data`](..\u002F..\u002Fshared\u002Fcoding\u002Favoid-hardcoding-external-data.md).\n\n## Relationship to other skills\n\n- **`claude-agent-workflow` \u002F `claude-review-workflow`** author and modify the\n  workflows that consume this secret.\n  This skill only replaces the secret and never edits a workflow file.\n- **`permission-check`** covers what a workflow token is allowed to do;\n  this covers whether the Claude credential authenticates at all.\n  A job can fail for either reason with a similar-looking short run.\n- **`ardi`** is what resumes once reviews work again.\n  A reviewer that never posts is not a clean verdict,\n  per [`fully-clean`](..\u002F..\u002Fshared\u002Fworkflow\u002Ffully-clean.md)'s\n  \"no findings\" versus \"no verdict\" distinction.\n- **`cdu`** audits stale pinned dependencies.\n  A stale credential is a different kind of staleness and is not in its sweep.\n",{"name":5,"description":7,"allowed-tools":24,"user-invocable":27},[25,26],"Bash","Read",true,"main","0f720481f8ce3b3d9fef485f6e230d8b3035748e","skills\u002Frefresh-claude-token",1,"https:\u002F\u002Fgithub.com\u002FMorrison-Lab\u002Fai-config","https:\u002F\u002Fmorrison-lab.github.io\u002Fai-config\u002F","https:\u002F\u002Fgithub.com\u002FMorrison-Lab","2026-11-15 04:39:15",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":27},[38,41,44],{"tool":39,"command":40},"npx","npx skills add Morrison-Lab\u002Fai-config --skill refresh-claude-token",{"tool":42,"command":43},"bunx","bunx skills add Morrison-Lab\u002Fai-config --skill refresh-claude-token",{"tool":45,"command":46},"pnpm","pnpm dlx skills add Morrison-Lab\u002Fai-config --skill refresh-claude-token","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMorrison-Lab\u002Fai-config\u002Fblob\u002Fmain\u002Fskills\u002Frefresh-claude-token\u002FSKILL.md",[],[50,57,64,71,78,85],{"skillNo":51,"name":52,"nameZh":6,"description":53,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":19},"01M735BVYCGR5VEC65AFDVSNKW","wrap-up","End-of-session verification and UMS.","https:\u002F\u002Fgithub.com\u002FMorrison-Lab\u002Fai-config\u002Fblob\u002Fmain\u002Fskills\u002Fwrap-up\u002FSKILL.md",[],[],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M735BTH469T1CQ8G2Q9GENCR","workaround-watcher","Watch upstream issue for fix.","https:\u002F\u002Fgithub.com\u002FMorrison-Lab\u002Fai-config\u002Fblob\u002Fmain\u002Fskills\u002Fworkaround-watcher\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M735BRKZWFANSQ0GM380B4TD","wn","→ whats-next.","https:\u002F\u002Fgithub.com\u002FMorrison-Lab\u002Fai-config\u002Fblob\u002Fmain\u002Fskills\u002Fwn\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M735BPE9V830B3B6NGXQ56J6","whats-next","Recommend concrete next step or action.","https:\u002F\u002Fgithub.com\u002FMorrison-Lab\u002Fai-config\u002Fblob\u002Fmain\u002Fskills\u002Fwhats-next\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M735BMHQ60EAD5B7QAWXC5A0","wait-for-results","Wait for pipeline\u002FCI results.","https:\u002F\u002Fgithub.com\u002FMorrison-Lab\u002Fai-config\u002Fblob\u002Fmain\u002Fskills\u002Fwait-for-results\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M735BKGZHPN1PEMJ7YBD5VJ8","wai","→ send-notes.","https:\u002F\u002Fgithub.com\u002FMorrison-Lab\u002Fai-config\u002Fblob\u002Fmain\u002Fskills\u002Fwai\u002FSKILL.md",[],[]]