These lessons are meant to be followed in order, from start to finish, and each one ends with something that works. Tutorials 2 and 3 extend the work of the one before. Tutorial 4 only needs Tutorial 1, and Tutorials 5 and 6 need Tutorial 3.
- Your first guarded tool. Put LeanGuard in front of a small notebook service and watch it refuse, ask for approval, and remember its decisions across a restart. Python only.
- Your own policy, with a proof. Write a Lean policy for the same notebook, run it, and prove what it allows.
- Rules that depend on time. Add an approval that expires and an hourly limit, and move the clock to watch them take effect.
- Delegating to other agents. Give a planner a budget, let it delegate to two readers, and revoke a grant.
- Checking an old conversation against a new policy. Save a conversation to a file and replay it against the notes policy.
- Guarding an agent over MCP. Serve the notebook to an agent over MCP, first a script and then Claude Code.
You need a LeanGuard checkout where bash scripts/setup.sh has finished; see
Try it in the main README.