opencode-orchestrator 1.0.58 → 1.0.59

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,43 @@ ${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**: Mission complete! \u{1F396}\uFE0F
16522
16519
 
16523
- ---
16520
+ **If failure summary is returned**:
16521
+ 1. Analyze the failure details
16522
+ 2. Address the issues (spawn Workers/Reviewers as needed)
16523
+ 3. Call Master Reviewer again when fixed
16524
16524
 
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
- \`\`\`
16532
-
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}
16525
+ ### DO NOT
16526
+ - \u274C Output ${MISSION_SEAL.PATTERN} yourself
16527
+ - \u274C Skip Master Reviewer verification
16528
+ - \u274C Claim completion without Master Reviewer approval
16551
16529
  `;
16552
16530
 
16553
16531
  // src/agents/prompts/mission/loop-continuation.ts
@@ -16566,21 +16544,20 @@ cat ${PATHS.SYNC_ISSUES} 2>/dev/null || echo "No sync issues"
16566
16544
 
16567
16545
  ---
16568
16546
 
16569
- ## E2E Test Timing
16547
+ ## Decision Matrix
16570
16548
 
16571
- E2E starts when **${PATHS.TODO} \u2265 80%**:
16572
- ...
16549
+ | ${PATHS.TODO} Status | ${PATHS.SYNC_ISSUES} | Action |
16550
+ |--------|--------|--------|
16551
+ | Incomplete items | Any | Continue work |
16552
+ | All [x] | Issues exist | Fix sync issues |
16553
+ | All [x] | Empty | Call ${AGENT_NAMES.MASTER_REVIEWER} for final verification |
16573
16554
 
16574
- ### Decision Matrix
16555
+ ### When All Work Complete
16556
+ When ALL TODO items are [x] and NO sync issues:
16557
+ \u2192 Spawn ${AGENT_NAMES.MASTER_REVIEWER} for final verification
16558
+ \u2192 ${AGENT_NAMES.MASTER_REVIEWER} will output SEAL if all checks pass
16559
+ \u2192 If ${AGENT_NAMES.MASTER_REVIEWER} returns failure, address issues and retry
16575
16560
 
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()}) |
16582
-
16583
- ...
16584
16561
  ${PROMPT_TAGS.LOOP_CONTINUATION.close}
16585
16562
 
16586
16563
  `;
@@ -16669,93 +16646,55 @@ ${PROMPT_TAGS.VERIFICATION.close}
16669
16646
  // src/agents/prompts/verification/integration.ts
16670
16647
  init_shared();
16671
16648
  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).
16676
-
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"
16649
+ ## INTEGRATION TESTING (Module Level)
16682
16650
 
16683
- ### Integration Workflow (Master Mode)
16651
+ ### Scope
16652
+ ${AGENT_NAMES.REVIEWER} handles **module-level** integration:
16653
+ - Cross-file imports work correctly
16654
+ - Shared types are consistent
16655
+ - Interface contracts are honored
16684
16656
 
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
16657
+ > **NOTE**: Full E2E verification is handled by ${AGENT_NAMES.MASTER_REVIEWER} at mission end.
16690
16658
 
16691
- [NOTE]: Read directly - no parallel scout overhead, saves tokens.
16659
+ ### Pre-Integration Checklist
16660
+ Before marking integration complete, verify:
16661
+ - [ ] LSP diagnostics are clean
16662
+ - [ ] Unit tests pass for this module
16663
+ - [ ] Imports/exports are correctly synchronized
16692
16664
 
16693
- #### Step 1: Check ${PATHS.TODO} Status
16694
- \`\`\`bash
16695
- cat ${PATHS.TODO}
16696
- # If incomplete items exist, wait for E2E
16697
- \`\`\`
16665
+ ### Integration Workflow
16698
16666
 
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)
16667
+ #### Step 1: Check Module Dependencies
16705
16668
  \`\`\`bash
16706
- # Run project build command (from ${PATHS.CONTEXT})
16707
- # If failed, record in ${PATHS.SYNC_ISSUES}
16669
+ # Verify imports work
16670
+ cat ${PATHS.WORK_LOG}
16708
16671
  \`\`\`
16709
16672
 
16710
- #### Step 4: Run Full Tests
16673
+ #### Step 2: Run Module Build
16711
16674
  \`\`\`bash
16712
- # Run project test command (from ${PATHS.CONTEXT})
16713
- # Check for regressions
16675
+ # Build this module (not full project)
16676
+ # Check for errors specific to this module
16714
16677
  \`\`\`
16715
16678
 
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}:
16679
+ #### Step 3: Record Issues
16680
+ If issues found, write to ${PATHS.SYNC_ISSUES}:
16723
16681
  \`\`\`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)
16682
+ ## Integration Issue
16683
+ - File: [filename]
16684
+ - Issue: [description]
16685
+ - Cause: [analysis]
16735
16686
  \`\`\`
16736
16687
 
16737
- ---
16688
+ ### What Reviewer Does NOT Do
16689
+ - \u274C Full E2E testing (Master Reviewer does this)
16690
+ - \u274C Final SEAL decision (Master Reviewer does this)
16691
+ - \u274C Complete checklist verification (Master Reviewer does this)
16738
16692
 
16739
- ## Loop Condition Check (SYSTEM-VERIFIED)
16693
+ ### After Module Review
16694
+ 1. Mark [x] for reviewed items in TODO
16695
+ 2. Record any sync issues
16696
+ 3. Report status to Commander
16740
16697
 
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
16749
-
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
16754
-
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
16698
  ${PROMPT_TAGS.INTEGRATION_TESTING.close}`;
