The LQ.AI Atlas LQ.AI's documentation, bound to the code it describes
234 documents

Document review & citations, end to end

How a contract becomes reviewed, cited, and trustworthy: the verification cascade, where citations are stored, the playbook and tabular surfaces that ride on it, and the honest edges where verification stops.

The executor workflow

The executor builds a LangGraph StateGraph in api/app/playbooks/executor.py and runs four nodes sequentially against a shared PlaybookExecutionState TypedDict (api/app/playbooks/state.py). The node implementations live in api/app/playbooks/nodes.py.

retrieve → classify → redline → compile → END
Node What it does LLM calls
retrieve For each position, runs Postgres FTS (websearch_to_tsquery) over the target document's chunks using the position's detection_keywords. Top-4 chunks per position (RETRIEVAL_TOP_K). Falls back to the document's first chunks when a position has no keywords or FTS returns no hits. None (pure SQL).
classify One structured-JSON call per position → {verdict, confidence, matched_fallback_rank, matched_text, cited_chunk_indices, justification}. Verdict is one of matches_standard | matches_fallback | deviates | missing. N (one per position).
redline For deviates verdicts only, one structured-JSON call per deviating position → {old_text, new_text, justification} drafted per the position's redline_strategy. Non-deviating rows pass through unchanged. One per deviates verdict.
compile Assembles the per-position results into the playbook_executions.results JSONB payload, computes the verdict-count summary, and flips the row to completed (or error if a prior node set state["error"]). Sets completed_at. None.