Skip to content

Smart Apply

Smart Apply detects stale-file conflicts — where a file changed between the last read and the current edit attempt — and recovers gracefully rather than corrupting the file or silently applying a bad patch.

[options.smart_apply]
enabled = true

When an agent reads a file, reasons about it, and then edits it, there’s a window where another process (or a previous agent turn) could have modified the file. Without Smart Apply, a diff-based edit would either fail with a conflict error or silently apply to the wrong line range.

With Smart Apply enabled, BMO detects the mismatch and uses a fuzzy re-anchor strategy to find the correct insertion point even when line numbers have shifted.

Enable Smart Apply when:

  • Running multiple concurrent agents that may edit overlapping files
  • Working in a codebase with fast-changing files (active CI, other developers)
  • Using long-running sessions where context is summarized and re-anchored

It’s safe to leave enabled by default — the overhead is negligible.

  • bmo config show-apply-patch shows whether Smart Apply is enabled and whether LLM-assisted merge is configured. This is the config-only view.
  • /smart-apply and /apply-patch show the live in-process posture plus the bounded recent event ring shared by apply_patch and Smart Apply.
  • list_recent_apply_patch_events exports recent apply_patch.fired and apply_patch.action records as JSON.