Skip to content

scdenney/open-science-skills / plugin/skills/advisor

advisor

Verified

Consults Fable as an independent, read-only reviewer at an effort the caller matches to the question. The calling session (usually Opus, or Haiku) holds the task and escalates one decision point. Use before committing to an interpretation or a substantial piece of writing or analysis, when stuck or not converging, when changing approach, or as a final check on a finished task. Fallback for when the native advisor tool is unavailable. Not for a session already running Fable.

FileKindSize
SKILL.mdskill md5.9 KB
assets/architecture.svgother3.5 KB
scripts/fable-advisor.shexecutablescript4.2 KB

scripts/fable-advisor.sh

View on GitHub
#!/usr/bin/env bash
# fable-advisor.sh — consult Fable as an independent second reviewer.
#
# Read-only advisory consult, not implementation. Spawns a fresh, isolated
# `claude` session (--permission-mode plan: no edits). The caller chooses
# Fable's effort per consult by the difficulty and stakes of the question
# (high / xhigh / max; see SKILL.md); it is never inherited from the caller.
# This is the fallback for when the native advisor() tool is unavailable;
# unlike that tool, this spawns an ISOLATED session with no automatic
# access to the calling conversation, so the caller must compose a
# self-contained briefing and pass it as --prompt-file. See SKILL.md.
#
# Usage:
#   fable-advisor.sh --prompt-file FILE --out FILE [-C DIR] [--model ID]
#                     [--effort LEVEL] [--timeout SEC]
#   fable-advisor.sh --check
#
#   --prompt-file FILE  the self-contained briefing (task, progress, question)
#   --out FILE          where Fable's advice is written
#   -C DIR              working dir Fable sees (default: $PWD)
#   --model ID          model alias or full name (default: fable)
#   --effort LEVEL      low|medium|high|xhigh|max (default: high, Anthropic's
#                        starting point for Fable; pass xhigh or max for
#                        harder or higher-stakes questions)
#   --timeout SEC        hard kill after SEC seconds (default: 900)
set -euo pipefail

MODEL="fable"
WORKDIR="$PWD"
PROMPT_FILE=""
OUT=""
EFFORT="high"
TIMEOUT_SECONDS=900

usage() {
  printf '%s\n' \
    'Usage: fable-advisor.sh --prompt-file FILE --out FILE [-C DIR] [--model ID] [--effort LEVEL] [--timeout SEC]' \
    '       fable-advisor.sh --check'
}

die() { printf 'fable-advisor: %s\n' "$*" >&2; exit 2; }

if [[ "${1:-}" == "--check" ]]; then
  command -v claude >/dev/null || die 'Claude Code CLI not found'
  claude --version
  printf 'default effort: %s\n' "$EFFORT"
  exit 0
fi

while [[ $# -gt 0 ]]; do
  case "$1" in
    --prompt-file) PROMPT_FILE="${2:-}"; shift 2 ;;
    --out) OUT="${2:-}"; shift 2 ;;
    -C) WORKDIR="${2:-}"; shift 2 ;;
    --model) MODEL="${2:-}"; shift 2 ;;
    --effort) EFFORT="${2:-}"; shift 2 ;;
    --timeout) TIMEOUT_SECONDS="${2:-}"; shift 2 ;;
    -h|--help) usage; exit 0 ;;
    *) die "unknown argument: $1" ;;
  esac
done

command -v claude >/dev/null || die 'Claude Code CLI not found'
[[ -n "$PROMPT_FILE" && -r "$PROMPT_FILE" ]] || die 'readable --prompt-file is required (the self-contained briefing)'
[[ -n "$OUT" ]] || die '--out is required'
[[ -d "$WORKDIR" ]] || die "working directory not found: $WORKDIR"
[[ "$TIMEOUT_SECONDS" =~ ^[1-9][0-9]*$ ]] || die '--timeout must be a positive integer'
case "$EFFORT" in low|medium|high|xhigh|max) ;; *) die "bad --effort: $EFFORT (low|medium|high|xhigh|max)" ;; esac
case "$PROMPT_FILE" in /*) ;; *) PROMPT_FILE="$PWD/$PROMPT_FILE" ;; esac
case "$OUT" in /*) ;; *) OUT="$PWD/$OUT" ;; esac
WORKDIR="$(cd "$WORKDIR" && pwd -P)"
mkdir -p "$(dirname "$OUT")"

# ANTHROPIC_API_KEY= : force subscription billing for the spawned session even
# if the caller's shell happens to export a live API key (it would otherwise
# be inherited and silently switch this consult to API billing).
cmd=(env ANTHROPIC_API_KEY= claude --safe-mode -p --model "$MODEL" --effort "$EFFORT" --permission-mode plan --output-format text --no-session-persistence \
  'You are consulted as an independent, stronger second reviewer for one specific decision point — not a co-implementer. Read the self-contained briefing supplied on stdin (the task, what has been done so far, the current approach or findings, and the specific question). You have no access to the original conversation beyond this briefing, so if it seems to be missing something you need, say what is missing rather than guessing. Give direct, decisive advice on the specific question asked. If you disagree with the stated approach, say so plainly and explain the specific failure mode, do not hedge into a survey of options. Do not edit any files — you are read-only advisory only. Return only your advice, no preamble.')

if command -v timeout >/dev/null; then
  (cd "$WORKDIR" && timeout "${TIMEOUT_SECONDS}s" "${cmd[@]}" < "$PROMPT_FILE" > "$OUT")
else
  (cd "$WORKDIR" && "${cmd[@]}" < "$PROMPT_FILE" > "$OUT")
fi

[[ -s "$OUT" ]] || die 'Fable returned no output'
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall