{"agent":"claude","input":"Add rate limiting to this Socket.IO chat server. Read package.json, package-lock.json, index.js, index.html, .gitignore and .codesandbox/Dockerfile first. Note that index.html sets ackTimeout and retries, so a silently dropped message is resent; a limited message must be acknowledged with an error payload and must not be stored or broadcast. Move the Express app, the Server and the connection handler from index.js into server.js with a function a test can call, keeping the cluster primary and worker wiring in index.js. Add a per-socket token bucket created on connection and removed on disconnect, with capacity and refill rate as constants that can be overridden from the environment, checked in the chat message handler before the database insert; do not limit the history replay. In index.html pass a callback that shows a notice when the ack carries an error. Add socket.io-client as a dev dependency and a node --test suite that starts server.js on port 0 with a temporary database, sends a burst past the limit and asserts the last ack carries error rate_limited, that a limited message reaches no other client, and that messages pass again after refill. Run npm install, npm test and node --check index.js, start index.js once to confirm the workers listen, and open a pull request that explains why the limit is per socket and not per address.","resources":[{"url":"https://github.com/your-org/your-app"}]}