The API has no memory; you do
Each messages.create() call is stateless. To continue a conversation, you re-send the entire history (every prior user and assistant turn) on every request. The model has no recollection between calls — your application is the memory layer.
Three ways to manage growing history
For short chats, send everything verbatim. For medium chats, summarize older turns into a condensed assistant note and keep recent turns verbatim. For long-running agents, store turns externally (database, JSONL) and rebuild the relevant slice on each call. cwkPippa uses option three: every turn lives in a JSONL file keyed by conversation_id, and the Agent SDK replays just enough internally to keep coherence.
Append-only is your friend
Treat conversation history as append-only. Editing past turns to 'fix' the model's response confuses Claude (the appended text now contradicts what was supposedly already said). If you need to redo a turn, start a new branch, do not rewrite history in place.