Custom prompts - passing arguments

Resolved 💬 31 comments Opened Aug 29, 2025 by michalkos Closed Oct 3, 2025
💡 Likely answer: A maintainer (dedrisian-oai, contributor) responded on this thread — see the highlighted reply below.

What feature would you like to see?

Please implement functionality to allow custom arguments (e.g., $ARGUMENTS) to be passed and rendered within the .md file when executing slash commands.

Additionally, the first line of the .md file could be used as a command title in the TUI. If the line exceeds the maximum allowed length, it should be truncated accordingly.

<img width="470" height="98" alt="Image" src="https://github.com/user-attachments/assets/f9068bba-6258-4d53-a84c-eef2ccbdb943" />

Once [pull request #2471](https://github.com/openai/codex/pull/2471) is merged, it would be great to support this functionality in custom commands as well.

Example

# Create a git commit

Based on the code changes, create a single git commit.

If `--push` argument is present, you can run `git push`.

**DO NOT** run `git add` unless asked by argument `--add`.

**DO NOT** add information that the commit is generated by Codex.

## Context

- Current git status: !`git status`
- Current git diff (staged and unstaged changes): !`git diff HEAD`
- Current branch: !`git branch --show-current`
- Recent commits: !`git log --oneline -10`

## Passed arguments 

`$ARGUMENTS`

Are you interested in implementing this feature?

_No response_

Additional information

_No response_

View original on GitHub ↗

31 Comments

cs-asimoes · 10 months ago

+1, would be really useful! i was just reading the source code to understand if this was already there!

suvam-jaiswal · 10 months ago

+1, arguments to saved prompts and adding additional content like this is super useful

SuperPauly · 10 months ago

It would be nice to have a more Git centric approach where codex ask if you want to create a new branch for this change.

Also does appropriate Git commits along the way so if you leave it running the user and Codex can easily step back to a point where it was in a working state regardless of Codex running or not.

This way you can see in the Git logs the branches and iterative changes over time to pick up any mistakes or changes that may be important or may have caused problems.

As this also would you help diagnose issues and looking at the state of repository with the many, many tools available for Git repository viewing and analysis out there already.

michalkos · 10 months ago

@SuperPauly, how you configure the command is entirely up to you. The example simply demonstrates how to use arguments in the setup.

dedrisian-oai contributor · 10 months ago

Thanks! Tracking this.

SystemicVoid · 10 months ago

+1 That would be very useful, thanks!

sergigp · 10 months ago

This will make prompts much more powerful. Imo ideally we should be able to pass multiple arguments with $1, $2, ...

avxkim · 10 months ago

i initially thought i could use something like: /code-review pass PR link and do it, but just found out, that it doesn't accept any args... Hope they will implement this soon.

alexx-ftw · 10 months ago

This will be a game changer for me. I rely on this a ton with Claude Code. +1

evandavid1 · 10 months ago

Status update / proposal

  • Draft PR: #3565 (minimal, backward‑compatible).
  • Scope:
  • Arguments: $1..$9, $ARGUMENTS, and $$

(literal); simple quoting for paths with spaces.

  • “@” file picker: inserts quoted file paths (no

content inlining, no auto‑exec).

  • Optional frontmatter: description and argument-

hint shown in the slash palette; frontmatter is
stripped before send.

  • Safety/back‑compat: no changes to approvals/

sandbox; protocol only adds optional fields; existing
prompts continue to work.

  • Tests/docs: unit + TUI snapshot tests added; docs/

prompts.md updated.

If this approach aligns, I’ll mark #3565 ready for
review. I’m happy to modify as needed.

evandavid1 · 10 months ago

Hi @dedrisian-oai and @aibrahim-oai - PR #3565 (https://github.com/openai/codex/pull/3565) mentioned above which shows high demand, delivers the full custom prompt update: $1..$9/$ARGUMENTS/$$ handling, @ file picker auto-quoting, inline description + argument-hint rendering, and the docs/tests refresh. It’s rebased on current main and the sweeps (formatting, per-crate tests, cargo test --all-features) are green. It’s still in draft mode and I can’t switch it back to active - could you unlock the PR and mark it ready for review? Please me know if you’d like any changes.

<img width="534" height="336" alt="Image" src="https://github.com/user-attachments/assets/8a4a8894-c660-4dec-adb0-f158ccdea639" />
<img width="534" height="421" alt="Image" src="https://github.com/user-attachments/assets/201238f9-fef5-43f9-936f-8719792af989" />

0xdevalias · 10 months ago

See also, recent duplicate:

dpolivaev · 10 months ago

Yeah, this high demand is justified: extensibility is key to creating prompt frameworks and libraries.
The documentation of spec-kit itself names this issue as a blocker, while almost every other tool in the long list already supports it.

Codex CLI, despite offering arguably the best model and usage conditions, has the weakest extensibility of all. That is especially frustrating given that multiple pull requests have already been proposed to resolve it.

I hope the official maintainers will notice this issue soon and give it the priority it deserves.

abdull1986 · 10 months ago

GPT5 is defiantly leading the model race, we need a top CLI agent with the GPT subscription :) @codex-maintainers please help here. Thank You.

