Catching AI-generated code that violates an ADR.
A Python coding agent proposes a locally reasonable but architecturally invalid import. Mneme retrieves the relevant ADR and flags the violation. The corrected import checks clean against the same corpus. The sequence below is the canonical enforcement loop; the runnable script performs the two checks deterministically.
ADR-005 separates brand identity from package namespace.
MnemeHQ is the GitHub org, the website, and the LinkedIn page — so an agent confidently writes from MnemeHQ.memory_store import …. The decision declares MnemeHQ a forbidden dependency; the installable package namespace is mneme.-
1 · DecisionADR-005 · project_memory.jsonBrand vs package namespace enforcement.
FORBID_DEPENDENCY: MnemeHQ— the compiled record the agent answers to, not a prompt-file plea. -
2 · Guidancepre-generation retrievalBefore the agent writes code, the retriever scores the task against the corpus and surfaces the relevant decision into its context.
-
3 · Violationagent proposes
from MnemeHQ.memory_store import MemoryStore— the brand name, not the package. Locally reasonable; architecturally invalid. -
4 · WarnWARNmneme check --mode warn
WARN [ADR-005] constraint "no MnemeHQ" -- trigger: mnemehq Brand vs Package Namespace Enforcement Use package namespace: mneme Result: WARN
-
5 · Correctionretry against the decisionThe agent receives ADR-005 and the compliant alternative, and regenerates:
from mneme.memory_store import MemoryStore. -
6 · AllowPASSsame corpus, second check
[ADR-005] import compliant — mneme namespace confirmed.The corrected import checks clean against the same corpus that caught the violation.
Illustration of the enforcement loop. The runnable script performs the two checks (violation, then corrected file) deterministically; the regeneration in between is the loop the hook drives in a live agent session.
Run it yourself
git clone https://github.com/MnemeHQ/mneme
cd mneme
pip install -e .
python examples/demo-adr-import.py
The final step prints the WARN verdict above. Edit an ADR in docs/adr/ and rerun — the next verdict reflects your edit.
What happened
- The agent proposed
from MnemeHQ.memory_store import MemoryStore— the brand name, not the package. - ADR-005 fired with its decision ID, the forbidden token, and the compliant alternative.
- The corrected import (
from mneme.memory_store import MemoryStore) was checked independently against the same corpus and passed.
Ready to try it?
Install the CLI and check your first decision in under a minute.
pip install mneme-hq