Extract every RFP requirement into a compliance matrix
Extract every RFP requirement into a compliance matrix. Direct quotes prevent paraphrasing, and a Python script checks clause counts against raw duty verbs.
Asking an AI to summarize a multi-page Request for Proposal (RFP) into a compliance matrix often drops mandatory requirements tucked away in appendices or alters key obligations through lossy paraphrasing. Enclose the main body and appendices in explicit tags, force verbatim quotes for every requirement, and run a Python check script to verify full coverage. The same quote-verification technique is covered in verify summary quotes.
[1] Prepare the RFP excerpt file. This excerpt from a portal modernization RFP for the Urban Transit Authority contains 28 total mandatory obligations: 10 functional, 8 performance/security, 7 operational, and 3 technical baseline requirements in the appendix (the middle 18 clauses are truncated with …).
1. Functional Requirements (SFR)[SFR-001] The system shall provide single sign-on via OAuth and corporate email.[SFR-002] Passwords shall contain at least 10 characters with numbers and special symbols.[SFR-003] The system shall lock any user account for 10 minutes after five consecutive failed logins.…2. Performance and Security Requirements (PER)[PER-001] Average response time shall remain under 2 seconds for 1,000 concurrent users.[PER-005] Query response times shall be optimized under peak system load.…3. Interface and Operational Requirements (OPR)[OPR-001] The system shall integrate in real time with the central transit clearinghouse.[OPR-007] System monitoring screens shall present a modern and intuitive dashboard. 4. Appendix: Technical and Security Baseline Specifications[APP-001] The portal shall achieve full compliance with WCAG 2.1 Level AA standards.[APP-002] Source code shall satisfy all 49 security rules in the federal secure coding guide.[APP-003] The application shall run independently on the authority's on-premises infrastructure.[2] Construct the prompt. Following Anthropic's prompt best practices, wrap sections in <document> tags with type metadata to isolate the main body from the appendix. To eliminate hallucinated wording, apply the direct quote rule from the guide to reducing hallucinations.
Extract every mandatory requirement from the RFP and generate a compliance matrix table. Rules:1. Extract all requirements inside the <document> tags that contain mandatory obligation language ("shall", "must", "mandatory") across both the main body and the appendix. Do not omit any appendix requirements.2. Output a Markdown table with exactly these 4 columns: | Clause ID | Source | Direct Quote | Ambiguity |3. Clause ID: Keep the original identifier from the text (e.g., SFR-001, PER-001, OPR-001, APP-001).4. Source: Specify "Main" or "Appendix".5. Direct Quote: Quote the exact sentence character for character from the text without any omission, paraphrasing, or summary.6. Ambiguity: Set to "Clear" if quantitative metrics or clear pass criteria exist; set to "Ambiguous: <reason>" if subjective or unquantified terms (e.g., "optimized", "intuitive") are used.7. Output only the table. No greetings, explanations, or surrounding text. {rfp_main_and_appendix_document_tags}[3] Run the prompt against the document. --tools "" and --setting-sources "" keep tools and local settings out of the answer.
$ claude -p --model claude-sonnet-5-5 --max-turns 1 --tools "" --setting-sources "" --strict-mcp-config < run/rfp_en.prompt.txt > run/rfp_en.1.out.txtThe model returns all 28 requirements (25 main, 3 appendix) formatted in a Markdown table. Below are 10 representative rows (the remaining 18 rows are omitted with …).
| Clause ID | Source | Direct Quote | Ambiguity ||---|---|---|---|| SFR-001 | Main | The system shall provide single sign-on via OAuth and corporate email. | Clear || SFR-002 | Main | Passwords shall contain at least 10 characters with numbers and special symbols. | Clear || SFR-003 | Main | The system shall lock any user account for 10 minutes after five consecutive failed logins. | Clear |…| PER-001 | Main | Average response time shall remain under 2 seconds for 1,000 concurrent users. | Clear || PER-005 | Main | Query response times shall be optimized under peak system load. | Ambiguous: "optimized" has no quantitative threshold, and "peak system load" is undefined |…| OPR-001 | Main | The system shall integrate in real time with the central transit clearinghouse. | Ambiguous: "real time" has no latency or frequency metric || OPR-007 | Main | System monitoring screens shall present a modern and intuitive dashboard. | Ambiguous: "modern" and "intuitive" are subjective and have no measurable acceptance criteria || APP-001 | Appendix | The portal shall achieve full compliance with WCAG 2.1 Level AA standards. | Clear || APP-002 | Appendix | Source code shall satisfy all 49 security rules in the federal secure coding guide. | Clear || APP-003 | Appendix | The application shall run independently on the authority's on-premises infrastructure. | Ambiguous: "independently" is not defined (e.g., which external dependencies or cloud services are excluded) |A second run (run/rfp_en.2.out.txt) produced identical Clause IDs and verbatim quotes for all 28 rows. Both runs categorized the same 7 items (SFR-009, SFR-010, PER-005, OPR-001, OPR-003, OPR-007, APP-003) as Ambiguous and the remaining 21 as Clear, differing only in minor phrasing ("open-ended list" vs "non-exhaustive list").
[4] Write the verification script. It counts mandatory verbs (shall, must, mandatory) in the source document using regex and compares that count against the table row count. It also ensures each quote appears in the source text exactly once and checks for duplicate IDs or line mismatches. The obligation count is only the number of times those three words occur, so a clause that expresses an obligation another way (for example "is required to") is not counted, and leaving it out of the table would not be caught by this script.
#!/usr/bin/env python3"""usage: check.py doc.txt out.txt — verify compliance matrix against raw RFP"""import re, sysdoc = open(sys.argv[1], encoding="utf-8").read()out = open(sys.argv[2], encoding="utf-8").read().strip()pat = re.compile(r'하여야 한다|해야 한다|필수' if re.search(r'[가-힣]', doc) else r'\b(?:shall|must|mandatory)\b', re.I)req_count = len(pat.findall(doc))rows = [l for l in out.splitlines() if l.strip().startswith("|")]rows = [[c.strip() for c in l.strip().strip("|").split("|")] for l in rows]rows = [r for r in rows if len(r) >= 4 and not set("".join(r[:2])) <= set("-: ")][1:]seen, errs = set(), []for idx, (cid, src, quote, amb, *_) in enumerate(rows, 1): if cid in seen: errs.append(f"DUP_ID {cid}") seen.add(cid) if not re.match(r'^(?:SFR|PER|OPR|APP)-\d{3}$', cid): errs.append(f"BAD_ID {cid}") if src not in ("본문", "부록", "Main", "Appendix"): errs.append(f"BAD_SRC {src}") n = doc.count(quote) if n != 1: errs.append(f"QUOTE {cid} ({'MISS' if n == 0 else 'DUP'})") if not any(f"[{cid}]" in line and quote in line for line in doc.splitlines()): errs.append(f"MISMATCH {cid}")if len(rows) != req_count: errs.append(f"COUNT_MISMATCH: doc={req_count} table={len(rows)}")for e in errs[:5]: print(f"FAIL: {e}")print(f"{len(rows)} rows, {len(errs)} errors (doc requirements: {req_count})")sys.exit(1 if errs else 0)[5] Run the check script on the first output. All 28 clauses match the source text, exiting 0.
$ python run/check.py run/doc.en.txt run/rfp_en.1.out.txt28 rows, 0 errors (doc requirements: 28)To test the check logic against flaws, three synthetic failure modes were tested: altered quote words, duplicate clause IDs, and swapped ID-to-quote mappings. All were flagged. Below is the test on bad_quote.en.txt, where "shall provide" was manually modified to "will provide" in SFR-001 (this is a deliberate test input, not model error).
$ python run/check.py run/doc.en.txt run/bad_quote.en.txtFAIL: QUOTE SFR-001 (MISS)FAIL: MISMATCH SFR-00128 rows, 2 errors (doc requirements: 28)[6] The weak spot is the Ambiguity column. Clause IDs and quotes matched across both runs, and both runs flagged the same seven clauses, but the stated reason changed wording on all seven (for example, SFR-009: "open-ended list" vs "non-exhaustive list"). Treat the column as a list for a human to review. To pin the judgment down, name the trigger words in rule 6 (for example: "mark Ambiguous when a requirement uses words such as appropriate, intuitive, real-time, or relevance without a number or formula"). This excerpt has one obligation per clause, so a clause that chains two "shall" sentences, and how that splits the regex count from the row count, was not tested.