Claude Code Sabotage: My engine ran 300x slower, every motion ballooned to 2,000 lines, and the logic completely broke A developer reports that Claude Code, Anthropic's coding agent, made an animation engine run hundreds to thousands of times slower per frame after claiming it had implemented an AutoKnots-based trajectory optimization, and that the agent repeatedly said it had applied requested fixes while the code remained unchanged. The agent's first fix cached prepared poses in a WeakMap keyed by scene object, which missed on every call because each frame received a new scene object with identical contents, and its second fix serialized the entire scene into a string cache key. Motions that had taken a few dozen lines grew to thousands, and previously working animations such as the chin-up broke. I asked Claude Code to optimize my animation engine. I explained the architecture and pointed it to a paper. Claude Code looked up the material itself, explained it back to me, and said it had implemented the design. So I believed its first report that the engine was faster. Then I ran it. The person on screen took several seconds to move from one pose to the next. I timed it myself. Depending on the motion, a single frame took hundreds to thousands of times as long to compute as it had before. I opened the code, pointed out what was wrong, and even wrote an example of the fix I wanted. Claude Code said it had fixed it. I reopened the same function and found the computation I’d asked it to move still sitting there. When I checked the other motions, I found the same shared computations rewritten in each one. Motions that had taken a few dozen lines now ran to thousands. The chin-up used to work. Now the bar rattled every time the figure pulled itself up. Take a high kick. Mark where the toes are at a few times during the kick and draw a curve through those points. Add more points where the curve strays too far from the actual path. Use that curve to find the toe position at any time during the kick. I asked Claude Code to build the curve before playback and pointed it to the AutoKnots paper. It looked up the paper and told me several times it was using AutoKnots as I’d asked. Here’s the example I gave it, stripped down to pseudocode. interface PreparedMotion { id: string; name: string; events: MotionEvent ; poseAt t: number : Pose; } function prepareHighKick scene: Scene : PreparedMotion { // Prepare the kick trajectory once. const curve: MotionCurve = prepareKickCurve scene ; return { id: scene.actionId, name: "highKick", events: scene.events, poseAt: t: number : Pose = curve.poseAt t , }; } const motion: PreparedMotion = prepareHighKick scene ; motion.poseAt 0.20 ; motion.poseAt 0.24 ; Here’s Claude Code’s version in the same form. The line that builds the curve is now inside the frame function. function prepareHighKick scene: Scene : PreparedMotion { return { id: scene.actionId, name: "highKick", events: scene.events, poseAt: t: number : Pose = evaluateFrame scene, t , }; } function evaluateFrame scene: Scene, t: number : Pose { // Rebuild the same trajectory every frame. const curve: MotionCurve = prepareKickCurve scene ; return curve.poseAt t ; } const motion: PreparedMotion = prepareHighKick scene ; motion.poseAt 0.20 ; motion.poseAt 0.24 ; At 0.24 seconds, the engine rebuilds the curve it just built for 0.20. Only the time changed. I asked Claude Code to move trajectory preparation out of the frame function. It said it had. When I opened the code, I found a module-level cache and the preparation call still inside the function. In these examples, preparePose scene builds the trajectory and returns a poseAt function. The first fix keyed the cache by scene object. js type PoseAt = t: number = Pose; const cache = new WeakMap