⚖️

AI模型智能选型与成本优化

model-pyramid · v1.0.0
AI 增强 安全 S+ 级 作者 vincentjiang06 公开目录收录
311 下载 0 安装 1.5k 收藏 11 浏览

简介

Anthropic官方Claude Code团队发布的模型选型框架,基于能力缺口与完备性缺口双轴评估,为子代理分配合适的模型与effort等级,实现性能与成本的最优平衡。

原始描述

Right-size MODEL + EFFORT for the session and for each subagent at fan-out time, and decide whether to attach an advisor. Two axes: capability gap → change model; thoroughness gap → change effort. Use when spawning / fanning out / delegating subagents, or when asked which model or effort something should get: "$model-pyramid". NOT API price shopping.

通过你的 Agent 添加

安装目录:model-pyramid/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/model-pyramid/
Codex CLI~/.codex/skills/model-pyramid/
DeepSeek Harness~/.agents/skills/model-pyramid/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

model-pyramid 是一套用于为会话及每个子代理选择合适模型和effort等级的决策框架。用户通过在子代理创建时声明 $model-pyramid 触发该技能,系统将根据任务特征自动推荐配置。核心操作围绕两个维度展开:能力缺口(Claude有能力但做错了)→ 更换模型;完备性缺口(漏读文件、跳过测试)→ 调整effort等级。

该技能强调right-sizing原则——仅为工作所需分配资源,而非简单的"选便宜模型"。使用时需为每个子代理单独决策,同一批次的混合任务应分别评估。技能提供机械校验脚本 check_plan.mjs 用于验证配置合法性,但不替代人的判断。

显著优点

  1. 双轴决策框架清晰:将常见的"选模型困惑"拆解为能力与完备性两个可观测维度,避免凭直觉选型。

  2. 与官方文档深度绑定:基于Claude 5系列(Fable 5/Opus 5/Sonnet 5/Haiku 4.5)的能力矩阵设计,所有数值均有文档出处,非经验猜测。

  3. 丰富的成本优化手段:除模型降级外,还提供advisor顾问模式、opusplan分层执行、effort降级等更安全的降本杠杆,避免一刀切的模型降级。

  4. 缓存感知设计:明确警告模型/effort变更会重置prompt缓存,指导用户跨工作负载而非会话内调整参数。

  5. 机械校验支持:附带Node脚本可自动检测配置冲突(如不存在的effort等级、max_tokens未提升、Opus 5的thinking冲突等)。

潜在缺点与局限性

  • 时效性强:所有数值标注为"dated",模型换代后需重新验证,存在维护负担。

  • 学习曲线陡峭:涉及Fable/Opus/Sonnet/Haiku四级模型、low/medium/high/xhigh/max五级effort、advisor/orchestration/cache等交叉概念,新手难以快速掌握。

  • 不直接执行:纯建议性技能,不自动spawn代理或修改配置,需要用户手动应用推荐。

  • Claude生态限定:紧密绑定Anthropic模型家族,对其他模型(GPT、Gemini等)无直接指导价值。

适合的目标群体

  • Claude Code重度用户:需要频繁创建子代理处理复杂多步骤任务的开发者。
  • AI工程团队:负责设计Agent编排策略、优化token成本的技术负责人。
  • 追求确定性输出的场景:科学计算、代码审查、长时自治任务等对质量敏感的应用。

使用风险

  1. 配置沉默降级:不支持的effort等级会静默回退到最高支持等级,可能导致预期外的成本或质量变化。

  2. 缓存失效成本:会话中频繁切换模型/effort会不断重置prompt缓存,在长会话中造成显著的token浪费。

  3. 过度优化陷阱:max effort在结构化输出任务上可能引发过度思考(overthinking),且成本收益比通常不佳。

  4. 依赖维护成本:每次Claude模型换代后需重新跑评估(evals),历史配置不能简单复用。

  5. Opus 5特殊限制:xhigh/max effort下无法禁用thinking,若代码强制设置thinking=false将返回400错误。

技能正文


name: model-pyramid description: >- Right-size MODEL + EFFORT for the session and for each subagent at fan-out time, and decide whether to attach an advisor. Two axes: capability gap → change model; thoroughness gap → change effort. Use when spawning / fanning out / delegating subagents, or when asked which model or effort something should get: "$model-pyramid". NOT API price shopping. license: MIT metadata: version: "1.0.0" model_baseline: "claude-5 family (Fable 5 / Opus 5 / Sonnet 5 / Haiku 4.5) · docs read 2026-07-29"

model-pyramid

Pick model and effort for the session and for every subagent you spawn, then say so in one line each. Framing is right-sizing: assign what the work needs. This skill recommends and reports — it never spawns agents, edits configs, or blocks you.

Everything numeric here is dated. Ladders, defaults and rosters change every model generation. metadata.model_baseline is the stamp. When the family changes, re-verify against live docs before trusting a number in this skill — and re-sweep your own evals.

