Skip to content

feat(agents): optimize RPI agent context management with shared discipline rules #1536

@katriendg

Description

@katriendg

Some users logged that running long RPI (Research → Plan → Implement → Review) sessions in Copilot,
some sessions run into context window /compact loops and loss of fidelity.

Background

Today, RPI subagents (Researcher Subagent, Plan Validator, Implementation Validator, RPI Validator) return verbose payloads in chat, and parent agents (RPI Agent, Task Researcher, Task Planner, Task Implementor, Task Reviewer) re-read tracking files and re-narrate next phases on every closing turn. Long sessions exhaust the context window and trigger /compact, losing nuance.

Acceptance Criteria

  • A shared instructions file hve-core/rpi-context-discipline defines three protocols: Lean Post-Work Turn, Response Mode Selection (Direct / Lightweight / Standard / Full), and Subagent Result Handling.
  • The 5 parent RPI agents that dispatch subagents reference the shared file via #file: (single-source-of-truth pattern). Task Challenger is explicitly out of scope (no subagents; stricter one-question protocol).
  • Subagent Response Format sections cap chat output: file path, status, ≤7 bullet findings (≤240 chars each), ≤3 clarifying questions when blocking, and a Re-read <path> pointer line. No full diffs, lint dumps, evidence tables, or quoted artifact bodies in chat.
  • Disk artifacts under .copilot-tracking/{research,plans,details,changes,reviews}/ remain the source of truth.
  • The instruction is included in the hve-core, hve-core-all, and project-planning collections, with regenerated plugin outputs and consistent symlinks.
  • npm run lint:frontmatter, npm run plugin:validate, and npm run plugin:generate pass on the branch.

Out of Scope

  • Runtime telemetry to measure context-window savings.
  • Changes to Task Challenger (already enforces a stricter response protocol).
  • Extension packaging changes beyond plugin regeneration.

Risks / Mitigations

  • Risk: Subagents truncate too aggressively and parent decisions need detail not in summary bullets.
    Mitigation: Subagent Result Handling explicitly permits re-reading the subagent file when a decision depends on detail beyond the bullets.
  • Risk: Drift between the shared rules and the per-agent Response Format sections.
    Mitigation: #file: reference keeps the rules single-sourced; Response Formats stay structurally identical across the four subagents.

Metadata

Metadata

Assignees

Labels

agentsCustom chat agents (.agent.md)instructionsCopilot instruction files (.instructions.md)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions