sync
Reconcile coco tracker state with the configured issue tracker. Syncs task statuses and reports mismatches.
User Input
$ARGUMENTS
$ARGUMENTS can optionally specify:
--dry-run-- show what would change without making updates--epic {name}-- sync a specific epic (default: active)
Setup
- Read
.coco/config.yamlforissue_trackerconfiguration. - If
issue_tracker.provideris "none", report "No issue tracker configured" and exit.
Execution
0. Clean Up Stale Worktrees
Remove stale git worktree references left by crashed or completed agents:
git worktree prune
If .claude/worktrees/ contains directories with no corresponding git worktree, remove them:
git worktree list --porcelain
Compare against directories in .claude/worktrees/. Remove any orphaned directories.
1. Load Tracker State
coco-tracker list --json --epic {epic-id}
Parse all tasks with their statuses and issue_key metadata.
2. Load Issue Tracker State
For each tracker task that has an issue_key:
If "linear":
Use: mcp__plugin_linear_linear__get_issue
Parameters:
id: {issue_key}
If "github":
If github.use_projects is true:
- Read
.coco/state/gh-projects.jsonand find the feature entry whereproject_numbermatches the task'sgh_project_numbermetadata. Extractproject_id,status_field_id, andstatus_optionsfrom that entry. - Query project board status as source of truth:
Match each task'sgh project item-list {project_number} --owner {github.owner} --format jsongh_project_item_idto get its current board column status. - Backfill detection: For tasks with
issue_keybut nogh_project_item_id(pre-existing issues created before Projects V2 was enabled), offer to backfill:
Then update tracker metadata with the newgh project item-add {project_number} --owner {github.owner} --url {issue_url}gh_project_item_id.
If github.use_projects is false (legacy):
gh issue view {issue_number} --json state,labels
3. Compare and Sync
Apply status mapping from issue_tracker.status_map in config:
| Tracker Status | Expected Issue Status |
|---|---|
pending | {status_map.pending} (default: Backlog) |
in_progress | {status_map.in_progress} (default: In Progress) |
completed | {status_map.completed} (default: In Review) |
For each mismatch, update the issue tracker to match the coco tracker (tracker is source of truth).
4. Report
Coco Sync Report
================
Epic: {epic-name}
Tasks synced: {count}
Already in sync: {count}
Updated: {count}
Changes:
{issue-key}: {old-status} -> {new-status} (Tracker: {tracker-status})
Orphans (tracker task without issue):
{task-id}: {title}
Orphans (issue not in tracker):
{issue-key}: {title}
5. Post Summary (Optional)
If changes were made and provider supports comments, post a sync summary.