agentleFS
nklischnklisch/claude-code-modes/.claude/skills/sync-upstream/SKILL.md

sync-upstream

Skill116 starsChanged 7 months agoMITView on GitHub

Compare this project's base prompts and model metadata against a Claude Code release. Extracts and greps the upstream prompt assembly, finds both drift in tracked fragments and content we never tracked at all, classifies each change as intentional omission or real drift, and applies approved updates. Use when user says "sync upstream", "check for drift", "new CC version", or runs /sync-upstream.

15 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use start-mission, tdd and 1 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • parkchuSkill

    start-mission

    넥스트스텝(NextStep) 미션을 처음 시작할 때, 미션 저장소를 fork·clone하고 최초 작업 브랜치(step1 등)까지 만들어 준다. gh CLI로 fork하고 clone까지 이어서 처리하며, gh가 없거나 인증이 안 돼 있으면 브라우저 Fork 안내로 폴백한다. 이미 fork/clone돼 있으면 재사용하고 이어서 진행한다(재실행 안전). 사용자가 "미션 시작하려는데 저장소 세팅해줘", "새 미션 시작할래", "fork부터 해줘", "/nextstep:start-mission" 등으로 요청할 때 사용한다.

    Also in 3 projects that use this

  • GoogleSkill

    tdd

    Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

    Also in 3 projects that use this

  • MicrosoftSkill

    handoff

    Compact the current conversation into a handoff document for another agent to pick up.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 11 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Keep prompts/base/, prompts/lean/, the prompt-bundle modifiers, and the model table in src/env.ts aligned with what Claude Code actually …

    line 16
  2. Very specific:

    Diffing two extractions is the cheapest first move: If a previous version's file is still in upstream-prompts/, diff it against the new one …

    line 69
  3. Distinctive:

    You may be running under one of these prompts yourself: If so, your own system prompt is a live sample of what a real session receives — …

    line 75

“Common” is measured: kept by at least 6 in 10 of the 11 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Sync Upstream

Keep prompts/base/, prompts/lean/, the prompt-bundle modifiers, and the model table in src/env.ts aligned with what Claude Code actually sends.

This is an investigation, not a checklist. The sections below describe what has to be true when you're done and the tools available to get there — how you sequence them is yours to judge. Two things are not yours to judge: confirm the target version before doing the work, and get changes approved before applying them.

What "aligned" means

Three prompt shapes exist upstream, assembled by one function that forks on a model-capability predicate. All three matter here:

ShapeWho gets itTracked in
standard headmodels without lean_promptprompts/base/
lean headmodels with lean_promptprompts/lean/
shared taileveryone, both headsduplicated in both bases
bundle sectionsmodels with opus_5_prompt_bundleprompts/modifiers/

Capabilities also drive --base auto, so the model table in src/env.ts is part of the sync, not a side note: a new flagship changes which base users get by default.

references/fragment-map.md holds the current local↔upstream mapping and the marker strings to find each piece. references/intentional-omissions.md holds every difference that is deliberate.

Ground truth and how to reach it

bun run scripts/extract-upstream-prompt.ts [version] pulls named prompt functions into upstream-prompts/. It is the fastest path for what it covers, which is the standard head and not much else. It does not extract the shared tail, the lean head, the bundle sections, or model capabilities.

For anything it misses, grep the release binary directly:

npm pack @anthropic-ai/claude-code-linux-x64@<version> && tar xzf *.tgz   # → package/claude

It's ~275 MB, so slice by byte offset in Python rather than running wide regexes:

data = open("package/claude","rb").read()
i = data.find(b"<marker text>")
print(data[i-4000:i+4000].decode("utf8","replace"))

Useful anchors: search a distinctive sentence to land in the assembler, then read outward. strings -n 8 package/claude | grep -o 'id:"claude-[a-z0-9-]*"[^}]\{0,220\}' gets the model table with its capabilities arrays.

Diffing two extractions is the cheapest first move. If a previous version's file is still in upstream-prompts/, diff it against the new one — most releases are pure minifier churn (ja_ → aO_) with one or two real sentence changes, and the diff isolates them in seconds. Ignore renamed symbols, template-variable syntax, and whitespace; they are noise.

You may be running under one of these prompts yourself. If so, your own system prompt is a live sample of what a real session receives — worth more than inference about which branch fires. Use it to confirm, and say so when you report.

Finding what isn't on the map

The mapping files are a record of what we already know. Diffing only against them can never surface content we never tracked — that blind spot is exactly how the shared tail sections went missing from prompts/base/ for several releases.

So each sync, spend some effort in the other direction: read the assembler's return value and account for every section it can emit. For each one, land in a category and be able to say which:

  • tracked in a local fragment
  • documented as an intentional omission
  • genuinely inapplicable — session-, environment-, or experiment-gated (a flag that fires on one model, a background-session block, an output-style hook)
  • unaccounted for — a real gap, whether or not the current release changed it

Watch for gates that turn out to mean something other than their name suggests. A branch filed as "some terser variant" may be a whole prompt shape; a "compact" mode may be reachable on exactly one model in one experiment. When a gate's meaning is unresolved, resolving it is usually higher-value than diffing another fragment, because an unresolved gate can hide an entire category of content.

Classifying a difference

  • Intentional omission — matches a documented entry. Leave it; if the upstream wording moved, update the quote in the reference so future diffs still match.
  • Local addition — we carry content upstream doesn't (gitStatus block, tool-agnostic rewrites of tool names). Leave it.
  • Drift — upstream changed and we haven't. Candidate to apply.
  • Unaccounted — from the sweep above. Report it separately; it usually needs a new fragment or a new omission entry, which is a decision, not a mechanical edit.

New content that lands in axis territory is a new omission, not drift. The test: would carrying it in a base contradict any value of the agency, quality, or scope axes? Read the axis fragments and check rather than guessing — # Delivering work looked like neutral guidance until its scope sentences were read against scope/unrestricted.

Reporting and applying

Report grouped by classification, with the specific changed text for each drift item, and an explicit count of what didn't change so the user can see coverage. Then get approval — AskUserQuestion with a multi-select works well when there are several independent items.

When applying:

  • Edit the local fragments. Changes to the shared tail apply to both bases.
  • Model table changes usually travel together: a new flagship touches MODEL_TABLE, MODEL_ALIASES, and the "most recent Claude models" line in every base's env.md.
  • New fragments need registering in scripts/generate-prompts.ts and src/embedded-prompts.test.ts, plus the manifest and the fragment counts in the count tests and CLAUDE.md.
  • Bump the validated-against version in CLAUDE.md and README.md.
  • Regenerate embedded prompts and run bun test.

Keeping the references current

The reference files are the durable output of every sync — more so than the prompt edits, which git already records. Before finishing, make sure they reflect what you learned: new mappings and refreshed minified names in fragment-map.md; new or newly-grounded omissions in intentional-omissions.md.

Record resolved mysteries, not just changes. "vE is the lean predicate" and "YFc returns false outright, so that section is dead code" are the findings that save the next sync the most time, and neither shows up as a diff.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.