Lossless Changelog
component

Assure Consistent Workflow and Codify Docs — Fact-Check Pipeline & Source Catalog

Introduces a three-step LLM-powered fact-check pipeline (extract → verify → correct) and a per-section comprehensive source catalog. The mechanical-only fact-checker is upgraded to use Perplexity Sonar Pro for independent claim verification and Claude for surgical corrections.

Changelog - 2026-03-23_02

Assure Consistent Workflow and Codify Docs — Fact-Check Pipeline & Source Catalog

Introduces a three-step LLM-powered fact-check pipeline (extract → verify → correct) and a per-section comprehensive source catalog. The mechanical-only fact-checker is upgraded to use Perplexity Sonar Pro for independent claim verification and Claude for surgical corrections.


Why

The existing fact_checker.py used regex to find claims and string matching to check if they appeared in research data. It could detect "this sentence mentions $50M" but couldn't assess whether the source actually said $50M, whether the number was about the right company, or whether a better source exists. Claims were flagged but never acted on — the 4-fact-check.json artifact was a dead end.

Investment analysts need:

  1. Verified claims — not just "has a citation" but "citation supports the claim"

  2. Corrections with traceability — old value → finding → new value → new source

  3. Complete source lists — every source the pipeline found, including excluded ones


What Changed

New Agent: fact_verifier.py (LLM-powered verification)

Reads 4-fact-check.json, filters to suspicious/critical claims, sends batches to Perplexity Sonar Pro for independent verification.

Pipeline: fact_check → fact_verify → fact_correct
                         ↑
            Perplexity Sonar Pro
            "Is this claim accurate?"

Each claim gets tagged:

ResultMeaning
confirmedClaim matches independent sources
contradictedSources say something materially different
correctedPartially right, needs adjustment
unverifiableCannot find reliable sources to confirm or deny

Output: 4-fact-check-verified.json + 4-fact-check-verified.md

New Agent: fact_corrector.py (surgical section updates)

Reads verified results, groups corrections by section, uses Claude to update specific sentences. Does NOT rewrite sections wholesale.

PYTHON
# Safety guard: reject if corrected content is wildly different length
len_ratio = len(corrected_content) / len(original_content)
if len_ratio < 0.5 or len_ratio > 2.0:
    print("Correction produced suspicious length change, skipping")

Output: 4-corrections-log.json + 4-corrections-log.md

Traceability chain:

claim found → checked for accuracy → found better source →
updated claim with citation → logged change with before/after

New Agent: source_cataloger.py (per-section source lists)

Compiles comprehensive source lists in 3-source-catalog/ by reading all pipeline artifacts:

1-research/*.md          → "found in research"
2-sections/*.md          → "included in final draft"
source-validation-log-*  → "excluded-invalid", "hallucinated"
4-fact-check-verified.*  → "verified by LLM"
4-corrections-log.*      → "added by correction"

Each source is tagged with a status:

StatusDescription
IncludedIn the final memo with inline citation
Added by CorrectionFound by LLM to fix an inaccurate claim
Valid but Not CitedPassed URL validation but wasn't used
Found in ResearchDiscovered during research phase
Excluded — Uncertain403/401/timeout (may be behind paywall)
Excluded — InvalidURL returned 404
HallucinatedFabricated URL detected

Output: 3-source-catalog/{section}-Complete-Source-List.md + README.md

Modified: remove_invalid_sources.py (validation logging)

The cleanup gate now persists full URL validation results as source-validation-log-cleanup_sections.json. Previously, validation details were only printed to console and lost.

Updated Pipeline Sequence

... → validate_citations →
  fact_check (regex extraction) →
  fact_verify (Perplexity Sonar Pro) →
  fact_correct (Claude surgical fixes) →
  source_catalog (compile source lists) →
validate → scorecard → ...

Canonical Orchestration Document

Created context-v/reminders/Ideal-Orchestration-Agent-Workflow.md as the single source of truth for agent execution order. Documents all 31 nodes across 9 phases, known bug patterns, and the golden rules for edge ordering.


Verification (Metabologic v0.2.3 → v0.2.4)

Metricv0.2.3 (before)v0.2.4 (after)
Fact-check score0% (entity mismatch)66% (25/38 verified)
Claims sent to PerplexityN/A12
Confirmed by LLMN/A2
Contradicted by LLMN/A2
Corrections appliedN/A2 sections modified
Source catalogN/A37 sources / 7 sections
Artifact files produced2 (json + md)8 (fact-check, verified, corrections, source catalog)

Files Changed

FileChange
src/agents/fact_verifier.pyCreated — LLM-powered claim verification via Perplexity
src/agents/fact_corrector.pyCreated — surgical section correction with traceability
src/agents/source_cataloger.pyCreated — per-section comprehensive source lists
src/agents/remove_invalid_sources.pyAdded extract_citation_details(), save_source_validation_log()
src/workflow.pyAdded 4 new nodes + edges in pipeline sequence
context-v/reminders/Ideal-Orchestration-Agent-Workflow.mdCreated — canonical workflow reference
context-v/issue-resolution/Preventing-Hallucinations-in-Memo-Generation.mdUpdated status: Tier 2+3 implemented