What the agent does
The agent reads the stack and the tooling around it. In an app shaped like typescript/api-cors-lambda-crud-dynamodb from aws-samples/aws-cdk-examples, index.ts defines one stack, ApiLambdaCrudDynamoDBStack, with a Table named items keyed on itemId, removalPolicy: RemovalPolicy.DESTROY under a comment that says it is not recommended for production, five NodejsFunction handlers on NODEJS_24_X bundled with esbuild and @aws-sdk/* left external, and a RestApi with CORS mock integrations. package.json pins aws-cdk-lib to 2.262.1 and aws-cdk to 2.1133.0, has jest 30 with @swc/jest, @types/jest and a jest.config.js that matches **/*.test.ts and loads aws-cdk-lib/testhelpers/jest-autoclean, but there is no *.test.ts file and no test script. cdk.json runs the app with npx tsc && npx tsx index.ts and carries a long list of feature flags including @aws-cdk/aws-dynamodb:retainTableReplica. The repository's SNAPSHOT_TESTING.md recommends normalizeTemplate from typescript/test-utils for snapshot tests, and the Build Pull Request workflow builds whichever examples a pull request changes.
The agent adds point-in-time recovery to the table with the prop the installed aws-cdk-lib treats as current. It checks the library's typings in node_modules for the Table props, uses the pointInTimeRecoverySpecification form with pointInTimeRecoveryEnabled: true, and confirms during cdk synth that no deprecation warning is printed for the table, since this library version marks the older boolean prop deprecated. It leaves removalPolicy alone, because the sample documents that choice, but says in the pull request that a table worth continuous backups is usually also worth RETAIN and deletionProtection, each a one-line follow-up.
Because the example has Jest wired up with nothing to run, the agent adds index.test.ts beside the stack: it builds the stack in a fresh App, takes Template.fromStack(stack), and asserts hasResourceProperties('AWS::DynamoDB::Table', { PointInTimeRecoverySpecification: { PointInTimeRecoveryEnabled: true } }), plus a resourceCountIs('AWS::Lambda::Function', 5) so the test fails if a handler disappears. To make the test importable it exports the stack class, which index.ts already does, and moves the new App() and app.synth() lines into a guard so importing the module does not synthesize. It adds "test": "jest" to scripts, matching the existing jest.config.js, and follows SNAPSHOT_TESTING.md only if it adds a snapshot, which it does not need for a property assertion.
Then it runs npm install (whose postinstall installs the lambdas/ dependencies and creates the package-lock.json the depsLockFilePath prop points at), npm run build, npm test and npx cdk synth, which bundles the five functions with the local esbuild and needs no AWS account because the stack has no environment lookups. It greps the synthesized template in cdk.out for PointInTimeRecoverySpecification and pastes that block, the Jest result and any synth warnings in the pull request description. cdk.out and node_modules are not committed.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Enable point-in-time recovery on the DynamoDB table in this CDK app and open a pull request. Read index.ts, package.json, cdk.json, jest.config.js, tsconfig.json and the repository's SNAPSHOT_TESTING.md first. Set point-in-time recovery on the items table using the prop the installed aws-cdk-lib version treats as current (check its typings in node_modules and make sure cdk synth prints no deprecation warning for the table); leave removalPolicy as it is but mention RETAIN and deletionProtection as follow-ups in the pull request. Add index.test.ts that builds the stack in a fresh App, uses Template.fromStack to assert the table has PointInTimeRecoverySpecification with PointInTimeRecoveryEnabled true and that there are five Lambda functions; guard the new App() and app.synth() lines so importing index.ts does not synthesize, and add a test script to package.json that runs jest. Run npm install, npm run build, npm test and npx cdk synth, then paste the PointInTimeRecoverySpecification block from the synthesized template, the Jest output and any synth warnings in the pull request description. Commit nothing from cdk.out or node_modules and change nothing else.",
"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 with index.ts changed in two places, the table props and the guarded app entry point, a new index.test.ts with the two assertions, and package.json with a test script. The description quotes the PointInTimeRecoverySpecification block from the synthesized template, the npm test output showing both assertions passing, and the cdk synth output with no deprecation warning for the table.
The repository's Build Pull Request workflow picks up the changed example and builds it as it does for any TypeScript sample, so the pull request shows a build check before merge. A reviewer confirms the prop used is the current one for aws-cdk-lib 2.262.1, that the guard still lets npx tsx index.ts synthesize from cdk.json, and decides whether to take the RETAIN and deletionProtection follow-ups now. On the next cdk deploy the table gets continuous backups with no replacement, since the change is an in-place update.
Run it on every Linear issue labelled agent
In the console, an automation with a linear trigger on linear.issue.labeled and the label agent starts one run per labelled issue, with the issue as its context, in the Project that has the repository. An issue titled Turn on PITR for the items table with this prompt in its description is the whole input. Changes made by an app integration never fire it, so the agent's own updates to the issue do not start new runs.
From your own server, the same run is one POST /o/{org}/sessions per issue: the repository in resources, plus the issue's https://linear.app/<workspace>/issue/<ID> URL there too, read through your Linear connection into the prompt. A webhook on the API key posts run.completed or run.failed when the turn finishes, with the session_url to read the pull request link.
The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.
Why run it on Rush?
The property is one line; the proof is the template. A CDK change is only known to be right after cdk synth, and a prop that the installed library has deprecated synthesizes with a warning that nobody reads in a terminal they closed. The agent runs the synth in its own sandbox with the pinned aws-cdk-lib, bundles the functions with the local esbuild, checks the generated JSON for the exact block, and adds the assertion test so the next change to the table cannot quietly drop it. Every command and its output stays in the run's record.
It also turns an empty Jest setup into a used one. The example ships jest, @swc/jest and a config that matches *.test.ts and finds nothing; after this pull request npm test means something, and the pattern is there for the next assertion.
Frequently asked questions
Will enabling point-in-time recovery replace the table?
No. PointInTimeRecoverySpecification is an updatable property on AWS::DynamoDB::Table, so CloudFormation applies it in place and the data stays. The agent confirms the logical id of the table is unchanged in the synthesized template, which is what would otherwise signal a replacement.
Does it need AWS credentials to check its work?
No. cdk synth for this stack needs no account because there are no environment-specific lookups, and the function bundling runs with the esbuild in devDependencies. The agent never deploys; the template in cdk.out is the evidence.
Why change the app entry point in index.ts?
Because index.ts creates the App and calls app.synth() at module scope, so a test importing the stack class would synthesize on import. The agent guards those lines so cdk.json's npx tsx index.ts still synthesizes while Jest can import the class. The reviewer checks that cdk synth still works from the command line.
Does it also set the removal policy to RETAIN?
Not in this pull request. The sample documents its DESTROY choice in a comment, so the agent leaves it and names RETAIN and deletionProtection as one-line follow-ups. Continuous backups and a table that cdk destroy deletes are an odd pair, and the maintainers should choose knowingly.
More AWS CDK jobs
The same job on other stacks
- Turn On DynamoDB Point-in-Time Recovery in a Serverless Framework Service (Serverless Framework)