feat: HN upvotes + RAG visibility on reading ticks #105
No reviewers
Labels
No labels
Agent
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
joshtronic/igor!105
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/hn-upvotes-and-rag-visibility"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two improvements to the reading loop, bundled because both touch
discretionary-read.sh.
HN upvotes via Algolia API.
Replaced the RSS-based discover_hn with a single Algolia query:
https://hn.algolia.com/api/v1/search?tags=front_page&hitsPerPage=30
Returns hits with .url AND .points (current upvote count).
Algolia's response order = HN's front-page order so position
still gives rank. Output is "rank|points|url" triples.
Self-posts (Ask HN, Tell HN) have null .url and get filtered
-- only external story URLs make it into the ledger.
Ledger annotation extends: hn-points N stored alongside
hn-rank N. Update rule: rank keeps LOWER number (highest
position), points keep HIGHER number (peak upvotes Igor
observed). A story that briefly hit 800 points stays
annotated "800" even after it falls off and current count
is moot.
Picker change: sort candidates by points DESC, rank ASC as
tiebreaker. So a 3-day-old 800-point story still beats
today's 200-point #1 -- the controversial/interesting stuff
bubbles up regardless of when Igor first saw it.
New ledger_update_points helper mirrors ledger_update_rank
but with reversed comparison (higher wins).
RAG visibility on reading ticks.
agent-read.sh DOES call rag_query before every API call --
the build's stderr was just buried because discretionary-
read.sh captured agent-read's stderr to a temp file and only
displayed it on failure. So you'd see
rag: flushed redis db / rag: collected N journal + M memory / rag: indexed ...onsite-work and tier-1 ticks but never on reading ticks.
Switched 2>"$err_file" to 2> >(tee "$err_file" >&2). stderr
now streams through to journalctl in real time AND gets
captured to err_file for the failure-tail. RAG progress
(and any future stderr-noisy thing) surfaces.
Verified:
triples cleanly.
regress when given a lower one.
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com
Two improvements to the reading loop, bundled because both touch discretionary-read.sh. 1. HN upvotes via Algolia API. Replaced the RSS-based discover_hn with a single Algolia query: https://hn.algolia.com/api/v1/search?tags=front_page&hitsPerPage=30 Returns hits with .url AND .points (current upvote count). Algolia's response order = HN's front-page order so position still gives rank. Output is "rank|points|url" triples. Self-posts (Ask HN, Tell HN) have null .url and get filtered -- only external story URLs make it into the ledger. Ledger annotation extends: hn-points N stored alongside hn-rank N. Update rule: rank keeps LOWER number (highest position), points keep HIGHER number (peak upvotes Igor observed). A story that briefly hit 800 points stays annotated "800" even after it falls off and current count is moot. Picker change: sort candidates by points DESC, rank ASC as tiebreaker. So a 3-day-old 800-point story still beats today's 200-point #1 -- the controversial/interesting stuff bubbles up regardless of when Igor first saw it. New ledger_update_points helper mirrors ledger_update_rank but with reversed comparison (higher wins). 2. RAG visibility on reading ticks. agent-read.sh DOES call rag_query before every API call -- the build's stderr was just buried because discretionary- read.sh captured agent-read's stderr to a temp file and only displayed it on failure. So you'd see `rag: flushed redis db / rag: collected N journal + M memory / rag: indexed ...` on site-work and tier-1 ticks but never on reading ticks. Switched 2>"$err_file" to 2> >(tee "$err_file" >&2). stderr now streams through to journalctl in real time AND gets captured to err_file for the failure-tail. RAG progress (and any future stderr-noisy thing) surfaces. Verified: - Algolia parse against the live API returns rank|points|url triples cleanly. - sort -k1nr -k2n orders 800@rank-3 > 800@rank-5 > 300 > 200. - ledger_update_points keeps the higher number; doesn't regress when given a lower one. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>