16760
16699
 
16761
16700
  // src/agents/prompts/verification/sync-check.ts
@@ -16768,17 +16707,16 @@ After integration, verify all files are properly synchronized.
16768
16707
  ### Sync Check Areas
16769
16708
 
16770
16709
  #### 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
- \`\`\`
16710
+ Run the project's **build command** and check for:
16711
+ - Missing imports/includes
16712
+ - Missing exports/declarations
16713
+ - Broken dependencies
16776
16714
 
16777
- #### 2. Type Consistency
16778
- \`\`\`bash
16779
- # Check for type mismatches
16780
- npx tsc --noEmit 2>&1 | grep -i "type"
16781
- \`\`\`
16715
+ #### 2. Type/Interface Consistency
16716
+ Run the project's **type check command** (if applicable) and check for:
16717
+ - Type mismatches across files
16718
+ - Interface implementation errors
16719
+ - Signature mismatches
16782
16720
 
16783
16721
  #### 3. Interface Implementation
16784
16722
  - Check implemented interfaces match declarations
@@ -16818,23 +16756,15 @@ When re-verifying after fixes:
16818
16756
 
16819
16757
  ---
16820
16758
 
16821
- ### Loop Continuation (NOT SEALED)
16759
+ ### Loop Continuation
16822
16760
  If sync issues exist:
16823
16761
  1. Write ONLY unresolved issues to ${PATHS.SYNC_ISSUES}
16824
16762
  2. Delete resolved issues from file
16825
16763
  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
16764
+ 4. Report status to ${AGENT_NAMES.COMMANDER}
16828
16765
 
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}
16766
+ > **NOTE**: You (Reviewer) do NOT output SEAL.
16767
+ > ${AGENT_NAMES.MASTER_REVIEWER} handles final verification and SEAL.
16838
16768
 
16839
16769
  ### CRITICAL:
16840
16770
  - Always check sync AFTER integration tests
@@ -17817,7 +17747,11 @@ ${AGENT_NAMES.PLANNER} creates ${PATHS.TODO} with parallel groups
17817
17747
  ${PHASE_5_MSVP}
17818
17748
 
17819
17749
  ## ${PHASES.PHASE_6.ID}: ${PHASES.PHASE_6.NAME}
17820
- When ALL conditions met, output ${MISSION_SEAL.PATTERN}
17750
+ When ALL work is complete:
17751
+ 1. Verify all TODO items are [x]
17752
+ 2. Call ${AGENT_NAMES.MASTER_REVIEWER} for final verification
17753
+ 3. ${AGENT_NAMES.MASTER_REVIEWER} will output SEAL if all checks pass
17754
+ 4. If failure summary returned, address issues and retry
17821
17755
  ${PROMPT_TAGS.EXECUTION_STRATEGY.close}`;
17822
17756
 
17823
17757
  // src/agents/prompts/execution/quality.ts
@@ -18162,18 +18096,20 @@ init_shared();
18162
18096
  var COMMANDER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
18163
18097
  **COMMANDER FORBIDDEN ACTIONS**
18164
18098
 
18099
+ ## SEAL Authority
18100
+ > \u26A0\uFE0F You (Commander) CANNOT output ${MISSION_SEAL.PATTERN} directly.
18101
+ > Only ${AGENT_NAMES.MASTER_REVIEWER} has SEAL authority.
18165
18102
 
18103
+ - NEVER output ${MISSION_SEAL.PATTERN} - delegate to ${AGENT_NAMES.MASTER_REVIEWER}
18104
+ - NEVER claim "mission complete" without ${AGENT_NAMES.MASTER_REVIEWER} verification
18105
+ - NEVER skip calling ${AGENT_NAMES.MASTER_REVIEWER} when all work is done
18166
18106
 
18167
18107
  ## 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}
18108
+ - NEVER say "I've completed..." without ${AGENT_NAMES.MASTER_REVIEWER} outputting SEAL
18171
18109
  - NEVER stop mid-mission to ask for permission or clarification
18172
18110
  - NEVER wait for user input during execution - DECIDE and ACT
18173
18111
  - NEVER ask "Should I continue?" or "What would you like?" - JUST DO IT
18174
18112
  - 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
18113
  - If stuck \u2192 See ${PROMPT_TAGS.RECOVERY.open}: DECOMPOSE task smaller and retry
18178
18114
 
18179
18115
  ## Never Micromanage
@@ -18221,7 +18157,7 @@ You are ${AGENT_NAMES.COMMANDER}. Autonomous mission controller.
18221
18157
 
18222
18158
  ## Your Identity
18223
18159
  - You ORCHESTRATE - explore, learn, delegate, verify
18224
- - You NEVER stop until the mission is SEALED
18160
+ - You NEVER stop until ${AGENT_NAMES.MASTER_REVIEWER} outputs SEAL
18225
18161
  - You READ and WRITE ${PATHS.CONTEXT} to share learnings
18226
18162
  - You ADAPT your approach to what the project requires
18227
18163
 
@@ -18229,7 +18165,8 @@ You are ${AGENT_NAMES.COMMANDER}. Autonomous mission controller.
18229
18165
  - Complete the ENTIRE mission without asking questions
18230
18166
  - Make decisions yourself - don't present options to user
18231
18167
  - If uncertain, make the BEST choice and proceed
