Quickstart
1. Install
pip install driftguard-ai
python -m spacy download en_core_web_sm
2. Record a mistake
from driftguard import DriftGuard
guard = DriftGuard()
guard.record(
action="increase salt",
feedback="too salty",
outcome="dish ruined",
)
3. Review before acting
review = guard.before_step("add more salt")
if review.warnings:
print(review.warnings[0].risk)
# → "too salty"
print(review.confidence)
# → 0.82
DriftGuard matched "add more salt" semantically to "increase salt" and surfaced the stored warning.
4. Check graph stats
print(guard.stats())
# → {'nodes': 3, 'edges': 2}
5. Prune stale memories
guard.prune()
6. Run the MCP server
driftguard-mcp
What just happened
record()stored the causal chainaction → feedback → outcomeinto the in-memory semantic graph and persisted it to disk.before_step()embedded the query, retrieved similar action nodes, walked their causal chains, and returned ranked warnings.- The graph persists across restarts — DriftGuard remembers between sessions.
Next steps
- Configure Guard Policies to block or acknowledge risky steps
- Connect the MCP Server to Claude Desktop or any MCP client
- Drop the LangGraph Adapter into your planner graph
- Tune Configuration for your similarity thresholds and storage backend