Files
crimson_leaf/templates/pulse_check.yml

114 lines
3.9 KiB
YAML

name: pulse_check
description: "Crimson Leaf holding company health scan -- Edgar checks all subsidiaries every 3 hours."
debug: true
model: power
system: agent_prompt
agent_prompt:
- "= identity.md"
sections:
- agent
- project
- rag
- message
- instructions
builders:
message: |
*** PORTFOLIO REPORT ***
{steps[0].text}
steps:
- type: tool
action: get_portfolio_report
output_key: portfolio_data
- type: think
max_tokens: 4000
hint: |
You are Edgar, CEO of Crimson Leaf Holdings. You just received the portfolio report above.
Analyze it as a systems operator would:
1. Which companies are active? Which are idle (no recent activity)?
2. Are any tasks stuck (in_progress but old)? Any unusually high failure rates?
3. Are adjudication pass rates healthy (>65%) or concerning?
4. Is the system healthy (workers online, queue depth reasonable)?
Be concise and data-driven. Flag only what needs human attention.
For each issue, format as: "David, [action needed]: [details]"
If everything looks healthy, say so briefly -- don't invent problems.
Also assess Crimson Leaf Publishing production status:
- The portfolio report includes a project_breakdown array for each company.
- Each project entry has: name, slug, company_slug, tasks_in_progress, tasks_completed,
last_activity_utc, hours_since_activity, and is_idle (true/false).
- is_idle is true when tasks_in_progress=0 AND hours_since_activity > 4.
- Identify which project has is_idle=true and the highest hours_since_activity.
- That is the project most overdue for a chapter dispatch.
- type: think
max_tokens: 200
output_key: dispatch_target
hint: |
Read the portfolio report data above.
Find the single project with is_idle=true and the highest hours_since_activity.
If no projects are idle, output exactly: none
If a project is found, output two lines -- nothing else:
COMPANY: <company_slug from the portfolio data>
PROJECT: <project slug from the portfolio data>
Rules: use the exact slug values from the data. No explanation. No punctuation.
If ALL projects have is_idle=false (tasks currently in progress), output: none
- type: think
max_tokens: 50
output_key: dispatch_company_slug
hint: |
Read dispatch_target above.
If dispatch_target is "none", output exactly: none
Otherwise, output ONLY the value after "COMPANY:" -- one word, no spaces, no newline.
- type: think
max_tokens: 50
output_key: dispatch_project_slug
hint: |
Read dispatch_target above.
If dispatch_target is "none", output exactly: none
Otherwise, output ONLY the value after "PROJECT:" -- one word, no spaces, no newline.
- type: tool
action: enqueue_strategy
optional: true
params:
company_slug: "{dispatch_company_slug}"
project_slug: "{dispatch_project_slug}"
task_type: "chapter_production"
content: "Pulse-check trigger: resume chapter production for this project."
- type: think
max_tokens: 200
output_key: status_summary
hint: |
Write a brief 2-line status update for the Discord #general channel.
This should be punchy and informative -- David reads this to know if anything needs attention.
Format:
Line 1: "Pulse check -- [time context] -- [one word health: HEALTHY / ATTENTION / IDLE]"
Line 2: "[What action was taken or what was observed. Dispatch fired? All idle? Issue flagged?]"
Use project and company names from the portfolio data -- do not invent names.
Keep it to 2 lines maximum. No extra commentary.
- type: reply
target: channel
channel_name: "crimson_leaf:general"
hint: |
Post the status_summary above to the channel. Output it exactly as written.
Do not add any explanation, preamble, or additional context.
adjudication:
enabled: false