Skip to content

Shubha1m/Advisor_Skill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local Advisor Skill

A Claude Code slash command that pairs a local LLM with Claude Code itself, splitting work between an executor and an advisor.

What it is

A /local-advisor slash command for Claude Code. When invoked, it runs a local model (via Ollama) as the bulk executor and uses Claude Code itself as the strategic advisor. The two communicate through files in a per-task state directory; the executor never talks to Anthropic's API directly, and the advisor never talks to the local model directly.

What it does

Run /local-advisor "your task" from any project directory in Claude Code:

  1. The local executor enters a tight loop: read files, edit files, run shell commands, run tests.
  2. At protocol-defined moments — start of task, before declaring done, when stuck, every N turns — the executor pauses and writes a transcript snapshot.
  3. Claude Code reads the transcript, writes short strategic advice, and resumes the executor.
  4. The loop continues until the executor declares the task done or hits a terminal error.

The executor handles the bulk of generation locally. Claude Code is consulted only at the moments that disproportionately matter for outcome quality.

Why it exists

Anthropic published the advisor pattern for Claude Sonnet plus Claude Opus, where Sonnet handles routine work and Opus is consulted at strategic moments. The pattern delivers near-Opus quality at a fraction of the Opus cost. Their official advisor_20260301 API tool only accepts Claude executors, though, so applying the same pattern with a local model means doing the orchestration yourself.

This project does that orchestration. A local Qwen model runs the file edits, shell commands, and test loops. Claude Code (via your Max plan) handles the strategic moments. You get a coding agent that mostly runs on your laptop with occasional consultation from a frontier model — and the consultations are covered by your existing Max subscription.

Installation

Prerequisites

  • macOS, Linux, or Windows (via WSL2) with at least 32 GB of RAM (the executor model lives in memory)
  • Ollama running locally
  • uv installed (the executor script uses PEP 723 inline metadata to resolve its own deps per invocation, no project venv needed)
  • Claude Code CLI

macOS or Linux

# 1. Clone this repo
git clone https://github.com/Shubha1m/Advisor_Skill.git
cd Advisor_Skill

# 2. Pull a compatible Ollama coding model
ollama pull qwen3.6:35b-a3b-mxfp8

# 3. Install the slash command at user scope
mkdir -p ~/.claude/commands
sed "s|<REPO_ROOT>|$(pwd)|g" .claude/skills/local-advisor/SKILL_TEMPLATE.md \
  > ~/.claude/commands/local-advisor.md

# 4. Restart Claude Code so the new slash command registers

Windows (via WSL2)

The executor's bash tool runs POSIX shell commands (ls, cat, mkdir -p, pytest, etc.), so native Windows + cmd.exe is not supported. Use WSL2 — once you're inside an Ubuntu (or similar) shell, the macOS/Linux steps above apply unchanged.

One-time setup, in PowerShell as Administrator:

# 1. Install WSL2 with Ubuntu (reboot when prompted)
wsl --install -d Ubuntu

Then open the Ubuntu shell and install the prerequisites inside WSL:

# 2. Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# 3. Install Ollama (runs as a Linux service inside WSL)
curl -fsSL https://ollama.com/install.sh | sh

# 4. Install Claude Code (follow the official instructions linked above)

Then follow the four-step block from the macOS / Linux section above, run from inside the WSL shell. Run /local-advisor from a Claude Code session that's also launched from inside WSL — running it from a native Windows Claude Code session will not see the WSL-installed slash command or Ollama.

Usage

In any project directory, in a Claude Code session:

/local-advisor "build a small CLI that converts YAML to JSON with type inference"

The first invocation will trigger Ollama to load the model into memory (roughly 30 to 60 seconds the first time). Subsequent invocations reuse the loaded model.

A different executor model can be requested per-invocation:

/local-advisor "the task" --model qwen3.6:27b-coding-mxfp8

Inspecting a run

Each run writes a state directory under /tmp/advisor-XXXXXXXX/:

File What it is
task.txt The original task description
transcript.jsonl Append-only message log, one JSON per line
metrics.jsonl Per-turn token counts and wall-clock
live.jsonl Per-SSE-chunk stream, for live tailing during a run
meta.json Running counters
status.json Last exit status, with executor aggregates on done
advice-N.md The Nth advice file written by the advisor

Helper scripts in scripts/:

  • watch.py <state-dir> — pretty-printed real-time view of a running task in another terminal
  • summarize_task.py <state-dir> — per-task scorecard
  • analyze_session.py <session-jsonl> — advisor-side token aggregates by model

For real-time token streaming during a run, tail the per-chunk live log directly:

tail -f /tmp/advisor-XXXXXXXX/live.jsonl | jq -rj 'select(.delta.reasoning) | .delta.reasoning'

Configuration

Behavior is controlled by step.py's flags. Run step.py --help for the full list. Common ones:

Flag Default What it does
--model qwen3.6:35b-a3b-mxfp8 Ollama model name
--max-turns 60 Per-segment turn cap
--max-advisor-calls 10 Per-task advisor cap
--no-progress-timeout 480 Abort if no tokens received for this many seconds
--force-advisor-at-turn 0 Force a consult at this turn (-1 disables)
--force-consult-every-n-turns 14 Periodic forced consult cadence (0 disables)

License

MIT. See LICENSE.

About

Local LLM executor with Claude Code as advisor (interactive /local-advisor slash command)

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages