Hermes-agent
This commit is contained in:
+300
@@ -0,0 +1,300 @@
|
||||
---
|
||||
title: "Arxiv — 通过关键词、作者、分类或 ID 搜索 arXiv 论文"
|
||||
sidebar_label: "Arxiv"
|
||||
description: "通过关键词、作者、分类或 ID 搜索 arXiv 论文"
|
||||
---
|
||||
|
||||
{/* This page is auto-generated from the skill's SKILL.md by website/scripts/generate-skill-docs.py. Edit the source SKILL.md, not this page. */}
|
||||
|
||||
# Arxiv
|
||||
|
||||
通过关键词、作者、分类或 ID 搜索 arXiv 论文。
|
||||
|
||||
## Skill 元数据
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| 来源 | 内置(默认安装) |
|
||||
| 路径 | `skills/research/arxiv` |
|
||||
| 版本 | `1.0.0` |
|
||||
| 作者 | Hermes Agent |
|
||||
| 许可证 | MIT |
|
||||
| 平台 | linux, macos, windows |
|
||||
| 标签 | `Research`, `Arxiv`, `Papers`, `Academic`, `Science`, `API` |
|
||||
| 相关 skill | [`ocr-and-documents`](/user-guide/skills/bundled/productivity/productivity-ocr-and-documents) |
|
||||
|
||||
## 参考:完整 SKILL.md
|
||||
|
||||
:::info
|
||||
以下是 Hermes 在触发此 skill 时加载的完整 skill 定义。这是 agent 在 skill 激活时所看到的指令内容。
|
||||
:::
|
||||
|
||||
# arXiv 学术研究
|
||||
|
||||
通过 arXiv 免费 REST API 搜索并获取学术论文。无需 API key,无需额外依赖——仅使用 curl。
|
||||
|
||||
## 快速参考
|
||||
|
||||
| 操作 | 命令 |
|
||||
|--------|---------|
|
||||
| 搜索论文 | `curl "https://export.arxiv.org/api/query?search_query=all:QUERY&max_results=5"` |
|
||||
| 获取指定论文 | `curl "https://export.arxiv.org/api/query?id_list=2402.03300"` |
|
||||
| 阅读摘要(网页) | `web_extract(urls=["https://arxiv.org/abs/2402.03300"])` |
|
||||
| 阅读完整论文(PDF) | `web_extract(urls=["https://arxiv.org/pdf/2402.03300"])` |
|
||||
|
||||
## 搜索论文
|
||||
|
||||
API 返回 Atom XML 格式数据。可使用 `grep`/`sed` 解析,或通过管道传给 `python3` 获得整洁输出。
|
||||
|
||||
### 基本搜索
|
||||
|
||||
```bash
|
||||
curl -s "https://export.arxiv.org/api/query?search_query=all:GRPO+reinforcement+learning&max_results=5"
|
||||
```
|
||||
|
||||
### 整洁输出(将 XML 解析为可读格式)
|
||||
|
||||
```bash
|
||||
curl -s "https://export.arxiv.org/api/query?search_query=all:GRPO+reinforcement+learning&max_results=5&sortBy=submittedDate&sortOrder=descending" | python3 -c "
|
||||
import sys, xml.etree.ElementTree as ET
|
||||
ns = {'a': 'http://www.w3.org/2005/Atom'}
|
||||
root = ET.parse(sys.stdin).getroot()
|
||||
for i, entry in enumerate(root.findall('a:entry', ns)):
|
||||
title = entry.find('a:title', ns).text.strip().replace('\n', ' ')
|
||||
arxiv_id = entry.find('a:id', ns).text.strip().split('/abs/')[-1]
|
||||
published = entry.find('a:published', ns).text[:10]
|
||||
authors = ', '.join(a.find('a:name', ns).text for a in entry.findall('a:author', ns))
|
||||
summary = entry.find('a:summary', ns).text.strip()[:200]
|
||||
cats = ', '.join(c.get('term') for c in entry.findall('a:category', ns))
|
||||
print(f'{i+1}. [{arxiv_id}] {title}')
|
||||
print(f' Authors: {authors}')
|
||||
print(f' Published: {published} | Categories: {cats}')
|
||||
print(f' Abstract: {summary}...')
|
||||
print(f' PDF: https://arxiv.org/pdf/{arxiv_id}')
|
||||
print()
|
||||
"
|
||||
```
|
||||
|
||||
## 搜索查询语法
|
||||
|
||||
| 前缀 | 搜索范围 | 示例 |
|
||||
|--------|----------|---------|
|
||||
| `all:` | 所有字段 | `all:transformer+attention` |
|
||||
| `ti:` | 标题 | `ti:large+language+models` |
|
||||
| `au:` | 作者 | `au:vaswani` |
|
||||
| `abs:` | 摘要 | `abs:reinforcement+learning` |
|
||||
| `cat:` | 分类 | `cat:cs.AI` |
|
||||
| `co:` | 备注 | `co:accepted+NeurIPS` |
|
||||
|
||||
### 布尔运算符
|
||||
|
||||
```
|
||||
# AND(使用 + 时的默认行为)
|
||||
search_query=all:transformer+attention
|
||||
|
||||
# OR
|
||||
search_query=all:GPT+OR+all:BERT
|
||||
|
||||
# AND NOT
|
||||
search_query=all:language+model+ANDNOT+all:vision
|
||||
|
||||
# 精确短语
|
||||
search_query=ti:"chain+of+thought"
|
||||
|
||||
# 组合使用
|
||||
search_query=au:hinton+AND+cat:cs.LG
|
||||
```
|
||||
|
||||
## 排序与分页
|
||||
|
||||
| 参数 | 选项 |
|
||||
|-----------|---------|
|
||||
| `sortBy` | `relevance`, `lastUpdatedDate`, `submittedDate` |
|
||||
| `sortOrder` | `ascending`, `descending` |
|
||||
| `start` | 结果偏移量(从 0 开始) |
|
||||
| `max_results` | 结果数量(默认 10,最大 30000) |
|
||||
|
||||
```bash
|
||||
# cs.AI 分类下最新的 10 篇论文
|
||||
curl -s "https://export.arxiv.org/api/query?search_query=cat:cs.AI&sortBy=submittedDate&sortOrder=descending&max_results=10"
|
||||
```
|
||||
|
||||
## 获取指定论文
|
||||
|
||||
```bash
|
||||
# 通过 arXiv ID
|
||||
curl -s "https://export.arxiv.org/api/query?id_list=2402.03300"
|
||||
|
||||
# 多篇论文
|
||||
curl -s "https://export.arxiv.org/api/query?id_list=2402.03300,2401.12345,2403.00001"
|
||||
```
|
||||
|
||||
## 生成 BibTeX
|
||||
|
||||
获取论文元数据后,生成 BibTeX 条目:
|
||||
|
||||
{% raw %}
|
||||
```bash
|
||||
curl -s "https://export.arxiv.org/api/query?id_list=1706.03762" | python3 -c "
|
||||
import sys, xml.etree.ElementTree as ET
|
||||
ns = {'a': 'http://www.w3.org/2005/Atom', 'arxiv': 'http://arxiv.org/schemas/atom'}
|
||||
root = ET.parse(sys.stdin).getroot()
|
||||
entry = root.find('a:entry', ns)
|
||||
if entry is None: sys.exit('Paper not found')
|
||||
title = entry.find('a:title', ns).text.strip().replace('\n', ' ')
|
||||
authors = ' and '.join(a.find('a:name', ns).text for a in entry.findall('a:author', ns))
|
||||
year = entry.find('a:published', ns).text[:4]
|
||||
raw_id = entry.find('a:id', ns).text.strip().split('/abs/')[-1]
|
||||
cat = entry.find('arxiv:primary_category', ns)
|
||||
primary = cat.get('term') if cat is not None else 'cs.LG'
|
||||
last_name = entry.find('a:author', ns).find('a:name', ns).text.split()[-1]
|
||||
print(f'@article{{{last_name}{year}_{raw_id.replace(\".\", \"\")},')
|
||||
print(f' title = {{{title}}},')
|
||||
print(f' author = {{{authors}}},')
|
||||
print(f' year = {{{year}}},')
|
||||
print(f' eprint = {{{raw_id}}},')
|
||||
print(f' archivePrefix = {{arXiv}},')
|
||||
print(f' primaryClass = {{{primary}}},')
|
||||
print(f' url = {{https://arxiv.org/abs/{raw_id}}}')
|
||||
print('}')
|
||||
"
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
## 阅读论文内容
|
||||
|
||||
找到论文后,按以下方式阅读:
|
||||
|
||||
```
|
||||
# 摘要页(速度快,包含元数据和摘要)
|
||||
web_extract(urls=["https://arxiv.org/abs/2402.03300"])
|
||||
|
||||
# 完整论文(PDF → 通过 Firecrawl 转为 markdown)
|
||||
web_extract(urls=["https://arxiv.org/pdf/2402.03300"])
|
||||
```
|
||||
|
||||
本地 PDF 处理请参阅 `ocr-and-documents` skill。
|
||||
|
||||
## 常用分类
|
||||
|
||||
| 分类 | 领域 |
|
||||
|----------|-------|
|
||||
| `cs.AI` | 人工智能 |
|
||||
| `cs.CL` | 计算与语言(NLP) |
|
||||
| `cs.CV` | 计算机视觉 |
|
||||
| `cs.LG` | 机器学习 |
|
||||
| `cs.CR` | 密码学与安全 |
|
||||
| `stat.ML` | 机器学习(统计) |
|
||||
| `math.OC` | 优化与控制 |
|
||||
| `physics.comp-ph` | 计算物理 |
|
||||
|
||||
完整列表:https://arxiv.org/category_taxonomy
|
||||
|
||||
## 辅助脚本
|
||||
|
||||
`scripts/search_arxiv.py` 脚本负责处理 XML 解析并提供整洁输出:
|
||||
|
||||
```bash
|
||||
python scripts/search_arxiv.py "GRPO reinforcement learning"
|
||||
python scripts/search_arxiv.py "transformer attention" --max 10 --sort date
|
||||
python scripts/search_arxiv.py --author "Yann LeCun" --max 5
|
||||
python scripts/search_arxiv.py --category cs.AI --sort date
|
||||
python scripts/search_arxiv.py --id 2402.03300
|
||||
python scripts/search_arxiv.py --id 2402.03300,2401.12345
|
||||
```
|
||||
|
||||
无需额外依赖——仅使用 Python 标准库。
|
||||
|
||||
---
|
||||
|
||||
## Semantic Scholar(引用、相关论文、作者主页)
|
||||
|
||||
arXiv 不提供引用数据或推荐功能。请使用 **Semantic Scholar API**——免费,基本使用无需 API key(1 次请求/秒),返回 JSON 格式。
|
||||
|
||||
### 获取论文详情及引用信息
|
||||
|
||||
```bash
|
||||
# 通过 arXiv ID
|
||||
curl -s "https://api.semanticscholar.org/graph/v1/paper/arXiv:2402.03300?fields=title,authors,citationCount,referenceCount,influentialCitationCount,year,abstract" | python3 -m json.tool
|
||||
|
||||
# 通过 Semantic Scholar 论文 ID 或 DOI
|
||||
curl -s "https://api.semanticscholar.org/graph/v1/paper/DOI:10.1234/example?fields=title,citationCount"
|
||||
```
|
||||
|
||||
### 获取引用该论文的文献(被引情况)
|
||||
|
||||
```bash
|
||||
curl -s "https://api.semanticscholar.org/graph/v1/paper/arXiv:2402.03300/citations?fields=title,authors,year,citationCount&limit=10" | python3 -m json.tool
|
||||
```
|
||||
|
||||
### 获取该论文的参考文献(引用情况)
|
||||
|
||||
```bash
|
||||
curl -s "https://api.semanticscholar.org/graph/v1/paper/arXiv:2402.03300/references?fields=title,authors,year,citationCount&limit=10" | python3 -m json.tool
|
||||
```
|
||||
|
||||
### 搜索论文(arXiv 搜索的替代方案,返回 JSON)
|
||||
|
||||
```bash
|
||||
curl -s "https://api.semanticscholar.org/graph/v1/paper/search?query=GRPO+reinforcement+learning&limit=5&fields=title,authors,year,citationCount,externalIds" | python3 -m json.tool
|
||||
```
|
||||
|
||||
### 获取论文推荐
|
||||
|
||||
```bash
|
||||
curl -s -X POST "https://api.semanticscholar.org/recommendations/v1/papers/" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"positivePaperIds": ["arXiv:2402.03300"], "negativePaperIds": []}' | python3 -m json.tool
|
||||
```
|
||||
|
||||
### 作者主页
|
||||
|
||||
```bash
|
||||
curl -s "https://api.semanticscholar.org/graph/v1/author/search?query=Yann+LeCun&fields=name,hIndex,citationCount,paperCount" | python3 -m json.tool
|
||||
```
|
||||
|
||||
### 常用 Semantic Scholar 字段
|
||||
|
||||
`title`、`authors`、`year`、`abstract`、`citationCount`、`referenceCount`、`influentialCitationCount`、`isOpenAccess`、`openAccessPdf`、`fieldsOfStudy`、`publicationVenue`、`externalIds`(包含 arXiv ID、DOI 等)
|
||||
|
||||
---
|
||||
|
||||
## 完整研究工作流
|
||||
|
||||
1. **发现论文**:`python scripts/search_arxiv.py "your topic" --sort date --max 10`
|
||||
2. **评估影响力**:`curl -s "https://api.semanticscholar.org/graph/v1/paper/arXiv:ID?fields=citationCount,influentialCitationCount"`
|
||||
3. **阅读摘要**:`web_extract(urls=["https://arxiv.org/abs/ID"])`
|
||||
4. **阅读完整论文**:`web_extract(urls=["https://arxiv.org/pdf/ID"])`
|
||||
5. **查找相关工作**:`curl -s "https://api.semanticscholar.org/graph/v1/paper/arXiv:ID/references?fields=title,citationCount&limit=20"`
|
||||
6. **获取推荐**:向 Semantic Scholar 推荐接口发送 POST 请求
|
||||
7. **追踪作者**:`curl -s "https://api.semanticscholar.org/graph/v1/author/search?query=NAME"`
|
||||
|
||||
## 速率限制
|
||||
|
||||
| API | 速率 | 认证 |
|
||||
|-----|------|------|
|
||||
| arXiv | 约 1 次请求 / 3 秒 | 无需认证 |
|
||||
| Semantic Scholar | 1 次请求 / 秒 | 无需认证(有 API key 可达 100 次/秒) |
|
||||
|
||||
## 注意事项
|
||||
|
||||
- arXiv 返回 Atom XML——使用辅助脚本或解析代码片段获得整洁输出
|
||||
- Semantic Scholar 返回 JSON——通过管道传给 `python3 -m json.tool` 提升可读性
|
||||
- arXiv ID 格式:旧格式(`hep-th/0601001`)与新格式(`2402.03300`)
|
||||
- PDF:`https://arxiv.org/pdf/{id}` — 摘要:`https://arxiv.org/abs/{id}`
|
||||
- HTML(如有):`https://arxiv.org/html/{id}`
|
||||
- 本地 PDF 处理请参阅 `ocr-and-documents` skill
|
||||
|
||||
## ID 版本控制
|
||||
|
||||
- `arxiv.org/abs/1706.03762` 始终解析为**最新**版本
|
||||
- `arxiv.org/abs/1706.03762v1` 指向某个**特定**不可变版本
|
||||
- 生成引用时,请保留你实际阅读的版本后缀,以防引用漂移(后续版本可能对内容有重大修改)
|
||||
- API 的 `<id>` 字段返回带版本号的 URL(例如 `http://arxiv.org/abs/1706.03762v7`)
|
||||
|
||||
## 已撤回论文
|
||||
|
||||
论文提交后可能被撤回。发生这种情况时:
|
||||
- `<summary>` 字段会包含撤回声明(注意查找 "withdrawn" 或 "retracted" 字样)
|
||||
- 元数据字段可能不完整
|
||||
- 在将某条结果视为有效论文之前,请务必检查摘要内容
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
---
|
||||
title: "Blogwatcher — 通过 blogwatcher-cli 工具监控博客和 RSS/Atom 订阅源"
|
||||
sidebar_label: "Blogwatcher"
|
||||
description: "通过 blogwatcher-cli 工具监控博客和 RSS/Atom 订阅源"
|
||||
---
|
||||
|
||||
{/* This page is auto-generated from the skill's SKILL.md by website/scripts/generate-skill-docs.py. Edit the source SKILL.md, not this page. */}
|
||||
|
||||
# Blogwatcher
|
||||
|
||||
通过 blogwatcher-cli 工具监控博客和 RSS/Atom 订阅源。
|
||||
|
||||
## Skill 元数据
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| 来源 | 内置(默认安装) |
|
||||
| 路径 | `skills/research/blogwatcher` |
|
||||
| 版本 | `2.0.0` |
|
||||
| 作者 | JulienTant (fork of Hyaxia/blogwatcher) |
|
||||
| 许可证 | MIT |
|
||||
| 平台 | linux, macos, windows |
|
||||
| 标签 | `RSS`, `Blogs`, `Feed-Reader`, `Monitoring` |
|
||||
|
||||
## 参考:完整 SKILL.md
|
||||
|
||||
:::info
|
||||
以下是 Hermes 在触发此 skill 时加载的完整 skill 定义。这是 agent 在 skill 激活时所看到的指令内容。
|
||||
:::
|
||||
|
||||
# Blogwatcher
|
||||
|
||||
使用 `blogwatcher-cli` 工具追踪博客和 RSS/Atom 订阅源的更新。支持自动订阅源发现、HTML 抓取回退、OPML 导入,以及文章已读/未读管理。
|
||||
|
||||
## 安装
|
||||
|
||||
选择以下任一方式:
|
||||
|
||||
- **Go:** `go install github.com/JulienTant/blogwatcher-cli/cmd/blogwatcher-cli@latest`
|
||||
- **Docker:** `docker run --rm -v blogwatcher-cli:/data ghcr.io/julientant/blogwatcher-cli`
|
||||
- **二进制文件(Linux amd64):** `curl -sL https://github.com/JulienTant/blogwatcher-cli/releases/latest/download/blogwatcher-cli_linux_amd64.tar.gz | tar xz -C /usr/local/bin blogwatcher-cli`
|
||||
- **二进制文件(Linux arm64):** `curl -sL https://github.com/JulienTant/blogwatcher-cli/releases/latest/download/blogwatcher-cli_linux_arm64.tar.gz | tar xz -C /usr/local/bin blogwatcher-cli`
|
||||
- **二进制文件(macOS Apple Silicon):** `curl -sL https://github.com/JulienTant/blogwatcher-cli/releases/latest/download/blogwatcher-cli_darwin_arm64.tar.gz | tar xz -C /usr/local/bin blogwatcher-cli`
|
||||
- **二进制文件(macOS Intel):** `curl -sL https://github.com/JulienTant/blogwatcher-cli/releases/latest/download/blogwatcher-cli_darwin_amd64.tar.gz | tar xz -C /usr/local/bin blogwatcher-cli`
|
||||
|
||||
所有发布版本:https://github.com/JulienTant/blogwatcher-cli/releases
|
||||
|
||||
### Docker 持久化存储
|
||||
|
||||
默认情况下,数据库位于 `~/.blogwatcher-cli/blogwatcher-cli.db`。在 Docker 中,容器重启后数据会丢失。使用 `BLOGWATCHER_DB` 或挂载卷来持久化数据:
|
||||
|
||||
```bash
|
||||
# 命名卷(最简单)
|
||||
docker run --rm -v blogwatcher-cli:/data -e BLOGWATCHER_DB=/data/blogwatcher-cli.db ghcr.io/julientant/blogwatcher-cli scan
|
||||
|
||||
# 主机绑定挂载
|
||||
docker run --rm -v /path/on/host:/data -e BLOGWATCHER_DB=/data/blogwatcher-cli.db ghcr.io/julientant/blogwatcher-cli scan
|
||||
```
|
||||
|
||||
### 从原版 blogwatcher 迁移
|
||||
|
||||
如果从 `Hyaxia/blogwatcher` 升级,请移动数据库文件:
|
||||
|
||||
```bash
|
||||
mv ~/.blogwatcher/blogwatcher.db ~/.blogwatcher-cli/blogwatcher-cli.db
|
||||
```
|
||||
|
||||
二进制文件名已从 `blogwatcher` 更改为 `blogwatcher-cli`。
|
||||
|
||||
## 常用命令
|
||||
|
||||
### 管理博客
|
||||
|
||||
- 添加博客:`blogwatcher-cli add "My Blog" https://example.com`
|
||||
- 指定订阅源添加:`blogwatcher-cli add "My Blog" https://example.com --feed-url https://example.com/feed.xml`
|
||||
- 使用 HTML 抓取添加:`blogwatcher-cli add "My Blog" https://example.com --scrape-selector "article h2 a"`
|
||||
- 列出已追踪博客:`blogwatcher-cli blogs`
|
||||
- 移除博客:`blogwatcher-cli remove "My Blog" --yes`
|
||||
- 从 OPML 导入:`blogwatcher-cli import subscriptions.opml`
|
||||
|
||||
### 扫描与阅读
|
||||
|
||||
- 扫描所有博客:`blogwatcher-cli scan`
|
||||
- 扫描单个博客:`blogwatcher-cli scan "My Blog"`
|
||||
- 列出未读文章:`blogwatcher-cli articles`
|
||||
- 列出所有文章:`blogwatcher-cli articles --all`
|
||||
- 按博客筛选:`blogwatcher-cli articles --blog "My Blog"`
|
||||
- 按分类筛选:`blogwatcher-cli articles --category "Engineering"`
|
||||
- 标记文章为已读:`blogwatcher-cli read 1`
|
||||
- 标记文章为未读:`blogwatcher-cli unread 1`
|
||||
- 全部标记为已读:`blogwatcher-cli read-all`
|
||||
- 标记某博客全部已读:`blogwatcher-cli read-all --blog "My Blog" --yes`
|
||||
|
||||
## 环境变量
|
||||
|
||||
所有标志均可通过带 `BLOGWATCHER_` 前缀的环境变量设置:
|
||||
|
||||
| 变量 | 描述 |
|
||||
|---|---|
|
||||
| `BLOGWATCHER_DB` | SQLite 数据库文件路径 |
|
||||
| `BLOGWATCHER_WORKERS` | 并发扫描 worker 数量(默认:8) |
|
||||
| `BLOGWATCHER_SILENT` | 扫描时仅输出"scan done" |
|
||||
| `BLOGWATCHER_YES` | 跳过确认提示 |
|
||||
| `BLOGWATCHER_CATEGORY` | 按分类筛选文章的默认值 |
|
||||
|
||||
## 示例输出
|
||||
|
||||
```
|
||||
$ blogwatcher-cli blogs
|
||||
Tracked blogs (1):
|
||||
|
||||
xkcd
|
||||
URL: https://xkcd.com
|
||||
Feed: https://xkcd.com/atom.xml
|
||||
Last scanned: 2026-04-03 10:30
|
||||
```
|
||||
|
||||
```
|
||||
$ blogwatcher-cli scan
|
||||
Scanning 1 blog(s)...
|
||||
|
||||
xkcd
|
||||
Source: RSS | Found: 4 | New: 4
|
||||
|
||||
Found 4 new article(s) total!
|
||||
```
|
||||
|
||||
```
|
||||
$ blogwatcher-cli articles
|
||||
Unread articles (2):
|
||||
|
||||
[1] [new] Barrel - Part 13
|
||||
Blog: xkcd
|
||||
URL: https://xkcd.com/3095/
|
||||
Published: 2026-04-02
|
||||
Categories: Comics, Science
|
||||
|
||||
[2] [new] Volcano Fact
|
||||
Blog: xkcd
|
||||
URL: https://xkcd.com/3094/
|
||||
Published: 2026-04-01
|
||||
Categories: Comics
|
||||
```
|
||||
|
||||
## 注意事项
|
||||
|
||||
- 未提供 `--feed-url` 时,自动从博客主页发现 RSS/Atom 订阅源。
|
||||
- 若 RSS 失败且已配置 `--scrape-selector`,则回退至 HTML 抓取。
|
||||
- RSS/Atom 订阅源中的分类会被存储,可用于筛选文章。
|
||||
- 支持从 Feedly、Inoreader、NewsBlur 等导出的 OPML 文件批量导入博客。
|
||||
- 数据库默认存储于 `~/.blogwatcher-cli/blogwatcher-cli.db`(可通过 `--db` 或 `BLOGWATCHER_DB` 覆盖)。
|
||||
- 使用 `blogwatcher-cli <command> --help` 查看所有标志和选项。
|
||||
+469
@@ -0,0 +1,469 @@
|
||||
---
|
||||
title: "Llm Wiki — Karpathy 的 LLM Wiki:构建/查询互联 Markdown 知识库"
|
||||
sidebar_label: "Llm Wiki"
|
||||
description: "Karpathy 的 LLM Wiki:构建/查询互联 Markdown 知识库"
|
||||
---
|
||||
|
||||
{/* This page is auto-generated from the skill's SKILL.md by website/scripts/generate-skill-docs.py. Edit the source SKILL.md, not this page. */}
|
||||
|
||||
# Llm Wiki
|
||||
|
||||
Karpathy 的 LLM Wiki:构建/查询互联 Markdown 知识库。
|
||||
|
||||
## Skill 元数据
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| 来源 | 内置(默认安装) |
|
||||
| 路径 | `skills/research/llm-wiki` |
|
||||
| 版本 | `2.1.0` |
|
||||
| 作者 | Hermes Agent |
|
||||
| 许可证 | MIT |
|
||||
| 平台 | linux, macos, windows |
|
||||
| 标签 | `wiki`, `knowledge-base`, `research`, `notes`, `markdown`, `rag-alternative` |
|
||||
| 相关 skill | [`obsidian`](/user-guide/skills/bundled/note-taking/note-taking-obsidian), [`arxiv`](/user-guide/skills/bundled/research/research-arxiv) |
|
||||
|
||||
## 参考:完整 SKILL.md
|
||||
|
||||
:::info
|
||||
以下是 Hermes 在触发此 skill 时加载的完整 skill 定义。这是 skill 激活时 agent 看到的指令内容。
|
||||
:::
|
||||
|
||||
# Karpathy 的 LLM Wiki
|
||||
|
||||
将知识库构建并维护为互联 Markdown 文件,持续积累、复利增长。
|
||||
基于 [Andrej Karpathy 的 LLM Wiki 模式](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f)。
|
||||
|
||||
与传统 RAG(每次查询都从头重新发现知识)不同,wiki 只编译一次知识并保持更新。交叉引用已就位,矛盾已被标记,综合分析反映了所有已摄入的内容。
|
||||
|
||||
**分工:** 人类负责筛选来源并指导分析。Agent 负责摘要、交叉引用、归档和维护一致性。
|
||||
|
||||
## 此 Skill 的激活时机
|
||||
|
||||
当用户执行以下操作时使用此 skill:
|
||||
- 要求创建、构建或启动 wiki 或知识库
|
||||
- 要求将某个来源摄入(ingest)、添加或处理到 wiki 中
|
||||
- 提出问题,且配置路径下已存在 wiki
|
||||
- 要求对 wiki 进行 lint、审计或健康检查
|
||||
- 在研究场景中提及其 wiki、知识库或"笔记"
|
||||
|
||||
## Wiki 位置
|
||||
|
||||
**位置:** 通过 `WIKI_PATH` 环境变量设置(例如在 `~/.hermes/.env` 中)。
|
||||
|
||||
未设置时,默认为 `~/wiki`。
|
||||
|
||||
```bash
|
||||
WIKI="${WIKI_PATH:-$HOME/wiki}"
|
||||
```
|
||||
|
||||
Wiki 只是一个 Markdown 文件目录——可在 Obsidian、VS Code 或任意编辑器中打开。无需数据库,无需特殊工具。
|
||||
|
||||
## 架构:三层结构
|
||||
|
||||
<!-- ascii-guard-ignore -->
|
||||
```
|
||||
wiki/
|
||||
├── SCHEMA.md # Conventions, structure rules, domain config
|
||||
├── index.md # Sectioned content catalog with one-line summaries
|
||||
├── log.md # Chronological action log (append-only, rotated yearly)
|
||||
├── raw/ # Layer 1: Immutable source material
|
||||
│ ├── articles/ # Web articles, clippings
|
||||
│ ├── papers/ # PDFs, arxiv papers
|
||||
│ ├── transcripts/ # Meeting notes, interviews
|
||||
│ └── assets/ # Images, diagrams referenced by sources
|
||||
├── entities/ # Layer 2: Entity pages (people, orgs, products, models)
|
||||
├── concepts/ # Layer 2: Concept/topic pages
|
||||
├── comparisons/ # Layer 2: Side-by-side analyses
|
||||
└── queries/ # Layer 2: Filed query results worth keeping
|
||||
```
|
||||
<!-- ascii-guard-ignore-end -->
|
||||
|
||||
**第一层——原始来源:** 不可变。Agent 只读,不修改。
|
||||
**第二层——Wiki 正文:** Agent 拥有的 Markdown 文件,由 Agent 创建、更新和交叉引用。
|
||||
**第三层——Schema:** `SCHEMA.md` 定义结构、约定和标签分类体系。
|
||||
|
||||
## 恢复已有 Wiki(关键——每次会话都必须执行)
|
||||
|
||||
当用户已有 wiki 时,**在执行任何操作前务必先定位自身**:
|
||||
|
||||
① **读取 `SCHEMA.md`** — 了解领域、约定和标签分类体系。
|
||||
② **读取 `index.md`** — 了解已有页面及其摘要。
|
||||
③ **扫描近期 `log.md`** — 读取最后 20-30 条记录,了解近期活动。
|
||||
|
||||
```bash
|
||||
WIKI="${WIKI_PATH:-$HOME/wiki}"
|
||||
# Orientation reads at session start
|
||||
read_file "$WIKI/SCHEMA.md"
|
||||
read_file "$WIKI/index.md"
|
||||
read_file "$WIKI/log.md" offset=<last 30 lines>
|
||||
```
|
||||
|
||||
只有完成定位后,才可进行摄入、查询或 lint 操作。这可以防止:
|
||||
- 为已存在的实体创建重复页面
|
||||
- 遗漏对已有内容的交叉引用
|
||||
- 违反 schema 约定
|
||||
- 重复已记录的工作
|
||||
|
||||
对于大型 wiki(100+ 页),在创建任何新内容前,还需针对当前主题快速执行 `search_files`。
|
||||
|
||||
## 初始化新 Wiki
|
||||
|
||||
当用户要求创建或启动 wiki 时:
|
||||
|
||||
1. 确定 wiki 路径(从 `$WIKI_PATH` 环境变量获取,或询问用户;默认 `~/wiki`)
|
||||
2. 创建上述目录结构
|
||||
3. 询问用户 wiki 涵盖的领域——要具体
|
||||
4. 编写针对该领域定制的 `SCHEMA.md`(见下方模板)
|
||||
5. 编写带分节标题的初始 `index.md`
|
||||
6. 编写包含创建条目的初始 `log.md`
|
||||
7. 确认 wiki 已就绪,并建议首批摄入来源
|
||||
|
||||
### SCHEMA.md 模板
|
||||
|
||||
根据用户领域进行调整。Schema 约束 Agent 行为并确保一致性:
|
||||
|
||||
```markdown
|
||||
# Wiki Schema
|
||||
|
||||
## Domain
|
||||
[What this wiki covers — e.g., "AI/ML research", "personal health", "startup intelligence"]
|
||||
|
||||
## Conventions
|
||||
- File names: lowercase, hyphens, no spaces (e.g., `transformer-architecture.md`)
|
||||
- Every wiki page starts with YAML frontmatter (see below)
|
||||
- Use `[[wikilinks]]` to link between pages (minimum 2 outbound links per page)
|
||||
- When updating a page, always bump the `updated` date
|
||||
- Every new page must be added to `index.md` under the correct section
|
||||
- Every action must be appended to `log.md`
|
||||
- **Provenance markers:** On pages that synthesize 3+ sources, append `^[raw/articles/source-file.md]`
|
||||
at the end of paragraphs whose claims come from a specific source. This lets a reader trace each
|
||||
claim back without re-reading the whole raw file. Optional on single-source pages where the
|
||||
`sources:` frontmatter is enough.
|
||||
|
||||
## Frontmatter
|
||||
```yaml
|
||||
---
|
||||
title: Page Title
|
||||
created: YYYY-MM-DD
|
||||
updated: YYYY-MM-DD
|
||||
type: entity | concept | comparison | query | summary
|
||||
tags: [from taxonomy below]
|
||||
sources: [raw/articles/source-name.md]
|
||||
# Optional quality signals:
|
||||
confidence: high | medium | low # how well-supported the claims are
|
||||
contested: true # set when the page has unresolved contradictions
|
||||
contradictions: [other-page-slug] # pages this one conflicts with
|
||||
---
|
||||
```
|
||||
|
||||
`confidence` 和 `contested` 是可选字段,但对于观点性强或快速变化的主题建议填写。Lint 会将 `contested: true` 和 `confidence: low` 的页面标记出来供审查,防止薄弱论断悄然固化为公认的 wiki 事实。
|
||||
|
||||
### raw/ Frontmatter
|
||||
|
||||
原始来源**同样**需要一个小型 frontmatter 块,以便重新摄入时检测内容漂移:
|
||||
|
||||
```yaml
|
||||
---
|
||||
source_url: https://example.com/article # original URL, if applicable
|
||||
ingested: YYYY-MM-DD
|
||||
sha256: <hex digest of the raw content below the frontmatter>
|
||||
---
|
||||
```
|
||||
|
||||
`sha256:` 字段允许未来重新摄入同一 URL 时,在内容未变时跳过处理,在内容已变时标记漂移。仅对正文(frontmatter 结束 `---` 之后的所有内容)计算哈希,不含 frontmatter 本身。
|
||||
|
||||
## Tag Taxonomy
|
||||
[Define 10-20 top-level tags for the domain. Add new tags here BEFORE using them.]
|
||||
|
||||
Example for AI/ML:
|
||||
- Models: model, architecture, benchmark, training
|
||||
- People/Orgs: person, company, lab, open-source
|
||||
- Techniques: optimization, fine-tuning, inference, alignment, data
|
||||
- Meta: comparison, timeline, controversy, prediction
|
||||
|
||||
Rule: every tag on a page must appear in this taxonomy. If a new tag is needed,
|
||||
add it here first, then use it. This prevents tag sprawl.
|
||||
|
||||
## Page Thresholds
|
||||
- **Create a page** when an entity/concept appears in 2+ sources OR is central to one source
|
||||
- **Add to existing page** when a source mentions something already covered
|
||||
- **DON'T create a page** for passing mentions, minor details, or things outside the domain
|
||||
- **Split a page** when it exceeds ~200 lines — break into sub-topics with cross-links
|
||||
- **Archive a page** when its content is fully superseded — move to `_archive/`, remove from index
|
||||
|
||||
## Entity Pages
|
||||
One page per notable entity. Include:
|
||||
- Overview / what it is
|
||||
- Key facts and dates
|
||||
- Relationships to other entities ([[wikilinks]])
|
||||
- Source references
|
||||
|
||||
## Concept Pages
|
||||
One page per concept or topic. Include:
|
||||
- Definition / explanation
|
||||
- Current state of knowledge
|
||||
- Open questions or debates
|
||||
- Related concepts ([[wikilinks]])
|
||||
|
||||
## Comparison Pages
|
||||
Side-by-side analyses. Include:
|
||||
- What is being compared and why
|
||||
- Dimensions of comparison (table format preferred)
|
||||
- Verdict or synthesis
|
||||
- Sources
|
||||
|
||||
## Update Policy
|
||||
When new information conflicts with existing content:
|
||||
1. Check the dates — newer sources generally supersede older ones
|
||||
2. If genuinely contradictory, note both positions with dates and sources
|
||||
3. Mark the contradiction in frontmatter: `contradictions: [page-name]`
|
||||
4. Flag for user review in the lint report
|
||||
```
|
||||
|
||||
### index.md 模板
|
||||
|
||||
索引按类型分节。每条记录为一行:wikilink + 摘要。
|
||||
|
||||
```markdown
|
||||
# Wiki Index
|
||||
|
||||
> Content catalog. Every wiki page listed under its type with a one-line summary.
|
||||
> Read this first to find relevant pages for any query.
|
||||
> Last updated: YYYY-MM-DD | Total pages: N
|
||||
|
||||
## Entities
|
||||
<!-- Alphabetical within section -->
|
||||
|
||||
## Concepts
|
||||
|
||||
## Comparisons
|
||||
|
||||
## Queries
|
||||
```
|
||||
|
||||
**扩展规则:** 当任意分节超过 50 条时,按首字母或子领域拆分为子节。当索引总条目超过 200 时,创建 `_meta/topic-map.md`,按主题对页面分组,以加快导航速度。
|
||||
|
||||
### log.md 模板
|
||||
|
||||
```markdown
|
||||
# Wiki Log
|
||||
|
||||
> Chronological record of all wiki actions. Append-only.
|
||||
> Format: `## [YYYY-MM-DD] action | subject`
|
||||
> Actions: ingest, update, query, lint, create, archive, delete
|
||||
> When this file exceeds 500 entries, rotate: rename to log-YYYY.md, start fresh.
|
||||
|
||||
## [YYYY-MM-DD] create | Wiki initialized
|
||||
- Domain: [domain]
|
||||
- Structure created with SCHEMA.md, index.md, log.md
|
||||
```
|
||||
|
||||
## 核心操作
|
||||
|
||||
### 1. 摄入(Ingest)
|
||||
|
||||
当用户提供来源(URL、文件、粘贴内容)时,将其整合到 wiki 中:
|
||||
|
||||
① **捕获原始来源:**
|
||||
- URL → 使用 `web_extract` 获取 Markdown,保存到 `raw/articles/`
|
||||
- PDF → 使用 `web_extract`(支持 PDF),保存到 `raw/papers/`
|
||||
- 粘贴文本 → 保存到对应的 `raw/` 子目录
|
||||
- 文件名应具有描述性:`raw/articles/karpathy-llm-wiki-2026.md`
|
||||
- **添加 raw frontmatter**(`source_url`、`ingested`、正文的 `sha256`)。
|
||||
重新摄入同一 URL 时:重新计算 sha256,与已存储值比较——相同则跳过,不同则标记漂移并更新。此操作成本极低,每次重新摄入都可执行,能捕获静默的来源变更。
|
||||
|
||||
② **与用户讨论要点** — 哪些内容有趣,哪些对领域重要。(自动化/cron 场景下跳过此步,直接继续。)
|
||||
|
||||
③ **检查已有内容** — 搜索 index.md,并使用 `search_files` 查找已提及实体/概念的现有页面。这是 wiki 持续增长与变成重复堆砌之间的关键区别。
|
||||
|
||||
④ **编写或更新 wiki 页面:**
|
||||
- **新实体/概念:** 仅在满足 SCHEMA.md 中页面阈值时创建页面(2+ 来源提及,或在某一来源中处于核心地位)
|
||||
- **已有页面:** 添加新信息,更新事实,更新 `updated` 日期。新信息与已有内容矛盾时,遵循更新策略。
|
||||
- **交叉引用:** 每个新建或更新的页面必须通过 `[[wikilinks]]` 链接到至少 2 个其他页面。检查已有页面是否有反向链接。
|
||||
- **标签:** 只使用 SCHEMA.md 分类体系中的标签
|
||||
- **来源溯源:** 在综合 3+ 来源的页面上,在论断可追溯到特定来源的段落末尾添加 `^[raw/articles/source.md]` 标记。
|
||||
- **置信度:** 对于观点性强、快速变化或单一来源的论断,在 frontmatter 中设置 `confidence: medium` 或 `low`。除非论断在多个来源中有充分支撑,否则不标记 `high`。
|
||||
|
||||
⑤ **更新导航:**
|
||||
- 将新页面按字母顺序添加到 `index.md` 对应分节
|
||||
- 更新 index 头部的"Total pages"计数和"Last updated"日期
|
||||
- 追加到 `log.md`:`## [YYYY-MM-DD] ingest | Source Title`
|
||||
- 在日志条目中列出每个创建或更新的文件
|
||||
|
||||
⑥ **报告变更内容** — 向用户列出每个创建或更新的文件。
|
||||
|
||||
单个来源可能触发 5-15 个 wiki 页面的更新。这是正常且期望的结果——这正是复利效应。
|
||||
|
||||
### 2. 查询(Query)
|
||||
|
||||
当用户就 wiki 领域提问时:
|
||||
|
||||
① **读取 `index.md`** 以识别相关页面。
|
||||
② **对于 100+ 页的 wiki**,还需对所有 `.md` 文件执行 `search_files` 搜索关键词——仅靠索引可能遗漏相关内容。
|
||||
③ **读取相关页面**,使用 `read_file`。
|
||||
④ **从已编译的知识中综合答案**。引用所参考的 wiki 页面:"Based on [[page-a]] and [[page-b]]..."
|
||||
⑤ **将有价值的答案归档** — 如果答案是实质性的比较、深度分析或新颖综合,在 `queries/` 或 `comparisons/` 中创建页面。不要归档琐碎的查询——只归档重新推导代价高昂的答案。
|
||||
⑥ **更新 log.md**,记录查询内容及是否已归档。
|
||||
|
||||
### 3. Lint
|
||||
|
||||
当用户要求 lint、健康检查或审计 wiki 时:
|
||||
|
||||
① **孤立页面:** 查找没有其他页面通过 `[[wikilinks]]` 指向的页面。
|
||||
```python
|
||||
# Use execute_code for this — programmatic scan across all wiki pages
|
||||
import os, re
|
||||
from collections import defaultdict
|
||||
wiki = "<WIKI_PATH>"
|
||||
# Scan all .md files in entities/, concepts/, comparisons/, queries/
|
||||
# Extract all [[wikilinks]] — build inbound link map
|
||||
# Pages with zero inbound links are orphans
|
||||
```
|
||||
|
||||
② **断开的 wikilink:** 查找指向不存在页面的 `[[links]]`。
|
||||
|
||||
③ **索引完整性:** 每个 wiki 页面都应出现在 `index.md` 中。对比文件系统与索引条目。
|
||||
|
||||
④ **Frontmatter 验证:** 每个 wiki 页面必须包含所有必填字段(title、created、updated、type、tags、sources)。标签必须在分类体系中。
|
||||
|
||||
⑤ **过时内容:** `updated` 日期比提及相同实体的最新来源早 90 天以上的页面。
|
||||
|
||||
⑥ **矛盾:** 涉及同一主题但论断相互冲突的页面。查找共享标签/实体但陈述不同事实的页面。将所有带有 `contested: true` 或 `contradictions:` frontmatter 的页面标记出来供用户审查。
|
||||
|
||||
⑦ **质量信号:** 列出 `confidence: low` 的页面,以及仅引用单一来源但未设置 confidence 字段的页面——这些页面是寻找佐证或降级为 `confidence: medium` 的候选。
|
||||
|
||||
⑧ **来源漂移:** 对 `raw/` 中每个带有 `sha256:` frontmatter 的文件,重新计算哈希并标记不匹配项。不匹配表明原始文件被编辑(不应发生——`raw/` 是不可变的)或从已变更的 URL 摄入。不是硬性错误,但值得报告。
|
||||
|
||||
⑨ **页面大小:** 标记超过 200 行的页面——拆分候选。
|
||||
|
||||
⑩ **标签审计:** 列出所有使用中的标签,标记不在 SCHEMA.md 分类体系中的标签。
|
||||
|
||||
⑪ **日志轮转:** 如果 log.md 超过 500 条,进行轮转。
|
||||
|
||||
⑫ **报告发现结果**,附具体文件路径和建议操作,按严重程度分组(断开链接 > 孤立页面 > 来源漂移 > 有争议页面 > 过时内容 > 样式问题)。
|
||||
|
||||
⑬ **追加到 log.md:** `## [YYYY-MM-DD] lint | N issues found`
|
||||
|
||||
## Wiki 使用方法
|
||||
|
||||
### 搜索
|
||||
|
||||
```bash
|
||||
# Find pages by content
|
||||
search_files "transformer" path="$WIKI" file_glob="*.md"
|
||||
|
||||
# Find pages by filename
|
||||
search_files "*.md" target="files" path="$WIKI"
|
||||
|
||||
# Find pages by tag
|
||||
search_files "tags:.*alignment" path="$WIKI" file_glob="*.md"
|
||||
|
||||
# Recent activity
|
||||
read_file "$WIKI/log.md" offset=<last 20 lines>
|
||||
```
|
||||
|
||||
### 批量摄入
|
||||
|
||||
同时摄入多个来源时,批量处理更新:
|
||||
1. 先读取所有来源
|
||||
2. 识别所有来源中的所有实体和概念
|
||||
3. 一次性检查所有实体的已有页面(一次搜索,而非 N 次)
|
||||
4. 一次性创建/更新页面(避免冗余更新)
|
||||
5. 最后统一更新 index.md
|
||||
6. 写一条涵盖整批操作的日志条目
|
||||
|
||||
### 归档
|
||||
|
||||
当内容完全被取代或领域范围发生变化时:
|
||||
1. 如不存在则创建 `_archive/` 目录
|
||||
2. 将页面移至 `_archive/`,保留原始路径(例如 `_archive/entities/old-page.md`)
|
||||
3. 从 `index.md` 中移除
|
||||
4. 更新所有链接到该页面的页面——将 wikilink 替换为纯文本 + "(已归档)"
|
||||
5. 记录归档操作
|
||||
|
||||
### Obsidian 集成
|
||||
|
||||
Wiki 目录开箱即用作为 Obsidian vault:
|
||||
- `[[wikilinks]]` 渲染为可点击链接
|
||||
- 图谱视图可视化知识网络
|
||||
- YAML frontmatter 支持 Dataview 查询
|
||||
- `raw/assets/` 文件夹存放通过 `![[image.png]]` 引用的图片
|
||||
|
||||
最佳实践:
|
||||
- 将 Obsidian 的附件文件夹设置为 `raw/assets/`
|
||||
- 在 Obsidian 设置中启用"Wikilinks"(通常默认开启)
|
||||
- 安装 Dataview 插件,支持如 `TABLE tags FROM "entities" WHERE contains(tags, "company")` 的查询
|
||||
|
||||
如果同时使用 Obsidian skill,将 `OBSIDIAN_VAULT_PATH` 设置为与 wiki 路径相同的目录。
|
||||
|
||||
### Obsidian 无头模式(服务器和无显示器机器)
|
||||
|
||||
在没有显示器的机器上,使用 `obsidian-headless` 代替桌面应用。它通过 Obsidian Sync 同步 vault,无需 GUI——非常适合在服务器上运行、向 wiki 写入内容,同时在另一台设备上用 Obsidian 桌面端读取的 Agent。
|
||||
|
||||
**设置:**
|
||||
```bash
|
||||
# Requires Node.js 22+
|
||||
npm install -g obsidian-headless
|
||||
|
||||
# Login (requires Obsidian account with Sync subscription)
|
||||
ob login --email <email> --password '<password>'
|
||||
|
||||
# Create a remote vault for the wiki
|
||||
ob sync-create-remote --name "LLM Wiki"
|
||||
|
||||
# Connect the wiki directory to the vault
|
||||
cd ~/wiki
|
||||
ob sync-setup --vault "<vault-id>"
|
||||
|
||||
# Initial sync
|
||||
ob sync
|
||||
|
||||
# Continuous sync (foreground — use systemd for background)
|
||||
ob sync --continuous
|
||||
```
|
||||
|
||||
**通过 systemd 实现持续后台同步:**
|
||||
```ini
|
||||
# ~/.config/systemd/user/obsidian-wiki-sync.service
|
||||
[Unit]
|
||||
Description=Obsidian LLM Wiki Sync
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/path/to/ob sync --continuous
|
||||
WorkingDirectory=/home/user/wiki
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
```
|
||||
|
||||
```bash
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable --now obsidian-wiki-sync
|
||||
# Enable linger so sync survives logout:
|
||||
sudo loginctl enable-linger $USER
|
||||
```
|
||||
|
||||
这样 Agent 可以在服务器上向 `~/wiki` 写入内容,同时你在笔记本/手机上的 Obsidian 中浏览同一 vault——变更在数秒内即可同步。
|
||||
|
||||
## 注意事项
|
||||
|
||||
- **永远不要修改 `raw/` 中的文件** — 来源是不可变的。更正内容写入 wiki 页面。
|
||||
- **始终先定位自身** — 在新会话中执行任何操作前,先读取 SCHEMA + index + 近期日志。跳过此步会导致重复和遗漏交叉引用。
|
||||
- **始终更新 index.md 和 log.md** — 跳过此步会导致 wiki 退化。这两个文件是导航骨架。
|
||||
- **不要为一笔带过的提及创建页面** — 遵循 SCHEMA.md 中的页面阈值。某个名称在脚注中出现一次,不足以创建实体页面。
|
||||
- **不要创建没有交叉引用的页面** — 孤立页面是不可见的。每个页面必须链接到至少 2 个其他页面。
|
||||
- **Frontmatter 是必填的** — 它支持搜索、过滤和过时检测。
|
||||
- **标签必须来自分类体系** — 自由形式的标签会退化为噪音。先在 SCHEMA.md 中添加新标签,再使用。
|
||||
- **保持页面可扫描** — wiki 页面应在 30 秒内可读完。超过 200 行的页面应拆分。将详细分析移至专用深度分析页面。
|
||||
- **批量更新前先确认** — 如果一次摄入会影响 10+ 个已有页面,先与用户确认范围。
|
||||
- **轮转日志** — 当 log.md 超过 500 条时,将其重命名为 `log-YYYY.md` 并重新开始。Agent 应在 lint 期间检查日志大小。
|
||||
- **显式处理矛盾** — 不要静默覆盖。注明两种论断及其日期,在 frontmatter 中标记,标记供用户审查。
|
||||
|
||||
## 相关工具
|
||||
|
||||
[llm-wiki-compiler](https://github.com/atomicmemory/llm-wiki-compiler) 是一个 Node.js CLI,基于相同的 Karpathy 灵感将来源编译为概念 wiki。它兼容 Obsidian,因此希望使用定时/CLI 驱动编译流水线的用户可以将其指向此 skill 维护的同一 vault。权衡:它拥有页面生成的控制权(取代 Agent 在页面创建上的判断),并针对小型语料库进行了调优。当你希望 Agent 参与策划时使用此 skill;当你希望批量编译来源目录时使用 llmwiki。
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
---
|
||||
title: "Polymarket — 查询 Polymarket:市场、价格、订单簿、历史记录"
|
||||
sidebar_label: "Polymarket"
|
||||
description: "查询 Polymarket:市场、价格、订单簿、历史记录"
|
||||
---
|
||||
|
||||
{/* This page is auto-generated from the skill's SKILL.md by website/scripts/generate-skill-docs.py. Edit the source SKILL.md, not this page. */}
|
||||
|
||||
# Polymarket
|
||||
|
||||
查询 Polymarket:市场、价格、订单簿、历史记录。
|
||||
|
||||
## Skill 元数据
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| 来源 | 内置(默认安装) |
|
||||
| 路径 | `skills/research/polymarket` |
|
||||
| 版本 | `1.0.0` |
|
||||
| 作者 | Hermes Agent + Teknium |
|
||||
| 平台 | linux, macos, windows |
|
||||
|
||||
## 参考:完整 SKILL.md
|
||||
|
||||
:::info
|
||||
以下是 Hermes 在触发此 skill 时加载的完整 skill 定义。这是 agent 在 skill 激活时所看到的指令内容。
|
||||
:::
|
||||
|
||||
# Polymarket — 预测市场数据
|
||||
|
||||
使用 Polymarket 的公开 REST API 查询预测市场数据。
|
||||
所有端点均为只读,无需任何身份验证。
|
||||
|
||||
完整端点参考及 curl 示例请见 `references/api-endpoints.md`。
|
||||
|
||||
## 使用场景
|
||||
|
||||
- 用户询问预测市场、博彩赔率或事件概率
|
||||
- 用户想了解"X 发生的概率是多少?"
|
||||
- 用户专门询问 Polymarket
|
||||
- 用户需要市场价格、订单簿数据或价格历史
|
||||
- 用户希望监控或追踪预测市场动态
|
||||
|
||||
## 核心概念
|
||||
|
||||
- **Events(事件)** 包含一个或多个 **Markets(市场)**(1:many 关系)
|
||||
- **Markets** 是二元结果,Yes/No 价格区间为 0.00 到 1.00
|
||||
- 价格即概率:价格 0.65 表示市场认为该事件有 65% 的可能性发生
|
||||
- `outcomePrices` 字段:JSON 编码的数组,格式如 `["0.80", "0.20"]`
|
||||
- `clobTokenIds` 字段:包含两个 token ID 的 JSON 编码数组 [Yes, No],用于价格/订单簿查询
|
||||
- `conditionId` 字段:十六进制字符串,用于价格历史查询
|
||||
- 成交量单位为 USDC(美元)
|
||||
|
||||
## 三个公开 API
|
||||
|
||||
1. **Gamma API**,地址 `gamma-api.polymarket.com` — 发现、搜索、浏览
|
||||
2. **CLOB API**,地址 `clob.polymarket.com` — 实时价格、订单簿、历史记录
|
||||
3. **Data API**,地址 `data-api.polymarket.com` — 交易记录、未平仓合约
|
||||
|
||||
## 典型工作流程
|
||||
|
||||
当用户询问预测市场赔率时:
|
||||
|
||||
1. **搜索** — 使用 Gamma API 的 public-search 端点,传入用户的查询词
|
||||
2. **解析** — 处理响应,提取 events 及其嵌套的 markets
|
||||
3. **展示** — 市场问题、当前价格(以百分比表示)及成交量
|
||||
4. **深入分析** — 如有需要,使用 `clobTokenIds` 查询订单簿,使用 `conditionId` 查询历史记录
|
||||
|
||||
## 结果展示
|
||||
|
||||
将价格格式化为百分比以提高可读性:
|
||||
- `outcomePrices` 为 `["0.652", "0.348"]` 时,展示为"Yes: 65.2%,No: 34.8%"
|
||||
- 始终显示市场问题和概率
|
||||
- 有成交量时一并展示
|
||||
|
||||
示例:`"Will X happen?" — 65.2% Yes(成交量 $1.2M)`
|
||||
|
||||
## 解析双重编码字段
|
||||
|
||||
Gamma API 返回的 `outcomePrices`、`outcomes` 和 `clobTokenIds` 是 JSON 响应中的 JSON 字符串(双重编码)。在 Python 中处理时,需使用 `json.loads(market['outcomePrices'])` 解析以获取实际数组。
|
||||
|
||||
## 速率限制
|
||||
|
||||
限制宽松,正常使用基本不会触发:
|
||||
- Gamma:每 10 秒 4,000 次请求(通用)
|
||||
- CLOB:每 10 秒 9,000 次请求(通用)
|
||||
- Data:每 10 秒 1,000 次请求(通用)
|
||||
|
||||
## 限制说明
|
||||
|
||||
- 此 skill 为只读模式,不支持下单交易
|
||||
- 交易需要基于钱包的加密身份验证(EIP-712 签名)
|
||||
- 部分新市场的价格历史可能为空
|
||||
- 交易受地理限制,但只读数据在全球范围内均可访问
|
||||
+2395
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user