/cronjob
Cosa fa. Crea un’attività automatica, pianificata o attivata da un alert.
Quando usarlo. Per automatizzare controlli e riepiloghi ricorrenti.
Argomenti. TASK DESCRIPTION
Esempio. /cronjob ogni mattina mandami il riepilogo del portafoglio
Cosa restituisce. La conferma del job creato (pianificazione e azione).
Come funziona
Sezione intitolata “Come funziona”Quando lanci /cronjob, Dexter non esegue codice fisso: invia all’AI la prompt qui sotto — il segnaposto {arg} viene sostituito con ciò che scrivi dopo il comando — e l’agente la esegue chiamando da sé gli strumenti necessari. Vedi Come funzionano i comandi per le convenzioni comuni (chiamate in parallelo, anti-allucinazione, fasi, widget di chiusura).
Strumenti che può usare: create_user_alert, cron, get_stock_performance, get_technical_indicators.
Prompt completa
Sezione intitolata “Prompt completa”È la prompt esatta inviata all’AI quando usi il comando (sostituendo {arg}).
User wants an automated job: "{arg}"If "{arg}" is empty or literally "{arg}", respond:"Usage: /cronjob <description>Examples:- /cronjob NVDA every morning at 9:30 — alert me if it moves >3% overnight- /cronjob check my portfolio every Monday- /cronjob when alerts #42 and #15 fire for NVDA, do full technical analysis"Stop if empty.
--- STEP 1: CLASSIFY ---A) ALERT-TRIGGERED: job fires only when specific alerts trigger. Signals: "alert #X", "when alert fires", "linked to alert", "when NVDA hits $X do Y". → Go to STEP 2A then STEP 5.B) TIME-BASED: recurring job on a schedule. → Go to STEP 2B, STEP 3, STEP 4.
--- STEP 2A: ALERT-TRIGGERED ---Extract all mentioned alert IDs (#42, "alert 42"). If mentioned as condition ("NVDA at $150"), call create_user_alert, grab the returned ID.Build the message: what the agent must do on fire. Include which tools to call and what action to take. Do NOT include __HEARTBEAT_OK__ — alert-triggered jobs always have something to report.Schedule = { kind: "every", everyMs: 0 } (sentinel: fires only via alert webhook).fulfillment = 'once' for single action, 'keep' for ongoing monitoring.Do NOT set activeHours. Do NOT set triggerAlertIds separately — already handled.
--- STEP 2B: PARSE TIME-BASED ---Extract from description: WHAT to monitor, WHEN, and CONDITION.Natural time mapping → schedule (default if ambiguous: everyMs: 300000, fulfillment='once'): "every morning" → cron "30 9 * * 1-5" tz America/New_York "every hour" → everyMs: 3600000 "every day" → cron "0 10 * * 1-5" tz America/New_York "every Monday" / "every week" → cron "0 9 * * 1" tz America/New_York "once when X" → everyMs: 300000, fulfillment='once'ONE-TIME: "alert me once", "when X hits Y" → fulfillment='once'. Otherwise → 'keep'.
--- STEP 3: CONTEXT & MESSAGE (time-based) ---If a specific ticker is involved, call in parallel: • get_stock_performance → price, RSI, 1D/1W • get_technical_indicators (limit=1) → MACD, SMA20, SMA50Use real data for concrete numeric thresholds in message. E.g. "alert if price > $X (current + 5%)" not "alert if it moved a lot".The `message` is self-contained. Must specify: tools to call, exact condition with thresholds, what to report if true.Mandatory final line: "If the condition is NOT met, respond with exactly: __HEARTBEAT_OK__"Example: "Call get_stock_performance for NVDA. If 1D change > +3% or < -3%, report ticker, price, % change, gap direction. If NOT met: __HEARTBEAT_OK__"
--- STEP 4: ACTIVE HOURS (time-based) ---For stock/market jobs: activeHours = { start: "09:00", end: "16:30", timezone: "America/New_York", daysOfWeek: [1,2,3,4,5] }For portfolio/news/macro jobs: same unless specified otherwise.If cron expression already has time, omit activeHours.For alert-triggered: omit activeHours.
--- STEP 5: CREATE JOB ---Call `cron` with action='add': - name: short label (<40 chars), in user's language - description: 1-sentence summary - schedule: as from STEP 2A/2B - message: as from STEP 2A/STEP 3 - fulfillment: 'once' or 'keep' - activeHours: as from STEP 4 (omit for alert-triggered and pre-timed cron) - triggerAlertIds: [id1, id2] — ONLY for alert-triggered
--- STEP 6: CONFIRM ---✅ **Job created: <name>**- Schedule: <human-readable, or "on alert #X firing">- Condition: <trigger>- Mode: <One-time / Recurring / Alert-triggered>- Next run: <timestamp or "on next alert fire">
If anything is ambiguous, ask ONE clarifying question before proceeding.