> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nika.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# CEO Monday brief

> T4 epic · founders — market + engineering + KPIs synthesized, and the ping tells you what the run cost.

> **T4 epic · founders / executives** — the flagship. Three branches
> gather in parallel (web signal, repo pulse, the KPI sheet), jq does
> the revenue arithmetic, a thinking model writes the brief — and
> `nika:inspect view: cost` puts the run's own bill in the ping.
> A workflow that reports what it cost you is a workflow you trust on
> a schedule.

## The job

Monday needs one page: market, product, numbers, risks, the ONE
decision. Assembling it eats an hour of founder time. This file
assembles it before you wake — dated filename, summed revenue, and a
webhook ping ending in `run cost $0.14`.

## The shape

```mermaid theme={"system"}
flowchart TD
  news["news · nika:fetch"]:::invoke
  pulse["pulse · git"]:::exec
  kpi_raw["kpi_raw · nika:read"]:::invoke
  kpis["kpis · nika:convert"]:::invoke
  revenue["revenue · nika:jq"]:::invoke
  brief["brief · thinking"]:::infer
  stamp["stamp · nika:date"]:::invoke
  save["save · nika:write"]:::invoke
  bill["bill · nika:inspect"]:::invoke
  ping["ping · nika:notify"]:::invoke
  kpi_raw --> kpis
  kpis --> revenue
  news --> brief
  pulse --> brief
  kpis --> brief
  revenue --> brief
  brief --> save
  stamp --> save
  save --> bill
  bill --> ping
  stamp --> ping
  classDef infer fill:#5b8cff22,stroke:#5b8cff,color:#5b8cff
  classDef exec fill:#ff7a3c22,stroke:#ff7a3c,color:#ff7a3c
  classDef invoke fill:#22d3ee22,stroke:#22d3ee,color:#22d3ee
```

## The file

```yaml t4-ceo-monday-brief.nika.yaml theme={"system"}
nika: v1
workflow: ceo-monday-brief
description: "news + repo pulse + KPIs → thinking synthesis → dated brief + cost ping"

model: mistral/mistral-large

vars:
  watch_query: "AI workflow engines"
  kpi_csv: "./finance/kpis.csv"

secrets:
  founders_webhook:
    source: env
    key: FOUNDERS_WEBHOOK_URL
    egress:                       # sanction the one send · the secret IS the URL
      - to: "nika:notify"
        host_from_self: true

tasks:
  # ── branch 1 · market signal ──
  - id: news
    invoke:
      tool: "nika:fetch"
      args:
        url: "https://hn.algolia.com/api/v1/search?query=${{ vars.watch_query }}"
        mode: jq
        jq: ".hits[:10] | map(.title)"

  # ── branch 2 · engineering pulse ──
  - id: pulse
    exec:
      command: "git shortlog -sn --since='1 week ago'"

  # ── branch 3 · the numbers ──
  - id: kpi_raw
    invoke:
      tool: "nika:read"
      args: { path: "${{ vars.kpi_csv }}" }

  - id: kpis
    depends_on: [kpi_raw]
    invoke:
      tool: "nika:convert"
      args:
        input: "${{ tasks.kpi_raw.output }}"
        from: csv
        to: json
        has_header: true

  - id: revenue
    depends_on: [kpis]
    invoke:
      tool: "nika:jq"
      args:
        input: "${{ tasks.kpis.output }}"
        expression: "map(.weekly_revenue | tonumber) | add"

  # ── synthesis · with a thinking budget ──
  - id: brief
    depends_on: [news, pulse, kpis, revenue]
    infer:
      model: anthropic/claude-sonnet-4-6   # per-task override · thinking budget
      prompt: |
        Market signal · ${{ tasks.news.output }}
        Engineering pulse · ${{ tasks.pulse.output }}
        KPIs · ${{ tasks.kpis.output }}
        Revenue (summed) · ${{ tasks.revenue.output }}

        Write my Monday brief · 5 sections · market · product ·
        numbers · risks · the ONE decision this week needs.
      thinking:
        enabled: true
        budget_tokens: 10000

  - id: stamp
    invoke:
      tool: "nika:date"
      args: { op: now }
    output:
      day: ".iso[:10]"               # YYYY-MM-DD from the ISO timestamp

  - id: save
    depends_on: [brief, stamp]
    invoke:
      tool: "nika:write"
      args:
        path: "./briefs/${{ tasks.stamp.day }}-monday.md"
        content: "${{ tasks.brief.output }}"
        create_dirs: true

  # ── the run reports its own bill ──
  - id: bill
    depends_on: [save]
    invoke:
      tool: "nika:inspect"
      args: { view: cost }

  - id: ping
    depends_on: [bill, stamp]
    invoke:
      tool: "nika:notify"
      args:
        channel: webhook
        target: "${{ secrets.founders_webhook }}"
        message: "Monday brief ready · briefs/${{ tasks.stamp.day }}-monday.md · run cost $${{ tasks.bill.output.total_usd }}"
        severity: info
    on_finally:
      - invoke:
          tool: "nika:emit"
          args:
            event_type: "brief.monday.run"
            payload:
              day: "${{ tasks.stamp.day }}"

outputs:
  brief: ${{ tasks.brief.output }}
  cost_usd: ${{ tasks.bill.output.total_usd }}
```

## How it works

<Steps>
  <Step title="Three branches, zero coordination code">
    News (HN API through `mode: jq`), engineering pulse (`git shortlog`)
    and the KPI sheet (read → convert → jq `add`) run concurrently. The
    revenue sum is jq arithmetic — deterministic, not model-guessed.
  </Step>

  <Step title="Dates come from a builtin">
    `nika:date` + the `.iso[:10]` binding stamp the filename
    `briefs/2026-06-15-monday.md`. Never let a model guess the date.
  </Step>

  <Step title="The run reports its own bill">
    `nika:inspect view: cost` returns `{total_usd, by_task, by_provider}`
    — the ping interpolates it. Cost-aware automation is automation you
    can leave running.
  </Step>
</Steps>

## Constructs you just used

| Construct                      | Where                        | Reference                        |
| ------------------------------ | ---------------------------- | -------------------------------- |
| 3-branch parallel gather       | `news` · `pulse` · `kpi_raw` | [Workflows](/concepts/workflows) |
| jq arithmetic (`add`)          | `revenue`                    | [Builtins](/reference/builtins)  |
| `nika:inspect view: cost`      | `bill`                       | [Builtins](/reference/builtins)  |
| `output:` binding on a builtin | `stamp`                      | [Bindings](/concepts/bindings)   |

## Make it yours

* Add a fourth branch: support sentiment from [Support triage](/examples/support-triage)'s board file.
* Keep a budget: follow `bill` with `nika:assert` on `total_usd < 1` — the brief refuses to overspend.
* Archive the history: the dated files under `briefs/` are already your decision journal.

<Card title="Back to all examples" icon="rocket" href="/examples/overview">
  You've climbed the whole ladder — starter to epic. Time to write
  yours.
</Card>
