Files
ECC/docs/zh-CN/skills/token-budget-advisor/SKILL.md
T
Samarjeet Singh TomarandSamarjeet Singh Tomar 754b8dd76c fix: make the installer runtime pass strict supply-chain vetting (#2503)
* fix: make the installer runtime pass strict supply-chain vetting

Remediate the four enterprise supply-chain vetting blockers from
affaan-m/ECC#2502 so the installer runtime (package.json + manifests +
scripts/lib/**) passes strict exact-pin evidence policy:

1. Remove the package.json `postinstall` lifecycle script (it only echoed a
   post-install banner) and move that banner to an explicit opt-in
   `npm run welcome` command. No install-time lifecycle script remains.
2. Exact-pin every dependency in package.json (dependencies + devDependencies)
   to the versions already resolved in package-lock.json; no ^/~ ranges.
3. Replace non-ASCII characters on the installer runtime script/config surface:
   em-dashes (U+2014) in scripts/lib/{path-safety,install-executor,
   install/link-rewrite}.js comments and the two "Itô" (U+00F4) occurrences in
   manifests/{install-components,install-modules}.json descriptions become
   ASCII, so strict-surface Unicode scanners are clean.
4. Drop the bare `require("ajv")` from scripts/lib/install-state.js; the file
   already carries a complete hand-rolled validator enforcing the same
   schemas/install-state.schema.json (ecc.install.v1) constraints, so the
   installer closure is dependency-free (zero non-builtin bare requires).

Refs affaan-m/ECC#2502

* fix: avoid unpinned welcome invocations

Signed-off-by: Samar Tomar <samar_tomar@hotmail.com>

* fix: validate translated skill frontmatter

Signed-off-by: Samar Tomar <samar_tomar@hotmail.com>

* fix: repair skill frontmatter YAML

Signed-off-by: Samar Tomar <samar_tomar@hotmail.com>

* fix: add MIT license to core skill manifests; pin verification-loop tsc invocation

* fix: preserve tsc/pyright exit status in verification-loop type-check (set -o pipefail)

* chore(deps): sync lockfiles with exact-pinned package.json

Regenerate package-lock.json and yarn.lock so the pinned dependency
specs are reflected in both lockfiles. npm ci and Yarn's --immutable
install now pass the sync check. The resolution tree is unchanged
(231 yarn resolutions, byte-identical set; zero npm transitive drift);
only the root descriptor strings move from ranges to the versions
already resolved in the committed lockfiles.

Addresses the Codex P1 on #2503.

---------

Signed-off-by: Samar Tomar <samar_tomar@hotmail.com>
Co-authored-by: Samarjeet Singh Tomar <samartomar@gmail.com>
2026-07-17 17:13:49 -04:00

5.9 KiB
Raw Blame History

name, description, origin
name description origin
token-budget-advisor 在回答前,为用户提供关于消耗多少响应深度的知情选择。当用户明确希望控制响应长度、深度或令牌预算时使用此技能。触发条件:"token budget", "token count", "token usage", "token limit", "response length", "answer depth", "short version", "brief answer", "detailed answer", "exhaustive answer", "respuesta corta vs larga", "cuántos tokens", "ahorrar tokens", "responde al 50%", "dame la versión corta", "quiero controlar cuánto usas",或用户明确要求控制答案大小或深度的清晰变体。不触发条件:用户已在当前会话中指定了级别(保持该级别),请求明显是单字答案,或"token"指代认证/会话/支付令牌而非响应大小。 community

Token预算顾问(TBA)

在Claude回答之前拦截响应流程,让用户选择回答深度。

何时使用

  • 用户希望控制回答的长度或详细程度
  • 用户提及token、预算、深度或回答长度
  • 用户说"简短版"、"太长不看"、"简要"、"25%"、"详尽"等
  • 任何用户希望预先选择深度/详细程度的情况

不要触发当:用户已在本会话中设置了级别(静默保持),或答案本身只有一行。

工作原理

第一步 — 估算输入token

使用仓库的标准上下文预算启发式方法,在脑海中估算提示词的token数量。

使用与context-budget相同的校准指南:

  • 散文:words × 1.3
  • 代码密集或混合/代码块:chars / 4

对于混合内容,使用主导内容类型并保持估算启发式方法。

第二步 — 按复杂度估算响应大小

对提示词进行分类,然后应用乘数范围获取完整响应窗口:

复杂度 乘数范围 示例提示词
简单 3× – 8× "X是什么?",是/否问题,单一事实
中等 8× – 20× "X是如何工作的?"
中高 10× – 25× 带上下文的代码请求
复杂 15× – 40× 多部分分析、比较、架构
创意 10× – 30× 故事、散文、叙事写作

响应窗口 = input_tokens × mult_min 到 input_tokens × mult_max(但不要超过模型配置的输出token限制)。

第三步 — 呈现深度选项

在回答之前呈现此区块,使用实际估算的数字:

分析您的提示...

输入:~[N] 个令牌  |  类型:[类型]  |  复杂度:[级别]  |  语言:[语言]

选择您的深度级别:

[1] 基础    (25%)  ->  ~[令牌数]   直接回答,无开场白
[2] 适中    (50%)  ->  ~[令牌数]   回答 + 背景 + 1个示例
[3] 详细    (75%)  ->  ~[令牌数]   完整回答及备选方案
[4] 详尽   (100%)  ->  ~[令牌数]   全部内容,无限制

选择哪个级别?(1-4 或说 "25% 深度", "50% 深度", "75% 深度", "100% 深度")

精确度:启发式估计约 85-90% 准确率(±15%)。

各级别token估算(在响应窗口内):

  • 25% → min + (max - min) × 0.25
  • 50% → min + (max - min) × 0.50
  • 75% → min + (max - min) × 0.75
  • 100% → max

第四步 — 按所选级别回答

级别 目标长度 包含内容 省略内容
25% 核心 最多2-4句话 直接回答、关键结论 上下文、示例、细微差别、替代方案
50% 适中 1-3个段落 答案+必要上下文+1个示例 深度分析、边界情况、参考文献
75% 详细 结构化回答 多个示例、优缺点、替代方案 极端边界情况、详尽参考文献
100% 详尽 无限制 一切内容——完整分析、所有代码、所有视角 无

快捷方式 — 跳过提问

如果用户已表明级别,立即按该级别回答,无需询问:

用户所说 级别
"1" / "25%深度" / "简短版" / "简要回答" / "太长不看" 25%
"2" / "50%深度" / "适中深度" / "平衡回答" 50%
"3" / "75%深度" / "详细回答" / "全面回答" 75%
"4" / "100%深度" / "详尽回答" / "完整深入分析" 100%

如果用户在本会话中已设置级别,后续回答静默保持该级别,除非用户更改。

精度说明

此技能使用启发式估算——非真实分词器。准确率约85-90%,偏差±15%。始终显示免责声明。

示例

触发场景

  • "先给我简短版。"
  • "你的回答会用多少token?"
  • "按50%深度回答。"
  • "我要详尽的答案,不要摘要。"
  • "先给我简短版,再给详细版。"

不触发场景

  • "什么是JWT token?"
  • "结账流程使用了一个支付token。"
  • "这正常吗?"
  • "完成重构。"
  • 用户已为本会话选择深度后的后续问题

来源

来自TBA — Claude Code的Token预算顾问的独立技能。 原始项目还附带了一个Python估算脚本,但本仓库保持技能自包含且仅使用启发式方法。