|
| 1 | +--- |
| 2 | +name: cockpit-scheduler-agent |
| 3 | +description: "Use when an agent needs to manage scheduler tasks, Jobs workflows, job folders, pause checkpoints, compile-to-task, or research profiles through the scheduler MCP tools." |
| 4 | +copilotCockpitSkillType: operational |
| 5 | +copilotCockpitToolNamespaces: [scheduler, research] |
| 6 | +copilotCockpitWorkflowIntents: [needs-bot-review, ready] |
| 7 | +copilotCockpitApprovalSensitive: true |
| 8 | +copilotCockpitPromptSummary: "Use scheduler_ and research_ MCP tools for task, job, pause, and research mutations instead of editing repo-local scheduler files by hand." |
| 9 | +copilotCockpitReadyWorkflowFlags: [ready, ON-SCHEDULE-LIST] |
| 10 | +copilotCockpitCloseoutWorkflowFlags: [needs-user-review, FINAL-USER-CHECK] |
| 11 | +--- |
| 12 | + |
| 13 | +# Cockpit Scheduler Agent Skill |
| 14 | + |
| 15 | +Use this skill when you want an agent to work with the scheduler MCP surface in a concept-first way instead of guessing tool names. |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +> **CRITICAL DISTINCTION — Tasks vs. Todo Cockpit cards** |
| 20 | +> |
| 21 | +> | Concept | What it is | Where it lives | Tool prefix | |
| 22 | +> |---|---|---|---| |
| 23 | +> | **Task** | A scheduled prompt execution entry | Workspace scheduler store, mirrored to `.vscode/scheduler.json` | `scheduler_` | |
| 24 | +> | **Todo Cockpit card** | A planning / communication card on the board | Workspace Cockpit store, mirrored to `.vscode/scheduler.private.json` | `cockpit_` | |
| 25 | +> |
| 26 | +> **These are completely separate artifacts with entirely separate tool sets.** |
| 27 | +> A task runs code on a schedule. A Cockpit card tracks intent, review state, and conversation. |
| 28 | +> Creating a task does NOT create a card. Creating a card does NOT schedule execution. |
| 29 | +> Never conflate the two. Never use `scheduler_` tools to manage board cards, and never use `cockpit_` tools to manage scheduled execution. |
| 30 | +
|
| 31 | +--- |
| 32 | + |
| 33 | +## Mental Model |
| 34 | + |
| 35 | +- **Task** = one scheduled prompt execution entry in the workspace scheduler store |
| 36 | +- **Job** = a workflow made of task nodes and pause checkpoints in the workspace scheduler store |
| 37 | +- **Job folder** = organization only, no execution logic |
| 38 | +- **Research profile** = a repo-local benchmark plan in the workspace research store |
| 39 | +- **Research run** = a recorded benchmark execution result and history entry |
| 40 | +- JSON mode uses `.vscode/scheduler.json`, `.vscode/scheduler.private.json`, and `.vscode/research.json` as the primary files. |
| 41 | +- When the workspace setting `copilotCockpit.storageMode` is `sqlite`, the extension uses `.vscode/copilot-cockpit.db` as the primary runtime store, keeps compatibility JSON mirrors, and writes `.vscode/copilot-cockpit.db-migration.json`. MCP tool semantics stay the same. |
| 42 | + |
| 43 | +## Required Preflight |
| 44 | + |
| 45 | +Before mutating scheduler state, verify all of the following: |
| 46 | + |
| 47 | +- The active workspace is the repo that actually owns the task or job being discussed. |
| 48 | +- Any repo paths or production-chain references mentioned in the request exist in the current workspace. |
| 49 | +- The required MCP tool exists in the current session before you plan around it. |
| 50 | + |
| 51 | +If any of those checks fail, stop and report the blocker instead of mutating the repo-local scheduler/Cockpit mirrors or recreating records by hand. |
| 52 | + |
| 53 | +## Mandatory MCP Capability Gate |
| 54 | + |
| 55 | +This skill is MCP-dependent. Do not try to "work around" missing scheduler or research MCP tools. |
| 56 | + |
| 57 | +- If the current agent cannot access the required `scheduler_` or `research_` MCP tool, do not solve the task by editing `.vscode` JSON files directly, inventing results, or pretending the mutation succeeded. |
| 58 | +- First prefer a handoff or subagent path only when that target agent actually has the required MCP tools and is allowed to perform the mutation. |
| 59 | +- Do not hand off a scheduler mutation to a read-only exploration agent or any agent that still lacks the required MCP surface. |
| 60 | +- If no MCP-capable handoff target is available, tell the user plainly that the active agent lacks the required MCP tools and that they must switch to an MCP-enabled agent or grant the needed tool permissions. |
| 61 | +- Only continue without MCP when the user explicitly wants analysis, documentation, or a plan instead of a live scheduler mutation. |
| 62 | + |
| 63 | +## Task Modes |
| 64 | + |
| 65 | +Use this distinction when deciding whether a user wants a one-time task or a recurring task. |
| 66 | + |
| 67 | +### One-time task |
| 68 | + |
| 69 | +- Runs once and then deletes itself automatically after a successful execution. |
| 70 | +- Best for ad hoc actions, one-off cleanup, migration work, or a single AI-assisted response. |
| 71 | +- Does not keep a recurring chat-session mode at the task level. |
| 72 | +- Should be used when the user wants a single future execution rather than an ongoing schedule. |
| 73 | +- **Todo Cockpit relationship:** A one-time task is almost always spawned from an approved todo card. That card is the planning record — do NOT create a new Cockpit card for the task itself. Use `scheduler_update_task` when the task needs changes. Use `cockpit_finalize_todo` on the originating card when the task completes. |
| 74 | + |
| 75 | +### Recurring task |
| 76 | + |
| 77 | +- Runs repeatedly on the cron schedule until the user disables or deletes it. |
| 78 | +- Best for daily dispatchers, weekly checks, maintenance loops, and other repeatable automation. |
| 79 | +- Can use the task-level chat session choice (`new` or `continue`). |
| 80 | +- Manual runs should honor that same chat-session choice. `new` means start a fresh Copilot chat before execution. `continue` means reuse the current chat session instead of silently opening a new one. |
| 81 | +- Can be reviewed on startup as an overdue task and either run now or wait for the next cycle. |
| 82 | +- **Todo Cockpit relationship:** Every recurring task has one permanent card in the `Recurring Tasks` section of Cockpit. That card is never finalized. It is a living change log. When the task changes — prompt, schedule, model, or behavior — update the task with `scheduler_update_task` AND add a comment to its Cockpit card documenting what changed and why. Do NOT create a new card for each change. |
| 83 | + |
| 84 | +### Practical rule |
| 85 | + |
| 86 | +- If the user says "do this once", "one-off", "single run", or "run it one time", use a one-time task. |
| 87 | +- If the user says "every day", "daily", "weekly", "keep running", or "recurring", use a recurring task. |
| 88 | +- If the user wants a workflow with multiple steps, pauses, or a bundled output, use a job instead of a task. |
| 89 | + |
| 90 | +## Tool Map |
| 91 | + |
| 92 | +### Tasks |
| 93 | +Use these when the goal is to create or manage one scheduled prompt. |
| 94 | + |
| 95 | +Use task tools for both task modes, but pick the right behavior: |
| 96 | + |
| 97 | +- one-time task -> create a task that should run once, delete itself automatically after success, and leave the originating todo card as the planning record |
| 98 | +- recurring task -> create a task that should remain scheduled over time |
| 99 | + |
| 100 | +- `scheduler_list_tasks` - inspect saved tasks |
| 101 | +- `scheduler_get_task` - inspect one task |
| 102 | +- `scheduler_add_task` - create a new task |
| 103 | +- `scheduler_update_task` - edit a task in place |
| 104 | +- `scheduler_duplicate_task` - make a disabled copy |
| 105 | +- `scheduler_remove_task` - delete a task |
| 106 | +- `scheduler_run_task` - trigger a task on the next tick |
| 107 | +- `scheduler_toggle_task` - enable or disable a task |
| 108 | +- `scheduler_list_history` - inspect scheduler snapshots |
| 109 | +- `scheduler_restore_snapshot` - restore a saved scheduler snapshot |
| 110 | +- `scheduler_get_overdue_tasks` - find due or missed tasks |
| 111 | + |
| 112 | +### Jobs |
| 113 | +Use these when the goal is a workflow made of multiple steps, pause checkpoints, or bundled execution. |
| 114 | + |
| 115 | +- `scheduler_list_jobs` - inspect all jobs and folders |
| 116 | +- `scheduler_get_job` - inspect one job with node summaries |
| 117 | +- `scheduler_create_job` - create a new workflow shell |
| 118 | +- `scheduler_update_job` - rename or reconfigure a job |
| 119 | +- `scheduler_delete_job` - delete a job and detach its tasks |
| 120 | +- `scheduler_duplicate_job` - clone a job workflow |
| 121 | +- `scheduler_list_job_folders` - inspect job folders |
| 122 | +- `scheduler_create_job_folder` - create a job folder |
| 123 | +- `scheduler_update_job_folder` - rename or reparent a folder |
| 124 | +- `scheduler_delete_job_folder` - delete an empty folder |
| 125 | +- `scheduler_add_job_task` - attach an existing task to a job |
| 126 | +- `scheduler_remove_job_task` - remove a task node from a job |
| 127 | +- `scheduler_create_job_pause` - insert a manual checkpoint |
| 128 | +- `scheduler_update_job_pause` - rename a pause checkpoint |
| 129 | +- `scheduler_delete_job_pause` - remove a pause checkpoint |
| 130 | +- `scheduler_update_job_node_window` - change a node window length |
| 131 | +- `scheduler_reorder_job_node` - move a node in the workflow order |
| 132 | +- `scheduler_compile_job_to_task` - bundle the whole job into one task and park the source job in Bundled Jobs |
| 133 | + |
| 134 | +### Todo Cockpit (agent-state catalog management) |
| 135 | +Use these when the goal is to manage the flag or label palette used by Todo Cockpit cards. |
| 136 | + |
| 137 | +- `cockpit_save_flag_definition` - upsert a flag entry in the flag palette (name + optional hex color); flags are squared chips and the active workflow is normalized to one canonical workflow flag such as `new`, `needs-bot-review`, `needs-user-review`, `ready`, `ON-SCHEDULE-LIST`, or `FINAL-USER-CHECK` |
| 138 | +- `cockpit_delete_flag_definition` - remove a flag from the flag palette by name |
| 139 | +- `cockpit_save_label_definition` - upsert a label entry in the label palette (name + optional hex color); labels are **multi-value** pill chips used for user-facing categorization, not agent action routing |
| 140 | +- `cockpit_delete_label_definition` - remove a label from the label palette by name |
| 141 | + |
| 142 | +Closeout shorthand: |
| 143 | + |
| 144 | +- `scheduled-task` belongs in `labels`, not `flags` |
| 145 | +- do not suggest more than one active workflow flag in a closeout update |
| 146 | +- if the user still needs review, prefer one review-state flag such as `needs-user-review` |
| 147 | +- treat `ON-SCHEDULE-LIST` as the canonical scheduled workflow flag, not as a second review flag to stack onto a handoff |
| 148 | + |
| 149 | +### Research |
| 150 | +Use these when the goal is to configure or inspect a bounded benchmark profile. |
| 151 | + |
| 152 | +- `research_list_profiles` - inspect all research profiles |
| 153 | +- `research_get_profile` - inspect one research profile |
| 154 | +- `research_create_profile` - create a research profile |
| 155 | +- `research_update_profile` - update a research profile |
| 156 | +- `research_delete_profile` - delete a research profile |
| 157 | +- `research_duplicate_profile` - clone a research profile |
| 158 | +- `research_list_runs` - inspect recent runs |
| 159 | +- `research_get_run` - inspect one recorded run |
| 160 | + |
| 161 | +## Conceptual Guidance |
| 162 | + |
| 163 | +### When to use tasks vs jobs |
| 164 | +- Use a **task** when the user wants one scheduled prompt with agent, model, labels, prompt source, and cron. |
| 165 | +- Use a **one-time task** for a single execution that should delete itself automatically after success. |
| 166 | +- Use a **recurring task** when the user wants the same prompt to keep running on a schedule. |
| 167 | +- Use a **job** when the user wants a workflow with multiple steps, optional pause checkpoints, or a bundled execution flow. |
| 168 | +- Use **compile job to task** when the user wants the whole workflow collapsed into one standalone prompt task. |
| 169 | + |
| 170 | +### Cockpit card relationship per task mode |
| 171 | + |
| 172 | +| Task mode | Cockpit card? | What to do when task changes | |
| 173 | +|---|---|---| |
| 174 | +| **One-time** | Reuse the originating todo card (no new card) | `scheduler_update_task` only; no new card or comment needed unless scope changes | |
| 175 | +| **Recurring** | One permanent card in `Recurring Tasks` section (never archived) | `scheduler_update_task` + `cockpit_add_todo_comment` on its card to record the change | |
| 176 | + |
| 177 | +- The `Recurring Tasks` section in Cockpit is collapsible like Archive, but holds **alive, long-running items** — not completed ones. |
| 178 | +- Never create a new Cockpit card every time a recurring task is modified. One card per task, with comments as the history. |
| 179 | +- When a one-time task finishes and the user still needs to review the outcome, prefer `cockpit_closeout_todo` on the originating card over manual multi-step card repair. |
| 180 | +- When describing that closeout, phrase it as one flag plus optional labels, not as multiple flags. Example: `Set flag to needs-user-review` and `Add label scheduled-task`. |
| 181 | + |
| 182 | +### When to use job folders |
| 183 | +- Use folders only for organization. |
| 184 | +- Do not treat folders as execution units. |
| 185 | +- Use folders to group related jobs like campaigns, recurring maintenance, experiments, or backlog bundles. |
| 186 | + |
| 187 | +### When to use research profiles |
| 188 | +- Use research profiles when the user wants repeatable benchmark-driven iteration. |
| 189 | +- A research profile is not the same as a scheduled task. |
| 190 | +- Research focuses on instructions, editable paths, benchmark command, metric regex, and agent/model choices. |
| 191 | +- Start and stop research runs in the app UI when run execution is needed; use MCP for profile setup and run inspection. |
| 192 | + |
| 193 | +## How This Plugin Is Commonly Used |
| 194 | + |
| 195 | +Look at the repo-local scheduler store and its compatibility mirrors as the live example set for this repository. Typical patterns include: |
| 196 | + |
| 197 | +- recurring automation tasks that dispatch work to Todo Cockpit or other services |
| 198 | +- daily research/market scans that collect ideas and create follow-up tasks |
| 199 | +- maintenance jobs that run on a schedule and bundle multiple steps |
| 200 | +- repo-specific workflow jobs that combine task steps, pause checkpoints, and a bundled output task |
| 201 | +- research profiles that benchmark a change against a local command and a metric regex |
| 202 | + |
| 203 | +## Example Set Completeness |
| 204 | + |
| 205 | +When the user asks for demo data, example data, screenshot data, or onboarding seed content, do not stop after creating recurring tasks plus one job. |
| 206 | + |
| 207 | +- `Todo Cockpit` needs at least one active planning card that is not merely a recurring-task mirror. |
| 208 | +- `Tasks` need at least one standalone scheduled task visible in the task list. |
| 209 | +- `Jobs` need at least one real workflow with task nodes and a pause checkpoint. |
| 210 | +- `Research` needs one profile when the user asks for research coverage too. |
| 211 | + |
| 212 | +Do not count job child tasks or recurring-task cards as covering every surface by themselves. If the request is for a complete example set, create separate artifacts through MCP for each requested surface. |
| 213 | + |
| 214 | +## Practical Examples |
| 215 | + |
| 216 | +### 1. Create a recurring task |
| 217 | +Use `scheduler_add_task` when the user wants a simple scheduled prompt. |
| 218 | + |
| 219 | +Example: |
| 220 | +- "Create a daily market research task that uses GPT-5.3-Codex and runs at 9:17." |
| 221 | + |
| 222 | +### 1a. Create a one-time task |
| 223 | +Use `scheduler_add_task` with `oneTime: true` when the user wants a single future execution. |
| 224 | + |
| 225 | +Example: |
| 226 | +- "Create a one-time task to send the migration summary tomorrow morning and then auto-delete itself after the successful run." |
| 227 | + |
| 228 | +### 2. Update an existing task |
| 229 | +Use `scheduler_update_task` when the cron, prompt, model, or labels should change but the task should stay the same record. |
| 230 | + |
| 231 | +Example: |
| 232 | +- "Adjust the dispatcher cron and keep the same task ID." |
| 233 | + |
| 234 | +If the task is recurring, you can also update its chat-session behavior: |
| 235 | +- `new` for a fresh chat session before sending the prompt |
| 236 | +- `continue` for the current chat flow when the environment supports it |
| 237 | + |
| 238 | +When the task is run manually or by schedule, the agent should treat that field as execution behavior, not just metadata. Do not describe a `continue` task run as creating a new chat session. |
| 239 | + |
| 240 | +### 3. Build a job workflow from existing tasks |
| 241 | +Use `scheduler_create_job`, then `scheduler_add_job_task`, then `scheduler_create_job_pause`. |
| 242 | + |
| 243 | +Example: |
| 244 | +- "Create a job for the weekly content loop with a draft task, a manual review pause, and a publish task." |
| 245 | + |
| 246 | +### 4. Bundle a job into one task |
| 247 | +Use `scheduler_compile_job_to_task` when the workflow should become one standalone prompt task. |
| 248 | + |
| 249 | +Example: |
| 250 | +- "Compile this job into one Bundled Task and park the source job in Bundled Jobs." |
| 251 | + |
| 252 | +### 5. Organize jobs into folders |
| 253 | +Use `scheduler_create_job_folder` and `scheduler_update_job_folder` when the user wants a clearer workflow layout. |
| 254 | + |
| 255 | +Example: |
| 256 | +- "Put all launch workflows into a Marketing folder and keep experiments separate." |
| 257 | + |
| 258 | +### 6. Create a research profile |
| 259 | +Use `research_create_profile` when the user wants repeatable benchmark iterations. |
| 260 | + |
| 261 | +Example: |
| 262 | +- "Create a research profile that edits docs, runs npm test, and scores the result with a regex." |
| 263 | + |
| 264 | +### 7. Inspect research history |
| 265 | +Use `research_list_runs` and `research_get_run` when the user wants to review previous benchmark executions before changing the profile. |
| 266 | + |
| 267 | +Example: |
| 268 | +- "Show me the last few runs for this benchmark profile and the winning score trend." |
| 269 | + |
| 270 | +## Decision Rules |
| 271 | + |
| 272 | +- Prefer the most specific tool that matches the concept. |
| 273 | +- Run the workspace and capability preflight before changing scheduler state for remediation or dispatcher work. |
| 274 | +- Do not use a task tool when the user is clearly asking for a job workflow. |
| 275 | +- Do not use job tools when the user only needs one scheduled prompt. |
| 276 | +- Do not treat one-time and recurring tasks as separate tool categories; they are the same task concept with different lifecycle behavior. |
| 277 | +- Use one-time tasks for disposable, single-run work. |
| 278 | +- Use recurring tasks for persistent automation. |
| 279 | +- Do not use research tools when the user only wants scheduler task edits. |
| 280 | +- If a recurring task is configured with `chatSession: continue`, manual `runNow` behavior should stay in the current chat instead of opening a fresh session first. |
| 281 | +- If the user asks for a workflow that mixes all three, split it: |
| 282 | +- task setup first |
| 283 | +- job composition second |
| 284 | +- research setup third |
| 285 | +- Do not patch repo-local scheduler JSON directly after an MCP failure or partial mutation unless the user explicitly approves a last-resort recovery path. |
| 286 | + |
| 287 | +## Output Expectations For The Agent |
| 288 | + |
| 289 | +When using this skill, the agent should explain: |
| 290 | +- which concept it is editing |
| 291 | +- which MCP tool category it chose |
| 292 | +- what changed in repo-local state |
| 293 | +- whether a follow-up UI action is needed for research run execution |
| 294 | + |
| 295 | +## Safety Notes |
| 296 | + |
| 297 | +- Keep edits scoped to the repo-local scheduler and research files. |
| 298 | +- Treat direct edits to `.vscode/scheduler.json`, `.vscode/scheduler.private.json`, or `.vscode/research.json` as a last-resort recovery path, not a normal execution path. |
| 299 | +- Preserve existing task IDs and job IDs unless the user asks for a rename or duplication. |
| 300 | +- For job compilation, keep backward compatibility with older scheduler data. |
| 301 | +- If a folder or profile is not safe to delete because it still has children or dependent items, stop and report that instead of forcing removal. |
0 commit comments