Skip to content

Conversation

@kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Nov 16, 2025

Description

This PR migrates the .NET MAUI PR Reviewer Agent from a large inline file prompt to a file-based instruction architecture. The previous inline prompt exceeded GitHub’s token limits, preventing the agent from loading. Because the instruction set is large and cannot be shortened, externalizing it into Markdown files is the correct and scalable solution.

Changes

  • Moved the full PR reviewer prompt from YAML into Markdown files.
  • Added a dedicated folder structure for agent instructions:
.github/
  agents/
    pr-reviewer.md
  instructions/pr-reviewer-agent
    core-guidelines.md
    testing-guidelines.md
    safearea-guidelines.md
    sandbox-setup.md
    edge-cases.md
  • Updated the agent YAML to load instructions from these files:
instructions:
  - file: .github/agents/pr-reviewer.md
  - file: .github/instructions/pr-reviewer-agent/core-guidelines.md
  - file: .github/instructions/pr-reviewer-agent/testing-guidelines.md
  - file: .github/instructions/pr-reviewer-agent/safearea-guidelines.md
  - file: .github/instructions/pr-reviewer-agent/edge-cases.md
  - file: .github/instructions/pr-reviewer-agent/sandbox-setup.md
  • No functional changes to agent behavior.

Why This Change Is Needed

  • Inline prompts have strict token limits.
  • The PR reviewer agent contains extensive instruction logic that cannot be shortened.
  • This structure improves maintainability and aligns with GitHub’s recommended agent architecture.

Impact

  • No behavioral changes.
  • Agent now loads reliably without token overflow issues.
  • Instructions are easier to maintain, reorganize, and extend.

Validation

  • Agent successfully loads with file-based instructions.
  • All referenced .md files resolve correctly.
  • No token limit errors.
  • Manual testing confirms identical behavior to the previous version.
Before After

Copilot AI review requested due to automatic review settings November 16, 2025 23:33
@kubaflo kubaflo changed the title Moved PR Reviewer Agent to File-Based Instruction System [AI] Moved PR Reviewer Agent to File-Based Instruction System Nov 16, 2025
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Nov 16, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @@kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses GitHub token limit issues by migrating the PR Reviewer Agent instructions from a large inline YAML file to a file-based instruction architecture. The change splits ~1200 lines of inline instructions into 7 organized markdown files under .github/instructions/pr-reviewer-agent/.

Key changes:

  • Created modular instruction files for testing, sandbox setup, error handling, output format, edge cases, SafeArea testing, and core guidelines
  • Updated main agent file to reference external instruction files
  • No functional behavior changes intended

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.github/agents/pr-reviewer.md Reduced from ~1200 lines to 39 lines; now references external instruction files
.github/instructions/pr-reviewer-agent/core-guidelines.md Core review philosophy, workflow, and code analysis patterns
.github/instructions/pr-reviewer-agent/testing-guidelines.md App selection (Sandbox vs HostApp), PR fetching, build/deploy procedures
.github/instructions/pr-reviewer-agent/sandbox-setup.md Sandbox modification patterns and instrumentation examples
.github/instructions/pr-reviewer-agent/safearea-guidelines.md SafeArea-specific testing guidance
.github/instructions/pr-reviewer-agent/output-format.md Review structure and redundancy elimination guidelines
.github/instructions/pr-reviewer-agent/error-handling.md Build error and unexpected result handling procedures
.github/instructions/pr-reviewer-agent/edge-cases.md Edge case discovery requirements

Comment on lines +17 to +19
dotnet clean Microsoft.Maui.slnx
rm -rf bin/ obj/
dotnet restore Microsoft.Maui.slnx --force
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect file extension. The repository uses .sln files, not .slnx. These commands should reference Microsoft.Maui.sln instead of Microsoft.Maui.slnx.

Suggested change
dotnet clean Microsoft.Maui.slnx
rm -rf bin/ obj/
dotnet restore Microsoft.Maui.slnx --force
dotnet clean Microsoft.Maui.sln
rm -rf bin/ obj/
dotnet restore Microsoft.Maui.sln --force

Copilot uses AI. Check for mistakes.
@PureWeen
Copy link
Member

/rebase

Condensed and reorganized .github/agents/pr-reviewer.md to reference new modular instruction files for PR review workflow. Added core guidelines and supporting documents under .github/instructions/pr-reviewer-agent/ for time management, edge cases, error handling, output format, safe area testing, sandbox setup, and testing procedures. This improves maintainability and clarity for PR reviewer agent processes.
@PureWeen PureWeen merged commit 17531c6 into dotnet:main Nov 18, 2025
1 check passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 2025
@kubaflo kubaflo added area-ai-agents Copilot CLI agents, agent skills, AI-assisted development and removed area-ai labels Jan 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-ai-agents Copilot CLI agents, agent skills, AI-assisted development community ✨ Community Contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants