clean-citations
DRY-RUN citation repair skill. Reads check-citations JSON report (or re-runs check internally), then emits PROPOSED PATCH entries in JSON/Markdown under <scratch-dir>/citations/. No real file writes in v0. Companion write-enabled skill (v1) is planned. PRELIMINARY.
- License 许可
- GPL-3.0
- 最近更新
- 2026-11-13
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- clean-citations
- description
- DRY-RUN citation repair skill. Reads check-citations JSON report (or re-runs check internally), then emits PROPOSED PATCH entries in JSON/Markdown under <scratch-dir>/citations/. No real file writes in v0. Companion write-enabled skill (v1) is planned. PRELIMINARY.
03 SKILL.md 正文
STATUS: PRELIMINARY (DRY-RUN ONLY). This is a v0 preliminary per
he-cnat. Emits PROPOSED PATCH entries as JSON/Markdown; makes no real writes to.texor.bibfiles. Writes ONLY under<scratch-dir>/citations/. NoEdit/MultiEdit/Bashwrites/git commit/git push. All five safety gates (worktree check, clean baseline, audit log, confirm-ambiguous,notes.texguard) are recorded in the proposals header, not enforced with write refusals. A write-enabled v1 will enforce them.
clean-citations
DRY-RUN citation repair skill. Reads the check-citations JSON report for a .tex
file, inspects each flagged citation, proposes corrected \cite{} calls, and emits a
structured proposals file. Nothing is written to the source .tex file in v0.
When to use
Use after check-citations has produced its report (or pass the .tex path and let
this skill re-run the check internally):
- After
check-citationsflaggedbib_match: falseornon_pinpoint: trueentries and you want proposed corrections before committing to in-place writes. - When a human or agent wants to review proposed changes before applying them.
- As a pre-flight step before running the write-enabled v1 (once available).
Workflow
-
Locate the
check-citationsreport — look for<scratch-dir>/citations/check-citations-report.json. If not found (or if the caller passes a.texpath directly), re-runcheck-citationsinternally first. -
Inspect the report header — record safety context — Check the following conditions and write them into the proposals header (no write is gated on these in v0):
- Worktree check (REQ-010): run
git rev-parse --is-inside-work-tree 2>/dev/nullfrom the directory containing the.texfile. Recordworktree_status: insideorworktree_status: outside. - Clean baseline (REQ-011): run
git status --short <tex_file>and recordbaseline_clean: trueif the output is empty,falseotherwise. Include the uncommitted file list in the header if not clean. - notes.tex on main (REQ-014): check whether the target filename is
notes.texand whether the current branch ismain(ormaster). If both, setsafety_gate: BLOCKEDand note"notes.tex on main — no writes permitted". In v0 this is a header annotation only; no write is attempted regardless.
- Worktree check (REQ-010): run
-
For each flagged citation — iterate over the citations in the report where either
bib_match: falseornon_pinpoint: true. For each:a.
bib_match: false— the.bibentry is missing. Propose no textual change (cannot invent bibliography data). Set:issue: "missing_bib_key"proposed_after: nullconfidence: lowsafety_gate: MANUAL(human must add.bibentry first)
b.
non_pinpoint: truewithbib_match: true— the key exists but the citation lacks a pinpoint argument. The skill proposes that the caller add a pinpoint argument. Determineconfidenceas follows:- Read the
contextfield (surrounding text) from the check-citations entry. - If the context clearly indicates a single theorem/proposition/definition/remark
number (e.g. "by Theorem 3.2 in \cite{key}"), set
proposed_afterto\cite[Theorem 3.2]{key}andconfidence: high. - If the context is ambiguous (mathematical content referenced but no specific
item extractable from context), set
proposed_after: "\\cite[§SECTION OR THEOREM NUMBER]{key}"(placeholder) andconfidence: borderline. - If no mathematical context is visible within ±3 lines of the
\cite{}call, setproposed_after: nullandconfidence: low.
c.
non_pinpoint: trueANDbib_match: false— both issues. Setissue: "both"(the string literal"both", not an array). Setproposed_after: null,confidence: low,safety_gate: MANUAL. -
Write the proposals — create
<scratch-dir>/citations/:clean-citations-proposals.json — JSON proposals object clean-citations-proposals.md — human-readable Markdown summaryJSON structure:
{ "tex_file": "<absolute path>", "run_date": "<ISO date>", "safety_header": { "worktree_status": "inside|outside|unknown", "baseline_clean": true, "uncommitted_changes": [], "notes_tex_on_main": false, "safety_gate": "OK|BLOCKED" }, "proposals": [ { "key": "smith1984", "issue": "non_pinpoint|missing_bib_key|both", "tex_line": 47, "before": "\\cite{smith1984}", "proposed_after": "\\cite[Theorem 3.1]{smith1984}", "confidence": "high|borderline|low", "safety_gate": "OK|MANUAL|BLOCKED" } ], "summary": { "total_flagged": 3, "proposals_high": 1, "proposals_borderline": 1, "proposals_low_or_null": 1 } }Markdown format:
# clean-citations proposals tex_file: <path> worktree_status: inside baseline_clean: true safety_gate: OK | Line | Key | Issue | Before | Proposed after | Confidence | |------|-----|-------|--------|----------------|------------| | 47 | smith1984 | non_pinpoint | \cite{smith1984} | \cite[Theorem 3.1]{smith1984} | high | -
Empty / all-clean case — if the check-citations report has no entries with
bib_match: falseornon_pinpoint: true, write reports withproposals: []and summary"nothing to fix". Do NOT raise an error.
Idempotence (REQ-016)
In v0 (proposals mode), idempotence is naturally satisfied: the same check-citations report input produces the same proposals output. Running the skill twice on the same source file produces the same proposals JSON.
Output files
<scratch-dir>/citations/clean-citations-proposals.json<scratch-dir>/citations/clean-citations-proposals.md
Use the current bead ID from context as <bead>. If no bead is active, use a slug
like clean-citations-<yyyy-mm-dd>.
DRY-RUN constraint
This skill is entirely non-writing in v0:
- Use
ReadandBash(read-only:grep,find,git status,git rev-parse) only. - Write ONLY the two proposals files under
<scratch-dir>/citations/viaWrite. - Never call
Edit,MultiEdit, or write anything to the source.texfile. - Never run
git commit,git push,git add, orgit checkout. - Never call
bd updateor any bead-mutation command.
Cross-reference
check-citations is the producer of the report this skill consumes. Run it first:
/check-citations <path-to-tex> → produces check-citations-report.json
/clean-citations → reads that report, emits clean-citations-proposals.json
Examples
Non-pinpoint citation with context — high confidence:
check-citations report: {key: "jones2020", bib_match: true, non_pinpoint: true,
context: "...by Theorem 2.3 in \\cite{jones2020}..."}
→ proposal: {before: "\\cite{jones2020}",
proposed_after: "\\cite[Theorem 2.3]{jones2020}",
confidence: "high"}
Ambiguous context — borderline:
context: "...see \\cite{jones2020} for details..."
→ proposal: {proposed_after: "\\cite[§SECTION OR THEOREM NUMBER]{jones2020}",
confidence: "borderline"}
Missing bib key — manual intervention needed:
check-citations report: {key: "smith1984", bib_match: false}
→ proposal: {proposed_after: null, confidence: "low", safety_gate: "MANUAL"}
Nothing to fix:
check-citations report: all citations bib_match: true, non_pinpoint: false
→ clean-citations-proposals.json: {proposals: [], summary: "nothing to fix"}
notes.tex on main detected:
tex_file: /path/to/notes.tex branch: main
→ safety_header: {notes_tex_on_main: true, safety_gate: "BLOCKED"}
→ proposals: [] (no proposals emitted when BLOCKED)
04 同仓库更多 Skills
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
writing-plans
Use when you have a spec or requirements for a multi-step task, before touching code
verification-before-completion
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
using-superpowers
Use when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions
using-git-worktrees
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback
test-driven-development
Use when implementing any feature or bugfix, before writing implementation code