Demonstrates parallel agentic retrieval using codex's experimental prompt field feature.
This demo shows how to run multiple specialized Codex CLI instances in parallel, each extracting specific information from documents. The included prompts are tailored for contract analysis as a simple example use case, but the pattern works for any type of office document.
simple-cli-retrieval/
├── prompts/ # Specialized extraction prompts
│ ├── payment_terms.md
│ ├── key_dates.md
│ ├── parties_and_roles.md
│ ├── confidentiality.md
│ ├── release_and_liability.md
│ ├── compliance_obligations.md
│ └── dispute_resolution.md
├── analyze_settlement.sh # Main execution script
└── README.md
Run the analysis script with your document (markdown format):
./analyze_settlement.sh /path/to/document.mdThe included prompts are designed for contract documents, but you can customize them for any document type (financial reports, legal briefs, meeting notes, etc.).
- Creates a datestamped output folder (e.g.,
results_2025-10-22_14-30-45/) - Launches 7 parallel Codex CLI instances, each with a specialized prompt
- Each instance analyzes the same document for specific information
- Results are saved to separate markdown files in the output folder
- Full execution traces and token usage are logged to
logs/subdirectory - Token usage summary is displayed at completion with per-analysis and total token counts
The included prompts target key information from class action settlements:
- payment_terms.md - Settlement amount and how money is distributed to class members
- key_dates.md - Top 3 most meaningful dates and their significance
- parties_and_roles.md - Who is eligible to be part of the settlement class
- confidentiality.md - What the lawsuit was about (synthesize allegations)
- release_and_liability.md - What claims class members are releasing
- compliance_obligations.md - How to submit a claim and required information
- dispute_resolution.md - How to opt out or object to the settlement
These demonstrate both simple extraction and synthesis tasks. Adapt them for your specific document types and information needs.
All results are saved to a timestamped directory with files named:
payment_terms_result.mdkey_dates_result.mdparties_and_roles_result.mdconfidentiality_result.mdrelease_and_liability_result.mdcompliance_obligations_result.mddispute_resolution_result.md
A logs/ subdirectory contains detailed execution traces:
- Full Codex CLI output for each analysis
- Token usage information
- Timestamps for start and completion
- Error traces if any analysis fails
At completion, the script displays a token usage summary showing input/output token counts for each analysis plus totals.
$ ./analyze_settlement.sh contract.md
===================================
Settlement Agreement Analysis
===================================
Input file: contract.md
Output directory: results_2025-10-22_14-30-45
Starting parallel analysis...
→ Starting analysis: Settlement Amount & Distribution
→ Starting analysis: Key Dates
→ Starting analysis: Eligibility Criteria
→ Starting analysis: Case Summary
→ Starting analysis: Released Claims
→ Starting analysis: Claim Process
→ Starting analysis: Opt-Out Rights
All analyses launched. Waiting for completion...To add new analysis types:
- Create a new prompt file in
prompts/directory with a focused extraction question - Add an entry to the
analysesarray inanalyze_settlement.sh(format: "prompt_name:Description") - Run the script - it will automatically include the new analysis
- Codex CLI installed and authenticated
- Bash shell (compatible with bash 3.2+, works on macOS and Linux)
- A markdown-formatted document to analyze (use MarkItDown to convert PDFs, Word docs, Excel sheets, and other office formats to markdown)
This pattern works well for:
- Contracts & legal documents - Extract parties, terms, dates, obligations
- Financial reports - Extract KPIs, figures, trends from different sections
- Meeting notes - Extract action items, decisions, attendees, follow-ups
- Research papers - Extract methodology, findings, datasets, conclusions
- Technical specs - Extract requirements, dependencies, timelines, constraints
The key is defining focused extraction questions in each prompt file.