> https://www.cotool.ai/detect

# Detections ~as code~ _are_ code. Agents write and tune them.

Cotool detections are Python code that runs against both centralized and federated data sources. Your team edits them in a notebook alongside detection engineering agents that tune your library and write new detections continuously.

Detection / personal\_cloud\_exfil.py · Python notebook · Visual · Code

Exfiltration to personal cloud storage · T1567.002

LOOKBACK = 30 \# days of history per user

SPIKE = 20 \# flag days this many times their normal

CATEGORY = "personal-storage"

ParametersLOOKBACK 30 · SPIKE 20× · personal-storage · Config

Query proxy logsUploads to personal storage, 30 days · Source

Model each user's normal30-day rolling median per user · Transform

Find spikesDays over 20× the user's normal · Decision

Flag leaversJoins each spike with a last day · Enrich

Ask RipplingLast day for each user

Exclude company BoxAdded by the tuning agent · v2

Return alertsOne alert per remaining spike · 1 alert · m.chen

Detections _are_ Code

## Detections optimized for agents

Every detection under the hood is pure code, what agents write best. A single detection can model baselines and deviations, call any tool in your stack, and apply any deterministic logic you want. Detection code is mapped to a dead-simple visual workflow, so the logic is clear to the entire team.

okta\_mfa\_fatigue.py · Visual · Code

MFA push fatigue

WINDOW\_MIN = 10

MIN\_DENIES = 5 \# edited in Visual

denies = tools.cotool\_runQuery(query=f"""

SELECT actor\_id, COUNT(\*) AS denies

FROM cotool\_logs.okta

WHERE event\_type = 'user.mfa.okta\_verify.deny\_push'

AND ts > now() - INTERVAL {WINDOW\_MIN} MINUTE

GROUP BY actor\_id

""")

hits = \[d for d in denies if d\["denies"\] >= MIN\_DENIES\]

emit\_results(hits)

Set thresholds `WINDOW_MIN` **10** · `MIN_DENIES` **5** · Configuration

Query Okta push denials Reads `cotool_logs.okta` for denied Okta Verify pushes · Source

Count denials per user Groups by actor over the last **10 minutes** · Transform

Flag push fatigue Keeps users with 5 or more denials · Decision

Return results Emits each flagged user as an alert · Output

Closed-Loop Tuning

## Every detection, tuned automatically

Agents investigate every alert, and each verdict feeds back into the detection that fired it. False positives get tuned out on their own, so your queue only holds what needs a human and you can ship new detections without bracing for noise.

Proposed tuning · gws\_oauth\_grant.py

Tuning agent · from 136 false positives closed in triage

1 · alerts = grants.where(scope\_\_in=SENSITIVE\_SCOPES)

2 · + · \# Security's register of approved OAuth apps

3 · + · trusted = notion.query("Approved apps")\["Client ID"\]

4 · + · alerts = alerts.exclude(client\_id\_\_in=trusted)

Alerts in a 30-day backtest · True positive

142 → 1426 of 6 true positives still fire

v5 live · Send for review · Apply tuning

Federated detections

## Detect on data you don't store

A detection can run against logs in Cotool or directly against the tools where your data already lives. You don't have to ingest a source to cover it. Store what needs fast search and long retention, and write detections against the rest where it is.

leaver\_still\_active.py · No log source

Terminated but still active · T1078 · Every hour

leavers = tools.call("rippling\_queryWorkers",

status="TERMINATED")

![Rippling](https://www.cotool.ai/_next/static/immutable/media/rippling.117-ka314lxaj.png) · Rippling · 4 terminated workers

active = tools.call("okta\_listUsers",

filter='status eq "ACTIVE"')

![Okta](https://www.cotool.ai/_next/static/immutable/media/okta.1lrca2rwccwzz.png) · Okta · 212 active users

gone = {w\["work\_email"\] for w in leavers}

emit\_results(\[u for u in active if u\["email"\] in gone\])

1 result

m.ortiz left Sep 26 and is still active in Okta · Sent to triage

Detection Library & Coverage Mapping

## Start with coverage, then close the gaps

Cotool comes with a library of detections across common log sources, automatically tuned to your environment by agents. Cotool maps your entire detection suite onto the MITRE ATT&CK framework, prioritizing gaps and creating new contextualized detections for any tactic or technique.

Coverage · 31 of 40 techniques

Initial · Exec · Persist · Priv Esc · Evasion · Cred · Lateral · Exfil

T1550.004 Web Session Cookie · Low · 1 detection

okta\_session\_replay\_drive.py · Live

Okta session replay followed by Finance Drive access

Okta System Log · + · Drive audit

Reject · Approve · Runs every 15 min on Okta and Google Workspace

## Scale detection in a completely new way

2,000 Employee Crypto Exchange · 1,500+ Employee Security Company

See how teams run continuous detection across live logs without writing rules for every edge case

[Book a demo](https://www.cotool.ai/request-demo)

## Extended Features

[Read the docs](https://docs.cotool.ai)

### GitOps

Keep detections in your own repository. Review changes in pull requests and deploy through CI.

Tune MFA fatigue threshold · #214 Open

tune-mfa-fatigue → main · Opened by Cotool agent

detections/okta/mfa\_fatigue.py

1 · denied = pushes.window("10m").group\_by("actor.id")

2 · \- · alerts = denied.count().where(lambda n: n >= 3)

3 · + · alerts = denied.count().where(lambda n: n >= 5)

4 · + · alerts = alerts.exclude(actor\_\_in=SERVICE\_ACCOUNTS)

Checks · Deploys on merge

cotool validate · Passed

cotool backtest --days 30 · −71% alerts, 0 missed

review · 1 approval

### Write detections with your coding agent

Cotool's MCP server lets Claude Code, Codex, Cursor, or any agent harness write, test, and deploy detections from your editor.

~/detections · cotool MCP connected

\> Write a detection for AWS access keys created outside Terraform

● cotool.search\_logs source="cloudtrail"

└ 1,204 CreateAccessKey events, 30 days

● cotool.create\_detection access\_key\_outside\_iac.py

└ Created, 24 lines

● cotool.test\_detection window="30d"

└ 2 hits, 0 false positives

● cotool.deploy\_detection

└ Live, runs every 15 minutes

Deployed. It flagged 2 keys created from the console last week.

### New detections from threat hunts

Hunts and threat intel produce detection suggestions around the clock, ready for your review.

AMBER MAZE targets developer AI sessions and cloud credentials

Cotool Threat Research · What Cotool checked

Anthropic Compliance · 1 agent session with unexpected egress

SentinelOne · Process tree pulled for MBP-117

GitHub · No repos reference cdn-checker.menlolabs.com

Deliverables · 2 detections

Hijacked AI agent sessionT1059 · T1552.001 · T1041 · Shipped

Coding agent credential pivot from untrusted instructionsT1552.001 · T1071.001 · In review

### Detection observability built-in

Every detection run is logged and searchable. Re-enter any execution to view all tool inputs and outputs and ask follow up questions.

Detection load heatmap · 014 runs / day

M · T · W · T · F · S · S · M · T · W · T · F · Total

rclone\_exfil.py · 84 · Healthy

okta\_mfa\_fatigue.py · 29 · Healthy

okta\_session\_reuse.py · 12 · Healthy

gws\_oauth\_consent.py · 10 · Healthy

aws\_root\_login.py · 3 · Healthy

↑ rclone\_exfil.py v6 shipped

Completed runs 138 · Failed runs 0 · Detections tuned 1

Executions · rclone\_exfil.py

Scheduled · Succeeded · just now · 12s · 4 rows

Scheduled · Succeeded · 15m ago · 11s · 0 rows

Manual · Succeeded · 1h ago · 14s · 6 rows

“It's enabled us to comfortably onboard new log sources and write rules around them without worrying that we're going to cause alert fatigue for the human detection engineers and analysts on the team.”

![Antoinette Stevens](https://www.cotool.ai/images/antoinette-stevens.jpeg) · Antoinette Stevens Principal Security Engineer
