TemplateAdapter (eme.py)

Mnemon · ai, execution-cache, plan-cache, fingerprint-matching, llm-caching

Mnemon Execution Memory Engine (EME) — v2 Generalised plan cache for any expensive recurring computation. System 1: exact fingerprint match — zero LLM, sub-millisecond System 2: partial segment match — gap fill with windowed context Fragment library: proven segments accumulate ac

"""
Mnemon Execution Memory Engine (EME) — v2
Generalised plan cache for any expensive recurring computation.

System 1: exact fingerprint match — zero LLM, sub-millisecond
System 2: partial segment match — gap fill with windowed context
Fragment library: proven segments accumulate across all templates

Architecture by Mahika Jadhav (smartass-4ever).

v2 bug fixes:
  [BUG-1] tokens_saved=0 on all-segments-matched System 2 path.
          The early-return block was missing tokens_saved and latency_saved_ms.
          Both defaulted to 0 even when all segments were successfully reused.

  [BUG-2] System 2 write-back was fire-and-forget (asyncio.create_task).
          The cache write could complete AFTER the next agent call arrived,
          causing Step 4 to re-enter System 2 instead of hi

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key