zhuge-workflow 0.1.0

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.
Files changed (80) hide show
  1. package/dist/index.js +801 -0
  2. package/dist/index.js.map +1 -0
  3. package/package.json +61 -0
  4. package/templates/claude/CLAUDE-ccg.md +258 -0
  5. package/templates/claude/CLAUDE.md +106 -0
  6. package/templates/claude/commands/ccg/_context.md +152 -0
  7. package/templates/claude/commands/ccg/spec-impl.md +161 -0
  8. package/templates/claude/commands/ccg/spec-plan-trellis.md +239 -0
  9. package/templates/claude/commands/ccg/spec-plan.md +225 -0
  10. package/templates/claude/commands/ccg/spec-research.md +113 -0
  11. package/templates/claude/commands/ccg/spec-review.md +127 -0
  12. package/templates/claude/commands/developer/brainstorm.md +5 -0
  13. package/templates/claude/commands/developer/design-checklist.md +81 -0
  14. package/templates/claude/commands/developer/design-doc.md +188 -0
  15. package/templates/claude/commands/developer/requirement-doc.md +150 -0
  16. package/templates/claude/commands/developer/requirement-interrogate.md +71 -0
  17. package/templates/claude/commands/developer/status.md +55 -0
  18. package/templates/claude/rules/bash-style.md +46 -0
  19. package/templates/claude/rules/claude-code-defensive.md +99 -0
  20. package/templates/claude/rules/doc-sync.md +49 -0
  21. package/templates/claude/rules/ops-safety.md +32 -0
  22. package/templates/claude/skills/bash-style/SKILL.md +244 -0
  23. package/templates/claude/skills/brainstorming/SKILL.md +48 -0
  24. package/templates/claude/skills/dotnet-dev/SKILL.md +250 -0
  25. package/templates/claude/skills/dotnet-dev/references/dotnet-style.md +991 -0
  26. package/templates/claude/skills/mcp-builder/LICENSE.txt +202 -0
  27. package/templates/claude/skills/mcp-builder/SKILL.md +328 -0
  28. package/templates/claude/skills/mcp-builder/reference/evaluation.md +602 -0
  29. package/templates/claude/skills/mcp-builder/reference/mcp_best_practices.md +915 -0
  30. package/templates/claude/skills/mcp-builder/reference/node_mcp_server.md +916 -0
  31. package/templates/claude/skills/mcp-builder/reference/python_mcp_server.md +752 -0
  32. package/templates/claude/skills/mcp-builder/scripts/connections.py +151 -0
  33. package/templates/claude/skills/mcp-builder/scripts/evaluation.py +373 -0
  34. package/templates/claude/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
  35. package/templates/claude/skills/mcp-builder/scripts/requirements.txt +2 -0
  36. package/templates/claude/skills/ops-safety/SKILL.md +130 -0
  37. package/templates/claude/skills/python-dev/SKILL.md +281 -0
  38. package/templates/claude/skills/skill-creator/LICENSE.txt +202 -0
  39. package/templates/claude/skills/skill-creator/SKILL.md +209 -0
  40. package/templates/claude/skills/skill-creator/scripts/init_skill.py +303 -0
  41. package/templates/claude/skills/skill-creator/scripts/package_skill.py +110 -0
  42. package/templates/claude/skills/skill-creator/scripts/quick_validate.py +65 -0
  43. package/templates/claude/skills/sqlserver-executor/SKILL.md +201 -0
  44. package/templates/claude/skills/sqlserver-executor/assets/config-example.json +26 -0
  45. package/templates/claude/skills/sqlserver-executor/config.json +12 -0
  46. package/templates/claude/skills/sqlserver-executor/scripts/sql_executor.py +404 -0
  47. package/templates/claude/skills/ui-ux-pro-max/SKILL.md +228 -0
  48. package/templates/claude/skills/ui-ux-pro-max/data/charts.csv +26 -0
  49. package/templates/claude/skills/ui-ux-pro-max/data/colors.csv +97 -0
  50. package/templates/claude/skills/ui-ux-pro-max/data/landing.csv +31 -0
  51. package/templates/claude/skills/ui-ux-pro-max/data/products.csv +97 -0
  52. package/templates/claude/skills/ui-ux-pro-max/data/prompts.csv +24 -0
  53. package/templates/claude/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  54. package/templates/claude/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  55. package/templates/claude/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  56. package/templates/claude/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  57. package/templates/claude/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  58. package/templates/claude/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  59. package/templates/claude/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  60. package/templates/claude/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  61. package/templates/claude/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  62. package/templates/claude/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  63. package/templates/claude/skills/ui-ux-pro-max/data/styles.csv +59 -0
  64. package/templates/claude/skills/ui-ux-pro-max/data/typography.csv +58 -0
  65. package/templates/claude/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  66. package/templates/claude/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-313.pyc +0 -0
  67. package/templates/claude/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-314.pyc +0 -0
  68. package/templates/claude/skills/ui-ux-pro-max/scripts/core.py +238 -0
  69. package/templates/claude/skills/ui-ux-pro-max/scripts/search.py +61 -0
  70. package/templates/claude/skills/webapp-testing/LICENSE.txt +202 -0
  71. package/templates/claude/skills/webapp-testing/SKILL.md +96 -0
  72. package/templates/claude/skills/webapp-testing/examples/console_logging.py +35 -0
  73. package/templates/claude/skills/webapp-testing/examples/element_discovery.py +40 -0
  74. package/templates/claude/skills/webapp-testing/examples/static_html_automation.py +33 -0
  75. package/templates/claude/skills/webapp-testing/scripts/with_server.py +106 -0
  76. package/templates/init/claude-agents/ccg-impl.md +199 -0
  77. package/templates/init/claude-agents/ccg-review.md +146 -0
  78. package/templates/init/claude-agents/dispatch.md +253 -0
  79. package/templates/init/claude-hooks/inject-subagent-context.py +964 -0
  80. package/templates/init/trellis-scripts/task.sh +1326 -0
