Inspiration## Inspiration

AI systems forget their corrections. A user can fix a stale answer today, yet the same RAG pipeline, chatbot, or coding agent repeats it tomorrow. The correction stays trapped in one conversation. MemoSprout turns that fleeting feedback into verified, portable knowledge.

What it does

MemoSprout is a domain-agnostic correction intelligence layer for any LLM application:

  1. Capture — processMessage() detects a natural-language correction and extracts a structured candidate.
  2. Gate — corrections are suggested first, validated against a domain-specific oracle, and explicitly approved before activation.
  3. Store — approved corrections live as Markdown with YAML frontmatter: human-readable, git-versionable, and portable.
  4. Deliver — context() injects relevant corrections before generation, while check() blocks known-wrong answers afterward.

The core is domain-agnostic. Adapters define how corrections are captured, validated, and delivered for enterprise RAG/chat, coding agents, finance, support, or any workflow where humans verify AI output.

How we built it

MemoSprout is an open-source TypeScript package built with Zod, deterministic file and JSON fixtures, Vitest, and a local-first Markdown store. It includes an npm library, CLI, REST API, and MCP server. The matching pipeline combines deterministic lexical checks with an optional semantic pass. Validation is deliberately separate from extraction: the generator never judges its own correction.

It supports 13 provider configurations through one interface, including OpenAI, Anthropic, DeepSeek, Qwen, Kimi, Xiaomi MiMo, MiniMax, Groq, Together AI, OpenRouter, Ollama, and generic OpenAI- or Anthropic-compatible endpoints.

Challenges

The hard part was not saving text; it was deciding when a correction is safe to reuse. We designed explicit lifecycle states, contradiction quarantine, source-aware validation, and approval gates so untrusted feedback cannot silently poison future prompts. We also had to prevent false positives: numeric values match exactly, and the gate does not block an answer that already contains the corrected value.

What we learned

Correction memory needs both retrieval and enforcement. Context injection alone can still be ignored by a model; an output gate alone lacks the right answer. Together they create a dependable correction loop. Deterministic oracles also matter: evaluation should not use one LLM to certify another LLM's answer.

Evidence

In our stale-context stress test across six live endpoints from five vendors, the unprotected baseline scored 0% by design. With MemoSprout retrieval plus gating, results ranged from 17% to 89%, and corrections transferred across providers in 43 of 50 cases. The evaluation also exposed two real bugs in our own gate, both documented in the repository.

What's next

Next we will deepen RAG integrations, add source-document adapters, expand multilingual evaluation, and make approval workflows easier to embed in existing enterprise chat systems.

Built With

Share this project:

Updates