Skip to content
LexBuild
On this page

Configuration

The LexBuild CLI is configured entirely through command-line flags. There is no configuration file and no environment variables. This keeps the tool stateless and reproducible — the same command always produces the same output.

Default Directories

PurposeDefault PathOverride Flag
USC XML downloads./downloads/usc/xml/download-usc -o <dir>
eCFR XML downloads./downloads/ecfr/xml/download-ecfr -o <dir>
FR downloads./downloads/fr/download-fr -o <dir>
Converted output./output/convert-usc -o <dir>

Output Directory Behavior

The -o flag on convert commands specifies a base output directory. LexBuild automatically appends source-specific subdirectories:

lexbuild convert-usc --all -o /data/legal
# Writes to: /data/legal/usc/title-01/...

lexbuild convert-ecfr --all -o /data/legal
# Writes to: /data/legal/ecfr/title-01/...

lexbuild convert-fr --all -o /data/legal
# Writes to: /data/legal/fr/2026/01/...

This means you can point all three sources at the same base directory and they will not conflict.

Cross-references between legal sections (e.g., “see section 101 of title 17”) are rendered according to the --link-style flag.

StyleDescriptionExample Output
plaintext (default)No links, citation text onlysection 101 of title 17
relativeRelative Markdown links within the corpus[section 101 of title 17](../../title-17/chapter-01/section-101.md)
canonicalAbsolute URLs to official sources[section 101 of title 17](https://uscode.house.gov/view.xhtml?req=...)

When to use each style:

  • plaintext — best for AI/RAG ingestion where links add noise. This is the default.
  • relative — best when you want navigable cross-references within the converted corpus. Links that cannot be resolved within the corpus fall back to official source URLs.
  • canonical — best when you want every reference to link to the authoritative online source.
lexbuild convert-usc --all --link-style relative
lexbuild convert-ecfr --all --link-style canonical

Notes Inclusion

By default, all notes are included in the output: editorial notes, statutory notes, and amendment history. You can disable notes entirely or include specific categories.

Disable All Notes

lexbuild convert-usc --all --no-include-notes

Selective Inclusion

When you set any selective flag, the broad --include-notes is automatically turned off. Only the categories you specify are included.

# Editorial notes only (e.g., transfer notices, cross-references)
lexbuild convert-usc --all --include-editorial-notes

# Statutory notes only (e.g., effective date provisions, short titles)
lexbuild convert-usc --all --include-statutory-notes

# Amendment history only
lexbuild convert-usc --all --include-amendments

# Combine selective flags
lexbuild convert-usc --all --include-editorial-notes --include-amendments

These flags apply to both USC and eCFR conversion commands.

Granularity

Granularity controls how much content is written to each output file. Available levels vary by source.

U.S. Code

LevelOutput
section (default)One .md per section, organized in chapter directories
chapterOne .md per chapter, all sections inlined
titleOne .md per title, entire hierarchy inlined

eCFR

LevelOutput
section (default)One .md per section, organized in part/chapter directories
partOne .md per part, all sections inlined
chapterOne .md per chapter, all parts and sections inlined
titleOne .md per title, entire hierarchy inlined

Federal Register

FR documents are inherently atomic. There is no granularity option — each document always produces a single .md file.

lexbuild convert-usc --all -g chapter
lexbuild convert-ecfr --all -g part

Dry Run

Use --dry-run to parse XML and report statistics without writing any files. This is useful for previewing output size or verifying your options before a long conversion run.

lexbuild convert-usc --all --dry-run
lexbuild convert-ecfr --titles 17 --dry-run -g part

The dry run reports section counts, chapter/part counts, and estimated token counts for each title processed.

Source Credits

Source credit annotations (statutory provenance text like “(July 30, 1947, ch. 388, 61 Stat. 633.)”) are included by default. Disable them with:

lexbuild convert-usc --all --no-include-source-credits

Verbose Output

Add -v or --verbose to see the path of every file written:

lexbuild convert-usc --titles 1 -v

Quick Reference

WhatFlagDefault
Output directory-o, --output./output
Granularity-g, --granularitysection
Link style--link-styleplaintext
Include all notes--include-noteson
Disable all notes--no-include-notes
Editorial notes only--include-editorial-notesoff
Statutory notes only--include-statutory-notesoff
Amendments only--include-amendmentsoff
Source credits--include-source-creditson
Dry run--dry-runoff
Verbose-v, --verboseoff

For the full list of flags on every command, see the CLI Reference.