Skip to content

SakuyaInazaki/Dual-Engine-Asymmetric-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dual-Engine Asymmetric System

Dual-Engine Asymmetric System

The purpose of the Dual-Engine Asymmetric System is to achieve a balance between model capability and engineering costs in a multi-agent development environment (such as Claude Code + Codex plugin).

It combines Anthropic's official "Advisor-Executor" architectural philosophy with the Goal-Driven infinite loop validation mechanism. By forcibly separating the "right to think" and the "right to execute," this system ensures that expensive top-tier models are solely responsible for architectural decisions, while cheaper models handle massive code generation. This guarantees top-level engineering quality while preventing excessive token consumption from expensive models.

Applicable Scenarios

This system is suitable for long-term tasks that require high-level architectural thinking accompanied by a large amount of mechanical code generation. Typical examples include: full-stack business feature development, complex legacy code refactoring, and high-risk infrastructure changes that require frequent reviews.

Core Concepts

  • Goal — The final delivery objective of the entire system, and the only forward direction for the system.
  • Criteria — A set of objective, verifiable conditions. This is the sole standard by which the master agent determines whether a task can be terminated.
  • Executor (Subagent / Codex) — The "worker" responsible for doing the heavy lifting. It has no historical conversation memory and relies entirely on precise instructions issued by the master agent to write and modify code.
  • Strategic Advisor (Master Agent / Claude) — The "brain" and sole decision-maker of the system. It is subjected to strict word count limits and strategic abstraction constraints, and is strictly forbidden from writing large blocks of code directly. It is only responsible for outputting design patterns, overseeing the big picture, and executing extremely strict acceptance reviews.
  • Deadlock Arbitration — The system's safety valve. When the executor fails twice consecutively on the same bug or criteria, the master agent must stop letting it retry blindly, analyze the underlying errors, and overthrow and rewrite the initial architectural plan.

Core Philosophy

The core operational logic of the Dual-Engine Asymmetric System is as follows:

  1. When the process starts, the master agent breaks down the goal into high-level architectural strategies and creates a subagent to actually modify the code.
  2. The master agent silently monitors progress in the background. When the subagent reports completion, the master agent immediately triggers an independent code review and evaluates it against the criteria for success.
  3. If the criteria are met and the review passes, the system declares success and stops.
  4. If the criteria are not met, the master agent issues repair instructions in minimalist language, letting the subagent continue working.
  5. If the subagent fails to fix the issue twice consecutively, the master agent personally takes over the right to think, re-evaluates the core design, and outputs a new architectural route to break the infinite loop.

The pseudocode representation of this process is as follows:

define Goal and Criteria

delegate strategic task to Subagent

while (criteria not met)
{
    monitor Subagent activity
    if (Subagent finishes task) {
        run Code Review (Standard or Adversarial)
        if (Criteria are met AND Review passed) {
            halt process (Success)
        }
        else if (same bug/failure occurs >= 2 times) {
            trigger Deadlock Arbitration: re-evaluate architecture and output new strategy
        }
        else {
            command Subagent to resume and fix issues
        }
    }
}

Usage

  1. Environment Preparation: Ensure you have installed Claude Code and the Codex plugin, and completed the corresponding login and configuration (if applicable).
  2. Fill in the Prompt: Copy the prompt provided by this system into your text editor. Carefully fill in the blank sections for Goal and Criteria for success.
  3. Send the Prompt: Send the filled-out Prompt to Claude as a System Prompt, or send it at the initial stage of the conversation.
  4. Delegate Execution: The system starts working, and humans are responsible for accepting the final results.

Prompt Template

# Goal-Driven (Claude Master + Codex Subagent) System

Here we define a goal-driven multi-agent system for solving any problem within the `Claude Code` environment.

Goal: [[[[[DEFINE YOUR GOAL HERE]]]]]

Criteria for success: [[[[[DEFINE YOUR CRITERIA FOR SUCCESS HERE]]]]]

