Photo by Sean Foster / Unsplash

Tiny Tool: Summarise History Prompt

tiny tool Jul 16, 2025 (Jul 18, 2025) Loading...
history -300 | llm -m claude-3.5-sonnet "write a consise narrative of my recent history – comment only on the actions and on particular patterns and groupings. Don't comment on me. Don't summarise at the end. pay particular attention to file location from cd to give or change context. A narrative is sequential, and looks like: «Called Ansible playbook xxx several times. Edited file yyy. Changed dirextory to zzzz. Switched focus to llm tooling.»"

This one-liner summarises my recent actions on the commandline. I've used it at the end of a session of exploring / configuring / coding to remind me what I've been doing. Here's an example of what it produces:

Started by looking at file headers and random data using head/tail commands on /dev/urandom. Created and edited files boo.yog and doo.txt, experimenting with various cat, head, and tail options. Monitored system logs using tail -F on various log files in /var/log/.
Made extensive use of Ansible, running multiple playbooks particularly user_setup_and_info.yml with the "7july" group parameter. Accessed secrets using 1Password (op) for vault passwords. Worked with Docker, checking versions and installing via Homebrew.
Changed directory to ansibleSetup, worked with droplet_only_setup.yml playbook multiple times. Created and managed vault-encrypted secrets files. Created a checkRefs.sh script and made it executable, then used it to process template files in the templates directory.
Finally, switched focus to exploring llm tooling, experimenting with different ways to analyze command history using llm with various models and parameters, particularly trying to generate narrative summaries of recent activities.

The tool pulls together:

  • the shell history (all the commandline commands I've entered this session), accessed through the history command*. I estimate how many entries I've made that I want to summarise.
  • Simon Willison's llm tool, which lets me experiment with my choice of large language model and gives me a transparent way to iterate on my prompt.
  • A text prompt, which could be better, but is better than I started with

I built the tool because I find that I need a reminder of what I've been doing – most recently I needed to explore a novel-to-me build tool while assessing the development experience, and found that I needed more reminders than I'd imagined. Browsing the history helps, but I need to re-interpret commands and gloss over the long ones. Having an acceptable summary helps me remember, which gives me a good place to start when looking over the history. It also gives me a good place to start if I need to summarise what I've been doing.

Making the tool took about 15 minutes, half of which on getting to the bottom of which history was in use, and the rest fiddling with the prompt and auditioning model. Writing about making it has taken an hour.

I imagine I'll continue to use it when I'm exploring something using the commandline, and when I'm building.

Changes: I'd love it to work on timestamped stuff, so that I can see sessions or ask for 'in the last two hours', or persuade the LLM to recognise bursts, or (maybe) combine two parallel histories in two simultaneous terminals. To do that I'll need to find a way to get VSCode to timestamp its history. It seems possible with bash and zsh history, so I'm hopeful. I'd like it to run every time I leave the commandline for (say) more than 15 minutes, and pop the summary somewhere I can see it. I'd like it to be much more clear about changes of context and directory. I need to use it in situations where I've been swinging about a bit.

I want to see what it makes of several old terminal windows (with their own history) so I can see what I was doing!

I particularly want to try combining with other timestamped logs, especially with dictated notes, system event sniffers, and trend monitors.

Subscribers get to see how the prompt evolved, and what other the other models produced.

`* The history command? I'd assumed that history would be in the file referenced by $HISTFILE, which might be /.zsh_history or /.bash_history – but both these are wrong: I've been working in the terminal in VSCode. VSCode keeps history in ~/Library/Application Support/Code/User/History/ on a Mac, referenced by a randomish number. So history it is – what a handy shim.

Member reactions

Reactions are loading...

Sign in to leave reactions on posts

Tags

Comments

Sign in or become a Workroom Productions member to read and leave comments.

James Lyndsay

Getting better at software testing. Singing in Bulgarian. Staying in. Going out. Listening. Talking. Writing. Making.

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.