v0.1 · decision models · MIT

If seen,
then do.

Turn anything your screen, camera or mic can pick up into an event. No API, no integration, no model training. Write one sentence; ifseen acts the moment it's true.

ifseen "a pan is cooking on a lit hob and nobody is in the kitchen" --camera 0 --ntfy my-phone
1 callper frame, every rule
0output tokens
~$0.09/hbusy scene, low-res
FIG.01 / TOPOLOGY every: 2s
skip_unchanged: true
SRC × 3 → 1 CALL P(yes) / RULE
The ifseen terminal dashboard watching a doorbell camera
00. Get started

Running in
three steps.

Install it, add a key (or don't), run a ready-made recipe. A couple of minutes, start to finish.

  1. brew install krishjoshi/tap/ifseen

    No Homebrew? curl -fsSL https://krishj.com/ifseen/install.sh | sh verifies the checksum, installs to ~/.local/bin (no sudo) and clears Gatekeeper's quarantine flag. Apple silicon and Intel; one binary, no Python.

    Upgrade brew upgrade ifseen (or re-run the script) · Uninstall brew uninstall ifseen (or rm ~/.local/bin/ifseen)

  2. recommendedGemini Decision 1

    Free tier from Google AI Studio. Images and audio.

    export GEMINI_API_KEY=...
    fastestTypeSafe Jev

    Key from console.typesafe.ai. Images only, ~180 ms.

    export TYPESAFE_API_KEY=...
    no keyFree or fake

    --provider local runs SigLIP offline (Python install). --dry-run uses random probabilities.

    ifseen watch doorbell --dry-run

    On Windows PowerShell: $env:GEMINI_API_KEY = "...".

  3. 03 Run your first ruleAll recipes →
    1. ifseen doctor

      Checks keys, extras and capture permissions.

    2. ifseen init appliance-done

      Writes ifseen.yaml from a recipe.

    3. Edit ifseen.yaml: point source at your camera, screen or snapshot URL and reword the rules.

    4. ifseen watch ifseen.yaml

      Live dashboard; actions run when a rule fires.

01. How it works

Real frames.
Real numbers.

Clips run through ifseen watch, plus everyday home and office pairs: one frame where the rule is true, a near-identical one where it isn't. Every probability is a real ifseen output, one call per frame. Nothing tuned or retouched.

AI-generated scenesreal ifseen outputsScenes: Gemini 2.5 Flash Image + Veo 3.1 Lite · prompts, rules & raw numbers

ifseen watch · every: 500ms · realtime: false · then: [log]Bars ease between decisions for smoothness; every number and FIRED moment is from the real run

Clips

00 · ifseen watch on each 6s clip · every 500ms · fire times from the real run (Gemini; Jev where shown)
Kitchen · hob.mp4

hob-unattended “A pan is cooking on a lit hob, with flame or steam, and nobody is in the kitchen.” threshold 80%

  1. 0.0sperson-in-kitchen fires · 93.8%
  2. 3.0shob-unattended 73% (cook in the doorway)
  3. 4.0s🔔 hob-unattended fires · 89.4%
  4. 4.5sJev fires too · 95%
Loading bay · hivis.mp4

no-hivis “A person in the loading bay is wearing ordinary clothes with no high-visibility vest.” threshold 80%

  1. 0.0sbay-empty fires · 89.1% (worker still outside)
  2. 0.5s🔔 no-hivis fires · 91.6% · Jev 96%
  3. 5.5sstill 93% / Jev 97% as he reaches the pallet
Pet cam · dog.mp4

dog-on-sofa “A dog is lying or sitting on the sofa.” threshold 80%

  1. 0.0sdog-on-floor fires · 93.0%
  2. 3.5sdog-on-sofa 28%
  3. 4.0sdog-on-sofa 61%
  4. 4.5s🔔 dog-on-sofa fires · 92.8%
Doorbell · parcel.mp4

parcel-left “A parcel or package has been left on the doorstep and nobody is with it.” threshold 85%

  1. 1.5sperson-at-door fires · 83.6%
  2. 4.0sparcel-left 77% (courier still there)
  3. 4.5s🔔 parcel-left fires · 94.5%
Hot desk · desk.mp4

laptop-unlocked-unattended “A laptop at an empty desk is unlocked and showing apps or documents, with nobody sitting there.” threshold 80%

  1. 0.0sperson-at-desk fires · 90.0%
  2. 2.0sperson-at-desk 47.5%
  3. 3.0s🔔 laptop-unlocked-unattended fires · 82.0%

Home

01 · rule true (left) vs false (right) · click for the full annotated frame
Pet cam

dog-on-sofa “A dog is lying or sitting on the sofa.” threshold 80%

Opposite rule dog-on-floor: 8.9% → 94.6%

Doorbell

parcel-left “A parcel or package has been left on the doorstep.” threshold 85%

Opposite rule doorstep-empty: 7.7% → 89.0%

Kitchen

boiling-over “A pot on the hob is boiling over, with foam or water spilling over the rim.” threshold 80%

Opposite rule gentle-simmer: 6.3% → 82.8%

3D printer

spaghetti “The 3D print has failed and is a tangle of loose filament.” threshold 85%

Opposite rule print-ok: 7.9% → 84.0%

Office

02 · rule true (left) vs false (right) · click for the full annotated frame
Hot desk

laptop-unlocked-unattended “A laptop at an empty desk is unlocked and showing apps or documents, with nobody sitting there.” threshold 80%

Middle: someone at the desk, so it stays quiet (15.2%; person-at-desk 92.9%). Opposite rule screen-locked: 6.2% → 92.1%

Meeting room

room-occupied “People are in the meeting room.” threshold 80%

Opposite rule room-empty: 9.2% → 92.6%

Printer

paper-jam “The printer's screen shows a paper jam or error.” threshold 80%

Opposite rule printer-ready: 6.1% → 95.3%

Reception

visitor-waiting “A visitor is waiting at the reception desk.” threshold 80%

Opposite rule reception-empty: 4.4% → 95.0%

↳ Under the hood

One frame. One call.
Every rule.

Decision models don't write text. They read an image or audio clip and return a calibrated probability for each yes/no question, with zero output tokens. ifseen is the glue around them.

  1. 01 / CAPTURE

    Grab a frame

    Screen, webcam, RTSP, snapshot URL, file, and/or the last few seconds of mic audio.

  2. 02 / SKIP

    Unchanged? Skip

    Static frames and silence never hit the API. A quiet scene costs almost nothing.

  3. 03 / ONE CALL

    Ask all rules

    3 rules or 300, it's one request per frame. The image is billed once.

  4. 04 / DEBOUNCE

    Stay calm

    Thresholds, for: N consecutive hits, cooldowns and hysteresis. One alert per event.

  5. 05 / ACTION

    Do the thing

    Notify, speak, run a shell command, hit a webhook, push a photo to your phone, save the frame, exit.

LIVE SIMULATION · doorbell.yaml · gemini-decision-1 · resolution: low
frame #0000capturing
    EVENT LOG
      Spent so far$0.000000

      Simulation. Per-call cost uses the measured ≈520 input tokens per low-res Gemini Decision 1 frame at $0.10 / 1M tokens.

      02. Use cases

      No API? No training?
      Doesn't matter.

      If a person can see it or hear it, ifseen can turn it into an event. Old appliances, existing CCTV, legacy software with no integration story. Every number below is a real ifseen test output from both decision models.

      AI-generated scenesreal ifseen outputsGemini Decision 1 · TypeSafe Jev · threshold 80% · prompts, rules & raw numbers

      Home safety · hob left on
      • Heat or flame sensor over the hob
      • Presence sensor in the kitchen
      • Glue logic: "hot AND nobody here for N minutes"

      hob-unattended “A pan is cooking on a lit hob, with flame or steam, and nobody is in the kitchen.”

      Hob on, nobody there
      Gemini 94.4% · Jev 96%
      Someone cooking
      Gemini 3.2% · Jev 2%
      Hob off
      Gemini 21.4% · Jev 26%
      Home · dumb appliance done
      • Replace a working machine with a "smart" one
      • Or a smart plug + power-draw thresholds that guess

      cycle-finished “The washing machine's display shows the cycle has finished, such as "End", "0:00" or a done light.”

      Display shows End
      Gemini 95.7% · Jev 98%
      Display shows 0:42
      Gemini 5.8% · Jev 2%
      Workplace safety · PPE
      • Collect and label thousands of images
      • Train a custom detector
      • Retrain for every site, camera and uniform

      no-hivis “A person in the loading bay is wearing ordinary clothes with no high-visibility vest.”

      No vest
      Gemini 91.9% · Jev 98%
      Hi-vis worn
      Gemini 4.7% · Jev 4%
      Empty bay
      Gemini 9.2% · Jev 7%
      Retail · restock needed
      • Shelf-scanning robots
      • Or a custom vision model per planogram
      • Or staff walking the aisles

      shelf-gap “Part of a shelf is empty, with a visible gap where products should be.”

      Gap on the shelf
      Gemini 94.3% · Jev 97%
      Fully stocked
      Gemini 26.6% · Jev 33%
      Legacy screen · no API
      • Screen-scraping or RPA bots that break on every UI change
      • OPC / vendor connectors, if they exist
      • Or someone watching the screen all night

      alarm-active “The control screen shows an active alarm, such as a red alarm banner or a tripped pump.”

      Red alarm banner
      Gemini 97.0% · Jev 99%
      Normal operation
      Gemini 1.4% · Jev 3%

      Opposite rules for contrast (true image → false image): person-cooking 94.3% / 95% → 6.6% / 32% · cycle-running 93.5% / 96% · hivis-worn 92.3% / 97% · normal-operation 95.5% / 98%. Two were weak: hob-off scored only 52.5% / 8% on the hob-off frame (food is still in the pan) and shelf-full 56.1% / 25% on the stocked shelf; neither fired. HMI screens are drawn with PIL, not generated.

      ++ Why it's nice

      No training.
      No bounding boxes.
      Just English.

      Plain-English rules

      Ask what you'd ask a person.

      "The washing machine shows End." "Someone in the loading bay has no hi-vis vest." Use false_means to say what "no" looks like.

      ifseen.yaml
      source: {camera: 0}
      every: 30s
      rules:
        - name: cycle-finished
          when: The washing machine's display shows the cycle has finished.
          false_means: The display shows time remaining.
          for: 2
          then:
            - ntfy: laundry-topic
            - say: the washing is done
      Debounced & calm

      One alert per event. Not one every two seconds.

      A rule must clear its threshold for: N frames in a row, then waits out its cooldown and re-arms only when the probability drops.

      ifseen watch doorbell --plainlive
      14:02:06skip frame unchanged
      14:02:08parcel-left 61%below 85%
      14:02:10parcel-left 93%hit 1/3
      14:02:12parcel-left 95%hit 2/3
      14:02:14🔔 FIRED parcel-left 97%
      14:02:14→ ntfy · snapshot saved
      14:02:16cooldown 30m
      Cheap by default

      Pay for change, not for time.

      Unchanged frames and silent audio are skipped automatically, so a static scene costs almost nothing. The dashboard shows real spend as you go.

      1,350 tok / frame520 tok · resolution: low$0.000135 / frame~$0.24/h busy scene~$0.09/h low-res
      cost metergemini-decision-1
      $0.0026spent
      ■ called (frame changed)■ fired□ skipped50 calls × ≈520 tokens
      Does real things

      Push the photo to your phone.

      ntfy sends the triggering frame along with the alert. Or chain anything else: shell commands get $IFSEEN_* env vars, never string-templated.

      ntfy · ifseen-doorbellnow
      📦 Parcel delivered
      parcel-left · 97% · priority high
      0.97
      notifysayshellwebhookntfysnapshotexit
      03. Integrate

      Choose
      your setup.

      The CLI is one way in. The same rules file also becomes Home Assistant entities, an always-on container, Python callbacks, a typed JS client or a local HTTP + SSE API.

      Needs Home Assistant OS or Supervised. Elsewhere, any MQTT broker + an mqtt: section works.

      1. Install the ifseen add-on, and the Mosquitto broker add-on if you don't have one. MQTT is picked up automatically.

      2. Pick a provider and paste its key in the add-on's Configuration tab (or turn on Dry run).

      3. Save a rules file like the one here in /addon_configs/xxxxxxxx_ifseen/ (Samba or File editor), or paste it into the rules option. Start the add-on.

      You get · one device per file
      • binary_sensor.front_door_person_at_door
      • sensor.front_door_person_at_door_probability
      • event.front_door_trigger · camera.front_door_last_trigger
      • switch.front_door_watching · status & cost sensors
      tested against a real MQTT brokernot yet verified in a live HA instance
      Full guide →
      front-door.yaml
      source:
        url:
          url: http://supervisor/core/api/camera_proxy/camera.front_door
          headers: {Authorization: "Bearer ${SUPERVISOR_TOKEN}"}
      every: 3s
      rules:
        - name: person-at-door
          when: A person is standing at the front door.
          for: 2
          ha_device_class: occupancy
      automation
      triggers:
        - trigger: state
          entity_id: binary_sensor.front_door_person_at_door
          to: "on"
      actions:
        - action: notify.mobile_app_my_phone
          data: {message: "Someone's at the door"}

      All key options

      Never in rule files · there is no key field
      geminiGemini Decision 1

      Free tier at aistudio.google.com/apikey. Images and audio.

      jevTypeSafe Jev

      Key from console.typesafe.ai. Images only; fastest, ~180 ms.

      azureMicrosoft-Decision

      Deploy Microsoft-Decision-1.1 in Azure Foundry: endpoint, key and deployment name.

      no keyLocal & dry run

      --provider local (SigLIP) and --dry-run need nothing. OpenAI-compatible and Ollama are optional.

      How to pass a provider API key on each surface
      SurfaceHow the key gets in
      CLI / YAMLAuto-detected env vars: GEMINI_API_KEY (or GOOGLE_API_KEY), TYPESAFE_API_KEY, AZURE_DECISION_ENDPOINT + AZURE_DECISION_KEY (+ AZURE_DECISION_DEPLOYMENT), OPENAI_API_KEY. Use another variable with provider: {api_key_env: MY_VAR}. ${VAR} expansion is for other secrets (ntfy topics, tokens). ifseen doctor shows which keys are set.
      PythonEnv vars by default, or explicitly: check(img, [...], provider="gemini", api_key=...), check_detailed(..., api_key=...), Watcher(..., provider="jev", api_key=...), Watcher.from_yaml(path, api_key=...). Needs an explicit provider; kept in memory only, never in state().
      JS / TScheck(img, rules, { provider: "gemini", apiKey }), or the same env vars in Node, Bun and Deno. Don't call providers from a browser: the key is visible to anyone. Use ifseen serve or your backend.
      ifseen serveKeys live only in the server's environment. HTTP clients never send provider keys, and custom endpoints are blocked by default so a client can't redirect your key elsewhere.
      HA add-onPassword fields in the add-on options: gemini_api_key, typesafe_api_key, openai_api_key, azure_decision_key (+ endpoint and deployment).
      DockerPut it in the compose .env file, or docker run --rm -e GEMINI_API_KEY ghcr.io/krishjoshi/ifseen watch kitchen passes it through from your shell.
      04. Recipes

      Eleven ready-made
      rule files.

      Run one directly, or ifseen init <name> to write an editable ifseen.yaml. Secrets come from env vars like ${NTFY_TOPIC}, so rule files are safe to share.

      Example rules, as written

      Rule text from the bundled recipes · ■ = consecutive hits required (for)
      05. Providers

      Bring any
      decision model.

      With no provider set, ifseen picks the first one it finds a key for. --dry-run uses the mock provider, so you can try everything with no key at all.

      Supported providers, their environment variables and whether they can see and hear
      ProviderEnv / configSeesHearsNotes
      geminiGEMINI_API_KEY✓✓Gemini Decision 1. Free tier; $0.10 / 1M input tokens. live-tested
      jevTYPESAFE_API_KEY✓TypeSafe Jev 1.13+; $0.042 / 1M input tokens. Fastest: ~180 ms. live-tested
      azureAZURE_DECISION_ENDPOINT / _KEY / _DEPLOYMENT✓Microsoft-Decision-1.1 on Azure Foundry.
      systemonebase_url (+ TYPESAFE_API_KEY)✓Any self-hosted Jev-compatible /v1/systemone server.
      openaiOPENAI_API_KEY (+ OPENAI_BASE_URL)✓Any OpenAI-compatible vision chat model. Not calibrated, slower.
      ollamamodel✓Fully local, e.g. --provider ollama --model gemma3. offline
      mocknone✓✓What --dry-run uses: random probabilities, actions printed not run.
      localpip install "ifseen[local]"✓Free & offline: SigLIP on your machine, ~20ms, $0. Great for “is X there?” and as a prefilter. free
      PrivacyFrames and audio go to the provider you choose and nowhere else. Use Ollama or a self-hosted server and nothing leaves your machine.
      Not yet benchmarkedMicrosoft-Decision is supported but hasn't been live-tested here yet, so there are no numbers for it on this page.
      Proxies & custom keysbase_url and api_key_env work for proxies, gateways and self-hosted servers.
      06. Benchmarks

      Measured,
      not estimated.

      Real numbers from real runs. Small samples, so treat them as directional.

      Bird benchmark · 8 images × 3 repeats

      Is there a bird? If so, which one? Includes a hard negative (a nest of blue eggs). The decision model asks yes/no + short-list choice in one call; the LLM gets "What bird is this?".

      Species correct8/8

      Both Gemini Decision 1 (one call) and gpt-5.4-mini.

      Median time / image0.69s

      Decision API vs 1.14s for gpt-5.4-mini.

      Cost / 1,000 images$0.19

      Decision API vs $0.44 for gpt-5.4-mini.

      Median latency / image · lower is better
      Gemini Decision 1 (one call)0.69s
      gpt-5.4-mini (free text)1.14s
      Cost / 1,000 images · lower is better
      Gemini Decision 1 (one call)$0.19
      gpt-5.4-mini (free text)$0.44
      Tokens & cost per frame · Gemini Decision 1
      1280×800 frame, default1,350
      resolution: low520
      Worst case: scene changes every 2s
      default resolution$0.24/h
      resolution: low$0.09/h

      Unchanged frames and silence are skipped, so a mostly static scene costs a fraction of this.

      Hard rules · 90 captures · accuracy at threshold 0.5

      Screen text (CI pages, error dialogs), spatial ("dog on the sofa"), scene state (door open, pot boiling) and audio. Hand-labelled; 2–6 positives per rule, so directional.

      Screen text
      Gemini Decision 1100%
      TypeSafe Jev100%
      gpt-5.4-mini98%
      SigLIP · local, free75%
      Spatial
      Gemini Decision 1100%
      TypeSafe Jev100%
      gpt-5.4-mini96%
      SigLIP · local, free100%
      Scene state
      Gemini Decision 1100%
      TypeSafe Jev100%
      gpt-5.4-mini91%
      SigLIP · local, free78%
      Audio
      Gemini Decision 1100%
      TypeSafe Jevn/a
      gpt-5.4-minin/a
      SigLIP · local, freen/a

      Median latency: Jev ~0.18s · Gemini Decision ~0.6–0.8s · gpt-5.4-mini 1.2–2.3s · SigLIP ~20ms. Cost per 1,000 images: Jev $0.10–0.13 · Gemini Decision $0.13 · gpt-5.4-mini $0.80–1.01 · SigLIP $0. Jev is image-only, so audio needs Gemini. Takeaway: local is great for “is X there?”; reading text, judging scene states and listening need a decision model — or use local as a free prefilter in front of one.

      Live tests
      94–96%
      "A pan is cooking on a lit hob … and nobody is in the kitchen", on the unattended-hob frame (Gemini 94.4%, Jev 96%; 3.2% / 2% with someone cooking)camera · kitchen · threshold 80%
      94%
      "Someone said my name", from a microphone clip (Gemini; Jev can't hear)mic · meeting-radar · threshold 75%

      Full method, prices and caveats: birds-results.md · hard-rules-results.md.

      07. Try it

      Write your
      first rule.

      Rule builder

      runs in your browser
      Narrow, positive statements work best. "A parcel is on the doorstep" beats "anything unusual?"
      Source
      …then do
      CLI one-liner
      
                
      ifseen.yaml · run with: ifseen watch ifseen.yaml
      
                

      Not installed yet? Get started →