sn-prepare-citations

Converts footnote-style citations into numbered references and appends a bibliography to research reports.

5.3k|380|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/OpenSenseNova/SenseNova-Skills --skill sn-prepare-citations
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sn-prepare-citations
Source: https://github.com/OpenSenseNova/SenseNova-Skills/tree/main/skills/sn-prepare-citations
Command: npx skills add https://github.com/OpenSenseNova/SenseNova-Skills --skill sn-prepare-citations

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Deep research reports written by AI agents often contain raw footnote-style citation keys like [^source_id], duplicate sources across evidence files, and leaked internal claim IDs. This Skill post-processes the final stitched Markdown report into a clean, deliverable document with numbered [N] citations and a proper bibliography.

Core Features & Use Cases

  • Citation Deduplication and Numbering: Collects sources from all evidence.json files, merges same-URL sources, and converts [^source_id] references into sequential [N] numbers.
  • Claim-ID Leakage Repair: Detects writer bugs where internal claim IDs like [^d8.c19] are used as citation keys and automatically substitutes the correct source IDs, reporting unresolved cases.
  • L0 Summary and TOC Rendering: Optionally inserts a key-findings summary box after the H1 title and auto-generates a table of contents from H2/H3 headings when an outline.json is provided.
  • Use Case: After a deep research pipeline produces stitched.md plus per-section evidence.json files, run this Skill to produce the final report.md with numbered citations, a 参考文献 bibliography section, and a citations.json metadata file.

Quick Start

Run the prepare_citations script on my stitched.md report with all the evidence.json files and outline.json to produce the final report.md with numbered citations and a bibliography.

Frequently Asked Questions about sn-prepare-citations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert footnote citations to numbered references in Markdown?

Run prepare_citations.py with --report pointing to your Markdown file and --evidence listing all evidence.json files. The script replaces [^source_id] keys with sequential [N] numbers in first-appearance order and appends a numbered bibliography section.

How to deduplicate citations from multiple evidence JSON files?

The script normalizes URLs by lowercasing scheme and host, stripping trailing slashes, and dropping fragments. Sources sharing a normalized URL across evidence files merge into a single citation, with the first-seen ID kept as primary.

Does the citation script require external Python packages?

No, prepare_citations.py uses only the Python 3 standard library: argparse, json, re, dataclasses, pathlib, and urllib.parse. It runs directly with python3 without installing any dependencies.

What happens when a citation key has no matching source?

Unmatched [^key] references are left as-is in the output and reported in the orphan_citations field of the JSON stdout result. The controller guidance says not to deliver the report until a writer or review step fixes or removes those citations.

Why do claim IDs like [^d8.c19] appear in my report?

This is claim-ID leakage, where the writer agent mistakenly used internal evidence claim indexes as citation keys. The script maps each claim ID to its evidence source IDs and substitutes them automatically, reporting resolved and unresolved cases in the claim_id_leakage field.

Can I disable the TOC or summary box generation?

Yes, pass --no-toc to skip table of contents generation or --no-l0 to skip the key-findings summary box. Both are enabled by default only when an --outline JSON file is provided; without --outline the script runs in legacy citation-only mode.