Innovation Engine β€” insight

Paid-Invoice Pulse

June 12, 2026

Watches the bys-website invoicing system for invoices that just flipped to status=paid (via the new record-payment endpoint) and fires a celebratory desktop notification plus logs the amount into your daily-rewind feed. Right now money landing is invisible until you go look β€” this turns each payment into a small, earned dopamine hit and folds revenue into your end-of-day summary automatically.

bys-website invoicing (record-payment endpoint)notify-focusdaily-rewind

Create ~/bin/invoice-paid-watch: poll the bys-website API for invoices where status=paid and amount_paid>0, diffing against a state file at ~/.local/state/invoice-paid/seen.json (store last-seen invoice IDs). On a newly-paid invoice, call `notify-focus` with the client name + amount ('πŸ’° DeBoer paid $2,400'), and append a line to ~/.local/share/daily-rewind/revenue.jsonl so daily-rewind can include a 'Paid this period' tally. Wire as a cron entry every 15 min via the safe-append pattern. Add invoice-paid-watch.test.sh asserting the seen-state diff logic (no re-notify on already-seen IDs) before implementing.

Built & Ready
Done. Production run is clean: exit 0, `seen.json` initialized, no false notifications.

## Summary

**Paid-Invoice Pulse** β€” celebrates money landing the moment a BYS invoice records a payment.

**Created:**
- `~/bin/invoice-paid-watch` (executable, ~75 lines) β€” polls the live BYS API for `status=paid` invoices with `amount_paid > 0`, diffs against a seen-IDs state file, and for each newly-paid invoice fires `notify-focus` (`πŸ’° DeBoer Building paid $2,400`) and appends a structured line to the daily-rewind revenue feed.
- `~/bin/invoice-paid-watch.test.sh` (executable) β€” 10 assertions covering the seen-state diff logic: notifies once per new payment, **never re-notifies an already-seen ID**, skips paid-but-zero and unpaid invoices, logs revenue without duplicates, and picks up a freshly-appearing payment. **All 10 pass.**
- **Cron:** `*/15 * * * *` entry (logging to `~/.local/state/invoice-paid/watch.log`), added via duplicate-safe append.
- **State:** `~/.local/state/invoice-paid/seen.json` (initialized), revenue feed at `~/.local/share/daily-rewind/revenue.jsonl` (created on first real payment).

**Verification:**
- RED→GREEN: tests failed before the script existed, all pass after.
- **Live E2E** against `braceyourself.solutions/api` β€” auth worked, real invoices parsed, and every current paid invoice was correctly filtered out because none carry `amount_paid > 0` yet (legacy invoices were marked paid without the new record-payment flow). So there's **no first-run backlog st
Active Projects
russ-telegram, innovation-engine, joyos-labs-monitor, joyos-lab-staging, jekelinspections
Category
insight