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

Method buildSystemPrompt

agent/subagent.go:473–495  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

471}
472
473func (s *SubAgent) buildSystemPrompt() string {
474 if override, _ := s.ExtraContext["system_prompt_override"].(string); strings.TrimSpace(override) != "" {
475 return override
476 }
477 cwd := s.Config.CWD
478 if wt, _ := s.ExtraContext["worktree_cwd"].(string); wt != "" {
479 cwd = wt
480 }
481 gitContext := agentContext.GetGitContext(cwd, 3.0, true)
482 agentMemory := ""
483 if s.Config.LongTermMemoryEnabled {
484 agentMemory = s.longTermAgentMemoryBehavior()
485 }
486 sections, err := agentContext.BuildSubagentPromptSections(s.Definition.Name, s.Definition.Description, cwd, s.MaxTurns, gitContext, agentMemory)
487 if err == nil {
488 return agentContext.AssemblePromptSections(sections)
489 }
490 prompt := BuildSystemPrompt(cwd) + "\n\nSub-agent: " + s.Definition.Name + "\n" + s.Definition.Description
491 if agentMemory != "" {
492 prompt += agentMemory
493 }
494 return prompt
495}
496
497func (s *SubAgent) buildInitialMessages(ctx context.Context, prompt string) []map[string]any {
498 var messages []map[string]any

Callers 1

createSessionStateMethod · 0.95

Calls 6

resolveProjectRootMethod · 0.95
GetGitContextFunction · 0.92
BuildAgentMemoryPromptFunction · 0.92
AssemblePromptSectionsFunction · 0.92
BuildSystemPromptFunction · 0.70

Tested by

no test coverage detected