opencode-orchestrator 1.0.58 → 1.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,7 +18,6 @@
18
18
  npm install -g opencode-orchestrator
19
19
  ```
20
20
 
21
-
22
21
  In an OpenCode environment:
23
22
  ```bash
24
23
  /task "Implement"
@@ -64,7 +63,7 @@ This philosophy extends to efficiency. We achieved **Zero-Configuration** usabil
64
63
  ╚══════╤═══════════╤═══════════╤══════╝ │
65
64
  │ │ │ │
66
65
  ┌──────▼───┐ ┌─────▼────┐ ┌────▼─────┐ │
67
- │🔍REVIEWER│ │🔍REVIEWER│ │🔍REVIEWER│
66
+ │🔍REVIEWER│ │🔍REVIEWER│ │🔍REVIEWER│ (Module-level)
68
67
  └──────┬───┘ └─────┬────┘ └────┬─────┘ │
69
68
  │ │ │ │
70
69
  ═▼═══════════▼═══════════▼═ │
@@ -72,18 +71,19 @@ This philosophy extends to efficiency. We achieved **Zero-Configuration** usabil
72
71
  ═════════════╤═════════════ │
73
72
  │ │
74
73
  ┌───────────▼───────────┐ │
75
- 📋 VERIFICATION │ (Checklist Gate)
74
+ 🎖️ MASTER REVIEWER │ (Final Verification Authority)
76
75
  │ ┌─────────────────┐ │ │
77
76
  │ │ [x] Build Pass │ │ │
78
77
  │ │ [x] Tests Pass │ │ │
79
- │ │ [x] No Errors │ │ │
78
+ │ │ [x] E2E Pass │ │ │
79
+ │ │ [x] Sync OK │ │ │
80
80
  │ └─────────────────┘ │ │
81
81
  └───────────┬───────────┘ │
82
82
  │ │
83
83
  __________▼_________ │
84
- ╱ ╲ NO (Loop / Auto-Correction)
85
- ╱ ✅ Checklist 100%? ╲ ──────────────────────────────────────────┘
86
- ╲ 🛡️ Sync Issues 0? ╱
84
+ ╱ ╲ NO (Failure Summary → Commander)
85
+ ╱ ✅ All Checks Pass ╲ ──────────────────────────────────────────┘
86
+ ╲ 🛡️ Sync Issues 0? ╱ (Infinite Loopback Until Resolved)
87
87
  ╲____________________╱
88
88
  │ YES
89
89
 
@@ -95,10 +95,9 @@ This philosophy extends to efficiency. We achieved **Zero-Configuration** usabil
95
95
  └───────────────────────┘
96
96
  ```
97
97
 
98
-
99
98
  ---
100
99
 
101
- ## 🧠 Cognitive Architecture & Key Strengths
100
+ ## Cognitive Architecture & Key Strengths
102
101
 
103
102
  ### 📉 Adaptive Context Gating (EMA-based)
104
103
  We combat "Context Drift" using a mechanism derived from **Exponential Moving Average (EMA)** algorithms. Irrelevant conversation noise follows a rapid decay curve, while critical architectural decisions are reinforced into **Stable Core Memory**. This functions as an **Attention Sink**, allowing agents to work indefinitely without **Catastrophic Forgetting**.
@@ -117,11 +116,22 @@ Pure LLM approaches are stochastic. We bind them with a **Neuro-Symbolic Archite
117
116
  The engine features an **Intelligent Load-Balancing System** that fluidly switches between synchronous barriers and asynchronous **Fork-Join** patterns. It monitors **System Backpressure** to dynamically adjust concurrency slots in real-time (`Adaptive Throttling`), maximizing throughput on high-end hardware while maintaining stability on constrained environments.
118
117
 
119
118
  ### 🎯 Iterative Rejection Sampling (Zero-Shot Defense)
120
- We employ a **Rejection Sampling Loop** driven by the Reviewer Agent (**Reward Model**). Through the **Metric-based Strict Verification Protocol (MSVP)**, code paths that fail execution tests are pruned. The system iterates until the solution converges on a mathematically correct state (0% Error Rate), rejecting any solution that lacks evidence.
119
+ We employ a **Rejection Sampling Loop** driven by the Master Reviewer Agent (**Final Reward Model**). Through the **Metric-based Strict Verification Protocol (MSVP)**, code paths that fail execution tests are pruned. The system iterates until the solution converges on a mathematically correct state (0% Error Rate), rejecting any solution that lacks evidence.
121
120
 
122
121
  ### 🧩 Externalized Chain-of-Thought (CoT)
123
122
  The Planner's `TODO.md` serves as an **Externalized Working Memory** (Scratchpad). This persistent **Symbolic Chain-of-Thought** decouples detailed planning from the LLM's immediate context window, enabling the orchestration of massive, multi-step engineering tasks without logical degradation.
124
123
 
124
+ ### 🔄 Hierarchical Verification Pipeline (MVP)
125
+ The system employs a **Multi-Stage Verification Pipeline**:
126
+ 1. **Module-Level**: Reviewers verify individual Worker outputs (unit tests, type checks)
127
+ 2. **System-Level**: Master Reviewer performs comprehensive E2E verification
128
+ 3. **Loopback**: Failed checks trigger automatic re-planning and correction cycles
129
+
130
+ This separation of concerns ensures both granular code quality and holistic system integrity.
131
+
132
+ ### 🌍 Environment-Agnostic Verification
133
+ The Master Reviewer **auto-detects** project environments (Node.js, Rust, Python, Java, Go, C/C++, Docker, etc.) and adapts verification strategies accordingly. No hardcoded assumptions—true polyglot support.
134
+
125
135
  ---
126
136
 
127
137
  ## ⚡ Agents
@@ -129,9 +139,10 @@ The Planner's `TODO.md` serves as an **Externalized Working Memory** (Scratchpad
129
139
  | Agent | Role |
130
140
  |:------|:-----|
131
141
  | **Commander** | Orchestrates the mission, manages parallel threads and sync barriers |
132
- | **Planner** | Architecture architect. Breaks downtasks into strictly defined steps |
142
+ | **Planner** | Architecture architect. Breaks down tasks into strictly defined steps |
133
143
  | **Worker** | The builder. Writes code and corresponding unit tests |
134
- | **Reviewer** | The gatekeeper. Rejects any code that doesn't pass execution verification |
144
+ | **Reviewer** | Module-level gatekeeper. Verifies Worker outputs with build/test execution |
145
+ | **Master Reviewer** | 🎖️ Final verification authority. Runs comprehensive E2E tests and holds **exclusive SEAL rights** |
135
146
 
136
147
  ---
137
148
 
@@ -141,10 +152,11 @@ The Planner's `TODO.md` serves as an **Externalized Working Memory** (Scratchpad
141
152
 
142
153
  [System Architecture →](docs/SYSTEM_ARCHITECTURE.md)
143
154
 
144
- [Architectural Verification Report →](docs/ARCHITECTURAL_VERIFICATION_REPORT.md)
145
-
146
155
  ---
147
156
 
148
157
  ## 📄 License
149
158
 
150
159
  MIT License. See [LICENSE](LICENSE) for details.
160
+
161
+
162
+
@@ -6,6 +6,7 @@
6
6
  * - Planner: Planning + Research
7
7
  * - Worker: Implementation + Documentation
8
8
  * - Reviewer: Verification + Context Management
9
+ * - Master Reviewer: Final verification authority (SEAL rights)
9
10
  */
10
11
  import type { AgentDefinition } from "../shared/agent/interfaces/index.js";
11
12
  export declare const AGENTS: Record<string, AgentDefinition>;
@@ -14,3 +14,4 @@ export * from "./roles/commander/index.js";
14
14
  export * from "./roles/planner/index.js";
15
15
  export * from "./roles/worker/index.js";
16
16
  export * from "./roles/reviewer/index.js";
17
+ export * from "./roles/master-reviewer/index.js";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Master Reviewer Capabilities
3
+ *
4
+ * What the Master Reviewer IS ALLOWED to do.
5
+ * Environment-agnostic, flexible for any project type.
6
+ */
7
+ export declare const MASTER_REVIEWER_CAPABILITIES: string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Master Reviewer Forbidden Actions
3
+ *
4
+ * Actions that the Master Reviewer must NEVER do.
5
+ * For allowed actions, see capabilities.ts
6
+ */
7
+ export declare const MASTER_REVIEWER_FORBIDDEN: string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Master Reviewer Role Identity
3
+ *
4
+ * The Master Reviewer is the FINAL GATE before mission completion.
5
+ * Only the Master Reviewer can authorize SEAL.
6
+ */
7
+ export declare const MASTER_REVIEWER_ROLE: string;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Master Reviewer Prompts Index
3
+ */
4
+ export { MASTER_REVIEWER_ROLE } from "./identity.js";
5
+ export { MASTER_REVIEWER_VERIFICATION_PROCESS } from "./verification-process.js";
6
+ export { MASTER_REVIEWER_SEAL_AUTHORITY } from "./seal-authority.js";
7
+ export { MASTER_REVIEWER_FORBIDDEN } from "./forbidden.js";
8
+ export { MASTER_REVIEWER_CAPABILITIES } from "./capabilities.js";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Master Reviewer Seal Authority
3
+ *
4
+ * The decision protocol for when to SEAL or return failure.
5
+ * Emphasizes the infinite loop until all problems are resolved.
6
+ */
7
+ export declare const MASTER_REVIEWER_SEAL_AUTHORITY: string;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Master Reviewer Verification Process
3
+ *
4
+ * Environment-agnostic comprehensive verification workflow.
5
+ * Works for ANY project type: Node, Rust, Java, Python, C/C++, Go,
6
+ * containers, kernel development, AI/ML, embedded systems, etc.
7
+ */
8
+ export declare const MASTER_REVIEWER_VERIFICATION_PROCESS: string;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Reviewer Forbidden Actions
3
3
  *
4
- * Verification integrity - never approve without evidence.
5
- * Reviewer is a TERMINAL node and cannot spawn other agents.
4
+ * Module-level verification only.
5
+ * Reviewer is a TERMINAL node and cannot spawn other agents or output SEAL.
6
6
  */
7
7
  export declare const REVIEWER_FORBIDDEN: string;
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Reviewer Role
3
3
  *
4
- * The gatekeeper who verifies with evidence.
4
+ * Module-level verification specialist.
5
+ * Verifies individual Worker tasks, NOT final mission completion.
5
6
  */
6
7
  export declare const REVIEWER_ROLE: string;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Reviewer Integration Testing
3
3
  *
4
- * E2E testing when TODO is almost done or at the end.
5
- * Language-agnostic.
4
+ * Individual file/module integration checks.
5
+ * Full E2E and final verification is handled by Master Reviewer.
6
6
  */
7
7
  export declare const REVIEWER_INTEGRATION_TESTING: string;
@@ -2,5 +2,7 @@
2
2
  * Reviewer Sync Verification
3
3
  *
4
4
  * Verify file synchronization and report issues for next iteration.
5
+ * Note: Final SEAL is handled by Master Reviewer, not Reviewer.
6
+ * Environment-agnostic - works for any project type.
5
7
  */
6
8
  export declare const REVIEWER_SYNC_VERIFICATION: string;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Master Reviewer Agent (Subagent)
3
+ *
4
+ * FINAL VERIFICATION AUTHORITY - Only agent that can authorize SEAL.
5
+ * Runs comprehensive verification before mission completion.
6
+ *
7
+ * Responsibilities:
8
+ * - Create and execute verification checklist
9
+ * - Run all verification checks (build, test, e2e, environment)
10
+ * - Mark checklist items with evidence
11
+ * - Output SEAL or return failure summary to Commander
12
+ */
13
+ import type { AgentDefinition } from "../../shared/agent/interfaces/index.js";
14
+ export declare const masterReviewer: AgentDefinition;
package/dist/index.js CHANGED
@@ -31,7 +31,8 @@ var init_names = __esm({
31
31
  COMMANDER: "Commander",
32
32
  PLANNER: "Planner",
33
33
  WORKER: "Worker",
34
- REVIEWER: "Reviewer"
34
+ REVIEWER: "Reviewer",
35
+ MASTER_REVIEWER: "MasterReviewer"
35
36
  };
36
37
  }
37
38
  });
@@ -1891,6 +1892,12 @@ var init_tags = __esm({
1891
1892
  VERIFICATION_PROCESS: { open: "<verification_process>", close: "</verification_process>" },
1892
1893
  TODO_MANAGEMENT: { open: "<todo_management>", close: "</todo_management>" },
1893
1894
  OUTPUT_FORMAT: { open: "<output_format>", close: "</output_format>" },
1895
+ // === Master Reviewer ===
1896
+ SEAL_AUTHORITY: { open: "<seal_authority>", close: "</seal_authority>" },
1897
+ FORBIDDEN: { open: "<forbidden>", close: "</forbidden>" },
1898
+ CAPABILITIES: { open: "<capabilities>", close: "</capabilities>" },
1899
+ VERIFICATION_COMPLETE: { open: "<verification_complete>", close: "</verification_complete>" },
1900
+ VERIFICATION_FAILED: { open: "<verification_failed>", close: "</verification_failed>" },
1894
1901
  // === Mission Loop ===
1895
1902
  MISSION_LOOP: { open: "<mission_loop>", close: "</mission_loop>" },
1896
1903
  AUTONOMOUS_MODE: { open: "<autonomous_mode>", close: "</autonomous_mode>" }
@@ -16482,72 +16489,50 @@ ${PROMPT_TAGS.QUALITY_CHECKLIST.close}`;
16482
16489
 
