update-from-main
Safely sync attached non-`main` worktree branch with fetched `origin/main`
Install / Use
npx skills add HenryQW/pi-harness --skill update-from-mainInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Development & EngineeringSupported Platforms
Tags
Our assessment of update-from-main
update-from-main scores 74/100 on our quality scale, 3730th of 4,642 Development & Engineering skills we index.
Its SKILL.md is 8.0 KB long, split into 6 sections with 5 code examples: a thorough specification that gives an agent plenty to work with.
It has no GitHub stars yet, so there is no community track record; judge it on its content.
Maintenance, license and trust
- The repository was last updated 7 days ago, so update-from-main is actively maintained.
- No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
- Its trust signals score 80/100, with 2 cautions from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands.
Automated pattern scan on 2026-10-29. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
update-from-main compared with similar skills
All 4 of these similar skills score higher than update-from-main; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| update-from-main (this skill)by HenryQW | 74 | 0 | 7d ago | SKILL.md |
| taste-skillby Leonxlnx | 100 | 105.4k | today | CLAUDE.md |
| ai-job-searchby ai-job-search-dev | 100 | 67.5k | 2d ago | CLAUDE.md |
| claude-howtoby luongnv89 | 100 | 46.1k | today | CLAUDE.md |
| algorithmic-artby anthropics | 100 | 177.9k | 37d ago | SKILL.md |
Frequently asked questions
- How do I install update-from-main?
- Run
npx skills add HenryQW/pi-harness --skill update-from-main. The install tabs above show the steps for each supported agent. - Which AI agents does update-from-main work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is update-from-main safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. It declares no license and scores 80/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is update-from-main still maintained?
- The repository was last updated 7 days ago, so update-from-main is actively maintained.
Skill content
View source on GitHubname: update-from-main
description: Safely sync attached non-main worktree branch with fetched origin/main. Use when asked to update, merge, or bring main into current branch.
update-from-main
Run python3 <skill>/scripts/update_from_main.py once from the target worktree. Use this file's directory for <skill>. Requires Python 3.9 or newer and Git with fetch --porcelain. This is a standalone merge without publication, not the guarded pull request (PR) branch update. The helper fetches before worktree mutation, backs up tracked/untracked state plus ignored paths when they collide, and merges the exact main OID captured from fetch output. It does not push or use GitHub. Before it stashes, the helper records ownership in this worktree's per-worktree ref. A retained backup blocks another run in its own worktree, also after a branch switch, but not in other worktrees. The instructions below are the single recovery guide.
If Pi started in a non-Git parent, select the intended worktree explicitly before running the helper. Run its commands in that worktree, not the parent. Set projectPath on every git_conflict call to that canonical worktree root. Relative tool paths start at the Pi session directory, not the helper directory. Never use conflict block identifiers from a sibling repository or another linked worktree.
Fast path
For status=merged or status=up_to_date, report emitted line, run:
git status --short --branch
git diff --check <emitted-before-sha> HEAD
If stash is non-none, restoration used that exact OID and kept the backup. Report the OID even on success. A later run in this worktree stays blocked until the user verifies staged, unstaged, untracked, and applicable ignored bytes, then explicitly asks to complete recovery. Never pop or drop a mutable stash stack entry automatically.
Stop. No tests, install, history scan, push, extra commit, or helper rerun.
Recovery
Emitted main SHA is authoritative for run. Do not rerun because origin/main advances. Never rerun while emitted stash remains retained; finish current recovery first.
status=merge_conflict: resolve andgit add <paths>; runGIT_EDITOR=true git merge --continue, then apply non-nonestash withgit stash apply --index <oid>.status=merge_pending: fix failed merge hook, runGIT_EDITOR=true git merge --continue, then apply non-nonestash.status=submodule_update_required: rungit submodule update --checkout --recursive, then apply non-nonestash.status=stash_conflict: resolve and stage every emitted conflict path; retain and report stash OID.status=stash_restore_failed: retain and report stash OID. Inspect once withgit stash show --name-status --include-untracked <oid>, restore clear changes, and ask user only when one upstream-path collision version must win. Never drop backup first.
After manual recovery, keep the backup and report its OID. A later update in this worktree stays blocked until the user verifies restoration and explicitly asks to complete recovery. Do not drop it automatically. If execution stops without a complete result, inspect HEAD, Git operation state, the stash, and git for-each-ref refs/worktree/update-from-main/ before further action; do not rerun an uncertain mutation.
Complete recovery
Only after the user verifies the restored bytes and explicitly asks, run in the owning worktree:
git update-ref -d refs/worktree/update-from-main/backup <oid>
This unblocks the worktree and keeps the stash entry. Drop that entry only on a separate explicit request, with no concurrent stash changes in any linked worktree. Re-find its stash@{n} by OID with git stash list --format='%gd %H' immediately before git stash drop; a concurrent push can change the selector and cause removal of another backup.
Interrupted run
The helper error names refs/worktree/update-from-main/pending/<token> when a run stopped before it recorded its stash OID. Find this run's entry:
git stash list --format='%H %gs' | grep -F 'update-from-main owned <token>'
-
One entry: record it, remove the pending ref, then restore its exact OID. If
applyfails, continue asstash_restore_failed.git update-ref refs/worktree/update-from-main/backup <oid> "" git update-ref -d refs/worktree/update-from-main/pending/<token> git stash apply --index <oid> -
No entry: stop and retain the pending ref. Absence does not prove that Git left the worktree unchanged; another session can remove a shared stash entry. Inspect the stash reflog and local state. Only after the user verifies all expected staged, unstaged, untracked, and applicable ignored bytes and explicitly asks to complete recovery, run
git update-ref -d refs/worktree/update-from-main/pending/<token>. If the expected state cannot be verified, keep the ref and ask the user. -
More entries, or a
backupref is also present: stop and ask the user.
Legacy backup
A stash entry with subject update-from-main or update-from-main <uuid> came from a helper without worktree ownership. It blocks every worktree until its owner adopts it or the user explicitly drops it. Ask the user to confirm the owner: the worktree that created it (the stash subject names its branch), or, if that worktree is gone, the worktree where they will verify recovery. In the owner worktree, run:
git update-ref refs/worktree/update-from-main/backup <oid> ""
git update-ref refs/update-from-main/adopted/<oid> <oid> ""
The first command blocks the owner; the second unblocks other worktrees. Both keep the stash entry. Then verify or restore it with git stash apply --index <oid> as for stash_restore_failed, and complete recovery. Keep the shared adopted ref while the stash entry exists; delete it with git update-ref -d refs/update-from-main/adopted/<oid> <oid> only together with an explicitly requested drop of that entry.
Start conflict triage with the emitted JSON conflict path list and git show --no-patch --oneline <emitted-main-sha>. Call git_conflict with { "action": "list" } for numbered blocks, ids, and line ranges, then show one block at a time. For merge_conflict, ours is the current branch and theirs is main. For stash_conflict, ours is the updated worktree and theirs is the retained local backup. Never grep for markers, edit marker lines by hand, or dump full git diff --cc across files. Use bounded git show :2:path | sed -n '<start>,<end>p' and git show :3:path | sed -n '<start>,<end>p' only when a block lacks context. Prefer upstream for unrelated changes; combine compatible overlapping behavior. Ask user only when intent cannot determine one required semantic winner.
Resolve source first. Resolve the blocks of one file in one resolve call (at most 256 blocks; for more, continue with the returned remaining blocks) with each block number and id: @ours, @theirs, @both (ours then theirs), or @base (diff3 or zdiff3 markers only). For a combined edit, resolve the block to @both, then edit the joined lines. If resolve reports a changed block, nothing was written: run list again. A path with a note instead of blocks (binary, deleted, oversized, submodule, symlink, custom merge driver, changed merge attributes, or ambiguous markers) needs a whole-file decision: ask the user when intent does not select one version. The tool never stages files. Regenerate lockfiles and build artifacts instead of reading generated conflicts. For docs/index conflicts, keep entries whose paths exist, add upstream paths, remove deleted paths, and avoid full-repo scans.
After recovery, verify exact source merged:
git merge-base --is-ancestor <emitted-main-sha> HEAD
git status --short --branch
Run only smallest relevant check; docs-only recovery gets docs-specific checks, not broad tests. Run project dependency preflight before dependency-backed checks. Redirect check output to temp file. On success report the command and at most 20 summary lines. On failure report at most 80 lines or 8 KiB of relevant errors. Never rebase, reset, abort, push, or commit unrelated work.
Related Skills
taste-skill
105.4kAgent skills that give coding agents taste: art direction, reference images and a browser check instead of generic AI pages
ai-job-search
67.5kThe job search that runs on your machine. AI job application framework built on Claude Code: evaluate postings, tailor CVs, write cover letters, prep interviews. Fork it and own it.
claude-howto
46.1kA visual, example-driven guide to Claude Code — from basic concepts to advanced agents, with copy-paste templates that bring immediate value.
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
