name: pulse_check description: "Crimson Leaf holding company health scan -- Edgar checks all DB projects 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: # Step 0: pull live data for ALL companies currently in the database - type: tool action: get_portfolio_report output_key: portfolio_data # Step 1: extract flat list of active projects across all subsidiaries - type: think max_tokens: 600 hint: | You are Edgar, CEO of Crimson Leaf Holdings. The portfolio report above lists every company and project registered in the system. Extract every ACTIVE project from every subsidiary company (exclude "crimson_leaf" itself). Exclude any project with status "completed" or "archived". Exclude any project named "management", "incubation", or "model-testing". Output ONLY a JSON array on a single line. Each element must be an object with exactly two keys: "company" (the company slug) and "project" (the project slug). Example: [{"company":"crimson_leaf_publishing","project":"cypress-bend"},{"company":"crimson_leaf_marketing","project":"book-marketing-agency"}] If there are no active projects, output: [] # Step 2: package the array so foreach can source it - type: package schema: '{"projects": [{"company": "string", "project": "string"}]}' hint: | The previous step produced a JSON array like: [{"company":"crimson_leaf_publishing","project":"cypress-bend"},{"company":"crimson_leaf_marketing","project":"book-marketing-agency"}] Wrap the entire array as the "projects" value. Copy ALL items exactly as-is. Output: {"projects": } Every item must keep exactly the "company" and "project" keys as strings. # Step 3: dispatch a project_review task to each active project - type: foreach source: projects step: type: tool action: enqueue_strategy optional: true params: company_slug: "{loop.item.company}" project_slug: "{loop.item.project}" task_type: "project_review" content: "Pulse-check: Edgar requesting project review." # Step 4: brief health summary to Discord - type: think max_tokens: 150 hint: | Write a 2-line status update for Discord. Line 1: "Pulse [HEALTHY/ATTENTION/IDLE] -- projects reviewed" Line 2: one sentence noting anything flagged (failures, idle projects, workers down, cost anomalies -- flag if total_spend_usd_today > $1.00 or any company cost_per_task_usd_30d > $5.00) 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 2-line status summary above verbatim. No preamble. adjudication: enabled: false