Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

121 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Second Opinion

CI

Second Opinion turns installed AI coding agents into steerable, parallel worker teams for each other. It handles implementation, testing, investigation, review, documentation, and integration work—not just code review.

Background tasks open a separate, lightweight native task-manager window by default. It shows every active Second Opinion task—even tasks another coding agent started—and lets you steer the work, send follow-up messages, choose the model for the next turn, stop or retry a run, and archive finished tasks. The manager is built with Python's native Tk toolkit rather than Electron, a browser, or an always-on server, so it starts quickly and keeps memory use small on macOS, Windows, and Linux.

Second Opinion task manager showing two Grok 4.5 workers spawned by Claude Code

Claude Code orchestrating two Grok 4.5 review workers in the native task manager. Each worker has an independent role and native Grok Build context, with model and effort controls, live output, follow-up messaging, retry, stop, and archive actions in one place.

For example, Claude Code can orchestrate five fresh Codex workers using GPT-5.6 Luna at xhigh: one implements, one writes tests, two inspect different risks, and one handles integration. Luna can make that pool much cheaper while parallel work improves throughput. The direction is completely reversible: Codex can orchestrate Claude Sonnet 5 workers, Grok 4.5 workers through Grok Build, or any supported model the selected harness can access. Each worker keeps its native CLI's auth, model access, tools, and safety behavior.

Second Opinion is model agnostic. It routes between installed agent surfaces and the user's existing model/provider setup instead of hardcoding one model. The generated skills teach each parent agent to reason about when another chat is useful, which agent's strongest capabilities fit the scenario, and when a same-agent fresh-context pass is the only sensible option.

For Claude Code, Second Opinion uses the documented non-interactive claude -p mode. Model aliases or full model names still pass through to Claude Code with --model.

Install

Interactive CLI installer:

curl -fsSL https://second-opinion.ssh.codes/install.sh | bash

Install every detected agent skill without prompts:

curl -fsSL https://second-opinion.ssh.codes/install.sh | bash -s -- --yes

Install all supported skill files:

curl -fsSL https://second-opinion.ssh.codes/install.sh | bash -s -- --all --yes

Install a specific agent integration:

curl -fsSL https://second-opinion.ssh.codes/install.sh | bash -s -- --agent codex --yes
curl -fsSL https://second-opinion.ssh.codes/install.sh | bash -s -- --agent claude --yes
curl -fsSL https://second-opinion.ssh.codes/install.sh | bash -s -- --agent opencode --yes
curl -fsSL https://second-opinion.ssh.codes/install.sh | bash -s -- --agent grok --yes
curl -fsSL https://second-opinion.ssh.codes/install.sh | bash -s -- --agent antigravity --yes

Install on another machine over SSH:

ssh dev@server 'curl -fsSL https://second-opinion.ssh.codes/install.sh | bash -s -- --all --yes'

Update an existing install when a newer version is published:

second-opinion update

second-opinion update downloads the latest CLI from https://second-opinion.ssh.codes, replaces the local binary only when the published version is newer, and refreshes existing Second Opinion-managed skill files. Use second-opinion update --all-skills to refresh every supported skill file or second-opinion update --force to reinstall the published version anyway.

What Gets Installed

The installer adds the second-opinion CLI to ~/.local/bin and writes only Second Opinion-owned skill files:

Agent File written
Codex ~/.agents/skills/second-opinion/SKILL.md
Claude Code ~/.claude/skills/second-opinion/SKILL.md
OpenCode ~/.config/opencode/skills/second-opinion/SKILL.md
Grok Build ~/.grok/skills/second-opinion/SKILL.md
Google Antigravity ~/.gemini/antigravity/skills/second-opinion/SKILL.md

Second Opinion does not edit model settings, provider credentials, hooks, MCP servers, permissions, or app config. If one of those skill files already exists and was not generated by Second Opinion, the installer skips it unless you pass --force.

Use

From any shell:

second-opinion status
second-opinion ask auto --from codex --cwd "$PWD" --mode consult --background -- "Review this change and call out risks."
second-opinion ask claude --from opencode --cwd "$PWD" --mode consult --background -- "Find edge cases in the parser."
second-opinion ask claude --from codex --cwd "$PWD" --model fable --mode consult --background -- "Review this design using Claude Code's selected model."
second-opinion ask grok --from claude --cwd "$PWD" --background -- "Implement only the README command table."
second-opinion jobs
second-opinion wait JOB_ID

The installed skills teach each agent to start subagents in the background by default. That lets the parent agent continue its own non-overlapping work while the subagent runs. Later, the parent runs second-opinion wait JOB_ID to collect the subagent output.

Native Image Creation

Second Opinion can ask a coding harness to use an image-generation tool it already exposes. The manager model first discovers eligible harnesses, then requests a real raster artifact with a strict output contract:

second-opinion image-tools --available --json

second-opinion image auto \
  --from claude \
  --cwd "$PWD" \
  --reference screenshots/current-home.png \
  --output design/homepage-concept.png \
  --background \
  --manager none \
  -- "Overhaul this homepage into a deliberate, distinctive product design."

Codex's built-in imagegen / image_gen capability is detected automatically. image-tools --json reports provider-native generator choices (provider-default when the harness does not expose a model list). --reference is repeatable; Codex and OpenCode receive references through their native image/file flags, while other harnesses receive readable local paths and additional-directory access where supported. An explicit target can also try a provider tool that cannot be detected statically. Declare such an existing tool for auto routing with SECOND_OPINION_IMAGE_TOOLS=claude=CreateImage,opencode=imagegen; optionally advertise selectable generators with SECOND_OPINION_IMAGE_MODELS='claude=canvas-v2|canvas-fast'.

Second Opinion does not generate the pixels itself, install an image tool, request credentials, or handle image API keys. The selected coding harness uses its existing authentication, native tools, model access, and safety policy. The command fails when the requested artifact is missing, empty, unchanged, or not a valid PNG, JPEG, WebP, or GIF, so an orchestrator cannot accidentally hand a text-only “design” to its implementation worker.

This enables the exact design handoff suggested in the feedback: generate a visual direction first, inspect it, then give the artifact and original constraints to a design-strong worker such as Claude Opus:

second-opinion wait IMAGE_JOB_ID
second-opinion ask claude --from codex --model opus --reasoning high --cwd "$PWD" --background -- \
  "Implement the approved design in design/homepage-concept.png. Preserve accessibility and responsive behavior."

Use --model to select the coding model supervising the image task. Use --image-model only when the native image tool already exposes a particular generator. Generated files must stay inside --cwd, existing artifacts require --force, and normal ask/team usage remains unchanged.

Parallel Worker Teams

second-opinion team starts one independent native harness process and fresh context per worker. The parent remains the orchestrator and can continue working, steer each task, change its next-turn model/effort, and synthesize the results.

Claude Code orchestrating five lower-cost Codex workers:

second-opinion team codex \
  --from claude \
  --count 5 \
  --strategy balanced \
  --model gpt-5.6-luna \
  --reasoning xhigh \
  --cwd "$PWD" \
  -- "Implement the feature, add tests, inspect risks, and prepare integration in parallel."

Codex orchestrating Claude or Grok workers works the same way:

second-opinion team claude --from codex --count 5 --strategy build --model claude-sonnet-5 --reasoning xhigh -- "Build these non-overlapping slices."
second-opinion team grok --from codex --count 5 --strategy review --model grok-4.5 --reasoning high --manager terminal -- "Review from five distinct angles."

The built-in strategies are:

  • build: core implementation, tests, edge-case hardening, performance/tooling, and integration/docs.
  • review: correctness, security, tests, performance, and product/integration review; workers default to consult mode.
  • balanced: a mix of implementation, tests, independent review, security/performance review, and integration/docs.

Repeat --role "..." to provide custom worker assignments. Use --mode work or --mode consult to force every worker into the same mode. The CLI accepts 1–32 workers, records the team/role/index on every task, opens only one manager, and returns immediately while all workers run in parallel. second-opinion wait TEAM_ID collects the whole team; second-opinion jobs --team TEAM_ID lists just that pool.

Model and effort values pass through the specialized harness: Codex uses codex exec and its reasoning config, Claude Code uses claude -p --effort, OpenCode uses opencode run --variant, Grok Build uses grok -p --reasoning-effort, and Antigravity uses agy --effort. Availability and accepted effort levels remain controlled by each installed provider CLI.

Parallel editing needs deliberate decomposition. Built-in roles include collision-avoidance instructions, but custom non-overlapping file or subsystem assignments are safest. Workers are told to re-read files before edits and never discard concurrent changes.

Keyless Model and Harness Benchmarks

The manager model can query current public Artificial Analysis data before choosing workers. This works without an Artificial Analysis API key, account, sign-in, dependency, or configuration:

second-opinion benchmarks --kind models --sort coding --max-cost 0.50 --limit 12
second-opinion benchmarks --kind models --sort agentic --min-intelligence 45 --json
second-opinion benchmarks --kind agents --sort agent-score --max-cost 3 --json
second-opinion benchmarks --kind all --limit 10 --json

Model results expose the Artificial Analysis Intelligence, Coding, and Agentic indices; average Intelligence Index cost and time per task; model token prices; and speed when published. --kind agents exposes the harness-specific Artificial Analysis Coding Agent Index plus average coding-task cost, time, steps, and tokens. This matters because a model's score and a particular model+harness combination are different decisions.

Public results are cached under ~/.second-opinion/cache/ for six hours to keep startup fast and network use small. Use --refresh to fetch immediately or --offline after the first fetch. Human and JSON output both preserve visible Artificial Analysis attribution and source URLs. Benchmark scores are routing evidence, not guarantees; the orchestrator should also consider task fit, installed CLIs, available subscriptions, and the exact model ids each harness accepts.

The native manager opens by default for a background task. Choose a separate terminal manager or no window at all per run:

second-opinion ask codex --background --manager app -- "Review the API changes."
second-opinion ask claude --background --manager terminal -- "Polish the responsive UI."
second-opinion ask grok --background --manager none -- "Explore two implementation options."
second-opinion ask opencode --background --no-window -- "Run a quick model-flexible review."

Set SECOND_OPINION_MANAGER=app|terminal|none to change the default without modifying any agent application or configuration. If Tk is unavailable on a minimal Linux install, the task still starts and the CLI explains how to use second-opinion tui or install the distribution's python3-tk package.

Use work mode by default. Work mode may edit files and should be assigned carefully so two agents do not edit the same files at the same time. Use explicit --mode consult for read-only review, planning, or risk analysis.

Task Manager

Open either manager at any time:

second-opinion app   # detached native app window
second-opinion tui   # interactive manager in the current terminal

Both surfaces operate only on Second Opinion's records under ~/.second-opinion/jobs/ and provide the same core controls:

  • See active, queued, finished, failed, stopped, and archived tasks.
  • Read live output without loading unbounded logs into memory. The native app renders headings, emphasis, lists, task lists, quotes, tables, code, and safe clickable web links as Markdown.
  • Send a steering message while a task is running; it queues behind the current turn.
  • Change the model and provider-native reasoning effort/variant passed to the task's next invocation. Leave either blank to use the provider default.
  • Stop, retry, archive, or restore tasks.
  • Start a new task with a chosen harness, workspace, mode, and optional model.

The harness is task-specific and stays task-specific: Codex turns run through codex exec, Claude Code through claude -p, OpenCode through opencode run, Grok through grok -p, and Antigravity through agy --print. Follow-up messages invoke that same harness with the prior result context. A model change does not hot-swap a provider process that is already running; it applies to the next turn, or you can stop and retry immediately.

Closing a manager window does not stop an agent task. Normal foreground CLI use loads no GUI modules, starts no manager process, and behaves as before. Second Opinion never embeds into or edits the Codex, Claude Code, Grok, OpenCode, or Antigravity applications.

Goal Mode

Goal mode is opt-in. Do not use it by default, and do not treat it as the normal Second Opinion workflow.

Use --goal only when the user explicitly asks to use Second Opinion with goals, or when the user has clearly requested a long-running delegated goal. For targets with a known native goal command, Second Opinion includes that target's /goal ... command in the subagent prompt:

second-opinion ask claude --from codex --cwd "$PWD" --mode work --background --goal "Finish the frontend accessibility pass and report blockers." -- "Work toward this goal in the assigned UI files only."

