# Ticket 3.4 — Version Check

**Phase**: 3 — Daemon & CLI
**Priority**: Low
**Depends on**: 3.1

## Description

Periodically check npm for a newer version of conduit and notify the user. Non-blocking, non-intrusive — just a banner in the CLI output and an optional notification in the web UI.

## Acceptance Criteria

### AC1: Checks npm registry on daemon start

```gherkin
Given the daemon starts
When it performs the initial version check
Then it fetches the latest version from the npm registry
And it compares against the current installed version
And if a newer version exists, it logs "Update available: X.Y.Z → A.B.C"
```

### AC2: Periodic background checks

```gherkin
Given the daemon is running
When 4 hours have passed since the last check
Then it performs another version check in the background
And it does NOT block any active operations
```

### AC3: Skip with flag

```gherkin
When the CLI is invoked with --no-update
Then no version check is performed
And no update banner is shown
```

### AC4: Notifies connected browsers

```gherkin
Given a newer version is available
When a browser is connected
Then it receives { type: "update_available", current: "1.0.0", latest: "1.1.0" }
And the UI shows a non-intrusive banner
```

## Testable Components

| Component | Test Type | What to Assert |
|-----------|-----------|----------------|
| `fetchLatestVersion()` | Unit | Parses npm registry response correctly |
| `isNewer(current, latest)` | Unit | Correct semver comparison |
| `checkInterval` | Unit | Triggers after configured interval |
| `--no-update` flag | Unit | Skips check entirely |

## Reference

- Claude-relay updater: `../claude-relay/lib/server.js` (fetchLatestVersion)
