Skip to main content

Opus-led code review-and-fix pipeline for Claude Code (native agent teams, no external API calls).

Project description

advisor

A one-command, Opus-led code review-and-fix pipeline for Claude Code. The advisor (Opus) goes first, does its own Glob+Grep discovery, ranks files P1–P5, decides how many Sonnet runners to spawn, and writes a unique, file-aware prompt for every runner based on what it just learned. Runners and the advisor stay in live two-way conversation throughout — runners ask questions, the advisor answers and verifies each output as it lands. Optional fix wave applies edits the same way.

No external API calls. Runs entirely through Claude Code's native TeamCreate / Agent / SendMessage tools.

Team

Role Model Agent type Job
Advisor Opus deep-reasoning Glob+Grep discovery, P1–P5 ranking, sizes the pool, writes per-runner prompts, dispatches explore + fix waves, verifies each output as it lands
Runner pool Sonnet × N code-review Long-lived workers; each gets a custom prompt from the advisor; reports findings + diffs back to the advisor in live dialogue

Priority scale: P5 auth/secrets · P4 user input/parsing · P3 handlers/DB/exec · P2 config/crypto/logging · P1 utils/tests.

Install (30 seconds)

pipx install advisor-agent
advisor status

That's it. The first run wires up ~/.claude/CLAUDE.md and the /advisor slash command automatically. advisor status confirms what landed where.

Other install methods
# Zero-install one-shot (uv)
uvx advisor-agent pipeline src/

# Plain pip
pip install advisor-agent

# From source
git clone https://github.com/vzwjustin/advisor && cd advisor && pip install -e .

# Local dev with uv tool (reinstall after edits)
uv tool install --reinstall .

Requires Python ≥ 3.10. Package name: advisor-agent. Import: advisor. CLI: advisor.

Manage the nudge / skill manually
advisor status               # health check (alias: advisor doctor)
advisor install              # append / update the nudge + skill (idempotent)
advisor install --check      # dry-run: print status, exit 3 if anything missing
advisor uninstall            # cleanly remove the nudge + skill
advisor install --path /x    # target a different CLAUDE.md

Opt out of auto-install with ADVISOR_NO_NUDGE=1. The CLAUDE.md block is wrapped in <!-- advisor:nudge:start --> / <!-- advisor:nudge:end --> markers so reinstalls update in place.

Usage

Invoke from inside Claude Code:

/advisor                    # review the cwd
/advisor src/               # review a specific dir
/advisor review the auth flow      # add scope context

Or use the standalone CLI to inspect the prompts and plans:

advisor pipeline src/                  # full pipeline reference
advisor plan src/                      # rank local files, print dispatch plan
advisor plan src/ --json               # same, machine-readable for `jq` etc.
advisor plan src/ --sarif out.sarif    # SARIF 2.1.0 output for Code Scanning
advisor audit RUN_ID [TARGET]          # post-hoc diagnostic for a completed run
advisor prompt advisor src/            # the advisor's prompt body
advisor prompt runner src/ --runner-id 1   # a runner's bootstrap prompt
advisor prompt verify src/ < findings  # verify-pass prompt
advisor status                         # health check (alias: doctor)
advisor status --json                  # JSON-formatted health for scripting
advisor install                        # install nudge + /advisor skill
advisor uninstall                      # remove nudge + /advisor skill
advisor history                        # recent findings from .advisor/history.jsonl
advisor baseline create                # snapshot current findings as baseline
advisor baseline diff                  # compare current run vs. baseline
advisor presets                        # list available rule-pack presets
advisor suppressions --list            # list active false-positive suppressions

Every subcommand's target defaults to . (current directory). Piping a long scope description is supported via --context - (reads stdin).

Flags: --team, --file-types, --max-runners (advisory — Opus may exceed for large repos), --min-priority, --context, --advisor-model, --runner-model. Default models: opus / sonnet.

Context-pressure knobs (reduce runner context exhaustion): --max-fixes-per-runner N · --large-file-line-threshold N · --large-file-max-fixes M.

Automation flags: --json on status/plan/install --check, --quiet on install/uninstall, --strict on status/install/uninstall (exit 3 when nothing changed or the install is unhealthy).

Colors are on by default. Opt out with NO_COLOR=1 or TERM=dumb.

Excluding files (.advisorignore)

Drop an .advisorignore file into your project root to skip paths during advisor plan and the live pipeline:

# comments begin with #
tests/            # skip directories (trailing slash)
*.md              # skip by filename glob
vendor/
generated/**/*.py # ** recursive globs are supported

Patterns follow fnmatch semantics for filename matches, and use PurePath.match when ** is present. Bare words match any path component (docs matches both docs/ and foo/docs/bar.py).

Python API

from advisor import (
    default_team_config,
    build_advisor_agent,
    build_advisor_prompt,
    build_runner_pool_agents,
    build_runner_pool_prompt,
    build_runner_dispatch_messages,
    build_runner_handoff_message,
    build_fix_assignment_message,   # stamped fix-count header per assignment
    check_batch_fix_budget,         # pre-flight cap validator
    build_verify_dispatch_prompt,
    build_verify_message,
    rank_files,
    load_advisorignore,
    create_focus_tasks,
    create_focus_batches,
    parse_findings_from_text,
    format_findings_block,
    render_pipeline,
)

config = default_team_config(
    target_dir="src/",
    team_name="review",
    file_types="*.py",
    max_runners=5,
    min_priority=3,
)

