lastout captures the output of interactive shell commands and lets you fetch the last completed command output directly with lastout.
- Gives automation and LLM tools a stable way to read terminal output after a command runs.
- Lets you include the original command with
lastout -wcwhen you want better AI context.
Current scope for v1 is intentionally narrow.
| Shell | Terminal | Status |
|---|---|---|
| Fish | Ghostty | Supported |
| Fish | Other terminals | Not supported |
| Bash/Zsh | Any terminal | Not supported |
No package manager release yet. Install from this repo locally.
- Put
bin/lastouton yourPATHand make it executable. - Copy or symlink
fish/conf.d/lastout.fishinto your Fishconf.ddirectory.
Example paths:
install -m 755 bin/lastout ~/.local/bin/lastout
ln -sf "$PWD/fish/conf.d/lastout.fish" ~/.config/fish/conf.d/lastout.fishStart a new Ghostty Fish session after installation.
# Run something that fails
python docs/demo/bugtrace.py
# Get plain output for the last completed command
lastout
# Include the original command too
lastout -wc
# Pipe it into an AI CLI for a fast fix suggestion
lastout -wc | aichat "Find the bug and give me the exact fix."
The demo shows this flow:
- Run a realistic Python traceback.
- Grab the exact output plus command with
lastout -wc. - Pipe it into an LLM CLI to get a fix suggestion immediately.
- Confirm that
lastoutnow points at the AI answer.
The demo asset is generated from docs/demo.tape with VHS so it stays reproducible.
Use these patterns when you want a fast diagnosis from terminal output.
python app.py
lastout -wc | aichat "Find the bug, tell me the exact line to change, and give me one verify command."bun test
lastout -wc | aichat "Summarize only failing tests and likely root cause. Return a minimal fix plan."git pull
lastout -wc | aichat "Explain what git is asking me to do, then list exact commands to resolve safely."python app.py
lastout -wc | aichat "Extract exception type, failing file:line, and the first fix I should try."lastout -wc | aichat "Give me the fastest fix. Format: cause, commands to run, verification command."lastout -wc | llm "You are a senior terminal troubleshooter. Return: root cause, exact fix commands, and one verify command."For stricter output (easy to copy/paste into scripts), ask for JSON:
lastout -wc | llm "Return valid JSON with keys: root_cause, fix_commands, verify_command."Optional: pass a sequence number to inspect an older captured command.
lastout 1
lastout -wc 1lastout [seq]: prints captured output for the last completed command (or specific sequence).lastout --with-command [seq]: prints the original command plus captured output.lastout -wc [seq]: shorthand for--with-command.
- In Ghostty + Fish, startup bootstrap runs
scriptand writes a raw session log to an ephemeral directory. - Fish
fish_preexecandfish_postexechooks call hiddenlastout --internal ...subcommands around each command. lastoutslices the raw log between captured start/end byte offsets and strips terminal control sequences.- Carriage-return spinners and transient
Generating...updates are collapsed so you only keep the final visible text. - On shell exit,
lastoutcleans up the ephemeral session directory.
lastoutnot found: verify~/.local/binis on yourPATHand restart Fish.- No output captured: confirm you are in Ghostty and
TERM_PROGRAMisghostty. - Capture never starts: check
command -q lastoutandcommand -q scriptsucceed in Fish. - Empty
lastout: run a command first, then calllastoutafter it finishes. - Permission issues: ensure
bin/lastoutis executable (chmod +x). - If
aichatorllmis not found, install the CLI first and retry the same pipeline. - If you want both the command and output for AI prompts, use
lastout -wcinstead of plainlastout.
- Run tests:
bun test - Shell syntax checks:
bash -n bin/lastout
fish -n fish/conf.d/lastout.fishMIT. See LICENSE.
