recsys-pipeline-architect
它能做什么
这个工具可以帮你搭建为用户挑选最合适内容的系统,例如新闻推送或商品推荐。它会把这个过程整理成清晰的步骤。
适用场景
- ✓搭建个性化新闻推送时。
- ✓整理搜索结果时。
- ✓决定要发送哪些通知时。
技能链接
https://github.com/wshobson/agents/blob/main/plugins/machine-learning-ops/skills/recsys-pipeline-architect/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我想搭建一个系统,根据用户之前看过的内容向他们推荐视频。”
每周 5 个新技能,1 分钟读完。
工作原理
它会把任务拆分为六个部分:获取候选内容、补充信息、过滤不相关的内容、打分、选出最佳内容,最后执行保存等额外操作。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Recsys Pipeline Architect
A spec-and-scaffold skill for building composable recommendation, ranking, and feed pipelines. Encodes the six-stage pattern popularized by xAI's open-sourced For You algorithm (Apache 2.0) and applies it to any "top K for (user, context)" problem.
Overview
Most "recommendation systems" in production aren't exotic ML — they're pipelines: fetch candidates from one or more sources, enrich them with metadata, drop the ineligible, score the rest, sort and pick the top K, then fire async side effects. The pattern is universal. The scoring function and the items change; the pipeline shape doesn't.
This skill is an independent reimplementation of the pattern (MIT) — no code copied from the original.
When to Use This Skill
- Building any system that returns "the top K items for a user/context"
- Designing or refactoring a personalized feed (content, search results, notifications)
- Wrapping an LLM/ML scorer in proper pipeline plumbing (sources, hydration, filters, side effects)
- Adding multi-action prediction with tunable weights (instead of a single relevance score)
- Building a RAG retrieval reranker (cheap retrieval → expensive rerank)
- Designing a task prioritizer or alert triage system
The Six-Stage Framework
| # | Stage | Job | Parallel? |
|---|---|---|---|
| 1 | Source | Fetch candidates from one or more origins | Yes — multiple sources run in parallel |
| 2 | Hydrator | Enrich candidates with metadata needed for filtering and scoring | Yes — independent hydrators run in parallel |
| 3 | Filter | Drop ineligible candidates (blocked, expired, duplicate, ineligible) | Sequential — each filter sees fewer items |
| 4 | Scorer | Assign each surviving candidate one or more scores | Sequential — later scorers see earlier scores |
| 5 | Selector | Sort by final score, return top K | Single op |
| 6 | SideEffect | Cache, log, emit events, update served-history | Async — must never block the response |
Why this exact order
- Sources before hydration: know what candidates exist before paying to enrich
- Hydration before filtering: many filters need metadata the source didn't provide
- Filtering before scoring: scoring is the expensive stage — drop the ineligible first
- Scorer chain (not single scorer): real systems compose ML scoring + diversity reranking + business rules
- Selector after scoring: keeps scoring deterministic and cacheable
- SideEffects last and async: side effects must never block the user response
Workflow When Invoked
Walk the user through eight steps:
- Clarify the use case (one round, three questions only if missing): items being ranked, input context, language/runtime
- Identify the candidate sources (usually in-network + out-of-network, but single-source also valid)
- List required hydrations — for each filter and scorer, what data does it need that the source didn't provide?
- List the filters — cheap before expensive, universal before user-specific (duplicate, self, age, block/mute, previously-served, eligibility)
- Design the scorer chain — primary ML/heuristic → combiner (multi-action with weights) → diversity → business rules
- Selector — sort descending by final score, take top K (or stratified mix)
- SideEffects — cache served IDs, emit impression events, update counters, log analytics; all fire-and-forget
- Generate the scaffold in the user's stack
Key Trade-offs to Surface
Never default silently on these — they are product decisions disguised as technical ones.
1. Single score vs multi-action prediction
- Single score: train one model to predict relevance. To change behavior → retrain.
- Multi-action: predict
P(action)for many actions (P(read),P(like),P(share),P(skip),P(report)), combine with weights at serving time. To change behavior → change weights. No retraining.
The X For You algorithm uses multi-action with both positive and negative weights. Recommend multi-action when the user expects to tune frequently.
2. Candidate isolation vs joint scoring
- Isolated: each candidate scored independently. Deterministic, cacheable.
- Joint: candidates attend to each other during scoring (e.g., transformer over the whole batch). More expressive but non-deterministic across batches.
Default to isolation. Joint only when there's a specific reason (e.g., explicit batch-aware diversity).
…
常见问题
为什么是这样的步骤顺序?
这个顺序是为了提高效率:先获取内容,仅在需要时补充数据,在打分前先过滤掉不合适的内容,并在不拖慢响应的前提下执行额外操作。
“multi-action”是什么意思?
系统不再只给出单一的“相关性”分数,而是可以预测多种行为(比如“观看”“点赞”“跳过”),并通过权重调整每种行为的重要程度,无需重新训练。
我可以混合使用不同类型的系统吗?
可以。这些步骤就像积木,可以自由组合。例如,先用一个简单的搜索系统获取候选内容,再用更复杂的系统进行精细筛选。
详情
作者的原始描述
Design composable recommendation, ranking, and feed pipelines using the six-stage Source→Hydrator→Filter→Scorer→Selector→SideEffect framework popularized by xAI's open-sourced X For You algorithm. Use when building any system that picks "the top K items for a (user, context)" — content feeds, search ranking, RAG rerankers, task prioritizers, notification triage, ad selection.
repo: wshobson/agents
热度
- GitHub 星标
- 41k
- 排名
- #6739
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …