Innovation Engine — productivity

Nightwatch Error → Project Context Bridge

March 19, 2026

Automatically pulls Laravel Nightwatch exception emails via gws and writes them into the relevant project's .claude/ERRORS.md file. Next time you open Claude Code in that project, the errors are already in context — no need to remember what broke overnight or dig through email.

Gmail/gwsLaravel NightwatchClaude Code session context

Create ~/bin/error-to-project (bash, ~60 lines). Runs via cron every 30m. Uses `gws gmail search --params '{"q": "from:nightwatch@laravel.com newer_than:1d"}'` to find recent Nightwatch alerts. Parses the project name from the subject line (e.g., 'bys.com' → ~/services/bys-website) and the exception class + message from the body. Appends a timestamped entry to .claude/ERRORS.md in the matched project directory with exception type, message, and a link to the original email. Deduplicates by hashing exception+message. Claude Code's CLAUDE.md can reference ERRORS.md so sessions auto-load it. The Stripe inactive product error you got today would already be waiting in bys-website/.claude/ERRORS.md when you next open that project.

Built & Ready
Here's what was created:

**Script:** `~/bin/error-to-project` (95 lines, executable)
- Queries Gmail for Nightwatch alerts from the last 24h via `gws`
- Parses project name and exception from subject line (`Issue detected in <project>: <exception>`)
- Maps project names to local directories via `PROJECT_MAP` associative array
- Deduplicates by MD5 hash of the exception text
- Appends timestamped entries to `.claude/ERRORS.md` with Gmail links
- Uses flock to prevent concurrent runs

**Cron:** `*/30 * * * *` — runs every 30 minutes, logs to `/tmp/error-to-project.log`

**Result:** The Stripe inactive product error is already in `~/code/braceyourself/bys-website/.claude/ERRORS.md`:
```
## 2026-03-19 05:12 — Stripe\Exception\InvalidRequestException: Payment Links cannot include a price with an inactive product.
- **Hash:** ad9ba699decc
- **Email:** [View in Gmail](...)
```

**To add more projects**, edit the `PROJECT_MAP` in the script:
```bash
["app.example.com"]="$HOME/code/example-app"
```
Active Projects
data, innovation-engine, bys-website, .claude, note-ocr
Category
productivity