skill: add --extract-model opt-in for Step 3B subagent model#289
skill: add --extract-model opt-in for Step 3B subagent model#289yelban wants to merge 1 commit intosafishamsi:v4from
Conversation
Step 3B dispatches one semantic-extraction subagent per chunk. Today
those subagents inherit the parent Claude Code model, which is often
Opus. Extraction mixes cheap pattern-matching (EXTRACTED edges, schema
compliance) with reasoning-heavy judgment (INFERRED edges,
semantically_similar_to, hyperedges, confidence calibration). Sonnet
handles the former with near-parity but cedes quality on the latter;
running Opus over a code-heavy corpus wastes budget.
Add a new opt-in flag:
--extract-model sonnet|opus|auto
- Flag omitted: no behavior change; subagents inherit parent as before.
- sonnet / opus: pin all Step 3B subagents to that model.
- auto: corpus-shape heuristic — --mode deep -> opus; code_ratio > 0.8
-> sonnet; (docs+papers)/total > 0.3 -> opus; else sonnet.
When the flag is set, skill.md instructs the orchestrator to pass
model=EXTRACT_MODEL on every Agent tool call and print one line naming
the resolved model and reason. When omitted, output is byte-identical
to pre-flag graphify.
Scope: only skill.md (Claude Code variant). Other skill-*.md variants
use different model-selection mechanisms and are intentionally
untouched. No Python package changes; detect.json already has the
fields the heuristic needs. No schema or cache change.
Full rationale, threshold reasoning, considered alternatives, and test
plan in graphify/docs/extract-model-routing.md.
|
If you are altering skill.md (claude code), you should also alter other flavors skill.md, unless this is a claude code only feature. |
|
Thanks for flagging — that's a fair question, and the PR body's Scope section addresses it explicitly (toggle "Scope" above). Short version: this is Claude-Code-only because the mechanism is Claude-Code-only. The flag's implementation pins the model on a dispatched subagent via the
Happy to open follow-up PRs for any specific flavor the maintainer wants me to target — but I'd rather do that on evidence of the mechanism than blindly extrapolate. Leaving the scoping call to @safishamsi. |
Summary
Step 3B dispatches one semantic-extraction subagent per chunk. Today those subagents inherit the parent Claude Code model, which is often Opus — overkill for the portion of the work that is simple pattern matching. Running Opus over a code-heavy corpus wastes budget; running Sonnet under `--mode deep` sacrifices the aggressive-INFERRED quality that mode is asking for.
This PR adds an opt-in flag so users who want finer control can pin the Step 3B model:
```
--extract-model sonnet|opus|auto
```
No default behavior change. Flag omitted → subagents inherit parent exactly as today.
When the flag is set, `skill.md` instructs the orchestrator to pass `model=EXTRACT_MODEL` on every Agent call and print one line naming the resolved model and reason. When omitted, output is byte-identical to pre-flag graphify.
Scope
Compatibility
Test plan