ClaudeMods
☰
ZH-CN
● 0 人在线 · 浏览 0 次
赞助提交作品
GitHub 仓库 · 发布者 KilimcininKorOglu

council

当模型调用它的工具或你运行 /council <question> 时,就难题向模型委员会提问:Claude 模型,以及 gemini-core 有密钥时的 Gemini 模型,会并行回答,再由会话模型根据这些回答写出一份裁决。

KilimcininKorOglu@KilimcininKorOglu

KilimcininKorOglu/claude-code-mods/tree/main/plugins/council

已翻译

关于这个 mod

council

有些问题不是再试一次就能解决的:同一个错误在每次修复后仍然存在,或者两个设计看起来都正确。第二个意见有帮助,多个独立意见更有帮助。这个 Mod 会就问题询问模型委员会:每个成员独立回答同一个问题,然后由会话自己的模型担任主席,把这些回答整理成一份裁决。模型卡住时会通过工具调用它,你也可以自己运行 /council <question>。

功能

  1. 成员包括 Opus 5.5、Sonnet 5、Fable 5.1 和 Haiku 4.5;当安装了 gemini-core 且有密钥时,还包括 gemini-3.8-flash。没有 gemini-core 或没有密钥时,会跳过 Gemini 成员,结果会说明原因。/council members 可以修改列表。
  2. 所有成员会同时收到提问:
    • 在会话自己的模型上运行的成员会通过 $.model.fork 分叉会话,因此会从 prompt cache 读取整个对话。
    • 其他 Claude 成员通过 $.model.complete 以文本形式获得对话,使用 high effort。当超过 400,000 个字符时,先裁掉最长的工具输出,再移除最早的消息。Haiku 4.5 最多读取 560,000 个字符,因为它的窗口是 200k token。
    • Gemini 成员通过 gemini-core 获得相同的文本;gemini-core 保存密钥、层级和思考级别。它需要 gemini-core 0.3.0 或更高版本,因为每个请求都会指定自己的模型。
  3. 主席也会分叉会话。它会在字母标签(Member A、Member B)下读取回答,而不是读取模型名称,并写出成员同意之处、分歧之处、对话支持哪一方、成员遗漏的内容,以及下一步。
  4. 调用方会读取裁决和每个回答,每个回答都标有字母、模型和时间。失败的成员会连同原因一起列出。如果没有成员回答,调用会带着每个原因被拒绝,主席不会运行。
  5. 子代理发起的调用不会发送对话,因为分叉和 $.session.messages() 会读取主线程。随后每个成员和主席只会以 completion 的形式得到问题本身。

模型何时调用它

工具是带有一个 question 输入的 mcp__council__convene。它无需 ToolSearch 就会列出,系统 prompt 中的一条说明会告诉模型何时调用:

  • 同一个错误在两次修复尝试后仍然存在;
  • 调查后根因仍不清楚;
  • 必须在两个各有实际取舍的设计之间做选择;
  • 在进行难以撤销的变更之前。

这条说明会在会话开始和 /clear 时固定下来,因此 /council on 会立即为模型提供工具,而说明会在下一次 /clear 或下一次会话生效。模型调用次数没有限制。这个设置由每个窗口共享:在另一个窗口执行 /council on,会让这个窗口的模型在下一回合得到工具,并在下一次 /clear 或会话中得到说明;在那里执行 /council off 会立即让这里的工具拒绝调用。

你会看到什么

打开 sidebar 时,运行过程后面会有一个常驻区块:先显示问题和运行时长,然后显示每个成员及其状态词(running 为黄色,answered 为绿色并带时间和 token,failed 为红色并带原因),再显示主席,最后显示裁决的开头几句话。每个模型的名称按其 family 着色:opus 为红色,fable 为黄色,sonnet 为绿色,haiku 为淡色,Gemini 为蓝色。

council: run
avg.js boş dizi için ne dönmeli: NaN, 0, yoksa hata mı fırl… · done in 44s
opus 5.5 · fork · answered 11s · 89k in, 902 out
sonnet 5.5 · complete · answered 17s · 6.7k in, 1.1k out
fable 5.1 · complete · answered 24s · 6.7k in, 1.4k out
haiku 4.5 · complete · answered 9s · 5.2k in, 634 out
gemini-3.8-flash · gemini · answered 8s · 4.7k in, 1.3k out · free tier
chair · opus 5.5 · fork · done 20s

关闭 sidebar 时,末尾会得到一行:

council: 1 of 2 members answered in 4s; the chair wrote the verdict

命令

/council                               on or off, the members, the chair, the last run (also /council status)
/council on | off                      whether the model has the tool; off by default
/council members                       the members
/council members <model> ...           opus, sonnet, fable, haiku, a claude- id, a gemini- or gemma- id
/council members reset                 the default members
/council <question>                    runs the council now, also while it is off

