# Keep custom code during regeneration

Commit changes you want to retain to the configured base branch, usually `main`.
The generation PR compares those changes with the next generated output. Review
that diff before merging; resolve overlapping edits on the base branch and rebuild.

Use `custom.keep` for files your team owns completely. An ownership rule is
different from preserving selected lines inside a generated file. Keep paths
specific and review their effect on the next PR.

For edits inside generated files, commit the change to the base branch and inspect
the next regeneration. A conflict needs a resolution; regeneration is not evidence
that every custom edit applied successfully. Do not resolve the conflict by editing
only the rolling `doctorine-next` branch and assuming the next run will retain it.

Doctorine-managed workflow and metadata files are regenerated by design. Avoid
using them as the only copy of a custom integration. Keep independent automation
in separately owned files and review the linking dialog's managed-file inventory.

Tracked customization history, per-patch states and **Forget** are not promised
by this guide. Use those features only when they are explicitly available in your
project; they require a separate rollout and verification.

Generated source already in your repository remains yours when you stop using
Doctorine. Keep your normal Git history and review practices; see
[Plans and offboarding](/guides/plans-and-offboarding/).

## Related pages

- [Doctorine SDK documentation](../index.md)
- [Publish SDKs to registries](./publish-sdks.md)
- [Set up a registry publisher](./registry-setup.md)
- [Doctorine App permissions](./app-permissions.md)
- [Plans, disable and offboarding](./plans-and-offboarding.md)
- [Troubleshoot an SDK release](./troubleshooting.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
