$npx -y skills add Varnan-Tech/opendirectory --skill hackernews-intelMonitors Hacker News for user-configured keywords, deduplicates against a local SQLite cache, and sends Slack alerts for new matching posts. Use when asked to monitor Hacker News for mentions, track keywords on HN, get alerts when something is posted about a topic on Hacker News,
| 1 | # Hacker News Intel |
| 2 | |
| 3 | Monitor Hacker News for keywords. On each run, fetch new posts via the HN Algolia API, deduplicate against a local SQLite cache, and send Slack alerts for unseen matches. Run manually or schedule via cron or GitHub Actions. |
| 4 | |
| 5 | --- |
| 6 | |
| 7 | ## Step 1: Check Setup |
| 8 | |
| 9 | **1a. Verify required environment variables** |
| 10 | |
| 11 | Check that these are set: |
| 12 | - `HN_KEYWORDS` (required): comma-separated list of keywords to monitor |
| 13 | - `SLACK_WEBHOOK` (required): Slack Incoming Webhook URL for alerts |
| 14 | |
| 15 | If either is missing, stop and tell the user: |
| 16 | - `HN_KEYWORDS`: list the topics you want to monitor, comma-separated. Example: `claude code,LLM agents,deno runtime` |
| 17 | - `SLACK_WEBHOOK`: create an Incoming Webhook at https://api.slack.com/apps. Select your workspace, enable Incoming Webhooks, and copy the URL. |
| 18 | |
| 19 | **1b. Verify script dependencies** |
| 20 | |
| 21 | ```bash |
| 22 | ls /Users/ksd/Desktop/Varnan_skills/hackernews-intel/node_modules/better-sqlite3 2>/dev/null |
| 23 | ``` |
| 24 | |
| 25 | If missing: |
| 26 | |
| 27 | ```bash |
| 28 | cd /Users/ksd/Desktop/Varnan_skills/hackernews-intel && npm install |
| 29 | ``` |
| 30 | |
| 31 | --- |
| 32 | |
| 33 | ## Step 2: Run the Monitor |
| 34 | |
| 35 | ```bash |
| 36 | cd /Users/ksd/Desktop/Varnan_skills/hackernews-intel && node scripts/monitor-hn.js |
| 37 | ``` |
| 38 | |
| 39 | **Flags:** |
| 40 | - `--dry-run`: print matches to stdout without sending any Slack alerts. Use this to preview what would be alerted before committing. |
| 41 | - `--days=N`: on the first run, look back N days (default: 1). Only applies when the SQLite cache is empty. |
| 42 | - `--reset`: clear the cache and start fresh. Use when you change your keyword list significantly. |
| 43 | |
| 44 | **What the script does:** |
| 45 | 1. Reads `HN_KEYWORDS` from environment, splits by comma, trims whitespace |
| 46 | 2. Opens (or creates) a SQLite database at the path in `HN_DB_PATH` (default: `./hn-intel.db`) |
| 47 | 3. For each keyword, calls `https://hn.algolia.com/api/v1/search_by_date` with `numericFilters=created_at_i>lastSeen` |
| 48 | 4. For each result, checks if the `objectID` is already in `seen_posts` — skips if yes |
| 49 | 5. If `HN_MIN_POINTS` is set, skips posts below that threshold |
| 50 | 6. For new matching posts, sends a Slack alert and inserts the `objectID` into the cache |
| 51 | 7. Updates `poll_log` with the run summary |
| 52 | 8. Prints a summary to stdout |
| 53 | |
| 54 | --- |
| 55 | |
| 56 | ## Step 3: Review Results |
| 57 | |
| 58 | After the script runs, read its stdout output. It will report: |
| 59 | |
| 60 | ``` |
| 61 | Run complete. |
| 62 | Keywords checked: N |
| 63 | Posts found: N |
| 64 | Posts alerted: N |
| 65 | Posts skipped (already seen): N |
| 66 | Errors: N |
| 67 | ``` |
| 68 | |
| 69 | If `Posts found: 0` and you expect results, check: |
| 70 | - Are the keywords specific enough? Very broad terms (e.g. "AI") may return 0 results if HN Algolia returns too many and the time window is narrow |
| 71 | - Is the `--days` window large enough for the first run? Try `--days=7` |
| 72 | - Is the DB cache too aggressive? Try `--reset` to clear it and rerun |
| 73 | |
| 74 | If `Posts alerted: 0` but `Posts found: N`, the deduplication is working — those posts were seen in a previous run. |
| 75 | |
| 76 | --- |
| 77 | |
| 78 | ## Step 4: Schedule the Monitor |
| 79 | |
| 80 | **Option A: cron (macOS/Linux)** |
| 81 | |
| 82 | Add to crontab to run every 4 hours: |
| 83 | |
| 84 | ```bash |
| 85 | crontab -e |
| 86 | ``` |
| 87 | |
| 88 | Add this line (adjust the path to match your install): |
| 89 | |
| 90 | ``` |
| 91 | 0 */4 * * * cd /Users/ksd/Desktop/Varnan_skills/hackernews-intel && node scripts/monitor-hn.js >> /tmp/hn-intel.log 2>&1 |
| 92 | ``` |
| 93 | |
| 94 | **Option B: GitHub Actions (recommended for teams)** |
| 95 | |
| 96 | Create `.github/workflows/hn-intel.yml` in any repo: |
| 97 | |
| 98 | ```yaml |
| 99 | name: HN Intel Monitor |
| 100 | on: |
| 101 | schedule: |
| 102 | - cron: '0 */4 * * *' |
| 103 | workflow_dispatch: |
| 104 | |
| 105 | jobs: |
| 106 | monitor: |
| 107 | runs-on: ubuntu-latest |
| 108 | steps: |
| 109 | - uses: actions/checkout@v4 |
| 110 | - uses: actions/setup-node@v4 |
| 111 | with: |
| 112 | node-version: '20' |
| 113 | - name: Install dependencies |
| 114 | run: npm install |
| 115 | working-directory: hackernews-intel |
| 116 | - name: Run monitor |
| 117 | run: node scripts/monitor-hn.js |
| 118 | working-directory: hackernews-intel |
| 119 | env: |
| 120 | HN_KEYWORDS: ${{ secrets.HN_KEYWORDS }} |
| 121 | SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |
| 122 | HN_MIN_POINTS: ${{ secrets.HN_MIN_POINTS }} |
| 123 | ``` |
| 124 | |
| 125 | Add `HN_KEYWORDS`, `SLACK_WEBHOOK`, and optionally `HN_MIN_POINTS` as repository secrets. |
| 126 | |
| 127 | Note: GitHub Actions does not persist files between runs, so the SQLite cache resets each run. This means every run will find all posts within the default 1-day lookback window again. For persistent dedup on GitHub Actions, store the DB in a persistent location (S3, artifact cache, or a dedicated branch). |
| 128 | |
| 129 | --- |
| 130 | |
| 131 | ## Step 5: Tune Keywords and Thresholds |
| 132 | |
| 133 | **Adding or changing keywords:** |
| 134 | Update `HN_KEYWORDS` i |