/council <question> 会立即回答 convened: 5 members。成员和主席回答后,Mod 会通过 /council:send 把裁决交给模型,让模型把它作为你的消息读到,并告诉你它从中得到什么。如果此时有回合正在运行,裁决会暂存到回合结束(在 2.1.283 上测得)。

成本

每次运行会为每个成员发送一个请求,再为主席发送一个请求。在 Claude Code 2.1.283 上测量:

  • 5 个默认成员的一次运行花费 25 到 44 秒;最慢的成员决定速度。分叉花费 4 到 11 秒,并从缓存读取短会话中的对话(83k token)。
  • 400,000 个字符的对话(默认限制)在 Opus 5.5、Sonnet 5 和 Fable 5.1 上分别是 163,828 个输入 token,在 Haiku 4.5 上是 128,018 个,在 gemini-3.8-flash 上是 120,057 个。

按列表价格估算,完整 400,000 个字符的一次运行约为 $2.20:Fable 5.1 约 $1.70(每百万输入 token $10),Sonnet 5.5 约 $0.34(与 Sonnet 5 相同的列表价格;检查测量的是 Sonnet 5 的 token 数),Haiku 4.5 约 $0.13,两个分叉的缓存读取只需几美分。对话更短时,费用按比例降低。Claude 订阅会把请求计入用量限制。要降低费用,可以通过 /council members 移除成员,例如 /council members opus sonnet haiku gemini-3.8-flash。

在检查中,gemini-3.1-pro-preview 在每一把免费层级密钥上都返回 HTTP 429,因为免费层级没有它的配额。只有付费密钥才应把它加入成员。

安装

claude plugin marketplace add KilimcininKorOglu/claude-code-mods
claude plugin install council@kilimcininkoroglu-mods

函数 hooks 属于早期预览功能。Claude Code 2.1.288 及更高版本默认加载它们,因此不需要打开任何开关。

安装后

  1. 重启 Claude Code。
  2. 如果希望模型自行调用委员会,运行 /council on。安装后它处于关闭状态,而 /council <question> 无论开关状态都能工作。
  3. 对于 Gemini 成员,安装 gemini-core 0.3.0 或更高版本并提供密钥(见它的 README)。委员会不依赖它;即使没有它,也能只用 Claude 成员运行。

选项

| Option | Default | What it sets | |---|---|---| | maxInputChars | 400000 | 当成员不分叉会话时,每个成员读取的对话字符数;20,000 到 2,000,000 |

它可以接触什么

在 Claude Code 2.1.283 上通过 claude plugin validate 验证:

❯ ./register.ts hooks: session.start, turn.start, classic.SessionStart, command.run{command=council}, prompt.section{name=env_info_simple}, tool.describe{tool=/"^mcp__council__convene$"/}, tool.call{tool=/"^mcp__council__convene$"/}, turn.step
❯ ./register.ts calls: $.clock.after (via runManual), $.clock.now (via askClaude, askGemini, askGeminiModel, convene, drawRun, ended, verdictOf), $.command.register, $.command.run (via send), $.gemini.enroll (via enrollGemini), $.gemini.read (via askGeminiModel), $.gemini.request (via askGeminiModel), $.gemini.settings (via geminiReach), $.http.fetch (via askGeminiModel), $.model.complete (via askChair, askClaude), $.model.fork (via askChair, askClaude), $.prompt.submit (via send), $.session.messages (via contextOf), $.sidebar.set (via drawRun), $.store.delete (via runCommand), $.store.get (via isEnabled, membersNow), $.store.set (via runCommand, storeEnabled), $.tool.register (via declareTool), $.ui.log (via enrollGemini, runManual, send, toPerson)

Reach L3:每个成员一个请求,主席再一个请求。

1. 读取:主线程的对话、问题,以及每个主循环请求使用的模型
2. 运行:不启动进程
3. 发送:通过 Claude Code 自己的 API 连接,将对话和问题发送给每个 Claude 成员;通过 gemini-core 将它们发送给每个 Gemini 成员及 Google
4. 持久化:在 $.store 中保存开关设置和成员列表;一次运行保存在内存中
5. 恶意输入:回答是模型读取的文本,不会被执行;成员 ID 在进入 Gemini URL 前必须匹配 [a-z0-9.-];免费层级的 Gemini 密钥允许 Google 读取发送给它的内容

限制

  • 每个成员都根据收到的内容回答。不分叉的成员会把对话作为文本读取,按 maxInputChars 截断,因此可能看不到被裁掉的内容。
  • 主席运行在会话模型上,也会判断自己 family 的回答;字母隐藏回答来自哪个模型,但不会隐藏回答说了什么。
  • 成员或主席的回答上限是 8,192 个 token,包括思考;成员在 5 分钟后仍未回答就算失败。
  • Gemini HTTP 503 后,请求会立即再次发出,不使用 gemini-core 指定的等待时间,因为 $.clock.sleep 会计入 hook 的 10 秒预算(在 2.1.283 上测得)。3 次快速重试可能都撞上同一负载。
  • 在 2.1.283 上测得:插件工具调用运行了 333 秒而没有超时。在 2.1.277 上限制为 60 秒,因此较旧的 Claude Code 可能会提前截断缓慢的运行。

开发

make install     # eslint, typescript-eslint, typescript
make lint        # complexity limit 10, the build fails above it
make typecheck   # needs .claude/types/ from /plugin-types with --plugin-dir ../sidebar --plugin-dir ../gemini-core
make validate
make test        # claude plugin test

安装

请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。

claude plugin marketplace add KilimcininKorOglu/claude-code-mods
claude plugin install council
原文 / README

council

Some problems do not yield to one more attempt: the same error survives every fix, or two designs each look right. A second opinion helps, and several independent ones help more. This mod asks a council of models about the problem: each member answers the same question on its own, and the session's own model, as the chair, turns their answers into one verdict. The model calls it through a tool when it is stuck, and you can run it yourself with /council <question>.

What it does

  1. The members are Opus 5.5, Sonnet 5, Fable 5.1 and Haiku 4.5, plus gemini-3.8-flash when gemini-core is installed and has a key. Without gemini-core, or without a key, the Gemini members are skipped and the result says why. /council members changes the list.
  2. Every member is asked at the same time:
    • The member that runs on the session's own model forks the session with $.model.fork, so it reads the whole conversation from the prompt cache.
    • Every other Claude member gets the conversation as text through $.model.complete, at high effort. Above 400,000 characters the longest tool outputs are cut first, then the oldest messages are left out. Haiku 4.5 reads at most 560,000 characters, because its window is 200k tokens.
    • A Gemini member gets the same text through gemini-core, which holds the key, the tier and the thinking level. It needs gemini-core 0.3.0 or later, because each request names its own model.
  3. The chair forks the session too. It reads the answers under letters (Member A, Member B), not model names, and writes where the members agree, where they disagree and which side the conversation supports, what they missed, and the next step.
  4. The caller reads the verdict and every answer, each headed with its letter, model and time. A member that failed is named with its reason. When no member answers, the call is refused with each reason, and no chair runs.
  5. A call from a subagent sends no conversation, because a fork and $.session.messages() read the main thread. Every member and the chair then get the question alone, as a completion.

When the model calls it

The tool is mcp__council__convene with one question input. It is listed without ToolSearch, and a note in the system prompt tells the model when to call it:

  • the same error survived two attempts to fix it;
  • the root cause is still unclear after it investigated;
  • it has to choose between two designs that each have real trade-offs;
  • before a change that is hard to undo.

The note is fixed at the session's start and at /clear, so /council on gives the model the tool at once and the note from the next session. There is no limit on how often the model calls it. The setting is shared by every window: a /council on in another window gives this window's model the tool at its next turn and the note at its next /clear or session, and a /council off there makes the tool refuse here at once.

What you see

With the sidebar open, a standing section follows the run: the question and how long the run has taken, then every member with its state word (running yellow, answered green with its time and tokens, failed red with the reason), then the chair, and finally the first words of the verdict. Each model's name is coloured by its family: opus red, fable yellow, sonnet green, haiku faint, Gemini blue.

council: run
avg.js boş dizi için ne dönmeli: NaN, 0, yoksa hata mı fırl… · done in 44s
opus 5.5 · fork · answered 11s · 89k in, 902 out
sonnet 5.5 · complete · answered 17s · 6.7k in, 1.1k out
fable 5.1 · complete · answered 24s · 6.7k in, 1.4k out
haiku 4.5 · complete · answered 9s · 5.2k in, 634 out
gemini-3.8-flash · gemini · answered 8s · 4.7k in, 1.3k out · free tier
chair · opus 5.5 · fork · done 20s

With the sidebar closed, you get one line at the end:

council: 1 of 2 members answered in 4s; the chair wrote the verdict

Command

/council                               on or off, the members, the chair, the last run (also /council status)
/council on | off                      whether the model has the tool; off by default
/council members                       the members
/council members <model> ...           opus, sonnet, fable, haiku, a claude- id, a gemini- or gemma- id
/council members reset                 the default members
/council <question>                    runs the council now, also while it is off

/council <question> answers convened: 5 members at once. When the members and the chair have answered, the mod hands the verdict to the model through /council:send, so the model reads it as your message and tells you what it takes from it. A turn that is running meanwhile holds it until the turn ends (measured on 2.1.283).

