feat(subagent-dev): add optional external delegate mode for implementation tasks#956
Open
feat(subagent-dev): add optional external delegate mode for implementation tasks#956
Conversation
…ation tasks Extends the "least powerful model per role" principle across providers. When configured in AGENTS.md, mechanical implementation tasks (cheap-model tier) can be piped to an external CLI instead of spawning a same-provider subagent. Reviews always use same-provider subagents. Includes circuit breaker (3 failures disables delegate for session) and graceful fallback. Relates to obra#730, obra#750
Contributor
Author
|
Can't tag you on X, but would love any thoughts here if you think this could work. Thanks for considering, love what youve built here! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem are you trying to solve?
Users on metered plans (Claude Pro, Codex weekly credits) burn through their token allocation running superpowers sessions with many mechanical tasks. Each implementation subagent consumes tokens from the same provider as the controller. On a session with 8+ tasks, the implementer subagents account for the majority of token spend, even though most mechanical tasks (1-2 files, clear spec) don't need the controller's model.
The skill already says "use the least powerful model that can handle each role" - but that principle stops at the provider boundary. There's no way to route cheap tasks to a different provider's CLI that might be faster, cheaper, or better suited for mechanical implementation.
Related issues:
What does this PR change?
Adds an optional "External Delegate" section to subagent-driven-development. When users configure
external-delegate: <cli-name>in their AGENTS.md, mechanical implementation tasks (cheap-model tier) get piped to the external CLI instead of spawning a same-provider subagent. Also addsexternal-delegate-prompt.md- a streamlined implementer prompt for delegates.Is this change appropriate for the core library?
Yes. This is provider-agnostic infrastructure, not a third-party integration. It works with any CLI that accepts a prompt on stdin and writes to the filesystem. The AGENTS.md example uses
codexbut the mechanism is generic. It extends an existing design pattern (model selection tiers) rather than adding a new one.The feature is opt-in. Without
external-delegatein AGENTS.md, behavior is identical to today. No new dependencies, no scripts, no external service calls from superpowers itself.What alternatives did you consider?
Cross-model review only (Feature request: Cross-model collaboration via external CLI tools (Codex, Gemini) for review and second opinions #730's original proposal) - smaller scope but only addresses the bias problem, not token conservation. If the delegate interface exists for implementation, adding review delegation later is trivial.
Token budget tracking - auto-switch to delegate when nearing billing limits. Too complex, too many assumptions about billing APIs. Explicit opt-in via AGENTS.md is simpler. Also aligns with @obra's response on Superpowers consume a lot of tokens in Opencode with Codex #750: "You can do that today - just put those things in your AGENTS.md."
Separate skill - a standalone
external-delegateskill instead of extending subagent-driven-development. This would fragment the execution flow and require users to choose between two competing execution skills. Extending the existing skill preserves the single execution path.Does this PR contain multiple unrelated changes?
No. One feature: external delegate mode. Two files: the section in SKILL.md and the prompt template.
Existing PRs
PR #113 was a larger scope ("comprehensive Codex CLI integration" with utility scripts, hooks, config files). This PR is instruction-only - 44 lines of markdown added to SKILL.md plus a prompt template. No code, no scripts, no config files. The approach is fundamentally different: opt-in via AGENTS.md rather than automatic delegation.
Environment tested
Evaluation
Initial prompt: "Research obra/superpowers for external delegate/Codex delegation patterns. If none exist, propose adding one."
This change adds skill instructions (markdown), not executable code. The evaluation is structural:
implementer-prompt.mdwith sections removed that the controller handles (self-review, escalation)I have not run multi-session evals comparing sessions with and without external delegation. The instructions are new and untested at scale. I'd welcome feedback on the circuit breaker threshold (currently 3 failures) and the task-tier classification rules.
Video Demo
Rigor
superpowers:writing-skillspatterns. Adversarial pressure testing was not performed (this is a new feature proposal, not a modification to existing behavior-shaping content).Human review
This contribution was developed with AI assistance (Claude Code).
Relates to #730, #750