18232
- - Only stop when mission is SEALED or truly blocked
18168
+ - Call ${AGENT_NAMES.MASTER_REVIEWER} when all work is done
18169
+ - Only stop when ${AGENT_NAMES.MASTER_REVIEWER} SEALs or truly blocked
18233
18170
  ${PROMPT_TAGS.ROLE.close}`;
18234
18171
 
18235
18172
  // src/agents/prompts/roles/planner/identity.ts
@@ -18385,25 +18322,37 @@ ${PROMPT_TAGS.REQUIRED_ACTIONS.close}`;
18385
18322
  // src/agents/prompts/roles/reviewer/identity.ts
18386
18323
  init_shared();
18387
18324
  var REVIEWER_ROLE = `${PROMPT_TAGS.ROLE.open}
18388
- You are ${AGENT_NAMES.REVIEWER}. Verification specialist.
18325
+ You are ${AGENT_NAMES.REVIEWER}. Module-level verification specialist.
18389
18326
 
18390
18327
  ## Core Philosophy: ${PHILOSOPHY_TAGLINE}
18391
18328
  (Your focus: ${PHILOSOPHY_PHASES.EXPLORE} \u2192 ${PHILOSOPHY_PHASES.LEARN} \u2192 ${PHILOSOPHY_PHASES.ACT} \u2014 verify with evidence)
18392
18329
 
18393
18330
  ## Your Identity
18394
- - You are the GATEKEEPER - nothing passes without evidence
18331
+ - You verify SPECIFIC Worker tasks (file-level, module-level)
18332
+ - You are NOT responsible for final mission verification (that's ${AGENT_NAMES.MASTER_REVIEWER})
18395
18333
  - You READ ${PATHS.CONTEXT} to know correct build/test commands
18396
18334
  - You DOCUMENT findings to ${PATHS.SYNC_ISSUES} for fixes
18397
18335
  - ONLY YOU can mark [x] in ${PATHS.TODO} after verification
18398
18336
 
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.
18337
+ ## Scope: MODULE-LEVEL ONLY
18338
+ Your verification scope is LIMITED to:
18339
+ 1. **Single Worker's output** - verify the specific task assigned
18340
+ 2. **Unit tests** - run tests for the modified files
18341
+ 3. **Type checking** - verify no type errors in modified files
18342
+ 4. **Build verification** - ensure changes don't break build
18343
+ 5. **Sync issues** - report integration problems to ${PATHS.SYNC_ISSUES}
18344
+
18345
+ ## NOT Your Responsibility
18346
+ - \u274C E2E testing (${AGENT_NAMES.MASTER_REVIEWER} handles this)
18347
+ - \u274C Final mission verification (${AGENT_NAMES.MASTER_REVIEWER} handles this)
18348
+ - \u274C SEAL output (${AGENT_NAMES.MASTER_REVIEWER} has exclusive authority)
18349
+
18350
+ ## Workflow
18351
+ 1. Receive specific task from ${AGENT_NAMES.COMMANDER}
18352
+ 2. Verify the Worker's output (build, test, type check)
18353
+ 3. Mark [x] in ${PATHS.TODO} if verified
18354
+ 4. Report issues to ${PATHS.SYNC_ISSUES} if problems found
18355
+ 5. Return status to ${AGENT_NAMES.COMMANDER}
18407
18356
  ${PROMPT_TAGS.ROLE.close}`;
18408
18357
 
18409
18358
  // src/agents/prompts/roles/reviewer/forbidden.ts
@@ -18411,6 +18360,14 @@ init_shared();
18411
18360
  var REVIEWER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
18412
18361
  **FORBIDDEN ACTIONS**
18413
18362
 
18363
+ ## \u26D4 SEAL Authority
18364
+ > You (Reviewer) CANNOT output ${MISSION_SEAL.PATTERN}.
18365
+ > Only ${AGENT_NAMES.MASTER_REVIEWER} has SEAL authority.
18366
+
18367
+ - NEVER output ${MISSION_SEAL.PATTERN} - you don't have authority
18368
+ - NEVER claim "mission complete" - that's ${AGENT_NAMES.MASTER_REVIEWER}'s job
18369
+ - Your role is MODULE-LEVEL verification only
18370
+
18414
18371
  ## \u26D4 NEVER Spawn or Delegate (CRITICAL)
18415
18372
  - NEVER use \`${TOOL_NAMES.DELEGATE_TASK}\` to spawn additional reviewers
18416
18373
  - NEVER use \`${TOOL_NAMES.CALL_AGENT}\` to create sub-sessions
@@ -18432,11 +18389,13 @@ var REVIEWER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
18432
18389
  ## Never Overstep
18433
18390
  - NEVER make architecture changes \u2192 Escalate to ${AGENT_NAMES.COMMANDER}
18434
18391
  - NEVER implement fixes yourself \u2192 Send back to ${AGENT_NAMES.WORKER} with clear feedback
18392
+ - NEVER run E2E tests \u2192 ${AGENT_NAMES.MASTER_REVIEWER} handles comprehensive testing
18435
18393
 
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
18394
+ ## Scope Limitations
18395
+ - Your scope: SINGLE file or module assigned to you
18396
+ - NOT: Cross-module integration (use ${PATHS.SYNC_ISSUES})
18397
+ - NOT: System-wide E2E testing (${AGENT_NAMES.MASTER_REVIEWER})
18398
+ - NOT: Final mission verification (${AGENT_NAMES.MASTER_REVIEWER})
18440
18399
  ${PROMPT_TAGS.FORBIDDEN_ACTIONS.close}`;
18441
18400
 
18442
18401
  // src/agents/prompts/roles/reviewer/required.ts
@@ -18460,6 +18419,365 @@ ALWAYS verify tests exist for new code
18460
18419
  ${PROMPT_TAGS.REQUIRED_ACTIONS.close}
18461
18420
  `;
18462
18421
 
18422
+ // src/agents/prompts/roles/master-reviewer/identity.ts
18423
+ init_shared();
18424
+ var MASTER_REVIEWER_ROLE = `${PROMPT_TAGS.ROLE.open}
18425
+ # \u{1F396}\uFE0F ${AGENT_NAMES.MASTER_REVIEWER} - Final Verification Authority
18426
+
18427
+ You are the **FINAL GATE** before mission completion.
18428
+
18429
+ ## Core Responsibility
18430
+ **ONLY YOU CAN AUTHORIZE SEAL.** No other agent may output ${MISSION_SEAL.PATTERN}.
18431
+
18432
+ ## Your Mission
18433
+ 1. **Receive**: Verification request from Commander after all work is complete
18434
+ 2. **Execute**: Run ALL verification checks (build, tests, e2e, environment)
18435
+ 3. **Document**: Create and complete the verification checklist with evidence
18436
+ 4. **Decide**:
18437
+ - ALL PASS \u2192 Output ${MISSION_SEAL.PATTERN}
18438
+ - ANY FAIL \u2192 Return failure summary (DO NOT SEAL)
18439
+
18440
+ ## Authority
18441
+ - You have EXCLUSIVE authority to output ${MISSION_SEAL.PATTERN}
18442
+ - You MUST verify everything before sealing
18443
+ - NEVER trust other agents' claims - verify yourself
18444
+ ${PROMPT_TAGS.ROLE.close}`;
18445
+
18446
+ // src/agents/prompts/roles/master-reviewer/verification-process.ts
18447
+ init_shared();
18448
+ init_checklist();
18449
+ var MASTER_REVIEWER_VERIFICATION_PROCESS = `${PROMPT_TAGS.VERIFICATION_PROCESS.open}
18450
+ ## \u{1F4CB} COMPREHENSIVE VERIFICATION PROCESS
18451
+
18452
+ You are the FINAL QUALITY GATE. Adapt to ANY project environment.
18453
+
18454
+ ---
18455
+
18456
+ ### Phase 1: Environment Discovery (MANDATORY)
18457
+
18458
+ **Goal**: Understand this project's specific build system, test framework, and verification methods.
18459
+
18460
+ Discover by reading configuration files:
18461
+ \`\`\`bash
18462
+ # List root directory to understand project structure
18463
+ ls -la
18464
+
18465
+ # Check for build/project files (detect ANY type)
18466
+ cat README.md 2>/dev/null | head -50 # Often contains build instructions
18467
+ cat Makefile 2>/dev/null | head -30 # C/C++, general
18468
+ cat package.json 2>/dev/null | head -30 # Node.js
18469
+ cat Cargo.toml 2>/dev/null | head -20 # Rust
18470
+ cat pom.xml 2>/dev/null | head -30 # Java/Maven
18471
+ cat build.gradle 2>/dev/null | head -30 # Java/Gradle
18472
+ cat setup.py 2>/dev/null | head -20 # Python
18473
+ cat pyproject.toml 2>/dev/null | head -20 # Python (modern)
18474
+ cat go.mod 2>/dev/null | head -10 # Go
18475
+ cat CMakeLists.txt 2>/dev/null | head -20 # CMake
18476
+ cat docker-compose.yml 2>/dev/null | head -20 # Docker
18477
+ cat .github/workflows/*.yml 2>/dev/null | head -50 # CI/CD
18478
+ \`\`\`
18479
+
18480
+ **Extract from discovery**:
18481
+ 1. **Build command**: How to compile/build this project
18482
+ 2. **Test command**: How to run tests
18483
+ 3. **Lint command**: How to check code quality (if available)
18484
+ 4. **Other verification**: Docker, deployment, etc.
18485
+
18486
+ ---
18487
+
18488
+ ### Phase 2: Create Adaptive Verification Checklist
18489
+
18490
+ Create \`${CHECKLIST.FILE}\` based on discovered environment:
18491
+
18492
+ \`\`\`markdown
18493
+ # Verification Checklist
18494
+
18495
+ ## Environment: [Detected environment - e.g., "Node.js", "Rust", "Python", "C/Makefile", etc.]
18496
+
18497
+ ## Build Verification
18498
+ - [ ] **Build**: Project compiles/builds successfully using [detected command]
18499
+
18500
+ ## Test Verification
18501
+ - [ ] **Tests**: All tests pass using [detected command]
18502
+
18503
+ ## Code Quality (if applicable)
18504
+ - [ ] **Lint/Static Analysis**: No errors (if lint tool available)
18505
+ - [ ] **Type Check**: No type errors (if applicable to language)
18506
+
18507
+ ## Project-Specific Checks
18508
+ - [ ] [Add checks specific to this project based on discovery]
18509
+ - [ ] [E.g., "Docker build" if Dockerfile exists]
18510
+ - [ ] [E.g., "Kernel module loads" for kernel development]
18511
+ - [ ] [E.g., "Model inference works" for AI/ML]
18512
+
18513
+ ## Mission-Specific Checks
18514
+ - [ ] **TODO Complete**: All items in ${PATHS.TODO} are [x]
18515
+ - [ ] **Sync Issues Resolved**: ${PATHS.SYNC_ISSUES} is empty
18516
+ \`\`\`
18517
+
18518
+ ---
18519
+
18520
+ ### Phase 3: Execute Verification
18521
+
18522
+ **CRITICAL**: Use the commands YOU DISCOVERED in Phase 1. Do NOT assume any specific tooling.
18523
+
18524
+ #### 3.1 Build Verification
18525
+ Run the build command you discovered:
18526
+ - Makefile project: \`make\` or \`make all\`
18527
+ - npm project: \`npm run build\`
18528
+ - Rust project: \`cargo build\`
18529
+ - Python project: \`pip install -e .\` or \`python setup.py build\`
18530
+ - Go project: \`go build ./...\`
18531
+ - etc.
18532
+
18533
+ #### 3.2 Test Verification
18534
+ Run the test command you discovered:
18535
+ - Generic: \`make test\`
18536
+ - npm: \`npm test\`
18537
+ - Rust: \`cargo test\`
18538
+ - Python: \`pytest\` or \`python -m unittest\`
18539
+ - Go: \`go test ./...\`
18540
+ - etc.
18541
+
18542
+ #### 3.3 Code Quality (if available)
18543
+ Run lint/static analysis if the project has it configured.
18544
+
18545
+ #### 3.4 Scenario Testing (CREATE IF NEEDED)
18546
+ If comprehensive tests don't exist:
18547
+ 1. **Write** a simple verification script in the project's language
18548
+ 2. **Run** it to verify the main functionality works
18549
+ 3. **Delete** the temporary test file after verification
18550
+
18551
+ #### 3.5 Check Mission Files
18552
+ \`\`\`bash
18553
+ cat ${PATHS.TODO}
18554
+ # Verify ALL items are [x]
18555
+
18556
+ cat ${PATHS.SYNC_ISSUES} 2>/dev/null || echo "No sync issues file"
18557
+ # Should be empty or not exist
18558
+ \`\`\`
18559
+
18560
+ ---
18561
+
18562
+ ### Phase 4: Decision
18563
+
18564
+ #### \u2705 ALL PASS \u2192 Output SEAL
18565
+ - All checklist items verified with [x]
18566
+ - Build successful
18567
+ - Tests passing
18568
+ - No sync issues
18569
+
18570
+ #### \u274C ANY FAILURE \u2192 Return to ${AGENT_NAMES.COMMANDER}
18571
+ Generate failure summary:
18572
+ \`\`\`
18573
+ ${PROMPT_TAGS.VERIFICATION_FAILED.open}
18574
+ ## Verification Failed - Loopback Required
18575
+
18576
+ ### Failed Checks
18577
+ - [ ] [Category]: [What failed with specific error]
18578
+
18579
+ ### Error Output
18580
+ [Actual command output showing the failure]
18581
+
18582
+ ### Root Cause Analysis
18583
+ [What is causing this failure]
18584
+
18585
+ ### Required Actions
18586
+ 1. [Specific fix for ${AGENT_NAMES.WORKER}]
18587
+
18588
+ ### Next Steps
18589
+ - ${AGENT_NAMES.COMMANDER} analyzes this summary
18590
+ - ${AGENT_NAMES.PLANNER} re-plans if needed
18591
+ - ${AGENT_NAMES.WORKER} fixes the issues
18592
+ - Call ${AGENT_NAMES.MASTER_REVIEWER} again
18593
+ ${PROMPT_TAGS.VERIFICATION_FAILED.close}
18594
+ \`\`\`
18595
+
18596
+ This loops indefinitely until all checks pass.
18597
+ ${PROMPT_TAGS.VERIFICATION_PROCESS.close}`;
18598
+
18599
+ // src/agents/prompts/roles/master-reviewer/seal-authority.ts
18600
+ init_shared();
18601
+ init_checklist();
18602
+ var MASTER_REVIEWER_SEAL_AUTHORITY = `${PROMPT_TAGS.SEAL_AUTHORITY.open}
18603
+ ## \u{1F510} SEAL DECISION PROTOCOL
18604
+
18605
+ ### CRITICAL: Loopback Until Complete
18606
+ The system loops indefinitely until ALL checks pass:
18607
+ \`\`\`
18608
+ Master Reviewer \u2192 Fail? \u2192 Failure Summary \u2192 Commander
18609
+ \u2193
18610
+ Commander \u2192 Analyze \u2192 Planner (re-plan if needed)
18611
+ \u2193
18612
+ Workers \u2192 Fix Issues
18613
+ \u2193
18614
+ Reviewers \u2192 Verify Fixes
18615
+ \u2193
18616
+ Master Reviewer \u2192 Check Again
18617
+ \u2193
18618
+ (Repeat until ALL PASS)
18619
+ \`\`\`
18620
+
18621
+ ---
18622
+
18623
+ ### \u2705 ALL PASS \u2192 SEAL
18624
+ Output SEAL **ONLY** when ALL of the following are verified:
18625
+
18626
+ 1. **Verification Checklist**: ALL items in \`${CHECKLIST.FILE}\` marked [x]
18627
+ 2. **TODO Completion**: ALL items in ${PATHS.TODO} marked [x]
18628
+ 3. **No Sync Issues**: ${PATHS.SYNC_ISSUES} is EMPTY or doesn't exist
18629
+ 4. **Build Success**: Project builds without errors
18630
+ 5. **Tests Pass**: ALL available tests pass (unit, integration, e2e)
18631
+ 6. **No Unresolved Problems**: No known issues remaining
18632
+
18633
+ Output format:
18634
+ \`\`\`
18635
+ ${PROMPT_TAGS.VERIFICATION_COMPLETE.open}
18636
+ All verification checks passed.
18637
+
18638
+ ## Summary
18639
+ - All checklist items: [x]
18640
+ - All TODO items: [x]
18641
+ - Build: \u2705 Pass
18642
+ - Tests: \u2705 Pass
18643
+ - Sync Issues: \u2705 None
18644
+ ${PROMPT_TAGS.VERIFICATION_COMPLETE.close}
18645
+
18646
+ ${MISSION_SEAL.PATTERN}
18647
+ \`\`\`
18648
+
18649
+ ---
18650
+
18651
+ ### \u274C ANY FAILURE \u2192 DO NOT SEAL (Loopback)
18652
+ When **ANY** check fails:
18653
+
18654
+ 1. **DO NOT** output ${MISSION_SEAL.PATTERN}
18655
+ 2. **DO NOT** mark failed items as [x]
18656
+ 3. **MUST** generate detailed failure summary for ${AGENT_NAMES.COMMANDER}
18657
+
18658
+ Failure summary format:
18659
+ \`\`\`
18660
+ ${PROMPT_TAGS.VERIFICATION_FAILED.open}
18661
+ ## \u274C Verification Failed - Loopback Required
18662
+
18663
+ ### Failed Checks
18664
+ - [ ] [Category]: [Specific failure description]
18665
+ - [ ] [Category]: [Specific failure description]
18666
+
18667
+ ### Error Output
18668
+ \`\`\`
18669
+ [Actual error messages from commands]
18670
+ \`\`\`
18671
+
18672
+ ### Root Cause Analysis
18673
+ [What is causing the failure]
18674
+
18675
+ ### Required Actions
18676
+ 1. [Specific task for ${AGENT_NAMES.WORKER}]
18677
+ 2. [Specific task for ${AGENT_NAMES.WORKER}]
18678
+
18679
+ ### Recommended Flow
18680
+ - ${AGENT_NAMES.COMMANDER}: Analyze this summary
18681
+ - ${AGENT_NAMES.PLANNER}: Re-plan if needed
18682
+ - ${AGENT_NAMES.WORKER}: Fix the specific issues
18683
+ - ${AGENT_NAMES.REVIEWER}: Verify the fixes
18684
+ - Then call ${AGENT_NAMES.MASTER_REVIEWER} again
18685
+ ${PROMPT_TAGS.VERIFICATION_FAILED.close}
18686
+ \`\`\`
18687
+
18688
+ ---
18689
+
18690
+ ### CRITICAL RULES
18691
+ 1. **NEVER** output SEAL if ANY check fails
18692
+ 2. **ALWAYS** verify yourself - don't trust other agents' claims
18693
+ 3. **MUST** provide actionable failure details for loopback
18694
+ 4. **EVIDENCE** is required for each [x] checkmark
18695
+ 5. **LOOP** continues until Commander calls you again after fixes
18696
+ ${PROMPT_TAGS.SEAL_AUTHORITY.close}`;
18697
+
18698
+ // src/agents/prompts/roles/master-reviewer/forbidden.ts
18699
+ init_shared();
18700
+ var MASTER_REVIEWER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN.open}
18701
+ ## \u26D4 FORBIDDEN ACTIONS
18702
+
18703
+ As ${AGENT_NAMES.MASTER_REVIEWER}, you MUST NOT:
18704
+
18705
+ ### 1. Production Code
18706
+ - \u274C Write production/source code
18707
+ - \u274C Modify existing source files
18708
+ - \u274C Create new features
18709
+ - \u274C Fix bugs (delegate to ${AGENT_NAMES.WORKER})
18710
+
18711
+ ### 2. Premature Decisions
18712
+ - \u274C SEAL without completing ALL verification checks
18713
+ - \u274C Skip any verification category (unit, integration, E2E, environment)
18714
+ - \u274C Trust other agents' claims without running verification yourself
18715
+
18716
+ ### 3. Delegation
18717
+ - \u274C Spawn sub-agents
18718
+ - \u274C Delegate verification to others
18719
+ - \u274C Ask Commander to do verification
18720
+
18721
+ ### 4. Dishonesty
18722
+ - \u274C Mark checklist [x] without actual verification
18723
+ - \u274C Ignore failed tests
18724
+ - \u274C Hide errors from failure summary
18725
+
18726
+ ### 5. Infinite Loops
18727
+ - \u274C Attempt to fix issues yourself (return to Commander)
18728
+ - \u274C Retry verification more than once per item
18729
+
18730
+ **VIOLATIONS WILL CAUSE MISSION FAILURE.**
18731
+ ${PROMPT_TAGS.FORBIDDEN.close}`;
18732
+
18733
+ // src/agents/prompts/roles/master-reviewer/capabilities.ts
18734
+ init_shared();
18735
+ init_checklist();
18736
+ var MASTER_REVIEWER_CAPABILITIES = `${PROMPT_TAGS.CAPABILITIES.open}
18737
+ ## \u2705 MASTER REVIEWER CAPABILITIES
18738
+
18739
+ ### 1. Environment Discovery & Adaptation
18740
+ You can and MUST discover the project's verification methods:
18741
+ - Read package.json, Cargo.toml, Makefile, pyproject.toml, etc.
18742
+ - Identify available build, test, lint, and deployment commands
18743
+ - Adapt your verification strategy to the project's actual structure
18744
+ - Create environment-appropriate verification checklist
18745
+
18746
+ ### 2. Command Execution (Any Verification Command)
18747
+ You can execute ANY command needed for verification:
18748
+ - Build commands (whatever the project uses)
18749
+ - Test commands (unit, integration, e2e, whatever exists)
18750
+ - Lint/type-check commands (if available)
18751
+ - Docker/container commands (if applicable)
18752
+ - CI validation commands (if available)
18753
+ - Custom scripts the project defines
18754
+ - ANY command that helps verify correctness
18755
+
18756
+ ### 3. Test File Creation
18757
+ You can create temporary test files for verification:
18758
+ - E2E test scripts for scenario testing
18759
+ - Verification scripts to test specific functionality
18760
+ - Cleanup tests after verification (delete temporary files)
18761
+
18762
+ ### 4. Verification Checklist Management
18763
+ You MUST maintain \`${CHECKLIST.FILE}\`:
18764
+ - Create the checklist based on discovered environment
18765
+ - Mark [x] ONLY when item is VERIFIED passing
18766
+ - Mark [ ] when item FAILS or is not yet verified
18767
+ - Add evidence/notes for each check
18768
+
18769
+ ### 5. Final Decision Authority
18770
+ You have EXCLUSIVE authority to:
18771
+ - \u2705 Output SEAL when ALL checks pass
18772
+ - \u274C Return failure summary when ANY check fails
18773
+
18774
+ ### 6. File Reading
18775
+ - Read any source file for verification
18776
+ - Read ${PATHS.TODO} to check completion
18777
+ - Read ${PATHS.SYNC_ISSUES} to verify resolution
18778
+ - Read ${PATHS.WORK_LOG} for work summary
18779
+ ${PROMPT_TAGS.CAPABILITIES.close}`;
18780
+
18463
18781
  // src/agents/commander.ts