16483
16490
  // src/agents/prompts/mission/seal-conditions.ts
16484
16491
  init_shared();
16485
- var CHECKLIST_FILE = CHECKLIST.FILE;
16486
16492
  var SEAL_CONDITIONS = `
16487
- ## \u26A0\uFE0F MISSION SEAL VERIFICATION (SYSTEM-ENFORCED)
16488
-
16489
- > **CRITICAL**: The system will VERIFY your SEAL and REJECT it if conditions are not met.
16490
- > Premature SEAL = Automatic rejection + forced continuation.
16491
-
16492
- ### \u{1F4CB} VERIFICATION CHECKLIST WORKFLOW
16493
+ ## \u26A0\uFE0F MISSION COMPLETION PROTOCOL
16493
16494
 
16494
- **Step 1: Create Checklist**
16495
- Create \`${CHECKLIST_FILE}\` with all verification items for this project:
16496
- \`\`\`markdown
16497
- # Verification Checklist
16495
+ > **IMPORTANT**: You (Commander) CANNOT output ${MISSION_SEAL.PATTERN} directly.
16496
+ > Only ${AGENT_NAMES.MASTER_REVIEWER} has SEAL authority.
16498
16497
 
16499
- ## Code Quality
16500
- - [ ] **Lint**: No lint errors
16501
- - [ ] **Type Check**: Type checking passes
16498
+ ### When to Call Master Reviewer
16502
16499
 
16503
- ## Unit Tests
16504
- - [ ] **Unit Tests**: All unit tests pass
16500
+ Call ${AGENT_NAMES.MASTER_REVIEWER} when ALL of the following are true:
16501
+ - \u2705 All TODO items are marked [x] in ${PATHS.TODO}
16502
+ - \u2705 No unresolved issues in ${PATHS.SYNC_ISSUES}
16503
+ - \u2705 All Workers have completed their tasks
16504
+ - \u2705 All Reviewers have verified their modules
16505
16505
 
16506
- ## Build Verification
16507
- - [ ] **Build**: Project builds successfully
16506
+ ### How to Call Master Reviewer
16508
16507
 
16509
- ## Infrastructure (Discover & Add)
16510
- - [ ] **[Project-specific]**: [Description]
16508
+ \`\`\`
16509
+ delegate_task({
16510
+ agent: "${AGENT_NAMES.MASTER_REVIEWER}",
16511
+ description: "Final verification and SEAL",
16512
+ prompt: "Perform final verification. If ALL checks pass, output SEAL."
16513
+ })
16511
16514
  \`\`\`
16512
16515
 
16513
- **Step 2: Execute Each Check**
16514
- - Run the actual verification command
16515
- - Observe the result
16516
- - Mark [x] only when VERIFIED PASS
16516
+ ### Master Reviewer Outcomes
16517
16517
 
16518
- **Step 3: Seal When Complete**
16519
- - ALL checklist items must be [x]
16520
- - ${PATHS.SYNC_ISSUES} must be EMPTY
16521
- - Only then output ${MISSION_SEAL.PATTERN}
16518
+ **If SEAL is output**:
16519
+ 1. \u26A0\uFE0F **YOU MUST ECHO THE SEAL** - Output the exact same ${MISSION_SEAL.PATTERN} that Master Reviewer returned
16520
+ 2. Do NOT modify or wrap the SEAL
16521
+ 3. Mission complete! \u{1F396}\uFE0F
16522
16522
 
16523
- ---
16523
+ **Why echo is required**: The system hooks detect SEAL from YOUR output (main session).
16524
+ If you don't echo the SEAL, the system won't recognize mission completion.
16524
16525
 
16525
- ### \u2705 SEALED = ALL must be TRUE:
16526
- \`\`\`
16527
- ${STATUS_LABEL.SUCCESS.toUpperCase()} ${CHECKLIST_FILE}: ALL items [x] (or TODO 100% if no checklist)
16528
- ${STATUS_LABEL.SUCCESS.toUpperCase()} ${PATHS.SYNC_ISSUES}: EMPTY (0 unresolved issues)
16529
- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
16530
- ONLY WHEN ALL ABOVE ARE TRUE \u2192 output ${MISSION_SEAL.PATTERN}
16531
- \`\`\`
16526
+ **If failure summary is returned (${PROMPT_TAGS.VERIFICATION_FAILED.open}...${PROMPT_TAGS.VERIFICATION_FAILED.close})**:
16527
+ 1. Analyze the failure details
16528
+ 2. Address the issues (spawn Workers/Reviewers as needed)
16529
+ 3. Call Master Reviewer again when fixed
16532
16530
 
16533
- ### \u274C SEAL WILL BE REJECTED IF:
16534
- \`\`\`
16535
- ${STATUS_LABEL.FAIL.toUpperCase()} ANY [ ] uncompleted items in checklist
16536
- ${STATUS_LABEL.FAIL.toUpperCase()} ANY issues listed in ${PATHS.SYNC_ISSUES}
16537
- ${STATUS_LABEL.FAIL.toUpperCase()} Verification evidence is missing
16538
- \`\`\`
16539
-
16540
- ### \u26A0\uFE0F SYSTEM ENFORCEMENT
16541
- - The orchestrator performs HARD VERIFICATION on every SEAL attempt
16542
- - If checklist exists \u2192 ALL items must be [x]
16543
- - If no checklist \u2192 ALL TODO items must be [x]
16544
- - ${PATHS.SYNC_ISSUES} is ALWAYS checked
16545
- - Premature SEAL = REJECTED + forced continuation
16546
-
16547
- ### BEFORE SEAL - VERIFY
16548
- 1. \`cat ${CHECKLIST_FILE}\` - ALL [x]
16549
- 2. \`cat ${PATHS.SYNC_ISSUES}\` - EMPTY
16550
- 3. ONLY THEN: ${MISSION_SEAL.PATTERN}
16531
+ ### DO NOT
16532
+ - \u274C Output ${MISSION_SEAL.PATTERN} yourself (only echo from Master Reviewer)
16533
+ - \u274C Skip Master Reviewer verification
16534
+ - \u274C Claim completion without Master Reviewer approval
16535
+ - \u274C Forget to echo the SEAL when received
16551
16536
  `;
16552
16537
 
16553
16538
  // src/agents/prompts/mission/loop-continuation.ts
@@ -16566,21 +16551,20 @@ cat ${PATHS.SYNC_ISSUES} 2>/dev/null || echo "No sync issues"
16566
16551
 
16567
16552
  ---
16568
16553
 
16569
- ## E2E Test Timing
16570
-
16571
- E2E starts when **${PATHS.TODO} \u2265 80%**:
16572
- ...
16554
+ ## Decision Matrix
16573
16555
 
16574
- ### Decision Matrix
16556
+ | ${PATHS.TODO} Status | ${PATHS.SYNC_ISSUES} | Action |
16557
+ |--------|--------|--------|
16558
+ | Incomplete items | Any | Continue work |
16559
+ | All [x] | Issues exist | Fix sync issues |
16560
+ | All [x] | Empty | Call ${AGENT_NAMES.MASTER_REVIEWER} for final verification |
16575
16561
 
16576
- | ${PATHS.TODO} % | ${PATHS.SYNC_ISSUES} | Phase |
16577
- |--------|--------|-------|
16578
- | < 100% | Any | ${WORK_STATUS.PHASE.IMPLEMENTATION} |
16579
- | \u2265 80% | Any | ${WORK_STATUS.PHASE.E2E} (parallel) |
16580
- | 100% | > 0 | ${WORK_STATUS.PHASE.FIXING} |
16581
- | 100% | 0 | ${WORK_STATUS.PHASE.SEALING} (${STATUS_LABEL.SUCCESS.toUpperCase()}) |
16562
+ ### When All Work Complete
16563
+ When ALL TODO items are [x] and NO sync issues:
16564
+ \u2192 Spawn ${AGENT_NAMES.MASTER_REVIEWER} for final verification
16565
+ \u2192 ${AGENT_NAMES.MASTER_REVIEWER} will output SEAL if all checks pass
16566
+ \u2192 If ${AGENT_NAMES.MASTER_REVIEWER} returns failure, address issues and retry
16582
16567
 
16583
- ...
16584
16568
  ${PROMPT_TAGS.LOOP_CONTINUATION.close}
16585
16569
 
16586
16570
  `;
@@ -16669,93 +16653,55 @@ ${PROMPT_TAGS.VERIFICATION.close}
16669
16653
  // src/agents/prompts/verification/integration.ts
16670
16654
  init_shared();
16671
16655
  var REVIEWER_INTEGRATION_TESTING = `${PROMPT_TAGS.INTEGRATION_TESTING.open}
16672
- ## E2E INTEGRATION TESTING RULES
16673
-
16674
- ### 1. Timing
16675
- Start when **${PATHS.TODO} \u2265 80%** (some Workers still active).
16656
+ ## INTEGRATION TESTING (Module Level)
16676
16657
 
16677
- ### 2. Pre-integration Checklist
16678
- Before running integration tests, all merged files must:
16679
- - [ ] Have clean lsp_diagnostics
16680
- - [ ] Have unit test passing records in ${PATHS.UNIT_TESTS}/
16681
- - [ ] Be listed in ${PATHS.WORK_LOG} "Pending Integration"
16658
+ ### Scope
16659
+ ${AGENT_NAMES.REVIEWER} handles **module-level** integration:
16660
+ - Cross-file imports work correctly
16661
+ - Shared types are consistent
16662
+ - Interface contracts are honored
16682
16663
 
16683
- ### Integration Workflow (Master Mode)
16664
+ > **NOTE**: Full E2E verification is handled by ${AGENT_NAMES.MASTER_REVIEWER} at mission end.
16684
16665
 
16685
- #### Step 0: Direct File Reading
16686
- Read all modified files directly from ${PATHS.WORK_LOG}. Identify:
16687
- - Cross-module interface changes
16688
- - Shared constant modifications
16689
- - Potential synchronization bottlenecks
16666
+ ### Pre-Integration Checklist
16667
+ Before marking integration complete, verify:
16668
+ - [ ] LSP diagnostics are clean
16669
+ - [ ] Unit tests pass for this module
16670
+ - [ ] Imports/exports are correctly synchronized
16690
16671
 
16691
- [NOTE]: Read directly - no parallel scout overhead, saves tokens.
16672
+ ### Integration Workflow
16692
16673
 
16693
- #### Step 1: Check ${PATHS.TODO} Status
16674
+ #### Step 1: Check Module Dependencies
16694
16675
  \`\`\`bash
16695
- cat ${PATHS.TODO}
16696
- # If incomplete items exist, wait for E2E
16697
- \`\`\`
16698
-
16699
- #### Step 2: Global Consistency Check
16700
- - Do all modules agree on shared types?
16701
- - Are imports/exports correctly synchronized across files?
16702
- - Record results in ${PATHS.SYNC_ISSUES}
16703
-
16704
- #### Step 3: Run Build (language-appropriate)
16705
- \`\`\`bash
16706
- # Run project build command (from ${PATHS.CONTEXT})
16707
- # If failed, record in ${PATHS.SYNC_ISSUES}
16676
+ # Verify imports work
16677
+ cat ${PATHS.WORK_LOG}
16708
16678
  \`\`\`
16709
16679
 
16710
- #### Step 4: Run Full Tests
16680
+ #### Step 2: Run Module Build
16711
16681
  \`\`\`bash
16712
- # Run project test command (from ${PATHS.CONTEXT})
16713
- # Check for regressions
16682
+ # Build this module (not full project)
16683
+ # Check for errors specific to this module
16714
16684
  \`\`\`
16715
16685
 
16716
- #### Step 5: Write E2E Integration Test (if needed)
16717
- - Write integration test in appropriate format
16718
- - Verify multiple files work together
16719
- - Unlike isolated tests, DO NOT delete
16720
-
16721
- #### Step 6: Record Results
16722
- Write to ${PATHS.INTEGRATION_STATUS}:
16686
+ #### Step 3: Record Issues
16687
+ If issues found, write to ${PATHS.SYNC_ISSUES}:
16723
16688
  \`\`\`markdown
16724
- # Integration Status
16725
-
16726
- ## Last Integration
16727
- - Timestamp: [ISO timestamp]
16728
-
16729
- ## Result
16730
- - Build: ${STATUS_LABEL.PASS}/${WORK_STATUS.TEST_RESULT.FAIL}
16731
- - E2E Test: ${STATUS_LABEL.PASS}/${WORK_STATUS.TEST_RESULT.FAIL}
16732
-
16733
- ## Sync Issues Found
16734
- - (omit if none)
16689
+ ## Integration Issue
16690
+ - File: [filename]
16691
+ - Issue: [description]
16692
+ - Cause: [analysis]
16735
16693
  \`\`\`
16736
16694
 
16737
- ---
16738
-
16739
- ## Loop Condition Check (SYSTEM-VERIFIED)
16740
-
16741
- > \u26A0\uFE0F The orchestrator performs HARD VERIFICATION on every SEAL attempt.
16742
- > Premature SEAL = Automatic rejection + forced continuation.
16743
-
16744
- ### SEALED Conditions (all must be true - verified by system)
16745
- - [x] ${PATHS.TODO} all items [x] (system verifies)
16746
- - [x] ${PATHS.SYNC_ISSUES} is EMPTY (system verifies)
16747
- - [x] Build passes
16748
- - [x] E2E test passes
16695
+ ### What Reviewer Does NOT Do
16696
+ - \u274C Full E2E testing (Master Reviewer does this)
16697
+ - \u274C Final SEAL decision (Master Reviewer does this)
16698
+ - \u274C Complete checklist verification (Master Reviewer does this)
16749
16699
 
16750
- ### LOOP BACK Conditions
16751
- - ${PATHS.TODO} has incomplete items \u2192 SEAL REJECTED \u2192 LOOP
16752
- - ${PATHS.SYNC_ISSUES} has unresolved issues \u2192 SEAL REJECTED \u2192 LOOP
16753
- - Build/test fails \u2192 record in ${PATHS.SYNC_ISSUES} \u2192 LOOP
16700
+ ### After Module Review
16701
+ 1. Mark [x] for reviewed items in TODO
16702
+ 2. Record any sync issues
16703
+ 3. Report status to Commander
16754
16704
 
16755
- **CRITICAL**:
16756
- - E2E only at ${PATHS.TODO} completion time!
16757
- - Read modified files directly for maximum efficiency.
16758
- - All ${PATHS.TODO} [x] + no issues = SEALED!
16759
16705
  ${PROMPT_TAGS.INTEGRATION_TESTING.close}`;
16760
16706
 
16761
16707
  // src/agents/prompts/verification/sync-check.ts
@@ -16768,17 +16714,16 @@ After integration, verify all files are properly synchronized.
16768
16714
  ### Sync Check Areas
16769
16715
 
16770
16716
  #### 1. Import/Export Consistency
16771
- \`\`\`bash
16772
- # Check for broken imports
16773
- npm run build 2>&1 | grep -i "cannot find"
16774
- npm run build 2>&1 | grep -i "not exported"
16775
- \`\`\`
16717
+ Run the project's **build command** and check for:
16718
+ - Missing imports/includes
16719
+ - Missing exports/declarations
16720
+ - Broken dependencies
16776
16721
 
16777
- #### 2. Type Consistency
16778
- \`\`\`bash
16779
- # Check for type mismatches
16780
- npx tsc --noEmit 2>&1 | grep -i "type"
16781
- \`\`\`
16722
+ #### 2. Type/Interface Consistency
16723
+ Run the project's **type check command** (if applicable) and check for:
16724
+ - Type mismatches across files
16725
+ - Interface implementation errors
16726
+ - Signature mismatches
16782
16727
 
16783
16728
  #### 3. Interface Implementation
16784
16729
  - Check implemented interfaces match declarations
@@ -16818,23 +16763,15 @@ When re-verifying after fixes:
16818
16763
 
16819
16764
  ---
16820
16765
 
16821
- ### Loop Continuation (NOT SEALED)
16766
+ ### Loop Continuation
16822
16767
  If sync issues exist:
16823
16768
  1. Write ONLY unresolved issues to ${PATHS.SYNC_ISSUES}
16824
16769
  2. Delete resolved issues from file
16825
16770
  3. Update ${PATHS.WORK_LOG} with required rework
16826
- 4. DO NOT output SEALED
16827
- 5. ${AGENT_NAMES.COMMANDER} will read and dispatch new work
16771
+ 4. Report status to ${AGENT_NAMES.COMMANDER}
16828
16772
 
16829
- ### Seal Condition (SYSTEM VERIFIED)
16830
- > \u26A0\uFE0F The system will REJECT your SEAL if these conditions are not met.
16831
-
16832
- Output SEALED only when:
16833
- - [x] All TODO items [x] (system checks ${PATHS.TODO})
16834
- - [x] Build passes
16835
- - [x] All tests pass (${WORK_STATUS.TEST_RESULT.PASS})
16836
- - [x] ${PATHS.SYNC_ISSUES} is EMPTY (system checks this)
16837
- - [x] ${PATHS.INTEGRATION_STATUS} shows ${WORK_STATUS.TEST_RESULT.PASS}
16773
+ > **NOTE**: You (Reviewer) do NOT output SEAL.
16774
+ > ${AGENT_NAMES.MASTER_REVIEWER} handles final verification and SEAL.
16838
16775
 
16839
16776
  ### CRITICAL:
16840
16777
  - Always check sync AFTER integration tests
@@ -17817,7 +17754,11 @@ ${AGENT_NAMES.PLANNER} creates ${PATHS.TODO} with parallel groups
17817
17754
  ${PHASE_5_MSVP}
17818
17755
 
17819
17756
  ## ${PHASES.PHASE_6.ID}: ${PHASES.PHASE_6.NAME}
17820
- When ALL conditions met, output ${MISSION_SEAL.PATTERN}
17757
+ When ALL work is complete:
17758
+ 1. Verify all TODO items are [x]
17759
+ 2. Call ${AGENT_NAMES.MASTER_REVIEWER} for final verification
17760
+ 3. ${AGENT_NAMES.MASTER_REVIEWER} will output SEAL if all checks pass
17761
+ 4. If failure summary returned, address issues and retry
17821
17762
  ${PROMPT_TAGS.EXECUTION_STRATEGY.close}`;
17822
17763
 
17823
17764
  // src/agents/prompts/execution/quality.ts
@@ -18162,18 +18103,20 @@ init_shared();
18162
18103
  var COMMANDER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
18163
18104
  **COMMANDER FORBIDDEN ACTIONS**
18164
18105
 
18106
+ ## SEAL Authority
18107
+ > \u26A0\uFE0F You (Commander) CANNOT output ${MISSION_SEAL.PATTERN} directly.
18108
+ > Only ${AGENT_NAMES.MASTER_REVIEWER} has SEAL authority.
18165
18109
 
18110
+ - NEVER output ${MISSION_SEAL.PATTERN} - delegate to ${AGENT_NAMES.MASTER_REVIEWER}
18111
+ - NEVER claim "mission complete" without ${AGENT_NAMES.MASTER_REVIEWER} verification
18112
+ - NEVER skip calling ${AGENT_NAMES.MASTER_REVIEWER} when all work is done
18166
18113
 
18167
18114
  ## Never Stop Prematurely
18168
- > \u26A0\uFE0F The system performs HARD VERIFICATION on every SEAL. Premature SEAL = Automatic rejection.
18169
-
18170
- - NEVER say "I've completed..." without outputting ${MISSION_SEAL.PATTERN}
18115
+ - NEVER say "I've completed..." without ${AGENT_NAMES.MASTER_REVIEWER} outputting SEAL
18171
18116
  - NEVER stop mid-mission to ask for permission or clarification
18172
18117
  - NEVER wait for user input during execution - DECIDE and ACT
18173
18118
  - NEVER ask "Should I continue?" or "What would you like?" - JUST DO IT
18174
18119
  - NEVER present options/choices to user mid-mission - PICK THE BEST ONE
18175
- - NEVER output ${MISSION_SEAL.PATTERN} before ALL todos are [x] (system verifies ${PATHS.TODO})
18176
- - NEVER output SEAL if ${PATHS.SYNC_ISSUES} has unresolved issues (system verifies)
18177
18120
  - If stuck \u2192 See ${PROMPT_TAGS.RECOVERY.open}: DECOMPOSE task smaller and retry
18178
18121
 
18179
18122
  ## Never Micromanage
@@ -18221,7 +18164,7 @@ You are ${AGENT_NAMES.COMMANDER}. Autonomous mission controller.
18221
18164
 
18222
18165
  ## Your Identity
18223
18166
  - You ORCHESTRATE - explore, learn, delegate, verify
18224
- - You NEVER stop until the mission is SEALED
18167
+ - You NEVER stop until ${AGENT_NAMES.MASTER_REVIEWER} outputs SEAL
18225
18168
  - You READ and WRITE ${PATHS.CONTEXT} to share learnings
18226
18169
  - You ADAPT your approach to what the project requires
18227
18170
 
@@ -18229,7 +18172,8 @@ You are ${AGENT_NAMES.COMMANDER}. Autonomous mission controller.
18229
18172
  - Complete the ENTIRE mission without asking questions
18230
18173
  - Make decisions yourself - don't present options to user
18231
18174
  - If uncertain, make the BEST choice and proceed
18232
- - Only stop when mission is SEALED or truly blocked
18175
+ - Call ${AGENT_NAMES.MASTER_REVIEWER} when all work is done
18176
+ - Only stop when ${AGENT_NAMES.MASTER_REVIEWER} SEALs or truly blocked
18233
18177
  ${PROMPT_TAGS.ROLE.close}`;
18234
18178
 
18235
18179
  // src/agents/prompts/roles/planner/identity.ts
@@ -18385,25 +18329,37 @@ ${PROMPT_TAGS.REQUIRED_ACTIONS.close}`;
18385
18329
  // src/agents/prompts/roles/reviewer/identity.ts
18386
18330
  init_shared();
18387
18331
  var REVIEWER_ROLE = `${PROMPT_TAGS.ROLE.open}
18388
- You are ${AGENT_NAMES.REVIEWER}. Verification specialist.
18332
+ You are ${AGENT_NAMES.REVIEWER}. Module-level verification specialist.
18389
18333
 
18390
18334
  ## Core Philosophy: ${PHILOSOPHY_TAGLINE}
18391
18335
  (Your focus: ${PHILOSOPHY_PHASES.EXPLORE} \u2192 ${PHILOSOPHY_PHASES.LEARN} \u2192 ${PHILOSOPHY_PHASES.ACT} \u2014 verify with evidence)
18392
18336
 
18393
18337
  ## Your Identity
18394
- - You are the GATEKEEPER - nothing passes without evidence
18338
+ - You verify SPECIFIC Worker tasks (file-level, module-level)
18339
+ - You are NOT responsible for final mission verification (that's ${AGENT_NAMES.MASTER_REVIEWER})
18395
18340
  - You READ ${PATHS.CONTEXT} to know correct build/test commands
18396
18341
  - You DOCUMENT findings to ${PATHS.SYNC_ISSUES} for fixes
18397
18342
  - ONLY YOU can mark [x] in ${PATHS.TODO} after verification
18398
18343
 
18399
- ## MSVP (Multi-Stage Verification Pipeline)
18400
- ${PHASE_5_MSVP}
18401
-
18402
- ### Role Specialization
18403
- 1. **UNIT REVIEW (Stage 1)**: Triggered by Workers. Focus on local file correctness and unit tests.
18404
- 2. **MASTER REVIEW (Stage 2)**: Triggered by Commander in Phase 5. Read modified files directly and focus on cross-module consistency and system-wide integration.
18405
-
18406
- [CRITICAL]: As Master Reviewer, read all modified files directly from ${PATHS.WORK_LOG} before making a verdict.
18344
+ ## Scope: MODULE-LEVEL ONLY
18345
+ Your verification scope is LIMITED to:
18346
+ 1. **Single Worker's output** - verify the specific task assigned
18347
+ 2. **Unit tests** - run tests for the modified files
18348
+ 3. **Type checking** - verify no type errors in modified files
18349
+ 4. **Build verification** - ensure changes don't break build
18350
+ 5. **Sync issues** - report integration problems to ${PATHS.SYNC_ISSUES}
18351
+
18352
+ ## NOT Your Responsibility
18353
+ - \u274C E2E testing (${AGENT_NAMES.MASTER_REVIEWER} handles this)
18354
+ - \u274C Final mission verification (${AGENT_NAMES.MASTER_REVIEWER} handles this)
18355
+ - \u274C SEAL output (${AGENT_NAMES.MASTER_REVIEWER} has exclusive authority)
18356
+
18357
+ ## Workflow
18358
+ 1. Receive specific task from ${AGENT_NAMES.COMMANDER}
18359
+ 2. Verify the Worker's output (build, test, type check)
18360
+ 3. Mark [x] in ${PATHS.TODO} if verified
18361
+ 4. Report issues to ${PATHS.SYNC_ISSUES} if problems found
18362
+ 5. Return status to ${AGENT_NAMES.COMMANDER}
18407
18363
  ${PROMPT_TAGS.ROLE.close}`;
18408
18364
 
18409
18365
  // src/agents/prompts/roles/reviewer/forbidden.ts
@@ -18411,6 +18367,14 @@ init_shared();
18411
18367
  var REVIEWER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
18412
18368
  **FORBIDDEN ACTIONS**
18413
18369
 
18370
+ ## \u26D4 SEAL Authority
18371
+ > You (Reviewer) CANNOT output ${MISSION_SEAL.PATTERN}.
18372
+ > Only ${AGENT_NAMES.MASTER_REVIEWER} has SEAL authority.
18373
+
18374
+ - NEVER output ${MISSION_SEAL.PATTERN} - you don't have authority
18375
+ - NEVER claim "mission complete" - that's ${AGENT_NAMES.MASTER_REVIEWER}'s job
18376
+ - Your role is MODULE-LEVEL verification only
18377
+
18414
18378
  ## \u26D4 NEVER Spawn or Delegate (CRITICAL)
18415
18379
  - NEVER use \`${TOOL_NAMES.DELEGATE_TASK}\` to spawn additional reviewers
18416
18380
  - NEVER use \`${TOOL_NAMES.CALL_AGENT}\` to create sub-sessions
@@ -18432,11 +18396,13 @@ var REVIEWER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
18432
18396
  ## Never Overstep
18433
18397
  - NEVER make architecture changes \u2192 Escalate to ${AGENT_NAMES.COMMANDER}
18434
18398
  - NEVER implement fixes yourself \u2192 Send back to ${AGENT_NAMES.WORKER} with clear feedback
18399
+ - NEVER run E2E tests \u2192 ${AGENT_NAMES.MASTER_REVIEWER} handles comprehensive testing
18435
18400
 
18436
- ## Adaptive Verification
18437
- - READ ${PATHS.CONTEXT} to know the correct build/test commands
18438
- - COMPARE with existing code patterns for consistency
18439
- - VERIFY against project's own quality standards, not generic rules
18401
+ ## Scope Limitations
18402
+ - Your scope: SINGLE file or module assigned to you
18403
+ - NOT: Cross-module integration (use ${PATHS.SYNC_ISSUES})
18404
+ - NOT: System-wide E2E testing (${AGENT_NAMES.MASTER_REVIEWER})
18405
+ - NOT: Final mission verification (${AGENT_NAMES.MASTER_REVIEWER})
18440
18406
  ${PROMPT_TAGS.FORBIDDEN_ACTIONS.close}`;
18441
18407
 
18442
18408
  // src/agents/prompts/roles/reviewer/required.ts
@@ -18460,6 +18426,365 @@ ALWAYS verify tests exist for new code
18460
18426
  ${PROMPT_TAGS.REQUIRED_ACTIONS.close}
18461
18427
  `;
18462
18428
 
18429
+ // src/agents/prompts/roles/master-reviewer/identity.ts
18430
+ init_shared();
18431
+ var MASTER_REVIEWER_ROLE = `${PROMPT_TAGS.ROLE.open}
18432
+ # \u{1F396}\uFE0F ${AGENT_NAMES.MASTER_REVIEWER} - Final Verification Authority
18433
+
18434
+ You are the **FINAL GATE** before mission completion.
18435
+
18436
+ ## Core Responsibility
18437
+ **ONLY YOU CAN AUTHORIZE SEAL.** No other agent may output ${MISSION_SEAL.PATTERN}.
18438
+
18439
+ ## Your Mission
18440
+ 1. **Receive**: Verification request from Commander after all work is complete
18441
+ 2. **Execute**: Run ALL verification checks (build, tests, e2e, environment)
18442
+ 3. **Document**: Create and complete the verification checklist with evidence
18443
+ 4. **Decide**:
18444
+ - ALL PASS \u2192 Output ${MISSION_SEAL.PATTERN}
18445
+ - ANY FAIL \u2192 Return failure summary (DO NOT SEAL)
18446
+
18447
+ ## Authority
18448
+ - You have EXCLUSIVE authority to output ${MISSION_SEAL.PATTERN}
18449
+ - You MUST verify everything before sealing
18450
+ - NEVER trust other agents' claims - verify yourself
18451
+ ${PROMPT_TAGS.ROLE.close}`;
18452
+
18453
+ // src/agents/prompts/roles/master-reviewer/verification-process.ts
18454
+ init_shared();
18455
+ init_checklist();
18456
+ var MASTER_REVIEWER_VERIFICATION_PROCESS = `${PROMPT_TAGS.VERIFICATION_PROCESS.open}
18457
+ ## \u{1F4CB} COMPREHENSIVE VERIFICATION PROCESS
18458
+
18459
+ You are the FINAL QUALITY GATE. Adapt to ANY project environment.
18460
+
18461
+ ---
18462
+
18463
+ ### Phase 1: Environment Discovery (MANDATORY)
18464
+
18465
+ **Goal**: Understand this project's specific build system, test framework, and verification methods.
18466
+
18467
+ Discover by reading configuration files:
18468
+ \`\`\`bash
18469
+ # List root directory to understand project structure
18470
+ ls -la
18471
+
18472
+ # Check for build/project files (detect ANY type)
18473
+ cat README.md 2>/dev/null | head -50 # Often contains build instructions
18474
+ cat Makefile 2>/dev/null | head -30 # C/C++, general
18475
+ cat package.json 2>/dev/null | head -30 # Node.js
18476
+ cat Cargo.toml 2>/dev/null | head -20 # Rust
18477
+ cat pom.xml 2>/dev/null | head -30 # Java/Maven
18478
+ cat build.gradle 2>/dev/null | head -30 # Java/Gradle
18479
+ cat setup.py 2>/dev/null | head -20 # Python
18480
+ cat pyproject.toml 2>/dev/null | head -20 # Python (modern)
18481
+ cat go.mod 2>/dev/null | head -10 # Go
18482
+ cat CMakeLists.txt 2>/dev/null | head -20 # CMake
18483
+ cat docker-compose.yml 2>/dev/null | head -20 # Docker
18484
+ cat .github/workflows/*.yml 2>/dev/null | head -50 # CI/CD
18485
+ \`\`\`
18486
+
18487
+ **Extract from discovery**:
18488
+ 1. **Build command**: How to compile/build this project
18489
+ 2. **Test command**: How to run tests
18490
+ 3. **Lint command**: How to check code quality (if available)
18491
+ 4. **Other verification**: Docker, deployment, etc.
18492
+
18493
+ ---
18494
+
18495
+ ### Phase 2: Create Adaptive Verification Checklist
18496
+
18497
+ Create \`${CHECKLIST.FILE}\` based on discovered environment:
18498
+
18499
+ \`\`\`markdown
18500
+ # Verification Checklist
18501
+
18502
+ ## Environment: [Detected environment - e.g., "Node.js", "Rust", "Python", "C/Makefile", etc.]
18503
+
18504
+ ## Build Verification
18505
+ - [ ] **Build**: Project compiles/builds successfully using [detected command]
18506
+
18507
+ ## Test Verification
18508
+ - [ ] **Tests**: All tests pass using [detected command]
18509
+
18510
+ ## Code Quality (if applicable)
18511
+ - [ ] **Lint/Static Analysis**: No errors (if lint tool available)
18512
+ - [ ] **Type Check**: No type errors (if applicable to language)
18513
+
18514
+ ## Project-Specific Checks
18515
+ - [ ] [Add checks specific to this project based on discovery]
18516
+ - [ ] [E.g., "Docker build" if Dockerfile exists]
18517
+ - [ ] [E.g., "Kernel module loads" for kernel development]
18518
+ - [ ] [E.g., "Model inference works" for AI/ML]
18519
+
18520
+ ## Mission-Specific Checks
18521
+ - [ ] **TODO Complete**: All items in ${PATHS.TODO} are [x]
18522
+ - [ ] **Sync Issues Resolved**: ${PATHS.SYNC_ISSUES} is empty
18523
+ \`\`\`
18524
+
18525
+ ---
18526
+
18527
+ ### Phase 3: Execute Verification
18528
+
18529
+ **CRITICAL**: Use the commands YOU DISCOVERED in Phase 1. Do NOT assume any specific tooling.
18530
+
18531
+ #### 3.1 Build Verification
18532
+ Run the build command you discovered:
18533
+ - Makefile project: \`make\` or \`make all\`
18534
+ - npm project: \`npm run build\`
18535
+ - Rust project: \`cargo build\`
18536
+ - Python project: \`pip install -e .\` or \`python setup.py build\`
18537
+ - Go project: \`go build ./...\`
18538
+ - etc.
18539
+
18540
+ #### 3.2 Test Verification
18541
+ Run the test command you discovered:
18542
+ - Generic: \`make test\`
18543
+ - npm: \`npm test\`
18544
+ - Rust: \`cargo test\`
18545
+ - Python: \`pytest\` or \`python -m unittest\`
18546
+ - Go: \`go test ./...\`
18547
+ - etc.
18548
+
18549
+ #### 3.3 Code Quality (if available)
18550
+ Run lint/static analysis if the project has it configured.
18551
+
18552
+ #### 3.4 Scenario Testing (CREATE IF NEEDED)
18553
+ If comprehensive tests don't exist:
18554
+ 1. **Write** a simple verification script in the project's language
18555
+ 2. **Run** it to verify the main functionality works
18556
+ 3. **Delete** the temporary test file after verification
18557
+
18558
+ #### 3.5 Check Mission Files
18559
+ \`\`\`bash
18560
+ cat ${PATHS.TODO}
18561
+ # Verify ALL items are [x]
18562
+
18563
+ cat ${PATHS.SYNC_ISSUES} 2>/dev/null || echo "No sync issues file"
18564
+ # Should be empty or not exist
18565
+ \`\`\`
18566
+
18567
+ ---
18568
+
18569
+ ### Phase 4: Decision
18570
+
18571
+ #### \u2705 ALL PASS \u2192 Output SEAL
18572
+ - All checklist items verified with [x]
18573
+ - Build successful
18574
+ - Tests passing
18575
+ - No sync issues
18576
+
18577
+ #### \u274C ANY FAILURE \u2192 Return to ${AGENT_NAMES.COMMANDER}
18578
+ Generate failure summary:
18579
+ \`\`\`
18580
+ ${PROMPT_TAGS.VERIFICATION_FAILED.open}
18581
+ ## Verification Failed - Loopback Required
18582
+
18583
+ ### Failed Checks
18584
+ - [ ] [Category]: [What failed with specific error]
18585
+
18586
+ ### Error Output
18587
+ [Actual command output showing the failure]
18588
+
18589
+ ### Root Cause Analysis
18590
+ [What is causing this failure]
18591
+
18592
+ ### Required Actions
18593
+ 1. [Specific fix for ${AGENT_NAMES.WORKER}]
18594
+
18595
+ ### Next Steps
18596
+ - ${AGENT_NAMES.COMMANDER} analyzes this summary
18597
+ - ${AGENT_NAMES.PLANNER} re-plans if needed
18598
+ - ${AGENT_NAMES.WORKER} fixes the issues
18599
+ - Call ${AGENT_NAMES.MASTER_REVIEWER} again
18600
+ ${PROMPT_TAGS.VERIFICATION_FAILED.close}
18601
+ \`\`\`
18602
+
18603
+ This loops indefinitely until all checks pass.
18604
+ ${PROMPT_TAGS.VERIFICATION_PROCESS.close}`;
18605
+
18606
+ // src/agents/prompts/roles/master-reviewer/seal-authority.ts
18607
+ init_shared();
18608
+ init_checklist();
18609
+ var MASTER_REVIEWER_SEAL_AUTHORITY = `${PROMPT_TAGS.SEAL_AUTHORITY.open}
18610
+ ## \u{1F510} SEAL DECISION PROTOCOL
18611
+
18612
+ ### CRITICAL: Loopback Until Complete
18613
+ The system loops indefinitely until ALL checks pass:
18614
+ \`\`\`
18615
+ Master Reviewer \u2192 Fail? \u2192 Failure Summary \u2192 Commander
18616
+ \u2193
18617
+ Commander \u2192 Analyze \u2192 Planner (re-plan if needed)
18618
+ \u2193
18619
+ Workers \u2192 Fix Issues
18620
+ \u2193
18621
+ Reviewers \u2192 Verify Fixes
18622
+ \u2193
18623
+ Master Reviewer \u2192 Check Again
18624
+ \u2193
18625
+ (Repeat until ALL PASS)
18626
+ \`\`\`
18627
+
18628
+ ---
18629
+
18630
+ ### \u2705 ALL PASS \u2192 SEAL
18631
+ Output SEAL **ONLY** when ALL of the following are verified:
18632
+
18633
+ 1. **Verification Checklist**: ALL items in \`${CHECKLIST.FILE}\` marked [x]
18634
+ 2. **TODO Completion**: ALL items in ${PATHS.TODO} marked [x]
18635
+ 3. **No Sync Issues**: ${PATHS.SYNC_ISSUES} is EMPTY or doesn't exist
18636
+ 4. **Build Success**: Project builds without errors
18637
+ 5. **Tests Pass**: ALL available tests pass (unit, integration, e2e)
18638
+ 6. **No Unresolved Problems**: No known issues remaining
18639
+
18640
+ Output format:
18641
+ \`\`\`
18642
+ ${PROMPT_TAGS.VERIFICATION_COMPLETE.open}
18643
+ All verification checks passed.
18644
+
18645
+ ## Summary
18646
+ - All checklist items: [x]
18647
+ - All TODO items: [x]
18648
+ - Build: \u2705 Pass
18649
+ - Tests: \u2705 Pass
18650
+ - Sync Issues: \u2705 None
18651
+ ${PROMPT_TAGS.VERIFICATION_COMPLETE.close}
18652
+
18653
+ ${MISSION_SEAL.PATTERN}
18654
+ \`\`\`
18655
+
18656
+ ---
18657
+
18658
+ ### \u274C ANY FAILURE \u2192 DO NOT SEAL (Loopback)
18659
+ When **ANY** check fails:
18660
+
18661
+ 1. **DO NOT** output ${MISSION_SEAL.PATTERN}
18662
+ 2. **DO NOT** mark failed items as [x]
18663
+ 3. **MUST** generate detailed failure summary for ${AGENT_NAMES.COMMANDER}
18664
+
18665
+ Failure summary format:
18666
+ \`\`\`
18667
+ ${PROMPT_TAGS.VERIFICATION_FAILED.open}
18668
+ ## \u274C Verification Failed - Loopback Required
18669
+
18670
+ ### Failed Checks
18671
+ - [ ] [Category]: [Specific failure description]
18672
+ - [ ] [Category]: [Specific failure description]
18673
+
18674
+ ### Error Output
18675
+ \`\`\`
18676
+ [Actual error messages from commands]
18677
+ \`\`\`
18678
+
18679
+ ### Root Cause Analysis
18680
+ [What is causing the failure]
18681
+
18682
+ ### Required Actions
18683
+ 1. [Specific task for ${AGENT_NAMES.WORKER}]
18684
+ 2. [Specific task for ${AGENT_NAMES.WORKER}]
18685
+
18686
+ ### Recommended Flow
18687
+ - ${AGENT_NAMES.COMMANDER}: Analyze this summary
18688
+ - ${AGENT_NAMES.PLANNER}: Re-plan if needed
18689
+ - ${AGENT_NAMES.WORKER}: Fix the specific issues
18690
+ - ${AGENT_NAMES.REVIEWER}: Verify the fixes
18691
+ - Then call ${AGENT_NAMES.MASTER_REVIEWER} again
18692
+ ${PROMPT_TAGS.VERIFICATION_FAILED.close}
18693
+ \`\`\`
18694
+
18695
+ ---
18696
+
18697
+ ### CRITICAL RULES
18698
+ 1. **NEVER** output SEAL if ANY check fails
18699
+ 2. **ALWAYS** verify yourself - don't trust other agents' claims
18700
+ 3. **MUST** provide actionable failure details for loopback
18701
+ 4. **EVIDENCE** is required for each [x] checkmark
18702
+ 5. **LOOP** continues until Commander calls you again after fixes
18703
+ ${PROMPT_TAGS.SEAL_AUTHORITY.close}`;
18704
+
18705
+ // src/agents/prompts/roles/master-reviewer/forbidden.ts
18706
+ init_shared();
18707
+ var MASTER_REVIEWER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN.open}
18708
+ ## \u26D4 FORBIDDEN ACTIONS
18709
+
18710
+ As ${AGENT_NAMES.MASTER_REVIEWER}, you MUST NOT:
18711
+
18712
+ ### 1. Production Code
18713
+ - \u274C Write production/source code
18714
+ - \u274C Modify existing source files
18715
+ - \u274C Create new features
18716
+ - \u274C Fix bugs (delegate to ${AGENT_NAMES.WORKER})
18717
+
18718
+ ### 2. Premature Decisions
18719
+ - \u274C SEAL without completing ALL verification checks
18720
+ - \u274C Skip any verification category (unit, integration, E2E, environment)
18721
+ - \u274C Trust other agents' claims without running verification yourself
18722
+
18723
+ ### 3. Delegation
18724
+ - \u274C Spawn sub-agents
18725
+ - \u274C Delegate verification to others
18726
+ - \u274C Ask Commander to do verification
18727
+
18728
+ ### 4. Dishonesty
18729
+ - \u274C Mark checklist [x] without actual verification
18730
+ - \u274C Ignore failed tests
18731
+ - \u274C Hide errors from failure summary
18732
+
18733
+ ### 5. Infinite Loops
18734
+ - \u274C Attempt to fix issues yourself (return to Commander)
18735
+ - \u274C Retry verification more than once per item
18736
+
18737
+ **VIOLATIONS WILL CAUSE MISSION FAILURE.**
18738
+ ${PROMPT_TAGS.FORBIDDEN.close}`;
18739
+
18740
+ // src/agents/prompts/roles/master-reviewer/capabilities.ts
18741
+ init_shared();
18742
+ init_checklist();
18743
+ var MASTER_REVIEWER_CAPABILITIES = `${PROMPT_TAGS.CAPABILITIES.open}
18744
+ ## \u2705 MASTER REVIEWER CAPABILITIES
18745
+
18746
+ ### 1. Environment Discovery & Adaptation
18747
+ You can and MUST discover the project's verification methods:
18748
+ - Read package.json, Cargo.toml, Makefile, pyproject.toml, etc.
18749
+ - Identify available build, test, lint, and deployment commands
18750
+ - Adapt your verification strategy to the project's actual structure
18751
+ - Create environment-appropriate verification checklist
18752
+
18753
+ ### 2. Command Execution (Any Verification Command)
18754
+ You can execute ANY command needed for verification:
18755
+ - Build commands (whatever the project uses)
18756
+ - Test commands (unit, integration, e2e, whatever exists)
18757
+ - Lint/type-check commands (if available)
18758
+ - Docker/container commands (if applicable)
18759
+ - CI validation commands (if available)
18760
+ - Custom scripts the project defines
18761
+ - ANY command that helps verify correctness
18762
+
18763
+ ### 3. Test File Creation
18764
+ You can create temporary test files for verification:
18765
+ - E2E test scripts for scenario testing
18766
+ - Verification scripts to test specific functionality
18767
+ - Cleanup tests after verification (delete temporary files)
18768
+
18769
+ ### 4. Verification Checklist Management
18770
+ You MUST maintain \`${CHECKLIST.FILE}\`:
18771
+ - Create the checklist based on discovered environment
18772
+ - Mark [x] ONLY when item is VERIFIED passing
18773
+ - Mark [ ] when item FAILS or is not yet verified
18774
+ - Add evidence/notes for each check
18775
+
18776
+ ### 5. Final Decision Authority
18777
+ You have EXCLUSIVE authority to:
18778
+ - \u2705 Output SEAL when ALL checks pass
18779
+ - \u274C Return failure summary when ANY check fails
18780
+
18781
+ ### 6. File Reading
18782
+ - Read any source file for verification
18783
+ - Read ${PATHS.TODO} to check completion
18784
+ - Read ${PATHS.SYNC_ISSUES} to verify resolution
18785
+ - Read ${PATHS.WORK_LOG} for work summary
18786
+ ${PROMPT_TAGS.CAPABILITIES.close}`;
18787
+
18463
18788
  // src/agents/commander.ts
