Skip to main content

The stack repository and the merge

Repository
One branch the platform owns, one branch you own

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.

stackticgenerated · git_branchmainbuild · build_branchevidencestack agent onlybuildsave & pushAPI buildbuildapps/<name> commitnot mergedone commit per scan runREADS MAINArgo CDimage buildsdeploy armyour teamMerge stacktic into main
The generated branch is rewritten by every build and merged into the build branch, where your application code and edits live. The stack agent keeps evidence on its own branch. Everything that deploys reads the build branch.

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.

BranchConfiguration keyWritten byWhat it holds
Generated branchgit_branchThe platform onlyExactly what the last build rendered: every manifest, policy, Job, script and document. It is overwritten on every build
Build branchbuild_branchThe platform, by merging; your team; the MCP serverThe generated output merged in, plus everything people add: application code under apps/<name>, edits to generated files, notes
Evidence branchfixed name evidenceThe stack agent, when its evidence_push attribute is onA 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.

Defining ignore and overwrite files

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.

Generate every component

Each component is rendered from its template, then the stack-wide steps run (metadata, network policies, checksums, air-gap rewrite).

Push to the generated branch

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.

Merge into the build branch (when merge is on)

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.

Never commit to the generated branch

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 mergeResult on the build branchLog section
It is on the stored ignore listNever touched, whatever changedIGNORED
It is on the overwrite listReplaced by the generated version, even if someone edited itOVERWRITTEN
Changed only by the generatorThe change is applied: added, changed or removedADDED · CHANGED · REMOVED
Changed only on the build branch, by a person or the MCPKept as they left it—
Deleted on the build branch but still generatedBrought back from the generated branchRESTORED
Changed on both sides, no overlapMerged line by lineMERGED
Changed on both sides, overlappingBuild: committed with conflict markers and listed for review. Save & Push: refused, see belowATTENTION
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​

ActionWrites the generated branchMerges into the build branch
Build, Fast Build or Full push from the build pageYesWhen Merge is ticked; conflicts are committed with markers and listed under ATTENTION
Save & Push, from the design page or the APIYes, only the files the changed attributes affectAlways. 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 wantDo this
Edit a generated file and keep the editEdit 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, foreverMark it ignore in the divergence list. From then on the platform never touches it
Throw your edit away and take the generated versionMark it overwrite for one build
Remove a generated fileRemove 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 filesDo 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​

ReaderBranch
Argo CD ApplicationsThe branch or tag in the Argo CD component's argocd_target_revision — normally the build branch
Image buildsThe application component's branch (for code in the stack repository, the build branch)
The stack agent's deploy armThe repository and branch named in the deploy request; nothing uncommitted is ever applied
The stack agent's metadatastack-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