You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Code review changes since branch diverged from default branch
4
4
---
5
5
6
-
Review the code changes introduced since this branch diverged from the default branch (main).
6
+
Review the code changes introduced since this branch diverged from its base branch.
7
7
8
8
**Agent assumptions (applies to all agents and subagents):**
9
9
- All tools are functional and will work without error. Do not test tools or make exploratory calls. Make sure this is clear to every subagent that is launched.
10
10
- Only call a tool if it is required to complete the task. Every tool call should have a clear purpose.
11
11
12
12
To do this, follow these steps precisely:
13
13
14
-
1. Run `git diff main...HEAD` to get the diff and `git log main..HEAD --oneline` to get the commit list. If the diff is empty, stop and report there are no changes to review.
14
+
1. Determine the base branch to diff against:
15
+
- The default base branch is `main`.
16
+
- Run `git branch` to list local branches and find any version branches (branches whose name matches the pattern `X.Y`, e.g. `0.6`, `1.2`).
17
+
- For each version branch found, compare how close the current branch is to it vs. `main` by counting commits since divergence: `git log <branch>..HEAD --oneline | wc -l`. Pick the branch with the fewest commits (i.e. the most recent common ancestor). If a version branch is closer than `main`, use it as the base branch instead.
18
+
- Store the chosen base branch name as BASE_BRANCH.
15
19
16
-
2. Launch a haiku agent to return a list of file paths (not their contents) for all relevant CLAUDE.md files including:
20
+
2. Run `git diff BASE_BRANCH...HEAD` to get the diff and `git log BASE_BRANCH..HEAD --oneline` to get the commit list. If the diff is empty, stop and report there are no changes to review.
21
+
22
+
3. Launch a haiku agent to return a list of file paths (not their contents) for all relevant CLAUDE.md files including:
17
23
- The root CLAUDE.md file, if it exists
18
24
- Any CLAUDE.md files in directories containing files modified in the diff
19
25
20
-
3. Launch 4 agents in parallel to independently review the changes. Each agent should return the list of issues, where each issue includes a description and the reason it was flagged (e.g. "CLAUDE.md adherence", "bug"). The agents should do the following:
26
+
4. Launch 4 agents in parallel to independently review the changes. Each agent should return the list of issues, where each issue includes a description and the reason it was flagged (e.g. "CLAUDE.md adherence", "bug"). The agents should do the following:
21
27
22
28
Agents 1 + 2: CLAUDE.md compliance sonnet agents
23
29
Audit changes for CLAUDE.md compliance in parallel. Note: When evaluating CLAUDE.md compliance for a file, you should only consider CLAUDE.md files that share a file path with the file or parents.
@@ -40,11 +46,11 @@ To do this, follow these steps precisely:
40
46
41
47
If you are not certain an issue is real, do not flag it. False positives erode trust and waste reviewer time.
42
48
43
-
4. For each issue found in the previous step by agents 3 and 4, launch parallel subagents to validate the issue. The agent's job is to review the issue to validate that the stated issue is truly an issue with high confidence. For example, if an issue such as "variable is not defined" was flagged, the subagent's job would be to validate that is actually true in the code. Another example would be CLAUDE.md issues. The agent should validate that the CLAUDE.md rule that was violated is scoped for this file and is actually violated. Use Opus subagents for bugs and logic issues, and sonnet agents for CLAUDE.md violations.
49
+
5. For each issue found in the previous step by agents 3 and 4, launch parallel subagents to validate the issue. The agent's job is to review the issue to validate that the stated issue is truly an issue with high confidence. For example, if an issue such as "variable is not defined" was flagged, the subagent's job would be to validate that is actually true in the code. Another example would be CLAUDE.md issues. The agent should validate that the CLAUDE.md rule that was violated is scoped for this file and is actually violated. Use Opus subagents for bugs and logic issues, and sonnet agents for CLAUDE.md violations.
44
50
45
-
5. Filter out any issues that were not validated in step 4. This step will give us our list of high signal issues for our review.
51
+
6. Filter out any issues that were not validated in step 4. This step will give us our list of high signal issues for our review.
46
52
47
-
6. Output a summary of the review findings to the terminal:
53
+
7. Output a summary of the review findings to the terminal:
48
54
- If issues were found, list each issue with a brief description and the file/line it occurs in.
49
55
- If no issues were found, state: "No issues found. Checked for bugs and CLAUDE.md compliance."
Copy file name to clipboardExpand all lines: AGENTS.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ tests/
48
48
- Always use strict comparisons (`===`, `!==`).
49
49
- Enforce the use of DateTimeImmutable over DateTime.
50
50
- Always use spaces in concatenation (`$a . $b`).
51
-
- Always use imports. Use aliases when collisions occur or the imported name is unclear.
51
+
- Always use imports. Use aliases when collisions occur or the imported name is unclear. Do not import classes from the root namespace (e.g. `\RuntimeException`, `\Stringable`); use the fully-qualified backslash prefix inline instead.
0 commit comments