What the agent does
A review of a .NET pull request starts with the rules the solution enforces on itself, because most findings are a rule the author did not know was there. In a solution like jasontaylordev/CleanArchitecture the agent reads Directory.Build.props, which turns on TreatWarningsAsErrors and Nullable for every project and moves build output to artifacts/, and Directory.Packages.props, which manages every version centrally with CentralPackageTransitivePinningEnabled. It reads the project references to learn the allowed direction: Domain.csproj has one package, MediatR.Contracts, and no project reference; Application references Domain; Infrastructure references Application; Web references both. It reads the three accepted records under docs/decisions, which say that handlers use IApplicationDbContext directly with no repository layer, that tests run against a real database through Aspire, and that MediatR.Contracts is the one dependency Domain may have.
Then it checks out the pull request's branch and runs what .github/workflows/build.yml runs: dotnet restore, dotnet build --no-restore --configuration Release and dotnet test, with the SDK global.json pins. A PackageReference that carries its own Version in a .csproj fails restore under central management, and a nullable warning fails the build, so both show up as command output the review can quote. It runs the unit test projects first, then Application.FunctionalTests, which starts TestAppHost and resets the database with Respawn between tests. If the Aspire host does not start in the sandbox the review says which projects ran and which did not, and does not report the suite as green.
With the build settled it reads the diff against the solution's conventions. A new command belongs in its own folder under src/Application/<Feature>/Commands with the request record, the handler and a FluentValidation validator, and gets a functional test beside the existing ones such as CreateTodoItemTests. A handler that injects the concrete ApplicationDbContext, or a using of CleanArchitecture.Infrastructure inside Application, breaks the direction the references allow even when it compiles through a transitive path. A new endpoint is a class implementing IEndpointGroup under src/Web/Endpoints; MapEndpoints finds it by reflection and prefixes /api/<ClassName>, so the class name is the route, and the existing groups return TypedResults and carry EndpointSummary and EndpointDescription attributes that feed the OpenAPI document. An exception type thrown from a handler should be one ProblemDetailsExceptionHandler maps, or the client gets a 500 where a 404 was meant.
It also reads for what compiles and is still wrong. A new endpoint group that leaves out groupBuilder.RequireAuthorization() is public, and a request with no Authorize attribute passes through AuthorizationBehaviour unchecked, so the review looks for one or the other on anything that changes data. An entity that should record who changed it has to derive from BaseAuditableEntity, or AuditableEntityInterceptor never stamps it. A string column added to an entity without a matching HasMaxLength in src/Infrastructure/Data/Configurations will pass a validator of 200 characters and still be unbounded in the schema. The repository has no migrations folder, and ApplicationDbContextInitialiser recreates the database in development, so a model change needs no migration here; the review says so once instead of asking for one. Everything goes into a single review with file and line for each finding, and the agent pushes nothing.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Review this pull request to our .NET solution. Read global.json, Directory.Build.props, Directory.Packages.props, the solution file, every .csproj for its project and package references, docs/decisions and .github/workflows/build.yml first. On the pull request branch run dotnet restore, dotnet build --no-restore --configuration Release and dotnet test the way the workflow does, unit test projects first, and quote any restore error, warning-as-error or failing test; if a test project cannot start in the sandbox, say which and why instead of calling the suite green. Then read the diff. Check that dependencies still point inward (Domain has no project reference, Application does not use Infrastructure types), that no PackageReference carries its own Version, that a new command has its validator and a functional test, that a new endpoint group follows IEndpointGroup with TypedResults and OpenAPI attributes, that handlers throw exceptions ProblemDetailsExceptionHandler maps, that anything which changes data is behind RequireAuthorization on its endpoint group or an Authorize attribute on its request, and that new string columns have a length in the entity configuration. Post one review on the pull request with file and line for every finding and the command output quoted. Do not push commits.",
"resources": [
{
"url": "https://github.com/your-org/your-app/pull/42"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
What comes back is one review on the pull request. It opens with the three commands and their result: restore, the Release build with any CS or NU code that failed it, and the test projects that ran with their pass and fail lines as dotnet test printed them. Findings follow, ordered by file, each with the line, the rule it breaks and where that rule comes from: a project file, an ADR by number, or an existing class the change should have matched. A pull request that only renames a variable gets a short review that says the build and tests pass and nothing structural changed.
The session keeps what the review is built on. GET /o/{org}/sessions/{id}/messages returns the transcript with every command and its full output, so an author who disputes a finding can read the exact compiler line or test failure behind it. The review is advice with evidence; it approves nothing and merges nothing, and the branch is exactly as the author left it.
Before acting on it, a maintainer checks two things: that a finding which cites a convention points at a real file in the repository, and that anything the review marks as not run, such as acceptance tests that need Playwright's browsers, is covered by the repository's own CI.
Run it on every pull request opened
Create an automation in the Project that holds the repository, with this prompt, read-only switched on, and a github trigger on pull_request.opened and pull_request.synchronize. The trigger puts the pull request after the prompt and fills nothing else in, and its branch_patterns setting limits it to pull requests whose base is main. It fires for work by an owner, member or collaborator only; a pull request from a fork or from a bot such as Renovate never fires it.
For a bot's pull request, a handler on your own server receives GitHub's webhook and sends this body with the pull request URL in resources, using an API key and a request_id that is a UUID v5 of the repository, the pull request number and the head SHA. A second delivery of the same push then returns the run already started, and a new push starts a new review. A fork's pull request keeps its branch in the fork, so a maintainer pushes the contributor's commits to a branch in the repository itself and opens the pull request from there.
The use case this job follows, with its automation and trigger: Review every pull request.
Why run it on Rush?
A human reviewer on this kind of solution spends the first part of a review getting the branch to build: the right SDK band, a restore against the central package file, a Release build that fails on the first warning. The agent does that part in its own sandbox on every pull request and brings the output with it, so the people reviewing start from a build result and a list of structural findings and spend their time on whether the change is the right one.
It is also consistent in a way a busy team is not. The dependency direction, the validator and functional test beside each command, the call or attribute that puts a request behind authorization: each is checked on every pull request, in parallel when several are open, and each finding names its source. Nothing is installed on a laptop, and the transcript shows precisely what was run and what was only read.
Frequently asked questions
Does it run the tests or only read the diff?
It runs them. The agent restores, builds in Release and runs dotnet test on the pull request's branch in its own sandbox, and quotes the output. Where a project cannot start there, the review names it as not run.
How does it know our architecture rules?
From the repository. It reads the project references, the shared build properties and any decision records, and holds the diff against those. A rule that lives only in someone's head can go in the prompt, in a sentence, and is checked the same way.
Will it review Renovate or Dependabot pull requests?
Not through the github trigger, which ignores bot senders. To review dependency bumps, start the run from your own server with the pull request URL in resources. The same prompt then builds and tests the bump like any other change.
Can it fix what it finds?
This run is a review and pushes nothing. To have a finding fixed, start a run from the API with the same pull request in resources and name the finding; that run starts on the pull request's branch.