Skip to content

First run ​

With TeXRA installed, this walkthrough guides you through running your first agent—polish—on a .tex document. The process takes under five minutes and illustrates both the VS Code extension and the terminal CLI side by side.

If you don't have TeXRA yet, read the installation guide.

Fresh install?

On a fresh install, the setup assistant offers to run this flow conversationally: it checks your environment, asks what you're working on, and runs the same polish demo, ending at the diff. Start it any time with TeXRA: Run Setup Assistant from the Command Palette in VS Code, or texra setup in the terminal. This page is the manual mirror of that conversation.

Step 0: add a key or connect a subscription ​

A credential is the one step no agent can do for you. Three ways in:

  • Use your own provider API key: Anthropic, OpenAI, Google, and more. Read Quick start: add a key or connect a subscription.
  • Use a ChatGPT subscription: Codex models through your ChatGPT plan. In VS Code, open Settings → Models → Subscriptions and use the ChatGPT sign-in section; in the terminal, run texra auth chatgpt login. Grok connects from the same place; Kimi Code and the GLM Coding Plan take a key under Settings → Models → API keys.
  • Use GitHub Copilot in VS Code: compatible models through your Copilot subscription. Open Settings → Models → Subscriptions → Copilot in VS Code and grant access in the native VS Code prompt. No provider API key is needed. This source is unavailable in the terminal and desktop applications.

What you'll do ​

  1. Get a sample .tex file.
  2. Run the polish agent with one instruction.
  3. Read the diff.

Get a sample file ​

If you already have a working draft, skip this step. Otherwise:

In VS Code ​

Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and run TeXRA: Create Sample Project. This creates a ready-to-run workspace at texra-sample/draft.tex.

In the terminal ​

Any .tex file works. If you want a quick test file:

sh
cat > draft.tex <<'EOF'
\documentclass{article}
\begin{document}
The proposed method achieves significant improvements over the baseline,
which is something that is very important for the field, and we will
demonstrate this in the following sections through various experiments.
\end{document}
EOF

Run polish ​

In VS Code ​

  1. Open draft.tex.
  2. Select the TeXRA icon in the Secondary Side Bar.
  3. In the Input section, select Add files and pick draft.tex from the file picker.
  4. Pick polish under Agent. Pick anthropic/claude-sonnet-5-5 under Model (or any available model).
  5. Type an instruction:

    Tighten the prose. Preserve all math and citations.

  6. Press Execute.

The ProgressBoard opens and streams the run. When it finishes, a diff icon appears on the completed stream. Select it to see what changed.

In the terminal ​

sh
texra run polish \
  --input draft.tex \
  --instruction "Tighten the prose. Preserve all math and citations."
texra run
$texra run polish --input draft.tex --instruction "Tighten the prose. Preserve all math and citations."
  • Revision 1: draft · r0/draft.tex written
  • Revision 2: critique, rereading its own output

Mid-run: the first revision is written and the second is critiquing and revising it. The live status line on stderr tracks the current revision. When the run completes, the path to the final document prints on stdout.

The run streams reasoning, tool calls, and the assembled output. When it completes, polish has written one folder per revision in the run's storage folder (executions/<run-id>/ under TeXRA's workspace storage):

executions/one folder per round · input filename preserved
<run-id>/
r0/first revision
  • draft.texreads draft.tex, applies your instruction
r1/critique pass · final
  • draft.texrereads r0, revises again
draft.polished.tex--outputwritten next to your input instead

Each revision lands in its own folder and keeps the input filename: r0/draft.tex is the first revision, r1/draft.tex the critique pass and final. Add --output draft.polished.tex to write the result next to your input instead.

To diff against your original, use the final-document path printed on stdout:

sh
diff -u draft.tex <path-to-r1/draft.tex-from-stdout>

What just happened ​

Polish ran two passes: a first revision, then a critique pass that rereads its own output and revises again.

1Revision 1: draft

Reads draft.tex, applies your instruction, writes the first revision.

r0/draft.tex
2Revision 2: critique

Rereads its own first revision, then revises again.

missing mathweakened sentencesgeneric fillerout-of-scope editsr1/draft.tex

Polish is a two-revision document task: the first revision drafts from your instruction, the second critiques its own output against a fixed checklist and revises into r1/draft.tex.

A document task like polish does not call tools. It reads input, runs its revisions, and writes a diff. The next step up, agents with tools, can read across your project, search literature, verify algebra in Wolfram, prove theorems in Lean 4, and compile LaTeX. Read the built-in agents catalog.

Next steps ​

  • Polish a draft: the document task in depth: revisions, limits, multi-file projects
  • Built-in agents: the full catalog, including correct, research, review, and lean
  • Models: choosing a model that matches the work
  • TeXRA CLI: sign-in, workspace defaults, headless output formats
  • LaTeX Diff: compiled PDF comparison of revisions