Deep dive 3 of 27: Three-Tier Memory: Episodic (Experience Log)
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 Context and State Management (Intro) · All 27 solutions · ← Three-Tier Memory: Long-Term (Vector Store) · Agentic Outcome: Token Budgets →
Read in this order
- In plain words: what it is, without jargon
- The problem it solves: the problem, and the standard approach in my words
- How to implement it (ServiceApps): scenario, steps, code and real output
- In NurseOps Now: built or not, and where
- Trade-offs and Interview answer
In plain words
Episodic memory (long-term memory of what happened: dated events, past sessions, mistakes) is the record of what happened, in order: who asked what, what the AI answered, what a person changed. It lets you replay a conversation, audit (a permanent record of who did what and when) a decision and learn from mistakes.
In plain terms: a ship's logbook: every event, with a time and who did it.
The problem it solves
No external state (nothing saved outside the model, so everything is lost when the program stops): without a log, you can't tell later why the AI said something or who changed a ticket, and the AI can't learn from past episodes.
The standard approach (in my words): keep a third tier (the AI's suggestion: likely approve, needs review or likely deny), an append-only log of events, separate from the window and the knowledge store.
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. ServiceApps (a company platform for IT tickets, HR requests and help-center articles) Assist logs every question, answer, thumbs up or down, and ticket status change, so support leads can replay any conversation.
Steps.
- Write one row per event: time, actor, action, details.
- Never edit rows; only append.
- Tag each row with the conversation (thread (one saved conversation, here one per user and case)) and ticket.
- Replay an episode by filtering on the thread (one saved conversation, here one per user and case) and sorting by time.
The code (Python):
log = []
def record(actor, action, **details):
log.append({"at": f"2026-11-19T10:{len(log):02d}:00Z", "actor": actor, "action": action, **details})
record("u42", "asked", question="VPN error 809", thread="u42:INC0012345")
record("assist", "answered", sources=["KB0010234"], thread="u42:INC0012345")
record("u42", "feedback", rating="thumbs_down", thread="u42:INC0012345")
record("agent7", "status_change", ticket="INC0012345", old="New", new="In Progress")
def episode(thread): # replay one conversation in order
return [e for e in log if e.get("thread") == thread]
for e in episode("u42:INC0012345"):
print(e["at"], e["actor"], e["action"], {k: v for k, v in e.items() if k not in ("at", "actor", "action", "thread")})
print("all events:", len(log))
Output (from running the code above):
2026-11-19T10:00:00Z u42 asked {'question': 'VPN error 809'}
2026-11-19T10:01:00Z assist answered {'sources': ['KB0010234']}
2026-11-19T10:02:00Z u42 feedback {'rating': 'thumbs_down'}
all events: 4
What to watch for.
- Mask personal data before it's logged (see Sanitization layer (code that masks personal details and secrets before anything is saved)).
- Logs grow forever; set retention (see TTL expiration (deleting saved data automatically after a set time)).
- Turn bad episodes (thumbs down (a user marking an AI answer as bad)) into test questions, so the log improves the system.
In plain terms: the assistant's diary: nothing is rewritten, so you can always see what really happened.
In NurseOps Now
Built. The audit_log table records every status change, AI Assist (the app's chat helper for staff questions) question and clear; llm_calls records each AI call's tokens (pieces of words the AI reads and writes; cost is per token) and cost; and LangSmith (a service that records each AI request step by step (tracing)) traces (step-by-step records of each request: what ran, how long, what it cost) each run with a masked thread (one saved conversation, here one per user and case) ID. See Step 7 and Step 9.
Trade-offs
- Detailed logs help audits (a permanent record of who did what and when) and debugging but are a privacy risk if not masked.
- Append-only is trustworthy but needs a retention policy (the health plan's written rules for when a test is covered).
Interview answer
"I keep an episodic log separate from chat memory: one append-only row per event with time, actor and action. It answers 'why did the AI say that' and 'who changed this', and bad episodes become new test cases."
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
- audit
- A permanent record of who did what and when.Used in: In plain words, Trade-offs↩ Back to where you were
- episodic memory
- Long-term memory of what happened: dated events, past sessions, mistakes.Used in: In plain words↩ 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
- LangSmith
- A service that records each AI request step by step (tracing).Used in: In NurseOps Now↩ Back to where you were
- no external state
- Nothing saved outside the model, so everything is lost when the program stops.Used in: The problem it solves↩ Back to where you were
- policy
- The health plan's written rules for when a test is covered.Used in: Trade-offs↩ Back to where you were
- sanitization layer
- Code that masks personal details and secrets before anything is saved.Used in: How to implement it (ServiceApps)↩ 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
- thread
- One saved conversation, here one per user and case.Used in: How to implement it (ServiceApps), In NurseOps Now↩ Back to where you were
- thumbs down
- A user marking an AI answer as bad.Used in: How to implement it (ServiceApps)↩ Back to where you were
- tier
- The AI's suggestion: likely approve, needs review or likely deny.Used in: The problem it solves↩ Back to where you were
- tokens
- Pieces of words the AI reads and writes; cost is per token.Used in: In NurseOps Now↩ Back to where you were
- traces
- Step-by-step records of each request: what ran, how long, what it cost.Used in: In NurseOps Now↩ Back to where you were
- TTL expiration
- Deleting saved data automatically after a set time.Used in: How to implement it (ServiceApps)↩ Back to where you were