Examples

Real .txt files. Save them and run them with think.

Hello world

Let's start with the simplest possible thing.

hello.txt
Print "hello world" and exit.
Terminal
$ think hello.txt
hello world

Weather lookup

Takes an optional city or zip code. If you don't pass one, it tries to geolocate. Results cache for an hour.

weather.txt
Figure out where I am and tell me the current
weather conditions. If arguments are passed in,
it could be a zip code or city. If not, try to
geolocate.

You can cache the results for an hour so you
don't have to make a new request every time.
Terminal
$ think weather.txt "New York"
New York, NY
45°F, clear skies. Wind: 8 mph NW. Humidity: 52%.

Install it and you can just run weather "New York" from anywhere.

Pipe data through

Since stdout is sacred, piping just works.

summarize.txt
Read stdin and output a one-paragraph summary.
Terminal
$ cat README.md | think summarize.txt
ThinkingScript lets you write executable scripts
in your own words. It sends prompts to an LLM
which uses tools to accomplish tasks, with user
approval at every step...

JSON processing

You don't need to remember the jq syntax for this. Just describe what you want.

extract-emails.txt
Read the JSON from stdin. Extract all email
addresses and output them one per line, sorted
alphabetically. No duplicates.
Terminal
$ cat users.json | think extract-emails.txt
alice@example.com
bob@example.com
carol@example.com

Stock market data

Results cache for an hour so you don't burn API calls. Shows ticker, price, change, volume, market cap, and PE ratio.

stocks.txt
Print a list of stock values. If none are given,
just show the top 10 by market cap.

I only need these updates once an hour, so you
can cache them so you don't have to fetch
every time.

Make sure you show ticker, company name, price,
change %, change $, volume, market cap, and
PE ratio.
Terminal
$ think stocks.txt
AAPL  Apple Inc.        $198.50  +1.2%  +$2.35
MSFT  Microsoft Corp.   $421.30  -0.3%  -$1.28
NVDA  NVIDIA Corp.      $875.40  +2.8%  +$23.80
...

Terminal table formatting

Pipe anything into it. It auto-formats with Unicode box-drawing, color-coded numbers, and columns sized to your terminal.

table.txt
Format the piped data into a terminal table.

Rules:
- Use Unicode box-drawing characters
- Right-align numbers, left-align text
- Bold white headers with a separator line
- Color numbers: green for positive, red for
  negative
- Size columns to fit the terminal width
- Use ANSI escape codes directly
Terminal
$ think stocks.txt | think table.txt

Programming techniques still apply

You're writing in plain text, but the same ideas from traditional programming still apply. You just describe them instead of implementing them.

Caching

API calls cost time and money. Tell the thought to cache and it will write results to its workspace and check before making another request.

exchange-rates.txt
Fetch current USD exchange rates for EUR, GBP,
and JPY.

Cache the results in the workspace for 4 hours.
If a cached file exists and isn't expired, use
that instead of making a new request.

First run hits the API. Next four hours? Serves from cache.

Structured output

When you need machine-readable output for downstream tools, just say so.

csv-contacts.txt
Read the messy text from stdin. Find anything
that looks like a contact (name, email, phone).

Output valid CSV with headers:
name,email,phone

If a field is missing, leave it empty. No
extra text, just the CSV.
Terminal
$ cat business-cards.txt | think csv-contacts.txt
name,email,phone
Alice Chen,alice@example.com,555-0142
Bob Park,bob@parkdesign.co,
Carol White,carol@white.io,555-0199

Chain them all together

Each script reads stdin, does its thing, writes to stdout. Stack as many as you want.

Terminal
$ cat raw-data.csv \
    | think clean.txt \
    | think analyze.txt \
    | think format-report.txt > report.md

Install them all and it gets real clean.

Terminal
$ cat raw-data.csv | clean | analyze | format-report > report.md

Get started

Terminal
$ curl -fsSL https://thinkingscript.com/install.sh | sh
$ thought setup
$ think https://thinkingscript.com/hi.txt