Skip to main content

mem0 extraction optimizer: diagnose failures and generate custom prompts for your system

Project description

zer0lint

AI memory extraction diagnostics. Find out why your AI agent forgets what matters — and fix it.

PyPI version Python 3.9+ License Made by Hermes Labs


The Problem

You set up mem0 (or Zep, or LangMem) and your AI agent still seems forgetful. Technical decisions, version numbers, experiment results — it stores them, but can't recall them.

Why? mem0's default extraction prompt is designed for personal assistants: favorite coffee shops, dietary preferences, weekend plans. When your agent stores "Redis upgraded to v7.2.4" or "security audit scored 7.2/10", it silently drops the specifics.

Proven gap (our testing):

  • Default mem0 prompt → 70% recall on technical facts
  • Wrong domain prompt (personal) → 40% recall
  • zer0lint technical prompt → 90% recall

That's a +20pp improvement from getting the extraction prompt right.


Quick Start

pip install zer0lint

# Check your current extraction health
zer0lint check --config ~/.mem0/config.json

# Diagnose and fix
zer0lint generate --config ~/.mem0/config.json

# Dry run (see what would change without applying)
zer0lint generate --config ~/.mem0/config.json --dry-run

What It Does

zer0lint check

Tests your current mem0 config against domain-relevant synthetic facts. Returns a score and status.

zer0lint v0.2.0 — extraction health check
Config : ~/.mem0/config.json
Model  : qwen3.5:4b
Prompt : default (mem0 built-in)

Score  : 4/5 (80%) — HEALTHY

  ✅ Version update
  ✅ CI status
  ✅ Model upgrade
  ✅ Configuration
  ⚠  API endpoint

Statuses: HEALTHY (≥80%) · ACCEPTABLE (60–79%) · DEGRADED (40–59%) · CRITICAL (<40%)

zer0lint generate

3-phase diagnostic + fix:

  1. Baseline — test your config as-is
  2. Re-test — inject zer0lint's domain-aware extraction prompt at config level
  3. Apply — if improved, write the validated prompt to your config
zer0lint v0.2.0 — extraction optimizer

[1/3] Baseline — testing current config as-is...
  Baseline score: 4/5 (80%)

[2/3] Re-testing with zer0lint technical extraction prompt...
  Improved score: 5/5 (100%)
  Improvement: +20pp

Results:
  Before : 4/5 (80%)
  After  : 5/5 (100%)
  Δ      : +20pp

✅ Fix applied to config.
   Backup: ~/.mem0/config.backup.2026-03-23T14:20:00

Why Config-Level Injection Matters

Important finding: In mem0 v1.x, passing a prompt via memory.add(..., prompt=X) has no measurable effect on retrieval quality. The extraction prompt must live in the config (custom_fact_extraction_prompt field) to actually work.

zer0lint writes the validated prompt directly to your config — this is the correct fix.


Supported Systems

System Status Notes
mem0 (v1.x) ✅ Supported Full check + generate
Zep / Graphiti 🔜 Planned v0.3
LangMem 🔜 Planned v0.4
Generic adapter 🔜 Planned BYOC callables

Test Results (2026-03-23)

Horse race across models (5 technical + research facts):

Model Default prompt zer0lint prompt Δ
qwen3.5:4b 80% 100% +20pp
mistral:7b 40% 40% 0pp

mistral:7b produces malformed JSON regardless of prompt — model quality is the bottleneck. zer0lint detects this and recommends switching models.

Scale test (10 facts, 5 domains):

Score %
Default 7/10 70%
zer0lint 9/10 90%

Installation

# From PyPI (recommended)
pip install zer0lint

# From source
git clone https://github.com/roli-lpci/zer0lint
cd zer0lint
pip install -e .

Requirements: Python 3.9+, mem0 v1.x, an Ollama or cloud LLM configured in your mem0 config.


How It Works

zer0lint reads your existing mem0 config, borrows whatever LLM you already have configured, and runs a controlled recall test. No new API keys, no new models, no cloud calls beyond what you already have.

The extraction prompt it generates is domain-aware — tuned for technical/research work rather than personal assistant use cases. It's validated against synthetic facts before being applied, and your original config is always backed up.


Built by Hermes Labs

zer0lint is part of the Hermes Labs AI agent tooling suite:

  • lintlang — Static linter for AI agent tool descriptions and prompts
  • Little Canary — Prompt injection detection
  • Suy Sideguy — Runtime policy enforcement for agents
  • zer0lint — Memory extraction diagnostics ← you are here

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zer0lint-0.2.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zer0lint-0.2.0-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file zer0lint-0.2.0.tar.gz.

File metadata

  • Download URL: zer0lint-0.2.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for zer0lint-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c16bb3736409d7917a8551b3b5457a86b751bc1fcc7fb5dd6145bc84cf9f0c3e
MD5 7432e9084052adbd9ce00118c00feccc
BLAKE2b-256 77d8798d77e4e68486aa2d0fb6c7b9465223868407f14557960caae7d2256539

See more details on using hashes here.

File details

Details for the file zer0lint-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: zer0lint-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for zer0lint-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc1d79d8f7cbe454f9dfb21c524e94e221aa5443531600900c2987b47b043e25
MD5 659f29413c3fa9a101f3fd592d2b2831
BLAKE2b-256 d3b30c4c27038c626149dca7b3c1b4ea85e39c0bb93a0062482855a6f7183b09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page