Skip to content

fix(prompts): SYSTEM.md content silently dropped in default sessions#1264

Open
mrosnerr wants to merge 1 commit into
can1357:mainfrom
mrosnerr:fix/render-system-prompt-customization
Open

fix(prompts): SYSTEM.md content silently dropped in default sessions#1264
mrosnerr wants to merge 1 commit into
can1357:mainfrom
mrosnerr:fix/render-system-prompt-customization

Conversation

@mrosnerr
Copy link
Copy Markdown

@mrosnerr mrosnerr commented May 21, 2026

What

Add the {{#if systemPromptCustomization}} Handlebars block to the default system-prompt.md template so that SYSTEM.md content discovered by the capability system is actually rendered into the prompt.

Why

SYSTEM.md files discovered by capability providers (.agents/SYSTEM.md, .claude/SYSTEM.md, .gemini/system.md, etc.) are loaded by loadSystemPromptFiles(), deduped, and passed as data.systemPromptCustomization to the Handlebars template — but the default system-prompt.md template never references the variable. The content is prepared correctly and then silently discarded.

The previous version of the template (before the rewrite in 7b17024, Feb 24) did render it:

{{#if systemPromptCustomization}}
<context>
{{systemPromptCustomization}}
</context>
{{/if}}

The rewrite dropped this block. Only custom-system-prompt.md still renders it, but that template is only active when customPrompt is explicitly provided — which the default SDK path never does.

The block is placed after the internal URLs section and before Skills, matching the position of the old template's <context> block.

Testing

  • bun run check:ts — all workspaces pass (exit 0, no errors).
  • Verified the Handlebars block matches the existing pattern in custom-system-prompt.md.
  • Change is 4 lines in a .md template file with no logic.

  • bun check passes
  • Tested locally
  • CHANGELOG updated (if user-facing)

SYSTEM.md content was loaded by loadSystemPromptFiles() and passed to the
template data, but the default system-prompt.md template never referenced
`{{systemPromptCustomization}}`. Only custom-system-prompt.md rendered it,
and that template is only active when customPrompt is explicitly provided
(which sdk.ts never does).

This meant all SYSTEM.md content — orchestration protocol, delegation
triggers, harness bindings — was silently dropped in every session.

Add the same `{{#if systemPromptCustomization}}` block to the default
template, positioned after the [ENV] section and before Skills/Rules.
@mrosnerr mrosnerr changed the title fix(prompts): render systemPromptCustomization in default template fix(prompts): SYSTEM.md content silently dropped in default sessions May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant