cmux-second-opinion
Skill3 starsChanged 10 days agoMITView on GitHub
Get a second opinion on code or specifications from a different AI agent via cmux. Default reviewer: Codex (or Claude Code if parent is Codex). Supports custom agents. Uses review_rules.md as review criteria when available.
In this repository24 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-delegateSkill
- cmux-delegateSkill
- cmux-forkSkill
- handoverSkill
- harness-initSkill
- harness-loopSkill
- harness-planSkill
- ja-humanizerSkill
- magiSkill
- mcp-convertSkill
- skill-suggestSkill
- spec-codeSkill
- spec-evaluateSkill
- spec-generatorSkill
- spec-implementSkill
- spec-inspectSkill
- spec-orchestrateSkill
- spec-reviewSkill
- spec-rules-initSkill
- spec-testSkill
- spec-to-issueSkill
- spec-workflow-initSkill
- spec-writingSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 44
If empty or unset → stop with error:
- Distinctive: line 75
If not found → automatically fall back to "No criteria" mode.
- Distinctive: line 107
If diff is empty → error: "No changes to review." / "レビュー対象の変更がありません。"
- Very specific: line 165
Create surface: cmux new-split right → extract surface handle from output (OK surface:{N} workspace:{N})
- Distinctive: line 182
If no spec files found → error: "Spec files not found." / "仕様書が見つかりません。"
- Very specific: line 184
If {feature} is not specified, scan .specs/ and ask user to select.
- Distinctive: line 230
Important: Do NOT pass inspection-report.md to the reviewer.
- Distinctive: line 238
After collecting the reviewer's output, structure it in the same language as user input:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
cmux-second-opinion — Second Opinion from Another AI
Get an independent code or spec review from a different AI agent in a separate cmux workspace.
Language Rules
- Auto-detect input language → output in the same language
- Japanese input → Japanese output, use
references/second-opinion-guide.ja.md - English input → English output, use
references/second-opinion-guide.md - Explicit override takes priority
Prerequisites
BEFORE requesting a second opinion, verify cmux environment:
echo $CMUX_SOCKET_PATH- If empty or unset → stop with error:
- EN: "Error: Not running inside a cmux session. Please start Claude Code from within cmux."
- JA: "エラー: cmux セッション内で実行されていません。cmux 内で Claude Code を起動してください。"
- If set → proceed
Review Type Detection
Determine the review type from user input:
| User Input Pattern | Type |
| "review this diff", "code review", "この変更をレビュー", "diff を見て" | code |
| "review specs", "spec review", "仕様書をレビュー", ".specs/ を見て" | spec |
| (ambiguous) | Ask user to clarify |
Review Criteria Mode
Determine how to use review_rules.md:
| Mode | review_rules.md | Additional Instruction | Trigger |
| Default | Pass to reviewer | "Also share any issues you notice beyond these rules" | (no mode specified) |
| No criteria | Do not pass | "Review freely from your own perspective" | "freely", "自由にレビュー", "ルールなしで" |
| Criteria only | Pass to reviewer | (none — strictly follow rules) | "strictly", "ルールに従って", "基準のみ" |
Detect review_rules.md:
find . -name "review_rules.md" -maxdepth 3 2>/dev/nullIf not found → automatically fall back to "No criteria" mode.
Agent Selection
Select a reviewer that differs from the parent agent to ensure a different perspective.
| Parent Agent | Default Reviewer | Auto-Approve Command |
| Claude Code | Codex | codex --dangerously-bypass-approvals-and-sandbox |
| Codex | Claude Code | claude --dangerously-skip-permissions |
| (unknown) | Ask user | — |
User can override: "have Claude review this", "Gemini にレビューさせて", etc.
Verify reviewer is available:
which codex # or whichever agent was selectedCode Review Flow
Step 1: Get Diff
# Staged + unstaged changes vs HEAD
git diff HEAD
# Or vs base branch (if on a feature branch)
git diff main...HEADIf diff is empty → error: "No changes to review." / "レビュー対象の変更がありません。"
Step 2: Build Review Prompt
Construct the prompt in the same language as the user's input (auto-detected via Language Rules). The reviewer should receive instructions and produce output in that language.
Default mode (English):
Review the following code changes.
## Review Criteria
{content of review_rules.md}
In addition to the above criteria, share any issues you notice from your own perspective.
## Diff
{diff content}
## Output Format
### Critical (must fix)
### Improvements
### Good pointsDefault mode (日本語):
以下のコード変更をレビューしてください。
## レビュー基準
{review_rules.md の内容}
上記の基準に加えて、独自の視点で気づいた点があれば指摘してください。
## 変更差分
{diff の内容}
## 出力形式
### 重大(修正必須)
### 改善提案
### 良い点No criteria mode (EN):
Review the following code changes from your own perspective.
Focus on code quality, security, performance, and best practices.
## Diff
{diff content}
## Output Format
### Critical (must fix) / ### Improvements / ### Good pointsNo criteria mode (JA):
以下のコード変更を自由な視点でレビューしてください。
コード品質、セキュリティ、パフォーマンス、ベストプラクティスの観点でお願いします。
## 変更差分
{diff の内容}
## 出力形式
### 重大(修正必須) / ### 改善提案 / ### 良い点Criteria only mode: Same as default but without the "also share" / "独自の視点" instruction.
Step 3: Launch Reviewer, Send Prompt, Collect Results
- Create surface:
cmux new-split right→ extract surface handle from output (OK surface:{N} workspace:{N})- Do NOT use
cmux new-workspace— it may create a non-terminal surface that cannot receive commands. Usecmux new-split right(ordown) instead.
- Do NOT use
- Launch reviewer:
cmux send --surface surface:{N} "{reviewer_command}\n" - Detect prompt: poll with
cmux read-screen(3s intervals, 15s timeout) - Send review prompt:
cmux send+cmux send-key return - Monitor completion: graduated polling (5s → 10s → 30s)
- Collect results:
cmux read-screen --surface surface:{N} --scrollback - Do NOT auto-close the reviewer pane. The user may want to review the output in the pane, scroll through history, or ask follow-up questions to the reviewer directly.
Spec Review Flow
Step 1: Locate Spec Files
ls .specs/{feature}/requirement.md .specs/{feature}/design.md .specs/{feature}/tasks.md 2>/dev/nullIf no spec files found → error: "Spec files not found." / "仕様書が見つかりません。"
If {feature} is not specified, scan .specs/ and ask user to select.
Step 2: Build Review Prompt
Construct in the same language as user input (per Language Rules).
English:
Review the following specification documents.
{if default or criteria-only mode}
## Review Criteria
{content of review_rules.md} (apply relevant review perspectives only)
{end}
## Specifications
### requirement.md / ### design.md / ### tasks.md
{contents}
## Review Perspectives
- Missing or contradictory requirements?
- Design consistent with requirements?
- Task breakdown appropriate?
- Technically infeasible aspects?
- Security concerns?
## Output Format
### Critical Issues / ### Improvements / ### Good Points日本語:
以下の仕様書をレビューしてください。
{if デフォルト or 基準のみモード}
## レビュー基準
{review_rules.md の内容}(該当する観点のみ適用)
{end}
## 仕様書
### requirement.md / ### design.md / ### tasks.md
{内容}
## レビュー観点
- 要件の漏れ・矛盾はないか
- 設計と要件の整合性はあるか
- タスク分解は適切か
- 技術的に実現困難な点はないか
- セキュリティ上の懸念はないか
## 出力形式
### 重大な問題 / ### 改善提案 / ### 良い点Important: Do NOT pass inspection-report.md to the reviewer. The value of a second opinion is an independent perspective.
Step 3: Launch, Send, Collect
Same as Code Review Flow Step 3 (use cmux new-split right, not new-workspace).
Result Report
After collecting the reviewer's output, structure it in the same language as user input:
English:
## Second Opinion Result
**Reviewer**: {agent_name} | **Type**: {code / spec} | **Criteria Mode**: {mode}
### Summary
- Critical: {n} / Improvements: {n} / Good points: {n}
### Critical (Must Fix) / ### Improvements / ### Good Points日本語:
## セカンドオピニオン結果
**レビュアー**: {agent_name} | **種別**: {code / spec} | **基準モード**: {mode}
### サマリー
- 重大: {n} 件 / 改善提案: {n} 件 / 良い点: {n} 件
### 重大(修正必須) / ### 改善提案 / ### 良い点Report to the user in the parent session.
Error Handling
| Situation | Response |
CMUX_SOCKET_PATH not set | Error: not in cmux session |
| Reviewer agent not installed | Error + suggest alternative agent |
| Diff is empty | Error: no changes to review |
| Spec files not found | Error: spec directory not found |
| Reviewer fails to start | Report error; suggest checking the pane |
| Reviewer crashes during review | Collect partial output; report what was captured |
| review_rules.md not found | Fall back to "no criteria" mode (not an error) |
Notes
- This skill provides the mechanism for second opinions. Review quality depends on the reviewer agent's capabilities.
- For general task delegation (not review-specific), use
cmux-delegate. - For conversation forking, use
cmux-fork. - For detailed usage examples and troubleshooting, see the reference guide.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

