Class: EnvironmentProbe
- Inherits:
-
Object
- Object
- EnvironmentProbe
- Defined in:
- lib/environment_probe.rb
Overview
Probes the shell environment and assembles a lightweight metadata block for injection into the system prompt. Gives the agent awareness of its working directory, OS, Git status, and nearby project files — without loading any file content.
Class Method Summary collapse
-
.to_prompt(pwd) ⇒ String?
Assembles the environment context block for a given working directory.
Instance Method Summary collapse
-
#initialize(pwd) ⇒ EnvironmentProbe
constructor
A new instance of EnvironmentProbe.
-
#to_prompt ⇒ String?
Markdown-formatted environment block.
Constructor Details
#initialize(pwd) ⇒ EnvironmentProbe
Returns a new instance of EnvironmentProbe.
28 29 30 |
# File 'lib/environment_probe.rb', line 28 def initialize(pwd) @pwd = pwd end |
Class Method Details
.to_prompt(pwd) ⇒ String?
Assembles the environment context block for a given working directory.
23 24 25 |
# File 'lib/environment_probe.rb', line 23 def self.to_prompt(pwd) new(pwd).to_prompt end |
Instance Method Details
#to_prompt ⇒ String?
Returns Markdown-formatted environment block.
33 34 35 36 37 38 39 40 |
# File 'lib/environment_probe.rb', line 33 def to_prompt return unless @pwd sections = [os_section, working_directory_section, project_files_section].compact return if sections.empty? "## Environment\n\n#{sections.join("\n\n")}" end |