explaingit

sbhattap/claude-pee

Analysis updated 2026-05-18

45RustAudience · developerComplexity · 3/5Setup · moderate

TLDR

A Rust CLI that wraps Claude Code so scripts can send it prompts and read back replies automatically.

Mindmap

mindmap
  root((claude-pee))
    What it does
      Wraps claude CLI
      Sends one shot prompts
      Reads assistant replies
    Tech stack
      Rust
      PTY handling
      env_logger
    Use cases
      Script Claude Code
      Automation pipelines
      CI integrations
    Audience
      Developers
      Automation engineers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Call Claude Code from a script and capture just the text reply.

USE CASE 2

Stream every event of a Claude Code session as JSON for another program to consume.

USE CASE 3

Use claude-pee as a drop in alias for the claude command in automation contexts.

What is it built with?

RustCargo

How does it compare?

sbhattap/claude-peeion-elgreco/riversfuninkina/openeffects
Stars454544
LanguageRustRustRust
Setup difficultymoderatemoderatemoderate
Complexity3/54/54/5
Audiencedeveloperdatadeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires Rust 1.85+ and a working install of the official Claude Code CLI on PATH.

No license information is provided in the README.

In plain English

claude-pee is a small command line tool written in Rust that wraps the official Claude Code CLI so it can be driven programmatically, as if a person were typing into it. Instead of replacing Claude Code, it starts the real claude program inside a virtual terminal, gives that session a fresh ID, and then watches what happens inside it. The main use is sending a single one shot prompt with the -p flag and getting back just the assistant's reply on the command line, either as plain text, as JSON, or as a live stream of JSON events. This makes it possible to call Claude Code from scripts, other programs, or automation pipelines, rather than only from an interactive terminal session. A key design detail is how it knows when Claude has actually finished answering. Rather than guessing based on the screen going idle, claude-pee registers a Stop hook with Claude Code for that session only. When Claude finishes a turn, that hook creates a small marker file, claude-pee notices it, sends an exit command, and shuts down cleanly with the same exit status as the underlying program. Several environment variables let a user tune behavior, such as how long to wait before typing the prompt, how fast to simulate typing, and which claude binary to run. It can also be used as a drop in replacement for the claude command itself through a shell alias, without causing infinite loops, because it looks up the real binary through the system path. Installation requires Rust 1.85 or newer and is done by building the project with cargo and copying the resulting binary onto the system path. The project is aimed at developers who want to script or automate interactions with Claude Code rather than type into it by hand, and the source code is organized into small modules covering argument parsing, configuration, terminal handling, and the hook based shutdown logic.

Copy-paste prompts

Prompt 1
Write a shell script that uses claude-pee to send a prompt to Claude Code and save the JSON reply to a file.
Prompt 2
Explain how the Stop hook sentinel file mechanism in claude-pee works and how I could adapt it for my own CLI tool.
Prompt 3
Help me set the CLAUDE_PEE_QUIESCE_MS and CLAUDE_PEE_INJECT_CHAR_DELAY_MS environment variables for a slow CI machine.
Prompt 4
Show me how to build claude-pee from source with cargo and install it on my PATH.

Frequently asked questions

What is claude-pee?

A Rust CLI that wraps Claude Code so scripts can send it prompts and read back replies automatically.

What language is claude-pee written in?

Mainly Rust. The stack also includes Rust, Cargo.

What license does claude-pee use?

No license information is provided in the README.

How hard is claude-pee to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is claude-pee for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.