Skip to content

Conversation

@terry-li-hm
Copy link
Contributor

Summary

Fixes Codex commands that use @agent- syntax by automatically transforming them to Task() calls during conversion.

Problem

Commands like /plan_review use Claude Code's @agent-dhh-rails-reviewer syntax, which doesn't work in Codex. When these commands are converted via the Codex converter, the syntax is copied as-is, causing errors like "required review agents aren't available in this environment."

Solution

Added transformAgentSyntax() function to the Codex converter that:

  • Detects @agent-<name> patterns in command bodies
  • Converts them to readable text ("the dhh-rails-reviewer agent")
  • Adds explicit Task() call examples with proper subagent_type
  • Includes instructions for running multiple agents in parallel

Example Transformation

Before (Claude Code syntax):

Have @agent-dhh-rails-reviewer @agent-kieran-rails-reviewer review this plan in parallel.

After (Codex-compatible):

Have the dhh-rails-reviewer agent the kieran-rails-reviewer agent review this plan in parallel.

**Launch these 2 agents IN PARALLEL using the Task tool:**

Task(
  subagent_type="dhh-rails-reviewer",
  description="dhh-rails-reviewer review",
  prompt="[Your prompt here with context]"
)

Task(
  subagent_type="kieran-rails-reviewer",
  description="kieran-rails-reviewer review",
  prompt="[Your prompt here with context]"
)

**IMPORTANT:** Include all Task calls in a single message to run them in parallel.

Impact

  • Fixes /plan_review and any other commands using @agent- syntax
  • Maintains clean source code (plugin authors can use natural @agent- syntax)
  • Automatic conversion handles the translation
  • One fix benefits all current and future commands

Testing

Ran the converter and verified /plan_review now includes proper Task() call instructions in Codex format.

- Add transformAgentSyntax() function to convert Claude Code @agent- mentions
- Converts '@agent-name' to Task(subagent_type='name', ...) for Codex compatibility
- Adds instructions for running multiple agents in parallel
- Fixes /plan_review and other commands that use @agent- syntax in Codex

Closes: Codex commands with @agent- syntax were failing with 'agents not available'
@terry-li-hm
Copy link
Contributor Author

After deeper investigation, I realized this PR doesn't fully address the underlying issue.

The real problem:

  • Claude Code uses Task agent-name(args) to spawn subagents
  • The converter already converts agents → Codex skills (e.g., repo-research-analyst skill exists)
  • But commands still contained the raw Task agent-name(...) syntax, which Codex doesn't understand
  • Converting @agent-X syntax (this PR) helps with one notation, but most commands use the Task form directly

Better solution:
Transform Task agent-name(args)Use the $agent-name skill to: args in the converter itself.

This connects the already-converted agent skills to the commands that reference them.

Closing in favor of #119 which implements this transformation in the Codex converter.

@terry-li-hm
Copy link
Contributor Author

Correction: The new PR is #120 (not #119).

Also found and fixed an additional bug during testing - the converter was transforming the skill files but not the prompt files. Both now correctly transform Task agent(args)Use the $agent skill to: args.

Verified locally with Codex CLI 0.89.0 - both skill and prompt files now have correct syntax.

@terry-li-hm terry-li-hm deleted the fix/codex-agent-syntax-converter branch January 26, 2026 01:15
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