The two axes (use these, not a rule table)

  • Claude had the context, tried, and still got it wrong → capability gap → change the MODEL.
  • Claude got it wrong by skipping a file, not running tests, not double-checking → thoroughness gap → change the EFFORT.

Effort is not "thinking depth". It governs all tokens in the response — text, tool calls, and thinking: how many files get read, how many tool calls get made, how much gets verified, how far a multi-step task runs before checking in. Lower effort ⇒ fewer tool calls.

⛔ The corollary that kills the most common mistake: search / exploration / repeated tool calling is the last place to economise on effort. Official guidance names "exploratory tasks such as repeated tool calling, detailed web search, and knowledge-base search" as a reason to go xhigh. Cutting effort on a search agent buys an agent that stops looking.

Defaults: start here, move on evidence

  1. Model — a subagent inherits the session model unless you say otherwise. Inheriting is the correct default; override only for a reason you can name.
  2. Effort — the default is high on every model that supports effort. Setting high is byte-identical to omitting the parameter. (Exception: Opus 4.7 defaults to xhigh.)
  3. Adjust with evals, not vibes. Step down where quality holds, up where it doesn't. Carrying settings over from an earlier model generation ⇒ re-sweep, don't reuse.

Sizing a fan-out

Classify per task, never per batch. One spawn of five mixed tasks gets five decisions.

Task shape Model Effort Why
Peer co-work — equal-difficulty shards, judge panels, adversarial verifiers, one delegated deep task inherit inherit It is the same work, split. Cutting either knob cuts the work.
Search / exploration — codebase sweep, web research, evidence gathering inherit inherit or raise Effort governs tool-call volume. This is the axis you raise for search.
High-volume homogeneous lookups (~20+ cheap, near-identical) drop one tier (Opus→Sonnet) low–medium The documented home of low: "simpler tasks that need the best speed and lowest costs, such as subagents".
Long-horizon autonomous run (>30 min, token budgets in the millions) Fable 5 if available, else top tier xhigh xhigh is defined for exactly this.
Anything else inherit default (high) No reason to move a knob ⇒ don't move it.

Clamps

  • At most one knob per layer — one tier down or one effort step, not both.
  • Two layers is the norm. A third layer, or a bottom-tier pick from a frontier session, needs a one-line justification in the report.
  • No hard floor. low is a documented, legitimate subagent setting — justify it, don't ban it. (This reverses v0.1.0's medium floor, which predated the current ladder.)
  • An explicit user override wins verbatim. Advisory means advisory.

Before you emit xhigh or max

  • Raise max_tokens — 64k is the documented starting point. It is a hard cap on thinking plus response text together, and at these levels the model needs room to think and act across subagents and tool calls.
  • Check the level exists on that model — an unsupported level silently falls back to the highest supported level at or below it.
  • On Opus 5, thinking cannot be disabled at xhigh/max — that combination returns 400.
  • max is for genuinely frontier problems. On most workloads it adds significant cost for small gains, and on structured-output tasks it can cause overthinking.
  • Effort does not shorten prose. On Opus 5, lowering effort does not reliably shorten the visible response — if you want it shorter, say so in the prompt.

Cost levers that are not "pick a cheaper model"

  • Advisor — a stronger model consulted at decision points rather than running throughout. Fits long multi-step tasks where most turns are routine but plan quality decides the outcome; adds little on short tasks. → references/orchestration.md
  • opusplan — Opus for plan mode, Sonnet for execution. A free structural win when the task genuinely splits that way.
  • Effort down-step — usually a bigger and safer lever than a model down-step: it degrades gracefully and applies per request.

The cache trap

Changing model or effort invalidates the prompt cache. Pick a level at the start of a cached conversation and hold it; vary effort across workloads, not within one long session. (Toggling the advisor does not invalidate the cache.)

Report

One line per agent:

<label>  model=<alias|id>  effort=<level>  rule=<peer|search|bulk|long-horizon|default|override>  [flags]

Flags worth emitting: inherited, justified:<reason>, override, max_tokens-raised, cache-hold, advisor:<model>, degraded:<what the runtime could not express>.

Files

File Load when
references/model-and-effort.md per-model ladder, support matrix, documented start points
references/orchestration.md advisor pairing, opusplan, subagent patterns, cost shape
references/runtime-knobs.md emitting knobs for a concrete runtime (Claude Code / Agent tool / Workflow / API / Codex)
scripts/check_plan.mjs validate a plan mechanically

Mechanical check

node scripts/check_plan.mjs '{"agents":[{"label":"reviewer","model":"claude-opus-5","effort":"max"}]}'

Checks only what is deterministic: level exists on that model, max_tokens raised at xhigh/max, Opus 5 thinking×effort conflict, advisor pairing legality, effort varied inside a cached session, and both-knobs-dropped. It does not judge whether your sizing is wise.

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

development-engineeringautomationproductivitydevopsai-enhancementcost-optimizationorchestration

同类 Skill