Commit 42cd146

mo khan <mo@mokhan.ca>
2025-11-07 17:57:42
feat: add an eval tool to allow an llm to use meta-programming to give itself more tools
1 parent def5f80
Changed files (1)
lib
lib/elelem/toolbox.rb
@@ -36,11 +36,16 @@ module Elelem
       { bytes_written: full_path.write(args["content"]) }
     end
 
+    EVAL_TOOL = Tool.build("eval", "Evaluates the Ruby expression(s) in the elelem coding agent allowing an LLM to create its own tools", { ruby: { type: "string" }, }, ["ruby"]) do |args|
+      { result: eval(args["ruby"]) }
+    end
+
     attr_reader :tools
 
     def initialize
       @tools_by_name = {}
       @tools = { read: [], write: [], execute: [] }
+      add_tool(EVAL_TOOL, :execute)
       add_tool(EXEC_TOOL, :execute)
       add_tool(GREP_TOOL, :read)
       add_tool(LIST_TOOL, :read)