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)
| 364 | // formatSkillIndex renders the stable, sorted index card. Sorting keeps the |
| 365 | // block byte-stable across turns so it stays prompt-cache friendly. |
| 366 | func 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 | |
| 380 | func (c skillCandidate) toInput() plugins.AutoSkillInput { |
| 381 | return plugins.AutoSkillInput{ |