From 53bf86da10dce8394cf15bdd08eb1a3cf1755d5e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 May 2026 21:48:41 +0000 Subject: [PATCH 1/2] plan: document {{#if}} template syntax in instructions files Agent-Logs-Url: https://github.com/github/gh-aw/sessions/da436940-6361-4301-89d1-3307f813ee7b Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .github/workflows/daily-community-attribution.lock.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily-community-attribution.lock.yml b/.github/workflows/daily-community-attribution.lock.yml index da95ba051e..f3223824f7 100644 --- a/.github/workflows/daily-community-attribution.lock.yml +++ b/.github/workflows/daily-community-attribution.lock.yml @@ -187,7 +187,7 @@ jobs: id: pick-experiment uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9 env: - GH_AW_EXPERIMENT_SPEC: '{"prompt_style":["concise","verbose"]}' + GH_AW_EXPERIMENT_SPEC: '{"prompt_style":{"variants":["concise","verbose"]}}' GH_AW_EXPERIMENT_STATE_FILE: /tmp/gh-aw/experiments/state.json GH_AW_EXPERIMENT_STATE_DIR: /tmp/gh-aw/experiments with: From ae95d8c002ccec9835bef2102ae69ec45dc579bc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 May 2026 21:51:05 +0000 Subject: [PATCH 2/2] docs: document {{#if}}/{{#else}}/{{#endif}} template syntax in instructions files Agent-Logs-Url: https://github.com/github/gh-aw/sessions/da436940-6361-4301-89d1-3307f813ee7b Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .github/aw/experiments.md | 18 ++++---- .github/aw/github-agentic-workflows.md | 60 ++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 9 deletions(-) diff --git a/.github/aw/experiments.md b/.github/aw/experiments.md index d2e4684dec..c2a27d70e5 100644 --- a/.github/aw/experiments.md +++ b/.github/aw/experiments.md @@ -39,9 +39,9 @@ experiments: {{#if experiments.prompt_style == "concise" }} Summarise the findings in ≤ 5 bullets. -{{else}} +{{#else}} Provide a detailed analysis with reasoning for each finding. -{{/if}} +{{#endif}} ``` ### Naming Rules @@ -67,9 +67,9 @@ The selected variant is injected into the prompt in two ways: ```markdown {{#if experiments.tone == "formal" }} Use formal, professional language throughout the report. -{{else}} +{{#else}} Use a friendly, conversational tone. -{{/if}} +{{#endif}} ``` ### 2 — Direct interpolation @@ -149,9 +149,9 @@ experiments: ```markdown {{#if experiments.tool_scope == "narrow" }} Only use the `issues` and `pull_requests` toolsets. -{{else}} +{{#else}} Use any available GitHub MCP tools. -{{/if}} +{{#endif}} ``` **Typical metrics**: number of tool calls, run duration, output accuracy. @@ -166,7 +166,7 @@ experiments: ```markdown {{#if experiments.skill_hint == "enabled" }} Check `skills/` for SKILL.md files relevant to this task and apply their guidance. -{{/if}} +{{#endif}} ``` **Typical metrics**: output quality, context token consumption, run duration. @@ -208,10 +208,10 @@ Summarise the pull requests merged in ${{ github.repository }} today. {{#if experiments.output_style == "concise" }} Write a maximum of 5 bullet points. Each bullet is one sentence. -{{else}} +{{#else}} Write a structured report with sections for: new features, bug fixes, refactors, and documentation changes. Include a one-paragraph executive summary at the top. -{{/if}} +{{#endif}} Include links to each PR. Use ${{ github.server_url }}/${{ github.repository }}/pull/ format. ``` diff --git a/.github/aw/github-agentic-workflows.md b/.github/aw/github-agentic-workflows.md index 68e7262217..6d4a8390be 100644 --- a/.github/aw/github-agentic-workflows.md +++ b/.github/aw/github-agentic-workflows.md @@ -2136,6 +2136,66 @@ Deploy to environment: "${{ github.event.inputs.environment }}" # Complex: ${{ toJson(github.workflow) }} ``` +## Prompt Template Conditionals (`{{#if}}`) + +The workflow markdown body supports a lightweight template language for conditional blocks. Template tags are resolved **at runtime, before the agent receives the prompt** — the agent always sees the final resolved text. + +### Syntax + +``` +{{#if }} +...true branch content... +{{#else}} +...false branch content (optional)... +{{#endif}} +``` + +- **`{{#if }}`** — opens a conditional block; the content is included only when `` is truthy +- **`{{#else}}`** — optional separator; splits the block into a true branch and a false branch +- **`{{#endif}}`** — closes the block (**primary closing tag**; preferred) +- **`{{/if}}`** — alternate closing tag (both forms are permanently supported; `{{#endif}}` is preferred for consistency) + +Tags may appear on their own line (block form) or inline. Block form (tag on its own line) is recommended for readability. + +### Supported Conditions + +| Form | Example | Truthy when | +|---|---|---| +| Bare value | `{{#if experiments.flag }}` | value is non-empty and not `"false"` | +| Equality | `{{#if experiments.style == "concise" }}` | value equals the quoted string | +| Inequality | `{{#if experiments.style != "verbose" }}` | value does not equal the quoted string | +| Strict equality | `{{#if experiments.style === "concise" }}` | value strictly equals the quoted string | +| Strict inequality | `{{#if experiments.style !== "verbose" }}` | value strictly differs from the quoted string | + +### Example: Conditional Without Else + +```markdown +{{#if experiments.skill_hint == "enabled" }} +Check `skills/` for SKILL.md files relevant to this task and apply their guidance. +{{#endif}} +``` + +### Example: Conditional With Else + +```markdown +{{#if experiments.output_style == "concise" }} +Write a maximum of 5 bullet points. Each bullet is one sentence. +{{#else}} +Write a structured report with sections for new features, bug fixes, and refactors. +Include a one-paragraph executive summary at the top. +{{#endif}} +``` + +### Integration with Experiments + +When the `experiments:` frontmatter field is set, the selected variant value is substituted into `{{#if experiments. == "..." }}` conditions before template rendering. See [A/B Testing Experiments](../aw/experiments.md) for full experiment design guidance. + +### Notes + +- **Fenced code blocks are preserved** — `{{#if}}` tags inside `` ``` `` blocks are never processed; they appear verbatim in the output. +- **Nested conditionals are not supported** — do not place `{{#if}}` inside another `{{#if}}` block; the inner tags will be treated as literal text and appear verbatim in the agent prompt. +- **Template tags are not visible to the agent** — all `{{#if}}` / `{{#else}}` / `{{#endif}}` tags are stripped from the prompt before the agent runs. + ## Tool Configuration ### General Tools