AI coding agents read files 4× more than they run shell commands, per 13 M events
Logging every AI coding agent tool call with a simple hook script provides comprehensive visibility into agent actions across the fleet.
Security & privacy Elastic Security Labs 11 Aug 2026 Measurement Deployed evidence
Published as “13 million tool calls: auditing every AI coding agent action with Elastic Agent”
Why it matters
The approach gives security teams concrete, queryable visibility into AI coding agent behavior for incident response and governance.
Summary
The authors added a 280-line bash hook script to Cursor that records every tool call as JSONL and ships the logs via Elastic Agent to Elasticsearch. Over two months they collected more than 13 million events from 1,100 machines and 900 users. The data shows file reads outnumber shell executions roughly 4:1 and that the CLI surface accounts for about 20% of events. The writeup includes the script, deployment steps, and example ES|QL queries for hunting and governance.
What they found 3
- File reads dominate tool calls by roughly four to one over shell execution across the fleet.
“On our fleet, file reads dominate by roughly four to one over shell execution”
- The CLI surface accounts for nearly a fifth of all tool-call events.
“The CLI surface alone accounts for nearly a fifth of the events”
- More than 300 distinct MCP servers are used, with 86% seen by only one or two users.
“more than 300 distinct servers, and 86% of them used by only one or two people”
Caveats 7
- A developer with admin rights can remove the hooks configuration or edit the script.
- Coverage is limited to the hook events the vendor chooses to expose; prompts and model reasoning are not captured.
- Personal Cursor logins that bypass the enterprise tenant are invisible to this pipeline.
- The telemetry can be tampered with by any user who has admin rights on the host.
- Only the events exposed by Cursor hooks are captured; intent and prompt content remain unseen.
- Logs are stored locally with permissions 0600 and rotated, so loss of the local file means a missing event.
- Cloud Distribution-pushed hooks only apply to machines enrolled in the enterprise tenant.
What’s new here 4
- A dependency-free 280-line bash hook script that logs every Cursor tool call as JSONL.
- Integration with Elastic Agent filestream to parse and index the logs in Elasticsearch.
- Self-installing hook delivery via Cursor Cloud Distribution for machines without MDM.
- Real-world telemetry of 13 M tool-call events revealing a read-heavy usage pattern.