open-index/open-npm huggingface dataset:
npm package: @mostlyhuman/nightswatch
Description: An autonomous agent to hold your fort while you're asleep
Latest version: 0.3.12

# Night's Watch

Autonomous overnight GitHub maintenance agent powered by Claude. Finds TODOs, outdated dependencies, failing CI, and open issues — fixes them while you sleep, then sends a morning summary.

## How it works

Night's Watch runs inside GitHub Actions on a schedule. It uses two Claude agents — an implementer and a reviewer — with GitHub Issues as the work queue and labels as the state machine.

```
scan (hourly)
  → finds TODOs, outdated deps, failing CI, open issues
  → creates GitHub Issues labeled nightswatch:queued

implementer (triggered by label)
  → reads issue, creates branch nightswatch/issue-<N>
  → writes fix, runs tests
  → opens PR labeled nightswatch:reviewing
  → if stuck → labels nightswatch:blocked, pings you

reviewer (triggered by PR)
  → reads diff + original issue
  → approves or requests changes
  → after max cycles without resolution → escalates to blocked

on approval:
  auto_merge     → merges the PR automatically
  request_review → pings you, leaves PR open for final sign-off

report (7am daily)
  → posts a GitHub Issue with overnight summary
```

## Setup

```bash
npx @mostlyhuman/nightswatch@latest init
```

This creates `.github/workflows/nightswatch.yml` in your repo. Then:

1. Add `ANTHROPIC_API_KEY` as a [GitHub Actions secret](https://docs.github.com/en/actions/security-guides/encrypted-secrets)
2. Optionally add `.nightswatch.yml` to customize behavior
3. Commit and push

## Configuration

Create `.nightswatch.yml` in your repo root:

```yaml
max_issues_per_run: 3       # cap issues created per scan (default: 5)

scanners:
  todos: true               # find TODO/FIXME comments
  dependencies: true        # find outdated npm packages
  ci: true                  # find failing GitHub Actions workflows
  issues: true              # pick up open GitHub issues

agents:
  implementer_model: claude-opus-4-6
  reviewer_model: claude-opus-4-6
  max_review_cycles: 3      # escalate to blocked after N cycles

on_approval: auto_merge     # auto_merge | request_review
# Per-scanner override:
# on_approval:
#   todos: auto_merge
#   issues: request_review

notify: "@your-github-username"   # who to ping on blockers

report:
  create_issue: true        # post morning summary as a GitHub Issue
```

## Labels

Night's Watch creates these labels automatically on first run:

| Label | Meaning |
|---|---|
| `nightswatch:queued` | Issue is queued for implementation |
| `nightswatch:implementing` | Agent is actively working |
| `nightswatch:reviewing` | PR is open, reviewer running |
| `nightswatch:changes-requested` | Reviewer left comments, reimplementing |
| `nightswatch:approved` | Reviewer approved |
| `nightswatch:blocked` | Human intervention needed |

## Requirements

- GitHub Actions enabled
- `ANTHROPIC_API_KEY` secret set in your repo
- Node.js 20+

## License

MIT