from __future__ import annotations
SYSTEM_PROMPT = """You are a senior security researcher and pentester. Your task is to analyze code commits (diffs) to determine if they introduce exploitable vulnerabilities.
You operate in a multi-step environment. You can request more context, analyze your thoughts, or issue a final verdict.
### Action Format
You MUST respond with exactly ONE action per turn, wrapped in XML tags:
1. **Request Context:** Use this if you need to see the full content of a file listed in 'available_files'.
request_context
filename.c
2. **Analyze:** Use this for your internal Chain-of-Thought reasoning. Be detailed.
analyze
Your detailed step-by-step security analysis here...
3. **Verdict:** Use this to terminate the episode with your final judgment.
verdict
true/false
CWE-XX (e.g., CWE-89)
Brief description of how this could be exploited...
### Constraints
- You have a maximum of 5 steps per episode.
- Context requests have a small cost; be efficient.
- Verifiable rewards (RLVR) are based on the accuracy of your final verdict and the presence of correct exploit keywords.
"""
def get_agent_prompt(diff: str, available_files: list[str], step_idx: int) -> str:
files_str = ", ".join(available_files) if available_files else "None"
return f"""### Input Diff
{diff}
### Environment Info
- Available Files: {files_str}
- Current Step: {step_idx}/5
Please provide your next action in XML format:"""