📦 Moved to new directory. Last updated 12.2.2026. New location: claude-config/library/03-memory-state/nurseops-now-state-bk7.html

Remembering the right things: state management in NurseOps Now

Tags: Intro the problem Short-term memory (7.1) Compression (7.2) Long-term memory (7.3) Drift and hallucinations (7.4)
the problem → fit the window → keep facts exact → save it → keep it on task and truthful

Nov 19, 2026 (updated Nov 20) · Michael Chang · Live (using the real Claude API (costs money), not a fake stand-in) demo: nurseops-now.fly.dev · Status: built; 6 gaps named, plan below

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

Reference: AI Bible Ch. 7

Read in this order

  1. Interview talk: the chapter in five paragraphs to say out loud, with links
  2. Why this post: where the ideas come from, and how this differs from the RAG (retrieval-augmented generation: the AI looks things up before it answers) and eval posts
  3. Words used in this post: the terms
  4. How a chat turn flows, and where state lives: the 4 Agentic Outcomes (problem → goal → what we built), then every solution, the standard ones first (bold), then my own, on one page
  5. Context and State Management (Intro): the problem, and the plan in one page
  6. Implementing Short-Term Memory: Token Budgets and Window Management (7.1)
  7. Compression Strategies: Summarization and Entity Extraction (7.2)
  8. Implementing Long-Term Memory: External Persistence Architecture (7.3)
  9. Preventing Drift and Hallucinations in Long-Running Agents (7.4)
  10. Common advice vs. NurseOps Now, Checklist, Findings, Plan, Tools and What this proves

Interview talk

What it does. The whole chapter in five short paragraphs I can say out loud, each linked to the part of the post that proves it.

The framing. The first thing to know is that LLMs are stateless: the model doesn't remember anything between calls, so every call has to carry everything it needs, again. That means memory isn't something a framework gives you for free; it's a design decision (Intro). I think about it as four questions: what goes into the context window (everything sent to the AI in one call; it has a size limit) on each call, what gets saved, for whom, and for how long. In a prior-auth app, one rule drives all four: case facts (the status, the decision, the AI review) are exact records in the database, and the AI looks them up fresh every time. They're never something the AI "remembers" from the chat, because a memory can drift (quality slowly getting worse over time) and a database row can't.

Short-term memory. Each nurse (the reviewer who checks requests; can approve or pend, not deny) gets their own conversation thread (one saved conversation, here one per user and case), one per user and case, saved by a LangGraph (a tool for building AI workflows step by step) checkpointer (the code that saves a checkpoint after each step) so it survives a restart (7.1). That matters because two nurses (the reviewer who checks requests; can approve or pend, not deny) must never see each other's history. On every call I rebuild the window: the rules go first, every single time, so a long chat can't push them out, and then only the last 10 turns. Older turns stay on disk but aren't sent. Instead of stuffing case data into the prompt (the instructions and text given to the AI), I load facts only when needed through tools (a function the AI can call, such as policy search), and cap what each tool (a function the AI can call, such as policy search) returns. The benefit is a small, cheap, focused window. The trade-off is that I cap by number of turns, not by counted tokens (pieces of words the AI reads and writes; cost is per token), so a few very long turns could still make the window big. Token (the unit the AI reads and is billed by, about three quarters of a word) counting is the next fix.

