Skip to content

Intelligent Merge workflow ​

When you need a merge ​

When an agent edits only one section of a long document, its output (r0/draft.tex or r1/draft.tex) may contain just the modified fragment rather than the full file. Running latexdiff directly between a partial fragment and the full original produces a broken diff.

Intelligent Merge runs the merge agent to splice the edited fragment back into your full Base File, producing a complete .tex document that you can compile and compare cleanly with latexdiff.

spectral-gap.texBase · full
\section{Introduction}
Spectral graph theory studies…
\section{Preliminaries}
Let G be a d-regular graph…
\section{Spectral Gap}
The gap d − λ₂ governs…
r1/spectral-gap.texEdited · partial
% only the revised section
\section{Spectral Gap}
The gap d − λ₂ tightly bounds
the mixing time of the random walk…
% (other sections omitted)
mergeClaude Opus 5synthesizes a complete document
r0/spectral-gap.texComplete
\section{Introduction}
\section{Preliminaries}
\section{Spectral Gap}
The gap d − λ₂ tightly bounds
the mixing time of the random walk…
valid latexdiff input vs spectral-gap.tex

The full Base File and the agent's partial Edited File both feed the merge agent, which emits a complete merged document: the valid latexdiff input.

The merge workflow ​

Open the merge action from the "LaTeXDiffs" section ( LaTeXDiffs) in the main TeXRA interface:

LaTeXDiffs
Base1
spectral-gap.tex
Edited
2
r1/spectral-gap.tex

The LaTeXDiffs section: pick an Edited File, then select the highlighted Merge action in the Edited row. Merge writes into the agent panel's primary Input file.

  1. Select the base file: Merge uses the primary Input file selected in the agent panel (the first input file) as the document to merge changes into. The LaTeXDiffs "Base File" dropdown ( Base) is used by Diff, Compare, and Accept, not by Merge. If no input file is selected, TeXRA says "Choose both the input and edited files to merge."
  2. Select the edited file: Choose the document containing the suggested changes from the "Edited File" dropdown ( Edited).
  3. Select Merge: Select the "Merge" button () in the "Edited File" row. The merge runs on TeXRA's helper model, set from Settings → Models → Models. Models with strong reasoning (such as Claude Opus 5, GPT-6 / GPT-5.6, or Gemini 3.1 Pro) are recommended for complex merges.

There is a second entry point. In the ProgressBoard, each generated output file has a Merge edits action ("Merge edits into the workspace file") that runs the same merge agent against the corresponding workspace file, with no dropdowns to fill in.

Extension and desktop feature

The Intelligent Merge action pairs a base file with a separate Edited File, which the VS Code extension and the desktop app supply through their file pickers and the ProgressBoard. The texra run CLI command takes only --input/--context files and has no edited-file slot, so this merge workflow is not available from the CLI.

Output ​

The merge agent writes the combined document to run storage under the base file's name (r0/<base filename>.tex) and streams its progress in the ProgressBoard. Once the run completes, compare r0/<base filename>.tex against your original file with latexdiff (or accept the merged file back into the workspace).

Next steps ​

  • LaTeX Diff: Learn how to use latexdiff to compare the merged file with your original.
  • Built-in agents: Review the agents whose outputs you might want to merge.