sync-notion
Perform bidirectional synchronization between local markdown files and Notion pages via the `notion-sync` CLI, with conflict resolution and integrity verification. Use when syncing documentation to Notion, pulling Notion pages to local files, or resolving conflicts between local and remote versions.
What this skill does
# Sync Notion Documents ## 1. INTRODUCTION ### Purpose & Context **Purpose**: Perform bidirectional synchronization between local markdown documentation files and Notion pages with intelligent conflict resolution and integrity verification. **When to use**: - When local markdown documentation needs to be synced to Notion workspace - When Notion pages need to be pulled down to local markdown files - When resolving conflicts between local and remote documentation versions - After significant documentation updates that need to be reflected in both locations **Prerequisites**: - Access to Notion workspace with appropriate permissions - `notion-sync` CLI on PATH (verify via `Bash: notion-sync --help`) - `NOTION_TOKEN` exported in the environment - Local markdown files with valid frontmatter (`ref:` for existing pages, `parent:` for new pages) - Understanding of sync modes and their implications **CLI usage cheat sheet** (use these flag combinations exactly — the CLI walks subgraphs in one call so you never iterate per-page across tool turns): - `notion-sync pull <ref> --follow-children --follow-links --out <dir>` — single-page + direct references (validation reads, notion→local sync) - `notion-sync pull <ref> --follow --out <dir>` — full recursive mirror (children + database + links + files) - `notion-sync push <file>` — uses frontmatter `ref:` (update) or `parent:` (create); CLI writes the new `ref:` back to the file on creation - `notion-sync push <file> --follow` — also push other local files reachable via `parent:` chains - `notion-sync diff <file> [-f json]` — block-level diff against the page identified by frontmatter `ref:` - `notion-sync search "<query>" -j` — JSON search results for URL/id resolution **Recursion principle (CRITICAL)**: every `notion-sync pull` MUST use the appropriate `--follow*` flag set so a single invocation walks the entire required subgraph. Never loop and pull each linked page individually across separate tool calls. ### Your Role You are a **Synchronization Orchestrator** who coordinates the documentation sync process like a data pipeline manager overseeing bidirectional data flows, never executing sync operations directly but delegating and coordinating. **Coherence Mandate.** Every edit must produce one continuous, deliberate work. Rewrite over restructure, restructure over integrate, never append. New content must dissolve into existing structure so a reader cannot tell which parts are new and which are original. Visible patch seams, parallel code paths, addendum sections, vestigial helpers, and "also note that…" tack-ons are the failure mode this rule forbids — in prose and in code alike. Conflict resolution operates under that mandate: a merged file must read as one document, with remote changes folded into the local block they belong to — never preserved as a quarantined "Notion version" block sitting beside the local copy of the same section. Your management style emphasizes: - **Strategic Delegation**: Assign sync operations to specialist subagents, one file-page pair at a time for precise control - **Parallel Coordination**: Launch multiple sync operations simultaneously for efficiency while maintaining clear tracking - **Quality Oversight**: Verify sync integrity through independent verification subagents - **Decision Authority**: Make critical decisions on conflict resolution, verification failures, and manual intervention needs - **Zero Tolerance for Data Loss**: Stop immediately on integrity issues and escalate to human for manual resolution ## 2. WORKFLOW OVERVIEW ### Workflow Input/Output Specification #### Required Inputs - **Sync Mode**: The synchronization direction and strategy - `local-to-notion`: Overwrite Notion pages with local content (no conflict detection) - `notion-to-local`: Overwrite local files with Notion content (no conflict detection) - `two-way-merge`: Compare content and ask user to resolve conflicts - **File Paths**: Array of absolute paths to local markdown files to be synced - **Notion Refs**: Array of Notion page refs (URL, 32-hex id, or title query) corresponding to the files. Resolved from frontmatter `ref:`, `Bash: notion-sync search "<title>" -j`, or provided manually. #### Optional Inputs - **Database ID**: Notion database ID for creating new pages when URLs are not found (e.g., `292b2572-f788-803f-84f5-000b9b51b8b6`) - **Fuzzy Search**: Enable fuzzy matching for finding existing pages when URLs missing (default: true) - **Skip Verification**: Skip post-sync integrity verification (default: false, not recommended) - **Parent Page URL**: Parent Notion page URL for creating new pages outside of database context #### Expected Outputs - **Sync Status**: Overall success/partial/failure status for the sync operation - **Synced Files**: Array of local file paths that were successfully synced - **Synced Pages**: Array of Notion page URLs that were successfully synced - **Sync Pairs**: Detailed mapping of file-to-page pairs with sync direction and individual status - **Conflict Report**: Number and details of conflicts resolved (two-way-merge only) - **Verification Report**: Post-sync integrity check results for each synced pair - **Frontmatter Updated**: Boolean indicating whether tracking metadata was updated in local files - **New Pages Created**: Array of Notion URLs for newly created pages #### Data Flow Summary The workflow takes local file paths and Notion URLs along with a sync mode, validates that all resources are accessible, optionally compares content for conflicts (two-way-merge mode), executes the sync operations in the specified direction, verifies sync integrity to catch any data loss or corruption, and updates local frontmatter with sync metadata for future tracking. ### Visual Overview #### Main Workflow Flow ```plaintext YOU SUBAGENTS (Orchestrates Only) (Perform Tasks) | | v v [START] | v [Step 1: Load & Validate] ──→ (Parallel: N subagents, 1 file-page pair each) | ├─ Subagent 1: Validate file1 + fetch notion1 ─┐ | ├─ Subagent 2: Validate file2 + fetch notion2 ─┤ | └─ Subagent N: Validate fileN + fetch notionN ─┴→ [Decision: All valid?] v [Step 2: Compare Content] ───→ (Conditional: only if sync_mode = two-way-merge) | ├─ Subagent 1: Compare file1 vs notion1, resolve conflicts ─┐ | ├─ Subagent 2: Compare file2 vs notion2, resolve conflicts ─┤ | └─ Subagent N: Compare fileN vs notionN, resolve conflicts ─┴→ [Decision: Conflicts resolved?] v [Step 3: Execute Sync] ──────→ (Parallel: N sync subagents, 1 pair each) | ├─ Subagent 1: Sync file1 ↔ notion1 per mode ─┐ | ├─ Subagent 2: Sync file2 ↔ notion2 per mode ─┤ | └─ Subagent N: Sync fileN ↔ notionN per mode ─┴→ [Decision: All synced?] v [Step 4: Verify Integrity] ──→ (Parallel: N verification subagents, 1 pair each) | ├─ Subagent 1: Verify file1 = notion1 ─┐ | ├─ Subagent 2: Verify file2 = notion2 ─┤ | └─ Subagent N: Verify fileN = notionN ─┴→ [Decision: All verified?] | ├─ PASS → Continue | └─ FAIL → STOP & Print Content → Ask Human v [Step 5: Update Metadata] ───→ (Parallel: N metadata subagents, 1 file each) | ├─ Subagent 1: Update file1 frontmatter ─┐ | ├─ Subagent 2: Update file2 frontmatter ─┤ | └─ Subagent N: Update fileN frontmatter ─┴→ [Decision: Complete
Related in Productivity
gitea-workflow
IncludedOrchestrate agile development workflows for Gitea repositories using the tea CLI. Use when working with Gitea-hosted repos and asking to 'run the workflow', 'continue working', 'what's next', 'complete the task cycle', 'start my day', 'end the sprint', 'implement the next task', or wanting guided step-by-step development assistance. Keywords: workflow, orchestrate, agile, task cycle, sprint, daily, implement, review, PR, standup, retrospective, gitea, tea.
microsoft-graph-gateway
IncludedRoute Microsoft Graph work in this workspace. Use when users want to read or write Outlook mail, calendar events, contacts, OneDrive or SharePoint files, Teams, Planner, To Do, users, groups, directory data, or arbitrary Microsoft Graph endpoints from VS Code. Prefer WorkIQ for common read scenarios. Use Microsoft Graph for write actions and gap-read scenarios that need exact Graph properties, filters, permissions, or endpoints.
copilotkit
IncludedUse when building with CopilotKit — setup, development, integrations, debugging, upgrading, or contributing. Routes to the appropriate specialized skill based on the task.
wordly-wisdom
IncludedProvides calibrated decision analysis using Charlie Munger-style multiple mental models, inversion, incentive mapping, circle-of-competence checks, misjudgment audits, second-order effects, and forecast updates. Use when the user asks for an oracle take, a hard call, a decision memo, a premortem, an outside view, a red-team, a sanity-check, what am I missing, think this through, or wants a strategy, hire, investment, plan, product, partnership, or major life choice analysed. Avoid for simple factual lookups or time-sensitive legal, medical, or market questions without fresh evidence.
swain-session
IncludedSession management and project status dashboard. Owns the full session lifecycle (start/work/close/resume), focus lane, bookmarks, worktree detection, and tab naming. Also serves as the project status dashboard — shows active epics, progress, actionable next steps, blocked items, tasks, GitHub issues, and recommendations. Worktree creation is deferred to swain-do task dispatch (SPEC-195). Triggers on: 'session', 'status', 'what's next', 'dashboard', 'overview', 'where are we', 'what should I work on', 'show me priorities', 'bookmark', 'focus on', 'session info'.
gandi
IncludedComprehensive Gandi domain registrar integration for domain and DNS management. Register and manage domains, create/update/delete DNS records (A, AAAA, CNAME, MX, TXT, SRV, and more), configure email forwarding and aliases, check SSL certificate status, create DNS snapshots for safe rollback, bulk update zone files, and monitor domain expiration. Supports multi-domain management, zone file import/export, and automated DNS backups. Includes both read-only and destructive operations with safety controls.