Skip to content

Bug: {{#import}} directives in markdown body are never resolved #28019

@tore-unumed

Description

@tore-unumed

Summary

{{#import shared/file.md}} directives placed in the markdown body of a workflow are recognized by the compiler (listed as "Includes" in the lock file manifest) but their content is never injected into the agent prompt — neither at compile time nor at runtime.

Expected behavior

Per the Imports reference:

Use imports: in frontmatter or {{#import ...}} in markdown to share workflow components across multiple workflows.

{{#import shared/file.md}} should inline the content of shared/file.md at that position in the prompt, similar to how imports: YAML entries produce {{#runtime-import}} directives that are resolved at runtime.

Actual behavior

  1. Compile time: The compiler scans the body, finds {{#import shared/file.md}}, and records it in the lock file manifest as an "Include" — but does NOT convert it to {{#runtime-import}} and does NOT inline the content.

  2. Runtime: interpolate_prompt.cjs (STEP 1: Runtime Imports) only resolves {{#runtime-import ...}} directives. {{#import ...}} directives pass through as raw literal text.

  3. Result: The agent sees the raw string {{#import shared/file.md}} in its prompt. The referenced content is completely absent.

Reproduction

# my-workflow.md
---
imports:
  - shared/working-import.md    # ← this works
---

# Instructions

{{#import shared/broken-import.md}}  # ← this does NOT work

After gh aw compile, inspect the lock file:

# Resolved workflow manifest:
#   Imports:
#     - shared/working-import.md        ← converted to {{#runtime-import}}
#   Includes:
#     - shared/broken-import.md         ← listed but NOT resolved

At runtime, the prompt contains the literal text {{#import shared/broken-import.md}} — the content of broken-import.md is never injected.

Environment

  • gh-aw version: v0.68.3
  • Compiler: gh aw compile completes with 0 errors, 0 warnings
  • Affected: any workflow using {{#import}} in the markdown body

Workaround

Move {{#import}} references to the imports: YAML key in frontmatter. This produces {{#runtime-import}} directives that the runtime correctly resolves.

Impact

In our repo, 12 workflows with 28 total {{#import}} directives are affected — shared instructions for sub-agent delegation, wiki context, breadcrumb footers, context diaries, and branch resolution are never seen by agents.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions