CODEX RESET RADAR Codex Reset Radar
中文
PRO TIPS · Field Playbooks

Refactoring Legacy Code with Codex: Let It Play Archaeologist Before It Plays Worker

Updated: 2026-10-18~3 min readsources × 2

TL;DRAgents execute well and plan poorly — that judgment from a high-scoring HN thread is exactly the division of labor a legacy refactor needs: phase one, Codex plays archaeologist (read-only, producing structure docs); phase two, it plays worker (small steps against a plan you confirmed).

Sources SOURCES

Distilled from public community discussions. This page only breaks them down and verifies — it never reposts the original; opinions belong to their authors.

Facts FACTS

Check these claims against the listed sources. For allowance mechanics, first-party account displays outrank community summaries.

Concepts CONCEPTS

Not everything said in a community thread is a fact — each concept carries its nature label. Read the label first.

The two-phase splitCommunity opinion

Phase one, 'archaeology': read-only — produce a module map, a dependency list, and a list of risk points. Phase two, 'construction': you convert the map into an ordered refactor plan, and Codex executes it in small steps. Never mixing the two phases is the most direct countermeasure to design blind spots.

Small steps plus a safety netCommunity opinion

The construction discipline the community agrees on: one verifiable transformation per step, backed by tests or a rollback path. The dependency list from phase one is exactly what decides 'where it is safest to cut first.'

Understanding is an asset tooUnverified hypothesis

Phase-one output — the module map — is team property in its own right: onboarding new hires and paying down documentation debt both draw on it. That is the standalone payoff for spending half a day on read-only work.

Takeaways TAKEAWAYS

Why not just tell Codex to 'refactor this module properly': the mechanistic explanation from the HN thread is that an agent never asks 'why was it designed this way' — it optimizes away the surface patterns and drags the implicit constraints down with them. Archaeology before construction is really about handing the 'ask why' step back to a human.

Phase-one acceptance can be very concrete: have Codex produce a list of 'which callers break if this function changes,' then spot-check three call sites by hand. All three check out and the map is trustworthy; any miss, shrink the scope and redo it.

Phase-two task granularity caps at 'one commit tells one story': change one thing, run the tests, commit. Let the granularity grow and the agent's design blind spots seep right back in.

When you may break the two-phase rule: a small refactor touching a single file with no external callers — let Codex one-shot it and run the tests. Blind-spot risk scales with blast radius.

Want today's verdict? Back to the live radar.

More Field Playbooks playbooks SAME CATEGORY

🎯 Any confirmed public reset today?
Open the signal radar for sourced announcements; personal allowance and exact reset time remain in Usage.
Open the signal radar →