Loading...
Loading...
Compare original and translation side by side
const args = '$ARGUMENTS'.split(' ').filter(Boolean);
const depth = args.find(a => a.startsWith('--depth='))?.split('=')[1] || 'medium';
const topic = args.filter(a => !a.startsWith('--')).join(' ');const args = '$ARGUMENTS'.split(' ').filter(Boolean);
const depth = args.find(a => a.startsWith('--depth='))?.split('=')[1] || 'medium';
const topic = args.filter(a => !a.startsWith('--')).join(' ');<topic> [--depth=brief|medium|deep]briefmediumdeep<topic> [--depth=brief|medium|deep]briefmediumdeep"{topic} overview introduction"
"{topic} documentation official""{topic} best practices"
"{topic} examples tutorial"
"{topic} site:stackoverflow.com""{topic} advanced techniques"
"{topic} pitfalls mistakes avoid"
"{topic} 2025 2026 latest""{topic} overview introduction"
"{topic} documentation official""{topic} best practices"
"{topic} examples tutorial"
"{topic} site:stackoverflow.com""{topic} advanced techniques"
"{topic} pitfalls mistakes avoid"
"{topic} 2025 2026 latest"| Factor | Weight | Max | Criteria |
|---|---|---|---|
| Authority | 3x | 30 | Official docs (10), recognized expert (8), established site (6), blog (4), random (2) |
| Recency | 2x | 20 | <6mo (10), <1yr (8), <2yr (6), <3yr (4), older (2) |
| Depth | 2x | 20 | Comprehensive (10), detailed (8), overview (6), superficial (4), fragment (2) |
| Examples | 2x | 20 | Multiple code examples (10), one example (6), no examples (2) |
| Uniqueness | 1x | 10 | Unique perspective (10), some overlap (6), duplicate content (2) |
| 评估维度 | 权重 | 最高分 | 评分标准 |
|---|---|---|---|
| 权威性 | 3x | 30 | 官方文档 (10), 公认专家产出 (8), 成熟站点内容 (6), 博客 (4), 未知来源内容 (2) |
| 时效性 | 2x | 20 | <6个月 (10), <1年 (8), <2年 (6), <3年 (4), 更早 (2) |
| 内容深度 | 2x | 20 | 内容全面 (10), 内容详细 (8), 概览级 (6), 表面内容 (4), 碎片化内容 (2) |
| 示例丰富度 | 2x | 20 | 多个代码示例 (10), 1个示例 (6), 无示例 (2) |
| 内容独特性 | 1x | 10 | 独特视角 (10), 部分重叠 (6), 重复内容 (2) |
{
"url": "https://...",
"title": "Article Title",
"qualityScore": 85,
"scores": {
"authority": 9,
"recency": 8,
"depth": 7,
"examples": 9,
"uniqueness": 6
},
"keyInsights": [
"Concise insight 1",
"Concise insight 2"
],
"codeExamples": [
{
"language": "javascript",
"description": "Basic usage pattern"
}
],
"extractedAt": "2026-02-05T12:00:00Z"
}{
"url": "https://...",
"title": "Article Title",
"qualityScore": 85,
"scores": {
"authority": 9,
"recency": 8,
"depth": 7,
"examples": 9,
"uniqueness": 6
},
"keyInsights": [
"Concise insight 1",
"Concise insight 2"
],
"codeExamples": [
{
"language": "javascript",
"description": "Basic usage pattern"
}
],
"extractedAt": "2026-02-05T12:00:00Z"
}agent-knowledge/{slug}.mdundefinedagent-knowledge/{slug}.mdundefined// Description of what this demonstrates
{code}// 示例功能说明
{code}{code}{code}| Pitfall | Why It Happens | How to Avoid |
|---|---|---|
| Issue 1 | Root cause | Prevention strategy |
| 陷阱 | 产生原因 | 规避方法 |
|---|---|---|
| 问题1 | 根本原因 | 预防方案 |
| Resource | Type | Why Recommended |
|---|---|---|
| Title | Official Docs | Authoritative reference |
| Title | Tutorial | Step-by-step guide |
resources/{slug}-sources.jsonundefined| 资源 | 类型 | 推荐理由 |
|---|---|---|
| 标题 | 官方文档 | 权威参考资料 |
| 标题 | 教程 | 分步操作指南 |
resources/{slug}-sources.jsonundefinedagent-knowledge/CLAUDE.mdundefinedagent-knowledge/CLAUDE.mdundefinedLearning guides created by /learn. Reference these when answering questions about listed topics.
由/learn命令创建的学习指南,回答所列主题相关问题时可参考这些内容。
| Topic | File | Sources | Depth | Created |
|---|---|---|---|---|
| {Topic 1} | {slug1}.md | {n} | medium | 2026-02-05 |
| {Topic 2} | {slug2}.md | {n} | deep | 2026-02-04 |
| 主题 | 文件 | 来源数量 | 深度 | 创建时间 |
|---|---|---|---|---|
| {主题1} | {slug1}.md | {n} | medium | 2026-02-05 |
| {主题2} | {slug2}.md | {n} | deep | 2026-02-04 |
| Keyword | Guide |
|---|---|
| recursion | recursion.md |
| hooks, react | react-hooks.md |
| 关键词 | 对应指南 |
|---|---|
| recursion | recursion.md |
| hooks, react | react-hooks.md |
Copy to `agent-knowledge/AGENTS.md` for OpenCode/Codex.
复制到 `agent-knowledge/AGENTS.md` 供OpenCode/Codex使用。agent-knowledge/resources/{slug}-sources.json{
"topic": "{original topic}",
"slug": "{slug}",
"generated": "2026-02-05T12:00:00Z",
"depth": "medium",
"totalSources": 20,
"sources": [
{
"url": "https://...",
"title": "...",
"qualityScore": 85,
"scores": {
"authority": 9,
"recency": 8,
"depth": 7,
"examples": 9,
"uniqueness": 6
},
"keyInsights": ["..."]
}
]
}agent-knowledge/resources/{slug}-sources.json{
"topic": "{original topic}",
"slug": "{slug}",
"generated": "2026-02-05T12:00:00Z",
"depth": "medium",
"totalSources": 20,
"sources": [
{
"url": "https://...",
"title": "...",
"qualityScore": 85,
"scores": {
"authority": 9,
"recency": 8,
"depth": 7,
"examples": 9,
"uniqueness": 6
},
"keyInsights": ["..."]
}
]
}| Metric | Question | Target |
|---|---|---|
| Coverage | Does guide cover main aspects? | ≥7 |
| Diversity | Are sources from diverse types? | ≥6 |
| Examples | Are code examples practical? | ≥7 |
| Accuracy | Confidence in content accuracy? | ≥8 |
| 指标 | 评分问题 | 目标分 |
|---|---|---|
| 覆盖度 | 指南是否覆盖了主题的主要方面? | ≥7 |
| 来源多样性 | 来源是否来自多种不同类型? | ≥6 |
| 示例实用性 | 代码示例是否实用? | ≥7 |
| 内容准确率 | 对内容准确率的信心? | ≥8 |
// Enhance the topic guide for RAG
Skill({ name: 'enhance-docs', args: `agent-knowledge/${slug}.md --ai` });
// Enhance the master index
Skill({ name: 'enhance-prompts', args: 'agent-knowledge/CLAUDE.md' });// 为RAG优化主题指南
Skill({ name: 'enhance-docs', args: `agent-knowledge/${slug}.md --ai` });
// 优化主索引
Skill({ name: 'enhance-prompts', args: 'agent-knowledge/CLAUDE.md' });=== LEARN_RESULT ===
{
"topic": "recursion",
"slug": "recursion",
"depth": "medium",
"guideFile": "agent-knowledge/recursion.md",
"sourcesFile": "agent-knowledge/resources/recursion-sources.json",
"sourceCount": 20,
"sourceBreakdown": {
"officialDocs": 4,
"tutorials": 5,
"stackOverflow": 3,
"blogPosts": 5,
"github": 3
},
"selfEvaluation": {
"coverage": 8,
"diversity": 7,
"examples": 9,
"accuracy": 8,
"gaps": ["tail recursion optimization not covered"]
},
"enhanced": true,
"indexUpdated": true
}
=== END_RESULT ====== LEARN_RESULT ===
{
"topic": "recursion",
"slug": "recursion",
"depth": "medium",
"guideFile": "agent-knowledge/recursion.md",
"sourcesFile": "agent-knowledge/resources/recursion-sources.json",
"sourceCount": 20,
"sourceBreakdown": {
"officialDocs": 4,
"tutorials": 5,
"stackOverflow": 3,
"blogPosts": 5,
"github": 3
},
"selfEvaluation": {
"coverage": 8,
"diversity": 7,
"examples": 9,
"accuracy": 8,
"gaps": ["tail recursion optimization not covered"]
},
"enhanced": true,
"indexUpdated": true
}
=== END_RESULT ===| Error | Action |
|---|---|
| WebSearch fails | Retry with simpler query |
| WebFetch timeout | Skip source, note in metadata |
| <minSources found | Warn user, proceed with available |
| Enhancement fails | Skip, note in output |
| Index doesn't exist | Create new index |
| 错误 | 处理动作 |
|---|---|
| WebSearch失败 | 使用更简单的查询重试 |
| WebFetch超时 | 跳过该来源,在元数据中记录 |
| 找到的来源少于最低要求 | 警告用户,使用现有资源继续 |
| 增强功能调用失败 | 跳过,在输出中记录 |
| 索引不存在 | 创建新索引 |
| Phase | Tokens | Notes |
|---|---|---|
| WebSearch queries | ~2,000 | 5-8 queries |
| Source scoring | ~1,000 | Metadata only |
| WebFetch extraction | ~40,000 | 20 sources × 2,000 avg |
| Synthesis | ~10,000 | Guide generation |
| Enhancement | ~5,000 | Two skill calls |
| Total | ~60,000 | Within opus budget |
| 阶段 | Token数量 | 说明 |
|---|---|---|
| WebSearch查询 | ~2,000 | 5-8次查询 |
| 来源评分 | ~1,000 | 仅处理元数据 |
| WebFetch内容提取 | ~40,000 | 20个来源 × 平均每个2000token |
| 内容整合 | ~10,000 | 指南生成 |
| 增强处理 | ~5,000 | 两次Skill调用 |
| 总计 | ~60,000 | 在opus模型预算范围内 |
learn-agent/learn/learnlearn-agent