Codex can help a law firm compare contract drafts, organise the documents in a matter or turn a set of exhibits into a review checklist. The most useful output contains findings you can trace back to a document, section and passage. The lawyer consults the relevant legal authority and decides which conclusions the analysis can support.
A good first project is to compare two versions of a services agreement. The inputs are clear, the changes are easy to check and the output can follow the same format each time. You can practise the entire workflow with fictional documents and then measure any time saved after checking each row. The same method works for litigation timelines and exhibit inventories.
- Project
Choose the working folder and the documents the session can access.
- Skill
Apply a consistent method and output format.
- Agent
Delegate a check of the quotations and differences.
- Lawyer
Check the sources and decide what belongs in the final analysis.
1. Create a Codex project for a demonstration matter
Create a folder named cabinet-demo and put the two fictional versions in an intrari subfolder. In the desktop app's Projects view, open the folder as a local project and start a chat in it. If you use the Codex CLI, open the session from the folder or run codex -C cabinet-demo from its parent directory. The project defines the working context for files and instructions. For each matter, start a chat with the material approved for that assignment.
cabinet-demo/
AGENTS.md
intrari/
contract-v1.md
contract-v2.md
.agents/skills/compare-contracts/SKILL.md
.codex/agents/source-reviewer.toml
Start with Markdown or plain text. For a scanned PDF, check the text recognition on the important pages before asking for a comparison. Record the filename, the page number in the viewer and the printed page number if they differ. For Word files, keep the originals and examine comments, tracked changes and appendices separately, because these may affect the meaning of an exported version.
Add a short AGENTS.md file at the project root. Use it to say what material Codex can consult and what it should deliver. This example asks for a response in chat and can be tried with read-only access.
# Demonstration project for legal work
- Use the files in intrari/ as the only evidence.
- Identify the version and section for each finding.
- Flag any missing document or passage.
- Separate text findings from questions for the lawyer.
- Preserve the input files and report in the chat.
Check the permissions in Codex before starting the first task. Give the pilot read access to the demonstration files and leave unrelated connectors disabled. Instructions in AGENTS.md describe the method for the agent to follow. Product permissions and file access rights control what it can actually read or change. Working in a local folder describes where the files and execution environment are located. Assess how the model processes data separately.
2. Create a skill for comparing contract drafts
A skill is a reusable procedure. You can create one manually at .agents/skills/compare-contracts/SKILL.md or describe the workflow with $skill-creator in Codex and review the proposed files. Instructions are enough to get started. Add a script or report template once you have a well-defined operation that comes up often and that you have checked on examples.
---
name: compare-contracts
description: Compare two approved versions of a contract.
---
1. Identify the available files and appendices.
2. Match clauses by subject and check their numbering.
3. Give the filename and section for each difference.
4. Quote a short passage from each version.
5. Separate changes in wording from renumbering.
6. Flag omissions and points the lawyer needs to check.
Invoke $compare-contracts explicitly and specify which file to use as the baseline. Add the clauses you care about, such as notices, fees and termination. If your firm has an approved comparison table, define its columns and say what to show when information is missing. For a reference to an appendix, a useful entry is “Appendix 1 is missing from the supplied files”.
3. Create an agent to verify source references
A Codex subagent can take on a narrowly defined check using the parent session's access configuration. Create .codex/agents/source-reviewer.toml in the project. In this example, the agent checks the table of changes against the input documents. Its role is to review the evidence, and you decide which findings to keep.
name = "source_reviewer"
description = "Check comparison sources and quotations."
developer_instructions = """
Read the input files available in the project.
Check each row's version, section and quotation.
Flag omissions, misquotations and unsupported inferences.
Preserve the files and report the findings in the chat.
"""
Open a chat in the project where you saved the agent. Ask explicitly for delegation and give the reviewer a narrow assignment. It can return just the rows that need work, along with the correct passage and the reason for the change. Availability depends on the client and the organisation's configuration. You can also ask for the same source check in a separate chat.
Apply $compare-contracts to intrari/contract-v1.md
and intrari/contract-v2.md. Use v1 as the baseline.
Prepare a table of versions, quotations and changes.
Ask source_reviewer to check the quotations and section
numbers against the originals.
Wait for the review and return the corrected rows here.
Worked example. What changed in the notice clause?
Save the fictional excerpts in the two files in intrari. Leave Appendix 1 out of the demonstration set to see whether the agent flags it as missing. A useful report tracks the notice period, the form, the destination and the question to raise in negotiation.
# contract-v1.md
## 7.2 Termination notice
Send written notice 30 calendar days in advance to the
email address in Appendix 1.
# contract-v2.md
## 8.1 Termination notice
Send notice 15 calendar days in advance to the address
the service provider will supply later.
| Item | V1 · §7.2 | V2 · §8.1 | What the lawyer checks |
|---|---|---|---|
| Notice period | 30 calendar days | 15 calendar days | Impact on the notice process. |
| Form | In writing | The excerpt gives no required form | Wording and evidence of delivery. |
| Destination | Email address in Appendix 1 | Address to be supplied by the provider | The exact address and evidence of delivery. |
| Missing source | Appendix 1 is absent | The passage gives no final address | Request the document and current contact details. |
The lawyer can open both texts and quickly check whether the figures and references have been copied correctly. They can then discuss whether the shorter period is acceptable and how service will be proved. The relevant date, operative address and legal effect still need to be established from the full set of material and the applicable law. The report should keep these questions visible.
Other useful workflows for law firms and legal teams
Build a litigation timeline
Ask for a table with dates as written, the event, the source and the page. Record the date of the document separately from the date it was served or received. If two documents give different dates, show both sources. Lawyers can use the timeline to locate evidence quickly and verify any procedural deadlines in a separate check.
Make an inventory of exhibits and appendices
Start with the approved files and a reference index. The agent can flag a missing title, a document with multiple versions or a scan that needs a quality check. Someone who knows the matter makes the final pass. They check names, pages and order against the originals and decide what to put in the package.
Review a group of contracts
Use a small batch to extract the same fields from each contract, such as parties, dates and renewal provisions. Ask for the exact passage for each field. Distinguish a clause found in the material from one that cannot be assessed because a file is incomplete. If the team needs access by matter, audit logs and approvals, it can turn the workflow into an internal application with AI integrated into document workflows.
When to move from examples to real client matters
In Romania, Article 11 of Law No. 51/1995 establishes a lawyer's duty to observe professional secrecy. Before using a tool on a real matter, the firm decides what categories of information it may handle, which account and configuration are approved, who may see the output and how data is deleted. Under OpenAI's business data policy, organisation data is excluded from training by default. Check the terms for the actual account, where files travel between services, retention and provider access separately.
Separate matters by folder, project and access rights. Start with fictional or approved test data, and remember that a document with the name removed can still contain enough details to identify someone. Disable web search and connectors in workflows limited to approved materials, using available client or organisation controls. Before any analysis goes to a client or a court, check the passages, the applicable version of the law and the cited decisions directly in the appropriate sources.
How to measure whether the workflow helps
Compare a manual review with a Codex-assisted review of the same fictional documents. Measure total time, including preparation and review, how many material changes are found, how many source references are correct and how many findings need rewriting. Include a renumbered agreement, a missing appendix and a hard-to-read passage. Adopt the workflow for tasks that a lawyer can verify quickly and consistently.