Workflow: Capture a Task¶
Realizes: spec_v3.md §1.1 Active Task Capture,
§5.5.1 Natural Language Task Parsing.
Scenario¶
Nick sends a Discord DM to Donna:
"Remind me to review the quarterly plan tomorrow at 10am, high priority."
Donna parses the message, classifies priority, deduplicates against existing tasks, persists the row, schedules reminders, and replies.
Path Through the Code¶
- Inbound.
donna.integrations.discord_botreceiveson_messageand forwards(text, user_id, channel_id)to the orchestrator. - Orchestrator intent routing.
donna.orchestratoridentifies this as a task-capture intent and invokes theparse_taskskill. - Skill execution.
donna.skills.executor.SkillExecutorruns the YAML-definedparse_taskskill step-by-step. - Model call.
donna.models.router.ModelRouter.completeroutes to the configured model fortask_parse(seeconfig/donna_models.yaml) and logs an invocation row viadonna.logging.invocation_logger. - Schema validation. The structured output is validated against
schemas/task_parse_output.json. - Dedup.
donna.skillsruns thededup_checkskill (spec_v3.md §5.3— fuzzy title match + LLM semantic comparison). - State machine.
donna.tasks.state_machinetransitions the new task toSCHEDULEDperconfig/task_states.yaml. - Persist.
donna.tasks.databasewrites the row;donna.integrations.supabase_syncmirrors it. - Schedule.
donna.schedulingenqueues reminder cadence (T-24h, T-1h, T). - Reply. The Discord bot confirms back to the user.
Sequence¶
sequenceDiagram
participant U as User
participant D as discord_bot
participant O as orchestrator
participant S as SkillExecutor
participant R as ModelRouter
participant V as schema validator
participant DB as tasks.database
participant SC as scheduling
U->>D: DM text
D->>O: route(text, user_id)
O->>S: run(parse_task, text)
S->>R: complete(prompt, "task_parse", user_id)
R-->>S: structured JSON
S->>V: validate(task_parse_output)
V-->>S: ok
S->>S: run(dedup_check, parsed)
S-->>O: Task
O->>DB: INSERT tasks WHERE user_id=?
O->>SC: enqueue reminders
O-->>D: confirmation text
D-->>U: reply
Observability¶
Every hop emits a structured log line with correlation_id, user_id,
task_id. See Domain → Observability.