Clawd Docs V2
2026-03-28
新闻来源:网淘吧
围观:25
电脑广告
手机广告
Clawd-Docs v2.0 - 智能文档访问
本技能提供对ClawdBot文档的智能访问包含以下功能:
- 本地搜索索引- 即时关键词查询(0令牌消耗)
- 缓存片段- 预取常见答案(约300-500令牌)
- 按需获取- 需要时获取完整页面(约8-12k令牌)
- 新鲜度追踪- 按页面类型设置TTL(生存时间)
快速开始
步骤1:首先检查黄金片段
在获取任何内容之前,先检查是否存在黄金片段:
ls ~/clawd/data/docs-snippets/
可用片段(优先检查缓存!):
| 片段 | 查询匹配项 |
|---|---|
telegram-setup.md | "ako nastaviť telegram", "telegram setup" |
telegram-allowfrom.md | "allowFrom"、"谁可以给我发消息"、"访问控制" |
oauth-troubleshoot.md | "令牌过期"、"oauth 错误"、"凭据" |
update-procedure.md | "如何更新"、"更新 clawdbot" |
restart-gateway.md | "重启"、"重新启动"、"停止/启动" |
config-basics.md | "配置"、"设置"、"配置文件" |
config-providers.md | "添加提供商"、"discord 设置"、"新频道" |
memory-search.md | "记忆"、"向量搜索"、"内存"、"嵌入" |
阅读代码片段:
cat ~/clawd/data/docs-snippets/telegram-setup.md
步骤 2:搜索索引(如果代码片段不存在)
检查~/clawd/data/docs-index.json以获取页面建议。
关键词匹配:
- "telegram" → channels/telegram
- "oauth" → concepts/oauth, gateway/troubleshooting
- "update" → install/updating
- "config" → gateway/configuration
步骤 3:检查完整页面缓存
在通过 brightdata 抓取之前,检查页面是否已缓存:
# Convert path: concepts/memory → concepts_memory.md
ls ~/clawd/data/docs-cache/ | grep "concepts_memory"
如果存在,则本地读取(0 个令牌!):
cat ~/clawd/data/docs-cache/concepts_memory.md
步骤 4:抓取页面(仅当未在缓存中时)
使用原生web_fetch工具(Clawdbot 核心的一部分 - 免费且快速!):
web_fetch({ url: "https://docs.clawd.bot/{path}", extractMode: "markdown" })
示例:
web_fetch({ url: "https://docs.clawd.bot/tools/skills", extractMode: "markdown" })
web_fetch 优势:
| web_fetch | brightdata | |
|---|---|---|
| 成本 | $0(免费!) | 约 $0.003/次调用 |
| 速度 | 约 400 毫秒 | 2-5 秒 |
| 质量 | Markdown ✅ | Markdown ✅ |
搜索索引结构
位置: ~/clawd/data/docs-index.json
{
"pages": [
{
"path": "channels/telegram",
"ttl_days": 7,
"keywords": ["telegram", "tg", "bot", "allowfrom"]
}
],
"synonyms": {
"telegram": ["tg", "telegrambot"],
"configuration": ["config", "nastavenie", "settings"]
}
}
使用同义词进行模糊匹配。
TTL策略(新鲜度)
| 页面类别 | TTL | 原因 |
|---|---|---|
安装/更新 | 1天 | 始终保持最新! |
gateway/* | 7天 | 配置变更 |
channels/* | 7天 | 提供商更新 |
tools/* | 7天 | 功能添加 |
concepts/* | 14天 | 极少变更 |
reference/* | 30天 | 稳定模板 |
检查代码片段过期时间:
head -10 ~/clawd/data/docs-snippets/telegram-setup.md | grep expires
常见场景
"如何设置 Telegram?"
- ✅ 已读
~/clawd/data/docs-snippets/telegram-setup.md
"allowFrom 不工作"
- ✅ 已读
~/clawd/data/docs-snippets/telegram-allowfrom.md
"令牌过期 / OAuth 错误"
- ✅ 已读
~/clawd/data/docs-snippets/oauth-troubleshoot.md
"如何更新 ClawdBot?"
- ✅ 已读
~/clawd/data/docs-snippets/update-procedure.md
"如何添加新技能?"(无代码片段)
- 搜索索引 → tools/skills
- 获取:
web_fetch({ url: "https://docs.clawd.bot/tools/skills", extractMode: "markdown" })
"多智能体路由"
- 搜索索引 → concepts/multi-agent
- 获取:
web_fetch({ url: "https://docs.clawd.bot/concepts/multi-agent", extractMode: "markdown" })
回退方案:完整索引刷新
如果找不到所需内容:
web_fetch({ url: "https://docs.clawd.bot/llms.txt", extractMode: "markdown" })
返回完整列表所有文档页面。
令牌效率指南
| 方法 | 令牌数 | 使用时机 |
|---|---|---|
| 黄金片段 | 约300-500 | ✅ 始终首选! |
| 搜索索引 | 0 | 关键词查找 |
| 整页抓取 | 约8-12千 | 最后手段 |
| 批量抓取 | 约20-30千 | 多个相关主题 |
80-90%的查询应通过片段回答!
数据位置
~/clawd/data/
├── docs-index.json # Search index
├── docs-stats.json # Usage tracking
├── docs-snippets/ # Cached Golden Snippets
│ ├── telegram-setup.md
│ ├── telegram-allowfrom.md
│ ├── oauth-troubleshoot.md
│ ├── update-procedure.md
│ ├── restart-gateway.md
│ └── config-basics.md
└── docs-cache/ # Full page cache (future)
版本信息
| 项目 | 数值 |
|---|---|
| 技能版本 | 2.1.0 |
| 创建时间 | 2026-01-14 |
| 更新时间 | 2026-01-26 |
| 作者 | Claude Code + Clawd (协作) |
| 来源 | https://docs.clawd.bot/ |
| 依赖项 | web_fetch (Clawdbot 核心工具) |
| 索引页 | 约 50 个核心页面 |
| 精选片段 | 7 个预缓存 |
更新日志
v2.2.0 (2026-01-26)
- 迁移至 web_fetch- 将 brightdata MCP 替换为原生 Clawdbot 工具
- 优势:免费 ($0),速度更快 (~400ms 对比 2-5s)
- 无外部依赖(不再需要mcporter)
- 协作开发:Claude Code 🦞 实现,Clawd 🐾 审核
v2.1.3 (2026-01-25) - ClawdHub版本
- 文档修复:明确check与refresh的区别
v2.0.0 (2026-01-14)
- 三层架构:搜索索引 → 代码片段 → 按需获取
- 针对常见查询预缓存黄金代码片段
- 基于TTL的新鲜度追踪机制
- 支持模糊匹配的同义词功能
- 常见查询可减少80-90%的token消耗
v1.0.0 (2026-01-08)
- 初始版本仅支持brightdata获取功能
本技能提供智能文档访问功能——始终优先使用缓存片段,仅在必要时才进行获取。
文章底部电脑广告
手机广告位-内容正文底部


微信扫一扫,打赏作者吧~