Native integration · Shipped

Mneme HQ + LangChain / LangGraph

Deterministic architectural governance for LangChain agents running on LangGraph. Mneme injects architectural context before model calls and evaluates supported filesystem mutations before execution using the same Mneme enforcement engine as every other integration — exposed as agent middleware your application controls.

Status: native, shipped, bounded

The integration merged on August 25, 2026 (PR #331) and lives at mneme/integrations/langchain/adapter.py, installable with the extra pip install "mneme-hq[langchain]". It implements LangChain’s agent middleware API (wrap_model_call, wrap_tool_call, awrap_tool_call) and is validated against exact pinned versions:

These are the validated pins. No generic version compatibility is claimed or implied beyond them.

The architectural boundary, precisely: the middleware translates LangChain events into existing Mneme semantics — retrieval is the unchanged DecisionRetriever path shared with the Claude Agent SDK adapter, and enforcement is the unchanged mneme check contract shared with the Claude Code hook. It does not implement a second policy or enforcement engine.

How it works

project_memory.json
    
Mneme decision retrieval
    
wrap_model_call
    
architectural context injected
    
LangChain agent
    
write_file / edit_file
    
wrap_tool_call / awrap_tool_call
    
mneme check --target-path
    
ALLOW / WARN / DENY

Sync and async loops behave identically: invoke goes through wrap_tool_call, ainvoke through awrap_tool_call, with the same policy applied. In strict mode, trusted WARN/FAIL verdicts deny the mutation before the tool handler runs and return rejection feedback to the model as the tool result. In warn mode the handler executes with a visible governance result carried on the tool output. Degraded evaluation fails open visibly: an unevaluated mutation is never silently reported as governed.

Supported surface

This integration is precise about what it governs and what it does not:

SurfaceStatus
wrap_model_callContext injection — retrieved decisions appended before model calls.
wrap_tool_callSync pre-tool enforcement.
awrap_tool_callAsync pre-tool enforcement.
write_fileGoverned. Full proposed content checked.
edit_fileGoverned. Only the introduced delta is checked (ADR-018).
Trusted strict WARN / FAIL verdictDenied before the handler runs; rejection feedback returned to the model.
Warn modeHandler executes with a visible governance result on the tool result.
Degraded evaluationFails open visibly: UNEVALUATED marker, never silent.
execute / shell surfacesNot governed. Out of scope for this milestone.
Arbitrary custom toolsNot governed. The tool map is deliberately closed.
Raw StateGraph custom ToolNodesBypass surface. Applications that wire their own execution nodes can bypass any middleware.
Remote / virtual filesystem semanticsUnsupported / unvalidated. Same-named tools over virtual backends are intercepted, but local-path semantics may not describe the actual mutation target there.

A compiled, middleware-equipped agent remains governed when embedded as a node or subgraph in a larger graph — that composition was proven empirically in validation. What Mneme claims no opinion over are nodes it cannot intercept.

What this integration is not

Evidence

Deterministic guardrails inside LangChain agents

Open-source. Repo-native. Architectural context before generation and deterministic enforcement before disk — with every boundary on this page stated rather than implied.