AI-Assisted PR Notes and Code Review
Code built with a Context Package, now heading to a PR
Section titled âCode built with a Context Package, now heading to a PRâIn the previous article, requesting implementation via a Context Package meant the agent reported back a decision summary, changed files, a verification command, an execution result, and unresolved items. Those five things are, in effect, already a draft of a PR note. This article covers how to wire that output into an actual PR process, and where AI is allowed to help versus where a human must always remain.
The PR process itself doesnât change
Section titled âThe PR process itself doesnât changeâAdopting AI doesnât change the basic flow: create a branch â commit â open a PR â review â approve â merge. What changes is how much text a human has to type from scratch at each step.
Where AI genuinely helps
Section titled âWhere AI genuinely helpsâDrafting a PR note
Section titled âDrafting a PR noteâAnalyzing commit history and code diffs to produce a summary organized by changed file, function, and class is something AI can do faster and with fewer omissions than a human. Reusing the output structure from the Context Package article, a draft PR note looks like this.
## SummaryImplemented the team name duplicate-check API (POST /api/registrations/check-team-name)
## Changes- Added: registrationController.checkTeamName, registrationRepository.findByTeamName- Modified: registrationRoutes.ts (registered the new route)
## Verification- Command: npm test -- --grep "team-name"- Result: 5 passing (including existing tests)
## Open Items- The error handler that converts a DB unique-constraint violation on concurrent requests into a 409 is not included in this PR (needs a separate issue)This draft is faster than writing it from scratch, but the same principle applies as before: an empty Open Items section should raise suspicion.
Review items that are mechanically checkable
Section titled âReview items that are mechanically checkableâThe review items AI can reliably catch are generally the ones with clear rules and a single correct answer.
- Naming convention violations (camelCase vs snake_case per project rules)- Formatting/lint rule violations- Obviously missing error handling (an external call with no try-catch)- Common security anti-patterns (string-concatenated queries vulnerable to SQL injection)- Test coverage gaps (branches with no test path)Since these have a clear correct answer, having AI filter them out first lets the human reviewer spend more time on the question AI cannot answer: does this code actually fit our business logic?
Where a human must always remain
Section titled âWhere a human must always remainâBusiness correctness approval
Section titled âBusiness correctness approvalââThis code is syntactically correct and passes its testsâ and âthis code actually satisfies the business requirement we wantedâ are two separate questions. Only someone who knows the PRD and user story built in this seriesâ earlier articles can judge the latter. AI can check whether a string of acceptance criteria matches the code, but it cannot judge whether those acceptance criteria were the right business decision in the first place.
Final security judgment
Section titled âFinal security judgmentâAI catching a common security anti-pattern is different from confirming this change is safe under this projectâs specific threat model. In particular, AI review output should never be treated as the final call in the following situations.
- Adding a new external integration (third-party API, payment, auth provider, etc.)- Changing the permission model (roles, access control logic)- Changing how personal data is handled- Changing encryption/signing schemesThe team should fix a rule that changes like these are not merged without explicit approval from a security owner or a senior engineer.
Release decisions
Section titled âRelease decisionsâPassing review doesnât answer whether itâs safe to deploy right now. Deployment timing, rollback plans, and conflicts with other deployments are operational-context decisions that canât be made from the code diff alone, which is all the information AI has.
Principles for adopting an AI review tool on a team
Section titled âPrinciples for adopting an AI review tool on a teamâ[Principles for adopting an AI review tool]1. Mark AI review comments as "suggestions," visually distinct from human approve/reject comments.2. A PR that AI marks as "no issues found" still cannot be merged without at least one human reviewer's approval.3. Changes falling into the Business/Security/Release categories require a designated human's approval regardless of the AI review outcome.4. When an issue the AI review tool missed is discovered later, add that case to the team's review checklist (fix the process, don't blame the tool).Wrapping up the series
Section titled âWrapping up the seriesâFrom requirements through user stories, context packages, and test scenarios to PR; this series has followed how a single requirement transforms along an artifact chain, and at each step, distinguished what AI can draft from what a human must decide. This principle holds regardless of which tool changes next: whatever you hand to AI, build the standard to verify it against first, and keep the human gate explicit.