Lion Cipher Lab

Stop a threat-hunting agent at the right time with a sequential probability ratio test

Why it matters

A threat hunt is a run of questions: did this host spawn an odd child process, does it beacon, did someone clear its security log. An AI hunting agent asks those questions one at a time, and every question costs something - a query against the SIEM, an API call, tokens, an analyst's attention when it escalates. So the agent has to decide, after each answer, whether it has seen enough. Stop too early and you get the classic System 1 mistake that clinicians call premature closure: the first scary indicator becomes the verdict, or three quiet answers become 'clean'. Always ask a fixed number of…

What you'll learn

Steps in this lab

  1. The words first: hunt, indicator, likelihood, log-likelihood ratio, false positive and negative, alpha and beta, premature closure, SPRT - and the fact that the agent is a stub
  2. Open a terminal, check Python, make a scratch folder (Windows, macOS, Linux)
  3. Build the keyed hosts: 400 hosts, 100 compromised, 40 evidence results each
  4. Write the stub hunting agent: premature closure, fixed-N and SPRT
  5. The agent is a STUB, and here is its whole behaviour in writing
  6. Measure: false-positive rate, false-negative rate and queries per host for every policy
  7. Read it honestly: what the table proves and what it does not
  8. Break it twice: echoed evidence and wrong likelihoods, and what each repair buys
  9. Cap the queries: what 'undecided - escalate to a human' costs at each cap
  10. When, why, and how a pro does it differently
  11. Ship it: the policy, what to log, and how to see what the stub is doing

Open the full interactive lab →