print(render_pipeline(config))
advisor_spec = build_advisor_agent(config)
# After Opus produces its dispatch plan, spawn each runner with the
# verbatim per-runner prompt from that plan — not a generic builder.

The builder functions return plain dicts — drop each one into a Claude Code Agent(...) or SendMessage(...) call.

Modules

  • advisor/orchestrate/TeamConfig, advisor + runner prompt builders, dispatch helpers, pipeline renderer (package: config, advisor_prompt, runner_prompts, verify_dispatch, pipeline)
  • advisor/rank.pyrank_files, RankedFile (keyword-signal priority ranking)
  • advisor/focus.pycreate_focus_tasks / create_focus_batches, plan formatters
  • advisor/verify.pyFinding, parse_findings_from_text, verify-pass builders
  • advisor/runner_budget.pyRunnerBudget, scope-anchor parsing, per-runner output-char budget and rotation logic
  • advisor/install.py — idempotent CLAUDE.md nudge + /advisor skill install/uninstall
  • advisor/_style.py — zero-dep ANSI styling (colors on by default)

Orchestration rules

  • TeamCreate before any agent spawn; TeamDelete before creating a new team.
  • Opus goes first — no runners until Opus's first pass produces a pool size.
  • Each runner is spawned with the verbatim per-runner prompt from Opus's dispatch plan. Don't substitute a generic template.
  • Dispatch runners in a single message with run_in_background=true so they come up in parallel.
  • Every agent prompt must end with a SendMessage(...) — agents go idle silently otherwise.
  • Shut down teammates individually by name; broadcast shutdown does not work.

See CLAUDE.md for the full protocol.

Tests

pip install -e ".[dev]"
make check        # ruff + mypy + pytest
pytest --cov=advisor --cov-report=term-missing

GitHub Action

Reusable workflow that runs advisor plan, uploads SARIF 2.1.0 output to GitHub Code Scanning, and (optionally) posts a PR comment. Paste this into .github/workflows/advisor.yml in your repo:

name: Advisor

on:
  pull_request:
  push:
    branches: [main]

jobs:
  advisor:
    uses: vzwjustin/advisor/.github/workflows/advisor.yml@v0.5.0
    with:
      target: "."
      min-priority: 3
      fail-on: "high"        # fail CI on HIGH/CRITICAL findings
      preset: "python-web"   # optional rule-pack tuning
      post-pr-comment: false

Or roll your own: any CI system can run advisor plan --sarif advisor.sarif and upload the file to whatever scanner you use.

Presets

Curated rule-pack bundles tune file-type defaults and priority keywords for common stacks:

Preset Stack Defaults
python-web Flask / Django / FastAPI *.py, P5 auth keywords
python-cli argparse / click CLIs *.py, P3 subprocess keywords
node-api Express / Fastify / Koa *.js,*.ts, P5 JWT/session
typescript-react React + TS *.ts,*.tsx, P4 DOM sinks
go-service net/http services *.go, P3 net/http/sql
rust-crate library / crate *.rs, P3 unsafe/transmute
advisor plan src/ --preset python-web
advisor presets            # list presets
advisor presets --json     # machine-readable

Automation flags

Flag Applies to Effect
--sarif PATH plan, audit Write SARIF 2.1.0 for Code Scanning
--fail-on LEVEL plan, audit Exit 4 if any finding ≥ LEVEL
--format pr-comment plan Emit a PR-body-ready markdown summary
--no-history plan Ignore history for deterministic CI plans
--baseline PATH plan Suppress findings matching a baseline
--json / --output FILE plan / audit Machine-readable output

Exit codes: 0 clean · 4 --fail-on threshold tripped · 3 --strict no-op or unhealthy install · 2 argparse / user error · 1 unexpected.

Findings lifecycle

  • advisor history — recent confirmed findings from .advisor/history.jsonl
  • advisor baseline create — snapshot current findings as an accepted baseline
  • advisor baseline diff — compare current run vs. baseline
  • .advisor/suppressions.jsonl — per-rule, per-file suppressions with expiry dates (run advisor suppressions --list)

Further reading

  • docs/architecture.md — module dependency graph, runtime flow, data contract, design invariants
  • docs/prompts.md — prompt engineering notes for contributors modifying prompt templates

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

advisor_agent-0.5.1.tar.gz (341.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

advisor_agent-0.5.1-py3-none-any.whl (162.7 kB view details)

Uploaded Python 3

File details

Details for the file advisor_agent-0.5.1.tar.gz.

File metadata

  • Download URL: advisor_agent-0.5.1.tar.gz
  • Upload date:
  • Size: 341.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for advisor_agent-0.5.1.tar.gz
Algorithm Hash digest
SHA256 22d5cc9ddbfa2a0a0ad9b8cd5cc74dcff9c63cd51305c05d312acffab9276e6e
MD5 ad3c77c18f2d66404ce644a1e3cda9c6
BLAKE2b-256 6a01486a4851ccecb2b79cbb92cac25fae92dc5641a29a2efa1dd87a2e26e9ef

See more details on using hashes here.

File details

Details for the file advisor_agent-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: advisor_agent-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 162.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for advisor_agent-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bc8670913d7a70b69d081afb965b0d2ce1d702b44bddcc052d9f371a4afe9180
MD5 edb72047a21aaff009d016f0f895fa40
BLAKE2b-256 067061c1fd10889537c212428ab8b3d671a3568b7d177eb73ea1955c20061588

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page