Ask a person from any shell script
finalsay ask sends the question to your phone and waits. The exit code is the answer.
finalsay ask "Deploy v2.3 to production?" -c "$(git log -1 --stat)" --wait && ./deploy.shSet it up
Install it
Node 20 or later.
sh npm i -g finalsaySign in
Run finalsay login on your machine, or set FINALSAY_API_KEY and FINALSAY_AGENT_ID in CI.
sh finalsay loginAsk, and wait for the answer
sh finalsay ask "Run the migration on prod?" --wait echo $? # 0 approved · 3 another option · 4 instruction · 5 expired
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
release.sh (continued)
code=$? choice=$(jq -r '.selected_option_value // empty' decision.json) case "$code:$choice" in 0:*) ./deploy.sh production ;; 3:canary) ./deploy.sh canary ;; 3:hold) echo "Not deploying: hold" ;; 4:*) echo "Instruction: $(jq -r .custom_instruction decision.json)"; exit 1 ;; 5:*) echo "Expired: $(jq -r .custom_instruction decision.json)"; exit 1 ;; *) exit 1 ;; esac
Exit codes
| Code | Meaning |
|---|---|
| 0 | Approved: the approving option was chosen (the first option, or --approve-value). |
| 1 | Error: network, auth, not found, rate or plan limit, idempotency conflict. |
| 2 | Usage error: bad flags, missing config, a payload over a limit. |
| 3 | Another option was chosen. |
| 4 | The reviewer sent a custom instruction. |
| 5 | Expired with no answer. |
| 6 | Still pending (status, or --max-wait reached). |
| 130 | Interrupted with Ctrl-C. The approval stays open; resume with finalsay wait. |
Details
Useful flags
- -o, --option
- An option as Label=value. Up to four. Approve and Reject if you set none.
- -c, --context / --context-file
- Markdown context, up to 2,500 characters. --context-file - reads stdin.
- --wait, --max-wait
- Block for the answer
- --approve-value
- Which option exits 0. The first one by default.
- --summary
- The push notification title
- --expires-in, --expire-instruction
- The timeout in seconds
- --json
- Print the result as JSON
JSON output
ask --wait --json, wait --json and status --json print the API result plus two fields the CLI adds: outcome and exit_code.
{
"request_id": "5b1c…",
"status": "selected_option",
"selected_option_index": 0,
"selected_option_label": "Approve",
"selected_option_value": "approve",
"custom_instruction": null,
"resolved_by": { "user_id": "…", "name": "Ana" },
"resolved_at": "2026-11-15T10:01:00.000Z",
"outcome": "approved",
"exit_code": 0
}In CI
The commit message goes through an environment variable, never straight into the script.
- name: Ask before deploying
env:
FINALSAY_API_KEY: ${{ secrets.FINALSAY_API_KEY }}
FINALSAY_AGENT_ID: ${{ vars.FINALSAY_AGENT_ID }}
COMMIT_MSG: ${{ github.event.head_commit.message }}
run: |
npx finalsay ask "Deploy ${GITHUB_SHA::7} to production?" -c "$COMMIT_MSG" --wait --max-wait 900For coding agents
Drop skill/SKILL.md into .claude/skills/finalsay/ or your agent’s skills folder, or paste AGENTS.md into your AGENTS.md or CLAUDE.md. The agent learns when to ask and how to read the answer. Codex, Cursor, Aider and any agent that runs shell commands can use it.
Good to know
- Polls from every 2 seconds, backing off to every 15, until someone answers or it stops waiting.
- Network errors and server errors are retried while it waits.
- The API key never goes on the command line, so it stays out of your shell history.
Questions
What if the CI job times out first?
--max-wait exits 6 and the approval stays open. Resume later with finalsay wait and the request ID.
Where is my key stored?
In ~/.config/finalsay/config.json, mode 0600. Environment variables and flags override it.
Can I pick which option means approved?
Yes, with --approve-value. Otherwise the first option exits 0.
Can I ask without waiting?
Yes. ask prints the request ID right away; run finalsay wait or finalsay status later.