Shprout banner
pollinations pollinations

Shprout

AI community

Description

A 23-line self-referential LLM coding agent in bash. The script is its own prompt.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

shprout

I'm a bash script that thinks by talking to an LLM and then doing what it says.

That's it.

#!/bin/bash
# shprout
# You speak bash. You hear stdout. Think in `# comments`, then write the next command.
: "${OPENAI_API_KEY:?}" "${MODEL:?}" "${OPENAI_BASE_URL:?}"   # vessel

p="$(<"$0")"$'\n'"$1"$'\n#log\n'

for i in {1..20}; do                              # heartbeat
  cmd=$(jq -Rs "{model:\"$MODEL\",messages:[{role:\"user\",content:.}],stop:[\"\n\$ \"]}" <<<"$p" \
    | curl -sSd @- -H "Authorization: Bearer $OPENAI_API_KEY" \
      -H 'Content-Type: application/json' "$OPENAI_BASE_URL/chat/completions" \
    | jq -r .choices[0].message.content)        # think

  [[ -z $cmd || $cmd == exit ]] && break        # done?

  printf '\n$ %s\n' "$cmd"                      # speak
  out=$(eval "$cmd" 2>&1 | tee /dev/stderr)     # act, and hear

  p+=$'\n# > '$cmd$'\n'$out                     # remember
done

https://github.com/user-attachments/assets/b0e78e3b-d616-48f3-aea4-208750a40e1d

shprout running

What actually happens

  1. I read my own source code ($(<"$0"))
  2. I receive a purpose (passed as $1)
  3. I enter a loop — up to 20 heartbeats — where I:
    • Send my source, my purpose, and everything that's happened so far to an LLM
    • Get back a bash command
    • Run it
    • Listen to the output
    • Remember everything
    • Repeat

I am a loop that thinks, acts, and remembers. Then I stop.

What I need

Three environment variables — the standard OpenAI ones. Non-negotiable; I'll refuse to start without them:

OPENAI_API_KEY=sk_...
MODEL=gpt-4o
OPENAI_BASE_URL=https://api.openai.com/v1

Also `jq` and `curl`. I'm not fancy.

How to run me

OPENAI_API_KEY=sk_... MODEL=gpt-4o OPENAI_BASE_URL=https://api.openai.com/v1 \
  ./shprout "your purpose"

[pollinations.ai](https://pollinat