AuxFlow
Static analysis and build planning for multi-pass document compilation.
AuxFlow is a compiler and static analyzer for LaTeX documents. It builds an instance-level dependency graph of cross-references, detects feedback cycles, and predicts how many passes the document needs to stabilize. All static checks complete before the typesetting engine runs.
Overview
Document compilers like LaTeX are multi-pass systems. They write cross-references, table of contents entries, and citations to auxiliary files. The engine reads these files on subsequent passes to resolve references.
Most build tools discover the required pass count dynamically. They run the engine repeatedly until auxiliary files stop changing, or they apply a fixed schedule.
AuxFlow takes a compiler approach:
- It parses the LaTeX source once into an Abstract Syntax Tree (AST).
- It resolves label, reference, and citation symbols across all files.
- It constructs an Intermediate Representation called the Auxiliary Reference Graph (ARG).
- It detects cycles with Tarjan's strongly connected components algorithm.
- It tracks values that affect document length using forward taint analysis.
- It classifies document convergence and generates an optimized build plan.
How It Works
AuxFlow implements a complete compiler pipeline:
Source (LaTeX subset)
|
v
Lexer Category codes 0-15
|
v
Parser Recursive descent (1-token lookahead)
|
v
AST Multi-file forest and inclusion graph
|
v
Semantic Analysis Symbol tables and static diagnostics
|
v
Auxiliary Reference Graph (ARG) Fact instances with lagged typed edges
|
v
Static Taint Analysis Forward reachability to content volume
|
v
SCC and Fixpoint Analysis Tarjan SCC, stable-pass recurrence
|
v
Classification CERTIFIED, BENIGN_CYCLIC, AMPLIFYING, UNKNOWN
|
v
Build Plan Optimized schedule with tool elimination
|
v
Runtime Verification Normalized auxiliary fixpoint check
1. Lexer and Parser
The lexer implements the sixteen TeX category codes in a single-pass scanner. It preserves source locations and tracks comments and verbatim blocks. The recursive-descent parser uses a signature table for macro arguments. It recovers from malformed input without stopping.
2. Multi-File Symbol Resolution
The semantic analyzer resolves cross-references with a two-pass algorithm. The declare pass records all definitions. The resolve pass binds uses across file boundaries.
3. The Auxiliary Reference Graph (ARG)
The ARG is AuxFlow's Intermediate Representation. Each vertex is a concrete fact instance with an exact source location. Edges carry dependency types and pass lags:
AUX_ROUNDTRIP(lag 1): Reads a fact written during the previous run.TOOL(lag 1): Represents external tools like BibTeX.LAYOUT(lag 0 or 1): Models pagination and list extents.
List entries split into exists (structural presence) and value (typeset page) facts. This separation keeps standard documents acyclic.
4. Convergence Classification
Documents classify into one of four states:
CERTIFIED: Acyclic dependency structure. Settle within a derived pass count ($P + 1$).BENIGN_CYCLIC: Value-only cycles. Settle safely without changing document content volume.AMPLIFYING: Reference values control content generation. May diverge infinitely. Refused by default.UNKNOWN: Contains unmodelled packages or macros. Falls back to a conservative default schedule.
5. Build Planner and Runtime Verifier
The planner removes unused files and unnecessary tool invocations. It derives the minimal engine run count for certified documents. At runtime, the verifier normalizes auxiliary files into canonical records and checks for a genuine fixpoint.
CLI Usage
Python 3.12 or later is required. On systems with an externally managed Python (for example Arch Linux), install into a virtual environment:
python -m venv .venv
source .venv/bin/activate # bash or zsh
source .venv/bin/activate.fish # fish
pip install -e ".[dev]"
The prompt shows (.venv) after activation. Use pip install -e . instead if you do not need the test, type-check, and lint tools. To skip activation, call .venv/bin/auxflow directly.
Check the install:
auxflow classify bench/corpus/b01_plain/main.tex
Inspect the compiler pipeline on any document:
# Print tokens with source positions
auxflow tokens document.tex
# View the multi-file AST
auxflow ast document.tex
# Inspect symbol tables (labels, refs, cites, packages)
auxflow symbols document.tex
# Run zero-engine semantic checks
auxflow check document.tex
# Export the Auxiliary Reference Graph in Graphviz DOT format
auxflow graph document.tex
# Classify document convergence
auxflow classify document.tex
# Inspect the generated build plan
auxflow plan --explain document.tex
# Execute the plan with runtime verification
auxflow run document.tex
Human-readable output is coloured when it goes to a terminal. Set NO_COLOR=1 or pass --color never to turn colour off. Pass --color always to keep it in a pipe. JSON, DOT, token and AST output is never coloured. classify ends with a short "In plain terms" sentence. check and run print a one-line summary on stderr, so stdout stays machine-readable.
Run auxflow help for an overview of every command, typical use, and exit codes. Run auxflow help COMMAND for the options of one command.
The images show real command output rendered from a pseudo-terminal.
Tab completion
AuxFlow completes commands, options, --color values, and .tex file names in bash, zsh, and fish. Load it for the current shell:
eval "$(auxflow completion bash)" # bash
eval "$(auxflow completion zsh)" # zsh
auxflow completion fish | source # fish
Add that line to ~/.bashrc, ~/.zshrc, or ~/.config/fish/config.fish to keep it. The scripts are generated from the command parser, so they list every command and option.
Quick demonstrations
The quickstart examples show a certified reference, a multi-file contents list, and a document with an amplifying cycle. The examples include commands and expected classifications.
For a project with a custom class or packages, start with auxflow check FILE and
auxflow classify FILE. UNKNOWN means that AuxFlow cannot establish the static bound.
It does not mean the document fails to compile. Do not treat package discovery as
proof that a package's typesetting effects are modelled.
Benchmark Corpus and Evaluation
The repository includes a 15-member benchmark corpus (bench/corpus/) covering non-convergence mechanisms and standard document structures:
- Monotone divergence loops (Gaspar 2014)
- Line-break width feedback oscillations
- Float placement oscillations
- Dynamic textual references (
varioref) - Conditional font size switches (
ifthenelse) - Same-page citation feedback (
biblatex) - Realistic multi-chapter thesis with table of contents, lists, and bibliography
Run the end-to-end demonstration script:
bash bench/demo.sh
Full experimental data from 1,050 containerized runs across 7 baselines is documented in docs/EVALUATION-REPORT.md and docs/GATE-REPORT.md.
Documentation
| Document | Description |
|---|---|
| docs/PROJECT.md | Project specification and open decisions |
| docs/COMPILER-PIPELINE.md | Detailed compiler phase descriptions and algorithms |
| docs/LANGUAGE-SUBSET.md | Supported LaTeX subset and fallback policies |
| docs/IR.md | Auxiliary Reference Graph specification |
| docs/STATIC-ANALYSIS.md | Taint analysis, SCC algorithms, and stable-pass recurrence |
| docs/NON-CONVERGENCE.md | Diagnostic format and error reporting |
| docs/BUILD-PLANNER.md | Plan lowering passes and safety invariants |
| docs/RUNTIME-VERIFICATION.md | Canonical state normalization and fixpoint detection |
| docs/BENCHMARKS.md | Benchmark corpus design and oracle specifications |
| docs/EVALUATION.md | Measurement methodology and baselines |
| docs/EVALUATION-REPORT.md | Full empirical evaluation results |
| docs/GATE-REPORT.md | Verification results for Gate 1 and Gate 2 |
| docs/RELATED-WORK.md | Literature review and technical comparison |
License
MIT. See LICENSE.
Metadata
Release files for auxflow 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| auxflow-0.1.0.tar.gz | 5.7 MB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| auxflow-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.8 MB
Release files / auxflow-0.1.0.tar.gz
| Download URL | auxflow-0.1.0.tar.gz |
|---|---|
| Size | 5.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7869c04ac19db93fe96e61cb84343cefbc67a8c1f98d024a3daa9946012f489f
|
|
BLAKE2b-256 checksum How to use checksums |
2e6a7685c6f8d732c90d1b2f072133b58a222587dbbd4c30a5230d51179d65d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logRelease files / auxflow-0.1.0-py3-none-any.whl
| Download URL | auxflow-0.1.0-py3-none-any.whl |
|---|---|
| Size | 72.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9ac69cf9857a0494ab7cbb8f88d59c735886fa2a8180875badd9b85f3ec308f0
|
|
BLAKE2b-256 checksum How to use checksums |
cd20b539d612a1242cee0cb98f3530cab2efc3e578ddefdb96f1dc3506896b0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logSecurity for auxflow 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for auxflow-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.