Hacker News CLI
Fetch top stories, search, and view comments from Hacker News.
Tool
Script: scripts/hn-cli.sh (Nix shebang, self-contained)
Commands
List top stories
bash
./scripts/hn-cli.sh # Top 20 stories ./scripts/hn-cli.sh 50 # Top 50 stories ./scripts/hn-cli.sh --hot # Hot stories only (🔥 score ≥300 or comments ≥100) ./scripts/hn-cli.sh --hot 10 # 10 hot stories
Search stories (via Algolia)
bash
./scripts/hn-cli.sh -s "rust programming" # Search, recent first (default) ./scripts/hn-cli.sh --search "AI" --sort popular # Search by popularity/relevance ./scripts/hn-cli.sh -s "nix flakes" 50 # Search, show 50 results (max 100)
View comments
bash
./scripts/hn-cli.sh -c STORY_ID # Comments for story (depth 1, max 20) ./scripts/hn-cli.sh --comments STORY_ID -d 3 # Depth 3 ./scripts/hn-cli.sh -c STORY_ID -n 100 # Up to 100 comments
Output format
Stories show: rank, title, domain, story ID, points, author, age, comment count, URLs. Comments show: tree structure with author, time, and text.
Story IDs appear in brackets [12345678] — use these for --comments.
Typical workflows
- •Browse HN: Run with no args, scan titles
- •Search for topics: Use
-s "query"to find stories on specific topics - •Dive into discussion: Note story ID, run with
-c ID -d 2 - •Find hot topics: Use
--hotto filter for trending stories - •Research a topic: Search with
-s, then fetch comments for interesting stories - •Summarize for user: Fetch stories + comments, summarize key points and insights
- •Briefing mode: See below
Briefing Mode
When user asks casually about hacker news stories, use this style:
Flow
- •Fetch top 20-50 stories, present hot/notable ones in a table
- •User picks stories they want to dig into
- •For each pick: fetch article (via
curl | pandoc) + comments in parallel - •Summarize with structure: article TL;DR, key quotes, HN discussion themes in tables
- •Group related stories together
- •When user asks "your take?" — give genuine opinions, not hedged summaries
Tone
- •HN-native: direct, slightly cynical, technically literate
- •Not corporate/PR: have a voice, make judgments
- •Opinionated on request: distinguish factual summary from editorial take
Format
- •Tables for quick scanning (story | points | comments | topic)
- •Headers to separate stories
- •Key quotes in blockquotes
- •Discussion themes grouped by viewpoint
- •Bullet points over paragraphs