Credentials. Anything you pipe in is sent to the model provider, so do not pipe logs or diffs that contain secrets or customer data.
Who it is forA developer debugging a failing container or writing commit messages at the end of a long day.
The problemReading long logs for the one real error, or summarizing a diff, takes time you would rather spend fixing.
The outcomeA short list of detected errors with suggested fixes, or a ready-to-edit commit message.
What you need first
- Python and pip
- An OpenAI API key, stored in ~/.config/shell_gpt/.sgptrc on first run, or a local backend such as Ollama
- Linux, macOS or Windows with Bash, Zsh, PowerShell or CMD
Steps
- Install with
pip install shell-gpt - Analyze logs:
docker logs -n 20 my_app | sgpt "check logs, find errors, provide possible solutions" - Write a commit message:
git diff | sgpt "Generate git commit message, for my changes" - Use any redirection operator to pass a file in with a prompt such as summarise
- Review the output before acting on it
Prompt for your agent
Using TheR1D/shell_gpt, pipe the last 50 lines of <service> logs into sgpt and ask it to find errors and suggest fixes. Then pipe my staged git diff into sgpt for a commit message and show me both before doing anything.
Caveat. ShellGPT is not optimized for local models, so results with Ollama may be weaker than with OpenAI.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for TheR1D/shell_gpt and "Pipe logs and diffs into an LLM for quick answers"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer