Skip to content
Development
Command

/sync-init

Set up automated sync for a new project folder: email monitoring (Outlook), file change detection, and auto-update of all documents (PRD, presentations, etc.) every 2 hours via cron. Run this in any project folder to get the same automation as other projects.

From plugin
coco
26441 skills37 agents41 commands
Install
$ npx -y skills add coco-research/coco --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/sync-init

Context preview

What this command does when you run it.

Set up automated sync for a new project folder: email monitoring (Outlook), file change detection, and auto-update of all documents (PRD, presentations, etc.) every 2 hours via cron. Run this in any project folder to get the same automation as other projects.

Command definition

sync-init.md
description: "Set up automated sync for a new project folder: email monitoring (Outlook), file change detection, and auto-update of all documents (PRD, presentations, etc.) every 2 hours via cron. Run this in any project folder to get the same automation as other projects."
allowed-tools:
  - Read
  - Write
  - Edit
  - Bash
  - Glob
  - Grep
  - Agent
  - Skill
  - AskUserQuestion

/pmstudio-sync-init — Set Up Automated Sync for a New Project Folder

Run it inside any project folder to set up automated sync. Execute the init process (Steps 1–6 below) directly — there is no separate `project-sync` skill; this command performs the setup and drives `~/.claude/scripts/project-sync-orchestrator.sh`. This sets up:

1. **Email extraction** — Searches Outlook via AppleScript (Legacy Outlook, primary) for project-specific emails by keywords, stakeholders, and subject patterns. Falls back to MIME cache + HxStore binary extraction if AppleScript fails (New Outlook). 2. **File monitoring** — Detects new meeting notes, research docs, source files in watched directories 3. **Sync report** — Generates `.sync-report.md` listing what changed and which docs need updating 4. **Auto-update** — Claude CLI (`claude -p`, Sonnet, $2 budget cap) reads new content and updates all structured documents (PRD, presentations, architecture, roadmap, etc.) 5. **Persistent cron job** — Runs every 2 hours in background, persists across terminal closes and reboots

The 4-Step Pipeline (every 2 hours)

Step 1: Email Search (AppleScript → Outlook inbox/sent)
  ↓ new emails saved to project emails folder
Step 2: File Detection (scan watched dirs for new/modified files)
  ↓ changes detected
Step 3: Sync Report (.sync-report.md generated)
  ↓ lists changed files + which docs need updating
Step 4: Auto-Update (Claude CLI reads changes, updates all target docs)
  ↓ documents updated, sync report deleted

What it creates

| File | Location | Purpose | |------|----------|---------| | `.sync-watch.json` | Project root | Config: keywords, senders, watch dirs, target docs, auto-update budget | | `run-sync-<name>.sh` | `~/.claude/scripts/` | Wrapper script (avoids OneDrive `&` path issues in launchd XML) | | `com.claude.project-sync.<name>.plist` | `~/Library/LaunchAgents/` | launchd cron job (every 2 hours) | | State cache | `~/.claude/state/<project>/` | Timestamps, logs, cached config, auto-update logs |

`.sync-watch.json` Full Schema

{
  "project_name": "Project Name",
  "watch_dirs": ["emails", "docs", "Meeting-Notes"],
  "target_docs": {
    "tier1": [
      {
        "path": "docs/PRD.html",
        "name": "PRD",
        "update_from": ["emails", "Meeting-Notes"],
        "what": "New requirements, stakeholder feedback, decisions"
      }
    ],
    "tier2": [
      {
        "path": "docs/Presentation.html",
        "name": "Stakeholder Deck",
        "update_from": ["PRD"],
        "what": "Sync with PRD changes"
      }
    ]
  },
  "email_search": {
    "enabled": true,
    "keywords": ["project name", "jira-id", "product name"],
    "senders": ["stakeholder_name", "another_name"],
    "subject_patterns": ["RE: Known Thread Subject"],
    "dest_dir": "emails",
    "format": "txt"
  },
  "auto_update": {
    "enabled": true,
    "model": "sonnet",
    "max_budget_usd": 2.00
  },
  "ignore_patterns": [".*", "*.tmp", "~$*"],
  "file_types": [".md", ".html", ".docx", ".xlsx", ".pdf", ".eml", ".txt"]
}

Init Process

Step 1: Gather project info

Ask the user for (or infer from existing files like CLAUDE.local.md, existing emails, folder structure): 1. **Project name** 2. **Email search keywords** — project-specific terms (product names, Jira IDs, codenames) 3. **Key stakeholders/senders** — names to filter emails by 4. **Subject patterns** — known email thread subjects 5. **Watch directories** — folders to monitor (emails, meeting notes, research, etc.) 6. **Target documents** — tier1 (critical) and tier2 (secondary) docs to auto-update 7. **Email destination folder** — where to save discovered emails 8. **Email format** — `txt` (default) or `eml` 9. **Auto-update settings** — model (`sonnet` default), budget ($2.00 default)

Step 2: Create `.sync-watch.json` in project root

Step 3: Create wrapper script

Write `~/.claude/scripts/run-sync-<safe-name>.sh`:

#!/bin/bash
exec /bin/bash $HOME/.claude/scripts/project-sync-orchestrator.sh "/full/path/to/project"

**CRITICAL:** Use absolute paths (no `~`), quote the path (handles `&` in OneDrive paths).

Step 4: Create launchd plist

Write `~/Library/LaunchAgents/com.claude.project-sync.<safe-name>.plist` with:

  • ProgramArguments pointing to the wrapper script (NOT the project dir directly)
  • StartInterval: 7200 (2 hours)
  • RunAtLoad: true
  • HOME env var set explicitly
  • Log paths under `~/.claude/logs/`

Step 5: Activate & cache

mkdir -p ~/.claude/logs ~/.claude/state
launchctl load ~/Library/LaunchAgents/com.claude.project-sync.<safe-name>.plist

Then run manually once to cache config:

/bin/bash ~/.claude/scripts/run-sync-<safe-name>.sh

Step 6: Verify

`launchctl list | grep project-sync` — expect exit code 0.

Email Search Details

**Primary: AppleScript (Legacy Outlook)**

  • Full inbox + sent items access
  • Searches by sender name/address, subject keywords, subject patterns
  • Saves matching emails as `.txt` files with headers (Subject, From, Date)
  • Deduplicates by checking if message date already exists in file
  • Searches last 2000 messages per folder (messages are date-sorted, stops at timestamp)

**Fallback: MIME + HxStore (New Outlook)**

  • Parses `~/Library/Group Containers/UBF8T346G9.Office/Outlook/.../MimeFiles/` for clean email files
  • Scans `HxStore.hxd` binary for subject awareness (logged, not dumped)
  • Used automatically if AppleScript fails

Email Commands (also available)

These `/email-*` commands work alongside the sync cron:

| Command | What it does | |---------

Read more
Ships withcoco

Meet Coco. A superintelligent agent framework powered by an advisory board of 389 world-class minds. Scale your AI assistant into a complete engineering department with 142 skills, 277 commands, and persistent state. Universal compatibility. Local privacy. Free and open source.

Get the whole plugin