Drop-in replacement for claude -p that drives the interactive TUI via PTY, preserving subscription billing
Critical: - G-1: Stop poller exit seq: replace malformed \x1b[201~\r/exit\r with /exit\r - G-2: EC-7 (Stop before prompt) is unreachable after EC-11 unsets session vars; now errors - G-3: hook.sh FIFO path written as single-quoted shell string to prevent injection - G-9: FIFO O_NONBLOCK ENXIO prevention: keeper write-end fd held until Stop fires - G-12: SIGTERM now installs handler (mirrors SIGINT) so TempDir drops cleanly High: - G-4: stream-json offset defined as byte offset via seek(End) at prompt injection - G-5: /read is a built-in slash command, not an MCP tool; no allowedTools needed - G-6: hook merge ordering documented (sequential, user hooks first, per-hook timeout) - G-7: mock_claude built in Phase 2 (not Phase 10) so integration tests run in all phases - G-8: install.sh step 3.5 installs mock_claude; doctor --check references ~/.local/bin/mock_claude - G-10: cwd-slug algorithm documented (strip leading /, replace / with -) + unit test directive - G-11: model precedence chain defined (--model > config.toml > compiled-in default) Medium/Low: - G-13: idle fallback timer is one-shot; deactivated after any transition - G-14: --setting-sources= marked unverified (per OQ-2) in all three mentions - G-15: /read sandboxing note added (not filesystem-restricted in standard installs) - G-16: mock_claude added to CI artifact list and Cargo.toml workspace note - G-17: ClaudePrintError variant → JSON subtype mapping table added - G-18: fingerprint dedup false-negative for identical-usage consecutive turns documented - G-19: install.sh step 2.5 preserves previous binary as claude-print.prev - G-20: window size probe order defined (STDOUT→STDIN→/dev/tty→fallback 220×50) - G-21: scenario count "20+" changed to open-ended; MOCK_DELAY_STOP usage noted - G-22: settings.json schema verification added to OQ-1 checklist - G-23: NEEDLE stdin delivery connected to CLI stdin-as-prompt behavior - G-24: PO-4 noted in Phase 4 entry; PO-5 acknowledged in Phase 7 entry Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| docs | ||
| README.md | ||
claude-print
Drop-in replacement for claude -p (print/headless mode) that drives the Claude Code interactive TUI via PTY — preserving subscription billing after the June 15, 2026 Agent SDK credit split.
Why this exists
Starting June 15, 2026, Anthropic separates claude -p (headless) into a separate Agent SDK credit pool ($100–$200/month on Max plans). Only the interactive TUI (cc_entrypoint=cli) continues drawing from the unlimited subscription. claude-print wraps the interactive TUI in a PTY so callers get claude -p wire-compatible output while billing against the subscription.
Structure
docs/notes/— design decisions, constraints, integration detailsdocs/plan/plan.md— complete implementation plan