DevSecOps Platform Lead Plan: Pull Request Gatekeeping for Security Agents
Design a deterministic execution plan for autonomous code review agents enforcing security standards and automated remediation.
Deploy this template when writing system instructions for static analysis and security review agents across continuous integration pipelines. It establishes rigorous criteria for automated pull request approvals, inline patch generation, and policy blocks.
Role: Staff DevSecOps Engineer & Autonomous Quality Platform Lead
Context
- Target Repositories: {{repository_scope}}
- Enforced Security Standard: {{security_compliance_standard}}
- Static Analysis & Lint Ruleset: {{code_review_ruleset}}
- PR Blocking Conditions: {{blocking_criteria}}
- Feedback Delivery Channel: {{developer_feedback_channel}}
- Exempt Paths & Override Roles: {{exempted_code_paths}}
Task
Construct a comprehensive execution plan for an autonomous pull request reviewer agent that enforces {{security_compliance_standard}} across {{repository_scope}}, providing immediate actionable inline feedback and blocking non-compliant changes.
Method
- Establish the agent scanning lifecycle upon pull request creation or update within {{repository_scope}}.
- Map rules from {{code_review_ruleset}} to specific AST (Abstract Syntax Tree) patterns and secret-detection heuristics.
- Filter out files matching {{exempted_code_paths}} while flagging any unauthorized modifications to critical security configurations.
- Formulate the triage algorithm to classify identified code vulnerabilities against {{security_compliance_standard}}.
- Define synthetic patch generation logic for common syntax and sanitation vulnerabilities that can be remediated safely.
- Detail the gating mechanism that triggers automated merge blocks based on {{blocking_criteria}}.
- Standardize formatted comment templates delivered directly to {{developer_feedback_channel}}.
Constraints
- Agent MUST block merging automatically when any condition in {{blocking_criteria}} is satisfied.
- Agent MUST NOT suggest inline code changes that introduce external third-party dependencies not already present in repository lockfiles.
- Secret detections must immediately redact sensitive values before publishing review comments.
- Scan duration target must remain below 120 seconds per standard PR.
Output format
Present the complete implementation plan containing:
- Execution Pipeline Workflow (phase-by-phase chronological steps)
- Policy Decision Matrix (risk tier, action taken, and merge status)
- Automated Patch Generation Guidelines (criteria for proposing code changes)
- Pull Request Review Output Template (Markdown template used by the agent in {{developer_feedback_channel}}) Length must be between 600 and 850 words.
Self-review
- Confirm all 6 context variables are actively utilized in the procedural steps.
- Check that merge blocking logic is explicit, deterministic, and unambiguous.
- Ensure feedback phrasing instructions emphasize developer clarity and minimal false-positive noise.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.