ClaudeMods
☰
ZH-TW
● 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

其他同名作品

更多類似作品