mirror-sync
Skill18 starsChanged 43 days agoMITView on GitHub
Pull every remote-only n8n workflow into the local repo so it mirrors the instance, via a deterministic JS Workflow (discover remote-only → fan-out pull → verify). Establishes and refreshes the local-first invariant that /n8n-autopilot:build-workflow-v2's edit flow relies on. Auto-triggered by the SessionStart drift probe (check-mirror-drift.sh) and run as the final step of init-repo.
In this repository25 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- build-stack-v2Skill
- build-workflowSkill
- build-workflow-v2Skill
- check-mcpsSkill
- data-tablesSkill
- deploySkill
- feedbackSkill
- find-credentialSkill
- find-projectSkill
- init-repoSkill
- inventorySkill
- n8nac-cheatsheetSkill
- n8nac-referenceSkill
- n8n-code-javascriptSkill
- n8n-code-pythonSkill
- n8n-modeSkill
- n8n-orchestration-patternsSkill
- n8n-structured-extractionSkill
- plugin-testingSkill
- pull-schemasSkill
- session-envSkill
- stack-intakeSkill
- sync-credentialsSkill
- test-manualSkill
The file
Files
Mirror Sync — pull all remote-only workflows
Make the local repo a complete mirror of the instance's workflows. n8nac has no pull-all; this skill drives the list --json → per-id pull loop deterministically via a Workflow script (fan-out, no silent cap, verified).
Why this exists
The edit flow of /n8n-autopilot:build-workflow-v2 is local-first — it assumes every remote workflow already has a local .workflow.ts. Nothing established that invariant before (init pulled schemas, never workflows). This skill is the enforcement: it pulls the gap and the SessionStart probe keeps it honest.
How to run
Normalize the script into the scratchpad, then invoke that copy via the Workflow tool (it runs in
the consumer-repo cwd, so npx n8nac still resolves the pinned project + sync folder):
sed 's/\r$//' "<plugin>/skills/mirror-sync/sync.workflow.js" > "<scratchpad>/sync.workflow.js"Workflow({ scriptPath: "<scratchpad>/sync.workflow.js" })The
sedis not optional — and seeing LF once does not excuse skipping it. Line endings in the installed copy are sporadic: measured withfile, this script was CRLF in 5.3.0 and 5.3.1 and LF in 5.3.2, whilebuild.workflow.jswas LF in all three. A version that works proves nothing about the next install, so normalize unconditionally — even though the repo blob is LF and.gitattributespins*.js text eol=lf.Workflow({scriptPath})then refuses it outright: "script contains control characters that would be hidden in the approval dialog". Normalizing costs one command and is content-identical to the blob (cmpagainstgit show HEAD:<path>). Never hand-edit the plugin cache.
Then render the result:
{ status:'success', pulled, mirrorComplete:true }— report how many pulled (0 = already complete).{ status:'partial', failed:[…], remoteOnlyRemaining }— list the failed ids + reasons; suggest a re-run or a manualnpx n8nac pull <id>.
Watch live progress with /workflows.
Phases (in the script)
- Discover —
n8n-mirrorrunsnpx n8nac list --jsonand returns the remote-only set (status matches/REMOTE/i— vocabulary-robust across n8nac versions — and not archived). Zero remote-only → returns early, mirror already complete. - Pull — fan-out: one
n8n-mirroragent per missing workflow runsnpx n8nac pull <id>. Failures are collected, not fatal. - Verify — re-discover;
remoteOnlyRemaining === 0⇒mirrorComplete.
Triggers
| Source | Mechanism |
| SessionStart | scripts/check-mirror-drift.sh --quiet emits AUTOPILOT_ACTION_REQUIRED: /n8n-autopilot:mirror-sync only when remote-only workflows exist (no blind every-session pull). |
| init-repo | Step 6.5 runs this after schemas, so a fresh repo starts as a full mirror. |
| Manual | /n8n-autopilot:mirror-sync any time. |
Boundaries
- Workflows only. Node schemas are a separate concern (
check-schema-versions.sh→/n8n-autopilot:pull-schemas); this skill does not duplicate them. - Pull only — never push/resolve/delete. Archived workflows are skipped (read-only).
- Large instances: fan-out is capped at ~10 concurrent by the Workflow runtime; all queued workflows still complete. The pull list is logged in full — no silent truncation.
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.

