feat(agent): depth-aware delegation + StartAgentParams refactor#87
Merged
yishuiliunian merged 2 commits intomainfrom Apr 6, 2026
Merged
feat(agent): depth-aware delegation + StartAgentParams refactor#87yishuiliunian merged 2 commits intomainfrom
yishuiliunian merged 2 commits intomainfrom
Conversation
…ruct params (#86) Sub-agents had no awareness of their position in the delegation chain, leading to cascading spawns (129 agents from a single task). This change: - Propagates `depth` through the full IPC chain so each agent knows how deep it is (rendered as `{{ agent_depth }}` in system prompt) - Removes the hard `max_depth` limit — depth is informational, not a gate - Adds Delegation Depth guidance in agent-guidelines.md so deeper agents naturally prefer direct tool use over further delegation - Refactors `start_agent()` from 10 positional params to `StartAgentParams` - Removes redundant concurrency guidance from agent-type prompts (explore, plan, default-subagent) — centralized in agent-guidelines.md
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
depththrough full IPC chain (SpawnParams → Hub → StartAgentParams → AgentShared → PromptContext) so each agent sees its nesting level as{{ agent_depth }}in the system promptAgentClient::start_agent()from 10 positional parameters toStartAgentParamsstructmax_depthhard limit — depth is informational context, not a gateChanges
crates/loopal-agent-client/—StartAgentParamsstruct,start_agent(&self, p: &StartAgentParams)crates/loopal-agent/—SpawnParams.depth,AgentSharedremovesmax_depthcrates/loopal-agent-hub/— dispatch + spawn_manager pass depth throughcrates/loopal-agent-server/—StartParams.depth,agent_setupwires depth into promptcrates/loopal-prompt/—PromptContext.agent_depthcrates/loopal-context/—build_system_prompt()acceptsagent_depthcrates/loopal-prompt-system/prompts/— agent-guidelines.md, explore.md, plan.md, default-subagent.mdTest plan