[codex] Add literal mode for subcommand-shaped prompts#33
Conversation
There was a problem hiding this comment.
💡 Codex Review
Lines 64 to 68 in ec688dc
--literal
When --literal is the first flag, tokens after it are documented as prompt text, but this dispatcher still interprets --help/--version as top-level commands. For example, i --literal --help currently prints help instead of treating --help as the natural-language prompt, which breaks the new literal-mode contract for subcommand/flag-shaped prompts. Gate this early switch on !forceLiteral (or move it before rewriting) so post-literal tokens are never re-parsed as dispatcher flags.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Non-technical summary
This adds a small but important escape hatch for
intent's command-line UX: prompts that begin with words likeversion,report, orexplaincan now be forced through natural-language mode instead of being mistaken for subcommands. That matters now because the current dispatch rule makes some perfectly valid prompts awkward or impossible to express without rewriting them.After this change,
i --literal ...keeps the rest of the argv tail as prompt text, so users can intentionally say things that look like subcommands or flags without fighting the parser.Technical summary
--literalhandling ininternal/cli/cli.goby collapsing everything after the first--literalinto one prompt token before subcommand matching--literal, while keeping everything after it inside the prompt textinternal/cli/cli_test.gofor the argv rewrite behaviorinternal/cli/smoke_test.goproving thatversionstays in natural-language mode under--literaland that tail flag-shaped words are not re-parseddocs/SPEC.mdandREADME.mdto document the new public flaggo test ./internal/cli/...,go test ./...,go vet ./...,make buildAdditional notes
Trade-off:
--literalis intentionally narrow. It fixes the dispatch ambiguity without redesigning the broader natural-language flag parser.Deferred: larger parser/prompting issues like file-edit grounding and other open natural-language behavior bugs remain separate increments.
Remaining gap: this makes subcommand-shaped prompts expressible, but it does not change how ordinary natural-language prompts are interpreted once they reach the model.