Skip to content

Claude Code. Any Model. The most powerful AI coding agent now speaks every language.

23.5 KB
Raw Blame

Research Report: Claude Advisor Tool Pattern + Claudish Integration

Session: dev-research-advisor-tool-claudish-20260410-113936-42c61676 Date: 2026-04-10 Status: COMPLETED


Executive Summary

Anthropic's Advisor Tool (beta advisor-tool-2026-03-01) pairs a faster executor model with a stronger advisor in a single server-side API request. Currently limited to Anthropic model pairs only (Haiku/Sonnet→Opus). This research investigated whether and how the advisor pattern can be extended to third-party models via Claudish/Claudish-MCP, whether Anthropic published a test harness for validation, and what architecture best supports this integration.

Key conclusions: (1) The hybrid MCP tool + prompt guidance architecture is unanimously recommended across all analyses. (2) Hooks are NOT viable as the primary advisor mechanism. (3) Anthropic has NOT published a public test harness — we must build our own, adapting SWE-bench and the magus autotest framework. (4) Cross-model advising provides unique value (diversity, cost arbitrage, critique quality) beyond what Opus-only offers. (5) Context packaging is the critical product challenge — unlike the native advisor which sees the full transcript automatically, a Claudish advisor only receives what the executor explicitly provides.


Research Questions and Answers

Q1: Can We Simulate the Advisor Pattern with Third-Party Models via Claudish?

Answer: YES (PARTIAL simulation with practical value)

The native advisor operates server-side within a single /v1/messages request with full transcript visibility. This transport cannot be replicated. However, the decision pattern — "pause, summarize state, get strategic guidance, continue" — CAN be simulated via an explicit MCP tool.

Key differences from native:

Aspect Native Advisor Claudish Advisor
Transport Server-side, single request MCP tool call → external API → response
Context Full transcript (auto) Executor-provided "advisor packet" (manual)
Latency ~3-8s (internal) ~8-30s (external API round-trip)
Model pairs Anthropic only Any model via OpenRouter
Trust level Implicit (same family) External (requires normalization)
Streaming Executor pauses, resumes Full round-trip, no partial streaming

Sources: Anthropic docs (primary), GPT-5.4 analysis, Gemini analysis, local codebase investigation

Q2: What Integration Points Exist?

Answer: MCP tool is the best integration point; hooks are NOT viable

Integration Point Feasibility Rationale
MCP advisor tool HIGH Explicit invocation, full observability, testable
Prompt/CLAUDE.md guidance HIGH No code changes, good nudge, but unreliable alone
PreToolUse hook LOW Timeouts too short (3-10s vs 15-30s needed), zero conversation context
PostToolUse hook LOW Same timeout issues
Proxy/wrapper LOW Fragile, opaque, potential ToS concerns
Hybrid (MCP + prompt) HIGHEST Best balance of control, usability, and testability

Hook timeout analysis (from codebase): Existing hooks with external API calls (GTD, SEO, autopilot) work because they do fast validation (3-10s), not full model inference (15-30s). Claude Code hook timeouts are insufficient for reasoning model responses.

MCP context limitation: Claudish MCP tools receive NO conversation history. External models run isolated sessions with only the provided prompt. This means the executor MUST construct and pass an "advisor packet" summarizing relevant context.

Sources: Local codebase investigation, GPT-5.4 analysis, Gemini analysis

Q3: Did Anthropic Publish a Test Harness for Advisor Tool Validation?

Answer: NO — no public test harness exists. Must build custom.

What Anthropic HAS published:

  • Benchmark names: SWE-bench Multilingual, BrowseComp, Terminal-Bench 2.0
  • Key result: "Haiku with Opus advisor more than doubled its standalone benchmark score while costing significantly less than running Sonnet"
  • Three-agent harness (planner/generator/evaluator) — related pattern but NOT advisor-specific
  • Generator-Evaluator harness with Playwright MCP for frontend evaluation

What does NOT exist publicly:

  • No evaluation scripts or test framework for the advisor tool
  • No anthropic-cookbook examples for advisor tool usage (as of April 2026)
  • No methodology details for the "early benchmarks" mentioned in docs
  • No community-published advisor tool evaluation frameworks

What we CAN reuse:

  1. SWE-bench as benchmark dataset (community toolkit: jimmc414/claudecode_gemini_and_codex_swebench)
  2. Generator-Evaluator separation principle from Anthropic's three-agent harness
  3. Sprint Contracts pattern for testable criteria
  4. Existing magus autotest/framework/ as runner infrastructure
  5. Paired comparison methodology (with/without advisor)

Sources: Web search (TestingCatalog, InfoQ, Understanding Data), GitHub search, Anthropic documentation

Q4: How to Validate Claudish + Third-Party Model Advisor Quality?

Answer: Build a paired-run benchmark framework measuring 3 dimensions

Dimension 1: End-to-End Task Outcomes

  • Task success / pass rate
  • Tests passing
  • Correctness score
  • Regression count

Dimension 2: Process Efficiency

  • Total latency
  • Tool calls per successful task
  • Number of retries / dead ends
  • Token cost
  • Advisor call count

Dimension 3: Advisor Intrinsic Quality (independent of executor)

  • Recommendation correctness
  • Risk identification recall
  • Confidence calibration
  • Actionability

Benchmark Design (from GPT-5.4 analysis):

  • 50 coding tasks + 30 debugging tasks + 20 architecture review tasks
  • 3 seeds each
  • Compare: No advisor → Native Opus advisor → Claudish advisor (per model)
  • Paired runs: same prompt, same repo snapshot, same executor model
  • Counterfactual replay where possible

Key Derived Metrics:

  • success_delta = success_with_advisor - success_without
  • advice_precision = useful_recommendations / all_recommendations
  • harm_rate = bad_advice_followed / tasks
  • calibration_error = |confidence - usefulness|

Sources: GPT-5.4 analysis, Gemini analysis, web research

Q5: Architectural Options for Implementation?

Answer: Hybrid approach (Option E) — MCP tool + prompt guidance + optional narrow hooks

All three independent analyses converged on the same recommendation:

Primary: Explicit MCP Advisor Tool

consult_advisor({
  mode: "architecture" | "debug" | "review" | "decision",
  advisor_model: "gemini-3.1-pro-preview",
  objective: "...",
  context_summary: "...",
  question: "...",
  max_output_tokens: 700
})

Response Schema:

{
  "recommendation": "...",
  "rationale": ["..."],
  "risks": ["..."],
  "alternatives": ["..."],
  "confidence": 4,
  "suggested_next_steps": ["..."],
  "assumptions": ["..."]
}

Secondary: CLAUDE.md Invocation Guidance

  • Instruct executor to consult advisor before architectural decisions, after failed attempts, before irreversible actions

Optional: Narrow Hooks (Phase 5)

  • Only for high-risk validation (e.g., before destructive Bash commands)
  • NOT for general advisor consultation

Sources: GPT-5.4 analysis (unanimous), Gemini analysis, local investigation


Key Findings (7 Total)

Finding 1: Hybrid MCP+Prompt Architecture Is Unanimously Recommended [UNANIMOUS — 3 sources]

All analyses independently converge on explicit MCP advisor tool + system prompt guidance. "Simulate the pattern, not the transport."

Finding 2: Hooks Are NOT Viable for Advisor Pattern [UNANIMOUS — 3 sources]

Timeouts too short (3-10s vs 15-30s needed), zero conversation history access, wrong granularity. Only viable for narrow validation, not primary advisor channel.

Finding 3: Context Packaging Is the Critical Product Challenge [UNANIMOUS — 4 sources]

Native advisor gets full transcript automatically. Claudish advisor gets only what executor provides. "Advisor packets" with structured context summaries are the key innovation.

Finding 4: Cross-Model Advising Provides Unique Value [STRONG — 2 sources]

Orthogonal blind spots, specialized domains, cost arbitrage, multi-advisor consensus. Market as "external strategic consults," not "Opus replacement."

Finding 5: No Public Anthropic Test Harness; Must Build Custom [UNANIMOUS — 3 sources]

Confirmed absent across all search vectors. Adapt SWE-bench + autotest framework + Anthropic's generator-evaluator patterns.

Finding 6: Phased Roadmap Starting with MVA [STRONG — 3 sources]

Single model → trigger policy → multi-advisor → evaluation harness → optional hooks. MVA config: { advisor: { enabled, defaultAdvisor, mode } }.

Finding 7: Native Advisor Is Single-Request Server-Side [UNANIMOUS — 1 authoritative source]

Full transcript visibility, thinking blocks dropped, Anthropic pairs only, max_uses limit, prompt caching available.


Architecture Recommendation

Recommended: Hybrid MCP Tool + Prompt Guidance

┌──────────────────────────┐
│ Claude executor session  │
│ (Sonnet/Haiku/internal)  │
└────────────┬─────────────┘
             │ decides to consult
             ▼
┌──────────────────────────┐
│ Advisor MCP tool         │
│ consult_advisor()        │
│ consult_advisors()       │
└────────────┬─────────────┘
             │ builds advisor packet
             ▼
┌──────────────────────────┐
│ Claudish orchestration   │
│ alias resolution         │
│ model routing            │
│ timeout/budget control   │
└───────┬────────┬─────────┘
        │        │
        ▼        ▼
┌────────────┐ ┌────────────┐
│ GPT/Gemini │ │ Grok/etc   │
└────────────┘ └────────────┘
        │        │
        └───┬────┘
            ▼
┌──────────────────────────┐
│ Advice normalizer        │
│ schema + synthesis       │
└────────────┬─────────────┘
             ▼
┌──────────────────────────┐
│ Executor continues       │
│ accepts/rejects advice   │
└──────────────────────────┘

Context Packaging Levels

  • Level 1 (default): Summary only — objective, known facts, constraints, proposed plan, question
  • Level 2: Summary + artifacts — file snippets, tool outputs, error traces, diff hunks
  • Level 3: Near-full transcript (only when needed and token budget allows)

User Configuration (MVP)

{
  "advisor": {
    "enabled": true,
    "defaultAdvisor": "gemini",
    "mode": "manual"
  }
}

Full Configuration (Later)

{
  "advisor": {
    "enabled": true,
    "mode": "manual",
    "defaultAdvisor": "gemini",
    "profiles": {
      "architecture": ["gemini"],
      "debug": ["grok"],
      "review": ["gpt"]
    },
    "triggerPolicy": {
      "consultOnLowConfidence": true,
      "consultAfterFailedAttempts": 2,
      "consultBeforeRiskyActions": true
    },
    "budgets": {
      "maxConsultsPerTask": 2,
      "maxConsultsPerSession": 8,
      "maxCostUsdPerSession": 2.0
    },
    "timeouts": { "fastMs": 8000, "deepMs": 25000 }
  }
}

Test Harness Strategy

Since Anthropic has NOT published an advisor-specific test harness, we must build our own.

Approach: Adapt Existing Infrastructure

Base: magus autotest/framework/ (already used for terminal, designer, coaching, GTD tests)

Benchmark Dataset: SWE-bench Verified subset + custom architecture/debugging tasks

Test Matrix:

Config Executor Advisor Purpose
A Sonnet 4.6 None Baseline
B Sonnet 4.6 Opus (native) Ceiling (Anthropic)
C Sonnet 4.6 Gemini (claudish) Third-party comparison
D Sonnet 4.6 GPT-5.4 (claudish) Third-party comparison
E Sonnet 4.6 Multi-advisor consensus Multi-model experiment

Metrics Collected Per Run:

  • Pass/fail
  • Tool call count
  • Latency (total, advisor-only)
  • Token cost
  • Advisor call count
  • Advice acceptance rate
  • Error/retry count

Advisor Quality Evaluation (separate from end-to-end):

  • Freeze executor state at advisor call point
  • Score advisor output on: correctness, actionability, risk awareness, confidence calibration
  • Use LLM-as-judge or expert rubric

Statistical Design:

  • 30-50 paired tasks per category for early signal
  • 3-5 seeds per task for variance control
  • Paired t-test or Wilcoxon signed-rank for significance

Related: Anthropic's Three-Agent Harness Pattern

While not advisor-specific, Anthropic's published generator-evaluator harness provides useful patterns:

  • Sprint Contracts for testable success criteria
  • Playwright MCP for live application testing
  • Design quality scoring rubric (Design Quality, Originality, Craft, Functionality)
  • Few-shot calibration for evaluator alignment

Evidence Quality Assessment

Consensus Levels

  • UNANIMOUS (5 findings): F1, F2, F3, F5, F7
  • STRONG (2 findings): F4, F6
  • CONTRADICTORY: None

Quality Metrics

  • Factual Integrity: 100% — all 28 claims are sourced
  • Agreement Score: 71% — 20 of 28 granular findings have multi-source support (exceeds 60% target)

Source Quality Distribution

Source Type Quality
Anthropic advisor tool docs Primary documentation HIGH
Local codebase investigation Ground truth HIGH
Web research (InfoQ, TestingCatalog, Understanding Data) Secondary with citations MEDIUM-HIGH
GPT-5.4 /team analysis AI reasoning MEDIUM
Gemini 3.1 Pro /team analysis AI reasoning MEDIUM

Source Analysis

Primary Sources (HIGH quality)

  1. Anthropic Advisor Tool Documentation — platform.claude.com — Complete protocol specification, API reference, best practices, pricing model
  2. Local Codebase Investigation — magus plugins/multimodel, plugins/dev — Ground truth on hook timeouts, MCP tool capabilities, existing orchestration patterns

Secondary Sources (MEDIUM-HIGH quality)

  1. InfoQ: Anthropic Three-Agent Harness — Three-agent architecture details, evaluation methodology
  2. Understanding Data: Generator-Evaluator Harness — Sprint Contracts, design scoring rubric, cost analysis
  3. TestingCatalog: Advisor Tool Launch — Benchmark references, performance claims
  4. SWE-bench Leaderboard — Model comparison data
  5. Community SWE-bench Toolkit — GitHub, evaluation tooling

AI Analysis Sources (MEDIUM quality)

  1. GPT-5.4 /team analysis — 30K chars, comprehensive architecture + roadmap + evaluation design
  2. Gemini 3.1 Pro Preview /team analysis — 8.6K chars, MCP integration + UX patterns

Failed Sources (no output)

10-14. MiniMax M2.7, Kimi K2.5, GLM-5 Turbo, Qwen3 235B, Grok 4.20 Beta — all timed out at 600s


Methodology

Research Pipeline

  • Phases: 6 (Session init → Planning → Queries → Exploration → Synthesis → Finalization)
  • Exploration rounds: 1 (convergence achieved on first iteration due to strong consensus)
  • Synthesis iterations: 1

Models Used

  • Internal (Claude Opus 4.6): Orchestration, synthesis, local investigation
  • GPT-5.4: /team analysis — produced 30K char comprehensive response
  • Gemini 3.1 Pro Preview: /team analysis — produced 8.6K char focused response
  • MiniMax M2.7, Kimi K2.5, GLM-5 Turbo, Qwen3 235B, Grok 4.20 Beta: /team analysis — all timed out at 600s

Sources Consulted

  • 3 web search queries
  • 3 web page fetches (detailed content extraction)
  • 1 local codebase deep exploration (Explore agent)
  • 3 background researcher agents (test harness, hooks/MCP feasibility, model quality/cost)
  • 7 external model analyses (/team)
  • 4 Anthropic GitHub repositories checked
  • 15+ local codebase files examined across 7 plugins

Convergence

  • Criterion: Unanimous consensus on core architecture + strong consensus on implementation roadmap
  • Result: Converged on iteration 1 — synthesizer recommended proceeding to implementation

Implementation Roadmap

Phase 1: Minimum Viable Advisor (MVA) — ~1-2 weeks

  • Single consult_advisor MCP tool in multimodel plugin
  • Summary-based context packets only
  • Strict JSON response schema
  • Manual invocation (user or executor via prompt guidance)
  • Single advisor model per call
  • Basic logging and metrics
  • Config: { advisor: { enabled, defaultAdvisor, mode: "manual" } }

Phase 2: Trigger Policy + UX — ~1 week

  • Executor-side heuristics for when to consult (low confidence, failed attempts, risky actions)
  • advisor: auto | manual | off modes
  • Fast vs deep advisor modes (with different timeouts)
  • Per-session advisor budget
  • /advise, /advise-arch, /advise-debug commands

Phase 3: Multi-Advisor Consensus — ~1-2 weeks

  • Parallel external consults via claudish team()
  • Synthesis strategies: consensus, diverse options, tie-breaker
  • Disagreement reporting
  • Role-specialized advisors (architecture→Gemini, debug→Grok, review→GPT)

Phase 4: Evaluation Harness — parallel with Phase 1-3

  • Benchmark corpus (SWE-bench subset + custom tasks)
  • Paired-run orchestrator
  • Advisor quality scoring
  • Cost-quality Pareto frontier dashboards

Phase 5: Optional Narrow Hooks — only if empirically justified

  • Consult before high-risk Bash actions
  • Consult after 2+ failed attempts
  • NOT every tool call

Recommendations

Immediate Actions

  1. Build MVA prototype — single consult_advisor MCP tool, Gemini as default advisor
  2. Measure latency — end-to-end round-trip times before committing to UX promises
  3. Test executor compliance — how reliably does Claude follow prompt instructions to consult the advisor?

