# Agent skill updates, from https://markdownregistry.com # # Daily, this checks every SKILL.md committed in this repository against every saved version of every public agent # skill. A skill that is a byte-for-byte copy of an older published version is brought to the newest one, with the # other files of its folder, in one pull request that leads with the newest version, what changed, and any check the # newer version newly trips. A SKILL.md you edited matches no published version and is never touched. Nothing is # deleted. No key, no account. Only the fingerprints and paths of your SKILL.md files are sent. # # Put this file at .github/workflows/skill-updates.yml. For the pull request to open, turn on # Settings > Actions > General > "Allow GitHub Actions to create and approve pull requests"; until then the branch # markdownregistry/skill-updates is still pushed and the run says so. To stop, delete this file. name: Agent skill updates on: schedule: - cron: "41 7 * * *" workflow_dispatch: permissions: contents: write pull-requests: write concurrency: group: agent-skill-updates cancel-in-progress: false jobs: update: runs-on: ubuntu-latest timeout-minutes: 10 steps: - uses: actions/checkout@v4 - name: Bring copied skills to their newest version id: check env: MDR_ORIGIN: https://markdownregistry.com run: | cat > "$RUNNER_TEMP/skill-updates.mjs" <<'MDR_SKILL_UPDATES_END' // Agent skill updates, from https://markdownregistry.com . Plain Node 18 or newer, no dependencies. import { execFileSync } from "node:child_process"; import { createHash } from "node:crypto"; import { appendFileSync, existsSync, lstatSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; import { dirname, join, posix } from "node:path"; const ORIGIN = (process.env.MDR_ORIGIN || "https://markdownregistry.com").replace(/\/+$/, ""); const OUT = process.env.MDR_OUT || process.env.RUNNER_TEMP || "."; const STAMP = /^e2e\+[A-Za-z0-9._-]{1,64}$/.test(process.env.MDR_E2E_STAMP || "") ? process.env.MDR_E2E_STAMP : null; const MIN_BYTES = 200, MAX_FILES = 200, PER_CHECK = 50, PER_CALL = 5, DIFF_CHARS = 6000, BODY_CHARS = 60000; const TICK = String.fromCharCode(96); const UNTOUCHED = []; function output(k, v) { if (process.env.GITHUB_OUTPUT) appendFileSync(process.env.GITHUB_OUTPUT, k + "=" + v + "\n"); } function summary(s) { if (process.env.GITHUB_STEP_SUMMARY) appendFileSync(process.env.GITHUB_STEP_SUMMARY, s + "\n"); console.log(s); } function warn(s) { console.log("::warning::" + s.replace(/[\r\n]+/g, " ")); } function sha256(b) { return createHash("sha256").update(b).digest("hex"); } function gitSha(b) { return createHash("sha1").update("blob " + b.length + "\0").update(b).digest("hex"); } function day(s) { return String(s || "").slice(0, 10); } function plural(n, one, many) { return n + " " + (n === 1 ? one : many); } function inline(s) { return TICK + String(s || "").replace(/[\x60\r\n]/g, " ").slice(0, 120) + TICK; } function fence(s) { const runs = String(s).match(/\x60+/g) || []; return TICK.repeat(Math.max(3, 1 + Math.max(0, ...runs.map((r) => r.length)))); } function done(updated) { output("updated", String(updated)); process.exit(0); } // A stranger's name or version label (frontmatter can hold newlines and markdown): one line, no control characters, no // leading "::" a runner would read as a command, and shown only inside code in the pull request (review round 1). function clean(s) { return String(s == null ? "" : s).replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]+/g, " ").replace(/\s+/g, " ").trim().replace(/^:+/, "").slice(0, 160); } // GitHub reads plain text for references: "fixes #1" closes an issue, "owner/repo#5", "GH-5" and an issue or pull URL // link one, and "@name" pings a person. Code spans hide them in the pull request, but a squash merge can carry the body // into a commit message as plain text, so EVERY stranger's string (a name, a label, a path, a file name, a check's // matched text, the diff) has each form broken by one space wherever it is shown, and stays readable. Line breaks are // kept, so the diff keeps its shape. function nolink(s) { return String(s == null ? "" : s).replace(/#(?=\d)/g, "# ").replace(/@(?=[A-Za-z0-9_-])/g, "@ ").replace(/\bGH-(?=\d)/gi, "GH ").replace(/\/(issues|pull|pulls|discussions)\/(?=\d)/gi, "/$1/ "); } function plain(s) { return nolink(clean(s)); } function code(s) { return inline(plain(s)); } // A path git would refuse to add: an untracked file the repository ignores (review round 1). Asked without literal // pathspecs, which check-ignore refuses outright (fatal, exit 128). function ignored(p) { try { execFileSync("git", ["check-ignore", "-q", "--", p], { stdio: "ignore", env: Object.assign({}, process.env, { GIT_LITERAL_PATHSPECS: "" }) }); return true; } catch { return false; } } // Never write into anything git keeps for itself or into GitHub's own folder (review round 1). function reserved(r) { return r.split("/").some((x) => /^\.git/i.test(x)); } // A symlinked folder on the way down would carry the write out of the skill's folder (review round 1). function linkedParent(base, r) { let p = base; for (const part of r.split("/").slice(0, -1)) { p = join(p, part); try { if (lstatSync(p).isSymbolicLink()) return true; } catch { return false; } } return false; } async function http(url, init) { const headers = Object.assign({ "user-agent": "markdownregistry-skill-updates/1" }, (init && init.headers) || {}); if (STAMP) headers["x-e2e-stamp"] = STAMP; return fetch(url, Object.assign({}, init || {}, { headers })); } let rpcId = 0; async function mcp(calls) { const msgs = [{ jsonrpc: "2.0", id: rpcId++, method: "initialize", params: { protocolVersion: "2025-06-18", capabilities: {}, clientInfo: { name: "markdownregistry skill updates", version: "1" } } }] .concat(calls.map((c) => ({ jsonrpc: "2.0", id: rpcId++, method: "tools/call", params: { name: c.name, arguments: c.arguments } }))); const r = await http(ORIGIN + "/mcp/registry", { method: "POST", headers: { "content-type": "application/json", accept: "application/json" }, body: JSON.stringify(msgs) }); if (r.status === 429) { warn("The registry asked this runner to slow down (" + (r.headers.get("retry-after") || "?") + " seconds). Nothing changed; the next run tries again."); done(0); } if (!r.ok) throw new Error("registry answered HTTP " + r.status); const out = await r.json(); return calls.map((_, i) => { const m = out.find((x) => x.id === msgs[i + 1].id); return m && m.result && !m.result.isError ? m.result : null; }); } async function tree(id, sha) { const r = await http(ORIGIN + "/api/v1/artifacts/" + id + "/versions/" + sha + "/tree"); return r.ok ? r.json() : null; } function local(path) { try { const st = lstatSync(path); if (st.isSymbolicLink() || !st.isFile()) return { odd: true }; return { bytes: readFileSync(path) }; } catch { return null; } } async function main() { const listed = execFileSync("git", ["ls-files", "-z"], { maxBuffer: 256 * 1024 * 1024 }).toString().split("\0").filter((p) => p === "SKILL.md" || p.endsWith("/SKILL.md")); const files = []; for (const p of listed.slice(0, MAX_FILES)) { const f = local(p); if (f && f.bytes && f.bytes.length >= MIN_BYTES) files.push({ path: p, sha256: sha256(f.bytes) }); } if (listed.length > MAX_FILES) warn("Checked the first " + MAX_FILES + " of " + listed.length + " SKILL.md files."); if (!files.length) { summary("No committed SKILL.md of " + MIN_BYTES + " bytes or more to check."); done(0); } const rows = []; for (let i = 0; i < files.length; i += PER_CHECK) { const [res] = await mcp([{ name: "check_installed", arguments: { files: files.slice(i, i + PER_CHECK) } }]); if (!res) throw new Error("check_installed failed"); rows.push(...res.structuredContent.files); } const behind = rows.filter((r) => r.known && r.newer > 0 && r.path); const unknown = rows.filter((r) => !r.known).length; if (!behind.length) { summary(plural(rows.length, "skill", "skills") + " checked: none is behind a newer published version" + (unknown ? " (" + unknown + " match no published version: your own, or edited, and left alone)" : "") + "."); done(0); } const changes = []; for (let i = 0; i < behind.length; i += PER_CALL) { const part = behind.slice(i, i + PER_CALL); const res = await mcp(part.map((r) => ({ name: "what_changed", arguments: { ref: r.ref, since: r.sha256 } }))); part.forEach((r, j) => { const w = res[j] && res[j].structuredContent; // A "nothing changed" answer carries to but no label (review round 1): never a change. if (w && w.to && w.from && w.to !== w.from && w.id && w.to_label) changes.push({ row: r, w, text: res[j].content[0].text }); }); } // Newest first: the skill whose newest version was committed most recently leads (Jack, round 21). changes.sort((a, b) => String(b.w.to_committed_at || "").localeCompare(String(a.w.to_committed_at || ""))); const done_ = [], written = []; for (const c of changes) { const blob = await http(ORIGIN + "/api/v1/blob/" + c.w.to); const bytes = blob.ok ? Buffer.from(await blob.arrayBuffer()) : null; if (!bytes || sha256(bytes) !== c.w.to) { warn(c.row.path + ": the newest version did not arrive intact; left as it is."); continue; } const now = local(c.row.path); if (!now || !now.bytes || sha256(now.bytes) !== c.row.sha256) { warn(c.row.path + " changed during the run; left as it is."); continue; } writeFileSync(c.row.path, bytes); written.push(c.row.path); const folder = { updated: [], kept: [], dropped: [], partial: false, root: false }; const [had, next] = await Promise.all([tree(c.w.id, c.w.from), tree(c.w.id, c.w.to)]); // A skill at the root of its repository: its "folder" is that whole repository, so only SKILL.md comes (review round 1). if (next && !next.dir) folder.root = true; else if (had && next && next.files) { folder.partial = next.complete === false; const rel = (t, p) => (t.dir ? p.slice(t.dir.length + 1) : p); const old = new Map(had.files.map((f) => [rel(had, f.path), f.git_sha])); const base = dirname(c.row.path); for (const f of next.files) { const r = rel(next, f.path); if (f.path === next.entry) continue; const norm = posix.normalize(r); if (!r || norm.startsWith("..") || posix.isAbsolute(norm) || norm !== r || reserved(r)) { folder.kept.push(r + " (a path this never writes)"); continue; } const target = join(base, r); if (linkedParent(base, r)) { folder.kept.push(r); continue; } const mine = local(target); if (mine && mine.odd) { folder.kept.push(r); continue; } const have = mine ? gitSha(mine.bytes) : null; if (have === f.git_sha) continue; if (have && have !== old.get(r)) { folder.kept.push(r); continue; } try { const got = await http(f.raw_url); const b = got.ok ? Buffer.from(await got.arrayBuffer()) : null; if (!b || gitSha(b) !== f.git_sha) { folder.kept.push(r + " (did not arrive intact)"); continue; } mkdirSync(dirname(target), { recursive: true }); // Asked once the folders exist, since a rule like "added/" matches only a folder git can see. if (!mine && ignored(target)) { folder.kept.push(r + " (this repository ignores it)"); continue; } writeFileSync(target, b); written.push(target); folder.updated.push(r); } catch { folder.kept.push(r + " (could not be written)"); } } const nextRel = new Set(next.files.map((f) => rel(next, f.path))); for (const [r] of old) if (!nextRel.has(r) && existsSync(join(base, r))) folder.dropped.push(r); } else folder.partial = true; done_.push(Object.assign({}, c, { folder })); } if (!done_.length) { summary("Skills behind were found, but none could be updated safely this run."); done(0); } const title = "Update " + plural(done_.length, "agent skill", "agent skills") + " to the newest version"; let body = "Newest first. Each skill below was a byte-for-byte copy of a version published on GitHub, so it now holds the newest version " + ORIGIN.replace(/^https?:\/\//, "") + " has saved. A SKILL.md you edited matches no published version and is never touched.\n"; for (const c of done_) { const w = c.w, f = c.folder; const trips = (w.new_checks || []); let s = "\n### " + code(w.ref) + ", now " + code(w.to_label) + (w.to_committed_at ? " (" + clean(day(w.to_committed_at)) + ")" : "") + "\n\n"; s += code(c.row.path) + " was " + code(w.from_label) + ", " + plural(w.versions_between, "version", "versions") + " behind. Grade " + (w.grade_from === w.grade_to ? w.grade_to + " before and after" : w.grade_from + " then, " + w.grade_to + " now") + ". " + plural(w.added, "line", "lines") + " added, " + plural(w.removed, "line", "lines") + " removed. [See exactly what changed](" + ORIGIN + "/a/" + w.id + "/diff?from=" + w.from + "&to=" + w.to + ")\n\n"; s += trips.length ? "**The newer version newly trips " + plural(trips.length, "check", "checks") + "**, read it before you merge:\n" + trips.map((t) => "- " + t.label + (t.critical ? " (critical)" : "") + (t.detail ? ": " + code(t.detail) : "")).join("\n") + "\n\n" : "It newly trips no check.\n\n"; if (f.updated.length) s += "Also brought to the newest version in this folder: " + f.updated.map(code).join(", ") + "\n\n"; if (f.kept.length) s += "Left as they are, because they were edited here or could not be checked: " + f.kept.map(code).join(", ") + "\n\n"; if (f.dropped.length) s += "No longer in the newest version, left in place for you to remove: " + f.dropped.map(code).join(", ") + "\n\n"; if (f.root) s += "Only SKILL.md was updated: this skill sits at the root of its repository, so the rest of that repository is not brought in.\n\n"; else if (f.partial) s += "Only SKILL.md was updated: the folder's file list could not be read in full.\n\n"; const m = /(\x60{3,})diff\n([\s\S]*?)\n\1/.exec(c.text); if (m) { const d = nolink(m[2].slice(0, DIFF_CHARS)); const fn = fence(d); s += "
The change to SKILL.md\n\n" + fn + "diff\n" + d + "\n" + fn + "\n\n
\n"; } if (body.length + s.length > BODY_CHARS) { body += "\nAnd " + (done_.length - done_.indexOf(c)) + " more, listed in the commit.\n"; break; } body += s; } body += "\n---\nOpened by the Agent skill updates workflow from [" + ORIGIN.replace(/^https?:\/\//, "") + "](" + ORIGIN + "): every saved version of every public agent skill, graded by fixed checks with no AI. Ask your agent about any skill before it updates: " + inline("claude mcp add --transport http markdownregistry " + ORIGIN + "/mcp/registry") + "\n\nTo stop these, delete .github/workflows/skill-updates.yml.\n"; writeFileSync(join(OUT, "mdr-pr.md"), body); writeFileSync(join(OUT, "mdr-commit.txt"), title + "\n\n" + done_.map((c) => plain(c.row.path) + ": " + c.w.from.slice(0, 12) + " to " + c.w.to.slice(0, 12)).join("\n") + "\n"); writeFileSync(join(OUT, "mdr-paths.txt"), written.join("\0")); summary(title + ": " + done_.map((c) => code(c.w.ref) + " now " + code(c.w.to_label)).join(", ") + "."); done(done_.length); } main().catch((e) => { warn("Agent skill updates could not finish: " + (e && e.message ? e.message : e) + ". Nothing changed."); done(0); }); MDR_SKILL_UPDATES_END node "$RUNNER_TEMP/skill-updates.mjs" - name: Open or refresh the pull request if: steps.check.outputs.updated != '' && steps.check.outputs.updated != '0' env: GH_TOKEN: ${{ github.token }} BRANCH: markdownregistry/skill-updates GIT_LITERAL_PATHSPECS: "1" run: | git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git switch -C "$BRANCH" git add --pathspec-from-file="$RUNNER_TEMP/mdr-paths.txt" --pathspec-file-nul git commit -q -F "$RUNNER_TEMP/mdr-commit.txt" if git fetch -q --depth=1 origin "$BRANCH" 2>/dev/null && [ "$(git rev-parse "HEAD^{tree}")" = "$(git rev-parse "FETCH_HEAD^{tree}")" ]; then echo "The branch $BRANCH already holds these versions." else git push -q -f origin "$BRANCH" fi title="$(head -n 1 "$RUNNER_TEMP/mdr-commit.txt")" if [ "$(gh pr view "$BRANCH" --json state -q .state 2>/dev/null)" = "OPEN" ]; then gh pr edit "$BRANCH" --title "$title" --body-file "$RUNNER_TEMP/mdr-pr.md" elif ! gh pr create --head "$BRANCH" --title "$title" --body-file "$RUNNER_TEMP/mdr-pr.md"; then echo "::warning::The branch $BRANCH is pushed, but this repository does not let Actions open pull requests. Open one from the branch, or turn on Settings > Actions > General > Allow GitHub Actions to create and approve pull requests." fi