| title | Scheduling prompts in {% data variables.copilot.copilot_cli %} | ||
|---|---|---|---|
| shortTitle | Schedule prompts | ||
| allowTitleToDifferFromFilename | true | ||
| intro | Use the `/every` and `/after` slash commands to submit a prompt to {% data variables.product.prodname_copilot_short %} on a recurring schedule, or after a specified delay. | ||
| versions |
|
||
| contentType | how-tos | ||
| docsTeamMetrics |
|
||
| category |
|
Note
The /every and /after commands are currently experimental features and are only available if you have used the /experimental on slash command, or the ‑‑experimental command line option.
In an interactive {% data variables.copilot.copilot_cli_short %} session you can schedule a prompt to be submitted automatically. This is useful when you want {% data variables.product.prodname_copilot_short %} to repeat a task at a regular cadence or to perform a one-off task after a delay, without you having to remember to submit the prompt manually.
There are two slash commands for this:
/every— schedule a prompt to be sent repeatedly at a fixed interval./after— schedule a prompt to be sent once, after a specified period of time.
Both commands are only available inside an interactive {% data variables.copilot.copilot_cli_short %} session: the schedules fire only while the session in which they were created is running. For ways to run {% data variables.copilot.copilot_cli_short %} on a schedule when no session is open, see Running a prompt from an external scheduler at the end of this article.
In an interactive {% data variables.copilot.copilot_cli_short %} session, type /every followed by an interval of time and the prompt you want to be submitted.
/every INTERVAL PROMPT
The prompt will be submitted after the interval you specified has elapsed and then again on the same cadence until you delete the schedule entry or you end the interactive CLI session.
/every 1h run the test suite and summarize any new failures
/every 30m check for new comments on my open pull requests
Note
/loop is an alias of /every. So you can enter /loop instead of /every, if you prefer, and the effect is the same.
Type /after followed by a delay and the prompt you want to submit:
/after DELAY PROMPT
The prompt fires once, after the delay has elapsed, and is then removed from the schedule list.
/after 30m Give me details of changes to README.md made in the last 30 minutes
/after 10m Check that the address finder is visible on example.com/register
You can use /every and /after to schedule a skill. To do this, you can reference the skill explicitly by using its slash command, or you can use natural language to tell {% data variables.product.prodname_copilot_short %} to run the skill.
Note
Only user-invocable skills and a subset of built-in slash commands can be scheduled. Commands that start a self-contained piece of work—such as /plan, /review, /research, or /security-review—are schedulable. Commands that change your session or configuration (for example, /model, /clear, /compact, /permissions, or /sandbox), that only display information (such as /usage or /context), or that manage scheduling itself (/every and /after) can't be scheduled, and {% data variables.product.prodname_copilot_short %} rejects them when you try.
/after 2h Use the docx skill to create a new file summarizing recent changes to this repo
/every 1d /refactor-plan Adjust the architecture of this project to improve the responsiveness of the client UI
| Suffix | Unit | Example |
|---|---|---|
s |
seconds | 30s |
m |
minutes | 5m |
h |
hours | 2h |
d |
days | 1d |
When you specify a numeric duration, always include the suffix. A bare number—for example, /every 30 remind me to check for Slack messages—is not recognized as an interval.
For a fixed interval, the minimum is 10 seconds and the maximum is 1 day (24 hours).
You can also describe the timing in plain language instead of using a duration—for example, /after at 3pm push the release, or /every day at 9am post the standup. {% data variables.product.prodname_copilot_short %} uses a model to interpret the phrase, then creates the schedule from it.
When a scheduled prompt is triggered, {% data variables.product.prodname_copilot_short %} precedes the prompt with text such as [Scheduled prompt #4] to distinguish it from a prompt you typed yourself.
You can use the ID to cancel the schedule. For example, by entering stop prompt 4.
To list the active schedules for the current session, type /every or /after with no arguments.
To delete a schedule, use the arrow keys on your keyboard to move through the list and select the schedule you want to delete, then press x.
Press Esc to exit the schedule list.
Scheduled prompts are scoped to the session they were created in, and they are only triggered while that session is running.
When you reopen the session (using the --continue or --resume command line options) the schedules are restored. For a recurring schedule created with a fixed interval, the wait before the next run is measured from the moment you reopen the session.
An /after schedule that had not been triggered before you closed the session keeps its original target time, rather than restarting the delay. If that time passed while the session was closed, the prompt is submitted as soon as you reopen the session.
The /every and /after commands only run while an interactive {% data variables.copilot.copilot_cli_short %} session is open. If you want a prompt to run on a schedule even when no session is active, you can run {% data variables.copilot.copilot_cli_short %} from an external scheduler such as cron on macOS or Linux, or Task Scheduler on Windows.
To run {% data variables.copilot.copilot_cli_short %} programmatically, use the syntax copilot -p "YOUR PROMPT". The CLI processes your prompt without displaying the interactive interface and then exits.
This is useful for tasks such as:
- Nightly maintenance — for example, running your test suite against the latest changes on a branch every night and posting a summary to a tracking issue.
- Periodic dependency checks — for example, opening a weekly pull request that updates dependencies and runs the test suite against the result.
- Scheduled reports — for example, generating a daily summary of new issues or pull requests assigned to you and emailing or posting it to a chat channel.
For more information, see AUTOTITLE.