What the agent does
The agent reads how the project is built and tested before it writes a line of YAML. In a project like temporalio/money-transfer-project-template-ts, package.json has build as tsc --build, lint as eslint src, format as prettier --write . and test as Mocha over src/mocha/*.test.ts with ts-node/register and source-map-support/register; the Temporal packages are pinned with ~1.14.1, .nvmrc says 18, tsconfig.json extends @tsconfig/node18 and emits to lib, and there is a package-lock.json. .eslintrc.js uses the TypeScript parser with project: ./tsconfig.json, turns on @typescript-eslint/no-floating-promises and bans Node built-ins inside src/workflows.ts with no-restricted-imports, and .prettierrc asks for single quotes. .github/ holds only a CODEOWNERS file, so nothing runs on a pull request today. It also notices that jest, ts-jest and jest.config.js are present but no script runs Jest, and that source-map-support is required by the test script yet named by no devDependency, so it checks with npm ls that it arrives through the SDK and says so in the pull request.
The tests shape the workflow. src/mocha/workflows.test.ts creates a TestWorkflowEnvironment.createLocal() in a before hook, starts a Worker with workflowsPath: require.resolve('../workflows'), and runs moneyTransfer four times: once with mocked withdraw and deposit activities that return fixed transaction ids, and three times with the real activities against the mock bank in src/banking-client.ts, where account 85-150 holds 2000 and 43-812 holds 0, expecting a WorkflowFailedError for an unknown target account, an unknown source account and an amount above the balance. src/mocha/activities.test.ts runs each activity in a MockActivityEnvironment. createLocal downloads the Temporal dev server the first time it runs, so the workflow needs network on that step and a Mocha timeout longer than the default for the before hook; the file's own this.timeout line is commented out, so the agent sets one in the test script or a .mocharc file and explains why.
It writes .github/workflows/ci.yml that runs on pull requests and on pushes to the default branch: checkout, actions/setup-node reading the version from .nvmrc with the npm cache keyed on the lockfile, npm ci, npm run lint, a Prettier check (the existing format script writes files, so it adds a format:check script that runs prettier --check . and uses that), npm run build, then npm test. It adds a concurrency group so a new push cancels the run for the previous commit. It keeps the Node major that .nvmrc names instead of upgrading it in the same change, and notes the question for the maintainers.
In its sandbox it installs that Node, runs npm ci, then each workflow step in order, and reads the Mocha output: the before hook downloading the dev server, the four Workflow cases and the three Activity cases. It also runs npm run format:check to see whether the tree is already formatted; if it is not, it reports the files rather than reformatting them in a CI pull request. Then it opens the pull request and watches the first run of the new workflow on it, fixing the YAML until the checks pass.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Add GitHub Actions CI to this Temporal TypeScript project and open a pull request. Read package.json, package-lock.json, .nvmrc, tsconfig.json, .eslintrc.js, .prettierrc, jest.config.js, src/worker.ts, src/workflows.ts, src/activities.ts, src/banking-client.ts and the tests under src/mocha first. Write .github/workflows/ci.yml that runs on pull requests and pushes to the default branch: setup-node from .nvmrc with the npm cache keyed on the lockfile, npm ci, npm run lint, a Prettier check through a new format:check script, npm run build, then npm test. The Workflow tests start a local Temporal test server with TestWorkflowEnvironment.createLocal, which downloads it on first use, so give the Mocha before hook a timeout that allows the download and say so in the workflow. Add a concurrency group that cancels superseded runs. Do not change the Node major or the Temporal SDK versions. Run every step in the sandbox first, then open the pull request and make sure the workflow passes on it.",
"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
What comes back is a pull request on its own branch that adds .github/workflows/ci.yml and a format:check script in package.json, plus the Mocha timeout setting the before hook needs. The description lists each workflow step with the command it runs and quotes the sandbox output of npm run lint, npm run build and npm test, including the dev server download and the test names. The workflow's first run on the pull request is the proof: it shows as a check on the pull request itself.
Before merging, a reviewer checks the Node version the workflow reads, that the dev server download on each run is acceptable or should be cached, and whether the Prettier check should block or only report. They also decide what to do about the unused Jest configuration the agent points out, since that is a cleanup, not a CI change.
Run it on every Temporal repository without CI
A team with several Temporal services sends one POST /o/{org}/sessions per repository, this prompt and the repository in resources. GET /o/{org}/github lists every repository the Rush GitHub App installation can reach, so a script can start a run for each one whose package.json depends on @temporalio/worker and whose .github/workflows/ directory is missing. Each run reads that service's own scripts and tests, so a project on Jest or on the time-skipping test server gets a workflow for what it has, and each opens its own pull request.
Set a webhook URL on the API key and Rush posts run.completed or run.failed when a run's turn finishes, with session_url so your server can read the pull request link. Send a fresh UUID as request_id with each request so a retry returns the run already started.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
Temporal tests are integration tests: they download and start a dev server, register a Worker and run real Workflows through it, so the workflow that runs them fails for reasons that have nothing to do with the code, such as a hook timeout during the first download or a step without network. On Rush the agent runs the exact commands the workflow will run in its own sandbox first, reads the Mocha output, and then reads the first real run on the pull request, so the job is done when the check is green rather than when the YAML is written.
Every command and its output stay in the run's record, the workflow is one readable file, and nothing becomes a required check until a person merges. The same request adds CI to every Temporal service the team maintains, each run reading its own scripts, one pull request each.
Frequently asked questions
Does the workflow need a Temporal server or Temporal Cloud credentials?
No. The tests use TestWorkflowEnvironment.createLocal() from @temporalio/testing, which downloads and starts a local dev server inside the job. No namespace, address or API key is read, and src/worker.ts and src/client.ts, which connect to localhost:7233 by default, are not run.
Why add a Mocha timeout?
The before hook in src/mocha/workflows.test.ts has its this.timeout call commented out, and the first createLocal on a fresh runner includes a download. Mocha's default hook timeout can cut that off, so the agent sets a longer one for the suite and records how long the hook takes in the sandbox.
Will it switch the tests to Jest, since jest.config.js is there?
No. The test script runs Mocha and the tests import from mocha, so the workflow runs them as they are. The pull request notes that Jest, ts-jest and the Jest config are unused and leaves that decision to you.
Does it format the code to make the Prettier check pass?
No. It adds a format:check script and runs it, and if files are not formatted it lists them in the pull request. Reformatting is a separate change you can ask for in a follow-up message to the same run.