Gemini CLI

Two ways to wire KYA into Gemini CLI. Pick one or use both:

Gemini CLI extension

The repo root is also a Gemini CLI extension named shield-kya (gemini-extension.json plus hooks/hooks.json):

gemini extensions install https://github.com/The-Pixel-Boys/shield-kya

Gemini asks you to confirm the install (--consent skips the prompt) and then runs the extension’s hooks with no further trust step. Restart Gemini CLI afterwards. The extension pins the kya version it was released with; a hand-wired hook needs a kya that understands Gemini’s BeforeTool event (released together with this extension).

What it does, and does not do:

Uninstall: gemini extensions uninstall shield-kya.

MCP server

Setup

Merge one of the examples into ~/.gemini/settings.json (global) or .gemini/settings.json (project):

Do not enable both at once. Keep "trust": false. Setting it true tells Gemini to skip its own confirmations for this server, which defeats the checkpoint. Restart Gemini CLI after editing.

What KYA reports

Three tools: kya.policy_evaluate (Allow / Deny / Hold), kya.session_ingest, kya.request_approval. Every MCP call lands on the receipt with a clipped, redacted change preview: kya receipt --open.

Files written

For the MCP path you edit one file by hand: ~/.gemini/settings.json or .gemini/settings.json. KYA installs nothing else. (The extension installs kya into its own folder, see above.)

Verify

Verified in CI: the e2e suite installs Gemini CLI headless, wires this config, and asserts gemini mcp list shows shield-kya with the three kya tools.

By hand:

  1. gemini mcp list: shield-kya connected.
  2. Ask Gemini for a small change; watch the record.
  3. Offline smoke:

    kya wrap --offline --tool-id Write --irreversible --args '{"path":"x.ts","content":"hi"}'
    

    Expect a REQUIRE_APPROVE row in the record.

Uninstall

Delete the shield-kya block from the settings file you merged into and restart.

Troubleshooting

Honesty note

On the MCP path, Gemini’s built-in tools only reach KYA when they go through MCP. The extension’s hook also sees native tool calls, but it is advisory: it records them and blocks the never-list and the guard pack. trust: false keeps Gemini’s own confirmation layer intact on top.

Wrap fallback

kya wrap --offline -- gemini "summarize this repo"

Wrap evaluates the command itself before it runs and records a row in the record. Exit 0 Allow, 4 Hold, 1 Deny.