$npx -y skills add openai/codex --skill path-typesChoose Rust types for operating system paths across the Codex repository. Use when defining new path-bearing types or explicitly migrating existing ones.
| 1 | # Path Types |
| 2 | |
| 3 | Apply this guidance when defining new types. Change existing code only when explicitly requested, |
| 4 | and keep edits minimal and proportional. Treat these rules as the target state of an ongoing |
| 5 | migration; if compliance is difficult, ask the user how to proceed. |
| 6 | |
| 7 | - In app-server protocol types, use `LegacyAppPathString` for backwards compatibility during the URI |
| 8 | migration. At the protocol boundary, convert it to `PathUri` and use `PathUri` internally. For |
| 9 | host-local logic, such as some config values, use `AbsolutePathBuf` or `PathBuf` instead. |
| 10 | - In exec-server protocol types, use `PathUri`. Internally, use `PathUri` or `AbsolutePathBuf` as |
| 11 | appropriate. |
| 12 | - In dependencies shared by both servers, use `PathUri` or separate APIs that decouple their use |
| 13 | cases. |
| 14 | - Tool call arguments that the model is expected to generate should be deserialized as regular |
| 15 | `String`s with feature-specific path handling code. |
| 16 | |
| 17 | ## Migration requirements |
| 18 | |
| 19 | Keep these requirements in mind while migrating code to conform with the above guidelines: |
| 20 | |
| 21 | * existing app-server clients keep sending and receiving legacy native-path strings |
| 22 | * app-server can retain and manipulate foreign-platform path URIs |
| 23 | * exec-server APIs use file:// URIs |
| 24 | * local-only operation must not change model-visible text |
| 25 | * model tool arguments may contain raw relative or absolute paths for any OS |
| 26 | * path reasoning must work before the related environment has come online |
| 27 | * URIs cannot explicitly encode the executor’s path convention or operating system |
| 28 | * users must not configure the environment’s OS/path convention explicitly |
| 29 | * URIs should not yet be stored in rollouts, databases, or other persistent storage |
| 30 | * path conversion errors: fail-closed for security-relevant paths, fail-open for UI/diagnostics |
| 31 | * prefer small focused methods on `PathUri` or `LegacyAppPathString` over local helpers |
| 32 | * represent `PathUri` values as URIs in diagnostics |
| 33 | |
| 34 | It is OK if the conversion between paths and URIs is somewhat lossy as long as it will do the right |
| 35 | thing for real users. |
| 36 | |
| 37 | Migrating to URIs should not add significant new failure modes. We will need to surface errors in |
| 38 | some places that were previously infallible but it should be kept to a minimum. |