Skip to content

Commit a6bda33

Browse files
Copilotpelikhan
andauthored
Fix create-agentic-workflow agent prompting patterns (#6999)
* Initial plan * Fix prompting issues in create-agentic-workflow custom agent - Update scheduling guidance to use fuzzy schedule syntax: schedule: daily/weekly - Remove recommendation for GitHub remote mode (already present) - Remove engine: copilot from templates (it's the default) - Add guidance to always include workflow_dispatch trigger - Add guidance for close-older-issues/discussions flag for daily reporting workflows - Add guidance for skip-if-match filter for daily improver workflows that create PRs - Update GitHub tool examples to show read-only operations with safe-outputs for writes Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Delete duplicate create-agentic-workflow.prompt.md file The .prompt.md file is a duplicate of .agent.md and is not used anywhere in the codebase. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent 68981cf commit a6bda33

3 files changed

Lines changed: 26 additions & 155 deletions

File tree

.github/agents/create-agentic-workflow.agent.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,11 @@ Analyze the user's response and map it to agentic workflows. Ask clarifying ques
8484
- 💡 If you detect the task requires **browser automation**, suggest the **`playwright`** tool.
8585

8686
**Scheduling Best Practices:**
87-
- 📅 When creating a **daily scheduled workflow**, use **fuzzy scheduling** by simply specifying `daily` without a time. This allows the compiler to automatically distribute workflow execution times across the day, reducing load spikes.
88-
-**Recommended**: `cron: daily` (fuzzy schedule - time will be scattered deterministically)
87+
- 📅 When creating a **daily or weekly scheduled workflow**, use **fuzzy scheduling** by simply specifying `daily` or `weekly` without a time. This allows the compiler to automatically distribute workflow execution times across the day, reducing load spikes.
88+
-**Recommended**: `schedule: daily` or `schedule: weekly` (fuzzy schedule - time will be scattered deterministically)
8989
- ⚠️ **Avoid fixed times**: Don't use explicit times like `cron: "0 0 * * *"` or `daily at midnight` as this concentrates all workflows at the same time, creating load spikes.
90-
- 🚫 **Avoid weekend scheduling**: For daily workflows that should only run on weekdays, use `cron: "0 <hour> * * 1-5"` pattern after discussing with the user if weekend execution is needed.
91-
- Example fuzzy daily schedule: `cron: daily` (compiler will scatter to something like `43 5 * * *`)
92-
- Example daily schedule avoiding weekends: `cron: "0 14 * * 1-5"` (2 PM UTC, weekdays only - use this only if user specifically wants to avoid weekends)
90+
- Example fuzzy daily schedule: `schedule: daily` (compiler will scatter to something like `43 5 * * *`)
91+
- Example fuzzy weekly schedule: `schedule: weekly` (compiler will scatter appropriately)
9392

9493
DO NOT ask all these questions at once; instead, engage in a back-and-forth conversation to gather the necessary details.
9594

@@ -222,10 +221,10 @@ DO NOT ask all these questions at once; instead, engage in a back-and-forth conv
222221
```
223222

224223
4. **Generate Workflows** (Both Modes)
225-
- Author workflows in the **agentic markdown format** (frontmatter: `on:`, `permissions:`, `engine:`, `tools:`, `mcp-servers:`, `safe-outputs:`, `network:`, etc.).
224+
- Author workflows in the **agentic markdown format** (frontmatter: `on:`, `permissions:`, `tools:`, `mcp-servers:`, `safe-outputs:`, `network:`, etc.).
226225
- Compile with `gh aw compile` to produce `.github/workflows/<name>.lock.yml`.
227226
- 💡 If the task benefits from **caching** (repeated model calls, large context reuse), suggest top-level **`cache-memory:`**.
228-
- ⚙️ Default to **`engine: copilot`** unless the user requests another engine.
227+
- ⚙️ **Copilot is the default engine** - do NOT include `engine: copilot` in the template unless the user specifically requests a different engine.
229228
- Apply security best practices:
230229
- Default to `permissions: read-all` and expand only if necessary.
231230
- Prefer `safe-outputs` (`create-issue`, `add-comment`, `create-pull-request`, `create-pull-request-review-comment`, `update-issue`) over granting write perms.
@@ -262,10 +261,10 @@ Based on the parsed requirements, determine:
262261

263262
1. **Workflow ID**: Convert the workflow name to kebab-case (e.g., "Issue Classifier" → "issue-classifier")
264263
2. **Triggers**: Infer appropriate triggers from the description:
265-
- Issue automation → `on: issues: types: [opened, edited]`
266-
- PR automation → `on: pull_request: types: [opened, synchronize]`
267-
- Scheduled tasks → `on: schedule: cron: daily` (use fuzzy scheduling)
268-
- Manual runs → `on: workflow_dispatch`
264+
- Issue automation → `on: issues: types: [opened, edited] workflow_dispatch:`
265+
- PR automation → `on: pull_request: types: [opened, synchronize] workflow_dispatch:`
266+
- Scheduled tasks → `on: schedule: daily workflow_dispatch:` (use fuzzy scheduling)
267+
- **ALWAYS include** `workflow_dispatch:` to allow manual runs
269268
3. **Tools**: Determine required tools:
270269
- GitHub API reads → `tools: github: toolsets: [default]`
271270
- Web access → `tools: web-fetch:` and `network: allowed: [<domains>]`
@@ -274,6 +273,8 @@ Based on the parsed requirements, determine:
274273
- Creating issues → `safe-outputs: create-issue:`
275274
- Commenting → `safe-outputs: add-comment:`
276275
- Creating PRs → `safe-outputs: create-pull-request:`
276+
- **Daily reporting workflows** (creates issues/discussions): Add `close-older-issues: true` or `close-older-discussions: true` to prevent clutter
277+
- **Daily improver workflows** (creates PRs): Add `skip-if-match:` with a filter to avoid opening duplicate PRs (e.g., `'is:pr is:open in:title "[workflow-name]"'`)
277278
5. **Permissions**: Start with `permissions: read-all` and only add specific write permissions if absolutely necessary
278279
6. **Prompt Body**: Write clear, actionable instructions for the AI agent
279280

@@ -293,10 +294,10 @@ description: <Brief description of what this workflow does>
293294
on:
294295
issues:
295296
types: [opened, edited]
297+
workflow_dispatch:
296298
permissions:
297299
contents: read
298300
issues: read
299-
engine: copilot
300301
tools:
301302
github:
302303
toolsets: [default]

pkg/cli/templates/create-agentic-workflow.agent.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,11 @@ Analyze the user's response and map it to agentic workflows. Ask clarifying ques
8484
- 💡 If you detect the task requires **browser automation**, suggest the **`playwright`** tool.
8585

8686
**Scheduling Best Practices:**
87-
- 📅 When creating a **daily scheduled workflow**, use **fuzzy scheduling** by simply specifying `daily` without a time. This allows the compiler to automatically distribute workflow execution times across the day, reducing load spikes.
88-
-**Recommended**: `cron: daily` (fuzzy schedule - time will be scattered deterministically)
87+
- 📅 When creating a **daily or weekly scheduled workflow**, use **fuzzy scheduling** by simply specifying `daily` or `weekly` without a time. This allows the compiler to automatically distribute workflow execution times across the day, reducing load spikes.
88+
-**Recommended**: `schedule: daily` or `schedule: weekly` (fuzzy schedule - time will be scattered deterministically)
8989
- ⚠️ **Avoid fixed times**: Don't use explicit times like `cron: "0 0 * * *"` or `daily at midnight` as this concentrates all workflows at the same time, creating load spikes.
90-
- 🚫 **Avoid weekend scheduling**: For daily workflows that should only run on weekdays, use `cron: "0 <hour> * * 1-5"` pattern after discussing with the user if weekend execution is needed.
91-
- Example fuzzy daily schedule: `cron: daily` (compiler will scatter to something like `43 5 * * *`)
92-
- Example daily schedule avoiding weekends: `cron: "0 14 * * 1-5"` (2 PM UTC, weekdays only - use this only if user specifically wants to avoid weekends)
90+
- Example fuzzy daily schedule: `schedule: daily` (compiler will scatter to something like `43 5 * * *`)
91+
- Example fuzzy weekly schedule: `schedule: weekly` (compiler will scatter appropriately)
9392

9493
DO NOT ask all these questions at once; instead, engage in a back-and-forth conversation to gather the necessary details.
9594

@@ -222,10 +221,10 @@ DO NOT ask all these questions at once; instead, engage in a back-and-forth conv
222221
```
223222

224223
4. **Generate Workflows** (Both Modes)
225-
- Author workflows in the **agentic markdown format** (frontmatter: `on:`, `permissions:`, `engine:`, `tools:`, `mcp-servers:`, `safe-outputs:`, `network:`, etc.).
224+
- Author workflows in the **agentic markdown format** (frontmatter: `on:`, `permissions:`, `tools:`, `mcp-servers:`, `safe-outputs:`, `network:`, etc.).
226225
- Compile with `gh aw compile` to produce `.github/workflows/<name>.lock.yml`.
227226
- 💡 If the task benefits from **caching** (repeated model calls, large context reuse), suggest top-level **`cache-memory:`**.
228-
- ⚙️ Default to **`engine: copilot`** unless the user requests another engine.
227+
- ⚙️ **Copilot is the default engine** - do NOT include `engine: copilot` in the template unless the user specifically requests a different engine.
229228
- Apply security best practices:
230229
- Default to `permissions: read-all` and expand only if necessary.
231230
- Prefer `safe-outputs` (`create-issue`, `add-comment`, `create-pull-request`, `create-pull-request-review-comment`, `update-issue`) over granting write perms.
@@ -262,10 +261,10 @@ Based on the parsed requirements, determine:
262261

263262
1. **Workflow ID**: Convert the workflow name to kebab-case (e.g., "Issue Classifier" → "issue-classifier")
264263
2. **Triggers**: Infer appropriate triggers from the description:
265-
- Issue automation → `on: issues: types: [opened, edited]`
266-
- PR automation → `on: pull_request: types: [opened, synchronize]`
267-
- Scheduled tasks → `on: schedule: cron: daily` (use fuzzy scheduling)
268-
- Manual runs → `on: workflow_dispatch`
264+
- Issue automation → `on: issues: types: [opened, edited] workflow_dispatch:`
265+
- PR automation → `on: pull_request: types: [opened, synchronize] workflow_dispatch:`
266+
- Scheduled tasks → `on: schedule: daily workflow_dispatch:` (use fuzzy scheduling)
267+
- **ALWAYS include** `workflow_dispatch:` to allow manual runs
269268
3. **Tools**: Determine required tools:
270269
- GitHub API reads → `tools: github: toolsets: [default]`
271270
- Web access → `tools: web-fetch:` and `network: allowed: [<domains>]`
@@ -274,6 +273,8 @@ Based on the parsed requirements, determine:
274273
- Creating issues → `safe-outputs: create-issue:`
275274
- Commenting → `safe-outputs: add-comment:`
276275
- Creating PRs → `safe-outputs: create-pull-request:`
276+
- **Daily reporting workflows** (creates issues/discussions): Add `close-older-issues: true` or `close-older-discussions: true` to prevent clutter
277+
- **Daily improver workflows** (creates PRs): Add `skip-if-match:` with a filter to avoid opening duplicate PRs (e.g., `'is:pr is:open in:title "[workflow-name]"'`)
277278
5. **Permissions**: Start with `permissions: read-all` and only add specific write permissions if absolutely necessary
278279
6. **Prompt Body**: Write clear, actionable instructions for the AI agent
279280

@@ -293,10 +294,10 @@ description: <Brief description of what this workflow does>
293294
on:
294295
issues:
295296
types: [opened, edited]
297+
workflow_dispatch:
296298
permissions:
297299
contents: read
298300
issues: read
299-
engine: copilot
300301
tools:
301302
github:
302303
toolsets: [default]

pkg/cli/templates/create-agentic-workflow.prompt.md

Lines changed: 0 additions & 131 deletions
This file was deleted.

0 commit comments

Comments
 (0)