Approve Claude Code and Codex commands from your phone
Your coding agent works on its own. Risky commands wait until you allow them from your phone.
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{ "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/finalsay-gate.sh", "timeout": 660 }
]
}
]
}
}Set it up
Install the CLI and sign in
Paste a workspace API key and pick the agent this repo should use.
sh npm i -g finalsay finalsay loginAdd the hook
Claude Code: copy the script and merge the snippet above into .claude/settings.json. Codex: see below. The hook needs jq.
sh mkdir -p .claude/hooks cp "$(npm root -g)/finalsay/examples/agent-hook/finalsay-gate.sh" .claude/hooks/ chmod +x .claude/hooks/finalsay-gate.shWork as usual
When the agent runs a matching command, your phone gets the request. The hook waits up to 10 minutes.
See it work
Answer it yourself. Nothing here talks to a server.
Interactive demo: answer an agent’s approval request
- Tap the notification
- Pick an answer
- See what the agent does
What the agent gets back
| You | Claude Code or Codex |
|---|---|
| Allow | The command runs. |
| Block | “Blocked by Ana in FinalSay. Do not run this command; ask the user how to proceed.” |
| Write your own answer | “Blocked by Ana in FinalSay with this instruction (follow it instead): …” |
| Nobody answers before it expires | “Blocked: nobody answered in FinalSay before the request expired.” plus the agent’s fallback instruction, if it has one. |
| No answer within the hook’s wait | “Blocked: no answer in FinalSay within 600s. Try again later or ask the user.” |
| FinalSay can’t be reached | Blocked, unless you set FINALSAY_GATE_FAIL_OPEN=1. |
Details
Options
- FINALSAY_GATE_PATTERNdefault: the default list
- An extended regex (case-insensitive) of the commands to gate.
- FINALSAY_GATE_MAX_WAITdefault: 600
- Seconds to wait for an answer. Keep the hook timeout above it.
- FINALSAY_GATE_FAIL_OPENdefault: off
- Set to 1 to let commands run when FinalSay itself can’t be reached.
In Codex
Copy the same script to .codex/hooks/, save this as .codex/hooks.json, then trust the hook in /hooks. The codex argument labels requests as Codex.
{
"hooks": {
"PreToolUse": [
{
"matcher": "^Bash$",
"hooks": [
{ "type": "command", "command": "\"$(git rev-parse --show-toplevel)\"/.codex/hooks/finalsay-gate.sh codex", "timeout": 660 }
]
}
]
}
}Good to know
- Gated by default: git push, rm -r, terraform apply and destroy, kubectl apply and delete, npm publish, DROP TABLE and DROP DATABASE.
- Only shell (Bash) tool calls are checked; everything else runs as normal.
- The request shows the exact command and the directory, plus Claude’s own description of what it’s for.
- Codex runs a hook only after you trust it in /hooks, and asks again when it changes.
Questions
Does this work with Cursor or Aider?
Use the finalsay CLI and its agent skill instead. Any agent that runs shell commands can ask with finalsay ask, and the exit code tells it what to do.
Can I answer from my laptop?
Yes. Every request also shows up in the web dashboard.
What if I’m asleep?
The request expires or the hook stops waiting, and the command stays blocked. The agent is told nobody answered.
Will it slow the agent down?
Only commands that match the pattern wait. Everything else runs as normal.
Can I change the list?
Yes. Set FINALSAY_GATE_PATTERN to your own extended regex.