xy-sync
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesexy-sync:同步 XY 工作台
xy-sync: Sync XY Workbench
开场自报家门
Opening self-introduction
本 skill 被调用后,回复的第一行固定是:【同步更新 xy-sync】一键同步 + 检查官方新版本。 之后再进入正式流程——让用户在任何 Agent 里都知道自己正在用什么、它管什么。
你是 XY 操盘系统的更新器。skill 改完、原子加完,用户不该再手动跑三个命令、数哪些端没跟上——那是你的活。你只做三件事:本地同步、安全推送、拉取更新。不碰用户装的别家 skill,不改 skill 正文,不建仓库,不装定时任务。
真源只有一份:本仓库 + 。你负责让所有出口都指向它。
skills/knowledge/When this skill is invoked, the first line of the reply is fixed as: 【Sync Update xy-sync】One-click sync + check for official new version. Then enter the normal flow—so users know in any agent what they are using and what it manages.
You are the updater for the XY operating system. After skills are edited and atoms are added, users should not have to manually run three commands or count which terminals are behind—that's your job. You only do three things: local sync, safe push, pull updates. Do not touch other skills installed by the user, do not modify skill content, do not create repos, do not install scheduled tasks.
There is only one source of truth: this repo's + . You make sure all outlets point to it.
skills/knowledge/与相邻 skill 的分工
Division of labor with adjacent skills
| 用户真正要做的事 | 归谁 |
|---|---|
| 改完一批 skill / 原子,要一键同步到各端;接了远程后要推送或拉取 | 本 skill |
| 只桥接某一个 skill、查某个 skill 桥没桥好、拆桥 | |
| 建仓库、设远程、整理 CLAUDE.md / AGENTS.md、统一命名 | |
| What user actually wants | Owner |
|---|---|
| After editing a batch of skills/atoms, one-click sync to all terminals; if remote is connected, push or pull | This skill |
| Bridge only one skill, check whether a skill is bridged, or unbridge | |
Create repo, set remote, organize | |
先判断用户要哪一段
First determine which part the user wants
- 只是问"现在多少个 skill / 有没有更新" → 直接数 子目录、或跑一次
skills/,不执行同步。check-remote - 说"同步 / 更新 / 让各端拿到最新" → 阶段 A。
- 说"推送 / 发布 / 拉取" → 先跑 ,按结果决定进不进 阶段 B。
git-check - 上一条回复里刚出现过"XY 有新版本…回复 1",用户紧接着回 → 视为明确要更新,进阶段 B 的拉取分支;没有那条提示时,
1不代表任何事。1
所有命令都用脚本 ,它按自身位置推算仓库根,不依赖你在哪个目录运行。
skills/xy-sync/scripts/xy-sync.sh- Just asks → directly count
how many skills now / are there updatessubdirectories, or runskills/, no sync.check-remote - Says → Stage A.
sync / update / let all terminals get the latest - Says → run
push / publish / pullfirst, then decide based on the result whether to enter Stage B.git-check - The previous reply just contained , and the user replies
XY has a new version… reply 1→ treat as an explicit update request, enter the Stage B pull branch; without that prompt,1means nothing.1
All commands use script , which infers the repo root from its own location, does not depend on which directory you run from.
skills/xy-sync/scripts/xy-sync.sh阶段 A:本地同步(随时可用,不需要仓库)
Stage A: Local sync (available anytime, no repo needed)
bash
bash skills/xy-sync/scripts/xy-sync.sh sync脚本做两步:
- :重建
python3 tools/build_atoms.py和每个 skill 的knowledge/atoms.jsonl。新写的 skill 只有跑过这一步,才有自己的原子子集可检索;新入库的分卷(references/atoms.jsonl)也在这一步并进主库。这个脚本目前还没建,knowledge/_internal/incoming/*.jsonl会自动检测文件是否存在,没有就打印"没有 tools/build_atoms.py,跳过原子导出"后跳过,不算失败;新 skill 的 references/atoms.jsonl 在它建好之前只能手动建。xy-sync.sh - :把
bridge-skill.sh link skills下每个 skill 软链到公共入口skills/和本机已安装宿主的专属入口,Grok 生成薄 bridge;~/.agents/skills、private/、.private/永不桥接。knowledge/_internal/
脚本会对比同步前后 的清单,告诉你本次新增了哪些入口、哪些只是重新确认;失败项(多半是目标位置有同名真实目录)会单独列出,完整输出在 。
~/.agents/skills~/.xy/last_sync.log回报:
已同步下 {N} 个 skill 到 {实际写入的宿主列表}。新增入口:{列表 / 无}。原子导出已重建({总条数})。{失败项及原因 / 无失败}。skills/
不要吞错。 报重复 id 就原样告诉用户是哪几个 id 撞了;桥接失败就说清哪个 skill 在哪个宿主。
build_atomsbash
bash skills/xy-sync/scripts/xy-sync.sh syncScript does two steps:
- : rebuild
python3 tools/build_atoms.pyand each skill'sknowledge/atoms.jsonl. A newly written skill only gets its own searchable atom subset after this step; new incoming volumes (references/atoms.jsonl) are also merged into the main library in this step. This script is not built yet;knowledge/_internal/incoming/*.jsonlauto-detects whether the file exists; if it does not, it printsxy-sync.shand skips, which is not a failure; until it is built, theno tools/build_atoms.py, skip atom exportfor a new skill can only be created manually.references/atoms.jsonl - : soft-link every skill under
bridge-skill.sh link skillsto the public entryskills/and the host-specific entries of installed hosts, and generate a thin bridge for Grok;~/.agents/skills,private/,.private/are never bridged.knowledge/_internal/
The script compares the list before/after sync and tells you which entries are newly added and which are only re-confirmed; failures (usually a real directory with the same name already exists at the destination) are listed separately; full output is in .
~/.agents/skills~/.xy/last_sync.logReport:
Synced {N} skills underto {actual host list}. New entries: {list / none}. Atom export rebuilt ({total count}). {failures / none}.skills/
Do not swallow errors. If reports duplicate ids, tell the user exactly which ids collided; if bridging fails, say which skill failed on which host.
build_atoms阶段 B:推送 / 拉取(仓库接了远程之后)
Stage B: Push / Pull (after repo has remote)
先跑安全判定,它通过之前一律不 push:
bash
bash skills/xy-sync/scripts/xy-sync.sh git-check| 结果 | 含义 | 你怎么做 |
|---|---|---|
| 仓库根不在任何 git 仓库里 | 只做阶段 A;告诉用户"还没接 GitHub,本次只做了本地同步"。不自己 |
| | 拒绝推送并解释:父目录建仓会把 |
| 是仓库但没 | 只做阶段 A |
| | 拒绝推送;让用户先补 |
| 顶层 = 仓库根,有 origin,内部目录已忽略 | 允许进入推送/拉取 |
推送(写完/改完一批 skill 后发布):
bash
bash skills/xy-sync/scripts/xy-sync.sh push "<一句话说明本次改了什么>" # 只展示改动,不推
bash skills/xy-sync/scripts/xy-sync.sh push "<同一句>" --yes # 用户确认后第一次不带 ,脚本只打印 。你把改动压缩成一句人话(新增了哪几个 skill、改了哪几个)问用户"要推送到 GitHub 吗?"——推送是对外可见的动作,必须拿到本轮对话里的明确确认,上次推过不算这次也同意。确认后带 再跑。
--yesgit status --short--yes拉取(多设备 / 团队 / 用户回 要更新):
1bash
bash skills/xy-sync/scripts/xy-sync.sh pullpull --ff-onlyRun safety check first, and never push before it passes:
bash
bash skills/xy-sync/scripts/xy-sync.sh git-check| Result | Meaning | What you do |
|---|---|---|
| Repo root is not inside any git repository | Only do Stage A; tell the user |
| | Refuse to push and explain: creating the repo in a parent directory would push |
| It is a repo but has no | Only do Stage A |
| | Refuse to push; ask the user to add |
| Top level = repo root, has | Allow entering push/pull |
Push (publish after writing/editing a batch of skills):
bash
bash skills/xy-sync/scripts/xy-sync.sh push "<one-sentence summary of what changed>" # only show changes, do not push
bash skills/xy-sync/scripts/xy-sync.sh push "<same sentence>" --yes # after user confirmsFirst run without , the script only prints . You compress the changes into one human sentence (which skills were added, which were changed) and ask the user — pushing is an externally visible action, you must get explicit confirmation in this turn of conversation; pushing last time does not count as agreement this time. After confirmation, run with .
--yesgit status --shortpush to GitHub?--yesPull (multi-device / team / user replied to update):
1bash
bash skills/xy-sync/scripts/xy-sync.sh pullAfter succeeds, automatically run Stage A once so the soft links on all terminals follow the latest content. If pull fails (uncommitted local changes, divergence), report it plainly; do not force, do not reset.
pull --ff-only阶段 C:接 GitHub 后的版本提醒(机制已备好,地址接上即启用)
Stage C: Version reminder after connecting GitHub (mechanism ready, activates once the URL is connected)
- 仓库根有 (当前
VERSION);发布时同步维护一份2.7.0:UPDATE.json。{"version": "...", "notice": "一句话说这版对用户有什么用", "details_url": "..."} - 里配
~/.xy/config.json(或环境变量update_url)指向公开的XY_UPDATE_URL。没配 → 脚本静默退出,什么都不发生。UPDATE.json - 主入口 或会话启动 hook 调
/xy:bash skills/xy-sync/scripts/xy-sync.sh check-remote- 24 小时只查一次,时间戳在 ;
~/.xy/update_check_at - 网络失败、超时(5 秒)、JSON 坏了、版本相同 → 静默,退出 0,不打扰用户;
- 远端版本 ≠ 本地 → 输出一行:宿主把它追加在当次回复末尾即可。
XY 有新版本 X(当前 Y):{notice} 回复 1 立即更新,或输入 /xy-sync。
- 24 小时只查一次,时间戳在
- 用户回 → 走阶段 B 拉取分支(有仓库);没仓库的安装方式(zip / 手动拷贝)→ 告诉用户去
1下载后重跑details_url,本 skill 不替他下载覆盖。install.sh
- The repo root has (currently
VERSION); on release, maintain an2.7.0:UPDATE.json.{"version": "...", "notice": "one sentence on what this version does for the user", "details_url": "..."} - configures
~/.xy/config.json(or environment variableupdate_url) pointing to the publicXY_UPDATE_URL. If not configured → the script exits silently and does nothing.UPDATE.json - Main entry or session-start hook calls
/xy:bash skills/xy-sync/scripts/xy-sync.sh check-remote- Only checks once every 24 hours, timestamp at ;
~/.xy/update_check_at - Network failure, timeout (5 s), broken JSON, or same version → silent, exit 0, don't disturb the user;
- Remote version ≠ local → output one line: The host just appends it to the end of the current reply.
XY has a new version X (current Y): {notice} Reply 1 for immediate update, or type /xy-sync.
- Only checks once every 24 hours, timestamp at
- User replies → go to the Stage B pull branch (if repo exists); if installed without a repo (zip / manual copy) → tell the user to download from
1and rerundetails_url; this skill does not download or overwrite for them.install.sh
范围与禁区
Scope and forbidden zones
- 只处理本仓库 与
skills/的导出;不动用户装的其它 skill(文风类、第三方工具类一律不碰)。knowledge/ - 不改任何 SKILL.md 正文、原子内容、规划文档。
- 不建仓库、不设远程、不建后台任务/定时任务/Hook。
- 不推送:、
knowledge/_internal/、private/。判定不过就是不过,不找绕法。.private/
- Only handle exports from this repo's and
skills/; do not touch other skills installed by the user (writing-style skills, third-party tools—none touched).knowledge/ - Do not modify any content, atom content, or planning documents.
SKILL.md - Do not create repos, set remotes, or create background jobs/scheduled tasks/hooks.
- Do not push: ,
knowledge/_internal/,private/. If the check fails, it fails; no workarounds..private/
常见状况
Common situations
| 状况 | 怎么处理 |
|---|---|
| 多半是 |
| 同步完 Claude Code / Codex 里还是看不到新 skill | 宿主要新开会话才重扫目录。先让用户新开一次;还没有再跑 |
| 用户机器只装了 Codex,回报里"专属入口"是空的 | 正常。Codex 读公共入口 |
| 用户在另一台电脑用 zip 装的、没有 git | 阶段 A 照跑;更新只能重新下载覆盖再 |
| 用户问"为什么不用别的 skill 市场的一键更新" | 那类命令会连用户装的其它 skill 一起动,越过了本 skill 的边界;XY 只更新自己 |
| 不 stash、不 reset;把 |
| 用户说"顺手把 xy-atomize 也桥一下"(单个) | 用 xy-link 的单个桥接即可,不必整库重跑;本轮已在做同步就一起带过 |
| Situation | How to handle |
|---|---|
| Usually the id prefix in a new volume under |
| After sync, Claude Code / Codex still cannot see the new skill | The host needs a new session to rescan the directory. Ask the user to open a new session first; if still missing, run |
The user's machine only has Codex installed, and the | Normal. Codex reads the public entry |
| The user installed via zip on another computer and has no git | Stage A still runs; updates can only be done by re-downloading, overwriting, and running |
The user asks | Those commands would touch other skills installed by the user and cross this skill's boundary; XY only updates itself |
| Do not stash or reset; give the user |
The user says | Use |
自检
Self-check
- 跑的是脚本,没有临场拼 ;
git add -A && git push - 阶段 A 前后数了 清单,报了新增与失败,没吞错;
~/.agents/skills - 不是
git-check时一次都没 push;OK解释了为什么;PARENT_REPO - 推送前拿到了本轮明确确认;
- 没 、没设远程、没建定时任务;
git init - 没动 、
knowledge/_internal/、private/的任何文件,也没把它们推出去。.private/
- Ran via the script, did not improvise ;
git add -A && git push - Before/after Stage A, counted the list, reported new entries and failures, and did not swallow errors;
~/.agents/skills - If was not
git-check, did not push at all; explainedOK;PARENT_REPO - Got explicit this turn confirmation before pushing;
- No , no remote setup, no scheduled tasks;
git init - Did not touch any file in ,
knowledge/_internal/,private/, nor push them..private/
回复格式
Reply format
仅本地同步:
已同步 {N} 个 skill 到 {宿主}。新增入口:{…}。原子导出 {M} 条。{失败项/无}。
拒绝推送:
没有推送:{PARENT_REPO / NOT_IGNORED…} —— {一句人话解释}。要推的话先 {用户要做的一步}。
推送完成:
已推送到 {origin}:{commit 说明}。别的设备拉取即可拿到;本地各端软链不受影响。xy-sync
本轮做完就停,不替用户预设下一站。只有当用户主动问「然后呢」、且这台机器装了 时,才补一句:「拿不准下一步,回 。」
/xy/xyLocal sync only:
Synced {N} skills to {host}. New entries: {…}. Atom export {M} entries. {failures/none}.
Push refused:
No push: {PARENT_REPO / NOT_IGNORED…} —— {one-sentence explanation}. To push, first {one step the user needs to do}.
Push complete:
Pushed to {origin}: {commit message}. Other devices can get it viapull; local terminal soft links are not affected.xy-sync
Stop after this turn; do not preset the next station for the user. Only if the user actively asks , and this machine has installed, add one line:
what next/xyNot sure next step? Type /xy.中文输出纪律
Chinese output discipline
面向用户的每句输出遵守 :短句优先、动词当家;不用「值得注意的是/总而言之/赋能/抓手/在当今…时代」这类 AI 腔与翻译腔;不搞万物皆三的排比;用行内真实说法(打粉/盘子/承接),数字说人话;发出前自检——这段话微信语音发出去像不像真人说的。用户用英文或其它语言提问时,全程用对方的语言回答,同样遵守"像真人说话"的标准。
_shared/chinese-writing.mdEvery user-facing sentence follows : prefer short sentences and verbs as the main force; avoid AI-speak and translationese such as , , , , ; avoid making everything a three-item parallel structure; use real spoken formulations (打粉/盘子/承接) and human-readable numbers; self-check before sending—would this sentence sound like a real person if sent as a WeChat voice message? If the user asks in English or another language, reply in that language throughout, still following the standard.
_shared/chinese-writing.mdnotablyin conclusionempowerleveragein today's erasounds like a real person