Files
crimson_leaf/templates/pulse_check.yml

138 lines
5.4 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 (CLP) production status:
- The portfolio report includes a project_breakdown array for each company.
- Look at the crimson_leaf_publishing company's project_breakdown.
- Each project entry has: name, 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 CLP 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: 100
output_key: dispatch_project_slug
hint: |
Based on the portfolio report's project_breakdown for crimson_leaf_publishing,
which single CLP project has is_idle=true with the most hours_since_activity?
CHAPTER LIMITS -- do NOT dispatch to a book that has reached its chapter target:
- cypress-bend: 12 chapters. If 12 or more polished chapters exist, do NOT dispatch.
- crimson-vows: 10 chapters. If 10 or more polished chapters exist, do NOT dispatch.
- binding-thread: 12 chapters. If 12 or more polished chapters exist, do NOT dispatch.
Check deliverables or portfolio report for polished chapter counts before deciding.
A book at or over its chapter limit should be treated as if is_idle=false.
Valid output values (pick exactly one): cypress-bend, crimson-vows, binding-thread, none
Rules: output ONLY the slug value. No explanation. No punctuation. No newlines.
If ALL three projects have is_idle=false (tasks currently in progress), output: none
- type: think
max_tokens: 500
output_key: dispatch_message
hint: |
The project selected for dispatch is: {dispatch_project_slug}
If {dispatch_project_slug} is "none", output exactly: none
Otherwise, write a clear chapter dispatch for the writing team. Include:
- Book context: title, genre, lead characters, core conflict, setting
- Task: "Write the next unwritten chapter. Check existing deliverables to find the
last written chapter and continue from there. If no chapters exist, start with ch-01."
- Word count target: approximately 3500 words per chapter
- Reminder: use the book outline in Gitea (pae/{company_slug}/projects/{project_slug}/)
for chapter titles and plot beats
Book reference:
- cypress-bend: "Cypress Bend" -- contemporary romance, Louisiana bayou. Elena Vargas
(painter) and Jax Harlan (reclusive novelist). 12 chapters.
- crimson-vows: "Crimson Vows" -- paranormal romance, blood pact. Lila Voss and vampire
heir Damian Voss. 10 chapters.
- binding-thread: "The Binding Thread" -- fantasy romance, fate-weavers. Lira and
rebel leader Thorne. Kingdom of Eldoria. 12 chapters.
Output ONLY the dispatch message text. No labels. No metadata. No preamble.
- type: tool
action: enqueue_strategy
optional: true
params:
company_slug: "crimson_leaf_publishing"
project_slug: "{dispatch_project_slug}"
task_type: "book_chapter"
content: "{dispatch_message}"
- 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?]"
Examples:
"Pulse check -- 3h cycle -- HEALTHY"
"Dispatched ch-06 to Cypress Bend. CLP queue active on all 3 projects."
"Pulse check -- 3h cycle -- ATTENTION"
"David, Crimson Vows has been idle 18h. Dispatch fired. Adj pass rate dropped to 42%."
"Pulse check -- 3h cycle -- IDLE"
"All CLP projects active. No dispatches needed. System nominal."
Keep it to 2 lines maximum. No extra commentary.
- type: reply
target: channel
channel_id: "1473516041249493104"
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