# yaml-language-server: $schema=../automation-document.schema.json
# Proactivity: when an issue opens, ask a model whether it is worth a maintainer's
# time, and if Yes the Triage agent handles it. Fill the ids with --var:
#   checkfu automations create -f proactivity.yaml --var RUNS_AS=prin_… \
#     --var GITHUB_ACCOUNT=conn_… --var TRIAGE_AGENT=agent_… --var ENVIRONMENT=env_…
# Delete the environment_id line when the Workspace has exactly one Environment.
name: Triage worthwhile issues
runs_as: "${RUNS_AS}"
environment_id: "${ENVIRONMENT}"
blocks:
  - id: opened
    type: trigger
    trigger: { type: app_event, connection_id: "${GITHUB_ACCOUNT}", event: issues.opened }
  - id: worth_it
    type: model
    route: { profile: fast-judge }
    prompt: "Is this issue worth a maintainer's time? {{opened.issue.title}} {{opened.issue.body}}"
    format: { type: yes_no }
  - id: triage
    type: agent
    agent: "${TRIAGE_AGENT}"
    prompt: "Triage {{opened.issue.html_url}}. Why it matters: {{worth_it.reason}}"
wires:
  - { from: opened, to: worth_it }
  - { from: worth_it, port: "yes", to: triage }
