rony-llm-agent/pkg/persona
2026-06-30 23:53:28 -07:00
..
loader.go feat(persona): add Persona definition, system prompt assembly, and AgentsMD discovery 2026-06-30 23:53:28 -07:00
persona.go feat(persona): add Persona definition, system prompt assembly, and AgentsMD discovery 2026-06-30 23:53:28 -07:00
persona_test.go feat(persona): add Persona definition, system prompt assembly, and AgentsMD discovery 2026-06-30 23:53:28 -07:00
README.es.md docs(i18n): translate all docs to English (with .es.md as Spanish alternative) 2026-06-30 13:40:37 -07:00
README.md docs(i18n): translate all docs to English (with .es.md as Spanish alternative) 2026-06-30 13:40:37 -07:00

pkg/persona

Configurable personality system for LLM agents.

Responsibility

Assemble the agent's final system prompt by combining:

  1. Base prompt (hardcoded in the library)
  2. Persona YAML (configurable per project)
  3. AGENTS.md (project instructions, discovered by searching up the directory tree)
  4. 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