📦 Moved to new directory. Last updated 12.2.2026. New location: claude-config/library/03-memory-state/deep-dives/state-10-textual-summarization.html

Deep dive 10 of 27: Textual Summarization

Nov 19, 2026 · Michael Chang · Status in NurseOps Now: ⬜ not built (illustrative)

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

Part of: Remembering the right things: state management in NurseOps Now, section Compression Strategies: Summarization and Entity Extraction (7.2) · All 27 solutions · ← System Prompt Pinning · Rolling Summaries →

Read in this order

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

In plain words

Textual summarization (rewriting old conversation into short, dense notes) rewrites an old conversation into a few short lines that keep the facts and decisions and drop the chat filler ("hi", "thanks", "sure"). The summary goes into the window instead of the full chat.

In plain terms: meeting minutes instead of the full recording.

The problem it solves

History can't keep growing: a long chat fills the window with greetings and back-and-forth that carry no facts.

The standard approach (in my words): periodically rewrite the history into a dense narrative that keeps only the state (everything the app must remember to continue correctly) changes.

How to implement it (ServiceApps)

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

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

The scenario. An employee and ServiceApps (a company platform for IT tickets, HR requests and help-center articles) Assist fixed a printer problem in 8 turns. Before the next topic, the chat is condensed.

Steps.

  1. Pick the turns to summarize (for example, everything older than the last 4).
  2. Ask the model: "Rewrite as short facts and decisions; keep IDs, numbers and errors exactly."
  3. Replace those turns with the summary.
  4. Keep exact IDs and decisions in structured storage (a database with fixed tables for exact facts, like SQL) too (see The Engineering Trade-off).

The code (Python):

import re
FILLER = re.compile(r"^(thanks for waiting|thank you|thanks|hello|hi there|hi|okay|ok|sure|great|no problem)\b[.!,]?\s*", re.I)
chat = [("user", "Hi there!"), ("assistant", "Hello! How can I help you today?"),
        ("user", "My laptop can't print to the 3rd floor printer."),
        ("assistant", "Sorry to hear that. Let me check that for you, one moment please."),
        ("user", "Sure, no rush."), ("assistant", "Thanks for waiting! Is it the printer named PR-3F-01?"),
        ("user", "Yes, PR-3F-01."), ("assistant", "Okay. Please remove it, then add it again by IP 10.20.3.15 (KB0030100)."),
        ("user", "Okay, give me a minute to try that."), ("assistant", "Of course, take your time."),
        ("user", "Thanks, that worked!"), ("assistant", "Great, glad it's fixed. Anything else I can help with?"),
        ("user", "No, that's all, thank you so much!"), ("assistant", "You're welcome, have a great day!")]

def summarize(turns):
    """Stand-in for an AI call ('rewrite as short facts and decisions'): keep only fact-bearing lines, no roles."""
    facts = []
    for role, text in turns:
        t = FILLER.sub("", text).strip()
        if re.search(r"\d|KB\d+|worked|can't|failed", t) and t not in facts:
            facts.append(t)
    return "Facts: " + " | ".join(facts)

s = summarize(chat)
print(s)
print(f"{sum(len(t) for _, t in chat)} chars -> {len(s)} chars")

Output (from running the code above):

Facts: My laptop can't print to the 3rd floor printer. | Is it the printer named PR-3F-01? | Yes, PR-3F-01. | Please remove it, then add it again by IP 10.20.3.15 (KB0030100). | that worked!
507 chars -> 190 chars

What to watch for.

In plain terms: after a long call, write three lines in the ticket: what broke, what fixed it, which article helped.

In NurseOps Now

Not built. NurseOps Now doesn't summarize: turns older than the last 10 stay on disk and leave the window, and case facts never depend on chat because they're in SQL. This is Plan 2.

Trade-offs

Interview answer

"When history gets long I'd rewrite old turns into short facts and decisions, with an instruction to copy IDs and error codes exactly, and keep the full transcript on disk. Exact facts also live (using the real Claude API (costs money), not a fake stand-in) in structured storage (a database with fixed tables for exact facts, like SQL), so a bad summary can't corrupt them."

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

← Back to all 27 solutions in the state management blog

Key terms

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

audit
A permanent record of who did what and when.Used in: How to implement it (ServiceApps)↩ Back to where you were
hallucination drift
Details slowly changing as summaries are summarized again.Used in: How to implement it (ServiceApps)↩ Back to where you were
incident
A ServiceApps ticket for something broken.Used in: How to implement it (ServiceApps)↩ Back to where you were
KB
Knowledge base: a library of help articles.Used in: How to implement it (ServiceApps)↩ Back to where you were
live
Using the real Claude API (costs money), not a fake stand-in.Used in: Interview answer↩ Back to where you were
ServiceApps
A company platform for IT tickets, HR requests and help-center articles.Used in: How to implement it (ServiceApps)↩ Back to where you were
state
Everything the app must remember to continue correctly.Used in: The problem it solves↩ Back to where you were
structured storage
A database with fixed tables for exact facts, like SQL.Used in: How to implement it (ServiceApps), Interview answer↩ Back to where you were
textual summarization
Rewriting old conversation into short, dense notes.Used in: In plain words↩ Back to where you were