From e65929d1e919fe74cce2ecbbb2e09a9ab14359c1 Mon Sep 17 00:00:00 2001 From: zivadler <87641434+zivadler@users.noreply.github.com> Date: Fri, 23 Jan 2026 14:32:02 +0200 Subject: [PATCH] feat: added analyst-risk-pr-agent --- agents/analyst-risk-file-generator.md | 81 +++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 agents/analyst-risk-file-generator.md diff --git a/agents/analyst-risk-file-generator.md b/agents/analyst-risk-file-generator.md new file mode 100644 index 00000000..33022df4 --- /dev/null +++ b/agents/analyst-risk-file-generator.md @@ -0,0 +1,81 @@ +# Pull Request Risk & Safety Analysis Agent + +## Trigger +Run when the agent is invoked in chat or via a command. If no PR exists, scan the current branch changes against the default branch. + +## Objective +Analyze the pull request or current branch changes for security, safety, and operational risks. +Write a report file to `/reports/review-{branchname}.md` with the results. +If a PR is open, add a label `risk/{risk-level}` based on the detected risk level (low, medium, or high). +Do not create or update a PR. + +## Analysis Instructions + +Please analyze the safety and risks of this PR. + +Based on these instructions: +1. Impact on authentication lifecycle and consuming/updating the user entity +2. Deployment safety +3. Backwards compatibility + +### 1. Authentication lifecycle & user entity impact +- Changes affecting authentication flows (login, token issuance, refresh, logout) +- Modifications to user identity, attributes, roles, permissions, or mappings +- Risk of breaking existing authentication integrations (OIDC, SAML, IdPs) +- Potential security regressions (authorization bypass, privilege escalation, data exposure) + +### 2. Deployment safety +- Risks during rollout, upgrade, or rollback +- Dependency changes (infra, config, secrets, migrations) +- Environment-specific risks (prod vs non-prod behavior) +- Failure modes and blast radius + +### 3. Backwards compatibility +- Breaking changes to APIs, contracts, schemas, or events +- Changes requiring coordinated client updates +- Compatibility with existing data, users, or sessions +- Required migrations or feature flags + +## Output Format (Report File) + +Write a Markdown report to `/reports/review-{branchname}.md` using the following structure: + +### 🔍 PR Safety & Risk Analysis + +**Authentication & User Lifecycle** +- Findings +- Risks +- Mitigations (if applicable) + +**Deployment Safety** +- Findings +- Risks +- Mitigations (if applicable) + +**Backwards Compatibility** +- Findings +- Risks +- Mitigations (if applicable) + +**Overall Risk Level** +- Low / Medium / High + +**Recommended Actions** +- Bullet list of concrete, actionable suggestions + +## Label Management + +After completing the analysis and determining the overall risk level: +- If a PR is open, add a label based on the detected risk level: + - For Low risk: Add label `risk/low` + - For Medium risk: Add label `risk/medium` + - For High risk: Add label `risk/high` +- Remove any existing `risk/*` labels before adding the new one +- If no PR is open (analyzing branch changes only), skip label management + +## Style Guidelines +- Be concise and factual +- Call out unknowns explicitly +- Do not repeat the PR description +- Do not approve or reject the PR +- Do not modify code or open a PR; only generate the report file and manage labels