Add a cross-agent intent map to prevent overlapping edits
What feature would you like to see?
When multiple Codex agents work in parallel on the same project, they should publish a lightweight map of the components, files, or responsibilities they intend to modify before substantial editing begins.
Codex can coordinate parallel agents and worktrees, but overlap is often discovered only after two agents have already edited the same area. At that point, the parent agent must reconcile conflicting implementations, duplicate work, or incompatible assumptions.
The goal is not to introduce rigid file locking. It is to make planned overlap visible early enough for the orchestrator or user to adjust task boundaries.
Example
A parent agent delegates:
- Agent A: implement password-reset API;
- Agent B: update authentication UI;
- Agent C: add integration tests.
During exploration, both A and B decide to modify src/auth/session.ts, while C plans to rewrite the shared auth fixtures.
Before editing, the system could expose:
Potential agent overlap detected:
Agent A
- owns: password reset service and API route
- intends to modify: src/auth/session.ts, src/auth/reset.ts
Agent B
- owns: authentication UI
- intends to modify: src/auth/session.ts, src/ui/reset-form.tsx
Agent C
- owns: integration coverage
- intends to modify: tests/fixtures/auth.ts
Conflict risk: src/auth/session.ts
Suggested action: assign session changes to Agent A and have Agent B consume the resulting interface.
Proposed behaviour
Each active agent should be able to publish and update an intent record containing, where practical:
- task responsibility or semantic ownership;
- files, directories, symbols, schemas, migrations, or APIs likely to change;
- whether an intended change is exploratory, read-only, additive, or destructive;
- dependencies on another agent's output;
- current phase: exploring, editing, validating, blocked, or complete;
- confidence in the predicted change surface.
The parent/orchestrator should compare these records and flag likely overlap before conflicting writes occur.
This should be advisory, not a hard lock
Predicted file ownership will sometimes be wrong because agents discover the real change surface during implementation. The intent map should therefore:
- allow agents to revise their declared scope;
- distinguish predicted overlap from an actual write conflict;
- permit deliberate shared ownership when coordinated;
- avoid blocking urgent or safe work automatically;
- escalate high-risk overlap to the parent or user;
- support optional hard reservations only if a workflow explicitly requests them.
Useful conflict categories
- read overlap: several agents inspect the same code; normally harmless;
- additive overlap: agents add separate code to the same module; requires awareness;
- interface overlap: one agent changes an API another is consuming;
- write overlap: multiple agents intend to edit the same file or symbol;
- migration/schema overlap: multiple agents alter shared state contracts;
- validation overlap: agents run or modify the same expensive or stateful test environment.
Why this is useful
This would reduce:
- duplicated investigation and implementation;
- merge conflicts between worktrees or branches;
- incompatible parallel architectural decisions;
- agents overwriting generated files or migrations;
- wasted usage caused by work that must later be discarded;
- parent-agent synthesis complexity.
It would also make multi-agent execution easier to inspect and steer before problems become expensive.
Suggested acceptance criteria
- An agent can publish and revise its intended change surface.
- The parent agent can inspect all active intent records in one place.
- Same-file and same-symbol write intentions are flagged before editing where possible.
- Read-only overlap does not produce unnecessary blocking warnings.
- Agents can declare dependencies on another agent's planned output.
- Intent state survives compaction and remains associated with agent/thread lineage.
- A completed or abandoned agent releases its active intent automatically.
- The feature works across shared workspaces, separate worktrees, and remote agents.
- The user can override or approve deliberate overlap.
Potential implementation direction
The intent map could be represented as structured per-agent metadata maintained by the existing multi-agent control layer. Initial declarations could be based on delegated task scope, then refined after exploration and before the first write. File-watch or Git-diff events could update the map with the actual change surface and distinguish planned from observed edits.