@@ -0,0 +1,33 @@
1
+ from playwright.sync_api import sync_playwright
2
+ import os
3
+
4
+ # Example: Automating interaction with static HTML files using file:// URLs
5
+
6
+ html_file_path = os.path.abspath('path/to/your/file.html')
7
+ file_url = f'file://{html_file_path}'
8
+
9
+ with sync_playwright() as p:
10
+ browser = p.chromium.launch(headless=True)
11
+ page = browser.new_page(viewport={'width': 1920, 'height': 1080})
12
+
13
+ # Navigate to local HTML file
14
+ page.goto(file_url)
15
+
16
+ # Take screenshot
17
+ page.screenshot(path='/mnt/user-data/outputs/static_page.png', full_page=True)
18
+
19
+ # Interact with elements
20
+ page.click('text=Click Me')
21
+ page.fill('#name', 'John Doe')
22
+ page.fill('#email', 'john@example.com')
23
+
24
+ # Submit form
25
+ page.click('button[type="submit"]')
26
+ page.wait_for_timeout(500)
27
+
28
+ # Take final screenshot
29
+ page.screenshot(path='/mnt/user-data/outputs/after_submit.png', full_page=True)
30
+
31
+ browser.close()
32
+
33
+ print("Static HTML automation completed!")
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Start one or more servers, wait for them to be ready, run a command, then clean up.
4
+
5
+ Usage:
6
+ # Single server
7
+ python scripts/with_server.py --server "npm run dev" --port 5173 -- python automation.py
8
+ python scripts/with_server.py --server "npm start" --port 3000 -- python test.py
9
+
10
+ # Multiple servers
11
+ python scripts/with_server.py \
12
+ --server "cd backend && python server.py" --port 3000 \
13
+ --server "cd frontend && npm run dev" --port 5173 \
14
+ -- python test.py
15
+ """
16
+
17
+ import subprocess
18
+ import socket
19
+ import time
20
+ import sys
21
+ import argparse
22
+
23
+ def is_server_ready(port, timeout=30):
24
+ """Wait for server to be ready by polling the port."""
25
+ start_time = time.time()
26
+ while time.time() - start_time < timeout:
27
+ try:
28
+ with socket.create_connection(('localhost', port), timeout=1):
29
+ return True
30
+ except (socket.error, ConnectionRefusedError):
31
+ time.sleep(0.5)
32
+ return False
33
+
34
+
35
+ def main():
36
+ parser = argparse.ArgumentParser(description='Run command with one or more servers')
37
+ parser.add_argument('--server', action='append', dest='servers', required=True, help='Server command (can be repeated)')
38
+ parser.add_argument('--port', action='append', dest='ports', type=int, required=True, help='Port for each server (must match --server count)')
39
+ parser.add_argument('--timeout', type=int, default=30, help='Timeout in seconds per server (default: 30)')
40
+ parser.add_argument('command', nargs=argparse.REMAINDER, help='Command to run after server(s) ready')
41
+
42
+ args = parser.parse_args()
43
+
44
+ # Remove the '--' separator if present
45
+ if args.command and args.command[0] == '--':
46
+ args.command = args.command[1:]
47
+
48
+ if not args.command:
49
+ print("Error: No command specified to run")
50
+ sys.exit(1)
51
+
52
+ # Parse server configurations
53
+ if len(args.servers) != len(args.ports):
54
+ print("Error: Number of --server and --port arguments must match")
55
+ sys.exit(1)
56
+
57
+ servers = []
58
+ for cmd, port in zip(args.servers, args.ports):
59
+ servers.append({'cmd': cmd, 'port': port})
60
+
61
+ server_processes = []
62
+
63
+ try:
64
+ # Start all servers
65
+ for i, server in enumerate(servers):
66
+ print(f"Starting server {i+1}/{len(servers)}: {server['cmd']}")
67
+
68
+ # Use shell=True to support commands with cd and &&
69
+ process = subprocess.Popen(
70
+ server['cmd'],
71
+ shell=True,
72
+ stdout=subprocess.PIPE,
73
+ stderr=subprocess.PIPE
74
+ )
75
+ server_processes.append(process)
76
+
77
+ # Wait for this server to be ready
78
+ print(f"Waiting for server on port {server['port']}...")
79
+ if not is_server_ready(server['port'], timeout=args.timeout):
80
+ raise RuntimeError(f"Server failed to start on port {server['port']} within {args.timeout}s")
81
+
82
+ print(f"Server ready on port {server['port']}")
83
+
84
+ print(f"\nAll {len(servers)} server(s) ready")
85
+
86
+ # Run the command
87
+ print(f"Running: {' '.join(args.command)}\n")
88
+ result = subprocess.run(args.command)
89
+ sys.exit(result.returncode)
90
+
91
+ finally:
92
+ # Clean up all servers
93
+ print(f"\nStopping {len(server_processes)} server(s)...")
94
+ for i, process in enumerate(server_processes):
95
+ try:
96
+ process.terminate()
97
+ process.wait(timeout=5)
98
+ except subprocess.TimeoutExpired:
99
+ process.kill()
100
+ process.wait()
101
+ print(f"Server {i+1} stopped")
102
+ print("All servers stopped")
103
+
104
+
105
+ if __name__ == '__main__':
106
+ main()
@@ -0,0 +1,199 @@
1
+ ---
2
+ name: ccg-impl
3
+ description: |
4
+ CCG implementation agent. Executes OpenSpec change phases with multi-model collaboration.
5
+ Reads prd.md to get change path and phase number, then implements tasks from tasks.md.
6
+ Uses Codex for backend, Gemini for frontend. Rewrites all external outputs to production code.
7
+ Calls check/debug agents for self-fix. Updates tasks.md and archives when complete.
8
+ tools: Read, Write, Edit, Bash, Glob, Grep, Task, TaskOutput, Skill, mcp__ace-tool__search_context, mcp__exa__web_search_exa, mcp__exa__get_code_context_exa
9
+ model: opus
10
+ ---
11
+ # CCG Implement Agent
12
+
13
+ You are the CCG Implement Agent in the Trellis workflow - a multi-model collaborative implementation agent.
14
+
15
+ ## Context
16
+
17
+ Before implementing, you will receive injected context including:
18
+ - `prd.md` - Contains OpenSpec change path and phase number
19
+ - `specs.md` - OpenSpec requirements and constraints
20
+ - `design.md` - OpenSpec technical design
21
+ - `tasks.md` - Task list with Phase sections
22
+ - `.trellis/spec/` - Project development guidelines
23
+
24
+ ## Core Responsibilities
25
+
26
+ 1. **Parse prd.md** - Extract change path and phase number
27
+ 2. **Read Phase tasks** - Get task list from tasks.md for the specified phase
28
+ 3. **Multi-model collaboration** - Route tasks to Codex (backend) or Gemini (frontend)
29
+ 4. **Rewrite prototypes** - External model outputs are reference only, rewrite to production code
30
+ 5. **Self-fix** - Call check/debug agents when issues found
31
+ 6. **Update status** - Mark completed tasks in tasks.md as `[x]`
32
+
33
+ ## Forbidden Operations
34
+
35
+ **Do NOT execute these git commands:**
36
+ - `git commit`
37
+ - `git push`
38
+ - `git merge`
39
+
40
+ ---
41
+
42
+ ## Workflow
43
+
44
+ ### 1. Parse Task Context
45
+
46
+ Read prd.md to extract:
47
+ ```
48
+ Change: openspec/changes/<change-name>
49
+ Phase: <N>
50
+ ```
51
+
52
+ ### 2. Read Phase Tasks
53
+
54
+ From tasks.md, find the section `## Phase N:` and extract all tasks under it.
55
+
56
+ ### 3. Read Specs and Design
57
+
58
+ Read the OpenSpec artifacts:
59
+ - `<change-dir>/specs.md` - Requirements and constraints
60
+ - `<change-dir>/design.md` - Technical decisions
61
+
62
+ ### 4. Route Tasks to Appropriate Model
63
+
64
+ For each task in the phase:
65
+
66
+ **Route A: Gemini** — Frontend/UI/styling
67
+ - CSS, React, Vue, HTML, components
68
+ - TypeScript frontend code
69
+
70
+ **Route B: Codex** — Backend/logic/algorithm
71
+ - API, data processing, business logic
72
+ - C#, Python backend code
73
+
74
+ ```bash
75
+ codeagent-wrapper --backend <codex|gemini> - "$PWD" <<'EOF'
76
+ TASK: <task description from tasks.md>
77
+ CONTEXT: <relevant code context>
78
+ CONSTRAINTS: <constraints from specs.md>
79
+ OUTPUT: Unified Diff Patch format ONLY
80
+ EOF
81
+ ```
82
+
83
+ ### 5. Rewrite Prototype to Production Code
84
+
85
+ Upon receiving diff patch from external model, **NEVER apply directly**. Rewrite by:
86
+ - Removing redundancy
87
+ - Ensuring clear naming and simple structure
88
+ - Aligning with project style
89
+ - Eliminating unnecessary comments
90
+ - Verifying no new dependencies introduced
91
+
92
+ ### 6. Side-Effect Review (Mandatory before apply)
93
+
94
+ Verify the change:
95
+ - [ ] Does not exceed tasks.md scope
96
+ - [ ] Does not affect unrelated modules
97
+ - [ ] Does not introduce new dependencies
98
+ - [ ] Does not break existing interfaces
99
+
100
+ If issues found, make targeted corrections.
101
+
102
+ ### 7. Multi-Model Review (PARALLEL)
103
+
104
+ **CRITICAL**: Launch BOTH Codex AND Gemini in a SINGLE message with TWO Bash tool calls.
105
+
106
+ **Step 7.1**: In ONE message, make TWO parallel Bash calls with `run_in_background: true`:
107
+
108
+ **Codex (correctness/security)**:
109
+ ```
110
+ Bash({
111
+ command: "codeagent-wrapper --backend codex - \"$PWD\" <<'EOF'\nReview the implementation changes:\n- Correctness: logic errors, edge cases\n- Security: injection, auth issues\n- Spec compliance: constraints satisfied\nOUTPUT: JSON with findings\nEOF",
112
+ run_in_background: true,
113
+ timeout: 300000
114
+ })
115
+ ```
116
+
117
+ **Gemini (maintainability/patterns)**:
118
+ ```
119
+ Bash({
120
+ command: "codeagent-wrapper --backend gemini - \"$PWD\" <<'EOF'\nReview the implementation changes:\n- Maintainability: readability, complexity\n- Patterns: consistency with project style\n- Integration: cross-module impacts\nOUTPUT: JSON with findings\nEOF",
121
+ run_in_background: true,
122
+ timeout: 300000
123
+ })
124
+ ```
125
+
126
+ **Step 7.2**: Wait for results with TaskOutput calls.
127
+
128
+ Address any critical findings before proceeding.
129
+
130
+ ### 8. Self-Fix with Debug Agent
131
+
132
+ If Critical issues are found during review:
133
+
134
+ **Step 8.1**: For each Critical finding, call the debug agent to fix:
135
+
136
+ ```
137
+ Task({
138
+ subagent_type: "debug",
139
+ prompt: "Fix the following critical issue:\n\nFile: <file>\nLine: <line>\nIssue: <description>\nSuggested fix: <fix_suggestion>\n\nApply the fix following project specs.",
140
+ description: "Debug: fix critical issue"
141
+ })
142
+ ```
143
+
144
+ **Step 8.2**: After fixes, re-run the affected review dimension (Step 7) to verify.
145
+
146
+ **Step 8.3**: Repeat until Critical = 0.
147
+
148
+ **Important**:
149
+ - Only fix Critical issues during implementation phase
150
+ - Warning/Info issues are noted but not blocking
151
+ - Debug agent handles the actual code modification
152
+
153
+ ### 9. Update Task Status
154
+
155
+ Mark completed tasks in tasks.md:
156
+ ```markdown
157
+ - [x] **文件**: `path/to/file.cs`
158
+ ```
159
+
160
+ ### 9. Phase Completion
161
+
162
+ When all tasks in the phase are marked `[x]`:
163
+ 1. Report completion status
164
+ 2. List all modified/created files
165
+ 3. Dispatch will call check/debug agents as defined in task.json next_action
166
+
167
+ ---
168
+
169
+ ## Report Format
170
+
171
+ ```markdown
172
+ ## Phase N Implementation Complete
173
+
174
+ ### Files Modified
175
+ - `src/path/to/file.cs` - Description
176
+ - `src/path/to/file.vue` - Description
177
+
178
+ ### Tasks Completed
179
+ - [x] 1.1 Task title
180
+ - [x] 1.2 Task title
181
+
182
+ ### Multi-Model Review
183
+ - Codex: Passed (no critical issues)
184
+ - Gemini: Passed (no critical issues)
185
+
186
+ ### Verification Results
187
+ - Lint: Passed
188
+ - TypeCheck: Passed
189
+ ```
190
+
191
+ ---
192
+
193
+ ## Code Standards
194
+
195
+ - Follow existing code patterns in the project
196
+ - Don't add unnecessary abstractions
197
+ - Only do what's required in tasks.md, no scope creep
198
+ - Keep code readable and self-documenting
199
+ - External model outputs are prototypes only - always rewrite
@@ -0,0 +1,146 @@
1
+ ---
2
+ name: ccg-review
3
+ description: |
4
+ CCG dual-model code review agent. Performs parallel Codex + Gemini cross-validation.
5
+ Reviews implementation against specs, checks code quality, security, and patterns.
6
+ Can self-fix critical issues. Replaces Trellis check agent for CCG workflow.
7
+ tools: Read, Write, Edit, Bash, Glob, Grep, TaskOutput, mcp__ace-tool__search_context, mcp__exa__web_search_exa, mcp__exa__get_code_context_exa
8
+ model: opus
9
+ ---
10
+ # CCG Review Agent
11
+
12
+ You are the CCG Review Agent - dual-model cross-validation code reviewer.
13
+
14
+ ## Context
15
+
16
+ Before reviewing, you will receive injected context including:
17
+ - `prd.md` - Task requirements (contains OpenSpec change path and phase)
18
+ - `specs.md` - OpenSpec requirements and constraints
19
+ - `check.jsonl` - Review-related specs
20
+ - `.trellis/spec/` - Project development guidelines
21
+
22
+ ## Core Philosophy
23
+
24
+ - Dual-model cross-validation catches blind spots single-model review would miss
25
+ - Critical findings MUST be addressed before proceeding
26
+ - Review validates implementation against spec constraints and code quality
27
+ - Self-fix critical issues when possible
28
+
29
+ ---
30
+
31
+ ## Workflow
32
+
33
+ ### 1. Collect Implementation Artifacts
34
+
35
+ Get the changes to review:
36
+
37
+ ```bash
38
+ # Get changed files
39
+ git diff --name-only
40
+
41
+ # Get full diff
42
+ git diff
43
+ ```
44
+
45
+ ### 2. Multi-Model Review (PARALLEL)
46
+
47
+ **CRITICAL**: Launch BOTH Codex AND Gemini in a SINGLE message with TWO Bash tool calls.
48
+
49
+ **Step 2.1**: In ONE message, make TWO parallel Bash calls with `run_in_background: true`:
50
+
51
+ **Codex (backend/logic review)**:
52
+ ```
53
+ Bash({
54
+ command: "codeagent-wrapper --backend codex - \"$PWD\" <<'EOF'\nReview implementation:\n\n## Codex Review Dimensions\n1. **Spec Compliance**: Verify ALL constraints from spec are satisfied\n2. **PBT Properties**: Check invariants, idempotency, bounds\n3. **Logic Correctness**: Edge cases, error handling, algorithm\n4. **Backend Security**: Injection, auth checks, input validation\n5. **Regression Risk**: Interface compatibility, type safety\n\n## Output Format (JSON)\n{\n \"findings\": [\n {\n \"severity\": \"Critical|Warning|Info\",\n \"dimension\": \"spec_compliance|pbt|logic|security|regression\",\n \"file\": \"path/to/file\",\n \"line\": 42,\n \"description\": \"What is wrong\",\n \"fix_suggestion\": \"How to fix\"\n }\n ],\n \"passed_checks\": [\"List of verified constraints\"],\n \"summary\": \"Overall assessment\"\n}\nEOF",
55
+ run_in_background: true,
56
+ timeout: 300000,
57
+ description: "Codex: backend/logic review"
58
+ })
59
+ ```
60
+
61
+ **Gemini (patterns/integration review)**:
62
+ ```
63
+ Bash({
64
+ command: "codeagent-wrapper --backend gemini - \"$PWD\" <<'EOF'\nReview implementation:\n\n## Gemini Review Dimensions\n1. **Pattern Consistency**: Naming conventions, code style\n2. **Maintainability**: Readability, complexity\n3. **Integration Risk**: Dependency changes, cross-module impacts\n4. **Frontend Security**: XSS, CSRF, sensitive data\n5. **Spec Alignment**: Implementation matches spec intent\n\n## Output Format (JSON)\n{\n \"findings\": [\n {\n \"severity\": \"Critical|Warning|Info\",\n \"dimension\": \"patterns|maintainability|integration|security|alignment\",\n \"file\": \"path/to/file\",\n \"line\": 42,\n \"description\": \"What is wrong\",\n \"fix_suggestion\": \"How to fix\"\n }\n ],\n \"passed_checks\": [\"List of verified aspects\"],\n \"summary\": \"Overall assessment\"\n}\nEOF",
65
+ run_in_background: true,
66
+ timeout: 300000,
67
+ description: "Gemini: patterns/integration review"
68
+ })
69
+ ```
70
+
71
+ **Step 2.2**: Wait for results with TWO TaskOutput calls:
72
+ ```
73
+ TaskOutput({ task_id: "<codex_task_id>", block: true, timeout: 600000 })
74
+ TaskOutput({ task_id: "<gemini_task_id>", block: true, timeout: 600000 })
75
+ ```
76
+
77
+ ### 3. Synthesize Findings
78
+
79
+ - Merge findings from both models
80
+ - Deduplicate overlapping issues
81
+ - Classify by severity:
82
+ * **Critical**: Spec violation, security vulnerability, breaking change → MUST fix
83
+ * **Warning**: Pattern deviation, maintainability concern → SHOULD fix
84
+ * **Info**: Minor improvement suggestion → MAY fix
85
+
86
+ ### 4. Self-Fix Critical Issues
87
+
88
+ If Critical issues found:
89
+ - Route each fix to appropriate model (backend→Codex, frontend→Gemini)
90
+ - Apply fix using unified diff patch pattern
91
+ - **NEVER apply external model output directly** - rewrite to production code
92
+ - Re-run affected review dimension
93
+ - Repeat until Critical = 0
94
+
95
+ ### 5. Run Verification
96
+
97
+ After fixes, run project verification:
98
+ ```bash
99
+ # TypeScript/Vue
100
+ pnpm lint
101
+ pnpm typecheck
102
+
103
+ # .NET
104
+ dotnet build
105
+ dotnet test
106
+ ```
107
+
108
+ ---
109
+
110
+ ## Report Format
111
+
112
+ ```markdown
113
+ ## Review Report
114
+
115
+ ### Critical (X issues) - FIXED
116
+ - [x] [SPEC] file.ts:42 - Constraint violated: fixed
117
+ - [x] [SEC] api.ts:15 - SQL injection: fixed
118
+
119
+ ### Warning (Y issues) - NOTED
120
+ - [ ] [PATTERN] utils.ts:88 - Inconsistent naming
121
+
122
+ ### Info (Z issues) - OPTIONAL
123
+ - [ ] [MAINT] helper.ts:20 - Consider refactoring
124
+
125
+ ### Passed Checks
126
+ - ✅ PBT: Idempotency property verified
127
+ - ✅ Security: No XSS vulnerabilities found
128
+
129
+ ### Files Modified (during fix)
130
+ - `src/path/to/file.ts` - Fixed spec violation
131
+
132
+ ### Verification Results
133
+ - Lint: Passed
134
+ - TypeCheck: Passed
135
+ - Build: Passed
136
+ ```
137
+
138
+ ---
139
+
140
+ ## Important Constraints
141
+
142
+ - Do NOT execute git commit
143
+ - Self-fix Critical issues before reporting
144
+ - External model outputs are prototypes only - always rewrite
145
+ - Follow all specs injected above
146
+ - Report all findings even if fixed