The Brain Sandwich
The Brain Sandwich
During a recent 1:1 session with Emily—one of our top-tier engineers—we found ourselves venting about the current state of AI in software development. We discussed the overwhelming volume of code reviews and the shifting nature of the profession. However, the most pressing issue was the tendency for some developers to completely remove their cognitive involvement from the process, essentially outsourcing their entire workflow to an LLM.
Some in the industry have started calling this phenomenon a Meat Proxy.
To combat this, Emily utilizes a straightforward framework she calls the "Brain Sandwich." This method allows engineers to leverage the power of AI without letting their technical skills atrophy wither away.
The Core Philosophy
The concept is simple: your workflow should always be structured as a trilogy of cognitive effort.
The Formula: Your Brain AI Your Brain
In mathematical terms, we can view the quality of the output as:
🥪 The Sandwich Layers
| Layer | Component | Action | Purpose |
|---|---|---|---|
| Top Bun | Your Brain | Analysis & Planning | Establish context and intent. |
| Filling | AI | Generation | Rapidly produce a draft or solution. |
| Bottom Bun | Your Brain | Review & Refinement | Ensure correctness and maintainability. |
1. The Top Bun: Pre-AI Cognition
Before you prompt an agent to write a single line of code, you must actually read and comprehend the existing system.
While you don't need a granular, step-by-step implementation blueprint, you do need a general trajectory. If you skip this, you risk:
- Building features that don't actually solve the core problem.
- Introducing unnecessary complexity.
- Following a "hallucinated" path that leads nowhere.
2. The Filling: AI Execution
Once you have established the necessary context and a rough goal, it is time to bring in the AI. This is where the heavy lifting happens.
# Example of the AI phase
def ai_generation_phase(context, goal):
solution = llm.generate(context, goal)
return solution
3. The Bottom Bun: Post-AI Verification
When the AI delivers a solution, your job isn't done—it's just beginning. You must critically evaluate the output to determine if it is:
- Correct
- Over-engineered
- Solving the wrong problem entirely
The goal here is to make the work reviewable. You cannot simply pass an AI-generated diff to your teammates. You must:
- Analyze the diff.
- Verify that the added complexity is justified.
- Write a high-quality PR description.
Final Pre-Flight Checklist
- I have read every line of the generated code.
- I can explain what is changing.
- I can explain why it is changing.
- The PR description is clear and concise.
Visualizing the Workflow
The Golden Rule: If you find yourself unable to explain the logic and the reasoning behind a change, it is not ready for a human review.