When a parent agent starts a goal-backed subagent, the parent still owns the outcome. It should record the job id, check second-opinion jobs, collect the result with second-opinion wait JOB_ID, verify output and edits, and avoid reporting the overall task as finished while the delegated goal is still running or unresolved.

Routing Tips

  • For visual UI, frontend polish, responsive layout, copy tone, and product/design judgment, prefer Claude Code with the latest/highest Claude model available to you, often an Opus-class model when available.
  • For backend work, APIs, data flow, tests, repo-wide edits, debugging, and most general implementation tasks, prefer Codex unless another target has clearly better context or provider access.
  • For quick model-flexible exploration, cheap parallel checks, or trying many configured providers, OpenCode is fast and easy to use; output quality depends heavily on the selected model, so verify smaller or cheaper model results more carefully.
  • Use Antigravity for Google/Gemini, Vertex, Firebase, Cloud Run, or Google-style orchestration.
  • Use Grok Build for broad exploration or implementation spikes when it is installed and speed matters more than precision.

Supported Agents

  • Codex
  • Claude Code
  • OpenCode
  • Grok Build
  • Google Antigravity

The CLI has a central registry for agent commands, skill paths, and task-routing hints. To add another agent, update the registry in bin/second-opinion, add tests, and run second-opinion install --agent <new-agent> to regenerate its skill.

Commands

second-opinion install              # interactive when attached to a terminal
second-opinion install --yes         # install detected agent skills
second-opinion install --all --yes   # install all supported skills
second-opinion update                # update the CLI and managed skills when newer
second-opinion uninstall --agent codex
second-opinion status --json
second-opinion choose --from claude --task "implement auth flow"
second-opinion ask auto --from claude --cwd "$PWD" --mode consult --background -- "Investigate failing tests."
second-opinion ask codex --from claude --cwd "$PWD" --model gpt-5.6-luna --reasoning xhigh --background -- "Implement the test fixtures."
second-opinion team codex --from claude --count 5 --strategy balanced --model gpt-5.6-luna --reasoning xhigh -- "Build and verify this in parallel."
second-opinion team claude --from codex --count 5 --strategy build --model claude-sonnet-5 --reasoning xhigh --manager none -- "Implement non-overlapping slices."
second-opinion benchmarks --kind models --sort coding --max-cost 0.50 --json
second-opinion benchmarks --kind agents --sort agent-score --json
second-opinion image-tools --available --json
second-opinion image codex --from claude --cwd "$PWD" --reference current.png --output design/concept.png --background -- "Create a stronger visual direction."
second-opinion ask auto --from claude --cwd "$PWD" --mode work --background --goal "Finish the migration tests and report blockers." -- "Work toward this goal in the assigned files only."
second-opinion ask auto --from claude --cwd "$PWD" --background --manager terminal -- "Open the terminal task manager."
second-opinion ask auto --from claude --cwd "$PWD" --background --manager none -- "Do not open a manager window."
second-opinion jobs
second-opinion jobs --all
second-opinion wait JOB_ID
second-opinion app
second-opinion tui
second-opinion commands
second-opinion doctor

Design

Second Opinion is intentionally small:

  • No server is required.
  • No browser or Electron runtime is required; the optional native window uses Tk and caps displayed log data.
  • No API keys are handled by Second Opinion; its benchmark tool reads attributed public pages and needs no Artificial Analysis key.
  • Image creation runs through native tools already available in a selected coding harness; Second Opinion does not install generators or handle image API keys.
  • Each target agent runs through its own installed CLI.
  • Claude Code runs through its documented claude -p non-interactive mode.
  • All agent instructions are regular skill files that users can inspect.
  • The subagent prompt includes anti-recursion and scope-isolation rules.
  • The manager starts only for a Second Opinion background task (unless opened explicitly) and can be disabled with --manager none.

Local Development

python3 -m unittest discover -s tests
SECOND_OPINION_HOME="$(mktemp -d)" bin/second-opinion install --all --yes
SECOND_OPINION_HOME="$(mktemp -d)" bin/second-opinion status --json

To test the installer against a local checkout:

python3 -m http.server 8080
SECOND_OPINION_BASE_URL=http://127.0.0.1:8080 bash install.sh --cli-only

License

MIT


Built by SSH.

About

Let Claude access other AI models via MCP

Resources

Security policy

Stars

42 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages