Build notes · AI Architecture & Maturity Framework

Klaros Pragmatic AI Maturity: A Situational Agentic Framework for WhatsApp CRM

· AI Architecture & Maturity Framework · Founder, Klaros

The recent industry discourse around AI agent architecture—most prominently articulated at events like the YC Harness Club—focuses heavily on autonomous multi-agent swarms, self-improving prompt harnesses (DSPy), and open-ended Recursive Language Models (RLM). While these paradigms drive massive breakthroughs for coding benchmarks, applying unconstrained agentic swarms to commercial WhatsApp CRM messaging is a dangerous anti-pattern.

The short version

  • Rules First: Klaros evaluates outreach through an 8-level priority tree in agent-decision.mjs. Human staff takeover triggers a 24-hour AI pause to ensure reps are never interrupted.
  • Zero-Token Caching: In learned-answer.mjs, repeat operator responses are served via Jaccard similarity at Stage 8000 ahead of the LLM at Stage 9000, delivering $0 token costs and sub-10ms latency.
  • Local Model Resiliency: json-repair.mjs normalizes code fences, trailing commas, and unescaped newlines from local Ollama/Qwen models in <0.5ms before JSON validation.

1. The Harness Paradigm: Hype vs. Commercial WhatsApp Realities

At the YC Harness Club event, researchers demonstrated how scaffolding (memory, tool REPLs, sub-agent coordination) can raise a static model's benchmark performance on ARC-AGI from 30% to 95–100%. However, commercial WhatsApp messaging in Klaros operates under strict real-world constraints:

2. The Klaros 5-Tier Situational AI Maturity Framework

Klaros evaluates every AI capability against a situational maturity ladder. We adopt agentic complexity only when business requirements demand it AND fail-closed guardrails are fully enforced:

Test the Klaros AI Engine Live on WhatsApp

Want to experience zero-token caching, sub-10ms responses, and fact-fenced auto-replies in action?

Message our live line with "ai-demo" →

3. Shipped Capabilities: Priority Trees, $0 Caches & JSON Repair

In agent-decision.mjs, Priority 1 evaluates detectOfflineConversation(). If human staff interacted in the last 8 hours, AI automation yields for 24 hours.

Calculate how much your business saves with zero-token caching using our interactive WhatsApp Cost Savings Calculator.

Code Blueprint: src/shared/json-repair.mjs Pre-Validation Engine

export function repairJsonString(raw) {
  if (typeof raw !== 'string') return '';
  let str = raw.trim();
  // 1. Strip markdown code fences
  str = str.replace(/^```(?:json)?\s*/i, '').replace(/\s*```$/i, '').trim();
  // 2. Extract balanced JSON braces
  const start = str.indexOf('{'), end = str.lastIndexOf('}');
  if (start !== -1 && end > start) str = str.slice(start, end + 1);
  // 3. Remove trailing commas before closing braces
  str = str.replace(/,\s*([\}])\}/g, '$1');
  return str;
}

4. Future Capabilities: Multi-Turn Goals & Closed-Loop Optimization

Klaros is rolling out Tier 3 bounded multi-turn slot collection (Q4 2026) to prevent off-hours booking drop-off, followed by Tier 4 closed-loop review queue prompt optimization (H1 2027) to auto-tune system prompts from operator edits.

5. Benchmarking Klaros against YC Harness Club Projects

Comparing Klaros against YC Harness Club projects:

6. Klaros Codebase Architecture Map

Key files in the Klaros AI architecture:

Get the next build note on WhatsApp

Message our line and type NOTES. The latest engineering note comes straight back in the thread.

Send NOTES on WhatsApp

Experience the Klaros AI Engine First-Hand

Not a sales form. Message our live line and type pricing or ai-demo. You will receive our live catalog, real-time availability slots, and instant zero-token answer resolution.

Questions about the Klaros AI maturity framework

Why does Klaros use a fail-closed priority tree instead of unconstrained LLM agent loops?

On official WhatsApp Cloud APIs, freeform messages must adhere to Meta's 24-hour service window, and unvetted automated messages can trigger spam blocks. Klaros runs an 8-level heuristic priority tree in agent-decision.mjs to enforce human staff takeover detection, opt-out checks, and sequence rules before invoking an LLM.

How does the zero-token learned answers cache work in Klaros?

Verified operator responses from the review queue are stored in knowledge_answers. Inbound queries are tokenized and scored using Jaccard term similarity (MATCH_FLOOR = 0.6) at Stage 8000 in learned-answer.mjs. Matches are served instantly at $0 token cost ahead of the LLM model at Stage 9000.

What is the Pre-Validation JSON Repair Engine in json-repair.mjs?

Local desktop installations running smaller open models (like Ollama llama3.2:3b or Qwen) often produce minor markdown code fences, trailing commas, or unescaped newlines. repairJsonString() normalizes malformed JSON in <0.5ms before schema validation, preventing false-positive human handoffs.

How does Klaros compare to YC Harness Club autonomous swarms?

YC Harness Club projects like Prime Agent and OpenJarvis focus on open-ended research or coding swarms where trial-and-error is acceptable. Klaros prioritizes sub-2-second latency, fail-closed customer safety, and $0 zero-token caching, reserving multi-agent swarms strictly for optional back-office ERP tasks.

What is the roadmap for Klaros AI agent capabilities?

Klaros is rolling out Tier 3 bounded multi-turn slot collection (Q4 2026) for 24/7 appointment bookings, followed by Tier 4 closed-loop review queue prompt optimization (H1 2027) to refine system prompts automatically based on operator edits.

Written 8 September 2026. We append when the facts change. Related: Klaros chatbot as-is AI architecture, Klaros autonomous AI agent to-be architecture, all build notes.