Lion Cipher Lab

Build a local chatbot and wrap it in safety guardrails

Why it matters

Reading about guardrails and building one are different kinds of understanding, and only the second one sticks. This lab gives you the smallest real thing worth protecting — a chatbot: a program that holds a back-and-forth conversation by sending your messages to a language model and showing you its replies — running entirely on your own machine with Ollama, so there is no bill, no API key, and no data leaving your computer. Then you wrap it in layers, one at a time, and watch each one change the app's behavior. First a system prompt (the model's standing instructions, set by you rather than…

What you'll learn

Steps in this lab

  1. What you're building, in one breath
  2. Install Ollama and pull a small model
  3. The minimal chat loop (no guardrails yet)
  4. Layer 1 — a system prompt that sets role and refusal policy
  5. Layer 2 — an input guard against injection and off-scope requests
  6. Layer 3 — an output guard for leaks and refusal patterns
  7. Layer 4 — logging and a human-escalation path
  8. Test it — benign first, then adversarial
  9. Layers reduce risk — they are not a guarantee

Open the full interactive lab →