Skip to content
← Back to Writing
2 min read

I let an agent rewrite my legacy backend. Here's what broke.

Attempting a full migration of a Node.js monolith using the new Cursor Composer agent. It wasn't magic, and I spent 3 hours debugging a hallucinated library.

Everyone on Twitter (X? whatever) is screaming about how they built a Spotify clone in 15 minutes. Meanwhile, I'm just trying to migrate a 4-year-old Express backend to Hono without losing my mind.

Last weekend, I decided to test the new Cursor Composer (v2.1) agent on a real, messy, production-grade repo. I didn't want a demo; I wanted to see if it could handle actual spaghetti code.

The Setup#

I didn't give it a prompt like "Make this better." I gave it a specific constraint file:

markdown
# .cursor/rules.md

- You are a Senior Backend Engineer.
- Migrate strictly to Hono v4.
- Do NOT touch the database schema.
- Use Zod for validation.
- If you delete a test, you must replace it.

The Good: It understands "intent" now#

The biggest shift from 2025 is that the agent doesn't just look at the open file. It read my entire utils/ folder before suggesting a refactor.

It successfully identified that my custom authMiddleware was deprecated and swapped it for a standard JWT implementation in Hono without me asking. That saved me about an hour of boilerplate typing.

The Bad: The "Hallucination Loop"#

Here is where the "Agentic Future" hits a wall. The agent decided that to handle file uploads, it needed a library called hono-upload-streamer.

Here's the problem: That library doesn't exist.

It spent 4 iterations trying to npm install a ghost package, then trying to debug the installation failure by modifying my package.json scripts. I had to physically intervene (click the "Stop" button) and type: "Dude, use standard Fetch API."

The Verdict#

We aren't "architects" yet. We are supervisors.

The code it wrote was 90% cleaner than what I would have written on a Friday afternoon. But that last 10%? That's where you earn your salary. If I hadn't caught that hallucinated dependency, I would have broken the build pipeline.

TL;DR: Use agents to write the code, but never let them merge the PR.

Related Posts