Mneme blocks five classes of governance violation before code is generated: architecture, workflow, security, dependency, and platform. Each rule maps a forbidden pattern to a deterministic verdict, so AI agents cannot ship the violation in the first place.
What Mneme prevents

Governance violations Mneme catches before generation

Concrete examples of the architectural decisions Mneme enforces against. These are not generic lint rules — they are organizational decisions encoded as structured constraints, injected into the agent's context, and checked at the file-write seam before the code exists.

The frame. Mneme injects your organization's architectural decisions into AI-assisted generation workflows. Each example below is a decision the team has already made — an ADR, a layering rule, a security policy, an ownership boundary — that Mneme keeps the agent honest about. The decision corpus is the source of truth; the violations below are what happens without it.
Category 01

Architecture governance

Layer boundaries, forbidden patterns, deprecated architectures. The decisions that define how the system is shaped — not what it does, but how its parts are allowed to relate.

01

Forbidden architecture patterns

Rule. Do not access BigQuery directly from frontend routes.

// AI generates inside a Next.js API route
const client = new BigQuery();
forbidden dependency ADR violation architectural boundary breach

Enforced pattern. The frontend route calls a backend service over HTTP; only the backend holds the BigQuery client.

// compliant - the route fetches from a backend endpoint, no DB client in the frontend
export async function GET() {
  const res = await fetch(`${process.env.API_URL}/reports/summary`);
  return Response.json(await res.json());
}
02

Layer boundary violations

Rule. Controllers must not contain business logic.

@app.post("/checkout")
def checkout():
    # pricing logic
    # tax logic
    # inventory logic
logic in presentation layer missing service abstraction

Enforced pattern. The controller stays thin and delegates pricing, tax, and inventory to a service.

# compliant - business logic lives in the service layer
@app.post("/checkout")
def checkout(cart: Cart):
    return checkout_service.place_order(cart)
03

Unauthorized framework introduction

Rule. React app standardized on Zustand. No Redux.

import { createStore } from "redux";
non-approved state management stack divergence

Enforced pattern. State management uses the approved library, Zustand.

// compliant - uses the standardized Zustand store
import { create } from "zustand";
const useStore = create((set) => ({ count: 0 }));
Category 02

Workflow governance

Protected directories, ownership boundaries, migration restrictions, prompt-level policies. The decisions that govern who — or which agent — is allowed to touch what.

04

Monorepo scope violations

Rule. Billing agent cannot modify the auth package.

# AI agent edits
packages/auth/*
scoped ownership breach out-of-domain modification

Enforced pattern. The billing agent edits only its own package and consumes auth through its published interface.

# compliant - edits stay inside the owned package
packages/billing/*
# auth is imported, never modified
import { verifyToken } from "@org/auth";
10

Agent workflow violations

Rule. Codegen agents cannot write directly to production migration folders.

# Agent modifies
db/prod/migrations/*
restricted execution scope protected path mutation

Enforced pattern. The agent writes proposed migrations to a staging directory; promotion to the production path is a human-gated step.

# compliant - agent writes to the reviewable staging path only
db/staging/migrations/*
# a maintainer promotes to db/prod/migrations/ after review
11

Prompt-level governance

Rule. Do not generate mock auth implementations.

# User prompt
"Just create a quick fake JWT validator."
policy conflict before generation governance-before-generation

Enforced pattern. The agent declines the mock and wires in the vetted auth library to verify real tokens.

# compliant - real verification, no fake validator
from app.auth import verify_jwt

def authenticate(token: str) -> User:
    return verify_jwt(token)  # signature + expiry checked
Category 03

Security governance

Unsafe query construction, credential handling, insecure auth patterns. The decisions where a violation is not just architectural debt but a vulnerability the team has already chosen not to ship.

05

Security policy violations

Rule. No raw SQL string concatenation.

query = f"SELECT * FROM users WHERE id = {user_id}"
unsafe query construction secure coding rule breach

Enforced pattern. The user input is bound as a parameter, never interpolated into the SQL string.

# compliant - parameterized query, no string interpolation
cursor.execute(
    "SELECT * FROM users WHERE id = %s",
    (user_id,),
)
Category 04

Dependency governance

Banned libraries, licensing constraints, version pins, and the supersession history of decisions the team has already revisited. Dependencies are decisions; Mneme treats them as such.

08

Dependency licensing

Rule. No GPL dependencies.

// AI adds to package.json
"some-gpl-library": "^2.1.0"
licensing policy violation approved-list deviation

Enforced pattern. The dependency is swapped for an approved permissively-licensed (MIT or Apache-2.0) equivalent.

// compliant - MIT-licensed library from the approved list
"some-mit-library": "^3.0.0"
09

ADR supersession violations

Rule. ADR-002: all async jobs use Pub/Sub. (Supersedes an older ADR that allowed Celery.)

from celery import Celery
superseded decision outdated architecture pattern precedence-aware enforcement

Enforced pattern. Async work is dispatched through Pub/Sub, the decision that supersedes Celery.

# compliant - ADR-002: publish to Pub/Sub instead of Celery
from google.cloud import pubsub_v1

publisher = pubsub_v1.PublisherClient()
publisher.publish(topic_path, payload)
Category 05

Platform governance

Observability requirements, infra standards, deployment policies, API contracts. The decisions platform teams ship to keep services consistent across the org.

06

Infra governance violations

Rule. All infrastructure changes must use Terraform modules.

gcloud compute instances create ...
bypassing approved infra workflow untracked change surface

Enforced pattern. The instance is declared in a Terraform module and applied through the reviewed pipeline, not an imperative CLI call.

# compliant - declarative Terraform, applied via CI
module "api_instance" {
  source        = "./modules/compute"
  machine_type  = "e2-standard-2"
}
07

API contract violations

Rule. Internal APIs must version under /v1/.

@app.route("/users")
routing convention breach API governance mismatch

Enforced pattern. The route is namespaced under the required /v1/ version prefix.

# compliant - versioned under /v1/
@app.route("/v1/users")
12

Organizational consistency violations

Rule. All services must emit OpenTelemetry traces.

# AI creates a new service with no tracing middleware
def create_app():
    app = FastAPI()
    return app
observability standard breach platform compliance failure

Enforced pattern. The service is instrumented with OpenTelemetry before it is returned.

# compliant - emits OpenTelemetry traces
def create_app():
    app = FastAPI()
    FastAPIInstrumentor.instrument_app(app)
    return app

The distinction that matters. Mneme injects organizational architectural decisions into AI-assisted generation workflows. The examples above are not static lint rules; they are decisions the team has already made, in the form the agent needs to see them, at the moment it is about to generate.

This is the difference between "we scan for bad code" and "we keep the agent honest about the decisions you've already made." The first is a check after the fact. The second is the layer that makes drift structurally harder.