tip
컨텍스트(Context) 주입 최적화 팁
Codex와 같은 CLI 도구는 현재 디렉터리의 파일 구조나 특정 코드 조각을 프롬프트에 자동으로 주입합니다. 로컬 모델(gemma-4)을 사용할 때는 VRAM과 컨텍스트 제한이 있으므로, 불필요한 파일이 인덱싱되지 않도록 관리해야 합니다.
.gitignore 및 .codexignore 활용: node_modules, python 가상환경(.venv), 대용량 금융 데이터 CSV 파일 등이 프로젝트 폴더에 있다면 Codex가 이를 읽느라 느려지거나 크래시가 날 수 있습니다. 무시할 경로를 반드시 지정하세요.
부분 컨텍스트 제공: 전체 프로젝트를 다 넘기기보다, 질문하기 전에 타겟이 되는 코드 파일만 지정하여 질문하는 메커니즘(예: codex ask “이 함수 최적화해줘” –files src/valuation.py)을 활용하면 로컬 LLM의 답변 정확도가 대폭 상승합니다.
prompting
https://developers.openai.com/codex/prompting
Setting up system prompts and instructions in Codex (OpenAI’s coding agent) relies on the config.toml file, sub-agents, and the AGENTS.md file rather than a standard chat-like system prompt interface.You can configure Codex’s instructions globally, per project, or per agent using the following approaches:
- Global / Project-Level Configuration (config.toml)
You can inject persistent developer guidelines or replace the base instructions using your configuration files.User Config: ~/.codex/config.toml (applies to all sessions)Project Config: .codex/config.toml (overrides in your specific repository)Add or modify the following lines in your config.toml to set system
1 | # Injected as high-priority developer instructions into all sessions |
- Project-Specific Instructions (AGENTS.md)
Codex automatically parses AGENTS.md in your project root to und
- Create a .agents.md or AGENTS.md file in the root of your project.
- Write markdown guidelines for your project
1 | ### Project Standards |
- Custom Agent Files (~/.codex/agents/)
If you are building specialized agent workflows, you can define autonomous sub-agents with their own system prompts.
Create a .toml file (e.g., ~/.codex/agents/backend_auditor.toml):
1 | name = "backend_auditor" |
- Custom Prompts for Reusable Commands (Slash Commands)For temporary behavior switches or specific tasks (like formatting PR descriptions), use custom prompts.Create a .md file in ~/.codex/prompts/ (e.g., ~/.codex/prompts/review.md).You can define arguments and placeholders to pass context to Codex.Would you like help with:Setting up a custom agent configuration file for a specific coding language?Configuring sandbox permissions and safety rules for tool execution?Writing outcome-based /goal prompts to improve task accuracy?