1.9 KiB
1.9 KiB
pkg/persona
Sistema de personalidades configurables para agentes LLM.
Responsabilidad
Ensamblar el system prompt final del agente combinando:
- Base prompt (hardcoded en la librería)
- Persona YAML (configurable por proyecto)
- AGENTS.md (instrucciones del proyecto, descubierto por búsqueda en árbol de directorios)
- Working memory context (resúmenes si hay compaction)
API pública
type Persona struct {
ID string
Name string
Tone string
Style string
Language string
Constraints []string
FewShot []llm.Message
}
type Loader interface {
Load(ctx context.Context, configPath string) (Persona, error)
Discover(ctx context.Context, workdir string) (Persona, error) // incluye AGENTS.md
}
Formato YAML
id: pragmatista
name: Pragmatista
tone: "Directo y profesional"
style: "Enfoque Go idiomatic"
language: "Español, con términos técnicos en inglés"
constraints:
- "No usar interface{} en código nuevo"
- "Siempre wrapped errors con %w"
few_shot:
- role: user
content: "Refactoriza este código"
- role: assistant
content: "Listo. Optimizado. ¿Aplico?"
AGENTS.md discovery
El loader busca ./AGENTS.md, sube al directorio padre, etc., concatenando todos los encontrados hasta llegar a ~ o /. También incluye ~/.config/rony/AGENTS.md como default global.
/home/user/proyecto/AGENTS.md ← incluye
/home/user/AGENTS.md ← incluye
/home/AGENTS.md ← incluye
~/.config/rony/AGENTS.md ← incluye
Uso
p, err := persona.Discover(ctx, "/home/user/mi-proyecto")
// p.Content incluye todo lo anterior concatenado
Ver también
- pkg/agent — Usa la persona en el system prompt