Skip to content

Fix(coding-agent) Updated system-prompt.ts to use xml boundaries #4541

Merged
badlogic merged 1 commit into
earendil-works:mainfrom
herrnel:fix/explicit-fences
May 17, 2026
Merged

Fix(coding-agent) Updated system-prompt.ts to use xml boundaries #4541
badlogic merged 1 commit into
earendil-works:mainfrom
herrnel:fix/explicit-fences

Conversation

@herrnel

@herrnel herrnel commented May 15, 2026

Copy link
Copy Markdown
Contributor

System prompt's (System.md) and context files (AGENT.md, CLAUDE.md) are merged together using ## headers as a way to create file boundaries. Currently, context file boundaries can become unclear for agents when a user uses ## headers or worse # in their context files. A good solution is to use the less commonly used xml tags as file context boundaries instead of ## which are more commonly used.

Fix:

  • Replaced # Project Context with <project_context></project_context
  • Replaced ## fake/file/path/AGENTS.md with
    • <project_instruction path="fake/file/path/AGENTS.md"></project_instruction>

Example:

<project_context>

Project-specific instructions and guidelines:

<project_instructions path="fake/file/path/SYSTEM.md">  
content  
</project_instructions> 

<project_instructions path="fake/file/path/AGENTS.md">  
content  
</project_instructions> 

<project_instructions path="fake/file/path/AGENTS.md">  
content  
</project_instructions> 
 
</project_context>

Fixes: #4319

@badlogic

Copy link
Copy Markdown
Collaborator

@herrnel this does not reference the issue it belongs to. the commit does not close the issue via "closes #xyz". the pr description is overly long and could be a paragraph plus an example of what the new fences look like.

Comment thread packages/coding-agent/src/core/skills.ts
Comment thread packages/coding-agent/src/core/system-prompt.ts Outdated
Comment thread packages/coding-agent/src/utils/escape-xml.ts Outdated
@badlogic

Copy link
Copy Markdown
Collaborator

@herrnel i left a review, please fix.

@herrnel

herrnel commented May 16, 2026

Copy link
Copy Markdown
Contributor Author

@badlogic understood, will fix asap

@herrnel herrnel force-pushed the fix/explicit-fences branch from f22c8d9 to aa37368 Compare May 17, 2026 02:15
@herrnel

herrnel commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

@badlogic fixed.

@overtongeist

Copy link
Copy Markdown

Why not sync commit msg with PR description? Otherwise that info is lost if Pi were to migrate to a different git provider than Github in the future.

…ext file merging rather than using `##` so that agents are less likely to ingest a prompt with inconsistent boundaries.
@herrnel herrnel force-pushed the fix/explicit-fences branch from aa37368 to e2fd651 Compare May 17, 2026 03:04
@herrnel

herrnel commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

@overtongeist good call out. The commit lacked reasoning.

@overtongeist

Copy link
Copy Markdown

Your PR description is still vastly bigger than the commit msg. Commit msg have a title, and a body, and the body doesn't have any size length limit.

@badlogic badlogic merged commit 8e69137 into earendil-works:main May 17, 2026
1 check passed
@badlogic

Copy link
Copy Markdown
Collaborator

@herrnel cheers!

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.

Use explicit fences for AGENTS.md in system prompt

3 participants