> ## Documentation Index
> Fetch the complete documentation index at: https://docs.interpscout.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Document Workshop

> Five stages from raw source to a mechanically accepted course glossary

Course production isn't one tool call. It's a five-stage pipeline where mechanical tools do the deterministic parts and the agent's judgment is reserved for the one part that genuinely needs it: deciding which terms in a document are worth an interpreter's preparation time.

## The five stages

<Steps>
  <Step title="Stage the source (mechanical)">
    A tool fetches the source, follows pagination if the source is paginated, cleans and aligns it into Chinese/English paragraph pairs, and runs an identity check to confirm the fetched text is actually the document the teacher asked for — not a different document with a similar title. This stage writes a skeleton straight to the database (paragraphs, no terms yet) and writes the aligned text out to a set of sandbox files. It does not extract any terminology.
  </Step>

  <Step title="The workshop (agent judgment)">
    The agent reads the staged document window by window — never the whole thing at once — and curates a candidate glossary as it goes, writing candidates to a sandbox file after every window rather than holding them in memory. A second pass rechecks anything it flagged as uncertain and greps for word-family members it may have missed the first time around. Uncertain official renderings get a web search, not a guess.
  </Step>

  <Step title="Adversarial review">
    The finished candidate glossary — plus a manifest of the document and a sample of the source text — is handed to a separate reviewer sub-agent with its own fresh context and no access to the producing agent's history. Its explicit job is to falsify, not to approve: it flags fabricated or misaligned pairs, everyday words below an interpreter's difficulty bar, whole section headings copied in as if they were terms, plausible-but-not-official renderings, and — just as important — terms it can see in the sample that the glossary missed. The producing agent revises against that verdict before moving on.
  </Step>

  <Step title="Submit (mechanical)">
    The revised glossary goes through a save tool that runs it past a stack of deterministic gates — not a second opinion from another model. A term that fails any gate is rejected with a specific, actionable reason; if too many terms fail, or too few survive relative to the document's length, the whole submission is rejected and sent back for another curation pass inside the same agent session.
  </Step>

  <Step title="Done">
    Once the gates pass, the course is marked complete in the same transaction that saves its content — there's no separate "finalize" step that can silently fall out of sync with what was actually saved.
  </Step>
</Steps>

## What the mechanical gates actually check

The submission gates aren't a vague quality score. Each one checks something specific and reproducible:

* **Stopword and boilerplate rejection** — site names and navigation text that occasionally get scraped in as if they were terms.
* **A length cap** — nothing that looks like a whole sentence or a filename gets accepted as a "term."
* **A ratio band between the Chinese and English sides** of a pair, to catch fragment mismatches (for example, an alignment of 武汉保卫战 with only "Wuhan" — a fragment, not a translation).
* **Three-tier literal verification** — every submitted term has to actually be locatable in the source text the course was built from; a term the agent can't be found verbatim in the document is rejected as fabricated or paraphrased, not silently kept.
* **Title-row rejection** — a term that turns out to be sitting inside a heading rather than body text is rejected, even if it passed every other check.
* **A density floor and a rejection-ratio ceiling** — if the surviving glossary is too thin relative to the document's length, or too much of what was submitted got rejected, the whole batch bounces back rather than shipping a sparse or low-quality result.
* **Alignment granularity assertions** — for documents that needed manual paragraph alignment, a single aligned pair can't span more than roughly 700 Chinese characters, and the aligned pairs have to cover a real majority of the source's paragraphs, so a "700-word chapter crammed into one giant pair" alignment can't sneak through.

A rejection here isn't a failure state for the task — it's an instruction. The agent reads the specific reasons, fixes the glossary inside the same session, and resubmits. Only a source that turns out to be unusable (not actually bilingual, not the document that was asked for, an excerpt rather than the full text) ends production outright.

<Note>
  The full philosophy behind "gates check, prompts don't guarantee" is in [Truth Layer & Mechanical Invariants](/internals/truth-layer).
</Note>
