feat: agent-type-aware system prompt with fragment selection#73
Merged
yishuiliunian merged 1 commit intomainfrom Apr 4, 2026
Merged
feat: agent-type-aware system prompt with fragment selection#73yishuiliunian merged 1 commit intomainfrom
yishuiliunian merged 1 commit intomainfrom
Conversation
…pt quality improvements Sub-agent prompts were crippled: agent_type never reached PromptContext, so agent-specific fragments (explore, plan) never matched. Tool schemas were also duplicated in both the system prompt and the API tools parameter. Changes: - Thread agent_type through the full IPC spawn pipeline (6 crates) - Add Condition::Agent variant so fragments can target specific agent types - Registry excludes Agents category for root agent; falls back to default fragment for unknown types; uses specific fragment when matched - Remove redundant tool schema section from system prompt (saves ~3-5K tokens) - Reorder assembly: fragments (identity-first) → instructions → skills → memory - Enhance explore/plan/default-subagent prompt content with behavioral constraints, search strategies, and structured output formats - Remove dead build_agent_prompt() superseded by fragment selection - Derive is_subagent() from agent_type.is_some() instead of separate field
c32227c to
83a10ad
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
agent_typethrough the full IPC spawn pipeline so sub-agent prompts use the correct fragment (explore/plan/default)Changes
Condition::Agentvariant,is_subagent()derived method, registry fallback/exclusion logicagent_typeparam tobuild_system_promptagent_typefrom AgentTool → SpawnParams → Hub → AgentClient → AgentServer → PromptContextbuild_agent_prompt()+default_agent_prompt()superseded by fragment selectionTest plan
parse_agent_condition,fragments_come_before_instructions, 3 registry agent selection testsexplore_subagent_full_prompt,plan_subagent_gets_plan_fragment,general_subagent_gets_default_fragment,root_agent_excludes_agent_fragments,agent_fragments_have_correct_conditions