From 1dd6b0d6a7cddceb0958fd4f4d29d99955287c51 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Thu, 26 Mar 2026 14:48:06 -0700 Subject: [PATCH] docs: update AGENTS.md to discourage adding code to codex-core --- AGENTS.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index b1dbd53f39..7a81eab40c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -51,6 +51,19 @@ Before finalizing a large change to `codex-rs`, run `just fix -p ` (in Also run `just argument-comment-lint` to ensure the codebase is clean of comment lint errors. +## The `codex-core` crate + +Over time, the `codex-core` crate (defined in `codex-rs/core/`) has become bloated because it is the largest crate, so it is often easier to add something new to `codex-core` rather than refactor out the library code you need so your new code neither takes a dependency on, nor contributes to the size of, `codex-core`. + +To that end: **resist adding code to codex-core**! + +Particularly when introducing a new concept/feature/API, before adding to `codex-core`, consider whether: + +- There is an existing crate other than `codex-core` that is an appropriate place for your new code to live. +- It is time to introduce a new crate to the Cargo workspace for your new functionality. Refactor existing code as necessary to make this happen. + +Likewise, when reviewing code, do not hesitate to push back on PRs that would unnecessarily add code to `codex-core`. + ## TUI style conventions See `codex-rs/tui/styles.md`.