{
  "markdown": "# Second Agent\n\n**Get a second opinion or delegate an engineering task to any AI engine CLI you have installed — Gemini, Codex, Claude Code, opencode, Copilot, Qwen, Kilo, Antigravity (agy), Command Code (cmd), Cursor, or Kiro CLI (kiro-cli) — from inside your current one.**\n\nNo single model catches everything. Second Agent spawns another engine as a subprocess inside your repo, embeds the diff/file content it needs directly into the prompt (engines don't self-read by default), and either asks it to comment (read-only) or actually do the work (write-capable) — then hands you back a clean, structured result.\n\nInstalls as the `second-agent-skill` plugin, from the [`srwbsw/second-agent-skill`](https://github.com/srwbsw/second-agent-skill) repo.\n\n## What it does\n\nTwo runners, one shared engine layer:\n\n| Runner | Mode | Use it for |\n|---|---|---|\n| `bin/review.js` | read-only | Second opinion / code review — one engine, or several in parallel (\"fusion\") |\n| `bin/agent.js` | write-capable, `--unrestricted` required | Delegate a real task — write tests, fix a bug, refactor — to one engine inside your repo |\n\nBoth share the same engine wiring, secret guard, and result format (`bin/lib/`) — see `bin/AGENTS.md` for internals.\n\n## Install\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/srwbsw/second-agent-skill/main/install.sh | bash\n```\n\nAuto-detects which of the 11 supported engines (below) you have installed, installs the plugin/skill/command adapter into each of the 10 installable harnesses it finds (Claude Code, Codex, Cursor, opencode, Gemini, Qwen, Copilot, Antigravity, Kilo, Command Code) — kiro-cli is engine-only, with no host adapter of its own — and symlinks `review.js`/`agent.js`/`list.js` onto `PATH` so every harness — even ones without a plugin cache — can resolve them. Idempotent; run `install.sh --help` for `--only=`, `--ref=`, and `--uninstall`.\n\nManual install for the two plugin-marketplace harnesses:\n\n```bash\n# Claude Code\nclaude plugin marketplace add srwbsw/second-agent-skill && claude plugin install second-agent-skill@second-agent-skill\n\n# Codex CLI\ncodex plugin marketplace add srwbsw/second-agent-skill && codex plugin add second-agent-skill@second-agent-skill\n```\n\nOther harnesses (Cursor, opencode, Gemini, Qwen, Copilot, agy, Kilo, cmd) install a rule/command/skill file directly — see `install.sh` for the exact command, or run the one-liner above with `--only=<engine>`.\n\n**Migrating from `second-opinion-skill`?** The plugin was renamed to `second-agent-skill` (the env vars `SECOND_OPINION_REVIEW`/`LIST`/`AGENT` are now `SECOND_AGENT_REVIEW`/`LIST`/`TASK`, breaking). Re-running `install.sh` auto-migrates each host — it retires the old-named plugin/extension after the new one installs successfully, no manual uninstall needed. One thing it *can't* fix for you: skill IDs are plugin-namespaced (`second-opinion-skill:second-agent` → `second-agent-skill:second-agent`) — update any hardcoded references in your `settings.json` permission allowlists or personal notes.\n\n## Quickstart\n\n```bash\n# Second opinion: read-only review of your unstaged changes\nreview.js --engine=gemini --cwd=. --diff=unstaged \\\n  \"Review this diff for correctness and regressions.\"\n\n# Task delegation: let Codex actually make the change (write-capable)\nagent.js --engine=codex --cwd=. --unrestricted \\\n  \"Add a CHANGELOG entry summarizing the last commit.\"\n```\n\n(Assumes `install.sh` put `review.js`/`agent.js` on `PATH`; otherwise use the full path to your checkout's `bin/`.)\n\n## Usage essentials\n\n### Engines\n\n| Engine | CLI | Model selection |\n|---|---|---|\n| Gemini CLI | `gemini` | automatic |\n| opencode | `opencode` | optional — provider → model, or default |\n| Codex CLI | `codex` | optional — type-in |\n| Claude Code | `claude` | optional — type-in |\n| GitHub Copilot CLI | `copilot` | optional — type-in |\n| Qwen Code CLI | `qwen` | optional — type-in |\n| Kilo | `kilo` | provider → model (free shown first) |\n| Antigravity | `agy` | optional — `agy models`, or default |\n| Command Code | `cmd` | optional — `cmd --list-models`, or default |\n| Cursor CLI | `agent` (`cursor`/`cursor-agent` aliases) | optional — `agent --list-models`, or default |\n| Kiro CLI | `kiro-cli` (`kiro` alias) | optional — `kiro-cli chat --list-models`, or default |\n\nPick one with `--engine=<name>` or `--engine=<name>:<model>`. `review.js` also supports fusion — repeat `--engine=` for multiple slots run in one pass (parallel by default, `--concurrency=1` for serial); see `skills/second-agent/references/fusion.md`. opencode/Kilo model discovery: `list.js --engine=opencode providers` then `list.js --engine=opencode models --provider=<p>`.\n\n### review vs. task\n\n- **`review.js`** never writes anything — every engine launches in its read-only/plan/sandbox mode.\n- **`agent.js`** has no read-only mode: `--unrestricted` is required, and the engine may edit files and run commands inside `--cwd`. Exactly one engine per invocation (no fusion — run it again for a second engine's take).\n\n### Safety model\n\n- **Read-only by default** — `review.js` always launches engines in their safe/plan/sandbox mode.\n- **`--unrestricted` gate** — required (hard-fails otherwise) on `agent.js`; optional on `review.js`, only for engines that need to run commands to review.\n- **Secret guard** — `.env`-style files are refused/skipped/redacted from anything embedded into the prompt, by both runners, by default; opt out with `--include-secrets`.\n- **Untrusted context** — embedded `--diff`/`--file` content is data, not instructions — but see the security note below before pointing a write-capable engine at someone else's diff.\n\n### Security notes\n\n`--unrestricted` is a deliberate acknowledgment, not a formality: an unrestricted engine can read anything the harness permissions allow — including `.env` files the secret guard never embedded — and can run commands in `--cwd`. Embedded `--diff`/`--file` content is handed straight to that write-capable engine, so treat any third-party or untrusted diff as a prompt-injection vector: only embed content you trust, or omit `--diff`/`--file` and let the engine read the repo itself.\n\n## Reading the result\n\nBoth runners print a final one-line JSON result on stdout — `SECOND_OPINION_RESULT` (`review.js`) or `SECOND_AGENT_RESULT` (`agent.js`) — plus an `ANSWER FILE: <path>` line whenever the engine's answer was cleanly extracted (read that file with the Read tool, not stdout; fall back to the printed `LOG FILE:` path otherwise). `agent.js` additionally prints a `CHANGED FILES:` block from a before/after git snapshot of `--cwd`.\n\n## Development\n\n```bash\npnpm run lint          # runs all 8 test suites (safety, shell-quote, env-guard, spawn, answer, agent, locate, host-parity)\npnpm run lint:js       # eslint bin/ test/\npnpm run format        # prettier --write bin/ test/\npnpm run format:check  # prettier --check bin/ test/\n```\n\nNo build step — never run `pnpm build`. `AGENTS.md` (root, plus `bin/`, `test/`, `skills/`) is the source of truth for internals — engine wiring, exit codes, secret guard, and test/fixture conventions; `CLAUDE.md`/`GEMINI.md`/`QWEN.md` are symlinks to it. Adding a new engine: `skills/second-agent/references/adding-engines.md` is the canonical checklist. Deeper reference docs (prompt templates, fusion mechanics, troubleshooting/anti-patterns) live under `skills/second-agent/references/`.\n\n## License\n\n[MIT](LICENSE)\n",
  "bytes": 7423,
  "sha": "b54f9621f322aba2a96a7c3d96f9bf889edc066c2c331e4fc79f14070ed6efee",
  "repo_slug": "srwbsw/second-agent-skill",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_srwbsw_second_agent_skill_8b0af803/readme"
}