The stack repository and the merge
The platform writes its output to a branch nobody else writes to, then merges that branch into the branch your team and your deployments use. Your edits and your application code live on the second branch and survive every build.
The branches
Both branch names are set on the system's configuration page;
by convention the generated branch is called stacktic and the build branch main.
| Branch | Configuration key | Written by | What it holds |
|---|---|---|---|
| Generated branch | git_branch | The platform only | Exactly what the last build rendered: every manifest, policy, Job, script and document. It is overwritten on every build |
| Build branch | build_branch | The platform, by merging; your team; the MCP server | The generated output merged in, plus everything people add: application code under apps/<name>, edits to generated files, notes |
| Evidence branch | fixed name evidence | The stack agent, when its evidence_push attribute is on | A copy of every saved scan run, so the audit trail has a record the agent cannot rewrite in place |
The generated branch answers "what does the design render". The build branch answers "what does the stack run".
What a build writes
The build log shows these steps in this order.
The per-file choices from the divergence list on the build page: ignore is stored on the system and kept for later builds; overwrite applies once.
Each component is rendered from its template, then the stack-wide steps run (metadata, network policies, checksums, air-gap rewrite).
The generated branch is fetched and reset to the remote, every generated file is copied in, and every file the generator did not produce is deleted, empty folders too. Then it is committed and pushed.
The build branch is fetched and reset to the remote, so commits pushed by people or by the MCP since the last build are part of the merge. Then the per-file merge below runs.
A file that the generator did not produce is deleted from the generated branch at the next build. Application code pushed there is gone the next time anyone builds. Commit to the build branch.
The merge, file by file
The merge compares three versions of every file: the generated commit that was last merged into the
build branch (the base), the newest generated commit, and the newest commit on the build branch.
On the very first merge there is no base, and a plain git merge runs.
| What happened to the file since the last merge | Result on the build branch | Log section |
|---|---|---|
| It is on the stored ignore list | Never touched, whatever changed | IGNORED |
| It is on the overwrite list | Replaced by the generated version, even if someone edited it | OVERWRITTEN |
| Changed only by the generator | The change is applied: added, changed or removed | ADDED · CHANGED · REMOVED |
| Changed only on the build branch, by a person or the MCP | Kept as they left it | — |
| Deleted on the build branch but still generated | Brought back from the generated branch | RESTORED |
| Changed on both sides, no overlap | Merged line by line | MERGED |
| Changed on both sides, overlapping | Build: committed with conflict markers and listed for review. Save & Push: refused, see below | ATTENTION |
Exists only on the build branch, never generated (apps/…, notes) | Untouched | — |
After the merge, kustomize build runs for every kustomization folder that contains a changed file,
and the result is logged under KUSTOMIZATION. A failure there is reported, not fatal.
The merge commit has two parents, the build branch and the generated branch, and the message
Merge <generated branch> into <build branch>. Its author is the person who started the build; its
committer is the stack's git user. If the remote refuses the push, the build fails and says so.
Which actions merge
| Action | Writes the generated branch | Merges into the build branch |
|---|---|---|
| Build, Fast Build or Full push from the build page | Yes | When Merge is ticked; conflicts are committed with markers and listed under ATTENTION |
| Save & Push, from the design page or the API | Yes, only the files the changed attributes affect | Always. A conflict blocks the push: the build branch is left untouched and the log says "Run a Build or Fast Build to resolve them" |
A build started through the API (the MCP's stacktic_system(action='build')) | Yes, with the commit message "API build" | No. Merge it later with a Save & Push, or a build from the page with Merge ticked |
Anything that deploys from the build branch — Argo CD, the stack agent's deploy arm, a CI job of yours — sees an API build only after the next merge.
Keeping a change of yours
| You want | Do this |
|---|---|
| Edit a generated file and keep the edit | Edit it on the build branch. It survives every build until the generator changes the same lines; then the file is merged, or flagged ATTENTION |
| Keep a file exactly as you left it, forever | Mark it ignore in the divergence list. From then on the platform never touches it |
| Throw your edit away and take the generated version | Mark it overwrite for one build |
| Remove a generated file | Remove what generates it from the design. Deleting it on the build branch does not stick: the next merge restores it. Or mark it ignore |
| Resolve ATTENTION files | Do not deploy that state. Fix the files on the build branch, or choose merge, overwrite or ignore for them in the divergence list and build again |
Where your application code lives
An application component whose code is in the stack repository keeps it on the build branch, one
folder per application under apps/<name>. The component's branch attribute names the build
branch; its build Job clones that branch.
The MCP server follows the same rule. It writes only under apps/, only on the build branch, and
signs its commits "Stacktic MCP". When a stack has no separate build branch, it refuses to write and
asks for the application to get a repository of its own. A repository per application is equally
supported; then the stack repository holds only generated files.
Who reads which branch
| Reader | Branch |
|---|---|
| Argo CD Applications | The branch or tag in the Argo CD component's argocd_target_revision — normally the build branch |
| Image builds | The application component's branch (for code in the stack repository, the build branch) |
| The stack agent's deploy arm | The repository and branch named in the deploy request; nothing uncommitted is ever applied |
| The stack agent's metadata | stack-metadata.yaml from the generated branch |
The MCP server's reads (stack_repo, stack_graph) | The generated branch: what the design renders, not what people edited. It writes application code to the build branch |
→ Systems and builds · Build and deploy · From graph to repository