---
title: "How we use /goal to find bugs in Patch the Planet"
description: "Codex's /goal mode works best for vulnerability hunting when the prompt defines a precise, calibrated outcome rather than a path, and when each agent pursues exactly one outcome."
url: "https://swe.quest/articles/how-we-use-goal-to-find-bugs-in-patch-the-planet-54705d077857df4c"
canonical: "https://blog.trailofbits.com/2026/07/28/how-we-use-goal-to-find-bugs-in-patch-the-planet/"
source: "Trail of Bits"
published: "2026-07-28"
difficulty: "medium"
kind: "Case study"
reading_minutes: 8
tags: ["vulnerability-research","ai-agents","ai-coding","open-source","rust"]
---

# How we use /goal to find bugs in Patch the Planet

A post on [Trail of Bits](https://swe.quest/sources/trail-of-bits.md), published 2026-07-28, 8 min read, Case study. Original: [https://blog.trailofbits.com/2026/07/28/how-we-use-goal-to-find-bugs-in-patch-the-planet/](https://blog.trailofbits.com/2026/07/28/how-we-use-goal-to-find-bugs-in-patch-the-planet/)

## Summary

Codex's /goal mode works best for vulnerability hunting when the prompt defines a precise, calibrated outcome rather than a path, and when each agent pursues exactly one outcome. In Patch the Planet, Trail of Bits had Codex draft and red-team its own goals from THREAT\_MODEL.md files and used agentcov to verify which code the model actually read. They split coverage and bug-finding into separate sessions, which worked far better on zlib. A Rust variant-analysis pipeline spawned one goal-mode agent per P-critical issue and filtered candidates through a security gate, a two-model false-positive check and human review, producing every Rust bug they submitted, including a soundness hole and a miscompilation fixed in Rust 1.98.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Vulnerability research](https://swe.quest/tags/vulnerability-research.md) (Security)
- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)
- [Open source](https://swe.quest/tags/open-source.md) (Engineering practices)
- [Rust](https://swe.quest/tags/rust.md) (Languages)

## Prerequisites

- vulnerability research basics ([easy posts on Vulnerability research](https://swe.quest/tags/vulnerability-research.md?difficulty=easy))
- variant analysis
- fuzzing ([easy posts on Vulnerability research](https://swe.quest/tags/vulnerability-research.md?difficulty=easy))
- LLM coding agents ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))

## Keywords

Codex, /goal, Patch the Planet, Semgrep, agentcov, zlib, Keycloak, THREAT\_MODEL.md

## Related posts

- [Your AI agent fixed the bug, but what else did it change?](https://swe.quest/articles/your-ai-agent-fixed-the-bug-but-what-else-did-it-change-4b4967c8420473e1.md): Trail of Bits · 2026-10-21 · Medium · 8 min read · AI agents, AI for coding, Security, Testing, Open source
  Trail of Bits released two agent plugins, patching-bugs and regression-hunt, that delegate bug reproduction, patch development and regression checking to AI agents.
- [How I hunt for vulnerabilities with AI](https://swe.quest/articles/how-i-hunt-for-vulnerabilities-with-ai-3d82bb1020f483da.md): ClickHouse · 2026-06-26 · Medium · 23 min read · Vulnerability research, AI agents, AI for coding, C & C++
  AI coding agents (GitHub Copilot in agent mode with Claude Opus and Gemini, later Claude and ChatGPT) can drive vulnerability research in a large C++ codebase like ClickHouse.
- [CWE-bench v2: More coverage, quality, and transparency](https://swe.quest/articles/cwe-bench-v2-more-coverage-quality-and-transparency-a9d3d012216634c0.md): Hugging Face · 2026-11-03 · Medium · 4 min read · Evaluation, Application security, AI agents, LLMs
  CWE-bench v2 releases a public set of 100 agentic security tasks covering 91 CWEs, where an agent must find and fix a vulnerability in a real open-source repository without breaking existing functionality, scored by deterministic programmatic verifiers that reject memorized upstream patches.
- [Building an agentic harness that outlasts the model](https://swe.quest/articles/building-an-agentic-harness-that-outlasts-the-model-75504578038e6cc5.md): Shopify Engineering · 2026-07-29 · Medium · 8 min read · AI agents, Application security, Vulnerability research, LLMs, Ruby
  Shopify's AppSec team built Dispatch, a Ruby-orchestrated multi-agent harness that partitions codebases, runs parallel category-specific Hunter agents, verifies candidates with tests written by a different model inside each app's existing test suite, and opens draft fix PRs.
- [GPT-5.5-Cyber built a zlib fuzzing lab in a day](https://swe.quest/articles/gpt-5-5-cyber-built-a-zlib-fuzzing-lab-in-a-day-34216d52ce035220.md): Trail of Bits · 2026-07-02 · Medium · 5 min read · Vulnerability research, AI agents, Testing, Open source, C & C++
  GPT-5.5-Cyber, driven through Codex's /goal command, independently chose dynamic testing over static review of heavily audited zlib and built a full fuzzing campaign in a day.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
