Dev48
Language
  • About
  • Services
  • Industries
  • Technologies
  • Articles
  • Contacts
Book a call
    Home/Articles/Organize legal documents in minutes with box cli box extract and claude code
Dev48
info@dev48.org+375 29 320-40-96WhatsApp@isky_by

© 2026 · All rights reserved.

Organize legal documents in minutes with Box CLI, Box Extract, and Claude Code

Source: Box Blog•December 2, 2026 at 07:47 PM

Organize legal documents in minutes with Box CLI, Box Extract, and Claude Code

“Box is the leader in Intelligent Content Management. Its platform enables organizations to fuel collaboration, manage the entire content lifecycle, secure critical content, and transform business workflows with enterprise AI.”

A large folder of legal documents often looks organized at first. It has a few subfolders, hundreds of files, and filenames that seem to point to familiar topics. But those clues can be misleading. A case mentioning “transport” may be about planning or procurement. A decision about equality may be buried in a folder with no obvious connection to it.

Instead of manually trying to organize hundreds of files, I used Box CLI with Claude Code to inspect a collection of court judgments and tribunal decisions. I then used Box’s AI extraction capabilities to start classifying the files by their contents.

In just ten minutes, I was able to set up an AI-powered workflow that could understand the shape of the problem, propose a useful structure, kick off the extraction process, and apply those changes to content. The final workflow allowed me to query my content with natural language in Claude Code and get content insights thanks to metadata.

Start with the folder

In this demo example, the folder holds 461 PDFs: 452 at the top level and nine in three partially used subfolders. The collection includes publicly available court decisions from 2003 to 2026, benefits, tribunal decisions without standard citations in their filenames, and seven National Travel Survey documents that aren’t judgments at all.

There are also seven duplicate pairs. Some filenames looked like they belonged in an existing subject folder, but a quick content check showed why filing by keyword alone would be risky. “Transport” could mean transport law, a planning case, or a procurement dispute. “Accessible” did not necessarily mean an accessibility case.

For a law firm, this is a familiar problem. A research folder gathers material over time as different people use and search for it. Naming conventions drift. Important documents become hard to find. And the first label that comes to mind is not always the legal issue a lawyer will search for later.

The first ten minutes: inspect, propose, and set up

Here’s the short version of the workflow:

  • Inspect the folderwith Box CLI: list the items, identify file types, and see which subfolders already exist
  • Ask Claude Code to analyze the listing and propose a taxonomy, metadata fields, and cleanup steps
  • Check samples against document contents using Box Extract, rather than trusting filenames as the source of truth
  • Review the proposed changes before authorizing bulk moves, renames, or duplicate cleanup

This initial pass gives you a map of the collection and a plan you can challenge. The Box CLI provides a terminal interface for working with Box content, while an AI coding agent can help compose and sequence those operations.Box’s CLI overview describes the CLI’s role in scripting and agent workflows.

Set up Box CLI

You’ll need Node.js for the npm installation, or you can use one of the native binaries in the Box CLI documentation. To install and authenticate:

box login guides you through authentication. The CLI acts with the access and permissions of the account or app you authenticate with, so use an account that has the appropriate access to the folder. Box’s CLI quickstart guide has the current setup details.

With Claude Code open in the project or terminal where you’re working, start with a read-only request. For example:

Use the Box CLI to inspect folder [folder ID]. Summarize the item counts, file types, existing subfolders, likely duplicates, and naming patterns. Suggest a one-level folder structure and metadata fields for a law firm’s court-decision research collection. Do not move, rename, delete, or update anything. Flag assumptions and documents that need content review.

That last instruction is useful as it makes the first result something you can inspect, rather than an instruction to change a live research collection.

Use Box Extract to classify what the documents say

A folder structure answers one question: where should files go? A metadata template answers others: which court issued this decision, what year is it from, what is the citation, and which areas of law does it concern?

For this collection, the proposed Box metadata fields were:

  • Citation
  • Court or tribunal
  • Year
  • Area of law
  • Equality or disability relevance
  • Key legislation
  • Outcome

Box Extract can use document content to populate structured fields, giving a legal team ways to find documents by attributes as well as by folder. For example, a lawyer could look for Supreme Court decisions concerning equality after 2015 without needing to remember the exact filename or browse several layers of folders.

Extraction is a starting point for classification, not a legal determination. In the console run, sample checks showed that filename keywords alone could send cases to the wrong subject area. The classification logic also needed adjustment for commercial disputes and records without a clear primary area of law. For legal research, those borderline cases deserve review by someone who understands the matter.

If your workflow uses extraction confidence scores, treat them as a way to prioritize review, not as a guarantee of correctness. Box’s confidence-level guidance recommends validating extracted values according to the risk and importance of the field.

Choose a structure that reflects legal work

The proposed structure grouped the judgments by area of law, kept the hierarchy one level deep, and placed general reference material separately:

Court judgments and tribunal decisions/ ├── 01 Equality, Discrimination & Disability ├── 02 Education ├── 03 Transport & Passenger Rights ├── 04 Planning, Housing & Local Government ├── 05 Social Security & Benefits ├── 06 Immigration & Asylum ├── 07 Information Rights & Data Protection ├── 08 Employment ├── 09 Public Procurement & Commercial ├── 10 Tax ├── 11 Family, Children & Court of Protection ├── 12 Crime, Policing & Justice ├── 13 Health & Social Care ├── 14 Other Public Law / Judicial Review └── Reference – National Travel Survey 2024

This is a starting taxonomy for this demo collection, not a universal folder template. The right areas depend on each team’s practice and case-by-case research reuse practices. Here, the key design choice was to use metadata for details such as court, year, and citation instead of building a deep folder tree for every combination.

Let the first pass reveal what needs human judgment

The console output captured an ongoing job, not a completed filing. After the duplicate review, Box Extract was processing 454 files. At one point, 111 had been extracted and the first files were beginning to move into topic folders. The remaining work was expected to continue in the background.

The run also surfaced practical cleanup tasks: keep the non-duplicate versions, separate the National Travel Survey reports from the judgments, standardize unclear filenames, and review cases whose subject classification was uncertain. That’s a useful outcome for an initial session. The folder is no longer an undifferentiated pile; the team has a proposed structure, fields to search on, and a list of decisions to verify. You might leverage a sandbox first to experiment before making changes to your folder structure.

For a production cleanup, you can make the sequence explicit:

  • Inspect and propose. Generate the inventory, taxonomy, and candidate cleanup list.
  • Review a representative sample. Check classifications against the documents, including cases that cross practice areas.
  • Create the metadata template. Agree on field names and allowed values with the lawyers who will use it.
  • Run extraction in batches. Track any failures or uncertain results; large collections may take longer than the initial planning session. Ask Claude Code to use Box Enhanced Extract agent for better results.
  • Review before changing files. Confirm the mapping, then authorize moves, renames, or duplicate handling.
  • Reconcile the result. Compare the final item counts with the inventory and spot-check the new folders and metadata.

That last review step is particularly important for legal content. A misfiled precedent can waste research time, and an incorrect extracted citation or outcome can mislead a later search. Automation can do the repetitive reading and routing work; the firm should decide how much review a field or classification requires.

Why this approach works for legal teams

Box CLI makes the content accessible to scripts and terminal-based agents. Box Extract turns document text into structured fields that can support search and routing. Claude Code helps connect the steps and adapt the workflow to the folder in front of you.

Together, they offer a practical way to turn an accumulated research folder into a more usable collection: files remain in Box, metadata makes them easier to find, and a lawyer can review the cases where the classification is not obvious. The first ten minutes can get the process moving. The quality comes from the taxonomy, the sample checks, and the review that follows.

FAQ's

Can you organize a large legal folder in ten minutes?

You can inspect a folder, propose a structure, and start an extraction workflow in about ten minutes. However, processing hundreds of files, reviewing uncertain results, and reconciling the final moves can take longer.

Why use metadata as well as folders?

Folders provide a clear home for documents. Metadata makes it possible to search across folders by fields such as citation, court, year, and area of law. Using both can make a collection easier to browse and filter.

Where can I learn more about Box CLI?

Start with the Box CLI documentation and quickstart, then reviewBox’s overview of using the CLI with developers and agents.

Can this workflow be used on client matter files?

Yes – with some important caveats. The example here concerns a collection of court judgments and public reference documents. Before applying a similar workflow to client matter content, a firm should confirm that the chosen account, app permissions, extraction configuration, and review process meet its confidentiality and governance requirements.

← All articles

What this article says

More in Cloud & Infrastructure

All →
Introducing Box for Insurance: Accelerate claims and underwriting with AI
Box

Introducing Box for Insurance: Accelerate claims and underwriting with AI

DigitalOcean Secrets Manager is now generally available: Manage application credentials in one place
DigitalOcean

DigitalOcean Secrets Manager is now generally available: Manage application credentials in one place

agento11y: open source safety and observability for local coding agents, by Grafana Labs
Grafana Labs

agento11y: open source safety and observability for local coding agents, by Grafana Labs

Hono on Fastly Compute: A Familiar Express-Style Experience at the Edge
Fastly

Hono on Fastly Compute: A Familiar Express-Style Experience at the Edge

Amazon's water conservation and replenishment efforts around the world
Amazon

Amazon's water conservation and replenishment efforts around the world

Writing quantum code with generative AI
IBM

Writing quantum code with generative AI

More from Box

Introducing Box for Insurance: Accelerate claims and underwriting with AI
Box

Introducing Box for Insurance: Accelerate claims and underwriting with AI

What AI can do with your unstructured data (and what you need to get it right)
Box

What AI can do with your unstructured data (and what you need to get it right)

NVIDIA OpenShell + Box Mount: Giving agents a governed workspace
Box

NVIDIA OpenShell + Box Mount: Giving agents a governed workspace

What I'm thankful for after black October
Box

What I'm thankful for after black October

Build faster, extract at scale, verify with confidence: What’s new in Box Extract
Box

Build faster, extract at scale, verify with confidence: What’s new in Box Extract

Accelerate breakthroughs with governed agentic AI and Intelligent Content Management
Box

Accelerate breakthroughs with governed agentic AI and Intelligent Content Management