Overview
WriterzRoomβs researcher agent runs every source batch through a deterministic quality scorer before passing results to the writer. When source quality falls below threshold, an adaptive retry loop β Agent-Supervised Tool Adaptation (ASTA) β reformulates the search query and merges the best results from both attempts. This pipeline has two goals: prevent low-relevance sources from reaching the writer, and eliminate fabricated or misattributed citations from the final output.Source Quality Scoring
Every source returned by Tavily or the pgvector corpus is scored on four axes before it enters the generation pipeline.| Dimension | Weight | What It Measures |
|---|---|---|
| Relevance | 45% | TF-IDF weighted term overlap between query and source snippet |
| Authority | 20% | Domain tier β .gov, .edu, and peer-reviewed domains score highest |
| Recency | 15% | Exponential decay from publication date with a configurable half-life |
| Density | 20% | Snippet length and information-to-filler ratio |
| Tier | Min Composite to Accept |
|---|---|
| Standard | 0.35 |
| Premium | 0.35 (higher bar applied via Voyage reranking) |
ASTA β Adaptive Query Reformulation
When the top-3 mean composite falls below threshold, ASTA fires a single reformulation call using Claude Haiku before accepting the results. Retry flow:- Broader β removes specificity that may have narrowed results too much
- Reframed β approaches the same topic from a different angle
claude-haiku-4-5 for reformulation. The call is capped at 200 tokens and runs in under 2 seconds.
Citation Audit
After the writer generates content, the editor runs a deterministic citation audit before any other validation pass. Three checks run in sequence:-
Bounds check β Any
[N]marker whereNexceeds the verified source count is stripped. If the researcher returned 3 sources,[4]and above are fabrication and are removed. -
Misattribution check β For each surviving
[N], the editor checks whether the 300-character window around the inline citation shares content terms with the sourceβs snippet. Zero overlap flags the marker as misattributed and strips it. - Orphan pruning β After stripping, any reference list entry whose index number no longer appears inline is removed from the references section.
Stat Validation
Statistics and expert quotes extracted from research results are cross-validated against source snippets before the writer sees them. A claim must pass a three-component match to be included:- Number match (35%) β normalized numeric overlap between claim and source
- Context match (25%) β content-term overlap between claim context and source text
- Proximity match (40%) β content-term overlap in an 80-character window around the matched number in the source