Class: RubyCoded::Chat::PromptBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_coded/chat/prompt_builder.rb

Overview

Assembles the final system instruction set for a given RuntimeMode.

Composes the base prompt (agent/plan/chat) with project skills for the same mode. Both LLMBridge and CodexBridge use this to keep prompt logic in a single place.

Constant Summary collapse

DEFAULT_CHAT_INSTRUCTIONS =
"You are a helpful coding assistant. " \
"Answer concisely and provide code examples when relevant."
MAX_WRITE_ROUNDS =
Tools::ExecutionPolicy::MAX_WRITE_TOOL_ROUNDS
MAX_TOTAL_ROUNDS =
Tools::ExecutionPolicy::MAX_TOTAL_TOOL_ROUNDS

Instance Method Summary collapse

Constructor Details

#initialize(project_root:, skill_catalog:, chat_base: :agentic) ⇒ PromptBuilder

chat_base:

- `:agentic` — chat mode still uses the full agentic prompt
(matches LLMBridge, where tools may still be relevant),
- `:simple`  — chat mode uses a light default instruction
(matches the Codex Responses API).


27
28
29
30
31
# File 'lib/ruby_coded/chat/prompt_builder.rb', line 27

def initialize(project_root:, skill_catalog:, chat_base: :agentic)
  @project_root = project_root
  @skill_catalog = skill_catalog
  @chat_base = chat_base
end

Instance Method Details

#build(mode) ⇒ Object



33
34
35
36
37
# File 'lib/ruby_coded/chat/prompt_builder.rb', line 33

def build(mode)
  base = base_instructions(mode)
  skills = @skill_catalog.relevant_skills_for(mode: mode.skill_mode)
  Skills::PromptFormatter.append(base, skills)
end