git-auto-sync-pipelines
Skill3 starsChanged 53 days agoMITView on GitHub
Design a scheduled commit/push pipeline for a repo the owner edits by hand: ordered preflight gates, a scope allowlist and size cap, a staged secret scan, rebase-then-push, heartbeat and deduped alerts. Use when a notes or research repo must sync on a schedule, or when an existing auto-sync needs a safety review. Not for a repo with a review/PR workflow, and not for a one-off commit you can make yourself.
- Commits and pushes
In this repository59 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-harness-settings-paritySkill
- agent-operating-contract-evolutionSkill
- ai-coding-agent-delegationSkill
- arch-improvement-planSkill
- contract-bound-deliverablesSkill
- cross-agent-repair-routingSkill
- define-goalSkill
- delegated-work-acceptanceSkill
- design-an-interfaceSkill
- design-mdSkill
- discord-rich-messageSkill
- dotnet-repo-workflowSkill
- evidence-backed-analytical-writingSkill
- evidence-boundary-disciplineSkill
- find-nearbySkill
- gddSkill
- generated-runtime-repairsSkill
- ghc-searchSkill
- github-code-reviewSkill
- github-repo-managementSkill
- grounded-citationsSkill
- harness-engineeringSkill
- hermes-context-file-loadingSkill
- hermes-modelsSkill
- hermes-updatesSkill
- hoa-introspect-distillSkill
- hoa-introspectSkill
- hoa-skill-reviewSkill
- hoa-skill-workSkill
- html-artifactSkill
- jupyter-live-kernelSkill
- kanban-workflowsSkill
- m365-copilot-cdpSkill
- measurement-campaign-evidenceSkill
- microsoft-officeSkill
- notes-to-prdSkill
- ocr-and-documentsSkill
- official-document-verificationSkill
- omp-headless-orchestrationSkill
- ops-claim-verificationSkill
- package-release-verificationSkill
- plan-to-issuesSkill
- project-phase-closeoutSkill
- report-claim-auditSkill
- research-stream-consolidationSkill
- review-revision-candidatesSkill
- rss-feedsSkill
- skill-library-curationSkill
- skill-porting-and-publishingSkill
- spec-convergenceSkill
- structural-validity-gatesSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- teams-cdpSkill
- tmux-agent-controlSkill
- whisperSkill
- writing-plansSkill
- writingSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
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
- Very specific: line 52
Heartbeat + watchdog: every successful run (including no-ops) writes a timestamp.
- Very specific: line 78
Read the repo's own contract for the validation set (its harness README, AGENTS.md, or equivalent) and run exactly that (SYNC_VALIDATE_CMD).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Git auto-sync pipelines
When to Use
- A repo is edited by hand (notes vault, research repo) and must be committed and pushed on a schedule.
- An existing auto-sync needs a safety review: branch guard, secret scan, alert noise, silent stalls.
- Someone asks to "sync these two repos every N hours" without a PR workflow.
Scheduled "validate → commit → rebase → push the target branch" for a repo the owner edits by hand.
Reference implementation shape: one shared library (<sync-root>/lib/git-sync-common.sh) plus one
wrapper per repo, run by a single scheduler entry that loops the wrappers and prints only what they
printed. A separate watchdog is usually retired into the daily health sweep: "has not succeeded
recently" is one step of that sweep, because a periodic watchdog cannot outlive the scheduler it is
watching.
Gate order (never reorder)
flock— one run at a time; silent skip on contention.- pre-staged index → refuse. Staging is the human's signal, not the automation's.
- no-op check → exit silently (still stamp the success heartbeat).
- branch must equal the target branch.
git push origin HEAD:<target>from a feature branch publishes that branch's commits to the target — this is the single highest-severity failure mode. - in-progress git operation markers (
rebase-merge,rebase-apply,MERGE_HEAD,CHERRY_PICK_HEAD,BISECT_LOG) → skip; a conflict path that runsrebase --abortwould otherwise destroy the owner's manual rebase. - scope + size gate → repo-defined validation →
git add -A→ staged secret scan → commit. - rebase onto
origin/<branch>, then push (never force), then re-fetch and assert HEAD == remote.
Rules that matter more than the happy path
- Exit 0 on failure when the message is the alert. A no-agent scheduler sends an extra error
notice on non-zero exit, so the wrapper's
fail()returns 0 after printing — one message, not two. - Dedupe alerts by failure signature (hash of the message,
SYNC_DEDUPE_HOURSwindow, default 24) or a permanently failing gate becomes 12 messages/day. - Heartbeat + watchdog: every successful run (including no-ops) writes a timestamp; a second
scheduled job alerts when the newest heartbeat is older than
SYNC_WATCHDOG_HOURS. Without it, a stale lock or a crashed script means "silently not syncing", which looks identical to "nothing to sync". - Scope whitelist, not
git add -Aalone: tracked paths are always allowed; new files only under declared roots (SYNC_NEW_FILE_ROOTS). Otherwise any stray export lands in history, which is irreversible. - Size cap (
SYNC_SIZE_BLOCK_MB, default 20;SYNC_SIZE_WARN_MB, default 5). Binary bloat in git is one-way. SYNC_PUSH=0turns a run commit-only: set it on secondary machines so exactly one machine pushes.- Target branch is configuration, not a constant. Resolve it per repo (
SYNC_TARGET_BRANCH, default: the repo's remote HEAD); never copymainfrom one machine into another repo's pipeline.
Secret scan specifics
gitleaks git --staged --redact --no-bannerexits 1 on findings and keeps secrets out of stdout. Substitute the scanner the operator's install provides; the contract is staged-only, exit 1 on a finding, no secret echoed.- A secret scanner usually carries a built-in allowlist: an AWS documentation placeholder such as
AKIAIOSFODNN7EXAMPLEis NOT reported. Verify the scan with a realistic token (ghp_plus 36 characters), not a documentation placeholder. - On a finding:
git reset -q(unstage) before failing, or the pre-staged guard blocks every later run and the sync wedges until a human intervenes.
Repo-specific validation stays in the repo
Read the repo's own contract for the validation set (its harness README, AGENTS.md, or equivalent)
and run exactly that (SYNC_VALIDATE_CMD). If the repo forbids unattended commits/pushes, add a
narrow mechanical-sync exception clause to its contract in the same change instead of silently
violating it.
Pitfalls
- Capture
git rebaseoutput. Conflict hints go to stderr and, uncaptured, reach stdout — which the scheduler delivers verbatim, so the noise re-fires every run and defeats alert dedupe. Capture to a variable, keep only theCONFLICTline in the alert, abort silently. - A stuck conflict is a human decision: abort, keep the local commit, alert once a day. Never
--force, neverrebase --skip. - Validation scripts that write dated reports will pollute every commit; delete only today's
untracked copies (never
git cleanthe whole directory — it takes human files too). - A validator that always exits 0 (report-only lint) is not a gate; say so instead of implying safety.
- Background/no-tty runs of such scripts can emit
open terminal failed: not a terminal; run tests in the foreground.
Configuration
| Key | Env | Default |
sync_root | SYNC_ROOT | none — directory holding the library and wrappers |
repos | SYNC_REPOS | none — newline/space list of repo paths, or a config file |
target_branch | SYNC_TARGET_BRANCH | the repo's remote HEAD branch |
new_file_roots | SYNC_NEW_FILE_ROOTS | none — allowlist of roots; tracked paths always pass |
validate_command | SYNC_VALIDATE_CMD | the repo's own contract command; none if absent |
secret_scanner | SYNC_SECRET_SCANNER | gitleaks if installed, else require an explicit value |
size_block_mb | SYNC_SIZE_BLOCK_MB | 20 |
size_warn_mb | SYNC_SIZE_WARN_MB | 5 |
dedupe_hours | SYNC_DEDUPE_HOURS | 24 |
watchdog_hours | SYNC_WATCHDOG_HOURS | none — required by the heartbeat job |
heartbeat_file | SYNC_HEARTBEAT_FILE | ${XDG_STATE_HOME:-$HOME/.local/state}/<sync-name>/heartbeat |
push | SYNC_PUSH | 1 |
alert_channel | SYNC_ALERT_CHANNEL | the scheduler's own notification path |
Resolution order and the config-file path are defined once in skill-porting-and-publishing § Configuration; this skill does not restate them. The repo list and target branch belong in the operator's config, not in the library script.
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.

