| 857 | |
| 858 | func AssemblePromptSections(sections []PromptSection) string { |
| 859 | var result []string |
| 860 | for _, section := range sections { |
| 861 | content := strings.TrimSpace(section.Content) |
| 862 | if content != "" { |
| 863 | result = append(result, content) |
| 864 | } |
| 865 | } |
| 866 | return strings.Join(result, "\n\n") |
| 867 | } |
| 868 | |
| 869 | func BuildSystemPrompt(cwd, memorySection string) (string, error) { |
| 870 | sections, err := BuildSystemPromptSection(cwd, memorySection) |
| 871 | if err != nil { |
| 872 | return "", err |
| 873 | } |
| 874 | return AssemblePromptSections(sections), nil |
| 875 | } |