claupe
v0.0.1
Published
A claude -p shim that drives a real claude TUI per invocation
Readme
claupe
A headless wrapper around the
claudeTUI for programmatic use.
Claude has recently introduced limits on the programmatic use of claude -p, which can get expensive fast. claupe allows you to use the claude TUI in a headless way, so your requests still bill against your interactive subscription instead. It's ideal for cron jobs, one-off scripts, and any time you want to quickly get an answer from claude without leaving the terminal.
How to use it
Install it globally using:
npm install -g claupeThen you can run:
claupe "<prompt>" # positional prompt
git diff | claupe "review" # stdin is appended to the prompt
claupe -p "<prompt>" # -p accepted for muscle memoryEach invocation is a fresh claude conversation. You can use claupe in scripts, cron jobs, or just for quick questions in the terminal.
Configuration
| Variable | Default | Purpose |
| -------------------------- | --------- | ------------------------------------------------------ |
| CLAUPE_FIFO_DIR | $TMPDIR | Where per-request FIFOs are created |
| CLAUPE_CLAUDE_BIN | claude | Path to the claude binary |
| CLAUPE_READY_IDLE_MS | 800 | PTY-idle window before pasting the envelope |
| CLAUPE_READY_MAX_WAIT_MS | 30000 | Max wait for the PTY to ever go idle |
| CLAUPE_TIMEOUT_MS | 300000 | Max wait for claude to respond after paste |
| CLAUPE_BOOT_DELAY_MS | 0 | If set, use this fixed sleep instead of idle detection |
Caveats
- Every call cold-starts claude (~3s). Fine for cron and one-shot scripts; bad for tight loops.
--dangerously-skip-permissionsis required so claude can run the callback unattended. Only run claupe in workspaces where that's acceptable.- No defense against prompt injection in piped stdin. If you
cat untrusted.txt | claupe ...and the file contains adversarial instructions, claude may follow them. With--dangerously-skip-permissionsthat includes shell commands. Only pipe content you trust. - The interactive/programmatic split is Anthropic's call, not a hard technical line. If they later decide to flag TUI traffic that comes from a PTY without a real human, this trick stops working.
License
MIT — see LICENSE.
