What the agent does
The run starts with the issue in front of it: the Linear URL in resources puts the issue's title, description and comments into the prompt through your Linear connection. The agent then reads how the API is built before touching it. In an app shaped like fastify/demo, package.json has fastify 5 as an ES module in TypeScript 6, @fastify/autoload loading src/plugins/external, then src/plugins/app, then src/routes with autoHooks on, @fastify/type-provider-typebox for schemas, knex with mysql2 for queries and postgrator for the numbered SQL files in migrations/. src/server.ts sets request and connection timeouts and an Ajv that coerces types and strips unknown body properties. src/routes/api/autohooks.ts rejects any request without request.session.user except the login route, and src/plugins/app/authorization.ts decorates requests with isAdmin and isModerator from the roles the 004 and 005 migrations define.
Take an issue such as 'add a due date to tasks, filterable in the list'. The agent reads src/schemas/tasks.ts, where TaskSchema lists id, name, author_id, assigned_user_id, status and the timestamps, and TaskStatusEnum runs from new to archived, and src/routes/api/tasks/index.ts, where GET / paginates through QueryTaskPaginationSchema with page and limit up to 100, POST / sets author_id from the session and status to new, and the CSV download streams through csv-stringify and gzip. The change is then a 006.do.tasks_due_date.sql and its undo beside the existing five pairs, an optional due_date on TaskSchema, CreateTaskSchema and UpdateTaskSchema using the DateTimeSchema from schemas/common.ts, a due_before query field on the list, the corresponding where in src/plugins/app/tasks/tasks-repository.ts, and the new column in the CSV export.
Tests follow the repository's own pattern. test/helper.ts builds the app with fastify-plugin so the error handler is shared, and adds login, which posts to /api/auth/login with the seeded password, and injectWithLogin, which attaches the session cookie named by COOKIE_NAME. test/routes/api/tasks/tasks.test.ts inserts users and tasks straight through app.knex in before hooks and runs with node:test. The agent adds cases there: creating a task with a due date returns it on GET /:id, due_before filters the list, an invalid date is a 400 through expectValidationError, and the CSV includes the column. It runs what .github/workflows/ci.yml runs on Node 22 and 24: a MySQL 8.4 service, npm run build -- --noEmit, npm run lint with the neostandard rules, then npm run db:migrate && npm run test with RATE_LIMIT_MAX=4, CAN_SEED_DATABASE=1 and a generated COOKIE_SECRET, since npm test seeds first and wraps the run in c8.
Then it pushes a branch and opens a pull request whose description quotes the issue, lists the migration, schema, repository and route changes, and links the Linear issue so the tracker shows the pull request. If the issue leaves a decision open, such as whether an overdue task should change status, the agent states the choice it made in the description instead of guessing silently.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Do the work the Linear issue in resources describes, in this Fastify API. Read package.json, src/app.ts, src/server.ts, src/routes/api/autohooks.ts, the schemas under src/schemas, the route and repository the issue touches, the migrations directory, test/helper.ts and .github/workflows/ci.yml first. Follow the repository's conventions: a numbered do and undo migration pair, TypeBox schemas with the shared types in schemas/common.ts, queries in the repository plugin, routes with response schemas and tags. Add tests in the matching file under test/routes/api using build, login and injectWithLogin from the helper and the knex inserts the existing tests use. Start MySQL 8.4 in the sandbox, set the environment variables ci.yml sets, generate COOKIE_SECRET, then run npm run build -- --noEmit, npm run lint, npm run db:migrate and npm run test. Open a pull request that quotes the issue, lists every change, states any decision the issue left open, and links back to the Linear issue. Do not merge.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
},
{
"url": "https://linear.app/your-org/issue/ENG-42"
}
],
"connections": [
"linear"
]
}- 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 a pull request on its own branch that links the Linear issue. For a schema change the diff has a new do and undo pair in migrations/, edits to src/schemas/tasks.ts, src/plugins/app/tasks/tasks-repository.ts and src/routes/api/tasks/index.ts, and new cases in test/routes/api/tasks/tasks.test.ts. The description quotes the issue, lists each file and why it changed, and names any decision the issue did not settle.
The repository's CI workflow runs on the branch on Node 22 and 24 against a MySQL 8.4 service: type check, lint, migrate and the node:test suite under c8. The session transcript at GET /o/{org}/sessions/{id}/messages keeps the same commands as the agent ran them in the sandbox with their output, and the Swagger UI the app serves reflects the new schema fields when a reviewer runs the branch.
Before merging, a reviewer checks that the undo migration really reverses the do, that the Ajv removeAdditional setting in server.ts does not silently drop the new field from a body because a schema was missed, and that the CSV export's column order change is acceptable to whoever consumes the file. Wanting a different shape is a follow-up to the same session, on the same branch.
Run it on every Linear issue labeled agent
Sign in to Linear once with POST /me/connections {"type": "app", "name": "linear"} and finish the authorize URL in the console. Then create an automation in the Project with this prompt and a linear trigger on linear.issue.labeled with config.labels set to agent, and optionally config.teams to the team keys that may use it. Each labeled issue adds the event after the prompt and starts one run in the Project's repository; changes made by an app integration never fire it, so the agent's own comments cannot loop.
The automation's max_runs_per_hour, between 1 and 30, bounds a triage session that labels many issues at once; a fire past the cap is skipped as rate_limited. To post the pull request link back on the issue from your own tooling, start runs from your server instead with POST /o/{org}/sessions, the issue URL in resources, and a key with a webhook_url; Rush POSTs run.completed with the session_url when the turn finishes.
The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.
Why run it on Rush?
Picking up a small issue by hand costs more in setup than in code: a MySQL instance, the migration, the .env with a long enough COOKIE_SECRET, and a seeded database before the first test runs. In a Rush sandbox the agent does that in its own clone with its own MySQL, the way ci.yml does, and your working tree and your local database stay as they were. Label the issue, and the pull request shows up.
The pull request carries its proof: the migration pair, the schema and route changes, tests in the repository's own style, and the transcript of every npm command with its output. Ten labeled issues mean ten sandboxes and ten independent pull requests, each linked to its issue, instead of ten branches on one laptop.
Frequently asked questions
How does the agent read the Linear issue?
Through your Linear connection. You sign in once from the console, which creates a linear app connection on your account, and naming the issue URL in resources puts the issue's text in the prompt. The run names linear in connections so it can also read comments and link the pull request back. It never sees your Linear credentials.
What if the issue is too vague to implement?
The agent states the decisions it had to make in the pull request description rather than guessing silently, and when the issue cannot be implemented as written, it opens no pull request and says what it would need. A linear trigger can also use config.states with plan mode, which posts a plan as a comment on the issue through your connection without changing code, so the team can refine the issue first.
Does it need MySQL to run the tests?
Yes. test/helper.ts builds the real app, which registers knex against the MYSQL_* variables @fastify/env validates in src/plugins/external/env.ts, and the tests insert rows through app.knex. The agent starts MySQL 8.4 in the sandbox, runs npm run db:migrate, and sets CAN_SEED_DATABASE=1 so npm test can seed, exactly as ci.yml does.
Will it respect the roles in the API?
The route hooks in autohooks.ts require a logged-in session for everything but login, and authorization.ts adds isAdmin and isModerator checks. The agent keeps new routes behind the same hooks and adds a role check where the issue asks for one, with a test that a user without the role gets 403.
Why does the request name both a repository and a Linear issue?
resources takes one repository per run, which the agent clones, and a Linear issue URL, which is read through your connection and placed in the prompt. The two are different kinds of resource, so a run may name one of each; any other URL is refused as unsupported.