Explicit Gears for AI Coding: From a Universal Assistant to an Expert Squad of Roles
This article explains why general-purpose coding agents degrade in real engineering practice and introduces "explicit gears"—a role-based approach that turns implicit intent into explicit, verifiable contracts. It covers a twelve-role structure organized into five layers (decision, design, implementation, quality, and delivery), how to design role configuration files with tool whitelists and output contracts, the requirement-review role to build first, a four-week rollout path, context engineering practices, and the metrics that actually indicate success. Readers will learn how to make AI coding outputs more predictable, reviewable, and safe to merge.
1. The Starting Point: Why Universal Assistants “Degrade” in Engineering Practice
When teams integrate large language models into their development workflow, the first step is almost always the same: give engineers a general-purpose coding agent that can chat about anything. You drop in a natural-language description, and it reads files, modifies code, runs commands, and delivers conclusions all in one go. Short-term efficiency gains are obvious, but a few weeks later a surprisingly stable pattern emerges: the vaguer the task description, the less controllable the output quality.
This is not a model capability problem—it is a process design problem. It can be broken down into three causes.
First, instructions get compressed into an average. What the engineer has in mind is usually “implement a certain capability within this specific codebase, following the existing layering conventions and staying compatible with the live canary state,” but what gets transmitted is only “help me modify this interface.” The model can only answer with the most common solution in its training distribution, so what you get is universally applicable template code that feels awkward everywhere in your repository.
Second, attention gets diluted. The same role simultaneously handles requirement clarification, architecture design, coding, test supplementation, and change review. The system prompt is stuffed with a dozen mutually conflicting constraints (be “concise” yet “cover all edge cases,” “follow the status quo” yet “refactor along the way”). Instruction adherence within a long context decays with position, and the requirements placed first are the first to be forgotten, so the end result is “changed roughly, missed half.”
Third, the responsible party is missing. No role means no boundary of responsibility. When the model is responsible for both producing the plan and proving it correct, its optimal strategy is to output conclusions that “look complete” rather than conclusions that “can be refuted.” You ask it to look at the code, it looks, and the conclusion is bland and safe; you ask it to test, it tests, but it only covers the main paths. This is not laziness—it is structural.
2. The Core Idea: Turning Implicit Intent into Explicit Gears
The standard way the engineering world deals with “ambiguity” has never been to swap in a bigger engine, but to cut up the process, fix the roles, and write interfaces clearly. Migrating this methodology to AI coding yields four principles whose value lies not in making the model “smarter” but in making the output “more predictable.”
- Explicit gear switching (Explicit Gears): The user explicitly declares which gear is currently engaged (decision / design / implementation / review / delivery), so the model does not have to guess intent or juggle all goals in a single prompt.
- Single-role responsibility: A capability unit takes on only one responsibility and is only allowed to use the tools needed for that responsibility. The review role is read-only; only the implementation role can write.
- Output contracts: Each role must return structured results that can be consumed by the next role or by pipeline machinery, not a passage of free-form prose.
- Handoff-able and interruptible: Roles pass context to each other through standard handoff documents, and any step can be vetoed and rolled back by a human without tearing down the whole chain.
The essence of this design is reconstructing “conversing with a model” into “running a pipeline with type signatures.”
3. What Role-Based Capability Units Look Like
A role is not a persona description but a configuration file with metadata, a tool whitelist, and input/output contracts. A sketch:
---name: requirement-reviewmode: analysis-only # read-only analysis, produces no codeinput:- Requirement description (natural language + background)- Target users and use cases- Expected quantifiable outcome- Hard constraints (compliance, performance, schedule, cost)output:verdict: [GO, PIVOT, NO-GO]objections: [] # must provide at least 2 objectionsminimal_scope: [] # minimal viable scopeout_of_scope: [] # explicit not-doing listkill_criteria: [] # conditions under which to abandonhandoff: [solution-design]denied_tools: [write_file, exec_command, git_commit]---You are a strict product decision reviewer, not a requirement scribe.Your job is to judge "whether it is worth doing," not "how to implement it."Do not answer implementation details; when the input is insufficient to support a judgment, return a list of missing information.
A few easily overlooked design points:
- The
modefield determines permissions, rather than relying on the prompt requesting self-discipline. The review role should have no ability to write files or execute commands during the design phase—tightening permissions is far more effective than repeated reminders. objectionsis required with a minimum of two. Forcing “you must object” effectively counteracts the model’s tendency to please, and this is the highest-ROI move for improving decision-type output quality.kill_criteriaup front. Writing down “under what conditions to abandon” in advance prevents a project from having its judgment hijacked by sunk costs midway.- The handoff document is machine-readable. The next role receives fields, not a story, so it can be validated by scripts, gated by the pipeline, and tracked by metrics.
4. How to Organize the Twelve Roles into Layers
When the number of roles exceeds ten, you must layer them, or the handoff overhead will eat up all the benefits. A recommended five-layer structure, where each layer has different responsibilities, outputs, and forbidden zones.
Decision layer (2): requirement review, opportunity assessment. Only makes judgments, producing decisions, objections, and a not-doing list. The forbidden zone is any form of implementation suggestion. This layer addresses “is the direction right,” with the highest ROI.
Design layer (3): architecture design, interface contract, data model. Input is the requirements and minimal scope approved by the decision layer; output is reviewable design documents, interface signatures, and data structures. Interface contracts need to specify version compatibility strategy and error semantics; data models need to specify indexing and growth expectations. The forbidden zone is writing implementation code.
Implementation layer (2): feature implementation, refactoring cleanup. Input is the interface contract and design constraints; output is scoped code changes. It requires “small commits, single-point responsibility,” and must read the repository’s directory conventions and neighboring module styles before acting. The forbidden zone is expanding the change scope on its own.
Quality layer (3): test design, defect reproduction and localization, security and compliance review. Test design produces a case matrix ahead of implementation (normal, boundary, exception, concurrency, idempotency, permission). The defect reproduction role reads only runtime logs and minimal reproduction paths, producing root-cause hypotheses ranked by likelihood. Security review focuses on input validation, privilege escalation, secret leakage, dependency supply chain, and log redaction.
Delivery layer (2): change notes and review preparation, release and rollback plan. Produces a change summary aimed at reviewers (what was done, blast radius, verification evidence, remaining risks) and release steps, observation metrics, and rollback trigger conditions.
The input of each layer is the structured output of the previous layer, and a human can be inserted between any two layers. This way, once a result is wrong, you only roll back one step rather than rerunning the whole chain.
5. The Role to Build First: Decide “Whether to Do It” Before Writing the First Line of Code
Among the whole set of roles, the requirement review role has the highest marginal return, for a simple reason: when the marginal cost of writing code approaches zero, the cost of judgment becomes the real bottleneck.
In the past, it took two weeks to go from idea to launch for a feature, and most of that time was spent coding, so the cost of a wrong “should we do this” decision was naturally filtered out by expensive time costs. Now a feature may produce a usable version in half a day, so a large number of requirements that should have been rejected get implemented at high speed and low unit price—they do not disappear in a draft folder but enter the codebase, enter testing, enter production, and then keep charging maintenance interest in every subsequent iteration. The faster a wrong implementation moves, the stronger the downstream amplification.
The way this role reviews also matters, with the core being stepping back from “how to do it” to “what does done look like”:
- Do not ask about features, ask about the target state. Instead of answering “how to implement this requirement,” first press on “three months after launch, what observable number proves this worked.” If they cannot produce a number, it is probably just an idea, not a requirement.
- Force comparison of alternatives. Must answer “what are the consequences of not doing it” and “is there a cheaper way to achieve it,” including a purely manual process, a configuration change, or reusing an existing capability.
- Proactively shrink scope. The default answer is to cut half of the requirement, listing the “might as well support” parts in the not-doing list. The degree of restraint in scope directly determines the cost of subsequent implementation and quality steps.
- Reject mediocre requirements. For inputs like “add a field,” “add a filter,” “add an export” that have no argument for user value, default to returning NO-GO or requesting more evidence rather than politely entering the design process.
A review template you can use directly:
Input: {requirement description}Please output in the following structure; do not output implementation suggestions:1. Target state: what quantifiable result should be achieved 3 months after launch (return MISSING_EVIDENCE if none)2. At least 2 objections (1 must address "why now")3. Cheaper alternative paths, sorted by ascending cost4. Minimal viable scope (keep only the minimal set that can validate item 1)5. Explicit not-doing list6. Abandonment conditions: what signals should stop further investment7. Verdict: GO / PIVOT / NO-GO + one-sentence reason
6. Implementation Path: Build Your Expert Squad in Four Weeks
Week 1: Build only one role. Start with requirement review. First run it ten times in a real requirement review meeting and observe how many of the objections it raises are genuinely valuable. One role running smoothly is more meaningful than twelve half-finished roles.
Week 2: Tighten permissions and context. Configure a tool whitelist for each role, specifying which directories it can read and which commands it can execute. Analysis roles are all set to read-only.
Week 3: Define the handoff protocol. Specify each layer’s output fields, validation rules, and failure rollback paths. Validate handoff document completeness with scripts; missing fields are directly rejected, and no “verbal supplementation” is allowed.
Week 4: Connect metrics and the pipeline. Make the roles’ outputs the pipeline’s inputs—for example, the case matrix output by the quality layer maps to the test report, and the change summary output by the delivery layer maps to the review template.
7. Context Engineering: Don’t Feed Roles “Everything”
Role division solves “who is working”; context engineering solves “what it can see.” In practice, supply it in four layers, narrowing layer by layer:
- Global layer: Coding standards, directory conventions, commit and branch conventions, banned dependency list. Stable across the repository, cacheable and reusable long-term.
- Map layer: Repository structure index, module dependency relationships, list of key entry files. Lets the role know where to look first instead of blindly doing a full-text search.
- Task layer: Files involved in the current change, related historical changes, failed cases, and log fragments.
- Supplementary layer: Documents and external materials retrieved on demand, enabled only when the task layer information is insufficient.
At the same time, explicitly declare what not to read. Telling the role “no need to read test fixtures and generated artifacts” and “do not traverse the dependency directory” often saves more budget than adding instructions. The context window is a scarce resource; treat it as a cache design—the higher the hit rate, the more stable the output.
Long tasks should not rely on “continuously passing all history forward”; instead, do summary relay: after each step, compress the conclusions into a structured handoff document, and subsequent steps read only the handoff document plus the currently necessary files. This is both cost control and a key means of preventing context pollution.
8. Metrics: Don’t Use Lines of Code and Commit Count as Results
The benefits of role-based design must be verifiable, or it easily degrades into a formalism that “looks professional.” These metrics are recommended to track:
- First-pass plan acceptance rate: The proportion of design-layer plans that need no major human rework, reflecting the quality of context supply.
- Requirement rework rate: The proportion redone after entering implementation due to requirement changes, directly testing whether the decision layer is effective.
- Defect escape rate: The proportion of problems that escape to late-stage testing or production, testing the quality layer’s coverage.
- Human interventions per task: From start to a mergeable state, how many rounds a human intervenes on average.
- Change review rounds: Reflects the readability and completeness of outputs for reviewers.
Explicitly listed as counter-metrics: lines of code, commit count, daily generation volume. The larger these numbers, the more they usually mean scope is out of control rather than efficiency improved. The only criterion for judging whether the role design succeeded is whether the team dares to let its output go directly into the protected flow of the main branch.
9. Connecting with Cloud Engineering Systems
Role-based capability units should not be islands; they are only meaningful when hooked onto existing development infrastructure. General capability categories include: code hosting and branch protection, continuous integration pipelines, artifact repositories, logging services and tracing, monitoring and alerting, secret and configuration management, and operation auditing.
Three connection principles are worth emphasizing:
- Roles can only propose; merge rights belong to humans. All write permission paths must go through branch protection and human review. No convenience of “auto-merge” is worth trading for it.
- Outputs must be machine-verifiable. Change summaries, case matrices, and rollback plans should all be structured files that can serve as pipeline inputs or gate conditions, not prose pasted into review comments.
- Least-privilege credentials + full audit. Credentials used by agents are divided by role and issued with short TTLs per task, and all sensitive operations are logged and traceable.
10. Common Anti-Patterns
- Piling up a dozen roles without layering: Handoff overhead exceeds the benefits, and the team ends up using just one role.
- Writing roles as lengthy persona manifestos: Personality descriptions produce no constraints; field contracts do. Constraints come before personality.
- Giving review roles write permissions: Once they can modify code, they start to “fix it along the way,” and the review value immediately drops to zero.
- No structured verdict: Outputting vague conclusions like “overall not bad, could do part of it first” is equivalent to no review.
- Treating context as a trash can: Stuffing everything in gets you key constraints drowned out.
- Replacing judgment with tools: Agents can accelerate implementation but cannot bear the decision responsibility of “whether to do it” for you.
11. Conclusion
From universal assistant to expert squad, what changes is not the model’s parameter count but our design precision for the process. The value of explicit gears can be summed up in one sentence: turn invisible intent into visible contracts, and turn uncontrollable output into verifiable artifacts.
For most teams, the most cost-effective starting point is just one—first build that read-only requirement review role, and let it ask, before every “help me look at the code” and “help me test this,” “is this worth doing, and what proves it holds up.” Once this link runs smoothly, gradually fill in the design, implementation, quality, and delivery roles according to the five-layer structure, and connect branch protection, pipeline gates, and monitoring alerts along the way. The maturity of a technical solution ultimately is not reflected in how strong a model you use, but in how many clearly bounded gears you cut an ambiguous problem into.
