システム指示を変えてもキャッシュが死なない
規則を一つ変えるために履歴を再実行しない。system_input で変え、キャッシュは残る。
長いセッションでシステム規則を変えると、ユーザー文に詰めるか、トップの system_instruction を書き換えてキャッシュが死んだ。2026-12-03 から Interactions API プレビューは system_input で途中更新でき、履歴はキャッシュに残せる。凍結後の読み取り専用を揃えるなら oakmeet で部屋を開く。
検索されやすい結果は システム指示を変えてもキャッシュが死なない。Gemini 4 全体のパブリックプレビュー、v1beta。system_input のトークンは標準入力単価。Google Keyword 2026-12-03 と Mid-conversation instructions。
トップは書き換えず、このターンの system_input を送る
規則をユーザー文にする
キャッシュは残るが権威が弱く、模倣できる。
トップの指示や tools を書き換え
接頭辞が変わりキャッシュが死に、会話全体を再処理する。
| 方法 | キャッシュ | 権威 |
|---|---|---|
| 規則を user に入れる | 残る | 弱い、偽装可 |
| トップの system_instruction / tools を変更 | 壊れる | 強いが全再実行 |
| system_input、トップは不変 | 接頭辞を再利用 | トップと同じ重み |
1ターン1ステップ、ユーザーの直前
- 01system_instruction をバイト単位で同一に
例:
You are an infrastructure troubleshooting assistant.2ターン目も同じ文。差分はsystem_input。 - 02previous_interaction_id を渡す
previous_interaction_id=turn1.id。サーバーが履歴をつなぐ。 - 03system_input のあと user_input
配列は
system_inputの次にuser_input。テキストとadded_tools/removed_tools可。 - 04関数の増減のみ、トップのリストは触らない
例:トップは
get_store_hoursとissue_refund。2ターン目で返金を外しcreate_escalation_ticketを追加。同一ステップは remove のあと add。MCP は非対応。
from google import genai
client = genai.Client(http_options={"api_version": "v1beta"})
system_instruction = "You are an infrastructure troubleshooting assistant."
turn2 = client.interactions.create(
model="gemini-4-neon",
previous_interaction_id=turn1.id,
system_instruction=system_instruction,
input=[
{"type": "system_input", "content": [{"type": "text", "text": "A production deployment freeze is now active."}]},
{"type": "user_input", "content": [{"type": "text", "text": "Give me the command to deploy a new release."}]},
],
)新しい規則は system_input へ。トップの一文は触らない。触るとキャッシュは消える。
- system_input はトップを置き換える?
- 履歴の一歩として追加される。別テーマは共存。衝突時は最新を優先。
- added_tools で MCP は?
- 現在は関数ツールのみ。MCP サーバーツールは不可。
- 信頼できない内容
- 関数呼び出しはバックエンドで認可。エンドユーザー文を system_input に入れない。
凍結と残る関数を二列に
デプロイ凍結後に deploy してよいかで争うなら、読み取り診断と禁止を一枚に。oakmeet は期限付きのブラウザ白板。空間コードで入る。Gemini API ではない。
CLI:無料枠ではリポの最初の作業が終わらない。Studio:Google AI Studio。部屋を開く。
GA か?
Google は public preview、Interactions API、v1beta、Gemini 4 全体。Enterprise Agent Platform は近日。
途中更新の別料金は?
別料金なし。system_input のトークンは標準入力単価。以前のターンはキャッシュ単価の対象になり得る。
1ターンに何個?
1つ。user_input の直前。
oakmeet が Gemini のシステム指示を変える?
変えない。開始リンクは凍結と禁止を広げるだけ。