MCPcopy Create free account
hub / github.com/diillson/chatcli / formatSkillIndex

Function formatSkillIndex

cli/selfevolve.go:366–378  ·  view source on GitHub ↗

formatSkillIndex renders the stable, sorted index card. Sorting keeps the block byte-stable across turns so it stays prompt-cache friendly.

(names []string, desc map[string]string)

Source from the content-addressed store, hash-verified

364// formatSkillIndex renders the stable, sorted index card. Sorting keeps the
365// block byte-stable across turns so it stays prompt-cache friendly.
366func formatSkillIndex(names []string, desc map[string]string) string {
367 if len(names) == 0 {
368 return ""
369 }
370 sorted := append([]string(nil), names...)
371 sort.Strings(sorted)
372 var b strings.Builder
373 b.WriteString("EXISTING SKILLS (index — reuse a name to EVOLVE that skill; do not duplicate):\n")
374 for _, n := range sorted {
375 b.WriteString("- " + n + " — " + truncateForLog(desc[n], skillIndexEntryCap) + "\n")
376 }
377 return strings.TrimRight(b.String(), "\n")
378}
379
380func (c skillCandidate) toInput() plugins.AutoSkillInput {
381 return plugins.AutoSkillInput{

Callers 2

buildSkillIndexMethod · 0.85
TestFormatSkillIndexFunction · 0.85

Calls 2

truncateForLogFunction · 0.70
StringMethod · 0.45

Tested by 1

TestFormatSkillIndexFunction · 0.68