Compression and long-term memory. The book's answer to a full window is to summarize old conversation. I chose to keep hard state in SQL instead, because summaries lose detail and can drift (quality slowly getting worse over time), and in healthcare the facts must not (7.2). Older turns are kept on disk but not summarized yet. For long-term memory (7.3) I do four things. I mask personal details before anything is saved (date of birth, phone, SSN (Social Security number)), because saved memory is a privacy liability. I run each case through a state machine where only a person can approve, so no conversation can change an outcome. I cache repeated reviews, so the same request isn't paid for twice. And users can clear their memory when they ask. Policies (the health plan's written rules for when tests are covered) and the user guide are searched with RAG (retrieval-augmented generation: the AI looks things up before it answers), so the whole design is a hybrid memory system: a short-term buffer of recent turns plus long-term retrieval (finding the right section of the right policy) from a vector store (a database that finds text by meaning, using embeddings).

Drift (quality slowly getting worse over time). In a long conversation the model can slowly lose its instructions; that's context drift (quality slowly getting worse over time) (7.4). My defense has three parts. The rules are re-sent on every call. I gate input and output in code, catching attack phrases, prompt (the instructions and text given to the AI) leaks and secrets. And I ground every answer with a quote check in code that retries once if a quote isn't found in the source. The demo showed 3 threads (one saved conversation, here one per user and case) kept apart across a restart, a window that stayed small after 12 turns, and personal details masked before saving. Still open: token (the unit the AI reads and is billed by, about three quarters of a word) counting, summaries of old turns, automatic expiry, prompt caching (the AI provider reusing an unchanged prompt start, so calls are cheaper and faster) for chat, and a 50-turn drift (quality slowly getting worse over time) test (plan).

30-second version: "I treat memory as a design decision. Rules go out on every call so they can't be pushed out; recent turns are capped; facts live (using the real Claude API (costs money), not a fake stand-in) as exact database records and are looked up fresh, so they can't drift (quality slowly getting worse over time) through summaries. Each nurse (the reviewer who checks requests; can approve or pend, not deny)'s conversation is a separate, masked, durable thread (one saved conversation, here one per user and case), and no conversation can change a case's outcome, because the state machine (a fixed list of allowed status changes) only lets a person approve. Next: token (the unit the AI reads and is billed by, about three quarters of a word) budgets, summaries and a drift (quality slowly getting worse over time) test."

Why this post

What this covers. Context and state (everything the app must remember to continue correctly) management in four parts: managing the window (7.1), compressing history (7.2), saving state (everything the app must remember to continue correctly) outside the model (7.3), and keeping a long-running agent (an AI that chooses which tools to use to answer) on task and truthful (7.4), after an intro on the core problem. For each part I state (everything the app must remember to continue correctly) the problem and how NurseOps Now solves it, with the real code and output, what isn't built yet, and where I'd push back on common advice. Every problem and solution is also tagged with the memory type it deals with: working, episodic, semantic or procedural (the four memory types).

How this differs from the other posts. The ingestion deep dive is about finding the right policy (the health plan's written rules for when a test is covered) text (RAG (retrieval-augmented generation: the AI looks things up before it answers)). The eval plan is about proving answers are good. This post is about memory: what the AI is given on each call, what is saved, for whom, for how long, and what must never be summarized or leaked. Each step has the two usual halves: the strategy (what we built) and the proof (how it's checked).

In plain terms: a checklist for an AI's memory, held up against a real app, item by item.

Words used in this post

TermPlain meaningEveryday example
State (everything the app must remember to continue correctly)Everything the app must remember to continue correctlyWhere you left off in a book
Context window (everything sent to the AI in one call; it has a size limit)Everything sent to the AI in one call; it has a size limitThe desk space you can work on at once
Token (the unit the AI reads and is billed by, about three quarters of a word)The unit the AI reads and is billed by; roughly ¾ of a wordPaying per word
Thread (one saved conversation, here one per user and case)One saved conversation, here one per user and caseOne email thread (one saved conversation, here one per user and case)
Checkpoint (a saved copy of a conversation's state after each step)A saved copy of a conversation's state (everything the app must remember to continue correctly) after each stepA game's save point
Hot state (what is in the current AI call)What's in the current callWhat's on your desk now
Cold state (what is saved in a database for later)What's saved in a database for laterThe filing cabinet
Rehydration (loading saved state back in for a new call)Loading saved state (everything the app must remember to continue correctly) back in for a new callOpening the file before a meeting
State machine (a fixed list of allowed status changes)A fixed list of allowed status changesA form that can only move from "draft" to "submitted"
Drift (quality slowly getting worse over time)An AI slowly forgetting its rules over a long conversationA new employee slowly ignoring the handbook
Hallucination (the AI stating something that isn't in the sources)The AI stating something made-up as factGuessing instead of checking
Prompt caching (the AI provider reusing an unchanged prompt start, so calls are cheaper and faster)The AI provider (the doctor or clinic asking for the test) reusing an unchanged prompt (the instructions and text given to the AI) start, so it's cheaper and fasterNot re-reading the same intro every time
Working / short-term memory (what the AI holds for the current call: the context window)What the AI holds for the current call: the context window (everything sent to the AI in one call; it has a size limit)A notepad
Episodic memory (long-term memory of what happened: dated events, past sessions, mistakes)Long-term memory of what happenedA shift log
Semantic memory (long-term memory of what is true: facts, policies, records)Long-term memory of what is true: facts, policies (the health plan's written rules for when tests are covered), recordsA policy (the health plan's written rules for when a test is covered) binder
Procedural memory (long-term memory of how to do things: rules, workflows, tools)Long-term memory of how to do things: rules, workflows (a fixed series of steps the app runs), tools (a function the AI can call, such as policy search)The checklist taped to the wall

How a chat turn flows, and where state lives

One AI Assist (the app's chat helper for staff questions) question goes through assist.ask() → a LangGraph (a tool for building AI workflows step by step) graph gate → agent → check → finish, saved by a checkpointer (the code that saves a checkpoint after each step) after each step. The case itself moves through state.transition(). Each group below covers one part, starting with the Intro (the title links to its section). Each group shows the problems, then the solutions, built or not. Problem names are in red (dark red = a main problem, lighter = a part of it) and the standard solution names in green (dark green = a main solution, lighter = a part of it, lightest = a part of that part); my own extras follow, marked (ours). "What happens" is the strategy; "How we check it" is the proof; Details links to the step that explains it, or to the plan if it isn't built.

This post uses four memory types: working, episodic, semantic and procedural. They're defined in the Intro, and each problem and solution from there on is tagged with one, like [Working].

The 4 Agentic Outcomes: what I set out to achieve. Each one reads as the problems I hit → the goal (yellow) → what I built. The blue parts are the talking points. Click a problem or solution to jump to its row, and hover for a one-line meaning.

1. Problems I hit: The token window is a hard limit, Cost and latency, History can't keep growing → Engineer token (the unit the AI reads and is billed by, about three quarters of a word) budgets using progressive summarization and compression techniques to maximize the context window (everything sent to the AI in one call; it has a size limit). 🟡 What I built: I cap each call at the rules plus the last 10 turns and fetch facts with tools (a function the AI can call, such as policy search); token (the unit the AI reads and is billed by, about three quarters of a word) counting and summaries are next. (7.1 Short-term memory, 7.2 Compression)

Solutions behind it (click a name to jump to its row below, which links to the deep dive; hover for a one-line meaning):

2. Problems I hit: LLMs are stateless, Flooding the context window → Architect hybrid memory systems that couple short-term conversational buffers with long-term Vector (text turned into a list of numbers so similar meanings sit close together) DB retrieval (finding the right section of the right policy) (RAG (retrieval-augmented generation: the AI looks things up before it answers)). ✅ What I built: I send the last 10 turns, search policies (the health plan's written rules for when tests are covered) and the user guide with RAG (retrieval-augmented generation: the AI looks things up before it answers) on Chroma (the database that stores the policy vectors), and keep case facts in SQL. (7.1 Short-term memory, 7.3 Long-term memory)

Solutions behind it (click a name to jump to its row below, which links to the deep dive; hover for a one-line meaning):

3. Problems I hit: No external state, Summarization solves volume, not time, Persistence creates liability → Implement strict state (everything the app must remember to continue correctly) serialization to allow agents (an AI that chooses which tools to use to answer) to pause, crash, and resume without data loss. 🟡 What I built: I checkpoint (a saved copy of a conversation's state after each step) every chat step to SQLite, so a restart picks up where it left off, and mask personal details before saving; a case review still reruns from the start after a crash. (7.3 Long-term memory)

Solutions behind it (click a name to jump to its row below, which links to the deep dive; hover for a one-line meaning):

4. Problems I hit: Loss of instructional integrity, Context Drift (The Alignment Failure) → Immunize against context drift (quality slowly getting worse over time) by systematically pruning irrelevant dialogue and re-injecting core instructions. 🟡 What I built: I re-send the rules on every call, keep only recent turns in the window, and gate (an automatic check that blocks a change when scores drop) input and output in code; an end-of-prompt reminder and a 50-turn drift (quality slowly getting worse over time) test are next. (7.4 Drift and hallucinations)

Solutions behind it (click a name to jump to its row below, which links to the deep dive; hover for a one-line meaning):

In plain terms: four promises for an AI's memory: stay on budget, remember both the chat and the facts, never lose your place, and never forget the rules.

Context and State Management (Intro)

Problems:

#ProblemWhat goes wrongHow NurseOps Now handles itSolved by
1LLMs are stateless (language models remember nothing between calls) ↑ Back to outcome 2The model remembers nothing between calls; everything must be sent again every timeEvery call is built fresh from saved state (everything the app must remember to continue correctly): the rules, the thread (one saved conversation, here one per user and case)'s last turns, and facts from tools (a function the AI can call, such as policy search)Three-tier memory, Hybrid memory systems (Step 1, Step 2)
2The context window: finite, expensive, volatile (the window is limited, paid per token, and gone after each call)The window has a size limit, every token (the unit the AI reads and is billed by, about three quarters of a word) costs money, and it's gone after the callSmall window per call; tokens (pieces of words the AI reads and writes; cost is per token) and cost recorded for every call; nothing important lives (using the real Claude API (costs money), not a fake stand-in) only in the windowToken (the unit the AI reads and is billed by, about three quarters of a word) budgets (Step 2, Step 8)
3Flooding the context window (sending so much that the AI loses its instructions) ↑ Back to outcome 2Too much raw data, and the AI forgets its original instructionsRules in the separate system field; facts fetched on demand and cappedToken (the unit the AI reads and is billed by, about three quarters of a word) budgets; see the 7.1 table below (Step 2, Step 3)
4No external state (nothing saved outside the model, so everything is lost when the program stops) ↑ Back to outcome 3When the script ends, the AI has forgotten everythingChat checkpointed to disk per thread (one saved conversation, here one per user and case); case facts in SQLStrict state (everything the app must remember to continue correctly) serialization; see the 7.3 table below (Step 1, Step 4)

Solutions (the standard ones first, then mine):

SolutionWhat happens in NurseOps NowHow we check itBuilt?DetailsDeep dive
Three-Tier Memory: Short-Term (Context Window) (what the AI sees in the current call)The window rebuilt on every call: rules, last 10 turns, a one-line case noteDemo: 12 turns stored, 10 sent✅Step 2Deep dive
Three-Tier Memory: Long-Term (Vector Store) (knowledge saved outside the model and searched when needed)Chroma (the database that stores the policy vectors) for policy (the health plan's written rules for when a test is covered) text and the user guide; plus SQL for case facts and checkpoints (saved copies of a conversation's state) for chatUnit tests (small automatic checks of one piece of code each) (RAG (retrieval-augmented generation: the AI looks things up before it answers), memory)✅Step 1, Step 4, Ingestion deep diveDeep dive
Three-Tier Memory: Episodic (Experience Log) (a record of what happened, step by step)audit_log table (every status change, AI Assist (the app's chat helper for staff questions) question and clear) 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)Unit test (a small automatic check of one piece of code) (audit row (one line in the log of who did what, when))✅Step 7, Step 9Deep dive
Agentic Outcome: Token Budgets (keeping each call within a planned size)A 10-turn history cap (a limit on how many past turns are sent to the AI); no token (the unit the AI reads and is billed by, about three quarters of a word) count or summaries yetDemo🟡Step 2, Plan 1, Plan 2Deep dive
Agentic Outcome: Hybrid Memory Systems (recent chat in the window plus long-term search)Short-term buffer (last 10 turns) plus long-term retrieval (finding the right section of the right policy) (RAG (retrieval-augmented generation: the AI looks things up before it answers) tools (a function the AI can call, such as policy search) over policies (the health plan's written rules for when tests are covered) and the guide)Unit tests (small automatic checks of one piece of code each) (tool (a function the AI can call, such as policy search) loop, RAG (retrieval-augmented generation: the AI looks things up before it answers))✅Step 2, Step 3Deep dive
Agentic Outcome: Strict State Serialization (saving state so work can pause, crash and resume without loss)Chat threads (one saved conversation, here one per user and case) checkpointed after every step and reloaded after a restart; a case review isn't checkpointed mid-run, so a crash reruns itUnit test (a small automatic check of one piece of code) (memory per user, restart, clear)🟡 Chat yes, review rerunsStep 1, FindingsDeep dive
The one rule: case facts never in the chat (ours)Status, decisions and the AI review are SQL records; the AI looks them up fresh every timeUnit tests (small automatic checks of one piece of code each) (state machine (a fixed list of allowed status changes))✅Step 4—

Implementing Short-Term Memory: Token Budgets and Window Management (7.1)

Problems:

#ProblemWhat goes wrongHow NurseOps Now handles itSolved by
1The token window is a hard limit (everything sent to the AI shares one fixed size budget) ↑ Back to outcome 1The rules, the question and the whole history all share one fixed budgetThe window is rebuilt on every call with only what's needed: the rules, the last 10 turns and a one-line case note; facts come from tools (a function the AI can call, such as policy search)Dynamic Context Loading (giving the AI tools to fetch data only when it needs it, instead of putting everything in the prompt), History cap (a limit on how many past turns are sent to the AI) (Step 2, Step 3)
2Sliding window truncation (silently dropping the oldest messages when the window is full)When the window fills, chat frameworks silently drop the oldest messagesNurseOps Now never sends more than the last 10 turns, so nothing is dropped behind its back; older turns stay saved on diskHistory cap (a limit on how many past turns are sent to the AI) (Step 2, Step 5)
3Loss of instructional integrity (the AI losing its rules because they were pushed out of the window) ↑ Back to outcome 4The rules get pushed out (for example by a long pasted document), and the AI forgets its roleThe rules are in the API's separate system field on every call; a question is cut at 2,000 characters and each tool (a function the AI can call, such as policy search) result at 12,000System Prompt Pinning (keeping the rules in a protected place that is sent on every call and never trimmed), Dynamic Context Loading (giving the AI tools to fetch data only when it needs it, instead of putting everything in the prompt) (Step 2, Step 3)
4Worse answers near capacity (a very full window makes the AI miss details in the middle)In a very full window, details in the middle get missed and the end gets too much weightThe window stays small, so it's never near capacity; there's no token (the unit the AI reads and is billed by, about three quarters of a word) check to prove it yetHistory cap (a limit on how many past turns are sent to the AI); Token Counting Middleware (code that counts tokens before every AI call and acts when the window gets too full) ⬜ (Plan 1)
5Cost and latency (how much each call costs and how long it takes) ↑ Back to outcome 1A full window is slower and costs more, because every token (the unit the AI reads and is billed by, about three quarters of a word) is paid forSmall window; identical reviews reused; review calls prompt-cached; tokens (pieces of words the AI reads and writes; cost is per token) and cost recorded for every callHistory cap (a limit on how many past turns are sent to the AI), Reuse instead of recompute (Step 8, Plan 4)

Solutions (the standard ones first, then mine):

SolutionWhat happens in NurseOps NowHow we check itBuilt?DetailsDeep dive
Token Counting Middleware (code that counts tokens before every AI call and acts when the window gets too full) ↑ Back to outcome 1Count tokens (pieces of words the AI reads and writes; cost is per token) before each call and act when the window gets too full—⬜ Not builtPlan 1Deep dive
Dynamic Context Loading (giving the AI tools to fetch data only when it needs it, instead of putting everything in the prompt) ↑ Back to outcome 2Case, policy (the health plan's written rules for when a test is covered), guide and metrics come from tools (a function the AI can call, such as policy search) only when the AI asks; each result capped at 12,000 characters; at most 4 tool (a function the AI can call, such as policy search) roundsUnit test (a small automatic check of one piece of code) (tool (a function the AI can call, such as policy search) loop)✅Step 3Deep dive
System Prompt Pinning (keeping the rules in a protected place that is sent on every call and never trimmed) ↑ Back to outcome 4The rules go in the API's separate system field on every call, never in the history, so they can't be trimmedDemo✅Step 2Deep dive
One thread per user and case (each nurse's conversation about each case is saved separately) (ours)Each user + case has its own saved thread (one saved conversation, here one per user and case) (nurse1:case-3), loaded from diskUnit test (a small automatic check of one piece of code) (memory per user, restart, clear)✅Step 1—
History cap (a limit on how many past turns are sent to the AI) (ours)Only the last 10 turns are sent, plus a one-line note about the open caseDemo: 12 turns stored, 10 sent✅Step 2—

Compression Strategies: Summarization and Entity Extraction (7.2)

Problems:

#ProblemWhat goes wrongHow NurseOps Now handles itSolved by
1History can't keep growing ↑ Back to outcome 1You can't keep appending history: the window fills and every call gets more expensiveExact facts never go into the chat; only the last 10 turns are sent; older turns stay on diskEntity Extraction (pulling key facts (names, dates, IDs) out of text into a structured record) (a different way), History cap (a limit on how many past turns are sent to the AI) (Step 4, Step 5)
2Hallucination drift (details slowly changing as summaries are summarized again)Summaries are lossy: a summary of a summary drifts (quality slowly getting worse over time) further each time, and exact details get corruptedNothing is summarized; IDs, dates, decisions and errors are stored word for wordThe Engineering Trade-off: Fidelity vs. Capacity (the trade-off between keeping every detail and fitting more in the window) (Step 4)

Solutions (the standard ones first, then mine):

SolutionWhat happens in NurseOps NowHow we check itBuilt?DetailsDeep dive
Textual Summarization (rewriting old conversation into short, dense notes) ↑ Back to outcome 1Rewrite old chat into dense notes—⬜ Not builtStep 5, Plan 2Deep dive
Rolling Summaries (a short running summary that replaces old conversation turns) ↑ Back to outcome 1Every few turns, condense the oldest turns into a short summary—⬜ Not builtStep 5, Plan 2Deep dive
Entity Extraction (pulling key facts (names, dates, IDs) out of text into a structured record) ↑ Back to outcome 1Key facts in a structured record. Here: case fields, the AI review JSON (a simple text format for structured data) and decisions are SQL records, fetched by a tool (a function the AI can call, such as policy search) (not a JSON (a simple text format for structured data) profile in the prompt (the instructions and text given to the AI))State machine (a fixed list of allowed status changes) tests✅ (a different way)Step 4Deep dive
Vector Compression via RAG (storing text as vectors and pulling back only the parts that match) ↑ Back to outcome 2Embed past text and pull back only the relevant parts. Here: used for policy (the health plan's written rules for when a test is covered) text and the user guide, not for chat historyUnit tests (small automatic checks of one piece of code each) (RAG (retrieval-augmented generation: the AI looks things up before it answers))🟡 Documents onlyIngestion deep diveDeep dive
The Engineering Trade-off: Fidelity vs. Capacity (the trade-off between keeping every detail and fitting more in the window) ↑ Back to outcome 1Summaries are lossy and drift (quality slowly getting worse over time), so exact facts ("hard state (everything the app must remember to continue correctly)": IDs, numbers, decisions, code, error logs) are kept word for word and only conversation ("soft state (everything the app must remember to continue correctly)") may be compressed. Here: exact facts are never in the chat at all, and nothing is summarized: reviews, decisions, audit rows (one line in the log of who did what, when) and tool (a function the AI can call, such as policy search) errors are stored as-is—✅Step 4Deep dive
Old turns kept, not sent (ours)Turns beyond the last 10 stay on disk but leave the windowDemo: oldest sent is question 3✅Step 5—

Implementing Long-Term Memory: External Persistence Architecture (7.3)

Problems:

#ProblemWhat goes wrongHow NurseOps Now handles itSolved by
1Summarization solves volume, not time (a summary shrinks memory but doesn't survive a crash or restart) ↑ Back to outcome 3A crash or a closed tab loses the window, however well it was summarizedEach chat thread (one saved conversation, here one per user and case) is checkpointed to disk after every step; case state (everything the app must remember to continue correctly) is in SQLSession Caching (saving a conversation's state so it can pause and resume), Structured Storage (a database with fixed tables for exact facts, like SQL), The Rehydration Pattern (fetch saved state, keep only what's relevant, and put it back into the next call) (Step 1, Step 7)
2Persistence creates liability (saved data can leak personal details or secrets) ↑ Back to outcome 3Saved memory, logs and vector stores (a database that finds text by meaning, using embeddings) can leak personal data or secrets, and keep them foreverPersonal details masked before saving; one thread (one saved conversation, here one per user and case) can be deleted on request; no automatic expiry yetSanitization layer (code that masks personal details and secrets before anything is saved), GDPR Right to Be Forgotten (a person's right to have their stored data deleted (from the EU's GDPR law)), TTL expiration (deleting saved data automatically after a set time) ⬜ (Step 6, Step 9, Plan 3)

Solutions (the standard ones first, then mine):

SolutionWhat happens in NurseOps NowHow we check itBuilt?DetailsDeep dive
The Hot/Cold State Architecture (splitting memory into what is in the current call (hot) and what is saved for later (cold)) ↑ Back to outcome 2Hot = what's in the current call; cold = SQL, checkpoints (saved copies of a conversation's state) and Chroma (the database that stores the policy vectors)—✅Step 1, IntroDeep dive
Structured Storage (SQL/Postgres) (a database with fixed tables for exact facts) ↑ Back to outcome 3SQLite tables cases, ai_reviews, decisions, audit_logUnit tests (small automatic checks of one piece of code each) (state machine (a fixed list of allowed status changes))✅Step 4Deep dive
Semantic Storage (Vector DB like Pinecone, Weaviate, or Chroma) (a vector database that finds text by meaning) ↑ Back to outcome 2Chroma (the database that stores the policy vectors) holds the policy (the health plan's written rules for when a test is covered) text and the user guideUnit tests (small automatic checks of one piece of code each) (RAG (retrieval-augmented generation: the AI looks things up before it answers))✅Ingestion deep diveDeep dive
Session Caching (Redis/Key-Value) (saving a conversation's state so it can pause and resume) ↑ Back to outcome 3LangGraph (a tool for building AI workflows step by step) SqliteSaver checkpoints (saved copies of a conversation's state) each thread (one saved conversation, here one per user and case) after every step (SQLite instead of Redis)Unit test (a small automatic check of one piece of code) (memory per user, restart, clear)✅ (SQLite, not Redis)Step 1Deep dive
The Rehydration Pattern (fetch saved state, keep only what's relevant, and put it back into the next call) ↑ Back to outcome 3Fetch the thread (one saved conversation, here one per user and case) by ID, filter to the last 10 turns, inject them with the rules; facts come from tools (a function the AI can call, such as policy search)Demo✅Step 1, Step 2, Step 3Deep dive
Sanitization layer (code that masks personal details and secrets before anything is saved) ↑ Back to outcome 3Personal details masked before saving to memory, logs and traces (step-by-step records of each request: what ran, how long, what it cost)Demo: DOB, phone, SSN (Social Security number) masked✅Step 6Deep dive
TTL (time-to-live) expiration (deleting saved data automatically after a set time) ↑ Back to outcome 3 (same paragraph)Delete saved data automatically after a set time—⬜ Not builtStep 9, Plan 3Deep dive
GDPR Right to Be Forgotten (a person's right to have their stored data deleted (from the EU's GDPR law)) ↑ Back to outcome 3 (same paragraph)"Clear" deletes one thread (one saved conversation, here one per user and case) and writes an audit row (one line in the log of who did what, when)Demo + test🟡 On request onlyStep 9Deep dive
Case state machine (a fixed list of allowed status changes) (ours)Status changes only along allowed paths; only a person can approve, deny or pend (pause a case for more information or a medical director); every change auditedUnit tests (small automatic checks of one piece of code each) (state machine (a fixed list of allowed status changes))✅Step 7—
Reuse instead of recompute (ours)Identical reviews reused from a result cache (saved AI answers reused when the exact same input comes again); review calls use prompt caching (the AI provider reusing an unchanged prompt start, so calls are cheaper and faster)Code🟡 Not for AI Assist (the app's chat helper for staff questions)Step 8, Plan 4—

Preventing Drift and Hallucinations in Long-Running Agents (7.4)

Problems:

#ProblemWhat goes wrongHow NurseOps Now handles itSolved by
1Context Drift (The Alignment Failure) (the AI slowly forgetting its rules over a long conversation) ↑ Back to outcome 4Over many turns the rules fade and the AI bends to the user (a strict reviewer slowly turns agreeable). Cause: the early rules get less attention as the conversation growsThe rules are sent on every call; bad questions are blocked in code; and no conversation can produce an approval, because the state machine (a fixed list of allowed status changes) only lets a person approveEngineering Fix: Recursive Goal Injection (repeating a short reminder of the rules before every AI answer) 🟡, System Prompt Pinning (keeping the rules in a protected place that is sent on every call and never trimmed), Input Filtering (checking a question before the AI sees it, and blocking bad ones), Case state machine (a fixed list of allowed status changes) (Step 2, Step 7, Step 10, Plan 5)
2Hallucination (The Grounding Failure) (the AI stating made-up facts when the answer isn't in front of it)The AI fills a gap with something plausible and made-up. Cause: a high temperature, or the answer simply isn't in the contextAnswers come only from tools (a function the AI can call, such as policy search); no source → a "please check" note; every review quote must match the PDF (a fixed-layout document file), with one retry; the output must match a schema (a fixed form the AI's answer must fit)Engineering Fix: Strict RAG and Citation Enforcement (answering only from retrieved sources, and flagging any answer without one), Process Control: Self-Correction Loop (checking the AI's answer and sending it back once to fix what failed), Output Guardrails: Schema Enforcement (requiring the AI's answer to match a fixed shape, checked in code) (Step 11)

Solutions (the standard ones first, then mine):

SolutionWhat happens in NurseOps NowHow we check itBuilt?DetailsDeep dive
Engineering Fix: Recursive Goal Injection (repeating a short reminder of the rules before every AI answer) ↑ Back to outcome 4A short reminder of the rules before every answer. Here: the full rules are sent on every call, but there's no extra reminder at the end—🟡Step 2, Plan 5Deep dive
Engineering Fix: Strict RAG and Citation Enforcement (answering only from retrieved sources, and flagging any answer without one) ↑ Back to outcome 4Answer only from tool (a function the AI can call, such as policy search) results; no source → a "please check" note; review quotes must match the PDF (a fixed-layout document file)Unit test (a small automatic check of one piece of code) (quote check + retry)✅Step 11Deep dive
Input Filtering: Relevance Pruning (checking and trimming a question before the AI sees it) ↑ Back to outcome 4Injection (hidden text that tries to give the AI new orders) and off-topic (not about prior authorization) questions blocked in code before the AI sees them (rules, not a second model)Unit tests (small automatic checks of one piece of code each) + red team (people or scripts that try to trick the AI on purpose) (44 attacks, 0 through)✅Step 10Deep dive
Process Control: Self-Correction Loop (checking the AI's answer and sending it back once to fix what failed) ↑ Back to outcome 4Reviews go ai_review → verify; a failed quote check sends the AI back once with the failuresUnit test (a small automatic check of one piece of code) (quote check + retry)✅ ReviewsStep 11Deep dive
Output Guardrails: Schema Enforcement (requiring the AI's answer to match a fixed shape, checked in code) ↑ Back to outcome 4Every review must match the ReviewResult Pydantic (a library that checks data fits a fixed form) schema (a fixed form the AI's answer must fit) (shape, not truth)Review tests✅Step 11Deep dive
Output gate (a check that blocks answers leaking the rules or a secret) (ours)Answers that quote the system prompt (the standing instructions that set the AI's rules and role) or contain a secret are blockedDemo: prompt (the instructions and text given to the AI) leak blocked✅Step 10—
Long-conversation drift (quality slowly getting worse over time) test (ours)A 50-turn scripted chat that keeps pushing for an approval—⬜ Not builtPlan 5—

The review of a case uses Steps 3, 4, 7, 8 and 11. A chat question uses Steps 1–3, 5, 6 and 9–11.

About the examples below: nurses (the reviewer who checks requests; can approve or pend, not deny) ask AI Assist (the app's chat helper for staff questions) questions in a fresh, separate copy of the app (temporary database and memory file) on Nov 19, 2026. AI mode is mock (a fake stand-in used in tests so no real AI call is made) (rules answer instead of Claude (Anthropic's AI model that this app uses)), so there is no API cost and no real data. The memory, masking, window and state (everything the app must remember to continue correctly) code is the same code that runs with Claude (Anthropic's AI model that this app uses).

Context and State Management (Intro)

The problem. A language model is stateless (keeping no memory between calls): it remembers nothing between calls. Whatever the AI should know (the rules, the conversation so far, the case facts) has to be sent again on every call, inside the context window (everything sent to the AI in one call; it has a size limit). That window is limited in size, paid for by the token (the unit the AI reads and is billed by, about three quarters of a word), and gone as soon as the call ends. An app can fail in two opposite ways:

The four memory types (working memory plus three long-term kinds: episodic, semantic, procedural). AI memory is grouped the way human memory is: one short-term type and three long-term ones.

TypeWhat it holdsWhere it livesIn NurseOps Now
Working / Short-termThe live (using the real Claude API (costs money), not a fake stand-in) task: rules, recent turns, tool (a function the AI can call, such as policy search) results for this callThe context window (everything sent to the AI in one call; it has a size limit)Rules + last 10 turns + one-line case note, rebuilt every call
Episodic (long-term)What happened: dated events, past sessions, mistakesEvent logs, chat historyaudit_log, 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), LangGraph (a tool for building AI workflows step by step) checkpoints (saved copies of a conversation's state) per thread (one saved conversation, here one per user and case)
Semantic (long-term)What is true: facts, policies (the health plan's written rules for when tests are covered), recordsVector (text turned into a list of numbers so similar meanings sit close together) DB, SQL tablesChroma (the database that stores the policy vectors) (policy (the health plan's written rules for when a test is covered) text, user guide), SQL case facts
Procedural (long-term)How to do things: rules, workflows (a fixed series of steps the app runs), stepsCode, system prompts (the standing instructions that set the AI's rules and role), tool (a function the AI can call, such as policy search) definitions, state machines (a fixed list of allowed status changes)System prompt (the standing instructions that set the AI's rules and role), tool (a function the AI can call, such as policy search) definitions, case state machine (a fixed list of allowed status changes)

Memory is often described as three tiers (the AI's suggestion: likely approve, needs review or likely deny) (short-term, long-term, episodic). I split long-term into the three types it actually holds. Each problem and solution below is tagged with the type it deals with, for example [Working]; an item that moves memory from one type into another gets both tags.

In plain terms: a nurse (the reviewer who checks requests; can approve or pend, not deny)'s notepad (working), shift log (episodic), policy (the health plan's written rules for when a test is covered) binder (semantic) and the checklist taped to the wall (procedural).

How NurseOps Now solves it.

In plain terms: a nurse (the reviewer who checks requests; can approve or pend, not deny) with a notepad and a filing cabinet. The notepad holds the last few things said and gets recycled; the filing cabinet holds the official case file, which is never rewritten from memory.

With LangGraph, AutoGen, CrewAI and LlamaIndex (Intro)

If you build on an agent (an AI that chooses which tools to use to answer) framework, some of this section's solutions come built in. 🔁 Replace = the framework does it, you configure it. 🤝 Complement = use both: the framework gives the mechanism, you add the rules. 🛠 Still yours = build it yourself. Each framework name links to its deep dive.

In short: of this section's 6 solutions, 4 are mostly replaced by the frameworks, 0 stay mostly yours, and the others are used together.

SolutionOverallLangGraphAutoGenCrewAILlamaIndex
Three-Tier Memory: Short-Term (Context Window) (what the AI sees in the current call)🔁 / 🤝🤝 Messages live (using the real Claude API (costs money), not a fake stand-in) in graph state (everything the app must remember to continue correctly) per thread (one saved conversation, here one per user and case); you trim them with trim_messages🔁 The agent (an AI that chooses which tools to use to answer)'s model context: BufferedChatCompletionContext, TokenLimitedChatCompletionContext, HeadAndTailChatCompletionContext🤝 Recalled memories are injected before each task; no chat-window setting on the memory page🔁 Memory.from_defaults(session_id=..., token_limit=...) manages the chat history
Three-Tier Memory: Long-Term (Vector Store) (knowledge saved outside the model and searched when needed)🔁 Replace (for agent (an AI that chooses which tools to use to answer) memory)🔁 Store (InMemoryStore, PostgresStore, …) with semantic search, per namespace🔁 ChromaDBVectorMemory, RedisMemory, Mem0Memory🔁 Unified Memory: remember / recall with semantic search (LanceDB by default)🔁 VectorMemoryBlock on any vector store (a database that finds text by meaning, using embeddings)
Three-Tier Memory: Episodic (Experience Log) (a record of what happened, step by step)🤝 Complement🤝 get_state_history replays a thread (one saved conversation, here one per user and case)'s checkpoints (saved copies of a conversation's state); the audit log (a permanent record of who did what and when) is yours🤝 ListMemory keeps a chronological list; the audit log (a permanent record of who did what and when) is yours🤝 Memory records carry source and time; the audit log (a permanent record of who did what and when) is yours🤝 The chat store keeps messages per session; the audit log (a permanent record of who did what and when) is yours
Agentic Outcome: Token Budgets (keeping each call within a planned size)🤝 Complement🤝 trim_messages(max_tokens=...); the budget per zone is yours🔁 TokenLimitedChatCompletionContext(token_limit=...) (experimental)🛠 Not on the memory page🔁 token_limit, chat_history_token_ratio and block priority decide what's kept
Agentic Outcome: Hybrid Memory Systems (recent chat in the window plus long-term search)🔁 Replace🔁 Checkpointer (the code that saves a checkpoint after each step) (short-term) + Store (long-term) in one graph🔁 Model context + memory=[...] on the agent (an AI that chooses which tools to use to answer)🔁 One Memory recalled into every task🔁 Short-term chat + memory blocks in one Memory
Agentic Outcome: Strict State Serialization (saving state so work can pause, crash and resume without loss)🔁 LangGraph (a tool for building AI workflows step by step), 🤝 others🔁 Checkpointers (the code that saves a checkpoint after each step) save after every step; resume with invoke(None, config); durability modes🤝 save_state() / load_state() return a dict; storing it is yours🤝 Memory is persistent; saving a run's state (everything the app must remember to continue correctly) isn't on the memory page🤝 Workflow (a fixed series of steps the app runs) ctx.to_dict() / Context.from_dict(); Memory is stored separately

Memory features checked against each framework's official memory docs on Nov 19, 2026. † = not a memory feature, so from general knowledge; check the current docs.

Implementing Short-Term Memory: Token Budgets and Window Management (7.1)

What it does. Keeps each call's context window (everything sent to the AI in one call; it has a size limit) small and on budget: count tokens (pieces of words the AI reads and writes; cost is per token), load facts only when needed, and pin the rules so they're never pushed out.

The problem:

  1. [Working] The token window is a hard limit (everything sent to the AI shares one fixed size budget): the rules, the question and the whole history share one fixed budget.
  2. [Working · Episodic] Sliding window truncation (silently dropping the oldest messages when the window is full): when it fills, chat frameworks silently drop the oldest messages.
  3. [Procedural] Loss of instructional integrity (the AI losing its rules because they were pushed out of the window): the rules can be pushed out, for example by a long pasted document, and the AI forgets its role.
  4. [Working] Worse answers near capacity (a very full window makes the AI miss details in the middle): in a very full window, details in the middle get missed.
  5. [Working] Cost and latency (how much each call costs and how long it takes): a full window is slower and costs more.

How NurseOps Now solves it (the three standard solutions first, then mine):

With LangGraph, AutoGen, CrewAI and LlamaIndex (7.1)

If you build on an agent (an AI that chooses which tools to use to answer) framework, some of this section's solutions come built in. 🔁 Replace = the framework does it, you configure it. 🤝 Complement = use both: the framework gives the mechanism, you add the rules. 🛠 Still yours = build it yourself. Each framework name links to its deep dive.

In short: of this section's 3 solutions, 2 are mostly replaced by the frameworks, 0 stay mostly yours, and the others are used together.

SolutionOverallLangGraphAutoGenCrewAILlamaIndex
Token Counting Middleware (code that counts tokens before every AI call and acts when the window gets too full)🤝 Complement🤝 trim_messages with a token_counter; thresholds (the cut-off a score must stay above) and actions are yours🔁 TokenLimitedChatCompletionContext counts with model_client.count_tokens()🛠 Not on the memory page🔁 Counts tokens (pieces of words the AI reads and writes; cost is per token) (tiktoken by default) and flushes old messages past the limit
Dynamic Context Loading (giving the AI tools to fetch data only when it needs it, instead of putting everything in the prompt) †🔁 Replace🔁 Tools (a function the AI can call, such as policy search) and tool (a function the AI can call, such as policy search) nodes are standard🔁 Tools (a function the AI can call, such as policy search) on AssistantAgent are standard🔁 Agent (an AI that chooses which tools to use to answer) tools (a function the AI can call, such as policy search) and knowledge sources are standard🔁 Tools (a function the AI can call, such as policy search) and query engines are standard
System Prompt Pinning (keeping the rules in a protected place that is sent on every call and never trimmed) †🔁 / 🤝🤝 You add the system prompt (the standing instructions that set the AI's rules and role) in your node, outside the trimmed history🤝 HeadAndTailChatCompletionContext can always keep the first messages🔁 Each agent (an AI that chooses which tools to use to answer)'s role, goal and backstory go into every task prompt (the instructions and text given to the AI)🔁 StaticMemoryBlock with priority=0 is always inserted, never truncated

Memory features checked against each framework's official memory docs on Nov 19, 2026. † = not a memory feature, so from general knowledge; check the current docs.

Step 1: Pick and load the thread

What it does. Chooses which saved conversation this question belongs to, and loads it from disk.

What we built. backend/app/services/assist.py: one thread per user and case (each nurse's conversation about each case is saved separately), saved by LangGraph (a tool for building AI workflows step by step)'s SqliteSaver in backend/data/assist_memory.db.

def thread_id(user: str, case_id: int | None) -> str:
    return f"{user}:case-{case_id}" if case_id else f"{user}:general"

Example (real output). Three nurses (the reviewer who checks requests; can approve or pend, not deny)' questions land in three separate threads (one saved conversation, here one per user and case), and they're still there after a restart:

thread nurse1:general     -> 4 messages
thread nurse2:general     -> 2 messages
thread nurse1:case-3      -> 2 messages
after a restart (new saver): nurse1:general -> 4 messages

Why this way. Per user + case is the smallest useful unit. Nurse (the reviewer who checks requests; can approve or pend, not deny) 1's chat about case 3 never mixes with case 5, or with nurse (the reviewer who checks requests; can approve or pend, not deny) 2's chat. Loading by thread (one saved conversation, here one per user and case) ID is the rehydration pattern (fetch saved state, keep only what's relevant, and put it back into the next call) (fetch, then use), done by the checkpointer (the code that saves a checkpoint after each step).

How it's checked. test_memory_persists_per_user_and_case_and_clears asks as two users, "restarts", and checks the counts.

In plain terms: one folder per nurse (the reviewer who checks requests; can approve or pend, not deny) per case; you open only the folder you're working on.

↑ Back to the flow

Step 2: Build the window

What it does. Decides exactly what goes into the AI call: the rules, recent history, and a note about the open case.

What we built. claude_answer() in assist.py:

system = load("assist_v1")                                    # rules: sent on every call, outside the history
msgs = [{"role": h["role"], "content": h["text"]} for h in history[-2 * settings.assist_turns:]]
ctx = f"(The user is looking at case {case_id}.) " if case_id else ""
msgs.append({"role": "user", "content": f"{ctx}{q}"})

Example (real output). One nurse (the reviewer who checks requests; can approve or pend, not deny) asked 12 questions in a row:

stored 24 messages (12 turns); sent to the AI 20 messages (10 turns)
oldest stored : Question 1: who can deny a request? | oldest sent: Question 3: who can deny a request?

(In mock mode (rules answer instead of the AI, so no API call or cost) Claude (Anthropic's AI model that this app uses) isn't called, so "sent" is computed with the same line of code claude_answer() uses.)

Why this way.

Trade-off. The limit counts turns, not tokens (pieces of words the AI reads and writes; cost is per token). Ten very long turns could still be large. There is no token counting middleware (code that counts tokens before every AI call and acts when the window gets too full) before the call (see Plan).

In plain terms: the handbook is always on the desk; only the last ten notes from the conversation are; the case file is fetched when needed.

↑ Back to the flow

Step 3: Load facts only when needed

What it does. Gives the AI tools (a function the AI can call, such as policy search) to fetch case facts, policy (the health plan's written rules for when a test is covered) text, the user guide and metrics, instead of putting them all in the prompt (the instructions and text given to the AI).

What we built. Read-only tools (a function the AI can call, such as policy search) in assist.py (get_case, list_cases, stuck_cases, metrics, search_policy, search_guide) that call the same services as the web app. Two size guards:

MAX_TOOL_ROUNDS = 4
...
results.append({"type": "tool_result", "tool_use_id": tu.id, "content": json.dumps(out, default=str)[:12000]})

Why this way. This is dynamic context loading (giving the AI tools to fetch data only when it needs it, instead of putting everything in the prompt). The AI gets only what this question needs, and always the current version of the case, never an old copy from earlier in the chat. The 12,000-character cap stops one large tool (a function the AI can call, such as policy search) result from flooding the window, a risk that's easy to miss.

How it's checked. test_claude_agent_uses_tools_then_answers (mocked (using fake stand-ins instead of real AI calls in tests) Claude (Anthropic's AI model that this app uses)) checks the tool (a function the AI can call, such as policy search) loop and the answer.

In plain terms: instead of photocopying the whole cabinet onto the desk, the AI asks for one file at a time, and each file is trimmed to fit.

↑ Back to the flow

Compression Strategies: Summarization and Entity Extraction (7.2)

What it does. Shrinks history that can't keep growing: summarize old turns and pull exact facts out of the chat so they can't drift (quality slowly getting worse over time).

The problem. [Episodic · Semantic] History can't grow forever, so something has to be shrunk. But a summary loses detail, and a summary of a summary drifts (quality slowly getting worse over time) further each time. That's harmless for small talk and dangerous for exact facts: an ID, a date or a decision that's slightly wrong is simply wrong.

How NurseOps Now solves it.

With LangGraph, AutoGen, CrewAI and LlamaIndex (7.2)

If you build on an agent (an AI that chooses which tools to use to answer) framework, some of this section's solutions come built in. 🔁 Replace = the framework does it, you configure it. 🤝 Complement = use both: the framework gives the mechanism, you add the rules. 🛠 Still yours = build it yourself. Each framework name links to its deep dive.

In short: of this section's 5 solutions, 2 are mostly replaced by the frameworks, 2 stay mostly yours, and the others are used together.

SolutionOverallLangGraphAutoGenCrewAILlamaIndex
Textual Summarization (rewriting old conversation into short, dense notes)🛠 Mostly yours🤝 LangMem SummarizationNode, or a custom summary key🛠 Not built in🤝 extract_memories() splits text into facts (not a summary)🛠 The summary buffer is deprecated; old messages are flushed to memory blocks instead
Rolling Summaries (a short running summary that replaces old conversation turns)🤝 / 🛠🤝 LangMem SummarizationNode(max_tokens_before_summary=...)🛠 Not built in🛠 Not built in🤝 Past chat_history_token_ratio, the oldest messages move to long-term blocks
Entity Extraction (pulling key facts (names, dates, IDs) out of text into a structured record)🔁 CrewAI and LlamaIndex, 🤝 others🤝 Write extracted facts to the Store yourself, or use LangMem🤝 Mem0Memory extracts facts (an outside service)🔁 remember analyzes content with an LLM (large language model: the AI that reads and writes text (here, Claude)) (categories, importance); extract_memories()🔁 FactExtractionMemoryBlock(max_facts=...)
Vector Compression via RAG (storing text as vectors and pulling back only the parts that match)🔁 Replace🔁 Store semantic search over saved memories🔁 ChromaDB or Redis vector (text turned into a list of numbers so similar meanings sit close together) memory🔁 recall(query) over all saved memories🔁 Flushed messages go into a VectorMemoryBlock
The Engineering Trade-off: Fidelity vs. Capacity (the trade-off between keeping every detail and fitting more in the window)🛠 Still yours🛠 No hard/soft split; your exact facts belong in your own tables🛠 Same🛠 Consolidation can merge or delete records automatically: keep exact facts elsewhere🛠 Fact extraction is an LLM (large language model: the AI that reads and writes text (here, Claude)) rewrite: keep exact facts elsewhere

Memory features checked against each framework's official memory docs on Nov 19, 2026. † = not a memory feature, so from general knowledge; check the current docs.

Step 4: Hard state stays in SQL

What it does. Keeps every exact fact (status, decisions, the AI review, the audit trail (the record of who did what, when, kept for review)) as records in the database, never as chat text.

What we built. backend/app/models.py: tables cases, ai_reviews (the review as JSON (a simple text format for structured data)), decisions, audit_log. The chat never stores these; the AI reads them through get_case.

Why this way. Summaries drift (quality slowly getting worse over time), so exact facts (numbers, IDs, decisions) must be stored losslessly and only "soft" conversation may be compressed. NurseOps Now goes one step further: facts are never in the chat at all, so there is nothing to summarize wrongly.

In plain terms: the official file is typed, signed and filed; nobody rewrites it from memory.

↑ Back to the flow

Step 5: Older turns

What it does. Handles conversation older than the last 10 turns.

What we built. Nothing extra: older turns stay saved on disk (Step 1 example: question 1 is still stored) but are no longer sent to the AI.

Why this way. Because facts are looked up fresh (Steps 3–4), losing old chat turns rarely loses anything important. A nurse (the reviewer who checks requests; can approve or pend, not deny) who asks again gets the current answer, not a stale one.

Trade-off. If a nurse (the reviewer who checks requests; can approve or pend, not deny) said something important 11 turns ago ("I already called the provider (the doctor or clinic asking for the test)"), the AI no longer sees it. The usual fixes, a rolling summary (a short running summary that replaces old conversation turns) or a small profile of key facts, are not built. Saved history also keeps growing on disk.

In plain terms: old notes go into a drawer; they're kept, but nobody reads them during the meeting.

↑ Back to the flow

Implementing Long-Term Memory: External Persistence Architecture (7.3)

What it does. Saves state (everything the app must remember to continue correctly) outside the model so it survives restarts, crashes and new sessions, without keeping personal data longer than needed.

The problem. [Episodic · Semantic] The window disappears after every call. Without a store outside the model, a restart, a crash or a new session loses everything. And whatever is saved becomes a liability: personal data copied into memory, logs and traces (step-by-step records of each request: what ran, how long, what it cost), and data kept forever.

How NurseOps Now solves it.

With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3)

If you build on an agent (an AI that chooses which tools to use to answer) framework, some of this section's solutions come built in. 🔁 Replace = the framework does it, you configure it. 🤝 Complement = use both: the framework gives the mechanism, you add the rules. 🛠 Still yours = build it yourself. Each framework name links to its deep dive.

In short: of this section's 8 solutions, 2 are mostly replaced by the frameworks, 3 stay mostly yours, and the others are used together.

SolutionOverallLangGraphAutoGenCrewAILlamaIndex
The Hot/Cold State Architecture (splitting memory into what is in the current call (hot) and what is saved for later (cold))🤝 Complement🤝 Graph state (everything the app must remember to continue correctly) is hot; checkpointers (the code that saves a checkpoint after each step) and the Store are cold; you decide what goes where🤝 Model context is hot; Memory and saved state (everything the app must remember to continue correctly) are cold🤝 The prompt (the instructions and text given to the AI) is hot; Memory is cold🤝 Short-term chat is hot; memory blocks are cold
Structured Storage (SQL/Postgres) (a database with fixed tables for exact facts)🛠 Still yours🛠 PostgresSaver stores checkpoints (saved copies of a conversation's state), not your business tables🛠 None🛠 Memory is stored in LanceDB, not your records🛠 A SQL chat store holds messages, not your records
Semantic Storage (Vector DB like Pinecone, Weaviate, or Chroma) (a vector database that finds text by meaning)🔁 for agent (an AI that chooses which tools to use to answer) memory, 🤝 for documents with permissions🔁 Store with an index (embeddings (text turned into numbers so similar meanings sit close together)), many backends🔁 ChromaDBVectorMemory, RedisMemory🔁 LanceDB by default, or a custom StorageBackend🔁 VectorMemoryBlock on any LlamaIndex vector store (a database that finds text by meaning, using embeddings)
Session Caching (Redis/Key-Value) (saving a conversation's state so it can pause and resume)🔁 LangGraph (a tool for building AI workflows step by step) and LlamaIndex🔁 Checkpointers (the code that saves a checkpoint after each step) incl. RedisSaver, keyed by thread_id🤝 save_state() gives a dict; you store it under your session key🛠 No session or thread (one saved conversation, here one per user and case) concept (scopes instead)🔁 session_id with a SQL chat store (async_database_uri)
The Rehydration Pattern (fetch saved state, keep only what's relevant, and put it back into the next call)🤝 Complement🤝 Reload by thread_id, memories by namespace; filtering and injection (hidden text that tries to give the AI new orders) are yours🤝 load_state(); memory adds relevant items to the context🔁 Relevant memories are recalled into each task, filtered by scope🔁 memory.get() returns recent chat plus memory blocks
Sanitization layer (code that masks personal details and secrets before anything is saved)🛠 Still yours🛠 No redaction; EncryptedSerializer encrypts checkpoints (saved copies of a conversation's state) at rest (a common way for programs to talk over the web using URLs)🛠 No redaction🛠 No redaction; private flag; docs suggest a local LLM (large language model: the AI that reads and writes text (here, Claude)) for sensitive data🛠 Not on the memory page
TTL (time-to-live) expiration (deleting saved data automatically after a set time)🛠 Still yours🛠 No built-in TTL in the docs; they suggest a cron job to delete old checkpoints (saved copies of a conversation's state)🛠 Not mentioned🛠 Not built in; recency_half_life_days only affects ranking🛠 Not mentioned
GDPR Right to Be Forgotten (a person's right to have their stored data deleted (from the EU's GDPR law))🤝 Complement (covering every store is yours)🤝 checkpointer.delete_thread(thread_id); Store items deleted by key🤝 memory.clear() clears a whole store, not one user🤝 memory.reset(scope="/customer/...") clears one scope🤝 Delete messages in the chat store by session

Memory features checked against each framework's official memory docs on Nov 19, 2026. † = not a memory feature, so from general knowledge; check the current docs.

Step 6: Mask, then save the turn

What it does. Removes personal details from the question and answer, then saves the turn to the thread (one saved conversation, here one per user and case).

What we built. The graph's last node, finish, in assist.py, uses backend/app/pii.py:

def finish(s):
    from app import pii                                      # S5: memory keeps no member names/IDs
    names = pii.case_names(session, s.get("case_id"))
    return {"history": [{"role": "user", "text": pii.redact(s["question"], names)},
                        {"role": "assistant", "text": pii.redact(s["answer"], names)}]}

Example (real output).

asked : Member DOB 04/12/1961, phone 555-201-3344, SSN 123-45-6789: what are the rules for a knee MRI?
stored: Member DOB [DATE], phone [PHONE], SSN [SSN]: what are the rules for a knee MRI?

Why this way. Saved state (everything the app must remember to continue correctly) is a liability. Memory, logs and traces (step-by-step records of each request: what ran, how long, what it cost) are copies that outlive the conversation, so they keep no member (a person covered by the health plan) names, dates of birth, phone numbers, SSNs (Social Security number), member (a person covered by the health plan) IDs or addresses. The case record itself stays complete (staff-only, audited). 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) also get a masked thread (one saved conversation, here one per user and case) ID.

Trade-off. Pattern-based masking catches known formats and the names on the case; a name typed in an unusual way could slip through.

In plain terms: before filing your meeting notes, black out every personal detail.

↑ Back to the flow

Step 7: Case state machine

What it does. Lets a case's status change only along allowed paths, and only a person can approve, deny or pend (pause a case for more information or a medical director).

What we built. backend/app/services/state.py:

ALLOWED: dict[str, set[str]] = {
    RECEIVED: {INCOMPLETE, READY},
    INCOMPLETE: {RECEIVED},
    READY: {APPROVED, DENIED, PENDED},
    PENDED: {READY},
    APPROVED: {SYNCED},
    DENIED: {SYNCED},
    SYNCED: set(),
}

Example (real output).

Approved        human=False -> REFUSED: Approved can only be set by a human reviewer
ReadyForReview  human=False -> OK, status now ReadyForReview
Approved        human=False -> REFUSED: Approved can only be set by a human reviewer
Approved        human=True  -> OK, status now Approved
audit rows for this case: [('status_change', 'Received', 'ReadyForReview'), ('status_change', 'ReadyForReview', 'Approved')]

Why this way. This is long-term state (everything the app must remember to continue correctly) that memory discussions often skip: workflow state (where an article is in its life: draft, review, published or retired). It lives (using the real Claude API (costs money), not a fake stand-in) in SQL, is checked in code (not in the AI's prompt (the instructions and text given to the AI)), and every change leaves an audit row (one line in the log of who did what, when). No conversation, however long, can talk the system into an approval.

How it's checked. test_state.py: allowed moves, human-only moves, every other move rejected, audit row (one line in the log of who did what, when) written.

In plain terms: a form that physically can't be stamped "approved" unless a nurse (the reviewer who checks requests; can approve or pend, not deny) signs it.

↑ Back to the flow

Step 8: Reuse instead of recompute

What it does. Avoids paying twice for the same AI work.

What we built. Two layers in backend/app/llm/client.py:

Why this way. A full window is slow and costly, and caching is often the cheapest fix.

Trade-off. AI Assist (the app's chat helper for staff questions) calls (create()) don't ask for prompt caching (the AI provider reusing an unchanged prompt start, so calls are cheaper and faster) yet, though their system prompt (the standing instructions that set the AI's rules and role) is the same on every call. Not demoed here: it needs real Claude (Anthropic's AI model that this app uses) calls.

In plain terms: if you've already reviewed this exact file, use your notes instead of reviewing it again.

↑ Back to the flow

Step 9: Forget on request

What it does. Deletes one conversation when the user clears it.

What we built. assist.clear() deletes the thread (one saved conversation, here one per user and case)'s checkpoints (saved copies of a conversation's state) and writes an assist_cleared audit row (one line in the log of who did what, when).

Example (real output). Only the cleared thread (one saved conversation, here one per user and case) is gone:

nurse1:general -> 0 | nurse1:case-3 -> 2 | nurse2:general -> 2
audit rows 'assist_cleared': 1

Trade-off. There is no automatic expiry: a thread (one saved conversation, here one per user and case) nobody clears is kept forever. Time-to-live (an automatic expiry time for stored data) expiry is not built.

In plain terms: shredding one folder, and noting in the log that you did.

↑ Back to the flow

Preventing Drift and Hallucinations in Long-Running Agents (7.4)

What it does. Keeps a long-running agent (an AI that chooses which tools to use to answer) on its rules (no drift (quality slowly getting worse over time)) and on the facts (no hallucination (the AI stating something that isn't in the sources)) by re-sending instructions and grounding every answer.

The problem:

  1. [Procedural] Context Drift (The Alignment Failure) (the AI slowly forgetting its rules over a long conversation): over many turns the rules fade and the AI starts bending to the user (a strict reviewer slowly becomes an agreeable helper).
  2. [Semantic] Hallucination (The Grounding Failure) (the AI stating made-up facts when the answer isn't in front of it): when the answer isn't in front of it, the AI fills the gap with something plausible and made-up.

How NurseOps Now solves it.

With LangGraph, AutoGen, CrewAI and LlamaIndex (7.4)

If you build on an agent (an AI that chooses which tools to use to answer) framework, some of this section's solutions come built in. 🔁 Replace = the framework does it, you configure it. 🤝 Complement = use both: the framework gives the mechanism, you add the rules. 🛠 Still yours = build it yourself. Each framework name links to its deep dive.

In short: of this section's 5 solutions, 1 is mostly replaced by the frameworks, 2 stay mostly yours, and the others are used together.

SolutionOverallLangGraphAutoGenCrewAILlamaIndex
Engineering Fix: Recursive Goal Injection (repeating a short reminder of the rules before every AI answer) †🤝 Complement🤝 Add the reminder in the node that builds the prompt (the instructions and text given to the AI)🛠 Yours to add🤝 Role and goal in every task prompt (the instructions and text given to the AI) act as an anchor🤝 A StaticMemoryBlock reminder is inserted every turn
Engineering Fix: Strict RAG and Citation Enforcement (answering only from retrieved sources, and flagging any answer without one) †🛠 Still yours🛠 Retrieval (finding the right section of the right policy) tools (a function the AI can call, such as policy search) yes; checking citations (pointers to the exact page and quote that support each claim) is yours🛠 Yours🛠 Yours🤝 Citation-style query engines return numbered sources; checking them is yours
Input Filtering: Relevance Pruning (checking and trimming a question before the AI sees it) †🛠 Still yours🤝 Add a gate (an automatic check that blocks a change when scores drop) node before the model (as NurseOps Now does)🛠 Yours🛠 Yours🛠 Yours
Process Control: Self-Correction Loop (checking the AI's answer and sending it back once to fix what failed) †🤝 Complement🤝 Conditional edges loop back to the model; the check is yours🤝 A second agent (an AI that chooses which tools to use to answer) can review (reflection pattern)🤝 Task guardrails (checks that block unsafe or off-topic input and output) can reject output and retry🤝 Workflows (a fixed series of steps the app runs) can loop back; the check is yours
Output Guardrails: Schema Enforcement (requiring the AI's answer to match a fixed shape, checked in code) †🔁 Replace🔁 Structured output (a task whose answer must fit a set format, like JSON, graded by schema validation) with a Pydantic (a library that checks data fits a fixed form) model🔁 Structured output (a task whose answer must fit a set format, like JSON, graded by schema validation) on AssistantAgent🔁 Task output_pydantic / output_json🔁 Structured output (a task whose answer must fit a set format, like JSON, graded by schema validation) with a Pydantic (a library that checks data fits a fixed form) output_cls

Memory features checked against each framework's official memory docs on Nov 19, 2026. † = not a memory feature, so from general knowledge; check the current docs.

Step 10: Gate the input and output

What it does. Stops bad questions before the AI sees them, and bad answers before the user sees them.

What we built. The gate and check nodes in assist.py, using backend/app/guard.py: injection (hidden text that tries to give the AI new orders) and off-topic (not about prior authorization) checks in code (no AI call), and an output check that blocks secrets and any 80-character run of the system prompt (the standing instructions that set the AI's rules and role).

Example (real output).

answer quoting 120 chars of the system prompt -> Blocked: prompt_leak

Why this way. A "filter the input" defense layer, done with rules instead of a second small model: free, fast and predictable. Together with Step 2 (rules always sent), it guards against slow drift (quality slowly getting worse over time) over a long chat.

How it's checked. test_assist.py (injection (hidden text that tries to give the AI new orders) blocked, off-topic (not about prior authorization) gated, leaky answer blocked) and the red-team (people or scripts that try to trick the AI on purpose) suite in the eval plan (44 attacks, 0 got through).

In plain terms: a receptionist who turns away off-topic (not about prior authorization) visitors, and a reviewer who checks every letter before it goes out.

↑ Back to the flow

Step 11: Ground every answer

What it does. Makes sure answers come from real data, not from the AI's guesses.

What we built.

Why this way. This is strict RAG and citation enforcement (answering only from retrieved sources, and flagging any answer without one). One correction to the usual claim: the schema (a fixed form the AI's answer must fit) guarantees the answer's shape, not its truth. It's the quote check against the PDF (a fixed-layout document file) that catches made-up content.

How it's checked. test_failed_quote_retries_claude_once_with_feedback, test_no_retry_when_quotes_verify.

In plain terms: every claim needs a page number, and someone checks the page.

↑ Back to the flow

Common advice vs. NurseOps Now

Every common idea from the intro and the four parts, with where NurseOps Now stands.

PartIdeaNurseOps NowStatus
IntroModels are stateless (keeping no memory between calls); memory in types (often called three tiers (the AI's suggestion: likely approve, needs review or likely deny): window, long-term store, episode log; I use four types)Working = Step 2; episodic = checkpoints (saved copies of a conversation's state) + audit_log + traces (step-by-step records of each request: what ran, how long, what it cost); semantic = SQL + Chroma (the database that stores the policy vectors); procedural = system prompt (the standing instructions that set the AI's rules and role), tools (a function the AI can call, such as policy search), state machine (a fixed list of allowed status changes)✅
Short-term memory (7.1)Count tokens (pieces of words the AI reads and writes; cost is per token) before each call; act at thresholds (the cut-off a score must stay above)Turn limit only⬜
Short-term memory (7.1)Load context only when neededTools (a function the AI can call, such as policy search) (Step 3)✅
Short-term memory (7.1)Pin the system prompt (the standing instructions that set the AI's rules and role)system field on every call (Step 2)✅
Compression (7.2)Rolling summaries (a short running summary that replaces old conversation turns) of old turnsOld turns dropped from the window, not summarized (Step 5)⬜
Compression (7.2)Key facts in a structured profileFacts in SQL, fetched by tool (a function the AI can call, such as policy search) (Steps 3–4)✅ (different way)
Compression (7.2)Never summarize exact factsFacts never in chat at all (Step 4)✅
Long-term memory (7.3)Hot / cold state (what is saved in a database for later)Window vs. SQL, checkpoints (saved copies of a conversation's state), Chroma (the database that stores the policy vectors)✅
Long-term memory (7.3)SQL for exact facts, vector store (a database that finds text by meaning, using embeddings) for fuzzy text, a session store for pause/resumeSQLite, Chroma (the database that stores the policy vectors), LangGraph (a tool for building AI workflows step by step) checkpoints (saved copies of a conversation's state)✅
Long-term memory (7.3)Rehydration (loading saved state back in for a new call): fetch, filter, injectThread (one saved conversation, here one per user and case) load + last 10 turns + tools (a function the AI can call, such as policy search) (Steps 1–3)✅
Long-term memory (7.3)Scrub personal data before savingStep 6✅
Long-term memory (7.3)Expire stored data automaticallyManual clear only (Step 9)⬜
Drift (quality slowly getting worse over time) and hallucinations (the AI stating something that isn't in the sources) (7.4)Re-inject the goal against drift (quality slowly getting worse over time)Rules sent separately every call (Step 2), no extra reminder at the end🟡
Drift (quality slowly getting worse over time) and hallucinations (the AI stating something that isn't in the sources) (7.4)Answer only with citations (pointers to the exact page and quote that support each claim)Steps 10–11✅
Drift (quality slowly getting worse over time) and hallucinations (the AI stating something that isn't in the sources) (7.4)Input filter, self-check loop, output schema (a fixed form the AI's answer must fit)Rule gate (an automatic check that blocks a change when scores drop), verify-and-retry, Pydantic (a library that checks data fits a fixed form) (Steps 10–11)✅

Common advice I'd correct:

What memory guides usually leave out, which NurseOps Now needed: workflow state (where an article is in its life: draft, review, published or retired) with allowed transitions (Step 7), capping tool (a function the AI can call, such as policy search) results (Step 3), caching (Step 8), and isolating memory per user and case (Step 1).

Checklist: what is done and what is next

StepWhatStatusResult
1Thread (one saved conversation, here one per user and case) per user + case, survives restart✅ Done3 threads (one saved conversation, here one per user and case) kept apart; 4 messages after restart
2Rules always sent; last 10 turns🟡 PartlyTurn limit works; no token (the unit the AI reads and is billed by, about three quarters of a word) count
3Facts by tool (a function the AI can call, such as policy search); results capped✅ Done12,000 characters, 4 rounds
4Exact facts in SQL✅ DoneNever in chat
5Older turns🟡 PartlyKept on disk, not summarized
6Mask, then save✅ DoneDOB, phone, SSN (Social Security number) masked
7State machine (a fixed list of allowed status changes) + audit (a permanent record of who did what and when)✅ DoneAI can't approve; 2 audit rows (one line in the log of who did what, when)
8Caching🟡 PartlyReview cached; Assist not prompt-cached
9Forget🟡 PartlyClear works; no expiry
10Gates (an automatic check that blocks a change when scores drop)✅ DonePrompt (the instructions and text given to the AI) leak blocked
11Grounding✅ DoneQuote check with one retry

Findings: what the demos showed

All from the separate demo copy on Nov 19, 2026 (mock (a fake stand-in used in tests so no real AI call is made) AI), plus the unit tests (small automatic checks of one piece of code each): 26 passed in test_assist.py, test_state.py and test_review_graph.py (2.78 s).

Plan: closing the gaps

  1. Count tokens (pieces of words the AI reads and writes; cost is per token) before each call. Use the API's token (the unit the AI reads and is billed by, about three quarters of a word) counting to check the window before sending, and drop or summarize more when it's near the limit.

Plain example: checking your bag's weight before the airport, not at the gate (an automatic check that blocks a change when scores drop).

Done when: a 50-turn chat never exceeds a set budget, shown in the trace.

  1. Summarize older turns. When turns fall out of the window, keep a short summary of what the nurse (the reviewer who checks requests; can approve or pend, not deny) said (never case facts, which stay in SQL).

Plain example: the meeting minutes, not the full recording.

Done when: a fact said at turn 2 is still used correctly at turn 15.

  1. Cap and expire memory. Keep at most N turns per thread (one saved conversation, here one per user and case) on disk, and delete threads (one saved conversation, here one per user and case) untouched for 90 days.

Plain example: a mailbox that auto-archives old mail.

Done when: a test shows old threads (one saved conversation, here one per user and case) gone and an audit row (one line in the log of who did what, when) for each.

  1. Prompt-cache AI Assist (the app's chat helper for staff questions). Mark the unchanged system prompt (the standing instructions that set the AI's rules and role) and tools (a function the AI can call, such as policy search) as cacheable on Assist calls too.

Plain example: keeping the handbook open instead of reopening it every question.

Done when: traces (step-by-step records of each request: what ran, how long, what it cost) show cache hits and lower cost per question.

  1. Test for drift (quality slowly getting worse over time). A 50-turn scripted conversation that keeps trying to get an approval out of the AI.

Plain example: a long, pushy customer call, rehearsed.

Done when: the AI still refuses at turn 50, as part of the eval plan.

Tools

ToolWhat it does hereStatus
LangGraph (a tool for building AI workflows step by step) SqliteSaverSaves each AI Assist (the app's chat helper for staff questions) thread (one saved conversation, here one per user and case) after every step; reload by thread (one saved conversation, here one per user and case) IDIn use
SQLite + SQLAlchemyCases, reviews, decisions, audit log (a permanent record of who did what and when), LLM (large language model: the AI that reads and writes text (here, Claude)) cacheIn use
Pydantic (a library that checks data fits a fixed form)Checks the shape of every AI reviewIn use
Anthropic SDKSystem prompt (the standing instructions that set the AI's rules and role) field, prompt caching (the AI provider reusing an unchanged prompt start, so calls are cheaper and faster) on reviews, token usage (input plus output tokens per task, a stand-in for cost) per callIn use
app/pii.py (regex (short for regular expression: a text pattern the code matches))Masks personal details in memory, logs and traces (step-by-step records of each request: what ran, how long, what it cost)In use
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 call, with a masked thread (one saved conversation, here one per user and case) IDIn use
Token (the unit the AI reads and is billed by, about three quarters of a word) counting APIWindow budget before each callWill use

What this proves

NurseOps Now treats memory as a design decision, not a framework default. The rules are sent on every call so they can't be pushed out. Facts live (using the real Claude API (costs money), not a fake stand-in) as exact records and are looked up fresh, so they can't drift (quality slowly getting worse over time) through summaries. Each nurse (the reviewer who checks requests; can approve or pend, not deny)'s conversation is a separate, masked, durable thread (one saved conversation, here one per user and case). And no conversation can change a case's outcome, because the state machine (a fixed list of allowed status changes) only lets a person approve. The gaps (token (the unit the AI reads and is billed by, about three quarters of a word) budget, summaries, expiry, caching for chat, a drift (quality slowly getting worse over time) test) are named, with a plan for each.

All cases and people are synthetic (made up for the demo; no real patients). No real patient data is used.

Key terms

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

agent
An AI that chooses which tools to use to answer.Used in: Why this post, How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (Intro), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.1), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.2), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3), Preventing Drift and Hallucinations in Long-Running Agents (7.4), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.4)↩ Back to where you were
agentic outcome: hybrid memory systems
Recent chat in the window plus long-term search.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (Intro)↩ Back to where you were
agentic outcome: strict state serialization
Saving state so work can pause, crash and resume without loss.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (Intro)↩ Back to where you were
agentic outcome: token budgets
Keeping each call within a planned size.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (Intro)↩ Back to where you were
AI Assist
The app's chat helper for staff questions.Used in: How a chat turn flows, and where state lives, Context and State Management (Intro), Implementing Long-Term Memory: External Persistence Architecture (7.3), Step 8: Reuse instead of recompute, Step 11: Ground every answer, Findings: what the demos showed, Plan: closing the gaps, Tools↩ Back to where you were
audit
A permanent record of who did what and when.Used in: Checklist: what is done and what is next↩ Back to where you were
audit log
A permanent record of who did what and when.Used in: With LangGraph, AutoGen, CrewAI and LlamaIndex (Intro), Tools↩ Back to where you were
audit row
One line in the log of who did what, when.Used in: How a chat turn flows, and where state lives, Implementing Long-Term Memory: External Persistence Architecture (7.3), Step 7: Case state machine, Step 9: Forget on request, Checklist: what is done and what is next, Plan: closing the gaps↩ Back to where you were
audit trail
The record of who did what, when, kept for review.Used in: Step 4: Hard state stays in SQL↩ Back to where you were
checkpoint
A saved copy of a conversation's state after each step.Used in: Words used in this post, How a chat turn flows, and where state lives↩ Back to where you were
checkpointer
The code that saves a checkpoint after each step.Used in: Interview talk, How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (Intro), Step 1: Pick and load the thread, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3)↩ Back to where you were
checkpoints
Saved copies of a conversation's state.Used in: How a chat turn flows, and where state lives, Context and State Management (Intro), With LangGraph, AutoGen, CrewAI and LlamaIndex (Intro), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3), Step 9: Forget on request, Common advice vs. NurseOps Now↩ Back to where you were
Chroma
The database that stores the policy vectors.Used in: How a chat turn flows, and where state lives, Context and State Management (Intro), Common advice vs. NurseOps Now↩ Back to where you were
chunks
Small pieces of a document; here, one policy rule each.Used in: Step 8: Reuse instead of recompute↩ Back to where you were
citations
Pointers to the exact page and quote that support each claim.Used in: With LangGraph, AutoGen, CrewAI and LlamaIndex (7.4), Common advice vs. NurseOps Now↩ Back to where you were
Claude
Anthropic's AI model that this app uses.Used in: How a chat turn flows, and where state lives, Step 2: Build the window, Step 3: Load facts only when needed, Step 8: Reuse instead of recompute, Step 11: Ground every answer↩ Back to where you were
cold state
What is saved in a database for later.Used in: Words used in this post, Common advice vs. NurseOps Now↩ Back to where you were
context drift (the alignment failure)
The AI slowly forgetting its rules over a long conversation.Used in: How a chat turn flows, and where state lives, Preventing Drift and Hallucinations in Long-Running Agents (7.4)↩ Back to where you were
context window
Everything sent to the AI in one call; it has a size limit.Used in: Interview talk, Words used in this post, How a chat turn flows, and where state lives, Context and State Management (Intro), Implementing Short-Term Memory: Token Budgets and Window Management (7.1)↩ Back to where you were
cost and latency
How much each call costs and how long it takes.Used in: How a chat turn flows, and where state lives, Implementing Short-Term Memory: Token Budgets and Window Management (7.1)↩ Back to where you were
drift
Quality slowly getting worse over time.Used in: Interview talk, Words used in this post, How a chat turn flows, and where state lives, Compression Strategies: Summarization and Entity Extraction (7.2), Step 4: Hard state stays in SQL, Preventing Drift and Hallucinations in Long-Running Agents (7.4), Step 10: Gate the input and output, Common advice vs. NurseOps Now, Findings: what the demos showed, Plan: closing the gaps, What this proves↩ Back to where you were
dynamic context loading
Giving the AI tools to fetch data only when it needs it, instead of putting everything in the prompt.Used in: How a chat turn flows, and where state lives, Implementing Short-Term Memory: Token Budgets and Window Management (7.1), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.1), Step 3: Load facts only when needed↩ Back to where you were
embeddings
Text turned into numbers so similar meanings sit close together.Used in: With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3)↩ Back to where you were
engineering fix: recursive goal injection
Repeating a short reminder of the rules before every AI answer.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.4)↩ Back to where you were
engineering fix: strict rag and citation enforcement
Answering only from retrieved sources, and flagging any answer without one.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.4)↩ Back to where you were
entity extraction
Pulling key facts (names, dates, IDs) out of text into a structured record.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.2)↩ Back to where you were
episodic memory
Long-term memory of what happened: dated events, past sessions, mistakes.Used in: Words used in this post↩ Back to where you were
flooding the context window
Sending so much that the AI loses its instructions.Used in: How a chat turn flows, and where state lives↩ Back to where you were
gate
An automatic check that blocks a change when scores drop.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.4), Common advice vs. NurseOps Now, Checklist: what is done and what is next, Plan: closing the gaps↩ Back to where you were
gdpr right to be forgotten
A person's right to have their stored data deleted (from the EU's GDPR law).Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3)↩ Back to where you were
guardrails
Checks that block unsafe or off-topic input and output.Used in: With LangGraph, AutoGen, CrewAI and LlamaIndex (7.4)↩ Back to where you were
hallucination
The AI stating something that isn't in the sources.Used in: Words used in this post, How a chat turn flows, and where state lives, Preventing Drift and Hallucinations in Long-Running Agents (7.4), Common advice vs. NurseOps Now↩ Back to where you were
hallucination (the grounding failure)
The AI stating made-up facts when the answer isn't in front of it.Used in: How a chat turn flows, and where state lives, Preventing Drift and Hallucinations in Long-Running Agents (7.4)↩ Back to where you were
hallucination drift
Details slowly changing as summaries are summarized again.Used in: How a chat turn flows, and where state lives↩ Back to where you were
history cap
A limit on how many past turns are sent to the AI.Used in: How a chat turn flows, and where state lives, Implementing Short-Term Memory: Token Budgets and Window Management (7.1)↩ Back to where you were
hot state
What is in the current AI call.Used in: Words used in this post↩ Back to where you were
injection
Hidden text that tries to give the AI new orders.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3), Step 10: Gate the input and output↩ Back to where you were
input filtering
Checking a question before the AI sees it, and blocking bad ones.Used in: How a chat turn flows, and where state lives↩ Back to where you were
input filtering: relevance pruning
Checking and trimming a question before the AI sees it.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.4)↩ Back to where you were
JSON
A simple text format for structured data.Used in: How a chat turn flows, and where state lives, Compression Strategies: Summarization and Entity Extraction (7.2), Step 4: Hard state stays in SQL↩ Back to where you were
LangGraph
A tool for building AI workflows step by step.Used in: Interview talk, How a chat turn flows, and where state lives, Context and State Management (Intro), With LangGraph, AutoGen, CrewAI and LlamaIndex (Intro), Step 1: Pick and load the thread, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3), Common advice vs. NurseOps Now, Tools↩ Back to where you were
LangSmith
A service that records each AI request step by step (tracing).Used in: How a chat turn flows, and where state lives, Context and State Management (Intro), Step 6: Mask, then save the turn, Tools↩ Back to where you were
live
Using the real Claude API (costs money), not a fake stand-in.Used in: Interview talk, How a chat turn flows, and where state lives, Context and State Management (Intro), With LangGraph, AutoGen, CrewAI and LlamaIndex (Intro), Implementing Long-Term Memory: External Persistence Architecture (7.3), Step 7: Case state machine, What this proves↩ Back to where you were
LLM
Large language model: the AI that reads and writes text (here, Claude).Used in: With LangGraph, AutoGen, CrewAI and LlamaIndex (7.2), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3), Tools↩ Back to where you were
llms are stateless
Language models remember nothing between calls.Used in: How a chat turn flows, and where state lives↩ Back to where you were
loss of instructional integrity
The AI losing its rules because they were pushed out of the window.Used in: How a chat turn flows, and where state lives, Implementing Short-Term Memory: Token Budgets and Window Management (7.1)↩ Back to where you were
member
A person covered by the health plan.Used in: Step 6: Mask, then save the turn↩ Back to where you were
memory types
Working memory plus three long-term kinds: episodic, semantic, procedural.Used in: Context and State Management (Intro)↩ Back to where you were
mock
A fake stand-in used in tests so no real AI call is made.Used in: How a chat turn flows, and where state lives, Findings: what the demos showed↩ Back to where you were
mock mode
Rules answer instead of the AI, so no API call or cost.Used in: Step 2: Build the window↩ Back to where you were
mocked
Using fake stand-ins instead of real AI calls in tests.Used in: Step 3: Load facts only when needed↩ Back to where you were
no external state
Nothing saved outside the model, so everything is lost when the program stops.Used in: How a chat turn flows, and where state lives↩ Back to where you were
nurse
The reviewer who checks requests; can approve or pend, not deny.Used in: Interview talk, How a chat turn flows, and where state lives, Context and State Management (Intro), Step 1: Pick and load the thread, Step 2: Build the window, Compression Strategies: Summarization and Entity Extraction (7.2), Step 5: Older turns, Step 7: Case state machine, Plan: closing the gaps, What this proves↩ Back to where you were
off-topic
Not about prior authorization.Used in: How a chat turn flows, and where state lives, Step 10: Gate the input and output↩ Back to where you were
one thread per user and case
Each nurse's conversation about each case is saved separately.Used in: How a chat turn flows, and where state lives, Implementing Short-Term Memory: Token Budgets and Window Management (7.1), Step 1: Pick and load the thread↩ Back to where you were
output gate
A check that blocks answers leaking the rules or a secret.Used in: How a chat turn flows, and where state lives↩ Back to where you were
output guardrails: schema enforcement
Requiring the AI's answer to match a fixed shape, checked in code.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.4)↩ Back to where you were
PDF
A fixed-layout document file.Used in: How a chat turn flows, and where state lives, Preventing Drift and Hallucinations in Long-Running Agents (7.4), Step 11: Ground every answer↩ Back to where you were
pend
Pause a case for more information or a medical director.Used in: How a chat turn flows, and where state lives, Step 7: Case state machine↩ Back to where you were
persistence creates liability
Saved data can leak personal details or secrets.Used in: How a chat turn flows, and where state lives↩ Back to where you were
policies
The health plan's written rules for when tests are covered.Used in: Interview talk, Words used in this post, How a chat turn flows, and where state lives, Context and State Management (Intro)↩ Back to where you were
policy
The health plan's written rules for when a test is covered.Used in: Why this post, Words used in this post, How a chat turn flows, and where state lives, Context and State Management (Intro), Implementing Short-Term Memory: Token Budgets and Window Management (7.1), Step 3: Load facts only when needed, Step 8: Reuse instead of recompute↩ Back to where you were
procedural memory
Long-term memory of how to do things: rules, workflows, tools.Used in: Words used in this post↩ Back to where you were
process control: self-correction loop
Checking the AI's answer and sending it back once to fix what failed.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.4)↩ Back to where you were
prompt
The instructions and text given to the AI.Used in: Interview talk, Words used in this post, How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.1), Step 3: Load facts only when needed, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3), Step 7: Case state machine, Step 8: Reuse instead of recompute, Preventing Drift and Hallucinations in Long-Running Agents (7.4), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.4), Step 11: Ground every answer, Checklist: what is done and what is next↩ Back to where you were
prompt caching
The AI provider reusing an unchanged prompt start, so calls are cheaper and faster.Used in: Interview talk, Words used in this post, How a chat turn flows, and where state lives, Implementing Long-Term Memory: External Persistence Architecture (7.3), Step 8: Reuse instead of recompute, Tools↩ Back to where you were
provider
The doctor or clinic asking for the test.Used in: Words used in this post, Step 5: Older turns, Step 8: Reuse instead of recompute↩ Back to where you were
Pydantic
A library that checks data fits a fixed form.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.4), Step 11: Ground every answer, Common advice vs. NurseOps Now, Tools↩ Back to where you were
RAG
Retrieval-augmented generation: the AI looks things up before it answers.Used in: Interview talk, Why this post, How a chat turn flows, and where state lives↩ Back to where you were
red team
People or scripts that try to trick the AI on purpose.Used in: How a chat turn flows, and where state lives↩ Back to where you were
red-team
People or scripts that try to trick the AI on purpose.Used in: Step 10: Gate the input and output↩ Back to where you were
regex
Short for regular expression: a text pattern the code matches.Used in: Tools↩ Back to where you were
rehydration
Loading saved state back in for a new call.Used in: Words used in this post, Common advice vs. NurseOps Now↩ Back to where you were
REST
A common way for programs to talk over the web using URLs.Used in: With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3)↩ Back to where you were
result cache
Saved AI answers reused when the exact same input comes again.Used in: How a chat turn flows, and where state lives, Step 8: Reuse instead of recompute↩ Back to where you were
retrieval
Finding the right section of the right policy.Used in: Interview talk, How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.4)↩ Back to where you were
rolling summaries
A short running summary that replaces old conversation turns.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.2), Common advice vs. NurseOps Now↩ Back to where you were
rolling summary
A short running summary that replaces old conversation turns.Used in: Step 5: Older turns↩ Back to where you were
sanitization layer
Code that masks personal details and secrets before anything is saved.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3)↩ Back to where you were
schema
A fixed form the AI's answer must fit.Used in: How a chat turn flows, and where state lives, Preventing Drift and Hallucinations in Long-Running Agents (7.4), Step 11: Ground every answer, Common advice vs. NurseOps Now↩ Back to where you were
semantic memory
Long-term memory of what is true: facts, policies, records.Used in: Words used in this post↩ Back to where you were
semantic storage (vector db like pinecone, weaviate, or chroma)
A vector database that finds text by meaning.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3)↩ Back to where you were
session caching
Saving a conversation's state so it can pause and resume.Used in: How a chat turn flows, and where state lives↩ Back to where you were
session caching (redis/key-value)
Saving a conversation's state so it can pause and resume.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3)↩ Back to where you were
sliding window truncation
Silently dropping the oldest messages when the window is full.Used in: How a chat turn flows, and where state lives, Implementing Short-Term Memory: Token Budgets and Window Management (7.1)↩ Back to where you were
SSN
Social Security number.Used in: Interview talk, How a chat turn flows, and where state lives, Step 6: Mask, then save the turn, Checklist: what is done and what is next, Findings: what the demos showed↩ Back to where you were
state
Everything the app must remember to continue correctly.Used in: Why this post, Words used in this post, How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (Intro), Implementing Long-Term Memory: External Persistence Architecture (7.3), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3), Step 6: Mask, then save the turn, Step 7: Case state machine↩ Back to where you were
state machine
A fixed list of allowed status changes.Used in: Interview talk, Words used in this post, How a chat turn flows, and where state lives, Context and State Management (Intro), Preventing Drift and Hallucinations in Long-Running Agents (7.4), Common advice vs. NurseOps Now, Checklist: what is done and what is next, What this proves↩ Back to where you were
stateless
Keeping no memory between calls.Used in: Context and State Management (Intro), Common advice vs. NurseOps Now↩ Back to where you were
strict RAG and citation enforcement
Answering only from retrieved sources, and flagging any answer without one.Used in: Step 11: Ground every answer↩ Back to where you were
structured output
A task whose answer must fit a set format, like JSON, graded by schema validation.Used in: With LangGraph, AutoGen, CrewAI and LlamaIndex (7.4)↩ Back to where you were
structured storage
A database with fixed tables for exact facts, like SQL.Used in: How a chat turn flows, and where state lives↩ Back to where you were
structured storage (sql/postgres)
A database with fixed tables for exact facts.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3)↩ Back to where you were
summarization solves volume, not time
A summary shrinks memory but doesn't survive a crash or restart.Used in: How a chat turn flows, and where state lives↩ Back to where you were
synthetic
Made up for the demo; no real patients.Used in: What this proves↩ Back to where you were
system prompt
The standing instructions that set the AI's rules and role.Used in: How a chat turn flows, and where state lives, Context and State Management (Intro), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.1), Step 2: Build the window, Step 8: Reuse instead of recompute, Step 10: Gate the input and output, Common advice vs. NurseOps Now, Plan: closing the gaps, Tools↩ Back to where you were
system prompt pinning
Keeping the rules in a protected place that is sent on every call and never trimmed.Used in: How a chat turn flows, and where state lives, Implementing Short-Term Memory: Token Budgets and Window Management (7.1), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.1), Step 2: Build the window↩ Back to where you were
textual summarization
Rewriting old conversation into short, dense notes.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.2)↩ Back to where you were
the context window: finite, expensive, volatile
The window is limited, paid per token, and gone after each call.Used in: How a chat turn flows, and where state lives↩ Back to where you were
the engineering trade-off: fidelity vs. capacity
The trade-off between keeping every detail and fitting more in the window.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.2)↩ Back to where you were
the hot/cold state architecture
Splitting memory into what is in the current call (hot) and what is saved for later (cold).Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3)↩ Back to where you were
the rehydration pattern
Fetch saved state, keep only what's relevant, and put it back into the next call.Used in: How a chat turn flows, and where state lives, Step 1: Pick and load the thread, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3)↩ Back to where you were
the token window is a hard limit
Everything sent to the AI shares one fixed size budget.Used in: How a chat turn flows, and where state lives, Implementing Short-Term Memory: Token Budgets and Window Management (7.1)↩ Back to where you were
thread
One saved conversation, here one per user and case.Used in: Interview talk, Words used in this post, How a chat turn flows, and where state lives, Context and State Management (Intro), With LangGraph, AutoGen, CrewAI and LlamaIndex (Intro), Step 1: Pick and load the thread, Implementing Long-Term Memory: External Persistence Architecture (7.3), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3), Step 6: Mask, then save the turn, Step 9: Forget on request, Common advice vs. NurseOps Now, Checklist: what is done and what is next, Findings: what the demos showed, Plan: closing the gaps, Tools, What this proves↩ Back to where you were
three-tier memory: episodic (experience log)
A record of what happened, step by step.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (Intro)↩ Back to where you were
three-tier memory: long-term (vector store)
Knowledge saved outside the model and searched when needed.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (Intro)↩ Back to where you were
three-tier memory: short-term (context window)
What the AI sees in the current call.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (Intro)↩ Back to where you were
threshold
The cut-off a score must stay above.Used in: With LangGraph, AutoGen, CrewAI and LlamaIndex (7.1), Common advice vs. NurseOps Now↩ Back to where you were
tier
The AI's suggestion: likely approve, needs review or likely deny.Used in: Context and State Management (Intro), Common advice vs. NurseOps Now↩ Back to where you were
time-to-live
An automatic expiry time for stored data.Used in: Step 9: Forget on request↩ Back to where you were
token
The unit the AI reads and is billed by, about three quarters of a word.Used in: Interview talk, Words used in this post, How a chat turn flows, and where state lives, Context and State Management (Intro), Implementing Short-Term Memory: Token Budgets and Window Management (7.1), Checklist: what is done and what is next, Findings: what the demos showed, Plan: closing the gaps, Tools, What this proves↩ Back to where you were
token counting middleware
Code that counts tokens before every AI call and acts when the window gets too full.Used in: How a chat turn flows, and where state lives, Implementing Short-Term Memory: Token Budgets and Window Management (7.1), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.1), Step 2: Build the window↩ Back to where you were
token usage
Input plus output tokens per task, a stand-in for cost.Used in: Tools↩ Back to where you were
tokens
Pieces of words the AI reads and writes; cost is per token.Used in: Interview talk, How a chat turn flows, and where state lives, Implementing Short-Term Memory: Token Budgets and Window Management (7.1), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.1), Step 2: Build the window, Common advice vs. NurseOps Now, Plan: closing the gaps↩ Back to where you were
tool
A function the AI can call, such as policy search.Used in: Interview talk, Words used in this post, How a chat turn flows, and where state lives, Context and State Management (Intro), Implementing Short-Term Memory: Token Budgets and Window Management (7.1), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.1), Step 2: Build the window, Step 3: Load facts only when needed, Compression Strategies: Summarization and Entity Extraction (7.2), Preventing Drift and Hallucinations in Long-Running Agents (7.4), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.4), Step 11: Ground every answer, Common advice vs. NurseOps Now, Checklist: what is done and what is next, Plan: closing the gaps↩ Back to where you were
traces
Step-by-step records of each request: what ran, how long, what it cost.Used in: How a chat turn flows, and where state lives, Context and State Management (Intro), Implementing Long-Term Memory: External Persistence Architecture (7.3), Step 6: Mask, then save the turn, Common advice vs. NurseOps Now, Plan: closing the gaps, Tools↩ Back to where you were
ttl (time-to-live) expiration
Deleting saved data automatically after a set time.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3)↩ Back to where you were
TTL expiration
Deleting saved data automatically after a set time.Used in: How a chat turn flows, and where state lives↩ Back to where you were
unit test
A small automatic check of one piece of code.Used in: How a chat turn flows, and where state lives↩ Back to where you were
unit tests
Small automatic checks of one piece of code each.Used in: How a chat turn flows, and where state lives, Findings: what the demos showed↩ Back to where you were
vector
Text turned into a list of numbers so similar meanings sit close together.Used in: How a chat turn flows, and where state lives, Context and State Management (Intro), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.2)↩ Back to where you were
vector compression via rag
Storing text as vectors and pulling back only the parts that match.Used in: How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (7.2)↩ Back to where you were
vector store
A database that finds text by meaning, using embeddings.Used in: Interview talk, How a chat turn flows, and where state lives, With LangGraph, AutoGen, CrewAI and LlamaIndex (Intro), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.3), Common advice vs. NurseOps Now↩ Back to where you were
vectors
Text turned into lists of numbers so similar meanings sit close together.Used in: How a chat turn flows, and where state lives↩ Back to where you were
workflow
A fixed series of steps the app runs.Used in: Words used in this post, Context and State Management (Intro), With LangGraph, AutoGen, CrewAI and LlamaIndex (Intro), With LangGraph, AutoGen, CrewAI and LlamaIndex (7.4)↩ Back to where you were
workflow state
Where an article is in its life: draft, review, published or retired.Used in: Step 7: Case state machine, Common advice vs. NurseOps Now↩ Back to where you were
working / short-term memory
What the AI holds for the current call: the context window.Used in: Words used in this post↩ Back to where you were
worse answers near capacity
A very full window makes the AI miss details in the middle.Used in: How a chat turn flows, and where state lives, Implementing Short-Term Memory: Token Budgets and Window Management (7.1)↩ Back to where you were