Add DB-driven pulse/company/project review chain with management projects
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
name: pulse_check
|
||||
description: "Crimson Leaf holding company health scan -- Edgar checks all subsidiaries every 3 hours."
|
||||
description: "Crimson Leaf holding company health scan -- Edgar checks all DB companies every 3 hours."
|
||||
debug: true
|
||||
model: power
|
||||
system: agent_prompt
|
||||
@@ -20,95 +20,59 @@ builders:
|
||||
{steps[0].text}
|
||||
|
||||
steps:
|
||||
# Step 0: pull live data for ALL companies currently in the database
|
||||
- type: tool
|
||||
action: get_portfolio_report
|
||||
output_key: portfolio_data
|
||||
|
||||
# Step 1: identify subsidiary company slugs (exclude crimson_leaf -- that is us)
|
||||
- type: think
|
||||
max_tokens: 4000
|
||||
max_tokens: 600
|
||||
hint: |
|
||||
You are Edgar, CEO of Crimson Leaf Holdings. You just received the portfolio report above.
|
||||
You are Edgar, CEO of Crimson Leaf Holdings.
|
||||
|
||||
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)?
|
||||
The portfolio report above lists every company registered in the system database.
|
||||
Extract the slug of every company EXCEPT "crimson_leaf" (that is the holding company -- us).
|
||||
|
||||
Be concise and data-driven. Flag only what needs human attention.
|
||||
For each issue, format as: "David, [action needed]: [details]"
|
||||
Output ONLY a JSON array of slug strings on a single line. No explanation. No markdown.
|
||||
Example: ["crimson_leaf_publishing","crimson_leaf_marketing","crimson_leaf_research"]
|
||||
|
||||
If everything looks healthy, say so briefly -- don't invent problems.
|
||||
If there are no subsidiary companies, output: []
|
||||
|
||||
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.
|
||||
# Step 2: package the array so foreach can source it
|
||||
- type: package
|
||||
schema: '{"company_slugs": "array"}'
|
||||
hint: |
|
||||
The previous step produced a JSON array of company slugs.
|
||||
Package it as: {"company_slugs": [...array of slug strings...]}
|
||||
|
||||
# Step 3: dispatch a company_review task to the management project of each subsidiary
|
||||
- type: foreach
|
||||
source: company_slugs
|
||||
step:
|
||||
type: tool
|
||||
action: enqueue_strategy
|
||||
optional: true
|
||||
params:
|
||||
company_slug: "{loop.item}"
|
||||
project_slug: "management"
|
||||
task_type: "company_review"
|
||||
content: "Pulse-check: Edgar requesting company review for all active projects."
|
||||
|
||||
# Step 4: brief health summary to Discord
|
||||
- type: think
|
||||
max_tokens: 200
|
||||
output_key: dispatch_target
|
||||
max_tokens: 150
|
||||
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.
|
||||
Write a 2-line status update for the Discord #general channel.
|
||||
Line 1: "Pulse [HEALTHY/ATTENTION/IDLE] -- <N> subsidiaries reviewed"
|
||||
Line 2: one sentence noting anything flagged (failures, idle companies, workers down) or "All systems nominal."
|
||||
Use data from the portfolio report. 2 lines max. 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.
|
||||
Post the 2-line status summary above verbatim. No preamble.
|
||||
|
||||
adjudication:
|
||||
enabled: false
|
||||
Reference in New Issue
Block a user