Class: Clacky::AgentProfile

Inherits:
Object
  • Object
show all
Defined in:
lib/clacky/agent_profile.rb

Overview

Loads and represents an agent profile (system prompt + skill whitelist).

Lookup order for a profile named “coding”:

1. ~/.clacky/agents/coding/          (user override)
2. <gem>/lib/clacky/default_agents/coding/  (built-in default)

Each profile directory must contain:

- profile.yml       — name, description, skills whitelist
- system_prompt.md  — agent-specific system prompt content

Global files (shared across all agents), also with user-override support:

- SOUL.md   — agent personality/values
- USER.md   — user profile information
- base_prompt.md — universal behavioral rules (todo manager, tool usage, etc.)

Constant Summary collapse

DEFAULT_AGENTS_DIR =
File.expand_path("../default_agents", __FILE__).freeze
USER_AGENTS_DIR =
File.expand_path("~/.clacky/agents").freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ AgentProfile

Returns a new instance of AgentProfile.



26
27
28
29
30
31
# File 'lib/clacky/agent_profile.rb', line 26

def initialize(name)
  @name = name.to_s
  profile_data = load_profile_yml
  @description = profile_data["description"] || ""
  @system_prompt_content = load_agent_file("system_prompt.md")
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



24
25
26
# File 'lib/clacky/agent_profile.rb', line 24

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



24
25
26
# File 'lib/clacky/agent_profile.rb', line 24

def name
  @name
end

Class Method Details

.load(name) ⇒ AgentProfile

Load a named profile. Raises ArgumentError if profile directory not found.

Parameters:

  • name (String, Symbol)

    profile name (e.g. “coding”, “general”)

Returns:



36
37
38
# File 'lib/clacky/agent_profile.rb', line 36

def self.load(name)
  new(name)
end

Instance Method Details

#base_promptString

Returns base prompt shared by all agents.

Returns:

  • (String)

    base prompt shared by all agents



46
47
48
# File 'lib/clacky/agent_profile.rb', line 46

def base_prompt
  load_global_file("base_prompt.md")
end

#soulString

Returns soul content (user override → built-in default).

Returns:

  • (String)

    soul content (user override → built-in default)



51
52
53
# File 'lib/clacky/agent_profile.rb', line 51

def soul
  load_global_file("SOUL.md")
end

#system_promptString

Returns agent-specific system prompt content.

Returns:

  • (String)

    agent-specific system prompt content



41
42
43
# File 'lib/clacky/agent_profile.rb', line 41

def system_prompt
  @system_prompt_content
end

#user_profileString

Returns user profile content (user override → built-in default).

Returns:

  • (String)

    user profile content (user override → built-in default)



56
57
58
# File 'lib/clacky/agent_profile.rb', line 56

def 
  load_global_file("USER.md")
end