Core concepts
Action rules
Rules fetched at the moment the agent performs an action.
Preferences about how to perform an action, commit message style, PR format, push policy, never surface through topic recall because they share no words with the task at hand. Action rules are the third retrieval channel: the rules that govern an action are fetched at the moment the agent performs that action, not by similarity to the conversation.
Store a rule
Hosted, no tag is needed: store the rule as a procedure, correction, or anti pattern and it is matched by meaning (see below). The embedded Python SDK release on PyPI still uses a tag lookup, so there the tag is the contract: trigger:<action> in lowercase kebab case, for example git-commit, pr-create, git-push, code-write.
db.store(
"commit messages: single line, conventional prefix",
memory_type="procedural",
tags=["trigger:git-commit"],
)Fetch at the moment of the action
Hosted, call the get_action_rules tool with your mdb_ key and an actionargument describing what is about to happen (the command, the intent). The engine recalls the rules that bear on it by meaning, ranks procedures and corrections first, excludes superseded rules, and needs no fixed list of action names. Embedded, the Python SDK's recall_for_action is a deterministic tag lookup: no embedding, no model call, superseded rules excluded, newest first.
rules = db.recall_for_action("git-commit", k=6)
for r in rules:
print(r["content"])curl -X POST https://api.mentedb.com/mcp/v1/tools/call \
-H "Authorization: Bearer $MENTEDB_API_KEY" \
-H "content-type: application/json" \
-d '{"name":"get_action_rules","arguments":{"action":"about to run git commit -m \"fix auth\""}}'Claude Code does this automatically
The connector installs a PreToolUse hook that sends each Bash command to MenteDB right before it runs (a git commit, a gh pr create, anything) and injects the rules that bear on it as context. It never blocks or approves commands, gives up after 1.5 seconds, and on any failure stays silent so your workflow is never interrupted. Corrections behave like every other memory: supersede a rule and the old version stops firing at the next commit.