> ## 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.

# Release radar

> T2 chain · devops: dependency release feeds diffed against last run · only the NEW ships reach you.

> **T2 chain · devops / dependency hygiene**: `mode: feed` parses
> RSS/Atom natively, and the **state-file pattern** (read last run →
> diff → write next state) means you only hear about what's new.

## The job

« Did anything we depend on ship this week? » Checking releases pages
is a robot's job. This workflow reads the Atom feed, diffs it against
what it saw last run (RFC 6902: empty patch means silence), digests
only the new entries, and saves the state for next time. First run?
The missing state file recovers to an empty list.

## The shape

```mermaid theme={"system"}
flowchart TD
  approve["approve · nika:prompt"]:::invoke
  no_state["no_state · nika:jq"]:::invoke
  previous["previous · nika:read"]:::invoke
  feed["feed · nika:fetch"]:::invoke
  previous_parsed["previous_parsed · nika:jq"]:::invoke
  fresh["fresh · nika:json_diff"]:::invoke
  digest["digest"]:::infer
  save_state["save_state · nika:write"]:::invoke
  approve --> no_state
  approve --> previous
  approve --> feed
  previous --> previous_parsed
  approve --> fresh
  previous_parsed --> fresh
  feed --> fresh
  approve --> digest
  fresh --> digest
  feed --> digest
  approve --> save_state
  feed --> save_state
  classDef infer fill:#5b8cff22,stroke:#5b8cff,color:#5b8cff
  classDef invoke fill:#22d3ee22,stroke:#22d3ee,color:#22d3ee
```

## The file

```yaml release-radar.nika theme={"system"}
nika: release-radar

model: ollama/qwen3.5:4b   # local · zero key · swap for any provider in the catalog

const:
  releases_feed: "https://github.com/tokio-rs/tokio/releases.atom"
  state_path: "out/release-radar.json"
permits:
  tools: ["nika:fetch", "nika:jq", "nika:json_diff", "nika:prompt", "nika:read", "nika:write"]
  net:
    http: ["github.com"]   # the feed's host · net entries are exact names, never globs
  fs:
    # The state-file pattern touches exactly ONE path, on both sides: read
    # last run's state, write the next. `const.state_path` names it and a run
    # cannot move a const, so the same literal is the whole boundary —
    # `create_dirs:` makes out/ underneath it on the first run.
    read: ["out/release-radar.json"]
    write: ["out/release-radar.json"]

tasks:
  # The human gate first (NIKA-SEC-009 · NEP-0002, the Rule of Two as a
  # static check). This boundary permits all three legs — private read
  # (the state file) + untrusted ingress (the release feed) + egress
  # (the state write) — so a blocking prompt (no default:) dominates the
  # flow before a byte moves. Headless surfaces pause durably and resume
  # with `--resume <trace> --answer approve=true`.
  approve:
    invoke:
      tool: "nika:prompt"
      args:
        message: "This run fetches ${{ const.releases_feed }}, diffs against ${{ const.state_path }}, and rewrites that state file. Proceed?"

  # First run has no state file · recover to an empty list.
  no_state:
    with:
      go: ${{ tasks.approve.output }}
    when: ${{ with.go == true }}
    invoke:
      tool: "nika:jq"
      args: { input: [], expression: "." }

  previous:
    with:
      go: ${{ tasks.approve.output }}
    when: ${{ with.go == true }}
    invoke:
      tool: "nika:read"
      args: { path: "${{ const.state_path }}" }
    on_error:
      on_codes: [NIKA-BUILTIN-READ-001]   # not-found ONLY · a permission error still fails loudly
      recover: ${{ tasks.no_state.output }}

  feed:
    with:
      go: ${{ tasks.approve.output }}
    when: ${{ with.go == true }}
    invoke:
      tool: "nika:fetch"
      args:
        url: "${{ const.releases_feed }}"
        mode: feed
    extract:
      entries: "[.items[] | {title, link}]"
    on_error:
      # No network → this sample stands in for the RAW feed response: it
      # carries `items:` under the keys `mode: feed` actually returns
      # (probed live on this feed: title · link · id · author · content —
      # there is no `published` field), so the `extract:` jq above runs over
      # it unchanged. Recovering the BINDING's shape instead makes the jq
      # throw NIKA-VAR-004 — the recovery must mirror the response, never
      # the binding.
      recover:
        items:
          - { title: "tokio 1.48.0", link: "https://github.com/tokio-rs/tokio/releases/tag/tokio-1.48.0" }
          - { title: "tokio 1.47.1", link: "https://github.com/tokio-rs/tokio/releases/tag/tokio-1.47.1" }

  # `nika:read` hands back a STRING — a file is text until you parse it.
  # Measured: diffing the unparsed read against the entries array emits ONE
  # whole-document `replace` op at path "" on every run after the first,
  # so everything is reported as new, forever. The first-run recovery is
  # already an array; the guard keeps both shapes.
  previous_parsed:
    with:
      previous: ${{ tasks.previous.output }}
    invoke:
      tool: "nika:jq"
      args:
        input: "${{ with.previous }}"
        expression: 'if type == "string" then fromjson else . end'

  fresh:
    with:
      go: ${{ tasks.approve.output }}
      previous: ${{ tasks.previous_parsed.output }}
      entries: ${{ tasks.feed.entries }}
    when: ${{ with.go == true }}
    invoke:
      tool: "nika:json_diff"
      args:
        before: "${{ with.previous }}"
        after: "${{ with.entries }}"

  digest:
    with:
      go: ${{ tasks.approve.output }}
      fresh: ${{ tasks.fresh.output }}
      entries: ${{ tasks.feed.entries }}
    when: ${{ with.go == true && size(with.fresh) > 0 }}
    infer:
      # a reasoning model needs 16384 here, or a documented run.reasoning.effort: low
      max_tokens: 500
      prompt: |
        New releases appeared on our dependency radar (RFC 6902 patch
        against last run) ·
        ${{ with.fresh }}
        Full current feed · ${{ with.entries }}
        Write 3 bullets · what shipped · whether it looks breaking ·
        what to check in our code.

  save_state:
    with:
      go: ${{ tasks.approve.output }}
      entries: ${{ tasks.feed.entries }}
    when: ${{ with.go == true }}
    invoke:
      tool: "nika:write"
      args:
        path: "${{ const.state_path }}"
        content: "${{ with.entries }}"
        create_dirs: true
        overwrite: true

outputs:
  new_entries:
    value: ${{ tasks.fresh.output }}
    description: "RFC 6902 ops · empty = nothing new since last run"
  # Untyped on purpose: `digest` is `when:`-gated, so on a quiet week it is
  # SKIPPED and this reads null. Exporting it is also what keeps those tokens
  # from being dead spend — an infer whose output nothing consumes is paid for
  # and thrown away, and `check` says so.
  briefing: ${{ tasks.digest.output }}
```

