{"slug": "building-structured-client-memory-and-deterministic-rule-checking-tools-for-b2b", "title": "Building structured client-memory and deterministic rule-checking tools for B2B agencies", "summary": "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.", "body_md": "In March, a client tells your agency: *\"Email only. And please, no calls before 11.\"*\n\nMonths 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.\n\nI 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.\n\n## \n  \n  \n  The Setup\n\nA synthetic client history was tested at **44 messages** and **300 messages**, with five standing rules buried inside routine replies:\n\n- Send a link instead of attachments\n- Format dates as `DD/MM`\n- No calls before 11am\n- Weekly updates instead of daily\n- No *\"I hope you're well\"* openers\n\nFour approaches answered nine new emails under identical conditions (`qwen2.5:7b` via Ollama, five automated checks per reply):\n\n1. \n**Long-context (`long_context`):** Paste as much thread history as fits.\n2. \n**Rolling summary (`summary`):** Maintain a running summary of the thread.\n3. \n**Retrieval (`retrieval`):** Fetch messages matching the current email.\n4. \n**Structured rulebook (`memory`):** Extract standing rules once and draft from the structured rule set—tested both**pre-guard** and**with deterministic post-guards** .\n\n## \n  \n  \n  Scoreboard\n\n| Scenario | `memory` (pre-guard) | `memory` (with deterministic post-guards) | `long_context` | `retrieval` | `summary` | \n| **44 messages** (`7_long_buried_rules` ) | 98% (44/45) | **100% (45/45)** | 89% (40/45) | 91% (41/45) | 84% (38/45) | \n| **300 messages** (`8_huge_history` , truncated) | 98% (44/45) | -- | 89% (40/45) | 89% (40/45) | 87% (39/45) | \n\n## \n  \n  \n  What Stood Out\n\n- \n**On a 44-message thread, unguarded approaches are close:** 98% vs. 91% is 3 checks apart out of 45.\n- \n**Much smaller context per reply:** Structured rules used**906 characters** per reply vs.**2,622 characters** for long-context on the 44-message thread.\n- \n**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.\n- \n**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.\n\n## \n  \n  \n  Known Limits\n\n- All benchmark threads are synthetic; 45 checks per scenario shows a clear pattern across 9 test emails, not a production-scale evaluation.\n- Naive clock-time checks treat any time before 11:00 as a violation, including negative phrasing like *\"I can't do before 11am\"* .\n- Naive attachment checks flag any `\"attach\"` substring, including*\"I can't attach\"* .\n- 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.\n\n## \n  \n  \n  Inspect the Benchmark Logs\n\nThe 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:\n\n👉 **[agency-client-memory-benchmark on GitHub](https://github.com/shreemurno-source/agency-client-memory-benchmark)**", "url": "https://wpnews.pro/news/building-structured-client-memory-and-deterministic-rule-checking-tools-for-b2b", "canonical_source": "https://dev.to/murno/building-structured-client-memory-and-deterministic-rule-checking-tools-for-b2b-agencies-10e1", "published_at": "2026-12-06 17:32:16+00:00", "updated_at": "2026-12-06 17:44:30.528373+00:00", "lang": "en", "topics": ["large-language-models", "ai-agents", "ai-tools", "ai-research"], "entities": ["Ollama", "qwen2.5:7b", "Murno", "GitHub"], "also_reported_by": [], "takeaway": "Extracting standing rules into a structured rulebook and pairing it with deterministic post-guards hit 100% (45/45) on buried-rule checks versus 98% unguarded, while cutting context per reply from 2,622 to 906 characters.", "recommendation": {"advice": "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.", "playbook": "evals-testing", "playbook_url": "https://wpnews.pro/playbooks/evals-testing"}, "alternates": {"html": "https://wpnews.pro/news/building-structured-client-memory-and-deterministic-rule-checking-tools-for-b2b", "markdown": "https://wpnews.pro/news/building-structured-client-memory-and-deterministic-rule-checking-tools-for-b2b.md", "text": "https://wpnews.pro/news/building-structured-client-memory-and-deterministic-rule-checking-tools-for-b2b.txt", "jsonld": "https://wpnews.pro/news/building-structured-client-memory-and-deterministic-rule-checking-tools-for-b2b.jsonld"}}