{"slug": "how-mneme-governs-ai-generated-code-before-the-model-writes-a-line", "title": "How Mneme governs AI-generated code before the model writes a line", "summary": "Mneme, a new open-source tool, governs AI-generated code by enforcing project decisions before the model writes a line. It reads existing architectural decisions and checks tasks against them, preventing architectural drift. The tool runs locally in under two minutes and is available on GitHub.", "body_md": "LLMs start every call from zero. They reintroduce a library you dropped six months ago, rebuild a component you chose to keep small, and contradict decisions your team already settled. Each violation reads as reasonable on its own. Stack them across a week of agent sessions and you get architectural drift.\n\nMneme works at the prompt boundary. It reads the decisions your project already made and checks the task against them before the model generates anything. The repo ships Layer 1: local-repo, single-developer, project-scoped governance. Here is the shape.\n\nFive stages, running locally in under two minutes:\n\n```\nproject_memory.json → MemoryStore → Retriever → ContextBuilder → LLMAdapter → Evaluator\n```\n\n`project_memory.json`\n\n`MemoryStore`\n\n`Retriever`\n\n`ContextBuilder`\n\n`LLMAdapter`\n\n`Evaluator`\n\nA second path adds `conflict_detector`\n\n, which scans the response after generation, and an ADR compiler (`adr_parser`\n\nthen `adr_compiler`\n\n) that turns ADR files with YAML frontmatter into the corpus and resolves precedence between decisions that disagree.\n\nThe demo runs each task twice, once with no governance and once with the corpus enforced, so you read the delta yourself.\n\nRAG retrieves documents to inform an answer. Mneme retrieves decisions to constrain one.\n\n| RAG | Mneme | |\n|---|---|---|\n| Input | Documents, chunks, embeddings | Rules, constraints, decision records |\n| Goal | Inform the response | Shape the response |\n| Output | The model knows more | The model follows what you decided |\n| Test | \"Did it cite the right source?\" | \"Did it respect the constraint?\" |\n\nNo vector store, no agent loop. The corpus stays small, structured, and yours.\n\nThe freeze pins the retrieval mechanics, enforcement semantics, and benchmark methodology at commit `e73ff7d`\n\n. The open exit criterion is real-world validation with design partners. Several things sit outside the wedge on purpose, not on a backlog:\n\nThe benchmark carries the same restraint. It is a regression instrument, not a generalization claim: canned model responses, fixed retrieval, two-layer scoring, today at 7/7 scenarios and recall@3 = 1.00. Its job is to make any change to retrieval or enforcement visible, so no regression lands unseen.\n\nLayer 1, the benchmark suite, and an example corpus are public at ** https://github.com/MnemeHQ/mneme**. The concepts behind the design (governance before generation, architectural drift, verification contracts) are defined at", "url": "https://wpnews.pro/news/how-mneme-governs-ai-generated-code-before-the-model-writes-a-line", "canonical_source": "https://dev.to/mnemehq/how-mneme-governs-ai-generated-code-before-the-model-writes-a-line-2noa", "published_at": "2026-06-29 13:58:30+00:00", "updated_at": "2026-06-29 14:19:05.059846+00:00", "lang": "en", "topics": ["developer-tools", "large-language-models", "ai-agents", "generative-ai", "artificial-intelligence"], "entities": ["Mneme", "MnemeHQ", "GitHub"], "alternates": {"html": "https://wpnews.pro/news/how-mneme-governs-ai-generated-code-before-the-model-writes-a-line", "markdown": "https://wpnews.pro/news/how-mneme-governs-ai-generated-code-before-the-model-writes-a-line.md", "text": "https://wpnews.pro/news/how-mneme-governs-ai-generated-code-before-the-model-writes-a-line.txt", "jsonld": "https://wpnews.pro/news/how-mneme-governs-ai-generated-code-before-the-model-writes-a-line.jsonld"}}