Discover and explore top open-source AI tools and projects—updated daily.
smithersaiCLI driver for interactive Claude Code TUI
New!
Top 83.7% on SourcePulse
This project provides claude-p, a drop-in replacement for the claude -p command-line tool. It enables programmatic interaction with the interactive Claude Code TUI by running it within an in-process zmux PTY session. Aimed at developers and power users, it offers enhanced control and a stable interface for automating Claude interactions, while demonstrating the challenges of client-side usage restrictions.
How It Works
claude-p spawns the Claude CLI within a zmux NativeSession, simulating a real terminal environment. It employs a small ANSI scanner to respond to terminal queries from Claude's Ink runtime, preventing TUI hangs. The wrapper registers SessionStart and Stop hooks, automatically typing prompts and capturing the final assistant message and usage from the generated transcript JSONL. This approach allows direct manipulation of the TUI without altering user configurations.
Quick Start & Requirements
zig build -Doptimize=ReleaseSafe). Dependencies are fetched automatically. Can also be used via npx claude-p .... Can be added as a Zig library (zig fetch --save=claude_p git+https://github.com/smithersai/claude-p).claude CLI must be in $PATH. Requires Zig 0.15.2 for building. Node.js/npm recommended for npx usage.Highlighted Details
claude -p with byte-for-byte stdout compatibility.zmux PTY session.text, json, stream-json.--model, --max-turns, --allowedTools, --resume, etc.) are supported and forwarded to the underlying claude CLI if unrecognized.Maintenance & Community
No specific details on maintainers, community channels, or roadmap were found in the provided README. The project is explicitly stated to exist for educational purposes.
Licensing & Compatibility
Limitations & Caveats
Unsupported on Windows due to reliance on forkpty. Not true real-time streaming; waits for model completion. Introduces ~50–200 ms latency. Multiline prompts require --input-file or stdin for reliable shell escaping. Susceptible to breaking changes in future Claude Code releases affecting terminal probes or hook payloads.
1 week ago
Inactive
dvdsgl