# Repository integration

The integration target is `dev`. `main` has an independent history and is written only by `scripts/publishing/publish-github.sh` (see [Publishing source to GitHub](https://fzkuji.github.io/OpenProgram/docs/reference/design/distribution/github-publishing.html)).

## Boundary

| Area | Rule |
| --- | --- |
| Audit | Each branch at its committed head; uncommitted files stay in their worktrees |
| Preparation | In an isolated clean checkout |
| Branch deletion | A separate operation |
| Stays authoritative | The Agent and Context refactor; the official Anthropic API requirement |

## Merge decisions

| The branch change | Decision |
| --- | --- |
| Is an ancestor | Already contained |
| Is duplicate or superseded, often patch-equivalent with a different commit id | Keep the current implementation; record the branch ancestry only after comparing its unique patches |
| Is genuinely new | Normal content merge |
| References removed APIs | Keep the newer implementation |
| Updates dependencies | Resolve together into one lockfile |
| Blanket remote overwrite, or blanket acceptance of historical files | Rejected |

## Verification

| Item | Requirement |
| --- | --- |
| Branch inventory | Exact heads, containment, patch comparisons, reviews and remaining checks, in a private delivery ledger |
| Ancestry | Every inventory head is an ancestor of the combined commit |
| Checks on that commit | Repository contracts, affected public checks, dependency lock validation, Web tests, documentation checks |
| Existing failures | Stay recorded as incomplete; never passing evidence |
| Conflicts or failed writes | Candidate and original refs are preserved |

## Delivery

`openprogram dev deploy`; see [Stable and development instances](https://fzkuji.github.io/OpenProgram/docs/reference/design/distribution/dev-instance.html). App acceptance uses the development instance, the `dev` profile on port `18200`; the stable App is the official release and changes only through its own updater.