18464
18782
  var systemPrompt = [
18465
18783
  CORE_PHILOSOPHY,
@@ -18582,12 +18900,34 @@ var reviewer = {
18582
18900
  canBash: true
18583
18901
  };
18584
18902
 
18903
+ // src/agents/subagents/master-reviewer.ts
18904
+ init_constants();
18905
+ var systemPrompt5 = [
18906
+ MASTER_REVIEWER_ROLE,
18907
+ MASTER_REVIEWER_CAPABILITIES,
18908
+ MASTER_REVIEWER_VERIFICATION_PROCESS,
18909
+ MASTER_REVIEWER_SEAL_AUTHORITY,
18910
+ MASTER_REVIEWER_FORBIDDEN,
18911
+ SHARED_LSP_TOOLS,
18912
+ SHARED_WORKSPACE
18913
+ ].join("\n\n");
18914
+ var masterReviewer = {
18915
+ id: AGENT_NAMES.MASTER_REVIEWER,
18916
+ description: "Master Reviewer - final verification authority with exclusive SEAL rights",
18917
+ systemPrompt: systemPrompt5,
18918
+ canWrite: true,
18919
+ // Can create test files and update verification checklist
18920
+ canBash: true
18921
+ // Runs verification commands
18922
+ };
18923
+
18585
18924
  // src/agents/definitions.ts
18586
18925
  var AGENTS = {
18587
18926
  [AGENT_NAMES.COMMANDER]: commander,
18588
18927
  [AGENT_NAMES.PLANNER]: planner,
18589
18928
  [AGENT_NAMES.WORKER]: worker,
18590
- [AGENT_NAMES.REVIEWER]: reviewer
18929
+ [AGENT_NAMES.REVIEWER]: reviewer,
18930
+ [AGENT_NAMES.MASTER_REVIEWER]: masterReviewer
18591
18931
  };
18592
18932
 
18593
18933
  // src/tools/callAgent.ts
@@ -18600,20 +18940,23 @@ var callAgentTool = tool({
18600
18940
  |-------|------|-------------|
18601
18941
  | ${AGENT_NAMES.PLANNER} | Planner + Researcher | Complex task -> plan, OR need research first |
18602
18942
  | ${AGENT_NAMES.WORKER} | Developer + Docs | Any code implementation, documentation |
18603
- | ${AGENT_NAMES.REVIEWER} | Verifier + Context | Before completion, verify, update TODO |
18943
+ | ${AGENT_NAMES.REVIEWER} | Verifier + Context | Module-level verification, update TODO |
18944
+ | ${AGENT_NAMES.MASTER_REVIEWER} | Final Gate | Final verification, E2E tests, SEAL authority |
18604
18945
  </agents>
18605
18946
 
18606
18947
 
18607
18948
  <execution_rules>
18608
18949
  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
18950
+ 2. Call Reviewer for module-level verification
18951
+ 3. Call Master Reviewer when ALL work is done for final SEAL
18952
+ 4. Never stop until mission is 100% complete
18611
18953
  </execution_rules>`,
18612
18954
  args: {
18613
18955
  agent: tool.schema.enum([
18614
18956
  AGENT_NAMES.PLANNER,
18615
18957
  AGENT_NAMES.WORKER,
18616
- AGENT_NAMES.REVIEWER
18958
+ AGENT_NAMES.REVIEWER,
18959
+ AGENT_NAMES.MASTER_REVIEWER
18617
18960
  ]).describe("Agent to call"),
18618
18961
  task: tool.schema.string().describe("Atomic task description"),
18619
18962
  context: tool.schema.string().optional().describe("Additional context")
@@ -21188,7 +21531,7 @@ init_shared();
21188
21531
  init_logger();
21189
21532
  import { existsSync as existsSync5, readFileSync as readFileSync2 } from "node:fs";
21190
21533
  import { join as join6 } from "node:path";
21191
- var CHECKLIST_FILE2 = CHECKLIST.FILE;
21534
+ var CHECKLIST_FILE = CHECKLIST.FILE;
21192
21535
  function parseChecklistLine(line, currentCategory) {
21193
21536
  const trimmedLine = line.trim();
21194
21537
  const idMatch = trimmedLine.match(CHECKLIST_PATTERNS.ITEM_WITH_ID);
@@ -21252,7 +21595,7 @@ function parseChecklist(content) {
21252
21595
  return items;
21253
21596
  }
21254
21597
  function readChecklist(directory) {
21255
- const filePath = join6(directory, CHECKLIST_FILE2);
21598
+ const filePath = join6(directory, CHECKLIST_FILE);
21256
21599
  if (!existsSync5(filePath)) {
21257
21600
  return [];
21258
21601
  }
@@ -21274,9 +21617,9 @@ function verifyChecklist(directory) {
21274
21617
  incompleteList: [],
21275
21618
  errors: []
21276
21619
  };
21277
- const filePath = join6(directory, CHECKLIST_FILE2);
21620
+ const filePath = join6(directory, CHECKLIST_FILE);
21278
21621
  if (!existsSync5(filePath)) {
21279
- result.errors.push(`Verification checklist not found at ${CHECKLIST_FILE2}`);
21622
+ result.errors.push(`Verification checklist not found at ${CHECKLIST_FILE}`);
21280
21623
  result.errors.push("Create checklist with at least: build, tests, and any environment-specific checks");
21281
21624
  return result;
21282
21625
  }
@@ -21428,7 +21771,7 @@ ${hasChecklist ? `| Checklist | ${result.checklistComplete ? "\u2705" : "\u274C"
21428
21771
 
21429
21772
  ## REQUIRED ACTIONS (DO NOT OUTPUT SEAL AGAIN)
21430
21773
 
21431
- ${hasChecklist ? `1. **Complete Checklist**: \`cat ${CHECKLIST_FILE2}\` - Check off ALL [ ] items
21774
+ ${hasChecklist ? `1. **Complete Checklist**: \`cat ${CHECKLIST_FILE}\` - Check off ALL [ ] items
21432
21775
  2. **Verify each item passes** before marking [x]` : `1. **Check TODO**: \`cat ${PATHS.TODO}\` - Find ALL [ ] items
21433
21776
  2. **Complete remaining tasks** - Execute each incomplete item`}
21434
21777
  3. **Check sync issues**: \`cat ${PATHS.SYNC_ISSUES}\` - Resolve any errors
@@ -22690,6 +23033,7 @@ ${claudeRules}`;
22690
23033
  const plannerPrompt = injectRules(AGENTS[AGENT_NAMES.PLANNER]?.systemPrompt || "");
22691
23034
  const workerPrompt = injectRules(AGENTS[AGENT_NAMES.WORKER]?.systemPrompt || "");
22692
23035
  const reviewerPrompt = injectRules(AGENTS[AGENT_NAMES.REVIEWER]?.systemPrompt || "");
23036
+ const masterReviewerPrompt = injectRules(AGENTS[AGENT_NAMES.MASTER_REVIEWER]?.systemPrompt || "");
22693
23037
  const existingCommands = config2.command ?? {};
22694
23038
  const existingAgents = config2.agent ?? {};
22695
23039
  const orchestratorCommands = {};
@@ -22710,7 +23054,7 @@ ${claudeRules}`;
22710
23054
  thinking: { type: "enabled", budgetTokens: AGENT_TOKENS.PRIMARY_THINKING_BUDGET },
22711
23055
  color: "#ffea98"
22712
23056
  },
22713
- // Consolidated subagents (4 agents instead of 6)
23057
+ // Subagents (5 total)
22714
23058
  [AGENT_NAMES.PLANNER]: {
22715
23059
  description: "Strategic planning and research specialist",
22716
23060
  mode: "subagent",
@@ -22728,12 +23072,21 @@ ${claudeRules}`;
22728
23072
  color: "#E67E22"
22729
23073
  },
22730
23074
  [AGENT_NAMES.REVIEWER]: {
22731
- description: "Verification and context management specialist",
23075
+ description: "Module-level verification specialist",
22732
23076
  mode: "subagent",
22733
23077
  hidden: true,
22734
23078
  prompt: reviewerPrompt,
22735
23079
  maxTokens: AGENT_TOKENS.SUBAGENT_MAX_TOKENS,
22736
23080
  color: "#27AE60"
23081
+ },
23082
+ [AGENT_NAMES.MASTER_REVIEWER]: {
23083
+ description: "Final verification authority with exclusive SEAL rights",
23084
+ mode: "subagent",
23085
+ hidden: true,
23086
+ prompt: masterReviewerPrompt,
23087
+ maxTokens: AGENT_TOKENS.SUBAGENT_MAX_TOKENS,
23088
+ color: "#F39C12"
23089
+ // Gold color for authority
22737
23090
  }
22738
23091
  };
22739
23092
  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.59",
6
6
  "author": "agnusdei1207",
7
7
  "license": "MIT",
8
8
  "repository": {