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

# Resume screener

> T3 fan-out · HR: a local-model rubric per candidate, ranked deterministically. PII never leaves the machine.

> **T3 fan-out · HR / recruiting**: CVs are PII, so the **whole
> screen runs on a local model**. One schema-enforced rubric for every
> candidate (enums kill « kinda-strong »), evidence quotes required,
> and the ranking is jq: deterministic, not model mood.

## The job

Forty CVs and a Friday deadline means the rubric drifts by CV #12.
Here glob discovers the pool, every candidate gets the SAME typed
rubric (fit enum, evidence quotes mandatory), two at a time so the
GPU breathes, weak fits drop, and jq sorts strong-first then by
relevant years. The shortlist brief quotes its evidence.

## The shape

```mermaid theme={"system"}
flowchart TD
  pool["pool · nika:glob"]:::invoke
  cvs["cvs · ∥ for_each · nika:read"]:::invoke
  pairs["pairs · nika:jq"]:::invoke
  screened["screened · ∥ for_each · typed"]:::infer
  ranked["ranked · nika:jq"]:::invoke
  shortlist["shortlist · nika:jq"]:::invoke
  brief["brief"]:::infer
  save["save · nika:write"]:::invoke
  pool --> cvs
  pool --> pairs
  cvs --> pairs
  pairs --> screened
  screened --> ranked
  ranked --> shortlist
  shortlist --> brief
  brief --> save
  classDef infer fill:#5b8cff22,stroke:#5b8cff,color:#5b8cff
  classDef invoke fill:#22d3ee22,stroke:#22d3ee,color:#22d3ee
```

## The file

```yaml resume-screener.nika theme={"system"}
nika: resume-screener

model: ollama/qwen3.5:4b   # PII stays on the machine · the whole screen is offline

const:
  role: "Senior Rust engineer"
  shortlist_size: 5
  # The committed rehearsal inbox. Point this at ./hiring/inbox (or wherever
  # your exports land) and change `permits.fs.read` to match, same edit.
  cv_glob: "./examples/fixtures/cvs/*.md"

permits:
  tools: ["nika:glob", "nika:jq", "nika:read", "nika:write"]
  # NO `net:` category. That absence is the whole sovereignty claim: with no
  # host granted, a CV that talks the model into exfiltrating itself still
  # has nowhere to go — the boundary refuses before the request is made.
  fs:
    # TWO entries, and both earn their place. `nika:glob` opens the ROOT of
    # its pattern before it lists anything, and a directory grant does not
    # cover its children while a child grant does not cover the directory —
    # so each is named. Measured: with only the second line, the run dies
    # `NIKA-SEC-004 · ./examples/…/cvs resolves outside permits.fs.read`
    # before a single CV is read.
    #
    # `*` is one segment and never crosses `/`, which is the right width
    # here: CVs land flat in the inbox. `cvs/**` would also work and would
    # additionally hand over every sub-tree someone drops in there.
    read:
      - "./examples/fixtures/cvs"      # the directory the glob opens
      - "./examples/fixtures/cvs/*"    # the CVs one level inside it
    # One brief, one path. Nothing else on this machine is writable by this
    # workflow — not `./hiring/**`, not a sibling of the brief.
    write: ["./hiring/shortlist-brief.md"]

tasks:
  # ── the pool is discovered at runtime · the count is never written down ──
  pool:
    invoke:
      tool: "nika:glob"
      args: { pattern: "${{ const.cv_glob }}" }

  cvs:
    with:
      paths: ${{ tasks.pool.output }}
    for_each:
      items: ${{ with.paths }}
      max_parallel: 8
      fail_fast: false                   # one unreadable CV must not stop the batch
    on_error:
      recover: null                    # null holds the index so the zip below stays aligned
    invoke:
      tool: "nika:read"
      args: { path: "${{ item }}" }

  # A for_each output is an array in ITEM ORDER, so `transpose` pairs each
  # path with its own text. The `select` is where the unreadable CVs leave.
  pairs:
    with:
      paths: ${{ tasks.pool.output }}
      texts: ${{ tasks.cvs.output }}
    invoke:
      tool: "nika:jq"
      args:
        input: ["${{ with.paths }}", "${{ with.texts }}"]
        expression: >-
          transpose
          | map(select(.[1] != null))
          | map({ path: .[0], text: .[1] })

  # ── one rubric, applied identically to everyone ────────────────────
  # `with.cv_path` reads `${{ item.path }}` — a pre-fan-out import that is
  # re-evaluated per iteration, which is how a loop-local reaches the prompt
  # under a name that means something.
  screened:
    with:
      pairs: ${{ tasks.pairs.output }}
      cv_path: ${{ item.path }}
    for_each:
      items: ${{ with.pairs }}
      max_parallel: 2                    # a local model shares one GPU · don't thrash it
      fail_fast: false
    on_error:
      recover: null
    infer:
      # a reasoning model needs 16384 here, or a documented run.reasoning.effort: low
      max_tokens: 1200                 # a rubric row, not an essay
      prompt: |
        Role · ${{ const.role }}
        Candidate file · ${{ with.cv_path }}
        CV ·
        ${{ item.text }}
        Score this candidate against the role. Quote evidence from the CV
        for every rating: no rating without a quote.
      # `additionalProperties: false` on EVERY object node — the top level and
      # each nested one. Without it a provider is free to add keys, and the
      # jq below would be sorting a shape that changes between runs.
      schema:
        type: object
        additionalProperties: false
        required: [file, fit, strengths, concerns]
        properties:
          file: { type: string }
          fit: { type: string, enum: [strong, possible, weak] }
          years_relevant: { type: integer }
          strengths: { type: array, items: { type: string } }
          concerns: { type: array, items: { type: string } }

  # ── the model judged · jq decides ──────────────────────────────────
  # Ranking lives HERE, not in a prompt, so the order is reproducible: same
  # scores in, same order out. `.fit != "strong"` sorts false (0) before true
  # (1), which puts the strong candidates first; `// 0` covers the candidates
  # whose CV never stated a number.
  ranked:
    with:
      screened: ${{ tasks.screened.output }}
    invoke:
      tool: "nika:jq"
      args:
        input: "${{ with.screened }}"
        expression: >-
          map(select(. != null))
          | map(select(.fit != "weak"))
          | sort_by(.fit != "strong", -(.years_relevant // 0))

  shortlist:
    with:
      ranked: ${{ tasks.ranked.output }}
    invoke:
      tool: "nika:jq"
      args:
        input: "${{ with.ranked }}"
        expression: ".[:${{ const.shortlist_size }}]"

  brief:
    with:
      shortlist: ${{ tasks.shortlist.output }}
    when: ${{ size(with.shortlist) > 0 }}   # nobody cleared the bar · spend nothing
    infer:
      # a reasoning model needs 16384 here, or a documented run.reasoning.effort: low
      max_tokens: 2000
      prompt: |
        Write the screening brief for these shortlisted candidates ·
        ${{ with.shortlist }}
        One paragraph each · lead with the evidence quotes · end with the
        suggested interview focus.

  save:
    with:
      brief: ${{ tasks.brief.output }}
    when: ${{ with.brief != null && size(with.brief) > 0 }}    # skipped (null) or an EMPTY answer · gate on the VALUE, both ways
    invoke:
      tool: "nika:write"
      args:
        path: "./hiring/shortlist-brief.md"
        content: "${{ with.brief }}"
        create_dirs: true

outputs:
  ranked:
    value: ${{ tasks.ranked.output }}
    description: "Everyone who was not scored weak · strong first, then by relevant years"
  shortlist:
    value: ${{ tasks.shortlist.output }}
    description: "The top `const.shortlist_size` of the ranking · what the brief covers"
```

## How it works

**1. Local inference is the requirement, not a preference**

`model: ollama/qwen3.5:4b` at the envelope: candidate data never
touches a cloud API. Same file shape as any other workflow.

**2. One rubric, enforced by schema**

`fit: enum [strong, possible, weak]` + required evidence arrays:
candidate #1 and #40 are judged on the same axes, and a rating
without a quote fails validation.

**3. The ORDER is deterministic**

`sort_by(.fit != "strong", -(.years_relevant // 0))`: strong fits
first, then by years. Re-run it: same input, same shortlist.

## Constructs you just used

| Construct | Where | Reference |
| - | - | - |
| local provider (PII) | envelope `model:` | [Providers](https://docs.nika.sh/concepts/providers.md) |
| `nika:glob` → `for_each` | `pool` · `screened` | [Workflows](https://docs.nika.sh/concepts/workflows.md) |
| schema enums + evidence | `screened` | [The 4 verbs](https://docs.nika.sh/concepts/verbs.md) |
| jq deterministic ranking | `ranked` · `shortlist` | [Builtins](https://docs.nika.sh/reference/builtins.md) |

## Run it

> [!NOTE]
>
> **What it needs:** A local model ([Ollama](https://ollama.com) serving `qwen3.5:4b`) and the three sample CVs. No network: the file grants none.

**1. Rehearse it**

```bash theme={"system"}
nika try resume-screener
```

A mock model answers, the sample files come with it, and nothing is written in your folder.

**2. Get your own copy**

Save the file above as `resume-screener.nika` in a new folder, then download the samples it reads:

```bash theme={"system"}
FIXTURES=https://raw.githubusercontent.com/supernovae-st/nika/v0.124.1/crates/nika-pack/pack/examples/fixtures
mkdir -p examples/fixtures/cvs
curl -fsSLo examples/fixtures/cvs/awa-diallo.md "$FIXTURES/cvs/awa-diallo.md"
curl -fsSLo examples/fixtures/cvs/priya-raman.md "$FIXTURES/cvs/priya-raman.md"
curl -fsSLo examples/fixtures/cvs/tomas-lindqvist.md "$FIXTURES/cvs/tomas-lindqvist.md"
```

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

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

The run writes `hiring/shortlist-brief.md`.

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

To screen your own folder, change `const.cv_glob` and the matching `permits.fs.read` entries together (`NIKA-AUTH-007`).

## Make it yours

* Anonymize first: a pre-pass `infer` that strips names/photos before scoring. Bias mitigation in one task.
* Wire the shortlist into [Meeting actions](https://docs.nika.sh/examples/meeting-actions.md)' pattern to draft interview invites.
* The same shape screens vendor proposals, grant applications, conference talks: any « N documents, one rubric » job.

> [card] [Next · Release train](https://docs.nika.sh/examples/release-train.md)
>
> Time as a first-class citizen: parallel gates, a human GO, and an
> absolute-time hold until the window.


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