# SPDX-License-Identifier: Apache-2.0
# © SuperNovae Studio · nika.sh/library
nika: v1
workflow:
  id: daily-brief
# local model · your notes never leave
model: ollama/llama3.2:3b

# the file IS the blast radius
permits:
  fs: { read: [ ./notes/* ], write: [ ./brief.md ] }
  tools: [ "nika:read", "nika:write" ]

tasks:
  notes: { invoke: { tool: "nika:read", args: { path: ./notes/today.md } } }
  inbox: { invoke: { tool: "nika:read", args: { path: ./notes/inbox.md } } }
  calendar: { invoke: { tool: "nika:read", args: { path: ./notes/calendar.md } } }

  triage:
    with:
      inbox: ${{ tasks.inbox.output }}
    infer: { prompt: "Flag what is urgent: ${{ with.inbox }}", max_tokens: 300 }
  agenda:
    with:
      calendar: ${{ tasks.calendar.output }}
    infer: { prompt: "Plan the day around: ${{ with.calendar }}", max_tokens: 300 }

  draft:
    with:
      notes: ${{ tasks.notes.output }}
      triage: ${{ tasks.triage.output }}
      agenda: ${{ tasks.agenda.output }}
    infer:
      prompt: "Write the morning brief. Notes: ${{ with.notes }} Urgent: ${{ with.triage }} Plan: ${{ with.agenda }}"
      max_tokens: 500

  save:
    with:
      draft: ${{ tasks.draft.output }}
    invoke:
      tool: "nika:write"
      args: { path: ./brief.md, content: "${{ with.draft }}" }

outputs:
  brief: "${{ tasks.draft.output }}"
