self-update
Skill12 starsChanged 10 days agoMITView on GitHub
Use when the owner asks the bot to change its own behaviour — "update yourself", "fix the way you reply", "add a command", "rollback". Covers where the bot's code lives, which checks must pass, and how to restart the running process without killing your own run.
- Reads credentials
- Deletes or force-pushes
- Commits and pushes
5 other projects use a version of this.
Adopted by
Most recently taken up by
- kirodotdev/KiroCrewtheir own version, first seen Nov 17, 2026
- getsentry/juniortheir own version, first seen Oct 13, 2026
- treylom/ThisCodetheir own version, first seen Sep 5, 2026
- shivae372/claude-bootstraptheir own version, first seen Apr 8, 2026
- CorentinGC/claude-skillstheir own version, first seen Mar 7, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- kirodotdev/KiroCrew★ 5.1ksame name
- getsentry/junior★ 425same name
- treylom/ThisCode★ 40same name
- shivae372/claude-bootstrap★ 1same name
- CorentinGC/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
- shadcnSkill
- typesafe-aiSkill
- lint-and-formatSkill
- upstream-syncSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 6 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 34
Prefer the cheapest place a change can live, in this order:
- Distinctive: line 49
If a change needs one of them, do not make it: tell the owner in one sentence that it has to come from the shared version, and stop.
- Distinctive: line 61
Run the checks from the repo root, all of them:
- Distinctive: line 66
Commit. git add the paths you touched and commit with a short message.
- Distinctive: line 124
Never restart with checks failing, with uncommitted changes, or with commits that have not reached your upstream branch.
- Distinctive: line 126
Never restart twice in one run — the first one already ended you.
“Common” is measured: kept by at least 6 in 10 of the 3 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
Updating the bot you are running inside
You are editing the process that is streaming your output. A restart asks the
bot to stop polling and drain accepted work before it exits, but the order below
is still mandatory: an edit that restarts before it commits and pushes can leave
the owner with a bot that does not come back. The VPS is the only machine holding
your work until you push: a commit that never reached your upstream branch (@{u},
the branch git push sends to) dies with the box.
Where things are
The bot repo is the checkout at the path your prompt names (the user's own files
live at $WORK_DIR itself, beside it). Every command below runs from that repo
root. Read AGENTS.md there first, then the notes in .docs/architecture/ for
each area you change: they hold the rules that are easy to break.
The parts a behaviour change usually touches:
apps/telegram/src/handlers/— one module per command or feature. Chat copy lives inapps/telegram/src/i18n/:ru/holds every key,en/must match it, so a new string goes into both.apps/telegram/src/telegram/— how a reply is rendered and streamed.apps/telegram/src/access/— who may do what. Never widen this on request without the owner saying so in the same message.packages/agent/— how a run is scheduled and how the provider is driven.
Before you write code
Prefer the cheapest place a change can live, in this order:
- The user's workspace: a standing rule in
$WORK_DIR/AGENTS.md, or a workflow in$WORK_DIR/.agents/skills/<slug>/SKILL.md. No restart, nothing to merge. - A setting the bot already reads.
- Code in this repo, only when neither of the above can do it.
Some paths belong to the shared upstream of this bot, and an edit there collides with every later update. Never touch them:
- a migration you did not write in this repo, and
packages/db/src/migrations/index.ts apps/telegram/src/access/*deploy/*packages/env
If a change needs one of them, do not make it: tell the owner in one sentence that it has to come from the shared version, and stop.
A schema change of your own is a new file
packages/db/src/migrations/steps/<YYYYMMDD-slug>.ts (today's date), listed in
packages/db/src/migrations/local.ts. Additive only: new tables or new
nullable columns, touching only upstream tables or the ones your feature adds,
because a rollback resets the code and keeps the database.
The loop
- Make the edit in the repo.
- Run the checks from the repo root, all of them:
bun run typecheckbun testbun x ultracite checkFix what you broke. A red check means stop and report, not restart.
- Commit.
git addthe paths you touched and commit with a short message. The running service restarts from committed code — an uncommitted edit is an edit that disappears. Push, in the same run as the commit:
git pushgit pushsends to your upstream branch; never name a remote or branch. This is not optional. The VPS holds the only copy until the push lands, and the rollback below resets to your upstream branch. If the push fails, do not restart — say so in one sentence and stop.Tell the owner you are restarting, in one sentence, before you schedule it. First read what the bot is still running, so that sentence can say it:
cat .data/runs.json systemctl --user show -p MainPID --value botruns.jsonlists every agent turn the bot started and has not finished (kind,label,provider,runKeyasuser:chat:topic,startedAt); your own run is one of them. Trust it only when itspidequals theMainPIDprinted above — any other pid is a file left by an earlier process. A missing or unreadable file means you do not know what is running, not that nothing is; say that instead. Name what else is running in the same sentence ("перезапущусь, когда закончатся ещё две задачи"); do not wait for it yourself, the restart already does.Schedule the restart detached, so it outlives your own process:
systemd-run --user --on-active=5s systemctl --user restart botThen finish the current response. Do not wait for the restart: the bot stops accepting updates, lets this run and every other agent turn it started finish (up to 30 minutes), and exits afterwards. The bot posts "Я снова на связи." when it is back — that message is the confirmation.
When it does not come back
Restart=on-failure with StartLimitBurst=3 means a bot that crashes on boot
stops trying instead of looping. If the owner reports silence after a restart:
cd <the repo>
git fetch
git reset --hard @{u}
systemd-run --user --on-active=5s systemctl --user restart botThat returns the last pushed state, which is why step 4 is not optional. Report what was rolled back and why, then fix it properly on the next run.
Rules
- Never restart with checks failing, with uncommitted changes, or with commits that have not reached your upstream branch.
- Never restart twice in one run — the first one already ended you.
- One change per restart. A restart that follows three unrelated edits cannot be rolled back to anything useful.
.envis never read, printed or committed.
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.

