Using LLM in the shebang line of a script
AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.
Why it matters
A workable pattern for turning any text file into an executable LLM prompt with tool calls, usable today with Simon Willison's free open-source LLM CLI.
Simon Willison describes how to put an AI prompt in the 'shebang' line of a file, the special first line that tells Unix systems which program should run the file. Using his free command-line tool called LLM, a text file whose first line invokes the tool becomes a runnable AI script. One example generates an SVG drawing of a pelican on a bicycle; another uses a time-reading tool so the AI can write a haiku mentioning the exact current time.
Willison's LLM CLI now supports a low-friction pattern where an entire script is just a prompt: the shebang line invokes the model, and options like '-T' attach tools. Tool calls even work inline, a demo calculator script ran multiply(2344, 5252) and add() correctly, returning 12,310,822. This is a developer conveniences, not a platform shift; no cost or enterprise implications are discussed.
The pattern uses '#!/usr/bin/env -S llm -f' so the file body is passed as a fragment prompt. Tool calling works via '-T name_of_tool', and YAML templates invoked with '-t' can define extra tools as inline Python functions plus a system prompt; a calc.sh example using model gpt-5.4-mini decomposed 2344 × 5252 + 134 into multiply and add tool calls, logging them with the --td debug flag. A fuller TIL example queries the Datasette SQL API over Willison's blog content.
Read the original
This summary exists to save you time, not to replace the source.
Key terms
LLM Simon Willison Kim_Bruning Hacker News Datasette gpt-5.4-mini
Was this summary useful?
One click, anonymous. It tells us which summaries to re-run.
Related reading
Code-driven AI illustrations are more useful than images from dedicated image models
Code-driven AI illustrations let designers edit assets directly in code, saving time on iteration and ensuring consistency, which is a game-changer for teams that need rapid, reusable visual content.
A hierarchical note-taking app for building large personal knowledge bases
Trilium lets users build and navigate massive personal knowledge bases without duplicating content, saving time on organization and retrieval.
Desktop apps in Go with native UI or web frontend
Go developers can now ship cross-platform desktop and mobile apps in a single small binary without cgo or heavy runtimes, cutting build complexity and deployment size.
OpenBitFun: an agent workspace with four harness modes and phone remote control
OpenBitFun lets agents run on any machine and be controlled from a phone, eliminating the need to choose between local power and remote access, saving developers time switching contexts.
Intel One Mono: a monospaced font designed with low-vision developers
Developers with low vision or eye fatigue can read code more clearly, reducing errors and improving productivity.