feat: forward extra args to the agent in ch run#19
Merged
Conversation
ch run <agent> replaces the current shell with a registered agent, but it only ever launched that agent with the arguments statically configured for it. Handing the agent a one-off argument at invocation time — say, picking a model for a single session — required editing config first. There was no way to pass arguments through at the call site. ch run <agent> -- <args> now forwards everything after -- to the agent verbatim, each token as its own argv element with no shell re-parsing. The extra args are appended after the agent's configured args, so they also land after any -- already embedded in the agent's command string (for example ai-jail -- claude): the arguments reach the real agent rather than the wrapper in front of it. In practice, ch run claude -- --model opus runs claude with --model opus tacked onto whatever the config already supplies. Enforcing the -- convention replaces cobra.ExactArgs(1) with a validator keyed on ArgsLenAtDash(): exactly one positional, the agent name, may appear before --, and any number may follow. A stray positional such as ch run claude foo is rejected outright rather than silently swallowed, and a bare flag without -- still errors as unknown — keeping the boundary between codeherd's own flags and the agent's flags unambiguous. The new usage is documented in the command help and the README, alongside the design spec and implementation plan under docs/superpowers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
ch run <agent>replaces the current shell with a registered agent, but it only ever launched that agent with its statically configured args. Passing a one-off argument at invocation time (e.g. picking a model for a single session) meant editing config first.This adds the
--pass-through convention:Everything after
--is forwarded to the agent verbatim — each token as its ownargvelement, no shell re-parsing. Extra args are appended after the agent's configured args, so they also land after any--already embedded in the agent's command string (e.g.ai-jail -- claude), reaching the real agent rather than the wrapper. Example:Validation
cobra.ExactArgs(1)is replaced with a validator keyed onArgsLenAtDash(): exactly one positional (the agent name) before--, any number after. A stray positional likech run claude foois rejected outright, and a bare flag without--still errors as unknown — keeping codeherd's own flags distinct from the agent's flags.Docs & tests
ch run --help) and the README Commands table + Agents section.docs/superpowers/.cmd/run_internal_test.gocover append order, landing after an embedded--, empty pass-through, and the three strict-validation rejections.make checkpasses: coverage 81.9% (≥80%), integration tests, lint (0 issues), build.🤖 Generated with Claude Code