Search published CFPB consumer complaint records and aggregations.
Build reproducible complaint cohorts, company pulses, peer comparisons, emerging-theme tables, and narrative evidence packets without presenting raw complaint counts as quality scores.
Quick Start
# Inspect a bounded published complaint cohort.
cfpb-complaints-pp-cli data-research --size 10 --state NY --agent
# Summarize one company's recent complaint mix.
cfpb-complaints-pp-cli company pulse --company 'CAPITAL ONE FINANCIAL CORPORATION' --window 30d --agent
Unique Features
These capabilities aren't available in any other tool for this API.
company pulse — Summarize complaint volume, products, issues, responses, timeliness, narrative availability, and a prior-window delta for one company.
compare companies — Compare companies inside one explicit cohort while labeling counts as non-market-adjusted complaint volume.
emerging themes — Rank mechanical product and issue count changes between current and baseline windows without semantic or causal claims.
narratives packet — Select a newest-first bounded packet of published narratives with complaint IDs, exact cohort dates, and availability caveats.
watch changes — Compare the latest bounded cohort with a locally persisted prior observation and report newly observed complaint IDs and categories.
Recipes
Compare peers in one cohort
cfpb-complaints-pp-cli compare companies 'CAPITAL ONE FINANCIAL CORPORATION' 'DISCOVER BANK' --product 'Credit card' --window 90d --agent
Use identical filters and keep raw-volume caveats attached.
Collect traceable narratives
cfpb-complaints-pp-cli narratives packet --company 'CAPITAL ONE FINANCIAL CORPORATION' --limit 10 --agent
Return complaint IDs with published narrative evidence.
Usage
Run cfpb-complaints-pp-cli --help for the full command reference and flag list.
Paths & environment variables
This CLI separates local files into four path kinds:
| Kind | Contents |
|---|
config | User-editable settings such as config.toml and saved profiles |
data | Durable local data such as data.db |
state | Runtime state such as persisted queries, jobs, and teach.log |
cache | Regenerable HTTP/cache files |
Each kind resolves independently. The ladder is:
- Per-kind env var:
CFPB_COMPLAINTS_CONFIG_DIR, CFPB_COMPLAINTS_DATA_DIR, CFPB_COMPLAINTS_STATE_DIR, or CFPB_COMPLAINTS_CACHE_DIR
--home <dir> for this invocation
CFPB_COMPLAINTS_HOME for a flat relocated root
- XDG env vars:
XDG_CONFIG_HOME, XDG_DATA_HOME, XDG_STATE_HOME, XDG_CACHE_HOME
- Platform defaults matching existing installs
For containers and agent sandboxes, prefer a single relocated root:
export CFPB_COMPLAINTS_HOME=/srv/cfpb-complaints
cfpb-complaints-pp-cli doctor
Under CFPB_COMPLAINTS_HOME=/srv/cfpb-complaints, the four dirs resolve to /srv/cfpb-complaints/config, /srv/cfpb-complaints/data, /srv/cfpb-complaints/state, and /srv/cfpb-complaints/cache.
MCP servers do not receive CLI flags from the host. Put relocation in the host env block:
{
"mcpServers": {
"cfpb-complaints": {
"command": "cfpb-complaints-pp-mcp",
"env": {
"CFPB_COMPLAINTS_HOME": "/srv/cfpb-complaints"
}
}
}
}
Precedence matters in fleets: an ambient per-kind variable such as CFPB_COMPLAINTS_DATA_DIR overrides an explicit --home for that kind. Use CFPB_COMPLAINTS_HOME or the per-kind variables for durable fleet relocation; treat --home as the weaker per-invocation lever.
Relocation is one-way. Unsetting CFPB_COMPLAINTS_HOME does not move files back to platform defaults, and doctor cannot find files left under a former root. Move the files manually before unsetting relocation variables.
Existing installs keep working because the platform-default rung matches the legacy layout. Run cfpb-complaints-pp-cli doctor --fail-on warn to check path warnings in automation.
Commands
data-research
Manage data research
cfpb-complaints-pp-cli data-research - Search published consumer complaints
Self-learning loop
This CLI caches per-question discovery so repeat queries skip the walk and structurally similar queries get answered via entity substitution. The loop also self-captures: every invocation is journaled locally, and failed-flag corrections plus fresh teaches surface as candidates on the next recall for confirm/reject judgment. Agents call recall before discovery and fire teach & after answering. See the ## Automatic learning section in SKILL.md for the full protocol.
cfpb-complaints-pp-cli recall <query> - Look up cached resources for a query before running discovery
cfpb-complaints-pp-cli teach - Record a query -> resource mapping (silent on success, safe to background with &)
cfpb-complaints-pp-cli learnings list - Inspect taught rows
cfpb-complaints-pp-cli learnings forget <query> - Undo a teach
cfpb-complaints-pp-cli learnings candidates - List auto-captured candidates awaiting confirm/reject
cfpb-complaints-pp-cli learnings stats - Local loop metrics: recall hit rate, teach-to-reuse, playbook resolution, candidate counts
cfpb-complaints-pp-cli teach-pattern - Install a query/resource template up front
cfpb-complaints-pp-cli teach-lookup - Add an entity mapping (e.g. country code, team alias) for pattern substitution
Pass --no-learn or set CFPB_COMPLAINTS_NO_LEARN=true to disable the loop for deterministic flows.
The local store's schema version stamp is one-way: once this version of cfpb-complaints-pp-cli opens the database, older binaries refuse it with a version error — upgrade the binary rather than downgrading.
Output Formats
# Human-readable table (default in terminal, JSON when piped)
cfpb-complaints-pp-cli data-research
# JSON for scripting and agents
cfpb-complaints-pp-cli data-research --json
# Filter to specific fields
cfpb-complaints-pp-cli data-research --json --select id,name,status
# Dry run — show the request without sending
cfpb-complaints-pp-cli data-research --dry-run
# Agent mode — JSON + compact + no prompts in one flag
cfpb-complaints-pp-cli data-research --agent
Agent Usage
This CLI is designed for AI agent consumption:
- Non-interactive - never prompts, every input is a flag
- Pipeable -
--json output to stdout, errors to stderr
- Filterable -
--select id,name returns only fields you need
- Previewable -
--dry-run shows the request without sending
- Read-only by default - this CLI does not create, update, delete, publish, send, or mutate remote resources
- Offline-friendly - sync/search commands can use the local SQLite store when available
- Agent-safe by default - no colors or formatting unless
--human-friendly is set
Exit codes: 0 success, 2 usage error, 3 not found, 5 API error, 7 rate limited, 10 config error.
Health Check
cfpb-complaints-pp-cli doctor
Verifies configuration and connectivity to the API.
Configuration
Run cfpb-complaints-pp-cli doctor to see the resolved config, data, state, and cache directories. The platform-default config path is ~/.config/cfpb-consumer-complaints-pp-cli/config.toml; --home, CFPB_COMPLAINTS_HOME, and per-kind env vars can relocate it.
Static request headers can be configured under headers; per-command header overrides take precedence.
Troubleshooting
Not found errors (exit code 3)
- Check the resource ID is correct
- Run the
list command to see available items
API-specific
- A cohort is empty —
- Few narratives appear —