Cost

Each run makes one request per member and one for the chair. Measured on Claude Code 2.1.283:

  • A run of the five default members took 25 to 44 seconds; the slowest member sets the pace. Forks took 4 to 11 seconds and read the conversation from the cache (83k tokens in a short session).
  • 400,000 characters of conversation, the default limit, are 163,828 input tokens on Opus 5.5, Sonnet 5 and Fable 5.1, 128,018 on Haiku 4.5 and 120,057 on gemini-3.8-flash.

At list prices, one run at the full 400,000 characters costs about $2.20, estimated: Fable 5.1 about $1.70 ($10 per million input tokens), Sonnet 5.5 about $0.34 (the same list price as Sonnet 5, whose token count the check measured), Haiku 4.5 about $0.13, and the two forks a few cents of cache reads. A shorter conversation costs proportionally less. On a Claude subscription the requests count toward your usage limits instead. To lower the cost, leave a member out with /council members, for example /council members opus sonnet haiku gemini-3.8-flash.

gemini-3.1-pro-preview answered HTTP 429 on every free-tier key in the check, because the free tier has no quota for it. Add it to the members only with a paid key.

Install

claude plugin marketplace add KilimcininKorOglu/claude-code-mods
claude plugin install council@kilimcininkoroglu-mods

Function hooks are early access. Claude Code 2.1.288 and later load them by default, so there is nothing to switch on.

After installing

  1. Restart Claude Code.
  2. Run /council on if the model should call the council by itself. It is off after an install, and /council <question> works either way.
  3. For Gemini members, install gemini-core 0.3.0 or later and give it a key (see its README). The council does not depend on it and runs with Claude members alone without it.

Options

| Option | Default | What it sets | |---|---|---| | maxInputChars | 400000 | How much of the conversation, in characters, each member reads when it does not fork the session; from 20,000 to 2,000,000 |

What it can reach

Validated with claude plugin validate on Claude Code 2.1.283:

❯ ./register.ts hooks: session.start, turn.start, classic.SessionStart, command.run{command=council}, prompt.section{name=env_info_simple}, tool.describe{tool=/"^mcp__council__convene$"/}, tool.call{tool=/"^mcp__council__convene$"/}, turn.step
❯ ./register.ts calls: $.clock.after (via runManual), $.clock.now (via askClaude, askGemini, askGeminiModel, convene, drawRun, ended, verdictOf), $.command.register, $.command.run (via send), $.gemini.enroll (via enrollGemini), $.gemini.read (via askGeminiModel), $.gemini.request (via askGeminiModel), $.gemini.settings (via geminiReach), $.http.fetch (via askGeminiModel), $.model.complete (via askChair, askClaude), $.model.fork (via askChair, askClaude), $.prompt.submit (via send), $.session.messages (via contextOf), $.sidebar.set (via drawRun), $.store.delete (via runCommand), $.store.get (via isEnabled, membersNow), $.store.set (via runCommand, storeEnabled), $.tool.register (via declareTool), $.ui.log (via enrollGemini, runManual, send, toPerson)

Reach L3: one request per member and one for the chair.

1. Reads:    the conversation of the main thread, the question, and the model of each main-loop request
2. Runs:     no process
3. Sends:    the conversation and the question to each Claude member through Claude Code's own API connection, and to Google for each Gemini member through gemini-core
4. Persists: in $.store, the on/off setting and the member list; a run lives in memory
5. Hostile input: the answers are text the model reads and never run; a member id must match [a-z0-9.-] before it reaches a Gemini URL; a free-tier Gemini key lets Google read what it is sent

Limits

  • Every member answers from what it is sent. A member that does not fork reads the conversation as text, cut at maxInputChars, so it can miss what was cut.
  • The chair runs on the session's model and judges answers from its own family too; the letters hide which answer came from which model, not what the answers say.
  • A member or chair answer is capped at 8,192 tokens, thinking included, and a member that has not answered after 5 minutes counts as failed.
  • After a Gemini HTTP 503 the request goes out again at once, without the wait gemini-core names, because $.clock.sleep counts against the hook's 10-second budget (measured on 2.1.283). Three quick retries can all hit the same load.
  • Measured on 2.1.283: a plugin tool call ran 333 seconds without a timeout. On 2.1.277 the limit was 60 seconds, so an older Claude Code can cut a slow run short.

Development

make install     # eslint, typescript-eslint, typescript
make lint        # complexity limit 10, the build fails above it
make typecheck   # needs .claude/types/ from /plugin-types with --plugin-dir ../sidebar --plugin-dir ../gemini-core
make validate
make test        # claude plugin test

其他同名作品

更多类似作品