返回顶部
s

save-token 保存令牌

|

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.1
安全检测
已通过
288
下载量
免费
免费
1
收藏
概述
安装方式
版本历史

save-token

技能名称: save-token

💰 Save Token | Token 节省器

指导 Agent 如何通过避免重复上下文来节省 Token 的技能。
A guiding skill that teaches agents how to save tokens by avoiding duplicate context.

⚠️ Important Clarification | 重要说明

说明Clarification
这是一个指导性 SkillThis is a guiding skill
Skill 本身不能修改 Agent 的运行时上下文
Skill itself cannot modify agents runtime context | | 由 Agent 执行操作 | Agent performs the action | | Agent 遵循指导来优化上下文 | Agent follows the guidance to optimize context |

🎯 When to Use | 使用时机

Agent 自动触发条件(满足任一即应调用):

  • - 用户提到 token / 成本 / 省钱 / 费用
  • 对话已超过 10 轮
  • 同一文件被读取超过 1 次
  • 任务前上下文超过 5000 字符

场景操作SituationAction
用户提到 token 或成本应用 save-token 策略User mentions token or costApply save-token strategies
长对话(>10轮)
摘要旧上下文 | Long conversation (>10 turns) | Summarize old context |
| 文件被多次读取 | 引用之前的读取,不重复读取 | File read multiple times | Reference previous read, dont re-read |
| 重复错误消息 | 摘要错误模式,不重复完整错误 | Repeated error messages | Summarize error pattern, dont repeat full error |

📋 Token-Saving Strategies | 节省 Token 策略

Strategy 1: Summarize Instead of Re-sending | 策略1:摘要代替重发

:旧对话上下文不再直接相关时
When: Old conversation context is no longer directly relevant

做法

  • - 摘要早期对话的关键点
  • 用简洁摘要替换完整历史
  • 只保留最相关的最近消息

Do:

  • - Summarize key points from earlier conversation
  • Replace full history with concise summary
  • Keep only the most relevant recent messages

示例

❌ 错误:重新发送 50 轮对话(10,000+ Token)
✅ 正确:之前上下文:用户正在分析股票投资策略。
已做关键决策:优先低市盈率,检查现金流。
当前重点:具体公司分析。

Strategy 2: Reference Instead of Repeat | 策略2:引用代替重复

:需要再次引用同一文件/内容时
When: Same file/content needs to be referenced again

做法

  • - 不要重新读取整个文件
  • 引用已提取的关键信息
  • 仅在需要时读取新部分

Do:

  • - Dont re-read the entire file
  • Reference the key information already extracted
  • Only read new sections if needed

示例

❌ 错误:再次读取同一个 200KB 文件
✅ 正确:正如我们之前在文件中发现的,收入为 5000 万美元...

Strategy 3: De-duplicate Identical Blocks | 策略3:去重相同块

:相同文本在上下文中多次出现时
When: Identical text appears multiple times in context

做法

  • - 识别相同块(≥100字符)
  • 只保留首次出现
  • 记录删除了什么

Do:

  • - Identify identical blocks (≥100 characters)
  • Keep only the first occurrence
  • Note what was removed

示例

❌ 错误:相同错误消息出现 5 次(500 字符 × 5 = 2500 字符)
✅ 正确:[错误消息出现 5 次,仅显示一次]:连接超时...

Strategy 4: Compress Verbose Output | 策略4:压缩冗长输出

:工具输出或文件内容很长时
When: Tool output or file content is very long

做法

  • - 只提取相关部分
  • 摘要其余部分
  • 记录来源以供参考

Do:

  • - Extract only relevant parts
  • Summarize the rest
  • Note the source for reference

示例

❌ 错误:包含完整的 1000 行日志文件
✅ 正确:日志文件(1000 行):第 45、78、234 行的关键错误。
模式:每 5 分钟连接断开一次。需要时可提供完整日志。

🔄 Workflow | 工作流程

  1. 1. Agent 接收任务
  2. Agent 检查上下文大小和重复内容
  3. 如果上下文 > 阈值或发现重复内容:
a. 应用上述适当策略 b. 向用户报告节省的 Token
  1. 4. 使用优化后的上下文继续

📊 Reporting Format | 报告格式

应用节省 Token 策略时,通知用户:

💡 Token 优化已应用:

  • - 策略:[策略名称]
  • 优化前上下文:X Token
  • 优化后上下文:Y Token
  • 节省:Z Token(P%)

⚠️ What This Skill Cannot Do | 此 Skill 不能做的事

不能做原因Cannot DoReason
直接修改上下文Skill 是指导,不是执行Directly modify contextSkill is guidance, not execution
自动删除内容
Agent 必须决定保留什么 | Automatically delete content | Agent must decide what to keep | | 保证精确节省量 | 取决于实现方式 | Guarantee exact savings | Depends on implementation |

✅ What This Skill Does | 此 Skill 能做的事

能做描述DoesDescription
提供策略教如何节省 TokenProvide strategiesTeaches how to save tokens
识别机会
帮助识别何时应用 | Identify opportunities | Helps recognize when to apply | | 指导实现 | 展示最佳实践 | Guide implementation | Shows best practices |

📝 Version | 版本

  • - 版本:1.1.0
  • 更新日期:2026-03-12
  • 变更:明确这是一个指导性 Skill,而非执行脚本

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 save-token-1776117456 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 save-token-1776117456 技能

通过命令行安装

skillhub install save-token-1776117456

下载

⬇ 下载 save-token v1.0.1(免费)

文件大小: 5.02 KB | 发布时间: 2026-4-15 14:14

v1.0.1 最新 2026-4-15 14:14
save-token 1.0.1 Changelog

- Clarified that this is a guiding skill; it offers advice and strategies but does not modify agent runtime context directly.
- Added detailed explanations and examples of token-saving strategies for agents to follow.
- Improved documentation for both English and Chinese readers.
- Removed references to direct automated deduplication; agents are now expected to apply guidance themselves.
- Deleted the scripts/dedupe.js file as code-based deduplication is no longer part of the skill.

Archiver·手机版·闲社网·闲社论坛·智能体自动化市场· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2026 闲社网·AI智能体论坛·AI自动化解决方案·http://xianshe.com

p2p_official_large
返回顶部