All lessons › Function D — Agentic Evaluation and Red Teaming › One Red-Team Lifecycle, End to End
D1.6

High-concurrency detection engineering

D1
▶
Lightboard recording

Not recorded yet. The lesson below is complete and runnable today — the video is added later without touching this page.

Video placeholderpublishes automatically from recordings/D1.6.mp4

The lab

Score candidate detection rules on precision, recall and the queue volume each one would add.

◉Use case relevance

A rule that flags an unauthorised runtime objective before compromise is worth a great deal, and the same rule firing on everything is worth less than nothing. Which one you built is decided by the volume it adds to the queue, not by its recall.

At CyberTravels. Take a rule with 98% precision and run deployable() at 100 events a day and at 100,000. The precision is identical; the second needs five analysts and has one. That rule will be muted, and the coverage report will still count it — which is why this lesson reports a volume rather than a ratio.

◴What this lesson is — Day 0, Day 1, Day 2

Why a rule's precision is the wrong thing to report to the people who have to work it. The same rule at two volumes, with the alert count and the analyst-days it implies — and the rule that gets muted while coverage still counts it.

Day 0 — why

A rule that flags an unauthorised runtime objective is worth a great deal; the same rule firing on everything is worth less than nothing.

Day 1 — how

Generate candidates, then score each against real history on the one property that decides deployability — firing volume.

Day 2 — measure

Alerts added to the queue per true positive. A rule at 301 to 1 is rejected with the number attached, not with an adjective.

Measure this

what to measuredenominator or target
alerts added to the queue per true positiveratio — 301 to 1 is rejected with the number attached

▦The framework, and how it works

   five rules for one runtime-objective anomaly

   R1  fires 301x for 1 true positive     buries the queue   REJECT
   R2  fires   2x for 2 true positives    generalises        SHIP
   R3  100% precision on nothing useful                      REJECT

   every rule detects the anomaly. deployability is decided by the
   volume it adds, replayed against real history.

Detecting emergent behaviour at machine speed is a detection-engineering problem. Semantic drift and runtime-objective anomalies are the signals, and the trap is the same one every detection has: a rule that fires on everything is worse than no rule, because it spends the attention the good rules need.

High-concurrency detection means generating candidate rules, then scoring them against real history on the one property that decides deployability — the firing volume — so a rule that flags an unauthorised objective before compromise is kept and one that buries the queue is rejected with its numbers.

2 · Demo — five candidate rules for one runtime anomaly

3 · Where it breaks — every rule detects something

4 · The control — score against history, ship few

5 · The procedure, as a skill

Every candidate rule here detects the anomaly. That is not the question.

The skill replays each rule against CyberTravels' real history and counts how often it would have fired. A rule that raises hundreds of alerts to catch one real problem is rejected, and the number is printed beside the rejection. That makes it an argument rather than an opinion.

▶Real time execution as skill

The skill — skills/detection/detection-rule-deployability/SKILL.md

name: detection-rule-deployability
description: >-
  Score candidate detection rules on precision, recall and firing volume, and
  reject the ones no analyst could work regardless of how well they detect. Use
  when authoring detections with or without a model, or when a rule is proposed
  because it caught the incident.
allowed-tools: Read, Grep, Glob

A rule that fires 301 times for one true positive is not a detection

Every candidate rule detects something. Deployability is a different property and it is arithmetic: precision, recall, and how many times the rule fires per day against real history. A rule failing on the third is rejected however good the first two look, because it will be muted within a week.

When to use this

Authoring detections, reviewing a model's proposed rules, and any time a rule is proposed on the strength of catching one incident.

Procedure

1 — Replay each candidate against real history. Not a sample chosen to contain the incident — the actual period, including the quiet parts.

2 — Compute precision, recall and volume. Volume is the one people omit and the one that decides whether the rule survives contact with an analyst.

3 — Set a deployability bar before you look at the results. Precision floor, recall floor, and a maximum firings per day. Setting it afterwards means setting it around the rule you like.

4 — Reject the broad rules explicitly, with their numbers. "Rejected: 301 firings for 1 true positive" is a sentence the author can act on; "too noisy" is not.

5 — Look at what survived, and what it depends on. A high-precision rule usually depends on a specific field being populated. Record that dependency — it is the thing that will silently break the rule later.

Example

Input — the fixture committed at the top of scripts/detection_rule_deployability.py. Edit it and re-run: the buckets, counts and verdicts below are derived from it, not hard-coded.

Output — the opening lines of a real run:

history: 522 events, 2 true positives
rule                                 alerts   prec  recall  alerts/TP
----------------------------------------------------------------------
R1 any http_get by an agent             301  0.003   0.500      301.0
R2 http_get to a non-github host          1  1.000   0.500        1.0
R3 link-local address                     1  1.000   0.500        1.0
R4 any failed action                     20  0.000   0.000        inf
R5 credential path OR link-local          2  1.000   1.000        1.0

The run continues past this. test_skills.py executes the script on every build, with no model configured — so what CI proves is that it runs and refuses legibly, not that it prints these lines. The output above is a recorded run against a real model, and nothing re-diffs it: a model's answer is not reproducible, and this repository does not claim otherwise anywhere it can be checked.

Output contract

{
  "history": {"events": 0, "period_days": 0, "true_positives": 0},
  "candidates": [{"name": "str", "fires": 0, "tp": 0, "precision": 0.0, "recall": 0.0,
                  "per_day": 0.0, "verdict": "deploy|reject", "why": "str"}],
  "bar": {"precision": 0.0, "recall": 0.0, "max_per_day": 0},
  "dependencies": [{"rule": "str", "requires_field": "str"}]
}

Failure modes

  • Replaying against a period chosen to contain the incident. Volume becomes meaningless.
  • Setting the bar after seeing the results. That is choosing a winner.
  • Deploying a rule with an unrecorded field dependency. It fails silently when the field stops being populated.

Three ways to do this lesson. Pick one. They run the same procedure against the same code — what changes is who drives it, and how much you see.

1In your AI agent — you are taught

The agent reads the lesson, explains the idea, fetches the code, runs the check and answers your questions as you go. This is the one to take if you are here to learn.

Install it, once. From the folder you cloned. --all does every agent it finds on your machine:

python3 scripts/install_skills.py --all --lessons D1.6

Then restart your agent and open it in that folder. On Windows, if python3 says Python was not found, use python instead.

Then pick d1-6-high-concurrency-detection-engineering:

agentinstall just for this agentstart it
Claude Codepython3 scripts/install_skills.py --tool claude --lessons D1.6type /d1-6-high-concurrency-detection-engineering
GitHub Copilot (VS Code)python3 scripts/install_skills.py --tool copilot --lessons D1.6type /d1-6-high-concurrency-detection-engineering in Chat
Cursorpython3 scripts/install_skills.py --tool cursor --lessons D1.6type / in Agent chat and search for it
Codexpython3 scripts/install_skills.py --tool agents --lessons D1.6type $d1-6-high-concurrency-detection-engineering, or run /skills

2As one Python command — you just run it

No agent, no conversation. The same lesson executes and prints the same readback. Take this one if you have no assistant, if you are reviewing rather than learning, or if you want the result without the teaching around it.

python3 scripts/lesson.py D1.6

3Read the code, and the difference — nothing runs

Neither of the above, and no model needed. The first command writes CyberTravels exactly as it stood at the end of this lesson; the second prints the diff — the lines this lesson added or changed, and nothing from any later one.

python3 scripts/checkpoint.py --at D1.6 --out work/cybertravels
python3 scripts/checkpoint.py --at D1.6 --diff

On Windows, type python wherever these say python3 — and use \ instead of / in the paths. Everything else is identical. A0.0 step 2 explains why.

Ways 1 and 2 need a model; way 3 does not. A signed-in Claude Code CLI needs no API key, and any OpenAI-compatible endpoint works too. With neither, the audit exits 2 and says so rather than inventing an answer. A0.0 sets this up.

Ways 1 and 2 both end with the same readback: What I did, What changed, The number and Read this next. A step that was skipped or refused is reported as exactly that, never as a pass.

If you did the last lesson’s challenge, expect this to stop. Most challenges ask you to edit the code, and ways 1 and 2 will not overwrite your edits: you get stopped, not a failure, with two options — --out for a fresh folder that keeps your work, or --force to discard it and start this lesson clean.

✓What you just proved

All candidates detect the anomaly, but their firing volumes differ by orders of magnitude, and the deployable one is chosen by the volume it would add to the queue rather than by recall alone.

✎Your turn

Take a detection you are proud of and compute how many times it fired last month against how many were true. If you cannot, the rule is unmeasured, which is the same as untuned.

Tools used

Sigma

Skill source: skills/detection/detection-rule-deployability

← PreviousD1.5 · Emergent swarms and multi-agent proliferation