Reconcile persisted plan file with in-session task list. Detects divergences, recreates missing tasks, and updates plan context. TRIGGER when: session resumed after compaction and task list is empty or out of sync with the plan file. DO NOT TRIGGER when: no plan file exists or task list is already in sync with the current session work.
REQUIRED: Create a task at invocation. Execute at startup:
TaskCreate(subject="Sync plan state", activeForm="Syncing plan")Read the plan file at <git-toplevel>/.claude/session/plan.yaml.
If no plan file exists, report "No persisted plan found" and exit.
Extract:
Call TaskList to get the current in-session task state.
For each task in the persisted plan:
Report format:
Plan: 15 tasks | Session: 12 tasks
Matched (same status): 10
Status mismatch: 2
- #5 "Set up workspace" — plan: completed, session: pending
- #7 "Implement changes" — plan: in_progress, session: completed
Missing from session: 3
- #13 "Groom commit history" (detailed) → git-groom
- #14 "Update PR description" (detailed) → gh-pr-create
- #15 "Mark PR ready" (detailed)
Extra in session: 0
For missing tasks, recreate them:
TaskCreate(subject=<from plan>, description=<from plan>,
metadata=<from plan including type, skills, steps>)
For status mismatches, trust the session state (it's more
recent) and update the plan file via:
mcp__plugin_Dev10x_cli__plan_sync_set_context(args=["last_reconciled=<timestamp>"])
If the caller passes context arguments, store them:
mcp__plugin_Dev10x_cli__plan_sync_set_context(args=["work_type=feature", "tickets=[\"GH-482\"]", "routing_table={...}"])
If all tasks in both plan and session are completed:
mcp__plugin_Dev10x_cli__plan_sync_archive()
Report: "Plan archived. All tasks completed."