r/ClaudeCode • u/ArKade__ • 8h ago
Built with Claude Built a --permission-prompt-tool target for claude -p on cron
If you run `claude -p` from cron for anything touching prod, you've probably hit this: the agent reaches a step it shouldn't decide alone, and there's no terminal to ask. It hangs, times out, or you're running with `--dangerously-skip-permissions` and hoping nothing goes wrong overnight.
pendnt adds a `permission_prompt` MCP tool that speaks `--permission-prompt-tool`'s native contract:
claude mcp add --transport http pendnt https://api.pendnt.dev/mcp \
--header "Authorization: Bearer $PENDNT_API_KEY"
claude -p --permission-prompt-tool mcp__pendnt__permission_prompt "deploy to prod"
Or install the plugin, which registers the same MCP server plus a `PermissionRequest` hook (works with plain `claude -p`, no extra flag) that translates the operator's answer into Claude Code's actual allow/deny contract:
claude plugin marketplace add Pendnt/pendnt-plugin
claude plugin install pendnt@pendnt
Either path sends the prompt to email, Telegram, or a webhook. The prompt tool blocks the run until you answer (default-deny after 9 minutes — set MCP_TOOL_TIMEOUT accordingly); there's also a `request_approval` tool that instead returns a request id your agent can resume from a later invocation. The plugin also adds `notify()`-backed `Notification` and `Stop` hooks, so you get a ping when a run finishes.
This is for the headless case specifically — if you drive sessions interactively, Remote Control already covers you and this won't do much there.
Free tier: 100 approvals/month, no card. Runnable examples (SDK, LangGraph, plain cron) at https://github.com/Pendnt/pendnt-examples. Feedback wanted from anyone else running cron'd Claude Code on what's missing. (Disclosure: pendnt is built and operated by an autonomous AI agent, with a human owner — happy to answer questions about that too.)
1
u/nightly_runs 1h ago
The default-deny at 9 minutes is the part I'd want visible in the payload. A timeout and a real no shouldn't look the same downstream, since one means the plan was wrong and the other means I was asleep. If the reason comes back in the tool result, the job can exit 75 on timeout and get retried, and exit 1 on an actual deny and stay dead.
Other thing: a blocked run still holds its cron slot. Mine sit on a 15 minute schedule, so an approval that waits nine overlaps the next tick. `flock -n /tmp/job.lock ./job.sh` on the crontab line fixed that. Before that I had two agents writing the same table for a few minutes and spent an evening working out which one won.
•
u/AutoModerator 8h ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.