- Add optional history parameter to Run/RunStream for conversation context - Add Reasoning/ReasoningDelta fields to completion and stream types - Update llama.cpp adapter to propagate reasoning content from responses - Default persona language now adapts to the user's language dynamically |
||
|---|---|---|
| .. | ||
| loader.go | ||
| persona.go | ||
| persona_test.go | ||
| README.es.md | ||
| README.md | ||
pkg/persona
Configurable personality system for LLM agents.
Responsibility
Assemble the agent's final system prompt by combining:
- Base prompt (hardcoded in the library)
- Persona YAML (configurable per project)
- AGENTS.md (project instructions, discovered by searching up the directory tree)
- Working memory context (summaries if there's compaction)
Public API
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) // includes AGENTS.md
}
YAML format
id: pragmatist
name: Pragmatist
tone: "Direct and professional"
style: "Idiomatic Go approach"
language: "English, with Spanish when needed"
constraints:
- "Don't use interface{} in new code (use any)"
- "Always wrap errors with %w"
few_shot:
- role: user
content: "Refactor this code"
- role: assistant
content: "Done. Optimized. Apply?"
AGENTS.md discovery
The loader searches for ./AGENTS.md, walks up to the parent directory, etc., concatenating all found until reaching ~ or /. Also includes ~/.config/rony/AGENTS.md as a global default.
/home/user/project/AGENTS.md ← includes
/home/user/AGENTS.md ← includes
/home/AGENTS.md ← includes
~/.config/rony/AGENTS.md ← includes
Usage
p, err := persona.Discover(ctx, "/home/user/my-project")
// p.Content includes all of the above concatenated
See also
- pkg/agent — Uses the persona in the system prompt