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

> Source: <https://dev.to/murno/building-structured-client-memory-and-deterministic-rule-checking-tools-for-b2b-agencies-10e1>
> Published: 2026-12-06 17:32:16+00:00

**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 the playbook "Evals and testing for LLM apps": <https://wpnews.pro/playbooks/evals-testing>

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):

1. 
**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 both**pre-guard** and**with 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 used**906 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 pushed`7_long_buried_rules` from 98% (44/45) to**100% (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](https://github.com/shreemurno-source/agency-client-memory-benchmark)**