Strategic Decisions

  1. Position as "strategic consults" not "Opus replacement" — different models offer different value
  2. Advisor vs Delegate distinction — advisor sharpens executor's decisions, delegate replaces executor ownership
  3. Treat advisor output as untrusted — sanitize, schema-parse, never auto-trigger tools from advisor text

Technical Priorities

  1. Context packaging is the highest-priority engineering challenge — invest in a good packet builder
  2. Instrument pre-advice state + advice payload + post-advice decision — this gives nearly all signal needed for evaluation
  3. Start evaluation harness in parallel with Phase 1 — don't wait until after building to start measuring

Model Cost & Quality Analysis (from Explorer 3)

Advisor Suitability Ranking

Rank Model Grade Context Est. Cost/Call vs Opus
1 Gemini 3.1 Pro A 1M ~$0.13 6x cheaper
2 GPT-5.4 A- 1.05M ~$0.26 3x cheaper
3 Grok 4.20 B+ 2M ~$0.16 5x cheaper
4 Kimi K2.5 B 256K ~$0.03 25x cheaper
5 Qwen3 235B B 256K ~$0.03 30x cheaper
6 DeepSeek V3.2 B- 163K ~$0.01 50x cheaper
7 MiniMax M2.7 C+ 200K ~$0.02 38x cheaper
8 GLM-5 Turbo C+ 200K ~$0.02 50x cheaper

Costs based on ~50K input + 700 output tokens. Opus baseline: ~$0.80/call.

Recommended Configurations

  • Premium single advisor: GPT-5.4 (~$0.26/call, 3x cheaper than Opus)
  • Best value single advisor: Gemini 3.1 Pro (~$0.13/call, 6x cheaper)
  • Budget single advisor: DeepSeek V3.2 (~$0.01/call, 50x cheaper)
  • Consensus advisor (recommended): Gemini + GPT-5.4 + DeepSeek (~$0.40/call, 2x cheaper than Opus, likely higher quality)
  • Ultra-budget consensus: Kimi + Qwen + MiniMax (~$0.08/call, 10x cheaper)

Real-World Review Quality (from ai-docs/plan-review-consolidated.md)

  • Gemini: High precision, low false positives — best signal-to-noise ratio for advisor role
  • GPT: Thorough issue detection — best for complex architectural decisions
  • GLM: Over-flagging tendency — would create noise as advisor
  • Multi-model consensus (2-3 models) likely exceeds single-Opus quality based on research literature

Existing Codebase Patterns to Leverage (from Explorers 1-2)

1. Dev Plugin Coaching Loop (Self-Advisory Precedent)

The dev plugin already implements a feedback loop structurally similar to the advisor pattern:

  • Stop hook → analyzes session transcript → writes behavioral recommendations
  • SessionStart hook → injects recommendations as context for next session
  • This is essentially a self-advisory system using Claude's own historical transcript

2. Autotest Framework (Evaluation Infrastructure)

  • evaluator.ts: pass/fail with PASS, PASS_ALT, PASS_DELEGATED, FAIL categories
  • comparator.ts: cross-model comparison with aggregate stats
  • types.ts: RunEntry tracks tokens, cost_usd, turns, retries, wall_time_ms
  • Tech-writer benchmark: blind A/B LLM-as-judge with 8 weighted criteria

3. Multimodel Evaluation Patterns

  • Task Complexity Router: 4-tier model routing evaluation
  • Hierarchical Coordinator: drift detection (structurally identical to advisor validation)
  • Performance Tracking: runs, success/failure, confidence, latency, cost per task
  • Quality Gates: multi-reviewer consensus with severity classification

4. run_prompt MCP Tool (Simplest Advisor Interface)

One-shot, synchronous query to external models — simpler than create_session for advisor use:

run_prompt(model="gemini", prompt="<advisor packet>")

Limitations

This research does NOT cover:

  • Empirical latency measurements — requires building and testing the prototype
  • Executor compliance rates — requires A/B testing with real sessions
  • Concrete cost calculations — depends on context packaging decisions not yet made
  • Anthropic's advisor tool roadmap — whether they plan custom model endpoint support
  • Legal/ToS analysis — whether simulating the advisor pattern with external models has compliance implications
  • 5 external models that timed out — MiniMax M2.7, Kimi K2.5, GLM-5 Turbo, Qwen3 235B, Grok 4.20 Beta did not produce analysis due to 600s team timeout

Appendix: Key Sources