ML-powered DOM pruning for 95% smaller browser prompts
用谓词的机器学习排序DOM元素替换默认浏览器快照。
将提示令牌使用量减少95%,同时保留可操作元素。
| 方法 | 令牌数 | 元素数 | 信号质量 |
|---|---|---|---|
| 无障碍树(默认) | ~18,000 | ~800 | 低(含噪声) |
| 谓词快照 |
结果: 更快的LLM推理、更低的成本、更少的重试次数。
无API密钥: 本地基于启发式的剪枝(约减少80%令牌)
有API密钥: 基于机器学习的排序以获得更干净的输出(约减少95%令牌,更少噪声)
在 predicate.systems/keys 获取免费API密钥
bash
npx clawdhub@latest install predicate-snapshot
或手动安装:
bash
git clone https://github.com/predicate-systems/predicate-snapshot-skill ~/.openclaw/skills/predicate-snapshot
cd ~/.openclaw/skills/predicate-snapshot && npm install && npm run build
如需增强的机器学习排序功能,请设置您的API密钥:
bash
export PREDICATEAPIKEY=sk-...
或在 ~/.openclaw/config.yaml 中配置:
yaml
skills:
predicate-snapshot:
api_key: sk-...
# 可选:设置使用限制
maxcreditsper_session: 100
捕获经过剪枝的DOM快照,优化用于LLM消费。
/predicate-snapshot [--limit=50] [--include-ordinal]
选项:
输出格式:
ID|role|text|imp|is_primary|docYq|ord|DG|href
42|button|Add to Cart|0.95|true|320|1|cart-actions|
15|button|Buy Now|0.92|true|340|2|cart-actions|
23|link|Product Details|0.78|false|400|0||/dp/...
通过谓词ID对元素执行操作。
/predicate-act
示例:
bash
仅限本地的快照,无需机器学习重排序(免费,精度较低)。
/predicate-snapshot-local [--limit=50]
在开发时或不需要机器学习排序功能时使用此命令。
| 层级 | 每月积分 | 价格 |
|---|---|---|
| 爱好者 | 500 | 免费 |
| 构建者 |
每次快照消耗1积分。本地快照免费。
使用前(无障碍树):
@e1 navigation Skip to main content
@e2 link Amazon
@e3 search Search Amazon
...(800+个元素)
@e742 button Add to Cart <-- 埋没在噪声中
...(更多元素)
使用后(谓词快照):
ID|role|text|imp|is_primary|docYq|ord|DG|href
42|button|Add to Cart|0.98|true|520|1|cart-actions| <-- 排名第1
15|button|Buy Now|0.95|true|540|2|cart-actions|
23|link|See All Buying...|0.72|false|560|3|cart-actions|
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 predicate-snapshot-1776306789 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 predicate-snapshot-1776306789 技能
skillhub install predicate-snapshot-1776306789
文件大小: 103.47 KB | 发布时间: 2026-4-16 18:39