📦 Moved to new directory. Last updated 12.2.2026. New location: claude-config/library/03-memory-state/deep-dives/state-19-rehydration-pattern.html

Deep dive 19 of 27: The Rehydration Pattern

Nov 19, 2026 · Michael Chang · Status in NurseOps Now: ✅ built

Show definitions in ( ) · hover a highlighted word for its meaning, click it for details · open with ?defs=1 to show definitions

Part of: Remembering the right things: state management in NurseOps Now, section Implementing Long-Term Memory: External Persistence Architecture (7.3) · All 27 solutions · ← Session Caching (Redis/Key-Value) · Sanitization layer →

Read in this order

  1. In plain words: what it is, without jargon
  2. The problem it solves: the problem, and the standard approach in my words
  3. How to implement it (ServiceApps): scenario, steps, code and real output
  4. In NurseOps Now: built or not, and where
  5. Trade-offs and Interview answer

In plain words

Rehydration (loading saved state back in for a new call) is how a returning user's context is rebuilt: fetch what's saved about them, filter it down to what matters for this question, and inject it into the prompt (the instructions and text given to the AI). To the user it feels like the AI remembers; really, the app assembled a new prompt (the instructions and text given to the AI) from saved state (everything the app must remember to continue correctly).

In plain terms: before a follow-up meeting you pull the client's file, skim the open items, and walk in prepared.

The problem it solves

Summarization solves volume, not time (a summary shrinks memory but doesn't survive a crash or restart): a user who returns after a week expects the assistant to know their open tickets and preferences.

The standard approach (in my words): Fetch (query by user or session ID) → Filter (only active projects, recent summaries, relevant memories) → Inject (prepend to the system prompt (the standing instructions that set the AI's rules and role) of the new session).

How to implement it (ServiceApps)

Illustrative example: no ServiceApps (a company platform for IT tickets, HR requests and help-center articles) instance is connected, so the scenario and data are made up. The code is a self-contained sketch; it was run on that made-up data on Nov 19, 2026, and the output below is from that run.

The setting. ServiceApps (a company platform for IT tickets, HR requests and help-center articles) Assist, an AI helper inside a company's ServiceApps (a company platform for IT tickets, HR requests and help-center articles) portal. Employees ask it IT and HR questions; it answers from knowledge-base (KB (knowledge base: a library of help articles)) articles, looks up the employee's own tickets (incidents (a ServiceApps ticket for something broken) like INC0012345) and requests, and keeps one conversation per employee and ticket.

The scenario. An employee comes back a week later and asks "Is my VPN ticket fixed yet?"

Steps.

  1. Fetch: load the user's saved profile, tickets and summaries by user ID.
  2. Filter: keep only open tickets and the latest summary.
  3. Inject: add them to the prompt (the instructions and text given to the AI) as a clearly labeled block.
  4. Let tools (a function the AI can call, such as policy search) fetch anything else on demand.

The code (Python):

import json
db = {"u42": {"profile": {"contact": "email", "asset": "LT-4471"},
              "tickets": [{"number": "INC0012345", "status": "In Progress", "summary": "VPN 809 on hotel Wi-Fi"},
                          {"number": "INC0011000", "status": "Resolved", "summary": "Printer PR-3F-01 re-added"}],
              "summaries": ["2026-11-12: set up MFA", "2026-11-18: VPN 809, told to avoid guest Wi-Fi"]}}

def fetch(user): return db.get(user, {})
def filter_(state):
    return {"profile": state["profile"],
            "open_tickets": [t for t in state["tickets"] if t["status"] != "Resolved"],
            "latest": state["summaries"][-1:]}
def inject(base, ctx): return base + "\n\nWhat you know about this user:\n" + json.dumps(ctx, indent=1)

print(inject("You are ServiceApps Assist.", filter_(fetch("u42"))))

Output (from running the code above):

You are ServiceApps Assist.

What you know about this user:
{
 "profile": {
  "contact": "email",
  "asset": "LT-4471"
 },
 "open_tickets": [
  {
   "number": "INC0012345",
   "status": "In Progress",
   "summary": "VPN 809 on hotel Wi-Fi"
  }
 ],
 "latest": [
  "2026-11-18: VPN 809, told to avoid guest Wi-Fi"
 ]
}

What to watch for.

In plain terms: before answering, the assistant pulls your file, keeps the open tickets, and reads them first.

In NurseOps Now

Built: AI Assist (the app's chat helper for staff questions) fetches the thread (one saved conversation, here one per user and case) by ID from the checkpointer (the code that saves a checkpoint after each step), filters to the last 10 turns, and injects them with the rules; case facts come live (using the real Claude API (costs money), not a fake stand-in) from tools (a function the AI can call, such as policy search). See Step 1, Step 2 and Step 3.

Trade-offs

Interview answer

"Memory across sessions is rehydration (loading saved state back in for a new call): fetch the user's saved state (everything the app must remember to continue correctly) by ID, filter to what's relevant (open tickets, the latest summary), and inject it as a labeled block. Live (using the real Claude API (costs money), not a fake stand-in) facts still come from tools (a function the AI can call, such as policy search), so nothing stale overrides (the nurse decided differently from the AI's suggestion) the current status."

All data in this post is made up. No real people, tickets or patient data.

← Back to all 27 solutions in the state management blog

Key terms

Every highlighted word in this post links here. Click ↩ Back to return to the spot you came from.

AI Assist
The app's chat helper for staff questions.Used in: In NurseOps Now↩ Back to where you were
checkpointer
The code that saves a checkpoint after each step.Used in: In NurseOps Now↩ Back to where you were
incident
A ServiceApps ticket for something broken.Used in: How to implement it (ServiceApps)↩ Back to where you were
KB
Knowledge base: a library of help articles.Used in: How to implement it (ServiceApps)↩ Back to where you were
live
Using the real Claude API (costs money), not a fake stand-in.Used in: How to implement it (ServiceApps), In NurseOps Now, Trade-offs, Interview answer↩ Back to where you were
override
The nurse decided differently from the AI's suggestion.Used in: Interview answer↩ Back to where you were
prompt
The instructions and text given to the AI.Used in: In plain words, How to implement it (ServiceApps)↩ Back to where you were
rehydration
Loading saved state back in for a new call.Used in: In plain words, Interview answer↩ Back to where you were
ServiceApps
A company platform for IT tickets, HR requests and help-center articles.Used in: How to implement it (ServiceApps)↩ Back to where you were
state
Everything the app must remember to continue correctly.Used in: In plain words, Interview answer↩ Back to where you were
summarization solves volume, not time
A summary shrinks memory but doesn't survive a crash or restart.Used in: The problem it solves↩ Back to where you were
system prompt
The standing instructions that set the AI's rules and role.Used in: The problem it solves↩ Back to where you were
thread
One saved conversation, here one per user and case.Used in: In NurseOps Now↩ Back to where you were
tool
A function the AI can call, such as policy search.Used in: How to implement it (ServiceApps), In NurseOps Now, Interview answer↩ Back to where you were