feat: Add Codex CLI support#14
Conversation
|
for those wanting to try this before PR approval:
|
|
Okay, I've been testing this on production software for the past two days. It works. The problem is, because codex-cli doesn't natively support custom commands yet, you have to remind the LLM it should be using the commands defined in the 'commands' directory. I'm not saying this shouldn't go into release, but if it does it needs a caveat. A lot of people are finding this repo and thinking it's a new vibe coding tool. It's not, it's a methodology and orchestration framework for software engineering with LLM agents. It works really well, but it's not going to fit into every SWE agent right now. |
|
Looks like codex has reusable prompts now. https://github.com/openai/codex/blob/main/docs/prompts.md |
|
@tabtablabs-dev I'm just starting to take a look at this repo, but I'm assuming the issue with codex is that it doesn't support passing arguments to prompts. |
Oh yeah! These are global prompts though rather than project specific. We have the same issue with codex MCP too. Can't be configured on a project / directory level |
|
I guess we need openai/codex#1548 and openai/codex#3164 to land. Go upvote them! |
| if matching_assets: | ||
| asset = matching_assets[0] | ||
| elif ai_assistant == "codex": | ||
| # Fallback to copilot template if codex-specific template is not published yet |
There was a problem hiding this comment.
# Fallback to copilot template if codex-specific template is not published yet
Shouldn't this then be to all assistants, including future ones been added?
Why would codex be the only one counting with a fallback system?
| if not target_cmds.exists(): | ||
| # Search for templates/commands within the running package/repo | ||
| commands_src = None | ||
| for ancestor in Path(__file__).resolve().parents: | ||
| cand = ancestor / "templates" / "commands" | ||
| if cand.exists() and cand.is_dir(): | ||
| commands_src = cand | ||
| break | ||
| if commands_src is not None: | ||
| shutil.copytree(commands_src, target_cmds, dirs_exist_ok=True) | ||
| tracker.complete("commands", "added") | ||
| else: | ||
| # Fallback: embed minimal commands | ||
| target_cmds.mkdir(parents=True, exist_ok=True) | ||
| (target_cmds / "specify.md").write_text(CODEX_CMD_SPECIFY, encoding="utf-8") | ||
| (target_cmds / "plan.md").write_text(CODEX_CMD_PLAN, encoding="utf-8") | ||
| (target_cmds / "tasks.md").write_text(CODEX_CMD_TASKS, encoding="utf-8") | ||
| tracker.complete("commands", "bootstrapped") |
There was a problem hiding this comment.
This is the structure I am getting:
codex/
├── .github
│ └── prompts
│ ├── plan.prompt.md
│ ├── specify.prompt.md
│ └── tasks.prompt.md
├── .specify
│ ├── memory
│ │ ├── constitution_update_checklist.md
│ │ └── constitution.md
│ ├── scripts
│ │ └── bash
│ │ ├── check-task-prerequisites.ps1
│ │ ├── common.ps1
│ │ ├── create-new-feature.ps1
│ │ ├── get-feature-paths.ps1
│ │ ├── setup-plan.ps1
│ │ └── update-agent-context.ps1
│ └── templates
│ ├── agent-file-template.md
│ ├── plan-template.md
│ ├── spec-template.md
│ └── tasks-template.md
└── commands
├── plan.md
├── specify.md
└── tasks.mdWouldn't it be better to have /commands/plan.md as a symlink to /github/prompts/plan.prompt.md rather than a dumbed out version of it?
|
I've been using Codex all day. It's as simple as: Run the `.claude/commands/specify.md` playbook with blah blah blahIt doesn't auto-expand the file path with |
FWIW, CODEX_HOME can be set to the path to the repo root which will give per-project config and prompt isolation. Not as nice as claude code, but it's possible. The most annoying part of that is having to login with the CLI for every project. |
|
@honjo-hiroaki-gtt - could you update your branch with the latest version of Specify and integrate your changes? Happy to merge after. Make sure to also rev the package version and update the changelog file. |
66257cd to
c440ca0
Compare
|
@localden |
c440ca0 to
286ad55
Compare
|
@honjo-hiroaki-gtt If I copy its content this way: the commands are recognized, not if they stay in the commands directory. |
|
Thanks again for surfacing all of these details—it really clarified the root cause for me. My current plan is to keep seeding the prompt sources under I’m going to work through those changes next, so please give me a bit of time before I push the update. |
| specify init <project_name> --ai claude --ignore-agent-tools | ||
| ``` | ||
|
|
||
| > [!NOTE] |
There was a problem hiding this comment.
@honjo-hiroaki-gtt I am still not sure how Codex CLI is different here - aren't all other agents also loading the commands from the workspace folder? That's how we use other agents as well (e.g., Claude Code, Copilot).
|
@honjo-hiroaki-gtt - I am planning on getting the Codex CLI support ready for Monday. Let me know if this is not feasible for you, and I am happy to pick up the PR and drive it to the finish line. |
|
Monday as in 22nd Septemer? @localden |
…eration without git, and documenting clearer /specify usage.
|
@localden Please take another look when you have a moment, and feel free to tweak anything that still needs polish. |
|
I’M SO READY FOR THIS! |
|
Currently working on cleanup - the current PR adds a bit too much, and the changes for new agents should be a bit more surgical 😁 |
So is this live now? 😲 |
|
Did this required any changes to codex? |
|
@localden Testing this now, as far as I can tell it's not working... the ❯ ls ${CODEX_HOME:-~/.codex}/prompts
❯ ls ${CODEX_HOME:-~/.codex}/commands
constitution.md implement.md plan.md specify.md tasks.md
❯ mv ${CODEX_HOME:-~/.codex}/commands/* ${CODEX_HOME:-~/.codex}/prompts/
❯ ls ${CODEX_HOME:-~/.codex}/prompts
constitution.md implement.md plan.md specify.md tasks.md
|
|
@danwashusen uvx --no-cache --from /path/to/spec-kit specify init test-codex \
--ignore-agent-tools --no-git --ai codexAfter that, the |
Hmm, I was testing locally after seeing Codex support mentioned in the commit log after bringing in changes from |
My bad, I didn't notice the release artefacts moved to |
|
For anyone wondering how to use these commands given that Codex doesn't support arguments (e.g. |
What about those open codex issues? Are they not required for spec kit to work as expected with Codex? |
…pport feat: Add Codex CLI support



Description
--ai codex). The init flow verifies Codex, ensures a commands/ directory, and bootstraps minimal command files when packaged templates are unavailable. Agent context updates now target AGENTS.md for Codex.How To Test
uv syncuv run specify init demo-codex --ai codex --ignore-agent-tools --no-gitcommands/exists with specify.md, plan.md, tasks.md/specify,/plan,/tasksand AGENTS.mdcodex /specify→/plan→/tasksuv run specify checkonly prints warnings for missing tools; it won’t list installed AI tools.Screenshots
Init — choose Codex CLI






Post‑init — next steps and project tree
Codex —
/specifyboot and repo scan/specify— prompt for feature description/specify— spec drafted with branch + pathProject tree — specs/001‑i‑want‑to/spec.md created
Checklist