Your Agent's Favorite Legal Database
翻譯準備中
取自儲存庫 README
正在載入完整 README。
檢視完整 README ↗Your agent's favorite legal database.
words-to-data holds the U.S. Code, release point by release point, and the public
laws that amend it. It records which amendment made which change, and the
evidence for each record. An agent asks it questions with one command,
words_to_data, and every answer comes with something it can quote.
SLEUTH is the official agent. It runs in the pi coding agent. You need 6 GB of free disk space, and no Rust.
Install pi. The installer also installs Node.js when it is necessary.
curl -fsSL https://pi.dev/install.sh | sh
Install SLEUTH into pi, start pi, and type /login to connect a model with a
subscription or an API key. /sleuth-setup downloads the words_to_data
command for your computer (Linux, macOS or Windows) and the example dataset
(280 MB, 5.3 GB on disk), and opens the dataset. Then ask a question:
pi install git:github.com/wordstodata/sleuth-pi
pi
/login
/sleuth-setup
Where in the Internal Revenue Code is the new Trump account section, and in which printing of the Code does it first appear?
The session is read-only. SLEUTH finds the section from the words alone, and it shows the evidence. A real answer (2026-10-23), cut:
Where: the new Trump account section is 26 U.S.C. § 530A ("Trump accounts"), in a brand-new part IX ("TRUMP ACCOUNTS") added at the end of subchapter F of chapter 1:
uscode/title_26/subtitle_A/chapter_1/subchapter_F/part_IX/section_530AFirst printing: the 2025-07-30 printing of Title 26.
w2d_pathreports the section present at 2025-07-30, 2025-08-14, 2026-01-23 and 2026-07-12, … a search for "Trump account" at 2025-07-18 returns 0 fields.Source: OLRC classifies
part_IX/section_530Aas new from Pub. L. 119-21 § 70204(a)(1) (bill 119-hr-1) …
Then ask more questions, for example:
The example dataset holds:
settle --explain prints all of it. The agent quotes the record and does not
rely on what it remembers about a law.residue) with the reason it stopped. An answer is never a guess that
looks like data.cases-citing names each period the
dataset holds no printing for, and says that this is not a statement that
nothing changed. residue gives the reason each unlinked amendment stopped.--path, --work, --at and
--bill narrow a listing, and --json gives machine-readable rows.link-amendment refuses a path that did
not change. settle records a review as its own record, and nothing is deleted.
A wrong link stays visible, and the newest review stands.SLEUTH-pi is a package for the
pi coding agent. It has a tool for each
words_to_data command, the playbook as four skills (answer, residue, review,
build), and a write gate. A session is read-only unless you give it --write.
Try it with SLEUTH gives the steps to install it.
pi install git:github.com/wordstodata/sleuth-pi
pi
/dataset law.sqlite
Give the agent three things: the words_to_data binary, a dataset, and
docs/agents/working-a-dataset.md. The
playbook tells it how to answer a question with evidence, how to work the residue,
and how to review links. It needs no other tools.
In the test of the playbook (#267), six new agents answered four questions about Public Law 119-21 correctly, in 17–22 tool calls each, and worked its residue from 55 items to 3. Every answer was checked by hand.
You need about 3.5 GB of disk and a free
Congress API key. Each
release has the
command for Linux (x86_64, aarch64), macOS (Apple silicon, Intel) and Windows
(x86_64). In the file name below, use aarch64-apple-darwin (Apple silicon) or
x86_64-apple-darwin (Intel) on macOS. With Rust,
cargo install words-to-data also works.
curl -fL https://github.com/wordstodata/words-to-data/releases/latest/download/words_to_data-x86_64-unknown-linux-musl.tar.gz | tar xz
sudo mv words_to_data /usr/local/bin/
export CONGRESS_API_KEY=<your key>
words_to_data build-dataset law.sqlite --uslm-dates 2025-07-18,2025-07-30 --bills 119-hr-1
words_to_data add-classifications law.sqlite
words_to_data redesignations law.sqlite --bill 119-hr-1 --between 2025-07-18 2025-07-30
words_to_data link-by-evidence law.sqlite
That is the whole Code at two release points, and Public Law 119-21 (the reconciliation act of July 2025) linked to the changes it made. It takes about a minute and a half.
Three questions, and the real output. Where is section 174A, which amendment made it, and why should anyone believe that?
$ words_to_data search law.sqlite "domestic research or experimental" --work uscode/title_26 --at 2025-07-30
...
uscode/title_26@2025-07-30 …/subchapter_B/part_VI/section_174A [heading] 1 occurrence
Domestic research or experimental expenditures
$ words_to_data annotations law.sqlite --bill 119-hr-1 --path uscode/title_26/subtitle_A/chapter_1/subchapter_B/part_VI/section_174A
[Pending] uscode/title_26 2025-07-18 -> 2025-07-30 insert 119-hr-1 amd 2841e731435d …
(a) In General.-Part VI of subchapter B of chapter 1 is amended by inserting after section 174 the f…
link 7cdb05c5323a …/section_174A [quoted_words]
$ words_to_data settle law.sqlite --link 7cdb05c5323a --explain
How it was made:
Source: rule:evidence_matching
Method: address, window and quoted words@9
Address: /us/usc/t26/s174A, from the bill's markup
Window: uscode/title_26@2025-07-18 to 2025-07-30
the first window after the law's enactment on 2025-07-04 in which something under the
address changed.
Changes under the address: 1
Chosen: by quoted words
the change shows the words the bill quotes: enacted text 1 of 1.
...
words_to_data residue law.sqlite --bill 119-hr-1 lists what the rules could not
link, and why. words_to_data --help lists every command.
[dependencies]
words-to-data = { version = "0.7", default-features = false }
use words_to_data::dataset::Dataset;
let dataset = Dataset::open_sqlite("law.sqlite")?;
let path = "uscode/title_26/subtitle_A/chapter_1/subchapter_B/part_VI/section_174A";
for annotation in dataset.annotations_for_path(path)? {
println!("{:?} by {}", annotation.operation, annotation.source_bill.bill_id);
}
// Insert by 119-hr-1
default-features = false leaves out the command line and its dependencies.
add-release-points and
add-bills. A grown dataset holds the same links as one built from scratch.
release-points lists the release-point dates the mirror offers and the cache
holds.add-opinions (needs
COURTLISTENER_API_KEY), then cases-citing.--offline reads only
the cache.CONTEXT.md is the glossary. docs/adr/
records each design decision and its reason. Start with
0013,
how a change is linked.cd tests/test_data && tar xf test_files.tar.xz && cd ../.. # the test corpus is an archive
cargo test
Without the archive, about 190 tests fail on missing files. Tests use real committed
data only. CLAUDE.md holds the working rules, including the merge
queue.
MIT or Apache-2.0, at your option.