Claude Code session
Claude P
Drop-in replacement for `claude -p` that drives the interactive Claude Code TUI inside an in-process zmux PTY session.
Install
npx claude-p "your prompt here"Found in the project README. Check it for setup steps after installing.
git clone https://github.com/smithersai/claude-p.gitFrom the README
claude-p
Use at your own risk. This package and repository exist for
educational purposes and demonstrates why client-side restrictions
on how a product is used are fundamentally unenforceable.
A drop-in replacement for claude -p that drives the interactive
claude UI inside an in-process [zmux][zmux] PTY session.
Built using smithers self-improving harness
Use
Output on stdout matches claude -p byte-for-byte.
How it works
1. Spawns claude interactively inside a [zmux][zmux] NativeSession
(a real PTY with a reader thread and bounded scrollback).
2. A small ANSI scanner answers the DA1 / DA2 / DSR / XTVERSION /
window-size queries Ink (the React-for-terminals runtime Claude
Code uses) issues at startup. Without these, the TUI hangs.
3. Registers two hooks via --settings '' — never
touches your ~/.claude/ config:
- SessionStart — the wrapper types the prompt + Enter.
- Stop — fires when the model finishes; payload carries
transcript_path.
4. Reads the transcript JSONL, extracts the final assistant message
plus usage, and prints in the requested format.
Flags
Unrecognized flags are forwarded verbatim to claude. -p/--print and
user-supplied --settings are rejected — claude-p emulates print mode and
injects its own settings to register the Stop hook.
Exit codes
Caveats
- macOS / Linux only. No Windows (no forkpty).
- Requires claude on $PATH. The wrapper invokes the real CLI.
- Per-message streaming, not per-token. With
--output-format stream-json, transcript lines (user messages, tool
uses, assistant turns, the trailing result envelope) are emitted
to stdout the moment claude flushes them. Individual tokens within
a single assistant message are not streamed — those require
claude -p --include-partial-messages which is only…Details
- Repository
- smithersai/claude-p
- Language
- Zig
- Last updated
- 17 June 2026
FAQ
What is Claude P?
Drop-in replacement for `claude -p` that drives the interactive Claude Code TUI inside an in-process zmux PTY session. It is a session for Claude Code, from smithersai/claude-p on GitHub.
How do I install Claude P?
Run npx claude-p "your prompt here", then follow the setup in the README.
Is Claude P popular?
smithersai/claude-p has 394 GitHub stars and 35 forks. It was last updated on 17 June 2026.
More sessions & history
Repo Harness
436Ancienttwo/repo-harness
File-backed workflow harness for reliable Claude Code and Codex sessions.
Avenoxbeyin
334avenoxai/avenoxbeyin
Your AI second brain in one command — open-source Obsidian + Claude Code system with persistent cross-session memory. avenox.lol/beyin.md
Clay
411chadbyte/clay
A self-hosted workspace where people and coding agents work together across projects, sessions, and providers.
Base
352ChristopherKahler/base
AI builder operating system. Turn Claude Code from a per-session tool into a workspace that remembers, maintains itself, and never goes stale. BASE = Builder's Automated State Engine.
claude-trace-replay
264harrylettering/claude-trace-replay
Open-source trace viewer that replays Claude Code sessions.
Claude Self Reflect
229ramakay/claude-self-reflect
Claude forgets everything. This fixes that. www.npmjs.com/package/claude-self-reflect
Browse the most popular Claude Code mods, all sessions & history, or the skills and MCP server directories.