[PR #5075] fix: support custom agent names for plan/build reminders #11232

Closed
opened 2026-02-16 18:16:02 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5075

State: closed
Merged: No


Summary

  • Fix plan/build agent reminder triggers to work with custom agent names
  • Replace exact string matching with word boundary regex pattern matching
  • Ensures users with custom agents containing "plan" or "build" receive proper context reminders

Issue

The plan/build reminder system used exact string matching (input.agent.name === "plan" and input.agent.name === "build"), which completely bypassed important context for users with custom agents. Users with agents like "my-plan-agent" or "custom-build-helper" would never see the plan mode reminder or build-switch reminder, reducing the effectiveness of the agent switching system.

Solution

  • Added hasAgentType() helper function that uses word boundary regex matching
  • Changed triggers from exact string matches to pattern matching for any agent name containing "plan" or "build" as whole words
  • Applied the same logic to both current agent detection and previous message mode detection
  • Maintains backward compatibility while extending support to custom agent names

Impact

Users with custom plan/build agents will now correctly receive contextual reminders, improving the agent switching experience and ensuring important context is preserved across agent transitions.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5075 **State:** closed **Merged:** No --- ## Summary - Fix plan/build agent reminder triggers to work with custom agent names - Replace exact string matching with word boundary regex pattern matching - Ensures users with custom agents containing "plan" or "build" receive proper context reminders ## Issue The plan/build reminder system used exact string matching (`input.agent.name === "plan"` and `input.agent.name === "build"`), which completely bypassed important context for users with custom agents. Users with agents like "my-plan-agent" or "custom-build-helper" would never see the plan mode reminder or build-switch reminder, reducing the effectiveness of the agent switching system. ## Solution - Added `hasAgentType()` helper function that uses word boundary regex matching - Changed triggers from exact string matches to pattern matching for any agent name containing "plan" or "build" as whole words - Applied the same logic to both current agent detection and previous message mode detection - Maintains backward compatibility while extending support to custom agent names ## Impact Users with custom plan/build agents will now correctly receive contextual reminders, improving the agent switching experience and ensuring important context is preserved across agent transitions.
yindo added the pull-request label 2026-02-16 18:16:02 -05:00
yindo closed this issue 2026-02-16 18:16:02 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11232