From 818ed50e2a54b40ccf7a7771bebe0312dc01a8b5 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 14 Mar 2026 09:56:52 +0200 Subject: Add agent-backed file processing DSL --- examples/plain_ruby/agents.rb | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 examples/plain_ruby/agents.rb (limited to 'examples/plain_ruby/agents.rb') diff --git a/examples/plain_ruby/agents.rb b/examples/plain_ruby/agents.rb new file mode 100755 index 0000000..e04da98 --- /dev/null +++ b/examples/plain_ruby/agents.rb @@ -0,0 +1,40 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# Example: Plain Ruby script using agent-backed file processing. +# +# Run with: +# ruby agents.rb --dry # dry run, no changes made +# ruby agents.rb --debug # verbose output +# ruby agents.rb # apply configuration +# +# Requires rcm to be installed as a gem, or adjust the path below: +# require_relative '../../lib/dsl' +begin + require 'rcm' +rescue LoadError + require_relative '../../lib/dsl' +end + +configure do + agent hexai do + 'hexai PROMPT' + end + + prompt fix english do + 'Correct English spellings and grammar. Improve clarity of the text. Dont introduce any new text or headers' + end + + # Draft a rough note, then let hexai polish the language in place. + file example notes draft do + path 'agents_example.txt' + manage directory + 'this are a short note with bad english and unclear wording.' + end + + file example notes polished do + path 'agents_example.txt' + requires file example notes draft + agent hexai fix english + end +end -- cgit v1.2.3