Commit bae487d

mo khan <mo@mokhan.ca>
2026-01-19 21:47:52
feat: parse the closest AGENTS.md file
1 parent 9715ab6
Changed files (1)
lib
elelem
lib/elelem/agent.rb
@@ -137,10 +137,18 @@ module Elelem
         # Codebase
         #{repo_map}
       PROMPT
-      prompt += "\n\n#{IO.read("AGENTS.md")}" if File.exist?("AGENTS.md")
+      prompt += "\n\n# Project Instructions\n#{agents_md}" if agents_md
       prompt
     end
 
+    def agents_md
+      Pathname.pwd.ascend.each do |dir|
+        file = dir / "AGENTS.md"
+        return file.read if file.exist?
+      end
+      nil
+    end
+
     def git_branch
       return unless File.exist?(".git")
       "branch: #{`git branch --show-current`.strip}"