claude.sh
Claude Code rewritten as a ~1,500-line bash script with zero npm dependencies, using only curl and jq to interact with the Anthropic API.
At a Glance
Fully free and open-source bash script. Requires your own Anthropic API key.
Engagement
Available On
Alternatives
Listed Apr 2026
About claude.sh
claude.sh is a minimal, dependency-free reimplementation of Claude Code as a single bash script. It replaces ~380,000 lines of TypeScript and 266 npm packages with roughly 1,500 lines of shell script, requiring only curl and jq. The tool provides a full REPL loop for interacting with Claude models, including real-time streaming, tool execution, and session management — all with instant startup and no Node.js runtime.
- Real-time streaming via FIFO pipe so text appears as Claude generates it, providing a responsive interactive experience
- 6 built-in tools (Bash, Read, Edit, Write, Glob, Grep) enabling Claude to read, write, and search files and run shell commands
- Tool chaining supports up to 25 tool calls per turn, allowing complex multi-step tasks
- Permission prompting asks before running non-safe commands, with
y/n/aoptions and configurable permission modes (ask,allow,deny) - CLAUDE.md loading reads project instructions from CLAUDE.md files up the directory tree for project-aware context
- Git-aware context injects branch name, status, and recent commits into the system prompt automatically
- Session save/resume auto-saves conversations on exit and allows resuming by ID or interactive list
- Retry with backoff handles 429/529 rate limit errors with exponential backoff
- Cost tracking displays per-turn and session token cost totals
- Slash commands including
/help,/cost,/model,/clear,/save,/resume,/commit, and/diff - Pipe mode allows non-interactive use:
echo "explain this" | ./claude.sh - Modular architecture split across
api.sh,json.sh,tools.sh, andtui.shfor maintainability
To get started, clone the repository, make the script executable with chmod +x claude.sh, set your ANTHROPIC_API_KEY environment variable, and run ./claude.sh. Optionally install ripgrep for better search and python3 for the edit tool.
Community Discussions
Be the first to start a conversation about claude.sh
Share your experience with claude.sh, ask questions, or help others learn from your insights.
Pricing
Open Source
Fully free and open-source bash script. Requires your own Anthropic API key.
- Full REPL loop
- 6 built-in tools
- Session save/resume
- Real-time streaming
- Cost tracking
Capabilities
Key Features
- Real-time streaming via FIFO pipe
- 6 tools: Bash, Read, Edit, Write, Glob, Grep
- Tool chaining up to 25 calls per turn
- Permission prompting before non-safe commands
- CLAUDE.md project instruction loading
- Git-aware context injection
- Session save and resume
- Exponential retry on rate limits
- Per-turn and session cost tracking
- Slash commands (/help, /cost, /model, /clear, /save, /resume, /commit, /diff)
- Pipe mode for non-interactive use
- Configurable model and token limits via environment variables
