sync-upstream
Skill1 starsChanged 8 days agoMITView on GitHub
Sync this workspace with the upstream Moraine template repo, preserving your personalizations. Use when user says "sync with upstream", "pull upstream changes", "update from upstream", or "keep my fork current".
- Deletes or force-pushes
19 other projects use a version of this.
Adopted by
Most recently taken up by
- initalok/ai-swissknifetheir own version, first seen Nov 29, 2026
- garfiec/Librechat-Mobiletheir own version, first seen Nov 21, 2026
- moisesrj97/skillstheir own version, first seen Nov 16, 2026
- 5kahoisaac/pi-plugin-cctheir own version, first seen Nov 16, 2026
- Trixx4191/asrartheir own version, first seen Nov 15, 2026
- next-step/nextstep-skillstheir own version, first seen Nov 8, 2026
Used with
Projects with it also use start-mission, improve-codebase-architecture 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.
parkchuSkillstart-mission
넥스트스텝(NextStep) 미션을 처음 시작할 때, 미션 저장소를 fork·clone하고 최초 작업 브랜치(step1 등)까지 만들어 준다. gh CLI로 fork하고 clone까지 이어서 처리하며, gh가 없거나 인증이 안 돼 있으면 브라우저 Fork 안내로 폴백한다. 이미 fork/clone돼 있으면 재사용하고 이어서 진행한다(재실행 안전). 사용자가 "미션 시작하려는데 저장소 세팅해줘", "새 미션 시작할래", "fork부터 해줘", "/nextstep:start-mission" 등으로 요청할 때 사용한다.
Also in 3 projects that use this
GoogleSkillimprove-codebase-architecture
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
Also in 3 projects that use this
GoogleSkilltdd
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
Other versions19 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 19
- microsoft/vscode★ 196ksame name
- nyaruka/phonenumbers★ 1.6ksame name
- garfiec/Librechat-Mobile★ 169same name
- nklisch/claude-code-modes★ 116same name
- ric03uec/clawrium★ 68same name
- leandrocfe/skills★ 31same name
- tigercosmos/code-cortex-mcp★ 12same name
- freskhu/genesis★ 5same name
- lucasheriques/pstack★ 4same name
- toverux/cantrips★ 3same name
9 more not listed
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 repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- create-skillSkill
- domain-modelingSkill
- grillingSkill
- scaffold-projectSkill
- session-handoffSkill
- session-searchSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
30 rules. 0 are common, 16 are distinctive, and 14 are very specific to this project.
0
Common
Most of the 14 edited versions we read keep these.
16
Distinctive
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
If this fails (missing remote), check the origin remote to infer the source:
- Very specific: line 30
If origin is your own repo (forked from jamesctucker/moraine, or cloned from it and repointed — the two setups the README recommends), add:
- Very specific: line 36
If origin came from a different user's repo (e.g., you forked from a friend who forked jamesctucker), ask the user which upstream they want …
- Distinctive: line 44
If anything is uncommitted or staged, stop and tell the user: "Working tree is dirty.
- Very specific: line 52
If CURRENT_BRANCH is not main, tell the user: "You're on $CURRENT_BRANCH.
- Distinctive: line 54
If they decline, proceed on the current branch — but remind them in the final report.
- Distinctive: line 79
If the output is empty, tell the user "Already up to date — no upstream changes to sync" and exit.
- Distinctive: line 81
If there are changes, list them so the user sees what's coming:
- Distinctive: line 147
If the file was deleted upstream, remove it locally:
- Very specific: line 155
Edge case — user-local changes to SAFE files: Check git diff HEAD -- <file> before checking out upstream.
- Very specific: line 175
If upstream added a new [CUSTOMIZE] section, include it
- Very specific: line 176
If upstream removed or moved a [CUSTOMIZE] section, surface it to the user — don't silently drop their content
- Distinctive: line 184
If upstream and user both changed the same non-marked section, prefer upstream (structural) but note the conflict
- Distinctive: line 205
Wait for the user's choice per file.
- Very specific: line 207
If the user chose "Show me the raw diff", print diff <file> <(git show upstream/main:<file>) and re-ask.
- Distinctive: line 213
If upstream changed any of these, stop and surface to the user.
- Distinctive: line 219
If upstream added a new file in a SAFE directory (e.g., new skill, new script), just take it:
- Distinctive: line 226
If upstream added a new file in a USER-OWNED directory, surface it to the user and ask.
- Distinctive: line 230
After all files are staged:
- Very specific: line 240
If upstream changed scripts/setup or requirements.txt, reinstall the Python dependencies into the workspace venv:
- Very specific: line 248
If upstream changed .opencode-version:
- Very specific: line 255
If they don't match, tell the user: "Upstream updated OpenCode to $EXPECTED.
- Very specific: line 259
Run the same checks as scripts/setup:
- Very specific: line 267
If anything fails, stop and tell the user.
- Distinctive: line 271
If smoke test passed (or user chose to proceed despite warnings):
- Distinctive: line 286
After committing, print a clear summary:
- Distinctive: line 315
If something fails and you've already staged some changes:
- Distinctive: line 323
If the user says "stop", "cancel", or "abort" at any point:
- Very specific: line 334
If git diff HEAD..upstream/main --stat | tail -1 shows more than ~50 files changed, warn the user: "This is a large upstream sync ($N …
- Distinctive: line 342
If the user has local commits between syncs, those are preserved in the backup branch
“Common” is measured: kept by at least 6 in 10 of the 14 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
Sync with Upstream
When to use
User wants to pull changes from the upstream Moraine repo into their clone or fork while preserving their personalizations (AGENTS.md customizations, MCP server selection, wiki content, etc.).
Overview
This is a merge operation, not a reset. The goal is to take upstream improvements (new skills, script fixes, cron updates) while keeping the user's personal content intact. For files with [CUSTOMIZE] markers the agent proposes a merge that keeps the marked regions; for markerless config it applies explicit preservation rules (e.g. the user's MCP server set). Every personalized file is shown to the user for approval — nothing personalized is auto-overwritten.
Pre-flight
1. Verify upstream remote
git remote get-url upstreamIf this fails (missing remote), check the origin remote to infer the source:
ORIGIN_URL=$(git remote get-url origin)If origin is your own repo (forked from jamesctucker/moraine, or cloned from it and repointed — the two setups the README recommends), add:
git remote add upstream https://github.com/jamesctucker/moraine.gitIf origin came from a different user's repo (e.g., you forked from a friend who forked jamesctucker), ask the user which upstream they want to sync from before adding the remote. Don't assume.
2. Check working tree is clean
git status --porcelainIf anything is uncommitted or staged, stop and tell the user: "Working tree is dirty. Commit or stash your changes before syncing." Do not proceed.
Also check the current branch: Ops should happen on main. If the user is on a feature branch, warn them and offer to switch:
CURRENT_BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null || echo "")If CURRENT_BRANCH is not main, tell the user: "You're on $CURRENT_BRANCH. Syncing here will commit upstream changes to this branch. Switch to main first? [Y/n]"
If they decline, proceed on the current branch — but remind them in the final report.
3. Create a backup branch
This is the escape hatch — if the sync goes wrong, the user can always reset to this branch.
BACKUP_BRANCH="backup-pre-sync-$(date +%Y%m%d-%H%M%S)"
git branch "$BACKUP_BRANCH"Tell the user: "Created backup branch \"$BACKUP_BRANCH\". If anything goes wrong: git reset --hard $BACKUP_BRANCH"
4. Fetch upstream
git fetch upstream5. Detect if there's anything to sync
git diff HEAD..upstream/main --name-onlyIf the output is empty, tell the user "Already up to date — no upstream changes to sync" and exit.
If there are changes, list them so the user sees what's coming:
Upstream changes detected:
M scripts/setup
M .agents/skills/session-handoff/SKILL.md
A packs/<pack>/skills/new-skill/SKILL.md
...Classify changes
For each changed file, classify into one of three buckets based on the path:
SAFE — structural files, auto-take upstream
These files are pure upstream code. The user should not have personalized them. If local changes exist, they were probably accidental — but always check (see "Auto-merge SAFE files" below for the safety check).
scripts/**(setup, themoraineCLI, core workspace scripts).agents/skills/<id>/**for each core skill upstream ships; any other real folder there is the user's (see USER-OWNED)packs/<pack>/**for every pack exceptlocal: skills, scripts, jobs,pack.yaml.opencode/plugins/**(plugin scaffolding).opencode/opencode.jsonoutsidemcp.servers(shell-safety permissions)CLAUDE.md,.claude/settings.json(the Claude import and permission mirror; the rest of.claude/is gitignored sync state).opencode-versiontests/**.husky/**(git hooks) — treat as SAFE but always check for user-local changes; users sometimes customizepre-push.github/**.editorconfig,.gitattributes,.gitignore,.nvmrc.sembleignorepackage.json,bun.lock,pyproject.toml,requirements.txtat the repo root (theautomationpack's runner copies are SAFE viapacks/<pack>/**above)LICENSE
PERSONALIZED — files with [CUSTOMIZE] markers or user-edited config
These files have structure that upstream maintains, but contain [CUSTOMIZE] sections where the user adds their own content. The agent should propose a merge, not auto-take upstream.
AGENTS.md— has[CUSTOMIZE]markers for remote accesspacks/<pack>/AGENTS.md— when it carries[CUSTOMIZE]markers (a pack's issue-tracker section does)README.md— user-edited setup notes and integrations (no markers; whole file is user-owned in spirit).opencode/opencode.json— permissions come from upstream; only themcp.serversblock is preserved (see the rule below)repos/README.mdandrepos/*.md— the user's repo registry (pointer files)memory/README.md(if user customized stubs)artifacts/README.md
USER-OWNED — user creates all content, upstream should never touch
These paths belong to the user. Never write to one yourself — not a stub, not a fix — and if an upstream change touches one, stop and surface it: it is either a template update (acceptable) or a mistake (flag it).
moraine.yaml— harnesses, enabled packs, and the user's MCP serverspacks/local/**— the user's own pack.agents/skills/<id>/for any skill upstream does not ship as corewiki/**memory/sessions/**,memory/staging/**,memory/reviews/**artifacts/**(except README.md and _TEMPLATE.md)repos/<repo>/**(sub-repos)
Auto-merge SAFE files
For each SAFE file that has upstream changes:
git checkout upstream/main -- <file>
git add <file>If the file was deleted upstream, remove it locally:
git rm <file>Track which files were auto-merged and report them at the end.
Edge case — user-local changes to SAFE files: Check git diff HEAD -- <file> before checking out upstream. If the user has local modifications, do not auto-overwrite — move it to the PERSONALIZED list and ask the user.
Smart-merge PERSONALIZED files
For each PERSONALIZED file:
1. Read both versions
git show upstream/main:<file> > /tmp/upstream-version
cat <file> # current version2. Identify the merge structure
Markers are a convention, not a machine-enforced boundary: AGENTS.md uses them consistently, opencode.json has none (it gets the MCP-preservation rule below instead). For files that do carry them (AGENTS.md, and a pack's AGENTS.md when it has them):
- The user's content lives between
<!-- [CUSTOMIZE] ... -->markers - Upstream changes outside those markers should be taken
- User content inside those markers should be preserved
- If upstream added a new
[CUSTOMIZE]section, include it - If upstream removed or moved a
[CUSTOMIZE]section, surface it to the user — don't silently drop their content
3. Propose a merged version
Construct the merged file in /tmp/<file>-merged. Use your judgment:
- Take upstream's structural changes (new sections, bug fixes, rewording)
- Preserve user's content inside
[CUSTOMIZE]blocks - If upstream and user both changed the same non-marked section, prefer upstream (structural) but note the conflict
For opencode.json: upstream owns everything except the mcp.servers block, which moraine sync writes from moraine.yaml and the enabled packs. Take upstream's changes outside that block and leave the local block alone. The user's server list lives in moraine.yaml, which is user-owned and is never merged. After the merge, run python3 scripts/moraine sync to regenerate the block.
4. Show the user the diff
diff <file> /tmp/<file>-mergedPresent this clearly. Then ask, per file:
AGENTS.md has upstream changes. I've proposed a merge that preserves
your [CUSTOMIZE] sections. Options:
1. Use my proposed merge (recommended)
2. Take upstream version (discard your changes)
3. Keep your version (skip upstream changes)
4. Show me the raw diffWait for the user's choice per file. Apply it: copy the chosen version to the actual file path and git add it.
If the user chose "Show me the raw diff", print diff <file> <(git show upstream/main:<file>) and re-ask.
USER-OWNED files
For files in any USER-OWNED path (moraine.yaml, packs/local/, wiki/, memory/sessions/, artifacts/ except README.md and _TEMPLATE.md):
If upstream changed any of these, stop and surface to the user. This shouldn't happen in normal operation. Possible causes:
- Template update added a new stub to
wiki/ormemory/— show user, ask if they want it - Mistake (upstream accidentally committed personal content) — flag it, don't apply
New files (added upstream)
If upstream added a new file in a SAFE directory (e.g., new skill, new script), just take it:
git checkout upstream/main -- <new-file>
git add <new-file>If upstream added a new file in a USER-OWNED directory, surface it to the user and ask.
Verify the merge
After all files are staged:
1. Resync and dependencies
Upstream may have moved skills or changed a pack manifest, so relink first:
python3 scripts/moraine syncIf upstream changed scripts/setup or requirements.txt, reinstall the Python dependencies into the workspace venv:
bash scripts/setup --yes2. OpenCode version check
If upstream changed .opencode-version:
INSTALLED=$(opencode --version 2>/dev/null || echo "none")
EXPECTED=$(cat .opencode-version)If they don't match, tell the user: "Upstream updated OpenCode to $EXPECTED. You have $INSTALLED. Run bash scripts/setup to install the matching version."
3. Smoke test
Run the same checks as scripts/setup:
python3 scripts/workspace/session-index.py --help 2>/dev/null || echo "session-index broken"
python3 scripts/workspace/validate.py || echo "validate failed"
python3 scripts/workspace/health-check.py --quick || echo "health check failed"If anything fails, stop and tell the user. Offer to abort: git reset --hard $BACKUP_BRANCH.
Commit
If smoke test passed (or user chose to proceed despite warnings):
UPSTREAM_SHA=$(git rev-parse --short upstream/main)
git commit -m "Sync with upstream ($UPSTREAM_SHA)
Auto-merged: <list of SAFE files>
Smart-merged: <list of PERSONALIZED files with user choices>
Skipped: <list of USER-OWNED files if any>
Backup branch: $BACKUP_BRANCH"Report
After committing, print a clear summary:
✓ Synced with upstream (abc1234)
Auto-merged (safe files):
scripts/setup
.agents/skills/sync-upstream/SKILL.md
...
Smart-merged (personalized):
AGENTS.md — preserved your [CUSTOMIZE] sections
.opencode/opencode.json — kept your mcp.servers block (moraine sync rerun)
New files added:
packs/<pack>/skills/new-skill/SKILL.md
Skipped (user-owned, no upstream changes):
wiki/, memory/sessions/
Smoke test: all passed
Backup: git reset --hard $BACKUP_BRANCH if anything looks wrongFailure modes
Merge went wrong mid-way
If something fails and you've already staged some changes:
- Tell the user what failed
- Offer to abort:
git reset --hard $BACKUP_BRANCH(discards all staged changes) - Or offer to commit what's been merged so far and let them clean up manually
User cancels
If the user says "stop", "cancel", or "abort" at any point:
git reset --hard $BACKUP_BRANCH
git checkout main # or whatever branch they were onTell them: "Aborted. Nothing was changed. Backup branch is still there if you want to inspect."
Upstream has diverged significantly
If git diff HEAD..upstream/main --stat | tail -1 shows more than ~50 files changed, warn the user: "This is a large upstream sync ($N files). Consider reviewing [upstream changes](https://github.com/jamesctucker/moraine/compare/$(git rev-parse --short HEAD)...upstream/main) first. Proceed?"
For very large syncs, suggest doing it file-by-file across multiple sessions.
Notes
- This skill runs destructive git operations only after explicit user approval (except
git checkout upstream/main -- <safe-file>for SAFE files with no local changes, which is documented as auto-take behavior) - The backup branch is never deleted by this skill — the user can clean up old backups with
git branch -D backup-pre-sync-*later - If the user has local commits between syncs, those are preserved in the backup branch
- Merges normally happen on
main, matching the "personal repo" mental model where the user works directly onmain. If the user insists on syncing from a feature branch, the commit lands there — warn in the report.
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.

