This repository was archived by the owner on Sep 21, 2026. It is now read-only.
perf: /quota 单次 token 成本降约 43% - #3
Merged
Merged
Conversation
问题:自定义命令本质是一段 prompt,查额度反而要烧一轮对话,与"省额度"的目的相悖。 实测单次 /quota 约 680 tokens。 优化(两处零风险改动): - 命令正文 731 -> 311 字符(约 243 -> 103 tokens):去掉冗余说明 - 明确要求 agent 不要复述面板:工具调用的输出本就显示在界面上, 回复改为 1-3 行结论(约 177 -> 40 tokens) 优化后约 390 tokens/次,省约 43%。 同时把成本分析和零 token 方案写进中英文 README: - ZCode 没有给插件留应用内组件位;hook 渲染的记录只有状态/耗时/名称, 没有输出字段,因此 hook 也无法显示内容(已在 zcode.cjs 核对) - 命令正文的内联 shell 展开确实存在,但 Windows 上用的是 cmd.exe 而非 bash, 只有写死路径才可用、走市场安装会硬失败,故未采用 - 唯一零 token 方式:--serve 当本地页面在内置浏览器面板里打开,每 30s 刷新 版本 1.2.0,同步更新官方市场 PR zai-org/zcode-plugins#19。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
自定义命令本质上是一段 prompt。
/quota注入正文 → agent 运行脚本 → 面板文本经过模型,所以查额度反而要烧一轮对话,与省额度的目的相悖。实测单次约 680 tokens。
两处零风险改动
工具调用的输出本来就显示在界面上,让 agent 再抄一遍纯属浪费——这是最大的一处节省。
一并查清的机制(已写进中英文 README)
没有输出字段(在
resources/glm/zcode.cjs核对)。同类插件2877905731/zcode-quota的做法是直接改
app.asar,每次 ZCode 更新失效,不适合官方市场。ltt()只在显式传shellProfile: posix-bash时用 bash;内联展开路径没传,Windows 上落到
cmd.exe—— 写死路径才可用,走市场安装会硬失败,故未采用。--serve把面板当本地页面在内置浏览器面板打开,每 30s 刷新。验证
node scripts/check.mjs48/48claude plugin validate --strict通过zai-org/zcode-plugins#19已同步升到 v1.2.0,其validate.py(OK: 27 plugins)、build_dist.py、git diff --check均通过