Support direct file read/write APIs instead of shell commands
Resolved 💬 4 comments Opened Jan 25, 2026 by dismonjames Closed Mar 20, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What feature would you like to see?
Support direct file read/write APIs (e.g. readFile/writeFile) instead of relying on shell commands for filesystem access.
Additional information
Additional context
- Using PowerShell/bash commands for file I/O leads to multiple cross-platform issues:
- CRLF vs LF line endings
- Encoding mismatches (UTF-8 vs system codepages)
- Shell escaping for paths with spaces/special characters
- Inconsistent behavior across Windows / macOS / Linux
Why it matters
- Agents and tools often need to write multi-line files (source code, configs, serialized data)
- Shell-based writes easily corrupt or reformat content unintentionally
- Beginners struggle with shell quirks → worse onboarding UX
Proposed direction
- Introduce a direct file API surface (e.g.
readFile,writeFile,appendFile) - Ensure consistent behavior across CLI and other Codex surfaces
- Avoid shell entirely for non-interactive filesystem operations
Willing to contribute
I’m interested in contributing a prototype implementation (especially Windows support).
Happy to help with API design, cross-platform behavior, and testing.
4 Comments
Codex already includes an
apply_patchtool that is an advanced version of what you're describing here. There are times whenapply_patchis optimal. There are other times when it's more efficient for the model to use other techniques (other tools, small shell scripts, Python scripts, etc.) to get the job done.Thanks for the context!
I’m aware of the
apply_patchtool and I agree it’s a good fit for many edit-style operations. The pain point I’m running into is specifically around full file creation/overwrite on Windows when going through shell commands:apply_patchis great when you already have a file on disk and you’re applying a diff, but for flows like:shell-based I/O still tends to introduce subtle corruption or formatting problems.
I’m not asking to remove or replace shell-based tools — they’re clearly useful in many scenarios. What I’m proposing is a complementary, direct file read/write surface (e.g.
readFile/writeFile/appendFile) that Codex can choose when it needs a “safe, binary-free, cross-platform” path for text files, especially on Windows.If that general direction sounds reasonable, I’m happy to put together a small design/PR sketch for how this could look in the CLI first and keep it opt-in / backward-compatible. Would that be in scope for the roadmap?
The
apply_patchtool is already a safe, binary-free, cross-platform path for text files.I don't think the problems you're describing would be solved by a direct read/write tool. Those are model behaviors, so improvements will need to be trained in to future versions of the model.
This feature request hasn't received enough upvotes, so closing.