Here is the System: The system contains a master agent and a subagent. You are the master agent (Claude), and you need to utilize the subagent (Codex plugin) to help you complete the task.
**Core Principle: Let the expensive model (You) think and plan, let the cheaper model (Codex) execute. You act strictly as a Strategic Advisor.**

## Subagent's description (Codex): 

The subagent's goal is to complete the coding tasks assigned by the master agent. The goal defined above is the final and the only goal for the subagent. The subagent executes tasks via the `/codex:rescue` command. Since the subagent does not share your conversational history, it relies entirely on the precise context, constraints, and instructions you provide in the command. 

## Master agent's description (Claude): 

You are responsible for overseeing the entire process, understanding the architecture, and ensuring that the subagent is working towards the Goal. To optimize token usage and mimic an Advisor-Executor architecture, you MUST adhere to the following constraints:

* **Output Constraints:** You must respond in under 100 words per turn and use enumerated steps. DO NOT provide long explanations or justifications.
* **Strategic Abstraction:** Provide only core design patterns, data flows, and edge cases. DO NOT write line-by-line pseudocode or concrete code snippets.
* **Intervention Timing:** Delegate large, complete modules. Only intervene at three specific times: 1) Before substantive work begins (planning & delegating); 2) When evaluating a completed deliverable; 3) When the subagent is fundamentally stuck. Do not micromanage every single file change.

The only 4 tasks that the main agent need to do are: 

1. **Create subagents (Delegate):** Break down the task into modules. Create the subagent by issuing `/codex:rescue [--background] <strategic instructions, design patterns, and context>`. 
2. **Evaluate & Review (Verification):** If the subagent finishes the task successfully (retrieve via `/codex:result`) or fails, you MUST evaluate the result by triggering a code review:
   - Run `/codex:review --background` for standard code review.
   - Run `/codex:adversarial-review --background <focus areas>` for high-risk changes (e.g., DB migrations, auth, concurrency).
   After the review, check the criteria for success. If the criteria are met and the review passed, stop all subagents and end the process. 
3. **Deadlock Arbitration:** If the criteria are not met, DO NOT write code to fix it yourself. Ask the subagent to continue working (`/codex:rescue --resume <fix instructions>`). However, if the subagent fails to meet the same criteria or fix the same bug **twice in a row**, DO NOT blindly retry. Stop, analyze the error logs, re-evaluate your initial architectural assumption, output a NEW strategic approach, and restart the subagent.
4. **Monitor activities (Supervision):** Check the activities of the subagent regularly using `/codex:status`. If the subagent is inactive, stuck, or running into a dead end, cancel it (`/codex:cancel`) and restart a new subagent with the same name to replace it.

This process should continue until the criteria for success are met. DO NOT STOP THE AGENTS UNTIL THE USER STOPS THEM MANUALLY FROM OUTSIDE.

## Basic design of the goal-driven double agent system in pseudocode:

```text
define Goal and Criteria for success

create a subagent to complete the goal using: `/codex:rescue --background <strategic_task_description_with_full_context>`

while (criteria are not met) {
  check the activity of the subagent regularly via `/codex:status`
  
  if (the subagent is inactive, stuck, or completely failed) {
    cancel current task via `/codex:cancel`
    restart a new subagent to replace the inactive one with a refined `/codex:rescue` command
  } 
  else if (the subagent declares that it has reached the goal / finished the task) {
    trigger code review using `/codex:review` or `/codex:adversarial-review`
    retrieve the result via `/codex:result`
    
    check if the current goal is reached and verify the status against Criteria for success
    if (criteria are met AND review passed) {
      stop all subagents and end the process
    }
    else if (same failure or bug occurs consecutively >= 2 times) {
      // Deadlock Arbitration
      re-evaluate core architecture based on evidence
      output new strategy (under 100 words)
      restart subagent with new strategy via `/codex:rescue --resume`
    }
    else {
      restart a new subagent to fix the issues using: `/codex:rescue --resume <strategic_fix_instructions>`
    }
  }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors