What the agent does
The agent reads what CI promises and what it does. In an app laid out like trpc/examples-next-prisma-starter, the README says the GitHub Actions setup covers end-to-end tests and linting, and next.config.ts turns off ESLint and type checking during next build with comments saying both run as separate tasks in CI. .github/workflows/main.yml has two jobs, both with a Postgres service: e2e runs pnpm prebuild, pnpm build, pnpm test-e2e with Playwright and pnpm tsc, and unit runs pnpm test-unit with Vitest and pnpm tsc. Neither runs pnpm lint, so the lint promise is unkept, and the workflow triggers on push only, so a pull request from a fork runs nothing.
package.json defines lint as eslint --cache src and lint-fix, and eslint.config.mjs is a flat config built on typescript-eslint with the type-checked and stylistic sets, the React and React Hooks plugins, projectService for type information and reportUnusedDisableDirectives. Prettier is configured inline in package.json, printWidth 80, trailingComma all and singleQuote, and recommended in .vscode/extensions.json, but no script runs it. package.json has no packageManager field and the repository has no lockfile, while the workflow's pnpm/action-setup step passes no version and setup-node asks for a pnpm cache, which only works with a lockfile.
The agent adds a lint job to main.yml: checkout, pnpm/action-setup and setup-node on the same Node 22 the other jobs use, pnpm install, which runs prisma generate through the postinstall script so the type-aware rules can see the Prisma client types, then pnpm lint and a new format:check script, prettier --check .. The job needs no Postgres service and no NODE_ENV, so it is the fastest of the three. The agent also adds pull_request to the workflow's triggers so forks are checked, and adds .eslintcache, which eslint --cache writes, to .gitignore, where coverage and playwright/test-results already are.
Before opening the pull request the agent runs both commands in its sandbox against the current tree. Where prettier --check fails, it runs prettier --write and commits that as its own change so the new job starts green; where ESLint reports a rule the code breaks, it fixes the code rather than the rule, or, for a rule the config deliberately disables with a comment, leaves it. It pins the pnpm version by adding a packageManager field to package.json so pnpm/action-setup resolves one, and runs pnpm tsc and pnpm test-unit afterwards so a formatting change in src/server/ is known to be harmless.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Add ESLint and Prettier checks to CI for this tRPC app. Read package.json, eslint.config.mjs, next.config.ts, .gitignore, .vscode/extensions.json and .github/workflows/main.yml first. Add a format:check script that runs prettier --check . and a lint job to main.yml with checkout, pnpm/action-setup, setup-node on the same Node version as the other jobs, pnpm install, pnpm lint and pnpm format:check; the job needs no database service. Add pull_request to the workflow triggers. Add .eslintcache to .gitignore. Add a packageManager field to package.json naming the current pnpm release so the action can resolve a version. Run pnpm lint and pnpm format:check in the sandbox; fix formatting with prettier --write in its own commit, fix code that breaks a rule rather than changing the rule, then run pnpm tsc and pnpm test-unit. Run actionlint over the workflow and open a pull request that lists each file the formatter changed and each lint finding you fixed.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- 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
The pull request changes .github/workflows/main.yml, package.json and .gitignore, and reformats whichever source files Prettier reported, in a commit of their own so the review separates the workflow from the whitespace. Its description lists the files the formatter touched, each ESLint finding and the fix, the tsc and Vitest results after the changes, and the actionlint output.
The new lint job runs on the pull request itself, beside e2e and unit, so the branch that introduces the check is the first one it passes. From then on a push or a pull request, from a fork included, fails within a minute or two on a rule from eslint.config.mjs or on formatting that prettier --check rejects, before the slower jobs with a database have started.
Before merging, a reviewer looks at the reformatted files for anything beyond whitespace, decides whether the lint job should also run pnpm tsc so the type check happens without a database too, and whether to commit a lockfile so the pnpm cache the workflow asks for starts working.
Run it on every pull request
A team with several Next.js and tRPC services sends this body once per repository from its own server, each a POST /o/{org}/sessions with that repository in resources and a request_id that is a UUID v5 of the repository's full name, so a retried call returns the run already started. Each run reads its own scripts and workflow: a repository that already runs pnpm lint in CI gets only the Prettier check added, and one on npm or Yarn gets the same job with that package manager's install step.
Once the job exists, an automation on the Project with a github trigger on pull_request.opened and pull_request.synchronize and the prompt "if the lint job failed on this pull request, read its log and comment with each finding and the one-line fix, file by file; push nothing" starts one run per push. The trigger adds the pull request after the prompt, only work by an owner, member or collaborator fires it, and its runs read the repository and comment, so a contributor sees what to change without opening the job log.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
A lint job that is missing from CI is invisible until a reviewer notices a console.log that the config would have caught, and adding it later means the first run fails on formatting nobody has looked at in months. The agent runs the checks first in a sandbox with the exact dependencies, fixes the formatting in a separate commit, and writes the job so the pull request that adds it is also the proof that it passes.
The lint and format output, the type check and the unit test results stay with the run, so the reviewer sees the findings the job would have raised rather than discovering them on the next push. A team with many services runs the same request across all of them at once, each in its own sandbox, and gets a job per repository fitted to its package manager and scripts.
Frequently asked questions
Why does the lint job need pnpm install if it runs no code?
The ESLint config uses typescript-eslint's type-checked rules with projectService, which load the TypeScript program and the Prisma client types, and pnpm install runs prisma generate through the postinstall script. Without the install, the type-aware rules cannot resolve @prisma/client and report errors that are not real.
Will the formatter rewrite my whole codebase?
Only the files prettier --check reports, using the printWidth, trailingComma and singleQuote settings already in package.json, and in a commit of their own so the review can skip it. A repository that is already formatted gets no such commit.
Why add pull_request to the triggers?
The workflow currently runs on push only, which covers branches in the repository but not pull requests from forks. With pull_request added, a contributor's branch is linted and tested before anyone reviews it, and the job appears as a check on the pull request page.
Does the job replace the ESLint setting in next.config.ts?
No. ignoreDuringBuilds stays on, because the build job should not duplicate the lint job, and the comment in next.config.ts that says ESLint runs as a separate CI task becomes true with this change rather than being removed.