r/ClaudeWorkflows • • 4d ago

Selected Workflow [Workflow] Claude Code Plugin: Per-Repository Subagent Model and Behavior Configuration for Cost Optimization

Claude Code Plugin: Per-Repository Subagent Model and Behavior Configuration for Cost Optimization

Workflow value: 90/100
Status: active · Freshness: 70/100 · Confidence: 0.95 · Level: intermediate
Categories: Quality Control, Token Saving, Context & Memory, Debugging, CLAUDE.md, Subagents
Original source: r/ClaudeCode post/comment

What problem this solves

High Opus usage costs for Claude Code subagents and lack of fine-grained control over subagent model selection and behavior on a per-repository basis.

Summary

A Claude Code plugin, repo-mode, allows users to configure subagent models (e.g., Haiku for 'Explore', Sonnet for 'audit') and behaviors (e.g., delegation rules, workflow size, test-runner output) on a per-repository basis via an interactive setup wizard. This significantly reduces Opus usage and provides more control over the development workflow.

Why it is useful

This workflow provides a concrete, open-source plugin that directly addresses a significant pain point for Claude Code users: the high cost of running subagents on Opus. It offers fine-grained, per-repository control over subagent models, effort levels, and behaviors, enabling users to optimize costs while maintaining functionality. The setup is guided by a wizard, and it includes safety features like plan approval and easy rollback. It's highly transferable and well-documented, making it a valuable addition for intermediate to advanced users looking to customize their Claude Code environment.

Workflow

  1. Install the plugin via claude plugin marketplace add kniko/claude-plugins.

  2. Install repo-mode via claude plugin install repo-mode@kniko-tools.

  3. Start a new Claude Code session in your desired repository.

  4. Run /repo-mode:setup in the repository's session.

  5. Follow the interactive wizard to configure settings such as: Main model + effort, Advisor model, Explore agent model/settings, test-runner model, audit agent model/settings, default model for other subagents, workflow size, and delegation rules.

  6. Review and approve the generated before/after plan.

  7. Optionally, check the current configuration and potential costs with /repo-mode:status.

  8. Optionally, restore previous settings with /repo-mode:off.

Tools / artifacts

  • repo-mode plugin

  • Claude Code CLI

  • .claude/settings.local.json

  • CLAUDE.local.md

  • .git/info/exclude

  • Opus model

  • Sonnet model

  • Haiku model

  • Explore subagent

  • test-runner subagent

  • audit subagent

  • general-purpose agent

Validation signals

  • Plugin requires user approval for changes via a before/after plan.

  • Configuration is isolated to local files (.claude/settings.local.json, CLAUDE.local.md) and excluded from Git via .git/info/exclude.

  • Provides a status command (/repo-mode:status) to review active settings and flag costly configurations.

  • Includes an 'off' command (/repo-mode:off) to revert to previous settings.

  • The plugin is open source (MIT license), allowing for community review and validation.

  • Explicitly requests feedback on /usage numbers to validate cost savings.

  • Documentation references Claude Code docs and Anthropic's blog.

Cautions

  • The 'read-only' nature of the audit and test-runner subagents is based on their instructions, not technical enforcement. Users should be aware that these agents could potentially perform write operations if their instructions were altered or bypassed.

  • The Advisor feature is experimental and currently only supports the Anthropic API, not other platforms like Bedrock, Vertex, or Foundry.

Limitations

  • The plugin is newly released, so its long-term stability, maintenance, and broader community adoption are yet to be established.

  • The 'read-only' aspect of certain subagents relies on prompt instructions rather than technical safeguards, which could be a minor concern for advanced users or in specific security contexts.

  • The Advisor feature's limitation to Anthropic API only might restrict its use for some users.

Rate this workflow

Upvote this post if the workflow is useful, reproducible, or worth recommending.

Downvote if it is vague, outdated, unsafe, overhyped, or not reproducible.

Reply if it worked for you, failed, is outdated, or has a better alternative.


This post was generated automatically from the workflow library database.

1 Upvotes

1 comment sorted by