Recently I’ve had a few discussions about AI hunt performance and token optimisation. Sysinternals Autoruns lists Windows autostart entries from run keys, services, scheduled tasks and many other locations. At 1,200 entries per host, a hunt across 5,000 hosts produces about six million records. Autoruns records can be verbose, and many entries repeat across hosts. At this scale, that’s a great opportunity for optimisation.
In AI Ate My Velociraptor, I introduced velociraptor-skills and its harness, vraptor. This time I’ll use an Autoruns hunt to show how I’ve optimised velociraptor-skills for AI review.
Question to evidence
A hunt can start with a direct request like “Please run an Autoruns hunt” or a broader question like “Are there any suspicious persistence entries across these Windows systems?”
velociraptor-artifact-selection queries artifact_definitions() on the connected server to discover available artifacts, including custom ones. The vraptor harness uses their descriptions, parameters and source VQL alongside curated guidance to select an artifact and its fields. Autoruns covers a broad range of Windows persistence. A question about run keys, services or scheduled tasks may only need a dedicated artifact.
velociraptor-hunting can reuse an existing hunt when its results cover the question. This lets us apply new filters or investigate another lead without collecting the same data again. The same principle applies to individual hosts. Collect fresh data when the existing results lack the evidence you need or you want to check the current state.
Selecting fields for analysis
Choosing which fields and format to send to AI for analysis can make a big difference to token use. For example, across 100,000 Autoruns rows, one unnecessary field means 100,000 extra values for the model to read. There is also a consideration that if we send each row as a JSON object, we also repeat that field name and associated tokens 100,000 times.
For general hunts and individual machine collections, velociraptor-skills uses shared artifact profiles to select relevant fields. These define fields for AI review, stacking and supporting context. They also define normalisation and filtering options. An artifact can have several stack views, depending on the hunting question.
Prefilter in VQL
If the same service entry appears on 1,000 hosts, sending the raw results makes the model read the same command 1,000 times. The server-side VQL query groups those records before AI review. A different launch argument or signer creates a separate group. The original records remain on the server for follow-up.
- Input filtering The query keeps enabled entries with an image path or launch string and drops rows marked “File not found”.
- Stacking logic The query normalises paths and signer text, then groups on
Category,ImagePath,LaunchStringandSigner. Each occurrence incrementsTotalRowsbefore deduplication, and the server keeps a bounded sample of hostnames for follow-up. - Exclusion logic By default, the query skips a group when its
TotalRowscount exceeds 20. The cutoff is configurable. The query then checks the remaining groups against GoldenDB, a SQLite database of reviewed Autoruns exclusion rules, and excludes matching groups. - Output fields The query returns one stack row per retained group, including
TotalRowsandExampleHosts. A finalsummaryrow reports source, exclusion and residual counts.

GoldenDB as a reusable filter
Velociraptor deploys GoldenDB as Autoruns.GoldenDB through its tools infrastructure. To exclude an entry, a single rule must match the category, image path, launch string and signer. Each field uses a case-insensitive regular expression. Anchor the pattern when it should match the whole field. An unanchored pattern can match part of a longer value and exclude an entry you intended to review.
This synthetic service entry illustrates how a rule handles Defender platform updates.
| Autoruns field | Example value |
|---|---|
Category | Services |
ImagePath | C:\ProgramData\Microsoft\Windows Defender\Platform\4.18.24090.11-0\MsMpEng.exe |
LaunchString | "C:\ProgramData\Microsoft\Windows Defender\Platform\4.18.24090.11-0\MsMpEng.exe" |
Signer | (Verified) Microsoft Windows Publisher |
In both the image path and the launch string, the rule uses a regex for the version directory instead of requiring the literal 4.18.24090.11-0. This lets the same rule filter expected service entries across Defender platform updates. The launch string still has to end at MsMpEng.exe or its closing quote, so an added argument breaks the match. Defender platform rule
To add a rule, an analyst tests it against saved Autoruns results, reviews the entries it would exclude and approves it for the next database build. AI review can suggest candidates. GoldenDB maintenance workflow
Chunking and AI review
After filtering, vraptor sends the remaining entries to the model for analysis. Each request contains the review instructions, the expected reply format and a CSV chunk with one row per distinct Autoruns entry.

Vraptor packs complete rows into each chunk up to the input token budget. Longer LaunchStrings leave room for fewer rows. Each chunk can be reviewed independently.
What comes back from the model?
The model returns one tab-separated line per finding. In the reply below, SUSPICIOUS 4 medium flags row 4 in the review CSV, the PowerShell scheduled task. Vraptor validates the fields, checks that the row ID belongs to the chunk and requires a final END line. It then uses the row ID to look up the original command and an example host.

In this example, the model flagged the malicious DeviceSyncHelper task as SUSPICIOUS and identified the Defender service as a GoldenDB candidate.

Investigate the remaining leads
The report lists suspicious entries by severity and includes a reason and example hosts for each finding. Vraptor writes GoldenDB candidates to autoruns_potential_golden.csv for analyst review. An analyst can test a candidate such as the Defender DLP service against saved results before approving a rule for future hunts.
Row 4 gives us a script path and an example host. Autoruns shows how the task is configured to launch monitor.ps1. What does the script actually do?

During hunt triage, scripts like monitor.ps1 are easy to overlook, especially when several scripts need review. Collecting and reading each script takes time, so this work often gets a lower priority. With AI, we can ask Velociraptor to triage all greyware scripts in the hunt results. The Velociraptor skills collect the scripts through file upload, and the agent reviews each one and flags malware or anything that needs follow-up.

Final thoughts
In this post, we covered several ways to optimise AI analysis. Reusing hunt results avoids collecting the same data twice. We reduce input tokens by selecting fields with security value and sending one CSV row per distinct entry. Returning findings by row ID keeps replies short and lets vraptor link each finding back to the evidence.
For detection, apply reviewed exclusions as early as possible. I have published Windows.Sysinternals.Autoruns.Filtered on the Velociraptor Artifact Exchange. It applies GoldenDB on the endpoint before upload. Fleet-wide prevalence filtering runs on the server because it needs results from multiple hosts. Enable CollectAll to bypass filtering and return every row from the selected Autoruns categories.