Open sourceNEWS BRIEFING

Rejecting Hallucinations: Senior Engineer Open-Sources Three-Gate Workflow for Claude Code and Cursor

2 min read

88Z AI, 20 November — Vaibhav, an engineer with over 4,500 hours of AI coding experience, has open-sourced a workflow for Claude Code and Cursor that reduces rework rates by over 80% through a three-stage gating system: Plan, Critique, and Readiness. This approach mandates architectural alignment and adversarial review before any code is written, addressing the logical chaos often seen in multi-file AI modifications.

At a glance

  • Core Principle: Never allow Agents to modify business code without state gates
  • Three-Gate System: Plan (read-only planning), Critique (adversarial review), Readiness (unlock write after verification)
  • Proven Impact: Reduced rework rates for complex features by over 80%, compatible with Claude Code and Cursor
  • Resource Access: Full workflow open-sourced in the GitHub repository my-ai-coding-workflow
Diagram of the three-gate workflow from the my-ai-coding-workflow repository
Diagram of the three-gate workflow from the my-ai-coding-workflow repository

Background and Pain Points: Why AI Coding Spirals Out of Control

In a highly upvoted post on Reddit’s r/ClaudeCode community, senior backend engineer Vaibhav highlights a common dilemma: while tools like Claude Code and Cursor are hailed as productivity boosters, many developers struggle when tasks involve modifying more than three files, often encountering hallucinations and deteriorating code structure. Drawing from over 4,500 hours of intensive AI-assisted coding experience, Vaibhav identifies the root cause as a lack of state constraints on Agent behavior. He argues that allowing AI agents to directly modify business code without explicit state gates inevitably leads to implicit coupling and missed edge cases.

Core Mechanism: A Three-Stage State Machine in .claude/

To address this, Vaibhav encapsulated his two-year-refined workflow into the .claude/ directory, designing it as a strict three-stage state machine. The first gate, "Plan (Architectural Alignment)," forces the Agent into read-only mode. It scans relevant modules and outputs a plan document with clear file boundaries, interface signatures, and invariant constraints, strictly prohibiting any file-writing tools. The second gate, "Critique (Adversarial Review)," initiates a separate review sub-context. Acting as a "ruthless senior architect," it aggressively critiques the plan to identify implicit couplings, missing boundaries, and over-engineering.

Execution Flow: From Readiness Check to Permission Unlock

The third gate is "Readiness." Code writing permissions are unlocked only after the plan passes the critical review and specific verification unit test commands are defined. This seemingly "slower" gating mechanism ensures accuracy and stability in subsequent code generation by controlling risks upfront. Vaibhav reports that this approach reduced rework rates for complex features by over 80%. The complete workflow is open-sourced in the GitHub repository my-ai-coding-workflow for developers to integrate and reference.

88Z Perspective

Vaibhav’s workflow reveals a key trend: the value proposition of AI coding is shifting from "generation speed" to "control precision." Traditional prompt engineering often focuses on better requirement description, whereas this state-machine-based gating introduces software engineering rigor, treating AI as an executor requiring strict supervision rather than an omniscient partner. For teams, directly copying the repository may not be optimal, but its core philosophy—mandating independent architectural review and test planning before writing—should be integrated into existing CI/CD pipelines or development standards. Developers should focus on offsetting the probabilistic defects of large models through structured constraints while maintaining agility.

Sources & editorial note

This article is an AI-assisted synthesis by 88Z AI based on the public sources below. Product claims and availability are attributed to their publishers. It does not represent independent testing or first-hand reporting.

  1. @mylifccSource published

Source dates above refer to the original announcements; the date under the headline is this article’s publication on 88Z AI.

All AI news

Related reading

All stories
88Z.ai