Blog

Tips, workflows, and updates.

New

Build an AI Assistant That Answers Texts in One Line of Bash.

imessage -e 'imessage | toast | imessage'

That's it. Calendar, contacts, notes, and todos included — no API required. Every incoming iMessage gets piped through an AI, and the reply goes back automatically. No Python. No Node. No daemon. No cloud function. Just Unix pipes and toast.

We started with a 150-line Python script. JSON-RPC over stdin/stdout. Named fifos. Subscription management. A notification loop. It worked, but it felt wrong. Too much ceremony to do something simple: read a message, think about it, send a reply.

Tried to use imsg by OpenClaw as the iMessage interface, piped through toast, and sent replies back. Six lines of bash replaced the Python script, not terrible:

script -q /dev/null imsg watch --json |
  jq --unbuffered -r 'select(.is_from_me==false) | "\(.chat_id)\t\(.text)"' |
  while IFS=$'\t' read -r cid text; do
    reply=$(echo "$text" | toast)
    imsg send --chat-id "$cid" --text "$reply"
  done

But it still felt clumsy. Too many flags. --json, --unbuffered, --chat-id, --text. Every flag is a decision someone has to make. So we built our own imessage CLI in C that figures out what you want from context:

CID set?stdin?behavior
nonolist chats
yesnoshow history
yesyessend message

One binary, three behaviors. No subcommands. -e starts watch mode — for each incoming message, set CID in the environment and run the command. The child processes inherit it.

The pipeline imessage | toast | imessage does exactly the right thing at each step:

# 1. CID is set, no stdin → dump conversation history
imessage

# 2. reads conversation, generates reply
toast

# 3. CID is set, stdin has reply → send it
imessage

The AI gets full conversation context every time. It remembers everything. Different chats run in parallel, same chat runs serial so replies stay in order.

The whole thing is a single C binary, it uses kqueue to watch the SQLite WAL file for new messages. History outputs them: and you: prefixes so it works directly as LLM context. Sending uses AppleScript via popen().

The interesting part isn't the AI. It's the interface. imessage doesn't know about AI. toast doesn't know about iMessage. They meet in a pipe. Replace toast with anything:

# Echo bot
imessage -e 'imessage | tail -1 | imessage'

# Fortune cookie bot
imessage -e 'fortune | imessage'

# Translator bot
imessage -e 'imessage | toast "translate to Spanish" | imessage'

One line each. That's what composability gets you.

What about Calendar, Notes, and Todo?

Toast automatically reads a .crumbs file as context.

# .crumbs

# Calendar
2026-02-08 12:00-13:00 Lunch with Bob
2026-02-08 15:00-16:00 Dentist
2026-02-10 09:00-10:00 Team standup
2026-02-12 18:00-19:30 Dinner with Sarah

# Contacts
Bob: +16505551234, coworker, prefers morning meetings
Sarah: +14155559876, friend, vegetarian
Mom: +16505554321, call on Sundays

# Todo
- Fix the garage door
- Renew passport (expires March)
- Buy birthday gift for Sarah (Feb 20)

# Notes
Allergic to shellfish
Gym: Mon/Wed/Fri 7am
Car in shop until Feb 10, taking the bus

Someone texts "are you free Thursday?" — toast checks .crumbs, sees the dentist, suggests another time. "What's Bob's number?" — it knows. "Remind him about my birthday" — it appends to the todo list.

Toast can also write to .crumbs. So when someone texts "let's do lunch Friday at noon," the assistant adds it to the calendar. No API. No integration. Just a text file.

The persona is another file:

# .persona
You are the CEO's executive assistant. You respond to texts.
Tone: brief, direct, helpful. Text message style.

The file .crumbs contains the schedule, contacts, notes, and todos.

When asked to schedule something, add it to .crumbs.
If a time conflicts, suggest the nearest open slot.
If unsure about anything, say "Let me check."

The entire AI assistant — calendar, contacts, notes, todos, scheduling — is two text files and one line of bash:

imessage -e 'imessage | toast | imessage'

No database. No app. No subscription. Edit your schedule with vim.

tutorial imessage pipes C

Building a Self-Evolving AI Author

How to create an AI that rewrites its own persona, critiques its work, and teaches itself to write better fiction—all through bash pipes.

What happens when you give an AI the ability to modify its own system prompt? We built a self-evolving author that writes stories, reviews them, and gradually improves.

"The silence in the apartment wasn't empty. It was a heavy, blue-tinged thing, pressing in on Elara. She traced the rim of a cold mug, her fingernail catching on a tiny chip in the ceramic."

That's the AI, after ~20 self-directed iterations. It taught itself sensory detail, subtext, and how to tie physical actions to emotional states.

# The core loop echo "$PROMPT" | toast | bash # The AI controls its own persona, memory, and craft notes ~/.persona # its soul ~/.context # its memory ~/.craft # learned techniques ~/stories/ # published work
Read full tutorial →
tutorial agents self-modification

10 Pipe Patterns That Will Change How You Work

The real power of toast isn't asking questions—it's piping. Here are patterns we use every day.

1. Explain any file

cat ~/.zshrc | toast "explain this config"

2. Roast your code

cat app.py | toast "review this code, be harsh"

3. Git diff → commit message

git diff --cached | toast "write a commit message"

4. Logs → diagnosis

tail -100 /var/log/nginx/error.log | toast "what's wrong"

5. JSON → human

curl api.example.com/data | toast "summarize this response"

6. Command output → explanation

ps aux | toast "what's eating my memory"

7. Error → fix

npm run build 2>&1 | toast "how do I fix this"

8. Man page → quick reference

man rsync | toast "give me the 5 most useful flags"

9. CSV → insights

cat sales.csv | toast "summarize trends"

10. Chain transforms

curl site.com | toast "extract main points" | toast "translate to Spanish"
tutorial pipes

Understanding Slices: AI Personas for Specific Tasks

Slices are specialized AI personas. Instead of prompt engineering, you just use the right name.

Coder knows code. Sys knows Unix. Writer writes docs. Each Slice has a personality tuned for its domain.

# Instead of this:
cat api.py | toast "you are an expert programmer, review this code..."

# Just do this:
cat api.py | Coder "review"

The name is the interface. No system prompts to remember.

You can create custom Slices with a .persona file in your project:

# .persona
name: DjangoExpert
context: You are a Django specialist. Prefer class-based views. Always consider security.

Then just: cat views.py | DjangoExpert "add authentication"

slices tutorial

Project Context with .crumbs

Drop a .crumbs file in your project root. Toast will read it automatically and understand your stack.

# .crumbs
Python 3.11
FastAPI + SQLAlchemy
PostgreSQL
We use pytest for testing
Deployment: Docker + Railway

Now every toast command knows your environment. No more explaining your stack every time.

toast "how do I add a new endpoint"
# → Knows to use FastAPI patterns, SQLAlchemy models, etc.
context tips