liveBook · Manning

Memory

As explained in Grokking AI Applications

Application memory is persisted conversational or task-related information that a software system can retrieve across interactions.

Memory makes an application appear to remember earlier conversation or task details, even though the underlying LLM starts each call from a clean slate. section 1.3 section 1.4

A memory-enabled application typically follows this lifecycle:

  • Capture previous user inputs and model outputs. section 1.4
  • Select or retain relevant history for the next interaction. section 1.4
  • Inject that history into the next prompt before calling the LLM. section 1.4

Remembering a name

After a user says, “Hi, I’m Andrea,” an isolated later question—“What’s my name?”—produces uncertainty. Resending the earlier exchange lets the application answer “Andrea.” section 1.4

Figure 1.3 In LLM relationships, every chat is a first date.

Use the “first date” metaphor to see why every direct LLM call lacks conversational continuity. section 1.4

A minimal implementation can keep a history list, append each new turn, and reinject the rendered history before the next model call. section 3.4

How Grokking AI Applications covers it

How deep it goes
Explains statelessness, history capture, and prompt reinjection, then demonstrates a simple list-based implementation.
Examples
Demonstrates memory through Andrea’s name, disabled assistant memory, history snippets, and a Python chat loop.
What you can do after
Build it from scratch by storing conversation turns and injecting them into each subsequent model prompt.
How it connects
Connects memory with LLMs, prompts, conversation history, personalization, Langflow, and Message History components.

Also explained in

Compare how 14 books explain memory →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking AI Applications. The section links point to the parts of the book it draws on.