gemini-core
Keeps the Gemini keys and tier of every Gemini mod, and each mod's model and thinking level, in one place: adds $.gemini, which builds their Gemini requests, reads the answers and moves to the next key after a quota or key error, and picks…
何をするか
- 欄を描く
- /gemini-core を足す
- engine.create・session.start・ui.closeにフックする
- ターンをまたいで自分の状態を持つ
- ネットワークに出る
良いところ
- プロセスを起こさない
- TypeScript で書かれている
- エラーを扱う
- ファイルを書かない
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like gemini-core by Kerem Gok (pane, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/kilimcininkoroglu-gemini-core/
// Written by modscode from that reading, not copied from the mod: use it as you like.
// Each value below stands for one the mod works out at run time; put in your own.
export const register: Register = on => {
// the pane: open it with $.ui.open({ id: 'my-pane', title: "Gemini model for ‹consumer›" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text } = $.ui.resolve(e)
const consumer = '…'
const label = '…'
const label2 = '…'
const label3 = '…'
return (
<Box flexDirection="column">
<Text dimColor>
{`/gemini-core model ${consumer} <id> sets one of:`}
</Text>
<Text>
{label}
</Text>
<Text>
{label2}
</Text>
<Text>
{label3}
</Text>
</Box>
)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
plugins/gemini-core/hooks/register.ts 257〜262 行 · ペイン
on('ui.render', { component: 'Pane' }, async ($, e, next) => {
const pick = session.pick
if (e.requestId !== PANE_ID || pick === undefined) return next(e)
if (e.surface === 'mobile') return listTree($.ui.resolve(e), pick)
return pickerTree($.ui.resolve(e), pick, model => void pickModel($, session, model).catch((err: unknown) => $.ui.toast(errorText(err))))
})plugins/gemini-core/hooks/picker.tsx 33〜41 行 · ペイン
export function listTree(els: Elements['mobile'], pick: Pick) {
const { Box, Text } = els
return (
<Box flexDirection="column">
<Text dimColor>{`/gemini-core model ${pick.consumer} <id> sets one of:`}</Text>
{pick.models.map(m => <Text key={m.id}>{label(m)}</Text>)}
</Box>
)
}plugins/gemini-core/hooks/picker.tsx 20〜30 行 · ペイン
export function pickerTree(els: Elements['terminal' | 'desktop' | 'vscode'], pick: Pick, onPick: (model: string) => void) {
const { Box, Select, Text } = els
const options = pick.models.map(m => ({ value: m.id, label: label(m) }))
const value = pick.models.some(m => m.id === pick.current) ? pick.current : undefined
return (
<Box flexDirection="column">
<Text dimColor>{`Enter sets the model of ${pick.consumer}; Esc closes without a change.`}</Text>
<Select key="model" label="model" options={options} {...(value === undefined ? {} : { value })} autoFocus onSelect={onPick} />
</Box>
)
}ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Kerem Gok Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
コードが呼ぶもの
通信環境変数保存
コードから読めること
2026-10-06 に読んだコミット 887502f53795 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。plugins/gemini-core/hooks/register.ts |
| 解析できる | すべてのファイルが TypeScript か JavaScript として解析できる。6 ファイルを解析 |
| コードが Mod の中で完結 | import は Mod 自身のファイルかエンジンのモジュールだけ。パッケージも require もない。コードはすべて Mod の中 |
| 読める | 圧縮した行・eval・new Function・計算した道の import()・符号化した塊がない。圧縮・eval・符号化した塊なし |
| 呼び出しが見える | 通信とプログラム起動はその場で $.http.fetch・$.process.run と書き、他へ渡さない。外への呼び出しはすべてその場の $ で |
| 入れる前に自分で判断する材料 | |
| 描く場所 | コードから読んだ、描く先。ターミナル・デスクトップアプリ・両方・何も描かない(フックだけ: 見張りやプロンプトの書き換え)のどれか。出すだけで、外す理由にはしない。ターミナルとデスクトップアプリに同じように描く |
| 入れる手順 | リポジトリ自身の .claude-plugin/marketplace.json にこの Mod が載っていて、ページに書いた手順でそのマーケットプレイスから入れられるか。リポジトリの .claude-plugin/marketplace.json に載っており、そこから入れられる |
| Windows のプログラム | $.process で起動するプログラムが Windows にあるか(tail・date・open・osascript・/usr/… などは無い)。Windows にないプログラムを使わない |
| 通信 | fetch の送り先(https のホスト)がコードに書いてあるか。plugins/gemini-core/hooks/register.ts:164 fetch(request.url) |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。プログラムを起動しない |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。読んだうえで通信する |
| ソースの鍵 | ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし |
| ライセンス | オープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT |
コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件
入れる
入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。
リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。
/plugin marketplace add KilimcininKorOglu/claude-code-mods/plugin install gemini-core@kilimcininkoroglu-mods入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(887502f53795)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「kilimcininkoroglu-gemini-core」をコードごと読んで、同じようなペインを作って似たデザイン
-
Claude に頼む…Xcodebuild · App · 31/3◐ Rendering App…Write↻ Re-render (r) r✦ Ask Claude (x) x◀ (h) h▶ (l) lOpen (o) o
-
Claude に頼む…Skins0 Your promptadd rate limiting to the hub api0 Tool rows: finished, running, failedYour prompt Spinner0 Folded group of reads and searches●main · note 3 · note 3 · note 30 Edit diff cardDesktop only; the terminal keeps Claude Code's diff.0 Shell output cardDesktop only.0 Code block cardDesktop only; the terminal keeps Claude Code's markdown.0 TableAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopyAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopyAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopy0 SpinnerAccent SpinnerSpinnerSpinner… 2h 10m0 Band above the prompt: normal, then nudging to compact█████░░░ 42% build█████░░░ 42% build█████░░░ 42% buildContext is 42% full0 Compact now0 Band above a questionTable BashBashBash0 Turn footer (terminal)3 build in 2h 10m · Grep · +3 −3
-
Claude に頼む…agent-discoverbuildbuildbuildRefreshMCP Browse/3Tab / shift+Tab move · Enter presses · ↑↓ scroll · Esc back to the promptBrowse...Audit asks:DeclineAcceptDeclineCancelAudit asks:DeclineAcceptDeclineCancelAudit asks:DeclineAcceptDeclineCancel
-
Claude に頼む…Fanyi settingsOnAPI · OpusenOn this MacAPIHost src/ SaveKey K · paste a new one, Enter SaveOpus↻ RefreshCustom model model id, for an API that lists none UseFanyi settingsHostClose
-
Claude に頼む…Commands●command-hubreading commands…+ create 3+ create 3+ create 3Prompt3 of 3 commandsReading the installed commands… they appear here in a moment.Save command/buildCommands/buildCommands/buildCommandsSave command/buildCommands/buildCommands/buildCommandsSave command/buildCommands/buildCommands/buildCommands
-
● pace Write · Park to1 park 12 dismiss 2pace: resume point 2h 10m · Fix login · 33 resume 34 discard 45 all 3 5pace: Park to resume point older than 7 days6 clear 6Claude に頼む…