Feature Proposal: Prompt Enhancement — expand vague inputs into structured prompts before agent execution
What variant of Codex are you using?
desktop
What feature would you like to see?
Problem
Codex CLI users often type brief, vague requests like "fix the bug" or
"write a test." The agent then needs multiple clarification rounds to
understand the intent, wasting tokens and time.
This is not a model capability issue — it's a communication gap between
human intent and AI-executable instructions.
Proposed Solution
Add an optional "prompt enhancement" preprocessing step:
- User types a brief request in the CLI
- User triggers enhancement (e.g.,
Ctrl+Eor/enhanceprefix) - Codex calls the current model with a meta-prompt to expand the input:
- Role: What role should the AI assume?
- Background: Relevant context (files, errors, recent changes)
- Tasks: Specific steps, numbered
- Output Format: Expected structure
- Constraints: Scope, testing, style
- Enhanced prompt is shown for user review (editable)
- On confirm, the enhanced prompt replaces the original input
Example
Input: fix the bug
Enhanced:
Identify the most recent error in the codebase by checking terminal output and error logs. Determine the root cause (e.g., TypeError, null reference, logic error). Propose a minimal fix with explanation. Add or update tests to prevent regression. Follow the existing code style and conventions.
Why This Matters
- Reduces clarification rounds: From 3-4 turns to 1 turn
- Improves output quality: Structured input → precise output
- Lowers usage barrier: New users don't need prompt engineering skills
- Token efficient: Enhancement call is small (~200 tokens) vs. multiple
clarification rounds (~2000+ tokens)
Design Considerations
- Opt-in, not default: Enhancement should be triggered explicitly,
not automatic. Some users prefer writing their own prompts.
- Model-agnostic: The meta-prompt should work with any model Codex
supports (o4-mini, gpt-4o, etc.).
- Context-aware: Could leverage Codex's existing context (open files,
recent errors) to make the enhancement more specific.
- Configurable: Users should be able to customize the meta-prompt via
~/.codex/instructions.md or a new config section.
- Style presets: Could support presets like "code", "debug", "refactor",
"test" for different task types.
Prior Art
- WorkBuddy (Tencent): Has a "增强提示词" feature with a star button
- Various Obsidian plugins: Implement similar prompt expansion
- This is a proven pattern in AI assistant UX
Non-Goals
- Not replacing custom instructions (
~/.codex/instructions.md) - Not a conversational prompt refinement tool
- Not modifying the agent execution loop
Open Questions
- Should enhancement be automatic for very short inputs (<10 words)?
- Should the meta-prompt be hardcoded or user-configurable?
- Should we cache enhancement results for identical inputs?
---
I'd love to hear the team's thoughts on this. I have a working implementation
in TypeScript (from an Obsidian plugin project) that could be adapted to
Codex's architecture if there's interest.
Additional information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