feat(classifier): NanoGPT-backed category-classify fetcher (32-axis taxonomy) - #3185
Open
0motionguy wants to merge 1 commit into
Open
0motionguy wants to merge 1 commit into
0motionguy wants to merge 1 commit into
Conversation
…axonomy) Without this fetcher, the 17 new categories shipped in C-CAT PR #3174 read "0 repos." Wires a daily classifier that maps every consensus- trending repo into one of the 32 ids (15 existing + 17 new from C-CAT). Approach: - New fetcher apps/trendingrepo-worker/src/fetchers/category-classify/ reads consensus-trending payload, batches the top-1000 fullNames into chunks of 20, sends each chunk to NanoGPT (Kimi-K2-Instruct) with a strict response_format json_object and the full 32-id taxonomy embedded in the system prompt. - Re-classifies any repo whose previous classification is older than 7 days; skips fresh assignments to keep cost bounded. - Emits ss:data:v1:repo-categories with computedAt + staleness_seconds so UI consumers can drop the chip facet when stale (no publicly stale batches rule). - Schedule: '17 3 * * *' UTC (well off the on-the-hour peaks where other fetchers run). - Cost discipline: ~$0.00003 per NanoGPT call × (1000 repos / 20-per- batch) = $0.0015/day at full pool. Documented in fetcher. NanoGPT client (apps/trendingrepo-worker/src/fetchers/category-classify/ llm.ts) lifts the L1 PR #3172 dual-provider pattern: NanoGPT primary when NANOGPT_API_KEY is set, Kimi fallback otherwise. env.ts: add NANOGPT_API_KEY/_BASE_URL/_MODEL and widen LLM_PROVIDER enum to include 'nanogpt'. llm/router.ts narrows back to its own 'kimi'|'openrouter' (it doesn't serve nanogpt; the classifier has its own client). scripts/classify-categories.ts: one-shot seed for operators to run after deploy without waiting for the cron tick. Vitest: 4 tests asserting the taxonomy schema (32 entries, no dupes, description coverage, chunk size sanity). Companion PRs in the ULTRA plan: C-CAT #3174 ships the taxonomy; this PR ships the classifier; #3181 per-category-landing-pages renders them. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0motionguy
added a commit
that referenced
this pull request
Jun 15, 2026
Closes part of the v3 deep-crawl deltas finding that no competitor has any API/RSS/webhook surface (defensibility 3.0). 32 categories × 1 RSS feed gives 32 SEO + agent-readable surfaces; the per-category llms.txt section makes the feeds discoverable to AI agents that follow the convention. Files: - src/app/feeds/[slug].xml/route.ts (new) — dynamic [slug] = one of the 32 category ids from src/lib/constants.ts. Returns RSS 2.0 XML with proper content-type + Cache-Control: s-maxage=900, swr=3600. Falls back to an "indexing in progress" item when the classifier (PR #3185) hasn't populated repo-categories yet. - src/app/feeds/route.ts (new) — index page listing all 32 feed URLs as JSON for agent discovery. - src/app/llms.txt/route.ts (modified) — adds "Per-category RSS feeds" section generated from CATEGORIES so the file scales when the taxonomy changes again. - src/app/categories/[slug]/page.tsx (modified) — adds <link rel="alternate" type="application/rss+xml"> so feed readers can auto-discover the matching feed. - src/lib/pipeline/__tests__/feeds-routes.test.ts — RSS XML escaping (&, <, >), content-type, and at-least-one <item> shape assertions. - scripts/check-production-topology-docs.mjs — adds a llms.txt topology phrase requirement so the HOSTUP section stays accurate. No publicly stale batches: when consensus-trending is past 4h, the feed emits an "indexing in progress" item instead of stale items. Companion PRs: C-CAT #3174 (taxonomy), classify #3185 (per-repo assignments), per-category-pages #3181 (HTML landing), Toolbox #241 (ULTRA harness with the deltas evidence). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Without a classifier, the 17 new chips shipped in C-CAT PR #3174 read "0 repos." This PR wires the missing piece: a daily NanoGPT-backed classifier that maps every consensus-trending repo into one of the 32 category ids.
Approach
apps/trendingrepo-worker/src/fetchers/category-classify/— reads consensus-trending payload, batches the top-1000 fullNames into chunks of 20, sends each chunk to NanoGPT (Kimi-K2-Instruct via OpenAI-compatible chat) with strictresponse_format: { type: 'json_object' }and the full 32-id taxonomy embedded in the system prompt.'17 3 * * *'UTC, well off the on-the-hour peaks where the other fetchers run.computedAt+staleness_secondsso UI consumers can drop the category facet when stale.Companion PRs
/categories/<slug>with JSON-LDFiles
Test plan
pnpm --filter trendingrepo-worker tsc --noEmit— cleanpnpm --filter trendingrepo-worker test src/fetchers/category-classify— 4/4 passNANOGPT_API_KEYand runspnpm tsx scripts/classify-categories.tsonce — verifyss:data:v1:repo-categoriespopulates with assignmentsEvidence
Deep-crawl deltas v3: OSSInsight ships 102 curated collections to TrendingRepo's 15; C-CAT brought us to 32; this classifier makes those 32 actually useful. Toolbox PR #241 has the underlying delta.
🤖 Generated with Claude Code