/ai-universe:ai-universe-second-opinion-workflowfrom ai-universe
Provides a complete workflow for running the AI Universe /secondo command, including authentication, endpoint configuration, and multi-model analysis with Cerebras, Gemini, Perplexity, and GPT-4o.
Ships in ai-universe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Quick start: Use /secondo or the HTTPie helper script to gather multi-model analysis (Cerebras, Gemini, Perplexity, GPT-4o + synthesis).
/secondo runs or HTTPie 401/5xx errors.Before any authentication command, use the host's already loaded nvm setup to resolve its installed Node 22. If nvm or Node 22 is unavailable, report that prerequisite; do not use a different major version or change persistent defaults.
AUTH_NODE="$(nvm which 22)" || exit 1
[ -x "$AUTH_NODE" ] || exit 1
case "$("$AUTH_NODE" --version)" in v22.*) ;; *) exit 1 ;; esac
Use this same verified AUTH_NODE executable for every command below.
test -f ${CLAUDE_HOME:-$HOME/.claude}/scripts/auth-cli.mjs && echo "✅ Installed" || echo "❌ Not found - run /localexportcommands"
"$AUTH_NODE" ${CLAUDE_HOME:-$HOME/.claude}/scripts/auth-cli.mjs status
../ai-universe-auth/SKILL.md for current authentication state and
refresh handling. If the existing token is expired, call the existing
auth-cli.mjs token command to refresh from the authorized credential store
without printing the token. Retry the requested non-UI MCP call once after a
successful refresh. Do not start a browser login from a 401 or stale token
status. If refresh fails, use the canonical credential owner's Keychain
presence probe (without displaying a value) and a cheap non-UI authenticated
call. Only after both fail may you report the physical authentication
dependency; do not ask for login from status output alone.http (HTTPie), jq, and python3 are installed..mcp.json or ~/.claude.json under mcpServers["ai-universe"].url if unset, then validate):
AI_UNIVERSE_MCP_URL="${AI_UNIVERSE_MCP_URL:-$(jq -r '.mcpServers["ai-universe"].url // empty' .mcp.json ~/.claude.json 2>/dev/null | grep -v '^$' | head -n 1)}"
export AI_UNIVERSE_MCP_URL="${AI_UNIVERSE_MCP_URL:?Set AI_UNIVERSE_MCP_URL to the AI Universe MCP endpoint, e.g. https://<ai-universe-host>/mcp}"
ℹ️ Seamless Auto-Refresh: The
/secondocommand uses the exact same auth-cli.mjs from AI Universe repo. If your token is valid, it does nothing. If expired, it auto-refreshes using your refresh token (silent, no browser popup). Only prompts for login if refresh token expires (30+ days).
ℹ️ Token Location: All tokens stored in
~/.ai-universe/auth-token.json(same as AI Universe repo)
- ID token: 1-hour expiration
- Refresh token: enables 30+ day sessions
ℹ️ For a dedicated authentication walkthrough see ai-universe-auth.md. Dependency notes live in secondo-dependencies.md.
| Scenario | Command |
|---|---|
| Quick question (when SlashCommand is working) | /secondo "Should I use Redis or in-memory caching?" |
| Build MCP request with PR context | python3 skills/second_opinion_workflow/scripts/build_second_opinion_request.py "$REQUEST_FILE" "QUESTION" 3 origin/main |
| Call MCP via HTTPie | http POST "$AI_UNIVERSE_MCP_URL" "Authorization:Bearer $TOKEN" < "$REQUEST_FILE" --timeout=180 --print=b |
| Parse embedded JSON response | jq -r '.result.content[0].text' "$RESPONSE_FILE" > "$PARSED_FILE" |
| Summarize models/costs | python3 skills/second_opinion_workflow/scripts/parse_second_opinion.py "$PARSED_FILE" |
| End-to-end helper | skills/second_opinion_workflow/scripts/request_second_opinion.sh "QUESTION" [MAX_OPINIONS] |
RUN_DIR="$(mktemp -d /tmp/second-opinion.XXXXXX)"
REQUEST_FILE="$RUN_DIR/mcp_request.json"
RESPONSE_FILE="$RUN_DIR/mcp_response.json"
PARSED_FILE="$RUN_DIR/mcp_parsed.json"
python3 skills/second_opinion_workflow/scripts/build_second_opinion_request.py \
"$REQUEST_FILE" \
"YOUR QUESTION HERE" \
3 \
origin/main
Adjust SECOND_OPINION_MAX_FILES, SECOND_OPINION_MAX_DIFF_CHARS, or SECOND_OPINION_MAX_PATCH_CHARS if you need more/less context."$REQUEST_FILE" to refine the natural-language question while keeping the attached git context intact.# Get token (auto-refreshes if expired, does nothing if valid)
TOKEN=$("$AUTH_NODE" ${CLAUDE_HOME:-$HOME/.claude}/scripts/auth-cli.mjs token)
AI_UNIVERSE_MCP_URL="${AI_UNIVERSE_MCP_URL:-$(jq -r '.mcpServers["ai-universe"].url // empty' .mcp.json ~/.claude.json 2>/dev/null | grep -v '^$' | head -n 1)}"
export AI_UNIVERSE_MCP_URL="${AI_UNIVERSE_MCP_URL:?Set AI_UNIVERSE_MCP_URL to the AI Universe MCP endpoint}"
http POST "$AI_UNIVERSE_MCP_URL" \
"Accept:application/json, text/event-stream" \
"Authorization:Bearer $TOKEN" \
< "$REQUEST_FILE" \
--timeout=180 \
--print=b > "$RESPONSE_FILE"
skills/second_opinion_workflow/scripts/. Run this workflow from that repository's
root so the relative path resolves:
jq -r '.result.content[0].text' "$RESPONSE_FILE" > "$PARSED_FILE"
python3 skills/second_opinion_workflow/scripts/parse_second_opinion.py "$PARSED_FILE"
📌 Need more HTTPie patterns? Use ai-universe-httpie.md as a companion reference.
Use /secondo "QUESTION" for quick prompts only when the command file is healthy. If it fails or hangs, switch to the HTTPie workflow.
Run the bundled script from repo root for a streamlined flow:
skills/second_opinion_workflow/scripts/request_second_opinion.sh "How should I harden our auth endpoints?" 4
The script:
MAX_OPINIONS is a positive integer.build_second_opinion_request.py to embed branch/base metadata, diffstat, recent commits, and per-file patches into the payload./tmp; set KEEP_TEMP_FILES=1 when running the script to keep them after completion.For advanced prompting templates and interactive options, see the existing ${CLAUDE_HOME:-$HOME/.claude}/scripts/secondo-cli.sh utility.
"What is 2+2?" request first to warm the backend..result.content[0].text before loading JSON. Use the helper Python snippet or script for safe parsing./secondo or HTTPie path was used.skills/second_opinion_workflow/scripts/ for helper tooling.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub jleechanorg/jleechan-skills --plugin ai-universe