[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7F1TFAS2GDQR010AV81M3H1":3,"skill-same:01M7F1TFAS2GDQR010AV81M3H1":46},{"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":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M7F1TFAS2GDQR010AV81M3H1","patchbook-update",null,"Pull upstreams into a repo that keeps its changes in a patchbook (.patchbook\u002F), repair what broke from each change's intent, test and review, then merge and deploy only when the sync was clean or the test command passes, and otherwise ask, opening a pull request when there are commits to push. Use when a scheduled task or the user says to update a patchbook repo, or for \u002Fpatchbook-update or $patchbook-update.","willgosnold\u002Fpatchbook","willgosnold","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F90176365?v=4","01M7F13J2VJ2R4DZHPQY7P92A0","Will Gosnold","01M7F1K8G0DXVG90J6F8WQR138",1,"MIT","https:\u002F\u002Fgithub.com\u002Fwillgosnold\u002Fpatchbook\u002Fblob\u002Fmain\u002Fskills\u002Fpatchbook-update\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\nname: patchbook-update\ndescription: Pull upstreams into a repo that keeps its changes in a patchbook (.patchbook\u002F), repair what broke from each change's intent, test and review, then merge and deploy only when the sync was clean or the test command passes, and otherwise ask, opening a pull request when there are commits to push. Use when a scheduled task or the user says to update a patchbook repo, or for \u002Fpatchbook-update or $patchbook-update.\n---\n\n# Patchbook update\n\nThis repo keeps its changes to one or more upstream repos in `.patchbook\u002F`. Read `.patchbook\u002Fconfig.toml` and the guide it names (`guide`) before you change anything. `patchbook --help` lists the commands. The `patchbook` repo's `DESIGN.md` explains the model.\n\nNever edit the build output, or a vendored copy, by hand. Change the patchbook, then build.\n\nNever commit `.patchbook\u002Flast-sync.json`. To stage everything, use `git add -A -- . ':!.patchbook\u002Flast-sync.json'`. To commit one thing, stage its paths. Make every commit with `PATCHBOOK_HOOK=0 git commit`, which skips patchbook's pre-commit hook: in a fork the hook records unstaged and untracked files and hand edits to the output into whatever commit runs.\n\nTo read an upstream, use `patchbook upstream \u003Cname>`: `\u003Cname> \u003Cpath>` prints a file at the pin, `--diff` shows what upstream changed in the sync that last pinned it, and `--export \u003Cdir>` writes it all out for searching. Export outside the worktree. Use `--diff` only for an upstream `patchbook sync` printed `pinned` for in this run, since for any other it shows an older run's change.\n\n## What this run can use\n\nTell from the tools you have, not from the model name. A tool's name can carry a prefix, such as `mcp__t3-code__`. If you can't tell whether a tool is there, take the path without it.\n\n- **Thread tools**: `t3_thread_organize`. Without it, skip each step that archives or settles the thread.\n- **A subagent tool**: T3's `delegate_task`, or the agent's own, such as Claude Code's `Agent`. Step 5 says what to do with each, and without one.\n- **Pull request linking**: `link_pull_request`. Without it, open the pull request and don't link it.\n\nNever wait for an answer, even when someone is there: a run from cron or CI has no one to answer. To ask, leave the work where a person finds it (step 6) and end the run.\n\nEnd every run with one of these as its last line, so a scheduler can read the outcome:\n\n- `patchbook-update: up to date`\n- `patchbook-update: merged`\n- `patchbook-update: needs you: \u003Cthe decision>`, naming the pull request, branch or worktree that holds the work\n- `patchbook-update: failed: \u003Cthe error>`\n\n## 1. Check\n\nFirst, upgrade patchbook the way it was installed, if you can tell: `npm install -g @patchbook\u002Fcli@latest` for an npm install, or rerun the install script for a script install. If you can't tell how it was installed, or the upgrade fails, carry on with the installed version. `patchbook --version` prints it.\n\nThen run `patchbook check`.\n\n- Exit 0: no upstream has moved. Archive the thread with `t3_thread_organize` (`archive`) if you have it. End with `patchbook-update: up to date`.\n- Exit 10: continue. The JSON says which upstreams moved and which of their files changed.\n- Anything else: report the error, leave the thread active, and end with `patchbook-update: failed: \u003Cthe error>`.\n\n## 2. Sync on the run's own branch\n\nEvery run makes its own worktree and branch here, in T3 too. Never work in, or clean up, the checkout the run started in, even when it is a linked worktree: it may hold someone's work.\n\n1. Find the main branch and the main checkout. Shell variables don't last between commands, so note both values:\n   - `MAIN_BRANCH=$(git symbolic-ref --short refs\u002Fremotes\u002Forigin\u002FHEAD | sed 's#^origin\u002F##')`\n   - `MAIN_CHECKOUT=$(git worktree list --porcelain | sed -n 's\u002F^worktree \u002F\u002Fp' | head -n 1)`\n2. Make the run's worktree outside the repo: `git fetch origin && git worktree add -b \"$RUN_BR\" \"$RUN_WT\" origin\u002F$MAIN_BRANCH`, with `RUN_BR=patchbook\u002Fupstream-\u003Ctime>` and `RUN_WT=\"${XDG_CACHE_HOME:-$HOME\u002F.cache}\u002Fpatchbook\u002Fworktrees\u002F\u003Crepo>-\u003Ctime>\"`, `\u003Ctime>` as `date -u +%Y%m%d-%H%M%S` prints it and `\u003Crepo>` the main checkout's folder name. Note both values. Run every later command there, starting each with `cd \"$RUN_WT\" &&`, since some agents, Claude Code among them, move the shell back to where the run started after each command. Edit its files by their full path.\n3. Run `patchbook sync`. It moves every upstream that moved, and prints `\u003Cname>: pinned \u003Cshort sha>` for each one. If it exits non-zero, quote its message and ask (step 6), before any commit. If it exits 0 and prints no `pinned` line, every upstream that moved has moved back to its pin since step 1. Say that in one line, Clean up (below), archive the thread as step 1 does, and end with `patchbook-update: up to date`, with no commit. Otherwise commit everything it changed except `.patchbook\u002Flast-sync.json` (`git add -A -- . ':!.patchbook\u002Flast-sync.json'`, then `PATCHBOOK_HOOK=0 git commit`) as \"Sync upstream \u003Cname> to \u003Cshort sha>\", naming each upstream.\n4. Read `.patchbook\u002Flast-sync.json` (per upstream: what changed and what merged on its own) and the `problems` in `patchbook status --json` (what broke). Ignore its `lastSync`, which can hold older runs' reports. Here and in steps 3, 5 and 6, read only the reports of the upstreams `patchbook sync` printed `pinned` for. An upstream can move after step 1, so this list can be longer than `patchbook check`'s.\n\n## 3. Repair\n\nFix each problem from the change's intent and the guide. Keep upstream's new behaviour wherever the intent allows. Paths are staged paths: an upstream that isn't mounted at the root has its files under its mount folder.\n\n| Problem | What to do |\n| --- | --- |\n| conflict | Resolve the conflict markers in the change's `ours` copy so its intent holds on upstream's new text. |\n| gone | Upstream moved or deleted the file. If it moved (`maybe` in the sync report), point the edit at the new path: copy the new upstream file to `base`, redo `ours` from the intent, and update `CHANGE.md`. If it was deleted and the intent no longer applies, retire the change. |\n| orphan, missing, leak, check, placeholder | As the guide says. |\n| `replacedUpstreamChanged` | Upstream changed a file this repo replaces outright. Read upstream's change and carry over what the intent doesn't exclude. |\n\nAlso read the upstream changes in the sync report for new files or features the guide says to handle, even where no check fired.\n\nTo retire a change, remove it from `series` and its folder, and add it to `retired.md` with the reason.\n\nCommit each change you repair or retire on its own with `PATCHBOOK_HOOK=0 git commit`, as \"Carry \u003Cchange> to upstream \u003Cshort sha>\" or \"Retire \u003Cchange>\". Handle each `replacedUpstreamChanged` entry in such a commit, whose message names the file and says what you carried over, or what you left out and why. If you carried over nothing, commit with `PATCHBOOK_HOOK=0 git commit --allow-empty`.\n\n## 4. Test\n\nBefore you build, run `git status --porcelain`. Delete anything you or a test wrote that doesn't belong in the repo, such as an export or notes, but keep `.patchbook\u002Flast-sync.json`. If it then lists a file in the build output (the config's `[output] to` folder, or in a fork everything outside `.patchbook\u002F` and the vendored copies) or in a vendored copy (the folder an upstream's `vendor` names, wherever it is), that is a hand edit: don't commit it, and ask (step 6). Commit each other change or fix it lists, except `.patchbook\u002Flast-sync.json`, on its own with `PATCHBOOK_HOOK=0 git commit` and a message that says what it is. If you can't say what something is, ask (step 6).\n\nRun `patchbook build`. Since no commit runs the hook, this is the run's only build. If it fails, quote its message and ask (step 6). If `git status --porcelain` then lists more than `.patchbook\u002Flast-sync.json`, commit it as one build commit (`git add -A -- . ':!.patchbook\u002Flast-sync.json'`, then `PATCHBOOK_HOOK=0 git commit`). It holds only what `patchbook build` wrote: output files and `.patchbook\u002Fbuild.lock`.\n\nThen run the `[test]` from the config on `origin\u002F$MAIN_BRANCH` (`git show origin\u002F$MAIN_BRANCH:.patchbook\u002Fconfig.toml`), not the branch's copy, from the worktree's root: a `command` must exit 0, and an `instructions` file, also read from `origin\u002F$MAIN_BRANCH` (`git show origin\u002F$MAIN_BRANCH:\u003Cfile>`), is a procedure to follow. If that `git show` fails, ask (step 6). After each test run, delete each file that `git ls-files --others --exclude-standard -- . ':!.patchbook\u002Flast-sync.json'` lists. The pre-build check left no other untracked file, and the build commit holds what the build wrote, so each one is the test's output. Keep `.patchbook\u002Flast-sync.json`, which `patchbook sync` wrote and steps 5 and 6 still read. Then, if `git status --porcelain --untracked-files=no` prints anything, ask (step 6), even if the test passed. Fix a failure if you can, with at most two attempts. A fix changes what the test checks, never the test, its scripts or its fixtures. If the only fix you can find changes one of those, ask (step 6). Commit each fix on its own with `PATCHBOOK_HOOK=0 git commit`, as \"Fix test: \u003Cwhat>\", then do step 4 again.\n\n## 5. Review\n\nStart a reviewer in a subagent on every run that reaches this step, however small the diff, and go on to step 6 only after it returns.\n\nWith `delegate_task`, use `mode: \"wait\"` and `timeoutMs: 3600000`. If it returns `waitTimedOut` or `hasPendingQuestion`, or ends with no verdicts at all, stop it with `task_cancel` and count the round as a fail. Call `orchestrator_capabilities` first, and choose the reviewer's model from its `providers`:\n\n- Take the first provider, other than `inheritedProviderInstanceId`, with `canRunCrossProviderChildTask` true.\n- Of its models, take the one whose `label` has the highest version number, such as 6.1 in `GPT-6.1-Sol`. On a tie, or when no label has one, take the first listed.\n- If that model has an `effort` or `reasoningEffort` option, set it to the highest of `max`, `xhigh` and `high` that the option lists.\n\nSet `target` to the provider's `providerInstanceId`, the model's `id` (not its `label`) and that option. If the model lists none of `max`, `xhigh` and `high`, leave the option out. If no other provider qualifies, omit `target`, so the reviewer runs on this thread's model and effort.\n\nWith another subagent tool, start the reviewer on it and wait for its answer. If it ends with no verdicts at all, count the round as a fail.\n\nWith no subagent tool, review the work yourself as a separate pass: take the brief below, read each file it names again, and answer from what the files say now.\n\nIts brief holds:\n\n- the guide's path;\n- each repaired or retired change, with its intent;\n- the upstream changes from the sync report;\n- `git diff origin\u002F$MAIN_BRANCH...HEAD -- .patchbook`;\n- the test results.\n\nAsk it, per change: does the result meet the intent on upstream's new text, and does it change anything beyond the intent. Ask it once: did upstream add anything that should have been handled. It answers each pass or fail, with reasons, without asking questions. A change or question it gives no pass or fail counts as a fail. On a fail, fix what it found, commit the fix on its own with `PATCHBOOK_HOOK=0 git commit` as \"Fix review: \u003Cwhat>\", do step 4 again, and start a new review round, with the earlier findings in the brief. A timeout, a pending question or a missing verdict fails the round but finds nothing to fix, so it adds no commit: start the next round. Stop after two rounds.\n\n## 6. Merge, or ask\n\nMerge only when, on the commit you push, `patchbook status` exits 0, `patchbook build` exits 0 and `git status --porcelain --untracked-files=no` then prints nothing, and one of these signals holds:\n\n- **Clean.** In `.patchbook\u002Flast-sync.json`, the report of each upstream `patchbook sync` printed `pinned` for has an empty `replacedUpstreamChanged` list. Step 3 found nothing to handle, from a check or from reading upstream's changes. The only commit after the sync commit, if any, is step 4's build commit, and the rebase below brings in no commits. A repair, a retirement, a test fix or a review fix voids it.\n- **Tested.** The `[test]` on `origin\u002F$MAIN_BRANCH` has a `command`, and it exited 0 on the commit you push. After any later commit, a review fix included, do step 4 again.\n\nAn `instructions` test and the review are not signals, since an agent grades both.\n\nAsk the user instead of merging when that doesn't hold, or when:\n\n- `patchbook sync` exits non-zero;\n- upstream removed or reworked something an intent depends on, and retiring the change would lose something the user wanted;\n- meeting an intent needs a choice that the intents and the guide don't settle;\n- the second review round returns any fail;\n- a test fails and you can't fix it. A failing `instructions` test counts, even though a passing one is not a signal, and so does an `instructions` file you can't read from `origin\u002F$MAIN_BRANCH`;\n- a test leaves tracked files changed (`git status --porcelain --untracked-files=no` prints something), even if it passed;\n- step 4's pre-build check lists a hand edit to the output or a vendored copy;\n- a `replacedUpstreamChanged` entry in the report of an upstream `patchbook sync` printed `pinned` for has no step 3 commit that names its file;\n- the branch changes `[test]` in `.patchbook\u002Fconfig.toml` (see `git diff origin\u002F$MAIN_BRANCH...HEAD -- .patchbook\u002Fconfig.toml`);\n- the only fix you can find for a failing test changes the test, its scripts or its fixtures.\n\nTo ask, push the branch (`git push -u origin HEAD`) and open a pull request against `$MAIN_BRANCH` with `gh pr create`, and link it with `link_pull_request` if you have it. If `gh` is missing or can't open one, as for an `origin` outside GitHub, the pushed branch holds the work. If the push fails, the worktree holds it. If the branch has no commits of its own, as after a failed sync, skip the push and the pull request. Keep the worktree, since the operator's answer needs what is in it, and leave the thread active. End with `patchbook-update: needs you: \u003Cthe decision>`.\n\nOtherwise:\n\n1. Run `git fetch origin && git rebase origin\u002F$MAIN_BRANCH`. If the rebase fails, run `git rebase --abort` and ask. If it brought in new commits, Clean no longer holds, so do step 4 again and merge only if the condition above holds with Tested, or ask.\n2. Push to the main branch: `git push origin HEAD:$MAIN_BRANCH`.\n3. Fast-forward the main checkout, if it is on `$MAIN_BRANCH` and clean: `git -C \"$MAIN_CHECKOUT\" pull --ff-only`.\n4. Run the config's `[deploy]` command from this worktree's root, and report its output.\n5. Reply in a few lines: each upstream's range, what merged on its own, what you repaired and how, what you retired, and the test, review and deploy results.\n6. Clean up (below), and settle the thread with `t3_thread_organize` (`settle`) if you have it. End with `patchbook-update: merged`, or with `patchbook-update: failed: deploy: \u003Cthe error>` if `[deploy]` exited non-zero.\n\n## Clean up\n\nOnly after step 2 made the run's worktree, and not when you stopped to ask, remove that worktree and branch by the values you noted, never by where the shell is. Delete its `.patchbook\u002Flast-sync.json` first, since no commit holds it:\n\n```sh\nrm -f \"$RUN_WT\u002F.patchbook\u002Flast-sync.json\" && cd \"$MAIN_CHECKOUT\" && git worktree remove \"$RUN_WT\" && git branch -d \"$RUN_BR\"\n```\n\nNever add `--force` or `-D`, and never remove any other worktree or branch. If git refuses, because files are left in the worktree or the branch isn't merged, leave what it refused, and say above the last line which worktree or branch you kept and git's message.\n","# Patchbook update\n\nThis repo keeps its changes to one or more upstream repos in `.patchbook\u002F`. Read `.patchbook\u002Fconfig.toml` and the guide it names (`guide`) before you change anything. `patchbook --help` lists the commands. The `patchbook` repo's `DESIGN.md` explains the model.\n\nNever edit the build output, or a vendored copy, by hand. Change the patchbook, then build.\n\nNever commit `.patchbook\u002Flast-sync.json`. To stage everything, use `git add -A -- . ':!.patchbook\u002Flast-sync.json'`. To commit one thing, stage its paths. Make every commit with `PATCHBOOK_HOOK=0 git commit`, which skips patchbook's pre-commit hook: in a fork the hook records unstaged and untracked files and hand edits to the output into whatever commit runs.\n\nTo read an upstream, use `patchbook upstream \u003Cname>`: `\u003Cname> \u003Cpath>` prints a file at the pin, `--diff` shows what upstream changed in the sync that last pinned it, and `--export \u003Cdir>` writes it all out for searching. Export outside the worktree. Use `--diff` only for an upstream `patchbook sync` printed `pinned` for in this run, since for any other it shows an older run's change.\n\n## What this run can use\n\nTell from the tools you have, not from the model name. A tool's name can carry a prefix, such as `mcp__t3-code__`. If you can't tell whether a tool is there, take the path without it.\n\n- **Thread tools**: `t3_thread_organize`. Without it, skip each step that archives or settles the thread.\n- **A subagent tool**: T3's `delegate_task`, or the agent's own, such as Claude Code's `Agent`. Step 5 says what to do with each, and without one.\n- **Pull request linking**: `link_pull_request`. Without it, open the pull request and don't link it.\n\nNever wait for an answer, even when someone is there: a run from cron or CI has no one to answer. To ask, leave the work where a person finds it (step 6) and end the run.\n\nEnd every run with one of these as its last line, so a scheduler can read the outcome:\n\n- `patchbook-update: up to date`\n- `patchbook-update: merged`\n- `patchbook-update: needs you: \u003Cthe decision>`, naming the pull request, branch or worktree that holds the work\n- `patchbook-update: failed: \u003Cthe error>`\n\n## 1. Check\n\nFirst, upgrade patchbook the way it was installed, if you can tell: `npm install -g @patchbook\u002Fcli@latest` for an npm install, or rerun the install script for a script install. If you can't tell how it was installed, or the upgrade fails, carry on with the installed version. `patchbook --version` prints it.\n\nThen run `patchbook check`.\n\n- Exit 0: no upstream has moved. Archive the thread with `t3_thread_organize` (`archive`) if you have it. End with `patchbook-update: up to date`.\n- Exit 10: continue. The JSON says which upstreams moved and which of their files changed.\n- Anything else: report the error, leave the thread active, and end with `patchbook-update: failed: \u003Cthe error>`.\n\n## 2. Sync on the run's own branch\n\nEvery run makes its own worktree and branch here, in T3 too. Never work in, or clean up, the checkout the run started in, even when it is a linked worktree: it may hold someone's work.\n\n1. Find the main branch and the main checkout. Shell variables don't last between commands, so note both values:\n   - `MAIN_BRANCH=$(git symbolic-ref --short refs\u002Fremotes\u002Forigin\u002FHEAD | sed 's#^origin\u002F##')`\n   - `MAIN_CHECKOUT=$(git worktree list --porcelain | sed -n 's\u002F^worktree \u002F\u002Fp' | head -n 1)`\n2. Make the run's worktree outside the repo: `git fetch origin && git worktree add -b \"$RUN_BR\" \"$RUN_WT\" origin\u002F$MAIN_BRANCH`, with `RUN_BR=patchbook\u002Fupstream-\u003Ctime>` and `RUN_WT=\"${XDG_CACHE_HOME:-$HOME\u002F.cache}\u002Fpatchbook\u002Fworktrees\u002F\u003Crepo>-\u003Ctime>\"`, `\u003Ctime>` as `date -u +%Y%m%d-%H%M%S` prints it and `\u003Crepo>` the main checkout's folder name. Note both values. Run every later command there, starting each with `cd \"$RUN_WT\" &&`, since some agents, Claude Code among them, move the shell back to where the run started after each command. Edit its files by their full path.\n3. Run `patchbook sync`. It moves every upstream that moved, and prints `\u003Cname>: pinned \u003Cshort sha>` for each one. If it exits non-zero, quote its message and ask (step 6), before any commit. If it exits 0 and prints no `pinned` line, every upstream that moved has moved back to its pin since step 1. Say that in one line, Clean up (below), archive the thread as step 1 does, and end with `patchbook-update: up to date`, with no commit. Otherwise commit everything it changed except `.patchbook\u002Flast-sync.json` (`git add -A -- . ':!.patchbook\u002Flast-sync.json'`, then `PATCHBOOK_HOOK=0 git commit`) as \"Sync upstream \u003Cname> to \u003Cshort sha>\", naming each upstream.\n4. Read `.patchbook\u002Flast-sync.json` (per upstream: what changed and what merged on its own) and the `problems` in `patchbook status --json` (what broke). Ignore its `lastSync`, which can hold older runs' reports. Here and in steps 3, 5 and 6, read only the reports of the upstreams `patchbook sync` printed `pinned` for. An upstream can move after step 1, so this list can be longer than `patchbook check`'s.\n\n## 3. Repair\n\nFix each problem from the change's intent and the guide. Keep upstream's new behaviour wherever the intent allows. Paths are staged paths: an upstream that isn't mounted at the root has its files under its mount folder.\n\n| Problem | What to do |\n| --- | --- |\n| conflict | Resolve the conflict markers in the change's `ours` copy so its intent holds on upstream's new text. |\n| gone | Upstream moved or deleted the file. If it moved (`maybe` in the sync report), point the edit at the new path: copy the new upstream file to `base`, redo `ours` from the intent, and update `CHANGE.md`. If it was deleted and the intent no longer applies, retire the change. |\n| orphan, missing, leak, check, placeholder | As the guide says. |\n| `replacedUpstreamChanged` | Upstream changed a file this repo replaces outright. Read upstream's change and carry over what the intent doesn't exclude. |\n\nAlso read the upstream changes in the sync report for new files or features the guide says to handle, even where no check fired.\n\nTo retire a change, remove it from `series` and its folder, and add it to `retired.md` with the reason.\n\nCommit each change you repair or retire on its own with `PATCHBOOK_HOOK=0 git commit`, as \"Carry \u003Cchange> to upstream \u003Cshort sha>\" or \"Retire \u003Cchange>\". Handle each `replacedUpstreamChanged` entry in such a commit, whose message names the file and says what you carried over, or what you left out and why. If you carried over nothing, commit with `PATCHBOOK_HOOK=0 git commit --allow-empty`.\n\n## 4. Test\n\nBefore you build, run `git status --porcelain`. Delete anything you or a test wrote that doesn't belong in the repo, such as an export or notes, but keep `.patchbook\u002Flast-sync.json`. If it then lists a file in the build output (the config's `[output] to` folder, or in a fork everything outside `.patchbook\u002F` and the vendored copies) or in a vendored copy (the folder an upstream's `vendor` names, wherever it is), that is a hand edit: don't commit it, and ask (step 6). Commit each other change or fix it lists, except `.patchbook\u002Flast-sync.json`, on its own with `PATCHBOOK_HOOK=0 git commit` and a message that says what it is. If you can't say what something is, ask (step 6).\n\nRun `patchbook build`. Since no commit runs the hook, this is the run's only build. If it fails, quote its message and ask (step 6). If `git status --porcelain` then lists more than `.patchbook\u002Flast-sync.json`, commit it as one build commit (`git add -A -- . ':!.patchbook\u002Flast-sync.json'`, then `PATCHBOOK_HOOK=0 git commit`). It holds only what `patchbook build` wrote: output files and `.patchbook\u002Fbuild.lock`.\n\nThen run the `[test]` from the config on `origin\u002F$MAIN_BRANCH` (`git show origin\u002F$MAIN_BRANCH:.patchbook\u002Fconfig.toml`), not the branch's copy, from the worktree's root: a `command` must exit 0, and an `instructions` file, also read from `origin\u002F$MAIN_BRANCH` (`git show origin\u002F$MAIN_BRANCH:\u003Cfile>`), is a procedure to follow. If that `git show` fails, ask (step 6). After each test run, delete each file that `git ls-files --others --exclude-standard -- . ':!.patchbook\u002Flast-sync.json'` lists. The pre-build check left no other untracked file, and the build commit holds what the build wrote, so each one is the test's output. Keep `.patchbook\u002Flast-sync.json`, which `patchbook sync` wrote and steps 5 and 6 still read. Then, if `git status --porcelain --untracked-files=no` prints anything, ask (step 6), even if the test passed. Fix a failure if you can, with at most two attempts. A fix changes what the test checks, never the test, its scripts or its fixtures. If the only fix you can find changes one of those, ask (step 6). Commit each fix on its own with `PATCHBOOK_HOOK=0 git commit`, as \"Fix test: \u003Cwhat>\", then do step 4 again.\n\n## 5. Review\n\nStart a reviewer in a subagent on every run that reaches this step, however small the diff, and go on to step 6 only after it returns.\n\nWith `delegate_task`, use `mode: \"wait\"` and `timeoutMs: 3600000`. If it returns `waitTimedOut` or `hasPendingQuestion`, or ends with no verdicts at all, stop it with `task_cancel` and count the round as a fail. Call `orchestrator_capabilities` first, and choose the reviewer's model from its `providers`:\n\n- Take the first provider, other than `inheritedProviderInstanceId`, with `canRunCrossProviderChildTask` true.\n- Of its models, take the one whose `label` has the highest version number, such as 6.1 in `GPT-6.1-Sol`. On a tie, or when no label has one, take the first listed.\n- If that model has an `effort` or `reasoningEffort` option, set it to the highest of `max`, `xhigh` and `high` that the option lists.\n\nSet `target` to the provider's `providerInstanceId`, the model's `id` (not its `label`) and that option. If the model lists none of `max`, `xhigh` and `high`, leave the option out. If no other provider qualifies, omit `target`, so the reviewer runs on this thread's model and effort.\n\nWith another subagent tool, start the reviewer on it and wait for its answer. If it ends with no verdicts at all, count the round as a fail.\n\nWith no subagent tool, review the work yourself as a separate pass: take the brief below, read each file it names again, and answer from what the files say now.\n\nIts brief holds:\n\n- the guide's path;\n- each repaired or retired change, with its intent;\n- the upstream changes from the sync report;\n- `git diff origin\u002F$MAIN_BRANCH...HEAD -- .patchbook`;\n- the test results.\n\nAsk it, per change: does the result meet the intent on upstream's new text, and does it change anything beyond the intent. Ask it once: did upstream add anything that should have been handled. It answers each pass or fail, with reasons, without asking questions. A change or question it gives no pass or fail counts as a fail. On a fail, fix what it found, commit the fix on its own with `PATCHBOOK_HOOK=0 git commit` as \"Fix review: \u003Cwhat>\", do step 4 again, and start a new review round, with the earlier findings in the brief. A timeout, a pending question or a missing verdict fails the round but finds nothing to fix, so it adds no commit: start the next round. Stop after two rounds.\n\n## 6. Merge, or ask\n\nMerge only when, on the commit you push, `patchbook status` exits 0, `patchbook build` exits 0 and `git status --porcelain --untracked-files=no` then prints nothing, and one of these signals holds:\n\n- **Clean.** In `.patchbook\u002Flast-sync.json`, the report of each upstream `patchbook sync` printed `pinned` for has an empty `replacedUpstreamChanged` list. Step 3 found nothing to handle, from a check or from reading upstream's changes. The only commit after the sync commit, if any, is step 4's build commit, and the rebase below brings in no commits. A repair, a retirement, a test fix or a review fix voids it.\n- **Tested.** The `[test]` on `origin\u002F$MAIN_BRANCH` has a `command`, and it exited 0 on the commit you push. After any later commit, a review fix included, do step 4 again.\n\nAn `instructions` test and the review are not signals, since an agent grades both.\n\nAsk the user instead of merging when that doesn't hold, or when:\n\n- `patchbook sync` exits non-zero;\n- upstream removed or reworked something an intent depends on, and retiring the change would lose something the user wanted;\n- meeting an intent needs a choice that the intents and the guide don't settle;\n- the second review round returns any fail;\n- a test fails and you can't fix it. A failing `instructions` test counts, even though a passing one is not a signal, and so does an `instructions` file you can't read from `origin\u002F$MAIN_BRANCH`;\n- a test leaves tracked files changed (`git status --porcelain --untracked-files=no` prints something), even if it passed;\n- step 4's pre-build check lists a hand edit to the output or a vendored copy;\n- a `replacedUpstreamChanged` entry in the report of an upstream `patchbook sync` printed `pinned` for has no step 3 commit that names its file;\n- the branch changes `[test]` in `.patchbook\u002Fconfig.toml` (see `git diff origin\u002F$MAIN_BRANCH...HEAD -- .patchbook\u002Fconfig.toml`);\n- the only fix you can find for a failing test changes the test, its scripts or its fixtures.\n\nTo ask, push the branch (`git push -u origin HEAD`) and open a pull request against `$MAIN_BRANCH` with `gh pr create`, and link it with `link_pull_request` if you have it. If `gh` is missing or can't open one, as for an `origin` outside GitHub, the pushed branch holds the work. If the push fails, the worktree holds it. If the branch has no commits of its own, as after a failed sync, skip the push and the pull request. Keep the worktree, since the operator's answer needs what is in it, and leave the thread active. End with `patchbook-update: needs you: \u003Cthe decision>`.\n\nOtherwise:\n\n1. Run `git fetch origin && git rebase origin\u002F$MAIN_BRANCH`. If the rebase fails, run `git rebase --abort` and ask. If it brought in new commits, Clean no longer holds, so do step 4 again and merge only if the condition above holds with Tested, or ask.\n2. Push to the main branch: `git push origin HEAD:$MAIN_BRANCH`.\n3. Fast-forward the main checkout, if it is on `$MAIN_BRANCH` and clean: `git -C \"$MAIN_CHECKOUT\" pull --ff-only`.\n4. Run the config's `[deploy]` command from this worktree's root, and report its output.\n5. Reply in a few lines: each upstream's range, what merged on its own, what you repaired and how, what you retired, and the test, review and deploy results.\n6. Clean up (below), and settle the thread with `t3_thread_organize` (`settle`) if you have it. End with `patchbook-update: merged`, or with `patchbook-update: failed: deploy: \u003Cthe error>` if `[deploy]` exited non-zero.\n\n## Clean up\n\nOnly after step 2 made the run's worktree, and not when you stopped to ask, remove that worktree and branch by the values you noted, never by where the shell is. Delete its `.patchbook\u002Flast-sync.json` first, since no commit holds it:\n\n```sh\nrm -f \"$RUN_WT\u002F.patchbook\u002Flast-sync.json\" && cd \"$MAIN_CHECKOUT\" && git worktree remove \"$RUN_WT\" && git branch -d \"$RUN_BR\"\n```\n\nNever add `--force` or `-D`, and never remove any other worktree or branch. If git refuses, because files are left in the worktree or the branch isn't merged, leave what it refused, and say above the last line which worktree or branch you kept and git's message.\n",{"name":5,"description":7},"main","b47f5118e95c2c9791e6e975b6a9a97571d2dc67","skills\u002Fpatchbook-update",0,"https:\u002F\u002Fgithub.com\u002Fwillgosnold\u002Fpatchbook","https:\u002F\u002Fgithub.com\u002Fwillgosnold","Independent AI safety research | London | MSc @ University of Exeter ","2026-10-28 06:42:27",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add willgosnold\u002Fpatchbook --skill patchbook-update",{"tool":38,"command":39},"bunx","bunx skills add willgosnold\u002Fpatchbook --skill patchbook-update",{"tool":41,"command":42},"pnpm","pnpm dlx skills add willgosnold\u002Fpatchbook --skill patchbook-update","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fwillgosnold\u002Fpatchbook\u002Fblob\u002Fmain\u002Fskills\u002Fpatchbook-update\u002FSKILL.md",true,[],[47,54,61,68,75,82],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":19},"01M7F1T945FRSKCATSWWGM0HJG","why","Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Discovers available MCPs and queries each evidence category (source control, issue tracker, long-form docs, real-time chat, infrastructure observability, error tracking, product analytics warehouse) in parallel, then returns a cited read on decisions and tradeoffs. Use how for runtime behavior.","https:\u002F\u002Fgithub.com\u002Fwillgosnold\u002Fpatchbook\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwhy\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M7F1T54ST6QFMHX8CX01DKNB","verify-patchbook","Drive the patchbook CLI from this checkout in a disposable sandbox (its own git repos, store, config and a fake model) and capture a transcript as proof. Use to reproduce a patchbook bug, run an issue's repro script, or prove a change to clone, init, record, the pre-commit hook, build, status, check, sync or upstream works the way a user would see it.","https:\u002F\u002Fgithub.com\u002Fwillgosnold\u002Fpatchbook\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fverify-patchbook\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M7F1T3NHKBVGVD4BT2C5BG7A","unslop","Cut AI tells from any writing.","https:\u002F\u002Fgithub.com\u002Fwillgosnold\u002Fpatchbook\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Funslop\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M7F1T1SSJSW2KVN8JXXBGZNN","typescript-best-practices","TypeScript best practices. Use when reading or editing any .ts or .tsx file.","https:\u002F\u002Fgithub.com\u002Fwillgosnold\u002Fpatchbook\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ftypescript-best-practices\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M7F1SXXN9RHQNWNG3JFBPZW0","technical-writing","Layered technical-writing standard: Diátaxis structure, Google developer style sentences, STE instruction rules, Global English syntax. Use for \u002Ftechnical-writing or $technical-writing, or when writing or reviewing docs, RFCs, readmes, PR descriptions, or commit messages.","https:\u002F\u002Fgithub.com\u002Fwillgosnold\u002Fpatchbook\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ftechnical-writing\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M7F1STRMBZWJT6FCM4M97G60","teach","Explain a body of work plainly so a person actually understands it. Runs the `how` and `why` skills and weaves what they find into one clear explanation. Use for 'teach me this', 'help me really understand X', 'explain this change or subsystem to me'.","https:\u002F\u002Fgithub.com\u002Fwillgosnold\u002Fpatchbook\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fteach\u002FSKILL.md",[],[]]