dedrisian-oai contributor · 9 months ago

From a personal point of view, I don't really like the $1...$9 args and $ARGUMENTS params.

I feel like people should use named params. In my proposal, we use something like:

My name is $NAME and I'm from $CITY in $STATE.

Would then manifest in the CLI as:

/custom-prompt NAME="" CITY="" STATE=""

This removes any ambiguity for the user, especially when the args are automatically rendered once you select the custom prompt. I also don't see the use for $ARGUMENTS -- is there a specific example that would make sense for it?

Thanks everyone!

dpolivaev · 9 months ago

The use case I am interested in is not something I invented — it comes directly from the spec-kit README.

The README shows examples where a command is followed by arbitrary free-form text, not just named parameters. For example:

  • /specify Build an application that can help me organize my photos in separate photo albums. Albums are grouped by date and can be re-organized by dragging and dropping on the main page. Albums are never in other nested albums. Within each album, photos are previewed in a tile-like interface.
  • /plan The application uses Vite with minimal number of libraries. Use vanilla HTML, CSS, and JavaScript as much as possible. Images are not uploaded anywhere and metadata is stored in a local SQLite database.

This usage pattern is part of spec-kit’s own documentation, and it doesn’t map cleanly to named parameters. That’s why support for $ARGUMENTS is essential — it makes it possible to implement the examples shown in the referenced README.

dedrisian-oai contributor · 9 months ago

Alright fair! We can support both.

LostPoE · 9 months ago

What is the latest on Custom prompts - passing arguments? When will this feature be available?

amynoox · 9 months ago

We need this now please :)

Hotion13 · 9 months ago

A message above said this feature is now on a branch and should be merged into main soon.

I this this is this feat : #3565

We all hope for this. Codex is replacing CC for lot of us, and spec kit hype is growing fast :)

desneck · 9 months ago

Hey @dedrisian-oai, will this feature be in the upcoming 0.43 release?
Thanks a lot!

dedrisian-oai contributor · 9 months ago

Hey guys, coming soon! @evandavid1's PR was merged into a feat branch, and I'll combine it with some named params and submit for a PR & review this week.

dedrisian-oai contributor · 9 months ago

Numbered args ($1, $2, $3, $ARGUMENTS) has been merged. Named args coming next!

Was85 · 9 months ago

We can't work with the GitHub Spec kit (Codex) without this.

dedrisian-oai contributor · 9 months ago

Both numbered args and named args have been merged! It will be released in the next version :)

Damecek · 9 months ago

just run the /constitution <input text> custom prompt on the latest build and everything looks working.

╭────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.43.0-alpha.6)                      │
│                                                        │
│ model:     gpt-5-codex   /model to change              │
│ directory: ~/IdeaProjects/force-navigator-reloaded-2-0 │
╰────────────────────────────────────────────────────────╯

  To get started, describe a task or try one of these commands:

  /init - create an AGENTS.md file with instructions for Codex
  /status - show current session configuration
  /approvals - choose what Codex can do without approval
  /model - choose what model and reasoning effort to use
  /review - review any changes and find issues


›
  The user input to you can be provided directly by the agent or as a command argument - you
  **MUST** consider it before proceeding with the prompt (if not empty).

  User input:

  This is repository containing source code for Chrome extension. Aimed to improve page navigation
  inside Salesforce org. Creates a set of dynamic and static url paths, scoped to current org,
  leveraging standard salesforce api.

  You are updating the project constitution at `.specify/memory/constitution.md`. This file
  is a TEMPLATE containing placeholder tokens in square brackets (e.g. `[PROJECT_NAME]`,
  `[PRINCIPLE_1_NAME]`). Your job is to (a) collect/derive concrete values, (b) fill the template
  precisely, and (c) propagate any amendments across dependent artifacts.
....
Tozo1995 · 9 months ago

Can we officially use Codex with the Spec kit and passing an argument? Is it official or experimental?

LostPoE · 9 months ago

I think it might be in v0.43.0 . But its not released yet.

aybouzaglou · 9 months ago

Latest codex cli version now supports custom commands

tibo-openai collaborator · 9 months ago