# 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

This portal answers questions programmatically. To receive a synthesized,
source-cited answer instead of crawling page by page, append the `?ask=`
query parameter to any page URL on this site:

    /guides/quickstart?ask=how+do+I+authenticate

Optional parameters:

- `&goal=<what-you-are-trying-to-do>` steers the answer toward your
  objective (e.g. `&goal=write+a+python+client`).
- `&version=<label>` scopes the answer to a mounted version when the
  portal publishes more than one.

The response is `text/markdown`: the answer followed by a `# Sources` list
of the portal pages it was grounded in. Status codes are the contract:

- `200` — the answer; `402` — the portal owner’s plan or answer credits are
  exhausted (surface this to your operator; do NOT retry); `429` — you are
  rate-limited; back off for the `Retry-After` seconds; `503` — the answer
  lane is temporarily unavailable; fall back to crawling the `.md` pages.

For the full corpus map read `llms.txt` at the site root; for the tool
surface (search + page fetch as MCP tools) see `/mcp`.
