Communitygithub.com

令牌预算顾问 (TBA)

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

令牌预算顾问 (TBA) 是什么?

令牌预算顾问 (Token Budget Advisor, TBA) 是一项 AI 代理技能,旨在赋能用户控制 Claude 等模型的回复长度和详细程度。该技能通过启发式估算输入令牌数并评估问题的复杂度,自动生成四种深度选项(25% 精简、50% 适度、75% 详细、100% 详尽),并在实际回答前展示给用户选择。支持的平台包括 Claude Code 以及其他基于 SKILL.md 的 AI 代理工具。用户也可通过关键词或短语(如“tl;dr”、“exhaustive”、“50% depth”)直接触发并跳过询问环节。TBA 的核心优势在于提供渐进式的回答控制,避免冗长或简略过度,同时保持会话内的深度设置一致,无需重复选择。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/ECC/tree/main/skills/token-budget-advisor

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

令牌预算顾问 (TBA) 是做什么的?

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

使用时机

  • 用户希望控制回复的长度或详细程度
  • 用户提到令牌、预算、深度或回复长度
  • 用户说“简版”、“tl;dr”、“简要”、“25% 深度”、“详尽”等
  • 任何时候用户希望提前选择深度/详细程度

不要触发当:用户在本会话中已设置过深度级别(静默保持),或者答案本身非常简单时。

工作原理

步骤 1 — 估算输入令牌数

使用仓库的标准上下文预算启发式方法,在心中估算提示的令牌数量。

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

  • 散文:字数 × 1.3
  • 代码密集型或混合/代码块:字符数 / 4

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

步骤 2 — 按复杂度估算回复大小

对提示进行分类,然后应用倍数范围以获得完整的回复窗口:

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

回复窗口 = input_tokens × mult_min 到 input_tokens × mult_max(但不要超过你模型配置的输出令牌限制)。

步骤 3 — 提供深度选项

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

正在分析你的提示...

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

选择你的深度级别:

[1] 精简的   (25%)  ->  约 [令牌数]   仅直接回答,无铺垫
[2] 适度     (50%)  ->  约 [令牌数]   回答 + 上下文 + 1 个示例
[3] 详细     (75%)  ->  约 [令牌数]   完整回答及备选方案
[4] 详尽    (100%)  ->  约 [令牌数]   所有内容,无限制

你选择哪个级别?(1-4 或说“25% 深度”、“50% 深度”、“75% 深度”、“100% 深度”)

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

级别令牌估算(在回复窗口内):

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

步骤 4 — 按所选级别回复

级别目标长度包含省略
25% 精简的最多 2-4 句直接回答,关键结论上下文、示例、细微差别、备选方案
50% 适度1-3 段落回答 + 必要上下文 + 1 个示例深度分析、边界案例、参考资料
75% 详细结构化回复多个示例、利弊、备选方案极端边界案例、详尽参考资料
100% 详尽无限制所有内容 — 完整分析、所有代码、所有视角无

快捷方式 — 跳过提问

如果用户已经表明了级别,立即以该级别回复,无需询问:

用户说的话级别
"1" / "25% depth" / "short version" / "brief answer" / "tl;dr"25%
"2" / "50% depth" / "moderate depth" / "balanced answer"50%
"3" / "75% depth" / "detailed answer" / "thorough answer"75%
"4" / "100% depth" / "exhaustive answer" / "full deep dive"100%

如果用户在本会话中已设置过深度级别,静默保持该级别以供后续回复使用,除非用户更改。

精度说明

本技能使用启发式估算 — 没有真正的分词器。准确度约 85-90%,方差 ±15%。始终显示免责声明。

示例

触发场景

  • "先给我简版。"
  • "你的回答会使用多少令牌?"
  • "以 50% 深度回复。"
  • "我要详尽的答案,不是摘要。"
  • "Dame la version corta y luego la detallada."

不触发场景

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

来源

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

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

相关技能