{"agent":"claude","input":"Add optimistic locking to this Prisma app. Read package.json, prisma.config.ts, prisma/schema.prisma, prisma/seed.ts, src/index.ts and tsconfig.json first. Identify every route that reads a row and then writes it based on what it read, and leave atomic updates such as increment alone. Add a version Int @default(0) field to each model those routes update, create the migration with npx prisma migrate dev, and rewrite each read-then-write route to use updateMany with the id and the caller's version in where and version: { increment: 1 } in data, answering 409 with the current row when count is 0; accept version from the request body and fall back to reading the row when it is absent. Include version in every response that returns the model. Add vitest with a test script, install and start PostgreSQL in the sandbox, set DATABASE_URL, run the migration and the seed, and write a test that fires two conflicting updates at once and asserts one 200, one 409 and a final version of 1. Run npx tsc --noEmit and npm test until they pass, then open a pull request that lists each route you changed, each you left alone and why.","resources":[{"url":"https://github.com/your-org/your-app"}]}