Skip to content

sandipchitale/tellme-gemini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TellMe for Gemini

A Gemini CLI extension that provides an interactive speech-based prompt mechanism and reads Gemini's responses aloud using macOS text-to-speech.

Overview

TellMe Gemini enhances the Gemini CLI by hooking into the agent lifecycle:

  1. Interactive Prompt (BeforeAgent Hook) — When you prefix your prompt with a dot (.), a Java Swing dialog box pops up for you to type your input. It then reads your prompt aloud ("You said: ...") and passes it to Gemini. If you prefix the prompts with .. then it will not use the dialog box and will use the input from the prompt.
  2. Speech Response (AfterAgent Hook) — After Gemini finishes responding to a spoken prompt (prefixed with . or .. or suffixed with ..), the extension reads Gemini's response aloud ("I say: ...") using the native macOS say command in the background.

Requirements

  • macOS (uses /usr/bin/say for text-to-speech)
  • Node.js
  • Java runtime (for the input dialog)
  • Gemini CLI with extension support

Installation

git clone https://github.com/sandipchitale/tellme-gemini
cd tellme-gemini
gemini extensions link .

Disable the extension

gemini extensions disable tellme-gemini

Enable the extension

gemini extensions enable tellme-gemini

Uninstallation

gemini extensions uninstall tellme-gemini

How It Works

BeforeAgent Hook (i-say)

  1. You provide a prompt to the Gemini CLI starting with a . or .. (e.g., .).
  2. The BeforeAgent hook executes tellme.mjs.
  3. It detects the . prefix and launches a Java Swing input dialog ("Wassup? (try dictation)"). If you prefix the prompts with .. then it will not use the dialog box and will use the input from the prompt.
  4. You enter your actual prompt and click "OK" (if using .).
  5. It uses the macOS /usr/bin/say command to speak your input aloud in the background: "You said: {input}.". On Linux it uses /usr/bin/espeak.
  6. It sends the input to the Gemini CLI as additionalContext to be used for the agent. If you cancel the dialog, it gracefully denies the execution, halting the agent.

AfterAgent Hook (tell-me)

  1. After Gemini generates a response, the AfterAgent hook triggers.
  2. It checks if the original prompt started with . or ended with ...
  3. If it did, it retrieves the generated response from the hook payload (prompt_response).
  4. It uses /usr/bin/say to speak the response aloud: "I say: {response}". On Linux it uses /usr/bin/espeak.
  5. The say process is spawned detached so the Gemini CLI can continue immediately without waiting for the speech to finish.

If the voice output is too long and you want to stop it do at the prompt:

!killall /usr/bin/say
ESCAPE

Project Structure

tellme-gemini/
├── hooks/
│   └── hooks.json           # Hook configuration mapping BeforeAgent/AfterAgent to tellme.mjs
├── scripts/
│   └── tellme.java          # Java Swing input dialog (single-file source program)
├── gemini-extension.json    # Gemini Extension metadata
├── package.json             # Project metadata (no dependencies)
├── tellme.mjs               # Main hook handler logic (plain JavaScript, Node.js built-ins only)
└── README.md                # This file

Key Implementation Details

  • tellme.mjs — The main script executed by the hooks. It reads the JSON event payload from stdin and checks hook_event_name to route logic to the BeforeAgent or AfterAgent handlers. Uses only Node.js built-in modules (child_process, fs).
  • scripts/tellme.java — A single-file Java source program that displays a Swing dialog for user input. Runs directly via java tellme.java without needing compilation.
  • hooks/hooks.json — Registers i-say for the BeforeAgent hook and tell-me for the AfterAgent hook. Both point to the tellme.mjs script.

Author

Sandip Chitale

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors