agentic examples

The Standup Digest

The Standup Digest: three collectors gather from the repo in parallel - recent commits, TODO debt, test suite shape - and a writer task fans their outputs in through the dependency pipe and publishes the digest nobody has to attend a meeting for.

Testing & Verification Round 3 DHH exit 0

source on github

bundle exec ruby examples/standup_digest.rb

a real captured run

STANDUP DIGEST

shipped: 1 recent commits (1 feat)
  latest: feat: the live tier (real LLM runs, recorded once) + artifact pipeline

owed: 0 TODO/FIXME/HACK markers in lib/
  (clean!)

guarded by: 0 examples across 0 spec files

(three collectors in parallel + one writer, completed in 10ms)

source

# frozen_string_literal: true

# The Standup Digest: three collectors gather from the repo in
# parallel - recent commits, TODO debt, test suite shape - and a writer
# task fans their outputs in through the dependency pipe and publishes
# the digest nobody has to attend a meeting for.
#
#   bundle exec ruby examples/standup_digest.rb
#
# Runs offline against the current git repo. The meeting is cancelled.

require class="s">"bundler/setup"
require class="s">"agentic"

ROOT = File.expand_path(class="s">"..", __dir__)

def repo_task(description, payload = nil)
  Agentic:class="y">:Task.new(
    description: description,
    agent_spec: {class="s">"name" => description, class="s">"instructions" => class="s">"Collect facts"},
    payload: payload
  )
end

orchestrator = Agentic:class="y">:PlanOrchestrator.new(concurrency_limit: 3)

commits = repo_task(class="s">"recent commits")
orchestrator.add_task(commits, agent: ->(_t) {
  log = `git -C #{ROOT} log --oneline -12 --pretty=format:class="s">"%s"`
    .force_encoding(Encoding:class="y">:UTF_8).lines.map(&class="y">:strip)
  themes = log.group_by { |line| line[/\A(\w+)(?:\(|:)/, 1] || class="s">"misc" }
  {count: log.size, themes: themes.transform_values(&class="y">:size), latest: log.first}
})

debt = repo_task(class="s">"todo debt")
orchestrator.add_task(debt, agent: ->(_t) {
  hits = Dir[File.join(ROOT, class="s">"lib", class="s">"**", class="s">"*.rb")].flat_map { |path|
    File.readlines(path, encoding: class="s">"UTF-8").each_with_index.select { |line, _| line =~ /#.*(TODO|FIXME|HACK)/ }
      .map { |line, i| class="s">"#{path.delete_prefix("#{ROOT}/class="s">")}:#{i + 1} #{line.strip.sub(/\A#\s*/, "class="s">")}" }
  }
  {count: hits.size, items: hits.first(5)}
})

tests = repo_task(class="s">"test suite shape")
orchestrator.add_task(tests, agent: ->(_t) {
  spec_files = Dir[File.join(ROOT, class="s">"spec", class="s">"**", class="s">"*_spec.rb")]
  examples = spec_files.sum { |f| File.read(f, encoding: class="s">"UTF-8").scan(/^\s*it\s/).size }
  {files: spec_files.size, examples: examples}
})

digest = repo_task(class="s">"digest")
orchestrator.add_task(digest, [commits, debt, tests], agent: ->(t) {
  shipped = t.output_of(commits)
  owed = t.output_of(debt)
  suite = t.output_of(tests)

  lines = []
  lines << class="s">"STANDUP DIGEST"
  lines << class="s">""
  lines << class="s">"shipped: #{shipped[class="y">:count]} recent commits " \
    class="s">"(#{shipped[class="y">:themes].map { |k, v| "#{v} #{k}class="s">" }.join(", class="s">")})"
  lines << class="s">"  latest: #{shipped[class="y">:latest]}"
  lines << class="s">""
  lines << class="s">"owed: #{owed[class="y">:count]} TODO/FIXME/HACK markers in lib/"
  owed[class="y">:items].each { |item| lines << class="s">"  - #{item}" }
  lines << class="s">"  (clean!)" if owed[class="y">:count].zero?
  lines << class="s">""
  lines << class="s">"guarded by: #{suite[class="y">:examples]} examples across #{suite[class="y">:files]} spec files"
  lines.join(class="s">"\n")
})

result = orchestrator.execute_plan

puts result.results[digest.id].output
puts
puts class="s">"(three collectors in parallel + one writer, #{result.status} " \
  class="s">"in #{(result.execution_time * 1000).round}ms)"