## How it works

**1. feed mode does the parsing**

`mode: feed` turns RSS/Atom into structured items: no scraping,
no XML wrangling. The `extract:` binding keeps just title/url/date.

**2. State makes it incremental**

`previous` reads the state file (recovering to `[]` on first run) ·
`nika:json_diff` against the fresh feed yields ONLY the new
entries · `save_state` overwrites for next time.

**3. Silence is the feature**

The digest runs `when: size(...) > 0`: nothing new, no model
call, no noise. Schedule it daily and forget it.

## Constructs you just used

| Construct | Where | Reference |
| - | - | - |
| `nika:fetch` `mode: feed` | `feed` | [Builtins](https://docs.nika.sh/reference/builtins.md) |
| state-file pattern | `previous` · `save_state` | [Bindings](https://docs.nika.sh/concepts/bindings.md) |
| `nika:json_diff` (RFC 6902) | `fresh` | [Builtins](https://docs.nika.sh/reference/builtins.md) |
| `on_error: recover:` first-run | `previous` | [Error model](https://docs.nika.sh/reference/error-codes.md) |

## Run it

> [!NOTE]
>
> **What it needs:** Network access to `github.com` for the feed, and a local model ([Ollama](https://ollama.com) serving `qwen3.5:4b`) for the digest.

**1. Rehearse it**

```bash theme={"system"}
nika try release-radar
```

A mock model answers and nothing is written in your folder. Its network fetches still go out: a rehearsal replaces the model, not the tools. Before it runs, `nika try` names those hosts: `may reach: github.com — the mock replaces the model, not the network`. It stops at the `approve` gate, as a real run does.

**2. Get your own copy**

Save the file above as `release-radar.nika` in a new folder. It reads no sample file.

**3. Check it, then run it**

```bash theme={"system"}
nika check release-radar.nika
nika run release-radar.nika --model mock/echo   # a mock model, no key
ollama pull qwen3.5:4b   # once, for the real run
nika run release-radar.nika
```

The run writes the state file `out/release-radar.json`.

It asks at the `approve` gate before anything else runs. On a terminal you answer; in a script it pauses (exit 4) and prints the `--resume` line that continues it, or you answer up front with `--answer approve=true`.

Any other model works: pass `--model <provider>/<name>` with its key, and cap a cloud model with `--max-cost-usd`.

Run it twice: the first run reports every entry as new and writes the state, the second reports only what shipped in between.

## Make it yours

* Watch N dependencies: lift the feed URL into a list and `for_each` the fetch ([Competitor radar](https://docs.nika.sh/examples/competitor-radar.md) shows the leash).
* Pipe breaking-change suspects into [PR review fan-out](https://docs.nika.sh/examples/pr-review-fanout.md)'s reviewer prompt.
* Swap the feed for your vendor's changelog RSS. The shape doesn't change.

> [card] [Next · Resume screener](https://docs.nika.sh/examples/resume-screener.md)
>
> PII never leaves the machine: a local-model rubric per candidate,
> ranked deterministically.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.