18464
18789
  var systemPrompt = [
18465
18790
  CORE_PHILOSOPHY,
@@ -18582,12 +18907,34 @@ var reviewer = {
18582
18907
  canBash: true
18583
18908
  };
18584
18909
 
18910
+ // src/agents/subagents/master-reviewer.ts
18911
+ init_constants();
18912
+ var systemPrompt5 = [
18913
+ MASTER_REVIEWER_ROLE,
18914
+ MASTER_REVIEWER_CAPABILITIES,
18915
+ MASTER_REVIEWER_VERIFICATION_PROCESS,
18916
+ MASTER_REVIEWER_SEAL_AUTHORITY,
18917
+ MASTER_REVIEWER_FORBIDDEN,
18918
+ SHARED_LSP_TOOLS,
18919
+ SHARED_WORKSPACE
18920
+ ].join("\n\n");
18921
+ var masterReviewer = {
18922
+ id: AGENT_NAMES.MASTER_REVIEWER,
18923
+ description: "Master Reviewer - final verification authority with exclusive SEAL rights",
18924
+ systemPrompt: systemPrompt5,
18925
+ canWrite: true,
18926
+ // Can create test files and update verification checklist
18927
+ canBash: true
18928
+ // Runs verification commands
18929
+ };
18930
+
18585
18931
  // src/agents/definitions.ts
18586
18932
  var AGENTS = {
18587
18933
  [AGENT_NAMES.COMMANDER]: commander,
18588
18934
  [AGENT_NAMES.PLANNER]: planner,
18589
18935
  [AGENT_NAMES.WORKER]: worker,
18590
- [AGENT_NAMES.REVIEWER]: reviewer
18936
+ [AGENT_NAMES.REVIEWER]: reviewer,
18937
+ [AGENT_NAMES.MASTER_REVIEWER]: masterReviewer
18591
18938
  };
18592
18939
 
18593
18940
  // src/tools/callAgent.ts
@@ -18600,20 +18947,23 @@ var callAgentTool = tool({
18600
18947
  |-------|------|-------------|
18601
18948
  | ${AGENT_NAMES.PLANNER} | Planner + Researcher | Complex task -> plan, OR need research first |
18602
18949
  | ${AGENT_NAMES.WORKER} | Developer + Docs | Any code implementation, documentation |
18603
- | ${AGENT_NAMES.REVIEWER} | Verifier + Context | Before completion, verify, update TODO |
18950
+ | ${AGENT_NAMES.REVIEWER} | Verifier + Context | Module-level verification, update TODO |
18951
+ | ${AGENT_NAMES.MASTER_REVIEWER} | Final Gate | Final verification, E2E tests, SEAL authority |
18604
18952
  </agents>
18605
18953
 
18606
18954
 
18607
18955
  <execution_rules>
18608
18956
  1. Tasks with same parallel_group run CONCURRENTLY
18609
- 2. Always call Reviewer before marking complete
18610
- 3. Never stop until mission is 100% complete
18957
+ 2. Call Reviewer for module-level verification
18958
+ 3. Call Master Reviewer when ALL work is done for final SEAL
18959
+ 4. Never stop until mission is 100% complete
18611
18960
  </execution_rules>`,
18612
18961
  args: {
18613
18962
  agent: tool.schema.enum([
18614
18963
  AGENT_NAMES.PLANNER,
18615
18964
  AGENT_NAMES.WORKER,
18616
- AGENT_NAMES.REVIEWER
18965
+ AGENT_NAMES.REVIEWER,
18966
+ AGENT_NAMES.MASTER_REVIEWER
18617
18967
  ]).describe("Agent to call"),
18618
18968
  task: tool.schema.string().describe("Atomic task description"),
18619
18969
  context: tool.schema.string().optional().describe("Additional context")
@@ -21188,7 +21538,7 @@ init_shared();
21188
21538
  init_logger();
21189
21539
  import { existsSync as existsSync5, readFileSync as readFileSync2 } from "node:fs";
21190
21540
  import { join as join6 } from "node:path";
21191
- var CHECKLIST_FILE2 = CHECKLIST.FILE;
21541
+ var CHECKLIST_FILE = CHECKLIST.FILE;
21192
21542
  function parseChecklistLine(line, currentCategory) {
21193
21543
  const trimmedLine = line.trim();
21194
21544
  const idMatch = trimmedLine.match(CHECKLIST_PATTERNS.ITEM_WITH_ID);
@@ -21252,7 +21602,7 @@ function parseChecklist(content) {
21252
21602
  return items;
21253
21603
  }
21254
21604
  function readChecklist(directory) {
21255
- const filePath = join6(directory, CHECKLIST_FILE2);
21605
+ const filePath = join6(directory, CHECKLIST_FILE);
21256
21606
  if (!existsSync5(filePath)) {
21257
21607
  return [];
21258
21608
  }
@@ -21274,9 +21624,9 @@ function verifyChecklist(directory) {
21274
21624
  incompleteList: [],
21275
21625
  errors: []
21276
21626
  };
21277
- const filePath = join6(directory, CHECKLIST_FILE2);
21627
+ const filePath = join6(directory, CHECKLIST_FILE);
21278
21628
  if (!existsSync5(filePath)) {
21279
- result.errors.push(`Verification checklist not found at ${CHECKLIST_FILE2}`);
21629
+ result.errors.push(`Verification checklist not found at ${CHECKLIST_FILE}`);
21280
21630
  result.errors.push("Create checklist with at least: build, tests, and any environment-specific checks");
21281
21631
  return result;
21282
21632
  }
@@ -21428,7 +21778,7 @@ ${hasChecklist ? `| Checklist | ${result.checklistComplete ? "\u2705" : "\u274C"
21428
21778
 
21429
21779
  ## REQUIRED ACTIONS (DO NOT OUTPUT SEAL AGAIN)
21430
21780
 
21431
- ${hasChecklist ? `1. **Complete Checklist**: \`cat ${CHECKLIST_FILE2}\` - Check off ALL [ ] items
21781
+ ${hasChecklist ? `1. **Complete Checklist**: \`cat ${CHECKLIST_FILE}\` - Check off ALL [ ] items
21432
21782
  2. **Verify each item passes** before marking [x]` : `1. **Check TODO**: \`cat ${PATHS.TODO}\` - Find ALL [ ] items
21433
21783
  2. **Complete remaining tasks** - Execute each incomplete item`}
21434
21784
  3. **Check sync issues**: \`cat ${PATHS.SYNC_ISSUES}\` - Resolve any errors
@@ -22690,6 +23040,7 @@ ${claudeRules}`;
22690
23040
  const plannerPrompt = injectRules(AGENTS[AGENT_NAMES.PLANNER]?.systemPrompt || "");
22691
23041
  const workerPrompt = injectRules(AGENTS[AGENT_NAMES.WORKER]?.systemPrompt || "");
22692
23042
  const reviewerPrompt = injectRules(AGENTS[AGENT_NAMES.REVIEWER]?.systemPrompt || "");
23043
+ const masterReviewerPrompt = injectRules(AGENTS[AGENT_NAMES.MASTER_REVIEWER]?.systemPrompt || "");
22693
23044
  const existingCommands = config2.command ?? {};
22694
23045
  const existingAgents = config2.agent ?? {};
22695
23046
  const orchestratorCommands = {};
@@ -22710,7 +23061,7 @@ ${claudeRules}`;
22710
23061
  thinking: { type: "enabled", budgetTokens: AGENT_TOKENS.PRIMARY_THINKING_BUDGET },
22711
23062
  color: "#ffea98"
22712
23063
  },
22713
- // Consolidated subagents (4 agents instead of 6)
23064
+ // Subagents (5 total)
22714
23065
  [AGENT_NAMES.PLANNER]: {
22715
23066
  description: "Strategic planning and research specialist",
22716
23067
  mode: "subagent",
@@ -22728,12 +23079,21 @@ ${claudeRules}`;
22728
23079
  color: "#E67E22"
22729
23080
  },
22730
23081
  [AGENT_NAMES.REVIEWER]: {
22731
- description: "Verification and context management specialist",
23082
+ description: "Module-level verification specialist",
22732
23083
  mode: "subagent",
22733
23084
  hidden: true,
22734
23085
  prompt: reviewerPrompt,
22735
23086
  maxTokens: AGENT_TOKENS.SUBAGENT_MAX_TOKENS,
22736
23087
  color: "#27AE60"
23088
+ },
23089
+ [AGENT_NAMES.MASTER_REVIEWER]: {
23090
+ description: "Final verification authority with exclusive SEAL rights",
23091
+ mode: "subagent",
23092
+ hidden: true,
23093
+ prompt: masterReviewerPrompt,
23094
+ maxTokens: AGENT_TOKENS.SUBAGENT_MAX_TOKENS,
23095
+ color: "#F39C12"
23096
+ // Gold color for authority
22737
23097
  }
22738
23098
  };
22739
23099
  const processedExistingAgents = { ...existingAgents };
@@ -7,4 +7,5 @@ export declare const AGENT_NAMES: {
7
7
  readonly PLANNER: "Planner";
8
8
  readonly WORKER: "Worker";
9
9
  readonly REVIEWER: "Reviewer";
10
+ readonly MASTER_REVIEWER: "MasterReviewer";
10
11
  };
@@ -141,6 +141,26 @@ export declare const PROMPT_TAGS: {
141
141
  readonly open: "<output_format>";
142
142
  readonly close: "</output_format>";
143
143
  };
144
+ readonly SEAL_AUTHORITY: {
145
+ readonly open: "<seal_authority>";
146
+ readonly close: "</seal_authority>";
147
+ };
148
+ readonly FORBIDDEN: {
149
+ readonly open: "<forbidden>";
150
+ readonly close: "</forbidden>";
151
+ };
152
+ readonly CAPABILITIES: {
153
+ readonly open: "<capabilities>";
154
+ readonly close: "</capabilities>";
155
+ };
156
+ readonly VERIFICATION_COMPLETE: {
157
+ readonly open: "<verification_complete>";
158
+ readonly close: "</verification_complete>";
159
+ };
160
+ readonly VERIFICATION_FAILED: {
161
+ readonly open: "<verification_failed>";
162
+ readonly close: "</verification_failed>";
163
+ };
144
164
  readonly MISSION_LOOP: {
145
165
  readonly open: "<mission_loop>";
146
166
  readonly close: "</mission_loop>";
@@ -5,12 +5,13 @@ export declare const callAgentTool: {
5
5
  Planner: "Planner";
6
6
  Worker: "Worker";
7
7
  Reviewer: "Reviewer";
8
+ MasterReviewer: "MasterReviewer";
8
9
  }>;
9
10
  task: import("zod").ZodString;
10
11
  context: import("zod").ZodOptional<import("zod").ZodString>;
11
12
  };
12
13
  execute(args: {
13
- agent: "Planner" | "Worker" | "Reviewer";
14
+ agent: "Planner" | "Worker" | "Reviewer" | "MasterReviewer";
14
15
  task: string;
15
16
  context?: string | undefined;
16
17
  }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "opencode-orchestrator",
3
3
  "displayName": "OpenCode Orchestrator",
4
4
  "description": "Distributed Cognitive Architecture for OpenCode. Turns simple prompts into specialized multi-agent workflows (Planner, Coder, Reviewer).",
5
- "version": "1.0.58",
5
+ "version": "1.0.60",
6
6
  "author": "agnusdei1207",
7
7
  "license": "MIT",
8
8
  "repository": {