The Rise of Koshary Code

How Vibe Coding Turns Clean Code into Chaos.

July 7, 2026

If you've ever visited Egypt, you've probably heard of Koshary.

It's one of the country's most famous dishes.

Rice. Pasta. Lentils. Chickpeas. Tomato sauce. Garlic vinegar. Fried onions. And a very angry chili sauce on the side.

Each ingredient is great on its own.

But once everything is mixed together…

Good luck separating them again.

Unfortunately, many vibe-coded projects end up looking exactly the same.

Koshary Code (a.k.a. Spaghetti Code's Louder Cousin)

At the beginning, everything is organized:

controllers/
services/
repositories/
models/

Each feature has its own place. The architecture makes sense. Adding a new feature is easy.

Then deadlines arrive.

"We just need one quick fix." "Let's copy this function." "We'll refactor it later." "We don't have time to redesign it."

One sprint later…

  • Business logic is inside controllers.
  • Controllers call each other.
  • SQL queries live in utility files.
  • Validation is duplicated in five different places.
  • Functions are 800 lines long.
  • Configuration is scattered across the project.

Nobody knows where anything belongs anymore.

Congratulations. You've cooked yourself a delicious plate of Koshary Code.

The Problem Isn't the Ingredients

Rice isn't bad. Pasta isn't bad. Lentils aren't bad.

Neither are:

  • React
  • Node.js
  • Python
  • Redis
  • PostgreSQL
  • Kafka
  • Microservices

The problem isn't the technologies.

The problem is throwing everything together until no one can tell where one responsibility ends and another begins.

Symptoms of Koshary Code

You know you're there when:

  • Every change breaks something unrelated.
  • Nobody wants to touch old files.
  • The AI keeps generating code that looks like the existing mess.
  • Code reviews become impossible.
  • The only documentation is "don't touch this file."

At this point, developers stop building features.

They start negotiating with the codebase.

Enter Vibe Coding: The Koshary Accelerator

Now here's where 2026 made everything faster — in both directions.

Vibe coding sounds like a dream:

You describe what you want. The AI writes it. You run it. It works. You ship it.

You never really read the code. You just… vibe.

And honestly? For a prototype, a weekend project, a proof of concept — it's magical.

But here's the uncomfortable truth:

Vibe coding doesn't create architecture. It creates output.

The AI doesn't know your project has a services/ layer unless you tell it. It doesn't know validation already exists in three other files. It doesn't know that this "quick helper function" is the fourth copy of the same logic.

So it does what it does best: it generates something that works — right here, right now, in this one file.

  • Need auth? It writes auth inline.
  • Need a query? It writes SQL right in the handler.
  • Need validation? Fresh copy, coming up.

Every prompt adds another ingredient to the pot.

And unlike a human junior developer, the AI never gets tired. It can produce Koshary Code at 10x speed, 24 hours a day, with full confidence and beautiful comments.

Old-school spaghetti code took years to cook.

A vibe coder can serve a family-sized Koshary in a single weekend..

The Feedback Loop From Hell

Here's the part most people miss.

It doesn’t just autocomplete your code, it learns your habits.

If your repository is clean, it tends to generate clean code. If your repository is chaos… AI becomes incredibly efficient at producing more chaos.

With vibe coding, the loop gets worse:

  1. AI generates messy code.
  2. Messy code becomes the context.
  3. AI generates messier code that matches the context.
  4. You can't review it, because you never understood it in the first place.
  5. Repeat until the only person who understands your codebase is… nobody.

That's the real danger of vibe coding. Not that the code is bad but that nobody is left who knows why anything is where it is.

The codebase becomes a black box...

The Cure (Yes, You Can Still Use AI)

The answer isn't "stop using AI." That ship has sailed, and honestly, it's a great ship.

The answer is: stop vibing, start directing.

The AI is your line cook. You are still the chef. The chef decides where things go.

Here's what that looks like in practice:

1. Give the AI a map before it cooks. A CLAUDE.md, AGENTS.md, or conventions file that says: business logic lives in services, queries live in repositories, validation lives in one place. AI models are surprisingly obedient — when you actually tell them the rules.

2. Review with intent, not with vibes. You don't need to read every line. You need to ask one question per change: "Is this in the right place?" That single question prevents 80% of Koshary.

3. Make the AI refactor, not just generate. The same tool that creates mess at 10x speed can clean it at 10x speed. Point it at a file and say: "Extract the business logic. Remove duplication. Don't change behavior." AI-assisted refactoring may be the most underrated capability of modern AI coding tools.

4. Small plates, always. Small files. Small functions. Small pull requests. Small prompts. The bigger the blob of context, the more the AI mixes concerns.

5. Tests are your garlic vinegar. They cut through everything. With good tests, you can refactor aggressively — human or AI — without fear.

6. Leave the code a little cleaner than you found it. Small improvements compound. Just like technical debt does.

You don't fix Koshary Code by rewriting everything.

You fix it one plate at a time.

The Anti-Koshary Plugin

Because I've seen this problem in so many codebases (including, let's be honest, some of my own), I'm working on something:

Anti-Koshary plugin — an AI-powered tool that audits your codebase, detects the mixing (business logic in controllers, duplicated validation, SQL in random utility files, 800-line functions), and helps you un-mix it, one safe refactor at a time.

Think of it as a strainer for your repository.

It’s focused mainly on vibe-coded projects and people with less technical background.

It won’t rewrite your project overnight. But it will tell you exactly which ingredients ended up in the wrong bowl — and help you put them back where they belong.

More on that soon. đź‘€

Final Thought

Koshary is one of the best dishes you'll ever eat.

Your codebase, however… should never look like one.

Because when every concern is mixed together, every bug becomes harder to find, every feature becomes harder to build, and every developer — human or AI — becomes afraid to make changes.

Vibe coding didn't create this problem.

It just removed the speed limit.

Keep your Koshary on your plate.

Architecture is no longer what slows AI down. It’s what keeps AI useful.