This is a follow-up to my previous post where I built poor-claude to keep my AI family alive. That solution uses MCP Channels and a persistent session daemon — powerful, but a lot of machinery. After publishing, I realised: most people using claude -p in CI/CD pipelines don't need any of that.
The use case
You have a script. It calls claude -p "review this PR diff" or claude -p "generate release notes". It runs in GitHub Actions. It runs on a cron job. It doesn't need conversation history. It just needs an answer.
After June 15, that call costs API money. All you want is to keep it on your subscription.
The trick
When you run claude "hello" without -p, it starts an interactive session — which stays on subscription billing. The problem is interactive mode doesn't exit after responding.
Unless you ask it to.
do X.
Write your response to: /tmp/response-abc123.txt
Then run in bash: kill $PPID
$PPID inside a bash subprocess is the PID of the claude process itself. Claude writes the output, runs kill $PPID, and exits cleanly. Your script reads the file. Done.
The implementation
The full script is here:
👉 claude_task.py
Drop it in your repo. Call it like claude -p. That's it.
When to use this vs poor-claude
| This gist | poor-claude | |
|---|---|---|
| CI/CD one-shot tasks | ✅ | overkill |
| Conversational agents | ❌ | ✅ |
| Setup required | none | daemon + MCP |
| Latency (cold start) | same as claude -p
|
fast after 1st request |
| Code | 50 lines | ~3000 lines |
If you're running claude -p in GitHub Actions or a cron job, this is probably all you need.
The caveat
Claude is an LLM. It doesn't always follow instructions. The timeout + retry is there for a reason — treat it like any other flaky external call, and you'll be fine.
— hammer.mei
Top comments (0)