Skip to content

feat(cli): forward extra arguments to launched agent#284

Merged
BYK merged 1 commit into
mainfrom
feat/forward-agent-args
May 13, 2026
Merged

feat(cli): forward extra arguments to launched agent#284
BYK merged 1 commit into
mainfrom
feat/forward-agent-args

Conversation

@BYK
Copy link
Copy Markdown
Owner

@BYK BYK commented May 13, 2026

Summary

  • Allow users to pass flags through to the agent process when using lore run or the agent shorthand
  • Uses parseArgs token stream to identify the agent name position in argv, then slices everything after it as raw passthrough args
  • In auto-detect mode (no agent name), unknown flags are reconstructed from the token stream and forwarded
  • Supports -- as separator to forward flags that share names with lore's own options

Examples

lore --dangerously-skip-permissions           # auto-detect agent, forward the flag
lore claude --dangerously-skip-permissions    # forward to claude
lore run claude --model gpt-4                # forward --model gpt-4 to claude
lore --debug claude --flag                   # --debug goes to lore, --flag goes to agent
lore -- --verbose --debug                    # use -- to forward lore-like flags

Changes

  • main.ts: Enable tokens: true in parseArgs, add extractAgentArgs() helper with three strategies:
    1. -- separator: everything after it goes to the agent
    2. Agent positional found: slice raw argv from after the agent name
    3. Auto-detect (no agent name): reconstruct unknown option tokens and forward them
  • run.ts: Accept and forward extraArgs parameter through commandRunresolveLaunchTargetlaunchChild
  • help.ts: Document argument forwarding with an "Agent arguments" section and new examples

Known Limitations

  • In auto-detect mode without --, only boolean-style flags (e.g. --dangerously-skip-permissions) can be forwarded. Value-bearing flags like --model gpt-4 cannot be reconstructed because parseArgs treats unknown flags as booleans and separates the value as a positional. Use -- for those: lore -- --model gpt-4
  • Flags that match lore's own options (--port, --debug, --host) are consumed by lore regardless of position. Use -- to prevent this: lore run claude -- --port 8080

Allow users to pass flags through to the agent process:
  lore claude --dangerously-skip-permissions
  lore run claude --model gpt-4
  lore -- --verbose  (auto-detect mode)

Uses parseArgs tokens to identify the agent name position in argv,
then slices everything after it as raw passthrough args. Supports
'--' as separator for the auto-detect case (no agent name given).
@BYK BYK force-pushed the feat/forward-agent-args branch from 5d0d8ae to 18450fb Compare May 13, 2026 10:37
@BYK BYK merged commit 87a3cf8 into main May 13, 2026
7 checks passed
@BYK BYK deleted the feat/forward-agent-args branch May 13, 2026 10:40
This was referenced May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant