cd /news/large-language-models/building-structured-client-memory-an… · home › topics › large-language-models › article
[ARTICLE · art-182978] src=dev.to ↗ pub= topic=large-language-models verified=true sentiment=↑ positive

Building structured client-memory and deterministic rule-checking tools for B2B agencies

A developer benchmarked four approaches for carrying standing client rules across noisy B2B agency email threads, testing long-context, rolling summary, retrieval, and a structured rulebook against nine new emails with five automated checks per reply on qwen2.5:7b via Ollama. The structured rulebook scored 98% (44/45) on a 44-message thread and 98% on a truncated 300-message thread, versus 89% for long-context and 84-87% for summaries, while using 906 characters of context per reply against 2,622 for long-context. Adding a deterministic post-check layer pushed the structured approach to 100% (45/45), a guard that unstructured baselines cannot apply directly.

recommendation

Extract standing rules into a structured rulebook and add deterministic post-checks for dates, negative constraints and placeholder URLs, since unguarded models still slip on those.

more in playbook: Evals and testing for LLM apps
by read2 min views10 publishedDec 6, 2026

In March, a client tells your agency: "Email only. And please, no calls before 11."

Months later, a teammate who never saw that thread books a 9am call. The rule was sitting in message #37 of a thread nobody has time to re-read.

I ran a controlled benchmark to test whether an LLM can reliably carry standing client rules across noisy B2B agency email threads—and where every common approach still slips.

#

The Setup

A synthetic client history was tested at 44 messages and 300 messages, with five standing rules buried inside routine replies:

  • Send a link instead of attachments
  • Format dates as DD/MM
  • No calls before 11am
  • Weekly updates instead of daily
  • No "I hope you're well" openers

Four approaches answered nine new emails under identical conditions (qwen2.5:7b via Ollama, five automated checks per reply):

Long-context (long_context): Paste as much thread history as fits. 2. Rolling summary (summary): Maintain a running summary of the thread. 3. Retrieval (retrieval): Fetch messages matching the current email. 4. Structured rulebook (memory): Extract standing rules once and draft from the structured rule set—tested bothpre-guard andwith deterministic post-guards .

#

Scoreboard

| Scenario | memory (pre-guard) | memory (with deterministic post-guards) | long_context | retrieval | summary |

| **44 messages** (`7_long_buried_rules` ) | 98% (44/45) | **100% (45/45)** | 89% (40/45) | 91% (41/45) | 84% (38/45) | 
| **300 messages** (`8_huge_history` , truncated) | 98% (44/45) | -- | 89% (40/45) | 89% (40/45) | 87% (39/45) | 

#

What Stood Out

On a 44-message thread, unguarded approaches are close: 98% vs. 91% is 3 checks apart out of 45. #

Much smaller context per reply: Structured rules used906 characters per reply vs.2,622 characters for long-context on the 44-message thread. #

Where unguarded models still trip: Formatting dates (DD/MM vs. month names), negative constraints ("no calls before 11am" ), and inventing placeholder URLs when asked to share files. #

Structure enables deterministic enforcement: Pairing structured rules with a deterministic post-check layer pushed7_long_buried_rules from 98% (44/45) to100% (45/45) —a layer that unstructured long-context, retrieval, or summary baselines cannot apply directly.

#

Known Limits

  • All benchmark threads are synthetic; 45 checks per scenario shows a clear pattern across 9 test emails, not a production-scale evaluation.
  • Naive clock-time checks treat any time before 11:00 as a violation, including negative phrasing like "I can't do before 11am" .
  • Naive attachment checks flag any "attach" substring, including*"I can't attach"* .
  • Replacing an old rule whose wording shares no keywords with the new rule (e.g., "weekly on Fridays" ->"daily progress summary" ) depends on the extraction pass flagging the removal.

#

Inspect the Benchmark Logs

The underlying extraction and deterministic guard engine powers Murno and is kept proprietary. The benchmark methodology, per-scenario breakdown, and raw scored outputs (results.md and results.json) are published here:

👉 agency-client-memory-benchmark on GitHub

── more in #large-language-models 4 stories · sorted by recency
── more on @ollama 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/building-structured-…] indexed:0 read:2min 2026-12-06 · —