verify

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

/verify — DeepCitation Verification

/verify — DeepCitation 验证功能

Verify claims against source documents using the DeepCitation API, saving JSON artifacts at each step.
使用DeepCitation API验证声明与源文档的一致性,并在每个步骤保存JSON工件。

Prerequisites

前置条件

  • DEEPCITATION_API_KEY
    environment variable must be set. If not set, try loading saved credentials:
    bash
    eval "$(npx -y deepcitation env 2>/dev/null)"
    If that also fails, tell the user to run
    npx -y deepcitation login
    first, then retry.
  • Source files (PDF, DOCX, images, etc.) must be accessible on disk or via URL
  • Accepted file types: PDF, images (JPG, PNG), Office files (DOCX, XLSX, PPTX), CSV, TSV, ODF
  • 必须设置
    DEEPCITATION_API_KEY
    环境变量。如果未设置,请尝试加载已保存的凭据:
    bash
    eval "$(npx -y deepcitation env 2>/dev/null)"
    如果仍失败,请告知用户先运行
    npx -y deepcitation login
    ,然后重试。
  • 源文件(PDF、DOCX、图片等)必须可通过本地磁盘或URL访问
  • 支持的文件类型:PDF、图片(JPG、PNG)、Office文件(DOCX、XLSX、PPTX)、CSV、TSV、ODF

Key Rules

核心规则

  • page_id
    and
    line_ids
    MUST come from the
    deepTextPromptPortion
    — see rules/line-ids.md for details.
  • Coverage audit: After generating citations, spawn a subagent to audit the report/chat and confirm all facts, sources, names, dates, and values have deepcitations. The subagent should flag any uncited claims.
  • page_id
    line_ids
    必须来自
    deepTextPromptPortion
    ——详情请参见rules/line-ids.md
  • 覆盖范围审核:生成引用后,启动子代理审核报告/对话,确认所有事实、来源、名称、日期和数值都已添加deepcitations。子代理应标记任何未引用的声明。

Workflow

工作流

Step 0: Analyze input

步骤0:分析输入

Load rules/analyze-input.md to determine which path to follow (A–F) based on what's in the conversation, arguments, and working directory.
加载rules/analyze-input.md,根据对话内容、参数和工作目录确定要遵循的路径(A–F)。

Step 1: Prepare sources

步骤1:准备源文件

Load rules/prepare-sources.md for CLI usage and what to retain from each prepare response.
加载rules/prepare-sources.md了解CLI用法以及需要从每个准备响应中保留的内容。

Step 2: Build citations

步骤2:构建引用

Load rules/build-citations.md for the full citation-building workflow:
  • Path A: Existing
    <<<CITATION_DATA>>>
    — skip to Step 3
  • Path B: Existing HTML with claims — identify claims, build citation data, generate keys, annotate HTML
  • Path C: Generate new cited response from scratch using the canonical citation format spec
加载rules/build-citations.md查看完整的引用构建工作流:
  • 路径A:已有
    <<<CITATION_DATA>>>
    ——跳至步骤3
  • 路径B:已有包含声明的HTML——识别声明、构建引用数据、生成密钥、标注HTML
  • 路径C:使用标准引用格式规范从头生成新的带引用响应

Step 3–5: Verify, inject, validate

步骤3–5:验证、注入、校验

Load rules/verify-and-inject.md for verification, HTML injection, and pre-delivery validation.
加载rules/verify-and-inject.md了解验证、HTML注入和交付前校验的流程。

When building citations

构建引用时的注意事项

When dealing with
lineIds
and
pageNumber
values, load rules/line-ids.md for how sparse line IDs work and how to find the right one.
When annotating HTML with
data-citation-key
attributes, load rules/annotate-html.md for placement rules, key-map building, and citation drawer triggers.
处理
lineIds
pageNumber
值时,请加载rules/line-ids.md了解稀疏行ID的工作原理以及如何找到正确的行ID。
使用
data-citation-key
属性标注HTML时,请加载rules/annotate-html.md了解放置规则、密钥映射构建和引用抽屉触发方式。

Output artifacts

输出工件

All artifacts are saved in
.deepcitation/
. Use
{topic}-{timestamp}
naming so re-runs don't clobber each other:
FileContents
prepare-{source}-{timestamp}.json
Upload response with
attachmentId
and
deepTextPromptPortion
llm-output-{timestamp}.txt
Full LLM response including
<<<CITATION_DATA>>>
block
citations-{timestamp}.json
Extracted
CitationRecord
with human-readable keys
citations-keyed-{timestamp}.json
Re-keyed citations with hashed keys (from
keygen
)
key-map-{timestamp}.json
Human-readable key → hashed key mapping
annotated-{timestamp}.html
HTML with
data-citation-key
attributes (before injection)
verify-response-{timestamp}.json
Verification results with statuses and evidence
injected-{timestamp}.html
Injected HTML with CDN runtime (Path B output)
所有工件都保存在
.deepcitation/
目录下。使用
{topic}-{timestamp}
命名格式,避免重新运行时覆盖现有文件:
文件内容
prepare-{source}-{timestamp}.json
包含
attachmentId
deepTextPromptPortion
的上传响应
llm-output-{timestamp}.txt
包含
<<<CITATION_DATA>>>
块的完整LLM响应
citations-{timestamp}.json
提取的
CitationRecord
,带人类可读密钥
citations-keyed-{timestamp}.json
使用哈希密钥重新标记的引用(来自
keygen
key-map-{timestamp}.json
人类可读密钥→哈希密钥的映射
annotated-{timestamp}.html
带有
data-citation-key
属性的HTML(注入前)
verify-response-{timestamp}.json
包含状态和证据的验证结果
injected-{timestamp}.html
注入CDN运行时的HTML(路径B输出)

Important rules

重要规则

  • Product name: Always "DeepCitation" (never "DeepCite")
  • Track attachmentId: Always retain the
    attachmentId
    from Step 1 — it's the key for verification lookups
  • Strip before display: Use
    extractVisibleText()
    to remove
    <<<CITATION_DATA>>>
    before showing text to user
  • CitationRecord is an object: Check emptiness with
    Object.keys(citations).length === 0
  • API key security: Never log or display
    DEEPCITATION_API_KEY
  • Verbatim quotes:
    fullPhrase
    must be copied exactly from the source — do not paraphrase
  • 产品名称:始终使用“DeepCitation”(绝不能用“DeepCite”)
  • 跟踪attachmentId:务必保留步骤1中的
    attachmentId
    ——它是验证查找的关键
  • 显示前剥离内容:使用
    extractVisibleText()
    在向用户显示文本前移除
    <<<CITATION_DATA>>>
  • CitationRecord是对象:通过
    Object.keys(citations).length === 0
    检查是否为空
  • API密钥安全:绝不要记录或显示
    DEEPCITATION_API_KEY
  • 精确引用
    fullPhrase
    必须完全从源文件复制——不得意译

References

参考资料

ARGUMENTS: $ARGUMENTS
参数:$ARGUMENTS