Module: Airb::Organism

Defined in:
lib/airb/organism.rb

Class Method Summary collapse

Class Method Details

.buildObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/airb/organism.rb', line 13

def self.build
  workspace_root = `git rev-parse --show-toplevel`.strip
  workspace_root = Dir.pwd if workspace_root.empty?

  provider = (ENV["AIRB_PROVIDER"] || "openai").downcase

  driver =
    case provider
    when "anthropic"
      VSM::Drivers::Anthropic::AsyncDriver.new(
        api_key: ENV.fetch("ANTHROPIC_API_KEY"),
        model:   ENV["AIRB_MODEL"] || "claude-sonnet-4-0"
      )
    when "gemini"
      VSM::Drivers::Gemini::AsyncDriver.new(
        api_key: ENV.fetch("GEMINI_API_KEY"),
        model:   ENV["AIRB_MODEL"] || "gemini-2.5-flash"
      )
    else
      VSM::Drivers::OpenAI::AsyncDriver.new(
        api_key: ENV.fetch("OPENAI_API_KEY"),
        model:   ENV["AIRB_MODEL"] || "gpt-5-nano"
      )
    end

  VSM::DSL.define(:airb) do
    identity     klass: Airb::Systems::Identity,    args: { name: "airb", invariants: [] }
    governance   klass: Airb::Systems::Governance,  args: { workspace_root: workspace_root }
    coordination klass: Airb::Systems::Coordination
    intelligence klass: Airb::Systems::Intelligence, args: { driver: driver }
    monitoring   klass: VSM::Monitoring

    operations do
      capsule :list_files, klass: Airb::Tools::FS::ListFiles
      capsule :read_file,  klass: Airb::Tools::FS::ReadFile
      capsule :edit_file,  klass: Airb::Tools::FS::EditFile
    end
  end
end