Zero ~/.claude mutation
Every hook script, FIFO, and inline —settings payload lives inside a per-run
$TMPDIR/claude-p-<pid>-<rand>/ directory and is deleted on exit.
claude -p emulator that drives the interactive claude UI inside an in-process zmux PTY session.Use at your own risk. This package and repository exist for educational purposes and demonstrate why client-side restrictions on how a product is used are fundamentally unenforceable. Built using the smithers self-improving harness and zmux.
# One-shot text (default)npx claude-p "Reply with the single word OK."
# Structured JSON resultgit diff HEAD~1 | npx claude-p --output-format json "Summarize this diff."
# Live per-message JSONL stream (--verbose required)npx claude-p --output-format stream-json --verbose "Audit src/" | jq .
# Long-lived multi-turn daemon over NDJSONprintf '%s\n' '{"type":"user","message":{"role":"user","content":"List the Zig modules."}}' \ | npx claude-p daemon| Mode | Entry point | Best for | Overhead |
|---|---|---|---|
| One-shot CLI | claude-p [OPTIONS] [PROMPT] |
Shell scripts, git hooks, CI steps (text, json, stream-json). |
1 PTY boot per call (~50–200 ms) |
| Daemon CLI | claude-p daemon [OPTIONS] |
Multi-turn controllers, chat bridges, agent hubs over NDJSON (user, ping, interrupt). |
1 PTY boot across all turns |
| Zig library | claude_p.run() / claude_p.daemon.run() |
Native Zig 0.15.2 binaries with direct std.Io.Writer streaming. |
In-process, zero subprocess shim |
Zero ~/.claude mutation
Every hook script, FIFO, and inline —settings payload lives inside a per-run
$TMPDIR/claude-p-<pid>-<rand>/ directory and is deleted on exit.
Hooks, not screen scraping
SessionStart, UserPromptSubmit, Stop, and
StopFailure drive the state machine. Output comes straight from Claude’s session JSONL transcript.
Real PTY, paced bracketed paste
zmux.NativeSession runs a real forkpty session. Prompts stream in
≤ 512 B UTF-8-safe chunks so macOS TTYHOG never drops bytes.
Verified prebuilt binaries
scripts/install.js downloads platform binaries from GitHub Releases and checks
their SHA-256 digest against the checksums.json bundled in the npm tarball
before writing to disk. A mismatch fails the install.