Commit c66997f

mo khan <mo@mokhan.ca>
2026-01-28 23:51:12
feat: add /mode to switch to a custom system prompt
1 parent 4b1e942
Changed files (1)
lib
elelem
builtins
lib/elelem/builtins/mode.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+Elelem::Plugins.register(:mode) do |agent|
+  agent.commands.register("mode",
+    description: "Switch system prompt mode",
+    completions: -> { Elelem::SystemPrompt.available_modes }
+  ) do |args|
+    name = args&.strip
+    if name.nil? || name.empty?
+      agent.terminal.say Elelem::SystemPrompt.available_modes.join(" ")
+    else
+      agent.system_prompt.switch(name)
+      agent.terminal.say "mode: #{name}"
+    end
+  end
+end