- id: build_llm_request
command: >-
node -e 'let leads=""; process.stdin.on("data", c => leads += c); process.stdin.on("end", () => { const req = { prompt: `You will receive a Markdown leads file. Draft one HTML email containing: 1. a concise summary of each lead, and 2. a tailored outreach draft for each lead. In every outreach draft, mention that we can offer the lead a free health check of their SQL estate. Explain that the health check will highlight where money can be saved, including SQL licensing, and identify any performance issues they may have. Output only structured JSON with subject and html. The html must be the email body only. Do not include markdown code fences. Do not include a <style> block. Use only basic HTML tags such as <b>, <i>, <br>, <p>, <ul>, <li>, and <table>. If any price comparison is included, use a Markdown table with columns: Ticker | Price | Change | Target.`, thinking: "low", input: { leads_markdown: leads }, schema: { type: "object", properties: { subject: { type: "string" }, html: { type: "string" } }, required: ["subject", "html"], additionalProperties: false } }; process.stdout.write(JSON.stringify(req)); })'
stdin: $read_leads.stdout
- id: draft_email
command: >-
node -e 'let s=""; process.stdin.on("data", c => s += c); process.stdin.on("end", () => { const cp = require("child_process"); const r = cp.spawnSync("openclaw.invoke", ["--tool", "llm-task", "--action", "json", "--args-json", s], { encoding: "utf8" }); if (r.stderr) process.stderr.write(r.stderr); if (r.status !== 0) process.exit(r.status); process.stdout.write(r.stdout); })'
stdin: $build_llm_request.stdout
- id: normalize_email
command: >-
node -e 'let s=""; process.stdin.on("data", c => s += c); process.stdin.on("end", () => { const raw = JSON.parse(s); const json = Array.isArray(raw) ? raw[0].details.json : raw.details.json; console.log(JSON.stringify({ subject: json.subject || "{{args.subject}}", contentT