credits-saver
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "credits-saver":https://skillpi.com/zh/skills/deepskill-4f465699f5336006ac496c61a7cf5d9c66bb1f0958f96c880a81b60938780b80。安装前核对上游来源和版本:https://skillhub.cn/skills/user_9e42ec7a/credits-saver。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
skillhub.cn
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
WorkBuddy / CodeBuddy 的 Token 与计费优化指南。在用户询问如何减少 token/credits 消耗、对话费用上升原因、如何选择更省模型、是否使用 /compact 压缩上下文、控制上下文体积或处理上下文窗口超限及中文 token 偏多问题时加载;覆盖 token 原理、平台计费依据及按性价比排序的实操清单。
介绍来源: third_party · user_9e42ec7a · 1.0.2 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 适合谁
- User asks how to save tokens / Credits, reduce cost, or why a conversation is getting expensive. User mentions context window limits, truncation, or "context 暴死". User asks which model is cheaper, or whether to use an expert / skill / `/compact`. User writes long replies, dumps large files, or runs many Bash commands in one conversation. Proactively: when a conversation has clearly drifted across unrelated topics, or accumulated many rounds, suggest a fresh conversation or `/compact`. **Tier triggers (整词匹配,防误触):** the user saying **`geek`** switches the current session to the Advanced mode; saying **`special`** invokes the Special mode for that one message; saying **`默认` / `default` / `退回默认`
- 实测状态
- 未测试
文件浏览
Frontmatter
name: credits-saver
description: WorkBuddy / CodeBuddy 省 Token 与计费优化指南。当用户询问如何减少 token / Credits 消耗、为什么对话越聊越贵、如何选更省的模型、是否该用 /compact 压缩上下文、如何控制上下文体积、提到上下文窗口超限、或中文消耗 token 偏多等场景时加载。覆盖 token 底层原理、平台计费依据与按性价比排序的实操清单。
agent_created: trueToken Saver — 省 Token 与计费优化指南
Purpose
This skill distills why WorkBuddy / CodeBuddy conversations consume tokens (and Credits) the way they do, and turns that understanding into a prioritized, repeatable optimization checklist. Load it whenever token cost, conversation expense, context size, or model selection comes up, so the assistant proactively applies token-efficient behavior instead of waiting to be reminded.
默认模式(你什么都不用做):AI 自动套用省 Token 清单——写文件、限长、精简提示、压上下文——答案正确性偏差≈0。进阶的
geek(极致省、有偏差)/special(特殊变换)是可选开关,不懂可完全忽略;它们只在你说对应词、且确认后才启用。
When to use
- User asks how to save tokens / Credits, reduce cost, or why a conversation is getting expensive.
- User mentions context window limits, truncation, or "context 暴死".
- User asks which model is cheaper, or whether to use an expert / skill /
/compact. - User writes long replies, dumps large files, or runs many Bash commands in one conversation.
- Proactively: when a conversation has clearly drifted across unrelated topics, or accumulated many rounds, suggest a fresh conversation or
/compact. - Tier triggers (整词匹配,防误触): the user saying
geekswitches the current session to the Advanced mode; sayingspecialinvokes the Special mode for that one message; saying默认/default/退回默认/恢复默认returns to the Default mode from any tier. The Special mode (e.g. translating content to English to save tokens) is invoked only on explicitspecial; otherwise ignore any hint to "translate to save tokens." - Hard guardrail (仅捕获用户自身指令句):
geek/special/ 回退词 are matched only in text the user actively types in their own instruction message — occurrences inside pasted code, files, logs, or quoted/referenced content do NOT count as a trigger. A bare word (e.g. a variable namedgeek, or "special case" in a pasted README) must never switch modes. - Activation confirmation gate (回显确认门): before switching into Advanced or Special, the assistant must echo a confirmation and wait — e.g. "是否开启 geek 模式?" / "是否开启 special 模式?" — and only activate after the user confirms (or when the same message already clearly states the intent to enable). If unconfirmed, stay in the Default mode; never switch silently.
Scope / 适用范围(通用原理 vs 平台特有)
本 skill 内容分两层,调用前先区分,避免把平台特有结论误用到其他产品:
- 通用原理(适用于所有基于 LLM 的编码 / 对话助手):BPE 分词、中英文效率差(中文吃亏)、一次请求 = 输入 + 输出、输出单价更高、逐轮重发历史、上下文窗口上限——这些在 WorkBuddy、CodeBuddy、Codex(OpenAI)、Claude Code(Anthropic)、Cursor、GitHub Copilot Chat、Cline、Aider 等平台均成立。省 Token 的"原理层"方法(单任务单对话、长内容写文件、精简提示、及时压缩)也普遍适用。
- 平台特有(仅 WorkBuddy / CodeBuddy):Credits 计费模型、GLM 系列原生适配利用率、
CODEBUDDY_*系列环境变量、/compact命令、专家模式与执行类技能的初始化溢价——这些只对应 WorkBuddy/CodeBuddy。其他平台有等价机制(如 Claude Code 的/compact、Codex 的上下文管理、各家的自动压缩),但具体命令名、变量名、计费口径不同,需按对应平台官方文档替换,不要直接照搬本 skill 的环境变量与命令。
社区分析中"模型加权 ×1.3~1.8、技能 +200~500 token 溢价"等具体数字为第三方推测,官方未公开,仅作量级参考;对其他平台不可直接套用。
Core token fundamentals (why there is room to optimize)
Tokens are the atomic unit the model processes — text is split by a tokenizer (BPE) into tokens, not characters or words. Key consequences:
- Chinese is token-inefficient. One common English word ≈ 1 token; one Chinese character ≈ 1 token. Same meaning costs ~2–3× more in Chinese. This is a structural "exchange-rate disadvantage" for Chinese users.
- One request = input + output tokens. Input = system prompt + history + current question + tool/file results + multimodal image translation. Output = generated answer, reasoning, code, tables.
- Output is usually 3–5× more expensive per token (serial generation, re-reads full context each step), but because prefix context is long, total cost is usually dominated by input.
- Context window = input + output cap. Exceeding it (e.g. 128K / 200K) errors or truncates history.
- History is re-sent every turn. Each new message re-packages the entire conversation to the model, so per-turn input grows cumulatively — the single biggest driver of escalating cost.
- Prompt caching softens the "re-send penalty". Many models cache repeated prefixes (system prompt + stable history); once cached, later turns hit the cache at a much lower rate, so the per-turn "full-price resend" anxiety is overstated. The first turn and cache misses still bill at full rate — don't assume caching alone makes history free.
For the detailed mechanism and the platform's secondary billing折算 (model weighting, skill premiums, context folding), load references/token-fundamentals.md.
Platform billing factors (WorkBuddy / CodeBuddy)
- Credits are the quota unit; every conversation-related request consumes Credits.
- Official, confirmed drivers: model token pricing (advanced models cost more per token) + task complexity (long code analysis, multi-turn dialog, knowledge-base retrieval cost more) + per-turn history resend.
- GLM-series models are natively adapted → highest token utilization; external models (Kimi / DeepSeek, etc.) carry a weighting premium.
- Expert mode and execution-type skills (docx / excel_batch, etc.) add fixed initialization overhead.
- WorkBuddy already auto-compresses context via
CODEBUDDY_PRE_MESSAGE_COMPACT_PCT(default 10%) and deep summarization near the window limit — these reduce, but do not eliminate, manual optimization needs.
Prioritized optimization checklist
Apply in this order (highest leverage first). Use it as a self-audit whenever cost is a concern.
| Priority | Method | Why / Effect |
|---|---|---|
| 🔴 Highest | Use /compact first (before topic drift / when history piles up) |
Manually compress to avoid piling unrelated history — the default first move for any long or drifting conversation. Keeps state, costs less than restarting. |
| 🟠 High | One task, one conversation — but ONLY for stateless, independently deliverable tasks | Clearing history zeroes input tokens; 量级上可省下一大块(具体倍率未证实,见 references)。前提标签:仅无状态任务——需跨轮连续调试/构建的 Agent 任务,用 /compact 而非开新对话,否则丢状态反而更贵。只在任务可一次性独立交付时才开新对话。 |
| 🟠 High | State the full requirement once; avoid multi-round rework | Every extra round re-sends the whole history. |
| 🟠 High | Write long output to files, not chat | Ask the assistant to write reports/code to .docx/.py/.md; chat returns only conclusions — 省下大量输出 token(量级见 references)。默认写文件前应确认路径,避免误覆盖、留痕与敏感内容泄露。 |
| 🟡 Medium | Keep prompts terse; drop pleasantries | One fewer filler line × every round. |
| 🟡 Medium | Batch similar tasks together | Fewer rounds, less System Prompt reload. |
| 🟡 Medium | Request brief replies / cap output length | Directly cuts the most expensive (output) tokens. |
| 🟢 Model | Prefer GLM-series; avoid external models when saving matters | Native adaptation = higher utilization, no weighting premium. |
| 🟢 Model | Don't over-use expert mode / execution skills | Domain memory load and skill init have fixed premiums. |
One-line principle: 少说、少改、一次到位、及时压缩 (say less, change less, get it right the first time, compact promptly).
Usage tiers / 用法分级(默认为主,进阶可选)
Not everyone wants the same aggressiveness. Tiering lets most users get safe savings with zero friction, while geeks can opt into extreme savings and self-accept the deviation risk. Core rule: deviation risk = whether the tier touches the content itself. Default mode only changes packaging (how content is wrapped/presented) → the model's answer is unchanged → answer-correctness deviation ≈ 0 (packaging only; side effects like file-overwrite/leak are listed under Risks, not counted as answer deviation). Advanced mode changes precision (truncation, model switch, lower vars) → bounded deviation, must warn each time. Special mode changes content itself (translation) → largest, least practical deviation.
| Tier | For whom | Allowed optimizations | Deviation source | Trigger | Scope |
|---|---|---|---|---|---|
| Default / 默认 | Most users | Write-to-file, length cap, terse prompts, one-task-one-convo, /compact, default GLM |
None (packaging only) | Always on; AI does it proactively | Global / permanent |
Advanced / 高级 (geek) |
Power geeks | Lower COMPACT_PCT / BASH_MAX_OUTPUT_LENGTH / TOOL_RESULT_THRESHOLD_KB, aggressive truncation, model downgrade, harsher length cap |
Truncation drops mid-errors, weaker model, lower precision | User says geek |
Current session; rollback to Default; memory is user's own choice (see below) |
Special / 特殊 (special) |
Rare | Unconventional transforms like translating content to English before sending | Translation alters meaning, wrong answers, least practical | User says special |
Current session, single-message granularity |
Trigger words (whole-word match to avoid false triggers): geek → Advanced; special → Special; 默认 / default / 退回默认 / 恢复默认 → back to Default. The three tiers are fully interchangeable — geek enters Advanced from any tier, special enters Special from any tier (Default or Advanced), rollback returns to Default from any tier. It is not a single chain.
Special mode lifecycle (single-message, must inform): on special, the assistant sets an internal flag and applies the transform only to that one message, then must immediately reset to the prior mode and broadcast (a forced step, not optional prose):
- Prior mode
geek: "special服务结束,您之前开启的geek模式继续为您服务。" - Prior mode
default: "special服务结束,您之前开启的default模式继续为您服务。" The special mode never persists; the flag is cleared the moment that message is handled, and the[special 模式·本条]status tag disappears with it.
Advanced mode memory (optional, user-controlled — never preset/forced): the skill does not auto-remember "user prefers Advanced." Whether to persist is entirely the user's decision (e.g. they set it in their own user-level MEMORY.md/preferences). The skill's How to apply only describes Advanced as session-scoped and geek-triggered; it contains no "remember last tier" logic.
Advanced mode state mechanism: the Advanced state is maintained by the assistant only within the current session and does not persist across sessions. If at any point the assistant is unsure which mode is active, it must default to the Default mode and not silently stay aggressive. While in Advanced or Special mode, the assistant appends a lightweight status tag to its replies (e.g. [geek 模式] / [special 模式·本条]) so the user always knows the current mode; the special tag clears once that message is handled.
How to apply during a session (Default tier / 默认模式)
核心原则:优化由 AI 主动代劳,用户无需学任何命令。 普通用户既不会、也不愿去记
/compact、环境变量或自测脚本——这些只作可选的进阶手段。AI 应直接把优化做出来,而不是等用户自己操作。本小节描述默认模式行为;高级模式见Config knobs,特殊模式见When to use触发说明。
- When starting a complex or long task, proactively do it for the user: write the result to a file and keep chat to conclusions; after the task, suggest a fresh conversation. For non-destructive writes (new file, or path not yet occupied), default to a safe path (e.g. current workspace
outputs/or session dir) and tell the user the path afterward — no pre-emptive blocking question. Only ask first when the write could overwrite an existing file, to avoid accidental overwrite, leftover traces, and leaking sensitive content. - When a conversation drifts or grows past ~10–15 rounds on mixed topics, default to
/compactto compress history (recommended first); only suggest a fresh conversation when the task is stateless and independently deliverable — and if the user agrees, just do it. - When the user pastes large files or expects long outputs, default to file output rather than inline text.
- When model choice is open, default to a GLM-series model unless the user needs an external model's specific capability.
- Keep the assistant's own replies concise; honor explicit length caps — and judge for the user when "brief" vs "thorough" is right (don't make them micromanage character counts).
Examples (默认模式样板)
看真实对话长什么样 → references/examples.md(含长文档写文件、/compact、原理解释、geek/special 触发 4 个片段)。两个最小样板:
- 长内容写文件(Before → After): 用户把 2000 行文档整段贴进对话(每轮重发,输入暴涨)→ 用户说"存成文件你读文件分析,聊天只给结论",AI 写
outputs/design.md、聊天仅回要点(文档只进一次上下文,量级最多省约九成)。 - 对话跑偏(Before → After): 一轮聊了 20 轮跨多个主题、越来越贵 → 用户说"帮我压一下上下文",AI 执行
/compact保留状态(而非盲目开新对话丢进度)。
用户常见疑问(中文为什么费 token、转英文会不会降质量、写文件会不会泄露等)速答见 references/faq.md(独立 FAQ 汇总页,含「症状 → 答案」速查树)。
Self-test script
scripts/token_selfcheck.py 是配套的自测工具,纯标准库、离线、只读、可直接执行而不必读入上下文(省 token)。用法:
python scripts/token_selfcheck.py <文件或目录>— 估算 token 数,对照上下文窗口给出占比与压缩 / 文件化建议。python scripts/token_selfcheck.py— 从 stdin 读取文本估算(如管道传入)。python scripts/token_selfcheck.py --env— 仅打印 WorkBuddy 压缩相关环境变量(CODEBUDDY_PRE_MESSAGE_COMPACT_PCT等)当前设置与说明。- 支持
--window <N>自定义上下文窗口(默认 128000)。
注意:估算为启发式量级值,非精确 BPE;中文约 1 token/字、英文约 1 token/词、代码更密。脚本会按 CJK 占比分类型标定 ±带宽:中文为主 ±15%、英文为主 ±35%(启发式系统性偏高、对英文不可靠)、中英混合/代码 ±25%。token 数 ≠ 最终 Credits——Credits 还受模型加权(外部模型 ×1.3~1.8,社区推测未证实)与技能初始化溢价等二次折算影响,"省 N% token"不直接等于"省 N% 积分"。精确计费以平台用量统计为准。
Config knobs (Advanced tier / geek — 高级模式)
These tune WorkBuddy's own compression aggressiveness. Scope: only active in the Advanced tier (session where the user said geek). They are not applied in the Default tier.
CODEBUDDY_PRE_MESSAGE_COMPACT_PCT(default 10%): lower (e.g. 5%) → compress more aggressively each turn.BASH_MAX_OUTPUT_LENGTH(default 30000 chars): lower it to cap single Bash output into context (keeps head 20% + tail 80% beyond limit).CODEBUDDY_TOOL_RESULT_THRESHOLD_KB(default 50KB): lower it so oversized tool results go to local disk with only a placeholder in context.
Advanced-tier rule: before applying any of these (lower var / aggressive truncation / model downgrade / harsher length cap), the assistant must warn the user of the deviation first and let them veto — never apply silently. Still honor safety baselines (e.g. confirm file path before writing). The user can return to Default anytime with
默认/default/退回默认/恢复默认.
Risks & boundaries / 风险与边界(按模式)
These are the failure modes surfaced during expert review — read before acting on any specific number.
Default tier / 默认模式(几乎无风险)
- Community numbers are order-of-magnitude, not fact. "省 40~50%", "输出贵 3~5 倍", "第 20 轮是第 1 轮 11 倍" come from single community measurements with no control group, no variance, possible survivor bias. Treat as magnitude only; your real saving = your own usage statistics.
- The self-test script is a heuristic estimate. "1 Chinese char ≈ 1 token / 1 English word ≈ 1 token" diverges from real BPE (English words often >1 token; code density varies). The script labels its ±band by language/code type (中文 ±15% / 英文 ±35% / 混合·代码 ±25%) because the heuristic is systematically biased — never base financial decisions on it; treat tiktoken's "cl100k 代理基准" column as a cross-check only (it is OpenAI's tokenizer, not WorkBuddy/GLM's, and deviates most on CJK).
- "One task, one conversation" has a precondition — and is deliberately NOT the top priority. Apply only to stateless, independently deliverable tasks. For multi-turn debugging/building Agent tasks, force-starting a new conversation loses state and causes rework — use
/compactinstead. That is why/compactis listed first. - Writing files has side effects. For destructive writes confirm the path before defaulting to file output; avoid accidental overwrite, leftover traces, and leaking sensitive content.
- Prompt caching eases the re-send penalty (see Core fundamentals #6) — but first turn and cache misses still bill fully. (Default-mode answer-correctness deviation ≈ 0: all operations are packaging-only and do not change the model's answer; note length-capping and proactive
/compactare bounded deviations, not absolutely zero, and side effects like file-overwrite/leak are listed separately — so "≈ 0" means answer correctness, not "overall deviation is absolutely 0".)
Advanced tier / 高级模式(geek,有偏差,需每次提醒)
- Lowering env vars can backfire. Too-low
COMPACT_PCTloses precision;BASH_MAX_OUTPUT_LENGTHtruncation (head 20% + tail 80%) drops middle errors and can miss diagnostics. Lower them only for "many local commands / large files" tasks, and verify in small steps. Model downgrade weakens capability. The assistant must warn of deviation before each such action (see Config knobs rule) and honor rollback to Default.
Special tier / 特殊模式(special,偏差最大、最不实用)
- Translation alters meaning. Translating content to English (or other transforms) before sending can change the original intent and produce wrong answers; it is impractical for most Chinese users. The assistant invokes it only on explicit
special, warns strongly beforehand, applies it for that one message only, then falls back and informs the user via the fixed phrase (see Usage tiers). The measured "≈33% token saving from translating to English" is kept only as a magnitude footnote here — non-practical, illustrative only. This trick is not in the prioritized optimization checklist above — it is the least practical item, kept only as a Special-mode option; it yields net benefit only when you can read the model's English output directly and the content is mostly code / symbols / edge cases.
Cross-platform
- Don't copy commands/vars across platforms.
/compactandCODEBUDDY_*are WorkBuddy/CodeBuddy only. Other platforms have equivalents with different names (see Scope).
Validation suggestion (for the curious): A/B the checklist — same task set, with vs without the optimizations, logging real Credits/tokens and rounds over several repeats; take the mean and a confidence interval. Calibrate the script against a real tokenizer (e.g. tiktoken) on a sample to derive a correction factor. A ready-to-use template (design + recording table + stats method) lives in references/ab_test_template.md.
Caveat
Model-weighting multipliers and skill "+200–500 token" premiums cited in community analyses are not officially published — treat them as order-of-magnitude only. Official docs confirm only: model pricing + task complexity + per-turn history resend. For precise cost estimates, track real usage over a task flow rather than extrapolating a single run. See references/token-fundamentals.md for the full breakdown.
当前收录版本
1.0.2
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 WorkBuddy/CodeBuddy 的 Token/Credits 优化指南,覆盖高频刚需场景(如减少消耗、模型选择、上下文压缩)
- 具有明确实用价值,受众广泛,属于通用工具类别
亮点
- description 清晰列出多种触发场景,覆盖合理且边界清晰
- 触发词定义明确,防误触机制完善
待提升项
-
description写错位置 原报告严重程度:轻微
顶层 frontmatter 中 description 与 skill_body 内重复,但内容一致
改进建议:建议移除 skill_body 内的重复 description 字段,保持唯一性
亮点
- 文档结构完整,含 Purpose、When to use、Core fundamentals、Checklist、Usage tiers、Examples、Risks 等章节
- 步骤清晰,有出口条件和示例,frontmatter 完整
亮点
- 工具建议(如 /compact、写文件)来源明确,参数说明清晰
- 覆盖主要异常(如文件覆盖确认、模式切换确认),不可逆操作有确认机制
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。