Skip to main content
Coding agents run commands on your machine and push to shared places. FinalSay gives you two ways to stay in charge, both built on the CLI, and both work the same in Claude Code and OpenAI Codex:
  • A hook that stops Claude Code or Codex before risky shell commands and asks you, whether or not the agent thinks to.
  • A skill (or AGENTS.md snippet) that teaches any coding agent when to ask and how to read the answer.
Both need the CLI installed and configured:
Create a dedicated agent for your coding agent (for example “Claude Code” or “Codex”) so its approvals have their own people and defaults.

The hook: approve risky commands from your phone

finalsay-gate.sh is a PreToolUse hook for both Claude Code and Codex. When the agent is about to run a shell command that matches a pattern, it asks in FinalSay with Allow and Block, and waits up to 10 minutes.
  • Allow → the command runs.
  • Block, a written answer, or no answer → the command is blocked and the agent is told why, including your written instruction.
By default it gates git push, rm -r…, terraform apply|destroy, kubectl apply|delete, npm publish, and DROP TABLE / DROP DATABASE. It needs jq.
1

Add the script

Copy examples/agent-hook/finalsay-gate.sh from the finalsay package to .claude/hooks/ in your project, and make it executable:
2

Register the hook

Merge this into .claude/settings.json:
.claude/settings.json
Keep the hook timeout above the wait time (600 seconds by default).

Tune it (optional)

The approval shows the full command and the directory, plus Claude’s own description of why it wants to run it (Codex doesn’t send one). The push notification reads Claude Code: <command> or Codex: <command>.
A hook is a strong guardrail, not a sandbox. It sees the commands the agent runs through its shell tool, so keep your agent’s own permission settings on as well.

The skill: teach the agent when to ask

The finalsay package includes:
  • skill/: an Agent Skill (SKILL.md, plus the icon and agents/openai.yaml Codex shows in its skill list). Copy the folder to your agent’s skills folder:
  • AGENTS.md: the same guidance, condensed. Paste it into your AGENTS.md (Codex reads it as is) or CLAUDE.md.
They teach the agent to ask before irreversible, costly or outward-facing actions, to write a question and context a person can answer quickly, and to act on each exit code: This works for any agent that runs shell commands: Claude Code, Codex, Cursor, Aider and others.
Agent shells often time out long commands. The skill tells the agent to run finalsay ask --wait in the background, or to ask without --wait and call finalsay wait <request_id> later.
Codex’s sandbox has no network by default, so finalsay ask from the agent’s own shell can’t reach FinalSay. Either allow it in ~/.codex/config.toml:
~/.codex/config.toml
or connect FinalSay over MCP instead, which doesn’t run in the sandbox. The skill tells the agent to use the MCP tools when its shell has no network.

Prefer MCP?

Claude Code, Codex and other MCP clients can also call FinalSay as tools (request_human_approval, get_approval_result). See MCP for both. The hook is the stronger guarantee: it runs whether or not the model decides to ask.