MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / BuildSubagentPromptSections

Function BuildSubagentPromptSections

agentContext/builder.go:737–771  ·  view source on GitHub ↗
(agentName, description, cwd string, maxTurns int, gitContext, agentMemory string)

Source from the content-addressed store, hash-verified

735 if !enabled {
736 return PromptSection{}, errors.New("session memory disabled")
737 }
738 return PromptSection{
739 "session-memory-behavior",
740 sessionMemorySection,
741 true,
742 }, nil
743}
744
745func BuildSubagentIdentitySection(agentName, description string) PromptSection {
746 content := fmt.Sprintf(
747 "You are a %s sub-agent. %s", agentName, description)
748 return PromptSection{"subagent-identity", content, false}
749}
750
751func BuildSubagentExecutionConstraintsSection(maxTurns int) PromptSection {
752 content := fmt.Sprintf(
753 "Instructions:\n"+
754 "- Complete the assigned task and return a concise result.\n"+
755 "- You have access to a limited set of tools - use them wisely.\n"+
756 "- You have %d turns to complete the task.\n"+
757 "- Return your final answer as plain text; the parent agent will use it to continue its work.",
758 maxTurns,
759 )
760 return PromptSection{"subagent-execution-constraints", content, false}
761}
762
763func BuildSubagentPromptSections(agentName, description, cwd string, maxTurns int, gitContext, agentMemory string) ([]PromptSection, error) {
764 priority, err := BuildInstructionPrioritySection()
765 if err != nil {
766 return nil, err
767 }
768 trust, err := BuildTrustAndExternalContextSection()
769 if err != nil {
770 return nil, err
771 }
772 workflow, err := BuildWorkflowSection()
773 if err != nil {
774 return nil, err