|
| 1 | +--- |
| 2 | +name: schedule-task |
| 3 | +description: "Create, update, list, or run scheduled tasks (one-off actions). Schedule a skill, prompt, or script to run at a specific date/time without creating a full routine. Use when user says 'schedule this for', 'run this at', 'agendar para', 'roda isso amanha', 'post this on Friday at 10am', 'schedule a task', or any reference to one-off scheduled actions." |
| 4 | +metadata: |
| 5 | + author: openclaude |
| 6 | + version: "1.0" |
| 7 | +--- |
| 8 | + |
| 9 | +# Schedule Task — One-Off Scheduled Actions |
| 10 | + |
| 11 | +Create and manage one-off scheduled tasks that run at a specific date/time. Unlike routines (which repeat on cron), scheduled tasks execute once and are done. |
| 12 | + |
| 13 | +## When to Use |
| 14 | + |
| 15 | +- User wants to schedule something for a specific time: "posta no LinkedIn sexta 10h" |
| 16 | +- User wants to run a report later: "roda o financial pulse amanha as 8h" |
| 17 | +- User says "agenda pra", "schedule this for", "run at", "agendar tarefa" |
| 18 | +- User wants to list or manage pending tasks: "quais tarefas agendadas?" |
| 19 | + |
| 20 | +## API Reference |
| 21 | + |
| 22 | +The dashboard backend exposes these endpoints: |
| 23 | + |
| 24 | +| Method | Endpoint | Action | |
| 25 | +|--------|----------|--------| |
| 26 | +| GET | `/api/tasks` | List tasks (query: `?status=pending\|running\|completed\|failed`) | |
| 27 | +| POST | `/api/tasks` | Create a new task | |
| 28 | +| GET | `/api/tasks/<id>` | Get task details | |
| 29 | +| PUT | `/api/tasks/<id>` | Edit a pending task | |
| 30 | +| DELETE | `/api/tasks/<id>` | Cancel (pending) or delete (completed/failed) | |
| 31 | +| POST | `/api/tasks/<id>/run` | Execute immediately | |
| 32 | + |
| 33 | +## Task Types |
| 34 | + |
| 35 | +| Type | Payload | When to Use | |
| 36 | +|------|---------|-------------| |
| 37 | +| `skill` | Skill name + args (e.g. `social-post-writer LinkedIn post about X`) | Running a Claude skill | |
| 38 | +| `prompt` | Free-form prompt text | Running a raw Claude prompt | |
| 39 | +| `script` | Script path relative to `ADWs/routines/` (e.g. `custom/financial_pulse.py`) | Running an existing routine script | |
| 40 | + |
| 41 | +## Agents |
| 42 | + |
| 43 | +| Agent ID | Short Name | |
| 44 | +|----------|------------| |
| 45 | +| `clawdia-assistant` | @clawdia | |
| 46 | +| `flux-financeiro` | @flux | |
| 47 | +| `atlas-project` | @atlas | |
| 48 | +| `kai-personal-assistant` | @kai | |
| 49 | +| `pulse-community` | @pulse | |
| 50 | +| `sage-strategy` | @sage | |
| 51 | +| `pixel-social-media` | @pixel | |
| 52 | +| `nex-comercial` | @nex | |
| 53 | +| `mentor-courses` | @mentor | |
| 54 | + |
| 55 | +## Workflow |
| 56 | + |
| 57 | +### Creating a Task |
| 58 | + |
| 59 | +1. **Understand the request** — extract what, when, and how: |
| 60 | + - **What:** the action to perform |
| 61 | + - **When:** date + time (convert relative dates like "amanha", "sexta" to absolute ISO 8601 in UTC) |
| 62 | + - **Type:** skill, prompt, or script |
| 63 | + - **Agent:** which agent should handle it (if applicable) |
| 64 | + |
| 65 | +2. **Confirm with user** — show a summary before creating: |
| 66 | + ``` |
| 67 | + Agendar: |
| 68 | + - Nome: Post LinkedIn sobre Evolution Summit |
| 69 | + - Tipo: skill |
| 70 | + - Payload: social-post-writer LinkedIn post about Evolution Summit April 14-16 |
| 71 | + - Agent: @pixel |
| 72 | + - Quando: 2026-04-11 13:00 (BRT) |
| 73 | + |
| 74 | + Confirma? |
| 75 | + ``` |
| 76 | + |
| 77 | +3. **Create via API:** |
| 78 | + |
| 79 | +```bash |
| 80 | +curl -s -X POST http://localhost:8080/api/tasks \ |
| 81 | + -H "Content-Type: application/json" \ |
| 82 | + -b "session=..." \ |
| 83 | + -d '{ |
| 84 | + "name": "Post LinkedIn sobre Evolution Summit", |
| 85 | + "description": "LinkedIn post promoting the Evolution Summit event", |
| 86 | + "type": "skill", |
| 87 | + "payload": "social-post-writer LinkedIn post about Evolution Summit April 14-16", |
| 88 | + "agent": "pixel-social-media", |
| 89 | + "scheduled_at": "2026-04-11T16:00:00Z" |
| 90 | + }' |
| 91 | +``` |
| 92 | + |
| 93 | +**Important:** Convert BRT times to UTC by adding 3 hours. The user's timezone is America/Sao_Paulo (UTC-3). |
| 94 | + |
| 95 | +### Listing Tasks |
| 96 | + |
| 97 | +```bash |
| 98 | +# All pending tasks |
| 99 | +curl -s http://localhost:8080/api/tasks?status=pending -b "session=..." |
| 100 | + |
| 101 | +# All tasks |
| 102 | +curl -s http://localhost:8080/api/tasks -b "session=..." |
| 103 | +``` |
| 104 | + |
| 105 | +Present as a clean table: |
| 106 | +``` |
| 107 | +ID | Nome | Tipo | Agendado | Status |
| 108 | +---|-------------------------------|-------|-----------------|-------- |
| 109 | +1 | Post LinkedIn Summit | skill | 11/04 13:00 BRT | pending |
| 110 | +2 | Financial Weekly extra | script| 12/04 08:00 BRT | completed |
| 111 | +``` |
| 112 | + |
| 113 | +### Running Now |
| 114 | + |
| 115 | +If user wants to execute immediately: |
| 116 | +```bash |
| 117 | +curl -s -X POST http://localhost:8080/api/tasks/<id>/run -b "session=..." |
| 118 | +``` |
| 119 | + |
| 120 | +### Cancelling |
| 121 | + |
| 122 | +```bash |
| 123 | +curl -s -X DELETE http://localhost:8080/api/tasks/<id> -b "session=..." |
| 124 | +``` |
| 125 | + |
| 126 | +## Date Parsing Rules |
| 127 | + |
| 128 | +The user speaks Portuguese. Common patterns: |
| 129 | +- "amanha as 10h" → tomorrow at 10:00 BRT → +1 day, 13:00 UTC |
| 130 | +- "sexta 15h" → next Friday at 15:00 BRT → Friday 18:00 UTC |
| 131 | +- "segunda de manha" → next Monday at 09:00 BRT → Monday 12:00 UTC |
| 132 | +- "hoje a noite" → today at 21:00 BRT → today 00:00+1 UTC |
| 133 | +- "daqui 2 horas" → now + 2 hours |
| 134 | + |
| 135 | +Always confirm the parsed date with the user before creating. |
| 136 | + |
| 137 | +## Examples |
| 138 | + |
| 139 | +### "Agenda um post no LinkedIn pra sexta as 10h sobre o Summit" |
| 140 | +```json |
| 141 | +{ |
| 142 | + "name": "Post LinkedIn — Evolution Summit", |
| 143 | + "type": "skill", |
| 144 | + "payload": "social-post-writer LinkedIn post about Evolution Summit April 14-16, 2026", |
| 145 | + "agent": "pixel-social-media", |
| 146 | + "scheduled_at": "2026-04-10T13:00:00Z" |
| 147 | +} |
| 148 | +``` |
| 149 | + |
| 150 | +### "Roda o community pulse amanha as 8h" |
| 151 | +```json |
| 152 | +{ |
| 153 | + "name": "Community Pulse (manual)", |
| 154 | + "type": "script", |
| 155 | + "payload": "custom/community_daily.py", |
| 156 | + "agent": null, |
| 157 | + "scheduled_at": "2026-04-10T11:00:00Z" |
| 158 | +} |
| 159 | +``` |
| 160 | + |
| 161 | +### "Manda um resumo pro Telegram amanha 14h com status dos projetos" |
| 162 | +```json |
| 163 | +{ |
| 164 | + "name": "Resumo projetos via Telegram", |
| 165 | + "type": "prompt", |
| 166 | + "payload": "Check the status of all active projects (Evo AI, Evolution Summit, Evo Academy) and send a summary via Telegram to Davidson", |
| 167 | + "agent": "atlas-project", |
| 168 | + "scheduled_at": "2026-04-10T17:00:00Z" |
| 169 | +} |
| 170 | +``` |
| 171 | + |
| 172 | +## Important Notes |
| 173 | + |
| 174 | +- Tasks are one-off. For recurring actions, use `create-routine` skill instead. |
| 175 | +- The scheduler checks for pending tasks every 30 seconds. |
| 176 | +- Tasks run in background threads — they won't block the scheduler. |
| 177 | +- Results are saved in `result_summary` and visible in the dashboard at `/tasks`. |
| 178 | +- Always confirm with the user before creating a task. |
| 179 | +- Convert all times from BRT (UTC-3) to UTC before sending to the API. |
0 commit comments