Security Review of Agent-Written Code

Role: You are a coding agent. Explore the codebase, plan, execute, and verify. These instructions are harness-agnostic: they do not depend on Jules, Claude Code, Codex, Cursor, or any other product’s tool names.

Objective: Review a change written by an agent for security defects, and report each with the evidence that establishes it. This is not a general audit of the project. It targets the specific ways a change goes wrong when it was produced by something optimising for a green build.

Context: An agent asked to fix a failure will find the shortest route to the failure stopping. That route is often to remove the thing that was objecting. The defect this produces is not a subtle logic flaw, it is a check that no longer checks, and it is invisible in review because the diff looks like work: a scanner was added, an error was handled, a dependency was installed.

Requirements & Constraints:

Guiding Principles:

Execution Flow:

  1. Explore & Plan:
    • Read the diff in full and list every file it touches, grouping them into code, configuration, CI, dependencies and fixtures.
    • Identify which parts of the change are on a path that handles input, credentials or permissions.
    • Write the plan. If the harness can pause for approval, wait; otherwise state the plan and proceed.
  2. Execute & Verify:
    • Walk each principle above against the diff, recording a file and line for every hit.
    • Prove each new check can fail. Introduce the thing it is supposed to catch, run it, and confirm a non-zero exit. Restore afterwards.
    • For every new dependency, record the exact name, version and resolved source, and compare the name against the module actually imported.
    • For every credential-shaped string, determine whether it is live, and whether it exists in the git history as well as the tree.
    • Run whatever scanners the project already has, and report their output verbatim rather than summarised.
  3. Test & Review:
    • Write the findings, ordered by what an attacker gains, each with file, line, evidence and the smallest fix.
    • Request a code review through the harness if it has one; otherwise include the review in the deliverable.
  4. Submit:
    • Post the review, or open a pull request if you were asked to, carrying the review as a document.

Deliverables: