Build with an agent
An agent can write an action, run it, read exactly what you would have seen, and fix it, without you pressing anything.
Test runs
glimpse actions run <name> "text" --headless runs the script for real, but Glimpse shows nothing and types nothing. It prints a record instead: notices, pill text, typed text, questions and answers, errors, exit code, timing and the end of standard error.
--answer <text>answers the nextglimpse ask, with a button label or spoken words. Repeat it for more questions.--say "<full sentence>"runs phrase matching like a real dictation and reports which action it reached. The name is optional. Add--key <shortcut>for a shared shortcut.--event <name>runs it as that event, with the text as input.--env KEY=VALUEsetsGLIMPSE_APP,GLIMPSE_WINDOW_TITLE,GLIMPSE_URL,GLIMPSE_SELECTED_TEXT,GLIMPSE_FIELD_TEXT,GLIMPSE_LANGUAGEorGLIMPSE_ID. Test runs never read your real app or selection.--jsonprints the record as data.
The script sees GLIMPSE_HEADLESS=1, and should skip anything it can't undo, like sending, posting or deleting.
glimpse actions run Standup "yesterday I shipped actions" --headless --answer PostStandup run, 155 ms, exit 0, headless
toast Drafting: yesterday I shipped actions
ask Post it? [Post | Cancel] -> Post
toast Standup: Would postWith --json:
{"action":"Standup","trigger":"run","headless":true,"ended":"exited","exit_code":0,"ok":true,"duration_ms":155,"waited_ms":0,"output":"Would post","shown":[{"kind":"toast","type":"info","title":null,"message":"Drafting: yesterday I shipped actions"},{"kind":"ask","question":"Post it?","buttons":["Post","Cancel"],"answer":"Post","skipped":false},{"kind":"toast","type":"info","title":"Standup","message":"Would post"}]}glimpse actions last <name> prints the record of the last real run, so an agent can ask you to press the key and then read what happened.
MCP
glimpse mcp offers list_actions (the folder, every action, its problems, and a reference of the file format) and last_action_run. Start it with --allow-actions to also offer run_action, with the same options as the command line. Its runs are headless unless the agent turns that off. A run that fails comes back as an error with its record.
Claude Code:
claude mcp add glimpse -- glimpse mcp --allow-actionsCodex, in ~/.codex/config.toml:
[mcp_servers.glimpse]
command = "glimpse"
args = ["mcp", "--allow-actions"]On Windows, run it through cmd /c glimpse mcp --allow-actions. It needs the command line installed. Setup for other agents is on the MCP page.
A skill for your agent
Save this as ~/.claude/skills/glimpse-actions/SKILL.md, or wherever your agent reads skills.
---
name: glimpse-actions
description: Write, test and fix Glimpse actions, the scripts Glimpse runs from a shortcut, a spoken phrase or an event. Use when asked to make a voice command, a Glimpse shortcut that runs a script, or to automate something after dictating.
---
# Glimpse actions
An action is one script file in the Glimpse actions folder. Find the folder with `glimpse actions list` (or the MCP tool `list_actions`).
## Write
- Any language. The `#!` line picks the program; otherwise the extension does (.py, .js/.mjs, .sh, .ps1, .cmd/.bat).
- Header comment lines at the top, before any code:
- `@glimpse.description <one line>`
- `@glimpse.shortcut <keys> [smart|hold|toggle]`, keys like `Control+Alt+T` or `CmdOrCtrl+Shift+K`
- `@glimpse.say <phrase>`: runs when a dictation starts with it. Two or more words unless the action also has a shortcut.
- `@glimpse.on dictation.saved|library.added|library.complete|library.error`
- `@glimpse.app <name>`, `@glimpse.site <host>`
- `@glimpse.show insert` to type the output; default shows it as a notice
- `@glimpse.timeout <seconds>` (default 30, 0 = none), `@glimpse.listen false` (key runs without dictation)
- Read the spoken text from stdin. Context is in GLIMPSE_APP, GLIMPSE_URL, GLIMPSE_SELECTED_TEXT, GLIMPSE_FIELD_TEXT, GLIMPSE_PHRASE, GLIMPSE_EVENT, GLIMPSE_ID, GLIMPSE_LANGUAGE, GLIMPSE_AUDIO_FILE; keep files in GLIMPSE_STATE_DIR.
- Print only the result to stdout. Logs and progress go to stderr. Exit non-zero on failure; the last stderr line becomes the error.
- Use `glimpse toast`, `glimpse ask "<question>" --button A --button B`, `glimpse pill` (typing actions only), `glimpse llm "<instruction>" [--local]` (stdin in, reply out), `glimpse clean`.
- Never put API keys in the file. Read them from the environment; the user exports them in their shell profile.
- When `GLIMPSE_HEADLESS` is `1`, skip anything that can't be undone (sending, posting, deleting, purchases) and print what you would have done.
## Test
1. Save the file in the folder.
2. `glimpse actions list`: fix every problem shown for it.
3. `glimpse actions run <name> "<what the user would say>" --headless`, with `--answer` for each question, `--say "<full sentence>"` to test phrase routing, `--event <name>` for events, and `--env GLIMPSE_APP=...` for context. Use `--json` to read the record.
4. Read the record: what was shown, typed and asked, the exit code and stderr. Fix and repeat until it does what the user asked.
5. Tell the user to switch it on in Glimpse's Actions screen (new files start off) and how to trigger it. After they try it, `glimpse actions last <name>` shows what happened.
With MCP, use `list_actions`, `run_action` and `last_action_run` instead of the CLI.