Published 2025-12-13.
Time to read: 1 minutes.
llm collection.
Command-line interface (CLI) chat clients like ollama, ChatGPT,
and Mini-Agent are very useful, but most of them suffer from a few serious problems:
- They do not provide a way to save a transcript of the entire session.
- The scrollback buffer is limited in size. For a chat client, that means you can only see the last few screens of dialog before it is lost forever.
- Transcripts cannot be searched or summarized.
This article discusses the record Bash script that provides a
universal solution to that problem.
The record Script
#!/bin/bash
# Mike Slinn mslinn@mslinn.com
# Default values:
OUTFILE_BASE="chat"
CHAT_COMMAND="mini-agent" # Put your favorite chat command here
# CHAT_COMMAND="ollama run qwen3:4b" # Example of running a ollama model
usage() {
echo "
Usage: $(basename $0) [-o BASENAME] [-c COMMAND] [COMMAND_ARGS...]
Options:
-c Specify the command to run the chat client (default: ${CHAT_COMMAND})
-o Specify the base name for the log file (default: ${OUTFILE_BASE})
Example:
$(basename $0) # Runs the default client with the default output file base name
$(basename $0) -c 'ollama run qwen3:4b' -o binary_search
$(basename $0) -c mini-agent -o inspect
You can view the log of the live chat session delayed by a few seconds by using 'tail -F'.
For example:
tail -F 2025-12-12_20-06-39_chat.log
"
exit 1
}
while getopts ":o:c:h" opt; do
case $opt in
c)
CHAT_COMMAND="$OPTARG"
;;
o)
OUTFILE_BASE="$OPTARG"
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
if [ -z "$CHAT_COMMAND" ]; then
echo "Error: You must specify a chat client command using -c."
usage
fi
LOG_FILE="$(date +\%Y-\%m-\%d_\%H-\%M-\%S)_${OUTFILE_BASE}.log"
if [ "$CHAT_COMMAND" != mini-agent ]; then
echo "Press Ctrl+D to end the chat and stop recording."
fi
# Execute the script command with the specified chat client command
# The -c option ensures the script terminates when the client terminates
script -a "$LOG_FILE" -c "$CHAT_COMMAND"
echo "Recording finished. Log saved to $PWD/$LOG_FILE"
Help Message
This is the record help message:
$ record -h
Usage: record [-o BASENAME] [-c COMMAND] [COMMAND_ARGS...] Options: -c Specify the command to run the chat client (default: 'mini-agent') -o Specify the base name for the log file (default: chat) Example: record # Runs the default client with the default output file base name record -c 'ollama run llama3' -o binary_search record -c mini-agent -o inspect You can view the log of the live chat session delayed by a few seconds by using 'tail -F'. For example: tail -F 2025-12-12_20-06-39_chat.log
Usage Examples
Examples of usage are provided in:
- Claude Code Is Magnificent But Claude Desktop Is a Hot Mess
- Open-Source Large Language Models with Ollama
- MiniMax-M2 and Mini-Agent Review
You could review the session later by typing:
$ less 2025-12-12_20-06-39_chat.log
You could also view the log of the live session delayed by a few seconds by
using
tail -F:
$ tail -F 2025-12-12_20-06-39_chat.log
This is an easy way to share a chat with an audience. Everyone in the audience
would use SSH to connect to the machine running the chat, then they would all
use the above tail -F command.