upstream-sync
Skill12 starsChanged 9 days agoMITView on GitHub
Use when the owner asks the bot to take the shared version's updates — "обновись", "update from upstream", "pull updates" — or to check the last one — "проверь обновление". Covers merging `upstream/main` into this fork, the conflict policy, the migration and lockfile fix-ups, the upgrade guides, the checks, and the detached restart.
- Reads credentials
- Deletes or force-pushes
- Commits and pushes
10 other projects use a version of this.
Adopted by
Most recently taken up by
- ilien-dev/quirontheir own version, first seen Nov 8, 2026
- Blueforce-Tech-Inc/BlueCortexCEtheir own version, first seen Nov 8, 2026
- lrstanley/skillstheir own version, first seen Nov 1, 2026
- shruthis4/claude-skillstheir own version, first seen Oct 20, 2026
- halo-box/strix-llama.cpptheir own version, first seen Oct 17, 2026
- bradcstevens/git-loopy-skillstheir own version, first seen Oct 15, 2026
Other versions10 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 10
- microsoft/intelligent-terminal★ 2.3ksame name
- halo-box/strix-llama.cpp★ 282same name
- ilien-dev/quiron★ 69same name
- Blueforce-Tech-Inc/BlueCortexCE★ 4same name
- lrstanley/skills★ 2same name
- chenson42/stackkeel★ 1same name
- dris1153/upstream-sync★ 1same name
- steven-pribilinskiy/tabby-claude-status★ 1same name
- bradcstevens/git-loopy-skills★ 0same name
- shruthis4/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- effect-client-wrapperSkill
- effectSkill
- observabilitySkill
- quality-codeSkill
- self-updateSkill
- shadcnSkill
- typesafe-aiSkill
- lint-and-formatSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. 0 are common, 15 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 10 edited versions we read keep these.
15
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 14
Every command runs from the repo root at the path your prompt names.
- Distinctive: line 19
All three must hold. If one does not, change nothing, tell the owner in one sentence what is wrong, and stop.
- Distinctive: line 50
Keep the fork's side of every conflict in code the fork changed on purpose.
- Distinctive: line 51
Read both sides; keep upstream's new lines when they do not clash with the fork's edit.
- Very specific: line 64
Never edit index.ts or a migration upstream sent.
- Very specific: line 65
Follow the upgrade guides this merge brings, in name order (YYYYMMDD-NN-slug: date, then sequence).
- Distinctive: line 72
Do each guide's before-restart part now, except a step it marks for right before the restart: that one runs after step 10, before step 11.
- Distinctive: line 83
Commit the fix-ups, only if steps 2–5 changed anything:
- Distinctive: line 91
Use the first form while the merge is still in progress, the second after a clean one.
- Distinctive: line 93
Run what the service runs before it starts.
- Distinctive: line 99
Run the checks, all of them:
- Distinctive: line 112
If the push fails, do not restart.
- Very specific: line 128
Read .data/runs.json and systemctl --user show -p MainPID --value bot the same way self-update does, and name other running work in the …
- Distinctive: line 143
When the owner asks to check the update, run the after-restart part of every guide the last upstream merge added, then report the result in …
- Distinctive: line 155
Before step 9, the pushed state is untouched:
- Distinctive: line 162
After a restart that does not come back:
- Distinctive: line 177
Only when the owner asks. Never merge upstream as a side effect of other work.
- Very specific: line 178
Never rebase, never push to upstream, never edit .env.
- Very specific: line 179
Never restart with a conflict open, a check red, uncommitted changes, or commits that have not reached @{u}.
- Distinctive: line 181
Never restart twice in one run.
“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Merging upstream into the bot you are running inside
This bot is a fork. The shared version lives on the upstream remote; your own
branch is @{u}, the branch git push sends to. Run this only when the owner
asks for it. The order below is mandatory for the same reason as in self-update:
the service restarts from what is committed and pushed, and a bad merge that
restarts can leave the owner with a bot that does not come back.
Every command runs from the repo root at the path your prompt names. Read
AGENTS.md there first.
Before you start
All three must hold. If one does not, change nothing, tell the owner in one sentence what is wrong, and stop.
git status --porcelain # must print nothing
git fetch
git log @{u}..HEAD --oneline # must print nothing: no unpushed commits
git remote get-url upstream # must succeedA missing upstream remote is set up by the admin, not by you. Do not add it.
The loop
Fetch and look at what is coming:
git fetch upstream git log --oneline HEAD..upstream/main git rev-parse HEAD # the pre-merge commit: keep it for rollbackAn empty
git logmeans there is nothing to merge. Say so in one sentence and stop: no commit, no restart.Merge. Never rebase: your branch is pushed and a rebase rewrites it.
git merge --no-edit upstream/mainOn a conflict:
- Keep the fork's side of every conflict in code the fork changed on purpose. Read both sides; keep upstream's new lines when they do not clash with the fork's edit.
bun.lock: take upstream's version (git checkout --theirs bun.lock); step 5 rebuilds it.- A migration file this fork also has under the same name: keep upstream's and delete the fork's copy.
- A conflict you cannot resolve with confidence:
git merge --abort, report which files, and stop.
- Clean
packages/db/src/migrations/local.ts, on a clean merge too, not only after a conflict. Drop from it every migration whose namepackages/db/src/migrations/index.tsnow lists, with its import. That migration came back from upstream under the same name; it is already applied and does not run again. A name in both lists fails the boot. Never editindex.tsor a migration upstream sent. Follow the upgrade guides this merge brings, in name order (
YYYYMMDD-NN-slug: date, then sequence). Each is written for you, for a change that needs a step on the fork's side:git diff --name-only --diff-filter=A <commit before the merge> upstream/main -- .docs/upgradesDo each guide's before-restart part now, except a step it marks for right before the restart: that one runs after step 10, before step 11. Its conflict rules for the files it names override step 2. A guide that says stop stops the whole sync. Its after-restart part runs on the owner's next message (see "Checking the last update").
Rebuild the lockfile, not frozen, so fork-only dependencies return to it:
bun installCommit the fix-ups, only if steps 2–5 changed anything:
git add -A git commit --no-edit # finishes a conflicted merge git commit -m "sync: fix up merge from upstream" # after a clean mergeUse the first form while the merge is still in progress, the second after a clean one.
Run what the service runs before it starts. It must pass:
bun install --frozen-lockfileRun the checks, all of them:
bun run typecheckbun testbun x ultracite check
A red check means roll back (below), report, and do not restart. Do not fix upstream code to make a check pass.
Push:
git pushIf the push fails, do not restart. Say so in one sentence and stop.
Snapshot the database. A new migration runs at the next boot, and a rollback resets the code, not the data:
if systemctl --user cat bot-backup >/dev/null 2>&1; then systemctl --user start bot-backup else deploy/backup-bot-db.sh fiA failed snapshot means no restart: report and stop.
- Tell the owner, in one sentence in their language, what changed and that you restart.
Summarize the step 1 commit list in plain words, not hashes or file names
("пришли напоминания по часовому поясу и правка в задачах, перезапускаюсь").
Read
.data/runs.jsonandsystemctl --user show -p MainPID --value botthe same way self-update does, and name other running work in the same sentence. When a step 4 guide has an after-restart part, end the sentence by asking the owner to write «проверь обновление» once the bot is back. Schedule the restart detached, then finish the response:
systemd-run --user --on-active=5s systemctl --user restart botThe bot posts "Я снова на связи." (English: "I am back online.") when it is back.
Checking the last update
When the owner asks to check the update, run the after-restart part of every guide the last upstream merge added, then report the result in one sentence in the owner's language:
git diff --name-only --diff-filter=A "$(git log --merges -1 --format=%H)^1" HEAD -- .docs/upgradesAn empty list means the update needs no check beyond the bot being back.
Rollback
Before step 9, the pushed state is untouched:
git merge --abort # still merging
git reset --hard @{u} # merge or fix-up commit already existsAfter a restart that does not come back:
git reset --hard <commit before the merge>
git push --force-with-lease
systemd-run --user --on-active=5s systemctl --user restart bot<commit before the merge> is the hash step 1 printed. Without it, take the
first parent of the merge commit (git log --merges -1 --format=%P, first
hash), never HEAD^1: after a fix-up commit, HEAD^1 is the merge itself.
Report what was rolled back and why.
Rules
- Only when the owner asks. Never merge upstream as a side effect of other work.
- Never rebase, never push to
upstream, never edit.env. - Never restart with a conflict open, a check red, uncommitted changes, or
commits that have not reached
@{u}. - Never restart twice in one run.
- A migration upstream sent is never edited, only the fork's
local.tsis.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

