# Make a text adventure you play by SMS with AI

A game played by text has a nice rhythm. You read a scene at the bus stop, answer "open the door", and get on with your day until you feel like playing again.

## Start with instructions

```text
You run an original mystery set on a night train.
Each reply: what happens, then one short question. Under 280 characters.
The player has three items at most. Track them and mention them when they matter.
Never decide the player's action. If they're stuck, a passenger says something useful.
```

Give that to your AI builder along with our setup prompt. It makes the endpoint and connects it.

## The memory problem

Your agent sees the last 20 messages, which is about ten turns. After that it forgets the lantern. There are two fixes:

- **Cheap:** tell it to restate the important things every few turns ("You still have the lantern and Mrs. Okafor's key").
- **Proper:** ask your AI builder to save a small state record per `sender_id`, and load it before each reply. `sender_id` stays the same for each player.

A prompt to give your builder:

```text
Make a text game endpoint. For each sender_id, keep a JSON record with
location, items (max 3), and a list of facts that must stay true.
Before replying, load it. After replying, update it. Reply in under 280 characters.
If the player texts "restart", clear the record.
```

## Budget for replies

Every scene is one reply. 25 free replies is a short session; 200 on Arrow is a campaign with a few friends. Keep one scene to one text.

## Questions

### Can several people share one story?

They can't share a thread, but your endpoint can give several senders the same saved world.

### Can I use STOP as a game command?

No. STOP, HELP, START, PAUSE, YES, QUIT, END and a few others are handled before your agent sees them when sent alone. Have players use other words.

### How dark can the story get?

Every reply is filtered. Graphic violence and sexual content are blocked, and repeated blocks pause the line.

---
Source: https://www.textyouragent.dev/guides/text-adventure-by-sms · Index: https://www.textyouragent.dev/llms.txt
