# pu.sh

> A full coding-agent harness in ~400 lines of shell script, supporting Anthropic and OpenAI APIs with zero dependencies beyond curl, awk, and common Unix tools.

pu.sh is a minimal, portable coding-agent harness written entirely in shell script — no Node, no pip, no Docker, no runtime. It implements a full agentic loop (send prompt → parse response → execute tool → append to history → repeat) in roughly 400 lines, weighing less than 40 KB. It supports both Anthropic and OpenAI APIs, offers an interactive REPL with multi-turn memory, and can be piped together with other agents for composable workflows.

- **Zero-dependency install**: *Download a single shell file with `curl`, `chmod +x`, and run — no package manager required.*
- **Dual provider support**: *Works with Anthropic Messages API and OpenAI Responses API; auto-detects provider from API key or model name.*
- **7 built-in tools**: *`bash`, `read`, `write`, `edit`, `grep`, `find`, `ls` — a minimal but complete surface area for coding tasks.*
- **Interactive REPL**: *Multi-turn sessions with memory, REPL commands like `/model`, `/effort`, `/compact`, `/export`, `/skill:name`, and inline shell via `!cmd`.*
- **Reasoning effort control**: *Set `AGENT_EFFORT` from `none` to `max`; gated by model support for both providers.*
- **Auto-compaction**: *Automatically summarizes older turns when the context budget is exceeded; manual `/compact [focus]` also available.*
- **Pipe mode**: *`--pipe` flag produces clean stdout for composing agents together in shell pipelines.*
- **Checkpoint and resume**: *Writes `.pu-history.json` for automatic session resume; every step logged to `.pu-events.jsonl` as structured JSONL.*
- **Skills and prompt templates**: *`/skill:name` loads `SKILL.md` from local or user directories; `/template` expands `.pi/prompts/template.md`.*
- **Context files**: *Auto-loads `AGENTS.md` / `CLAUDE.md` from the current directory upward.*
- **Confirmation mode**: *`AGENT_CONFIRM=1` prompts before every tool execution for safer operation.*
- **Regression test suite**: *90 no-API behavioral tests via `bash eval/test_real.sh` covering JSON parsing, tool behavior, compaction, and more.*
- **MIT licensed**: *Fully open source — read every line, fork it, modify it, deploy it anywhere.*

## Features
- Zero-dependency shell script install
- Dual provider support (Anthropic + OpenAI)
- 7 built-in agent tools: bash, read, write, edit, grep, find, ls
- Interactive multi-turn REPL
- Reasoning effort control (none to max)
- Auto-compaction of long contexts
- Pipe mode for composable agent workflows
- Checkpoint and resume via .pu-history.json
- Event log in JSONL format
- Skills and prompt template system
- Auto-loads AGENTS.md / CLAUDE.md context files
- Confirmation mode before tool execution
- Session export to markdown
- 90-test regression suite with no API calls
- Surgical file editing with oldText→newText replacement
- Trailing newline preservation on file writes/edits

## Integrations
Anthropic Claude API, OpenAI API

## Platforms
WINDOWS, MACOS, API, CLI

## Pricing
Open Source

## Links
- Website: https://github.com/NahimNasser/pu
- Repository: https://github.com/NahimNasser/pu
- EveryDev.ai: https://www.everydev.ai/tools/pu-sh
