Commit a52e4b9

mo khan <mo@mokhan.ca>
2025-08-14 15:50:36
feat: improve the prompt
1 parent b1a5b34
Changed files (2)
lib/elelem/agent.rb
@@ -2,11 +2,12 @@
 
 module Elelem
   class Agent
-    attr_reader :api, :conversation, :logger
+    attr_reader :api, :conversation, :logger, :model
 
     def initialize(configuration)
       @api = configuration.api
       @configuration = configuration
+      @model = configuration.model
       @conversation = configuration.conversation
       @logger = configuration.logger
       transition_to(Idle.new)
lib/elelem/state.rb
@@ -4,13 +4,19 @@ module Elelem
   class Idle
     def run(agent)
       agent.logger.debug("Idling...")
-      agent.say(Dir.pwd, colour: :magenta, newline: true)
+      agent.say("#{Dir.pwd} (#{agent.model}) [#{git_branch}]", colour: :magenta, newline: true)
       input = agent.prompt("モ ")
       agent.quit if input.nil? || input.empty? || input == "exit" || input == "quit"
 
       agent.conversation.add(role: :user, content: input)
       agent.transition_to(Working.new)
     end
+
+    private
+
+    def git_branch
+      `git branch --no-color --show-current --no-abbrev`.strip
+    end
   end
 
   class Working