goodvibes: Hook for Gemini CLI

.gemini/settings.json

BeforeTool is a hook for Gemini CLI from jgiox/goodvibes. Its token cost is not measured, scanned C, a copy of PreToolUse, Apache-2.0.

A pre-tool hook that runs a shell check before selected shell, file-reading, and search actions. It is configured to inspect commands involving Git and comes from the GoodVibes tool set.

In plain words
What is it for?
Use it to attach the GoodVibes Git-command check to the listed tool events. The input does not describe any broader behavior.
Why use it?
It adds an automatic check before those actions, so a command can be examined before the agent runs it.

Hook for Gemini CLI

Written for Gemini CLI: installed under .gemini/. Also seen: positional $N argument.

This is jgiox/goodvibes's own configuration. It tells Gemini CLI how to work on goodvibes itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything goodvibes configures →

Reuse

Borrowing it

Nothing to install: this file belongs to jgiox/goodvibes. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/jgiox/goodvibes/main/.gemini/settings.json
Clone the repo
git clone --depth 1 https://github.com/jgiox/goodvibes

Made for: Gemini CLI.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for BeforeTool

README.md
[![agentmods](https://agentmods.dev/badge/hooks/jgiox/goodvibes/before-tool/github.svg)](https://agentmods.dev/hooks/jgiox/goodvibes/before-tool)
Your own site
<a href="https://agentmods.dev/hooks/jgiox/goodvibes/before-tool"><img src="https://agentmods.dev/badge/hooks/jgiox/goodvibes/before-tool/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for BeforeTool

Your own site · 80×15
<a href="https://agentmods.dev/hooks/jgiox/goodvibes/before-tool"><img src="https://agentmods.dev/badge/hooks/jgiox/goodvibes/before-tool.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session not measured What this adds to a session before it is invoked.
When invoked not measured Not applicable: nothing here is loaded into a session.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin 92% copy Near-identical to another mod in the catalogue.
Security

Grade C, and why

BeforeTool scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the commands this hook runs, not an audit. A hook is shell that executes on your machine at the event it names, which is why every command in it is printed with what was found.

Reaches for credential fileshighPrivilege escalation

SSH keys, cloud credentials, git-credentials, .npmrc, /etc/shadow: reading these is how a config file becomes a credential leak.

"command": ": goodvibes-read-guard; case $GOODVIBES_READ_GUARD in off) exit 0;; esac; M=$(awk 'function dec(s, h, x) { gsub(/\\\\\"/, \"\\\"\", s); gsub(/\\\\n/, \"\\n\", s); gsub(/\\\\t/, \"\\t\", s); gsub(/\\\\r/, \"\"
Origin

This is a copy

92% identical to PreToolUse — 8 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.gemini/settings.json · 24 lines

How it starts

The opening of the file, as written. The whole thing — 24 lines — stays where its author put it; the contents beside it link to each section on GitHub.

{
  "BeforeTool": [
    {
      "matcher": "^run_shell_command$",
      "hooks": [
        {
          "type": "command",
          "name": "goodvibes-journal-gate",
          "command": ": goodvibes-journal-gate; IN=$(tr -d \"\\r\\n\"); case $IN in *'\"command\"'*|*'\"command_line\"'*) ;; *) exit 0;; esac; CMD=$(printf \"%s\" \"$IN\" | sed -E \"s/.*\\\"command(_line)?\\\"[[:space:]]*:[[:space:]]*\\\"((\\\\\\\\.|[^\\\"\\\\\\\\])*)\\\".*/\\\\2/\"); case $CMD in *git*) ;; *) exit 0;; esac; RES=$(printf \"%s\" \"$CMD\" | awk '{ gsub(/\\\\\\\\/, \"\\001\"); n = split($0, L, /\\\\n/); d = \"\"; nh = 0; sep = \"\"; for (i = 1; i <= n; i++) { l = L[i]; if (d != \"\") { t = l; if (dash) sub(/^(\\\\t)+/, \"\", t); if (t == d) { d = \"\"; nh = 0 } else H[++nh] = l; continue } if (l ~ /^([ ]|\\\\t)*#/) continue; printf \"%s%s\", sep, l; sep = \"\\\\n\"; if (match(l, /(^|[^<])<<-?[ ]*\\\\?[\\042\\047]?[^ \\t;&|<>()\\042\\047\\\\]+/) && l !~ /(^|[|;&(`]|\\$\\()[ ]*((sudo|doas|env|exec|command|nohup|time|timeout|nice|xargs)[ ]+([^ |;&]+[ ]+)*)?([^ |;&<]*\\/)?(sh|bash|zsh|dash|ksh|ssh|eval)([ <]|$)/) { d = substr(l, RSTART, RLENGTH); dash = (d ~ /<<-/); sub(/^[^<]?<<-?[ ]*\\\\?[\\042\\047]?/, \"\", d) } } for (j = 1; j <= nh; j++) printf \"\\\\n%s\", H[j]; print \"\" }' | awk 'function fl() { if (st) { nt++; T[nt] = cur; TU[nt] = cu; TD[nt] = cdl; TT[nt] = ctl; TO[nt] = cu && cur ~ /^(&&|\\|\\||;|&|\\||\\(|\\)|`|\\$\\(|\\n)$/ } cur = \"\"; st = 0; cu = 1; cdl = 0; ctl = 0 } function res(k,  v) { if (k > nt || TO[k]) return \"\"; v = T[k]; if (TT[k]) { if (v !~ /^~(\\/|$)/ || HM == \"\") return \"\"; v = HM substr(v, 2) } else if (TD[k]) { if (TD[k] != 1 || v !~ /^\\$(HOME|\\{HOME\\})(\\/|$)/ || HM == \"\") return \"\"; sub(/^\\$(HOME|\\{HOME\\})/, \"\", v); v = HM v } if (v ~ /^-/ || v ~ /\\n/) return \"\"; return v } BEGIN { HM = ENVIRON[\"HOME\"]; QF = \"\\047[^\\047]*\\047|\\\"[^\\\"]*\\\"\"; QS = QF \"|\\001\\047\"; cu = 1 } { s = $0; gsub(/\\001\\001/, \"\\004\", s); gsub(/\\

Read the full file on GitHub · 24 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 24 lines scan C 11502f11c721

Subscribe to this mod's changes

BeforeTool is a hook published in the GitHub repository jgiox/goodvibes (5 stars, last pushed 6d ago), licensed Apache-2.0. Its token cost is not measured: a hook is shell that never enters the context. A static security scan graded it C with 1 finding (reaches for credential files). It is 92% identical to PreToolUse, differing in 8 lines, and is treated as a copy.