By the end of this project you'll have a summarize command on your $PATH. Pipe it a file or paste text in via stdin and it returns three bullets — the format you keep coming back to in real work.
Tip
This project assumes you can already make a model call. If not, do Build a Chatbot first.
Step-by-step
The build
1. Scaffold the CLI
Create a
summarizescript with a shebang. Useargparse(Python) orcommander(Node) for one positional argument: a file path. If no path is given, read from stdin. Return version with--version.2. Write the summarise prompt
Three bullets, no jargon, action-oriented. Reuse the Plain-English summary prompt from the Library — that's exactly what it's for.
3. Stream the output
Use the streaming API and print tokens as they arrive. Flushing is important — pipe-friendly tools must not buffer until the end.
4. Set proper exit codes
Empty input → exit 2. Model error → exit 1. Success → exit 0. This makes
summarize file.md && echo donework as expected in scripts.5. Install it on your PATH
chmod +x summarize, drop it in~/bin(orpipx install .), and use it tomorrow morning instead of opening a chat window.
What you learned
- CLIs are good interfaces for AI tools — composable, scriptable, no app to babysit.
- Streaming matters; humans tolerate latency much better when they see progress.
- Exit codes are how you turn a one-off script into a piece of infrastructure.