/ai-slop:groundfrom ai-slop
Fetches cited sources for LaTeX \cite{} commands and writes verbatim % GROUNDING comments with supporting quotes, or TODO verify stubs when sources cannot be retrieved.
Ships in ai-slop. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This skill fills the grounding comments that review mode flags as missing. /ai-slop:review lists every \cite{} missing a % GROUNDING: comment as a grounding to-do but never fills it. Ground mode fetches each cited source, extracts a verbatim quote supporting the claim that the paper attributes to it, and writes the grounding comment into the LaTeX. Where the source cannot be retrieved, it writes a TODO verify -- <reason> stub instead, never a quote from memory. Quote-less TODO verify stubs, left by /ai-slop:revise or by an earlier ground run, count as unfilled. Ground picks up the citations that carry these stubs and replaces the stub with the retrieved quote.
Audience and tone. The default user is an author who has citations to ground before submission. The result is an audit trail in the source: a quote that co-authors and reviewers can check against each citation. Frame the summary as work completed and work still needing the author's attention, not as a verdict.
The anti-fabrication rule. A quote is written into the paper only when the source text was actually retrieved (fetched from the web or read from a local file). If it was not retrieved, the comment is TODO verify -- <reason>, never an approximation, paraphrase, or remembered quote. This rule applies the principle of the skill, to verify rather than assert. The grounding comment certifies that the cited source says what the paper claims, so a fabricated quote is worse than an honest TODO. Hold every grounding agent to this rule, and do not rely on the agents alone. Step 6 re-reads each named source and checks that the quote occurs in it before anything is written.
This workflow works in Claude Code, Codex, and pi. Resolve <skill-dir> to the absolute directory containing this SKILL.md, using the skill path supplied by the client. Substitute that directory in every command below and keep the script path quoted. Resolve ../../shared/ and other bundled paths relative to that directory, while keeping the working directory at the user's project. No client-specific environment variable is required.
In Claude Code, invoke /ai-slop:ground. In Codex, select the ai-slop:ground skill through /skills or a $ mention. In pi, invoke /skill:ground. References to other /ai-slop: commands below mean the corresponding sibling skill in any client.
Invoke this skill when the user:
% GROUNDING: comments, or "close the grounding to-do" from an /ai-slop:review./ai-slop:ground.Do not invoke for a fresh review (use /ai-slop:review), to apply the prose suggestions of a review report (use /ai-slop:revise), or on a non-LaTeX document. Grounding writes an inline LaTeX comment, so it is LaTeX-only. Neither Markdown nor PDF has an inline comment syntax that could hold the audit trail.
The skill operates on the LaTeX paper in the current working directory. No arguments are required.
python3 "<skill-dir>/../../scripts/find_latex_root.py". Exit 0 means that the printed path is the root. Exit 2 means multiple candidate roots, so list them and ask which to ground. Exit 1 means no .tex root, so stop. A .tex path can be passed as the first argument to override the scan.python3 "<skill-dir>/../../scripts/detect_scope.py" <resolved-path>. Proceed only on latex. On general, stop and tell the user that grounding is LaTeX-only.paywalled or book.Resolve and check the scope. Auto-detect the LaTeX root (or use the supplied path) and confirm that detect_scope.py reports latex. Stop on a non-LaTeX target.
Extract the citations. Run python3 "<skill-dir>/../../scripts/extract_cites.py" <path> and capture stdout to grounding-cites.json in the working directory. The JSON holds:
sites: every citation call, with file, line, command, keys, the enclosing-sentence claim, and groundable / grounded flags.by_key: per unique key, the de-duplicated claims and the sites that cite it.meta: per key, the .bib metadata (type, title, author, year, doi, url, eprint, howpublished) needed to identify and locate the source.The script prints to stderr a one-line summary (sites, unique keys, groundable sites still missing a comment, metadata coverage). Add grounding-cites.json and grounding-quotes.json to the top-level .gitignore (resolve the root with git rev-parse --show-toplevel, and create the file if absent). Both files are generated artifacts and must not be committed.
Pick the keys to ground. From by_key, take the keys with at least one site where groundable is true and grounded is false. grounded is true only for a quote-backed comment, so sites carrying a quote-less TODO verify stub are selected and filled. Keys already grounded everywhere are skipped. Keys that appear only in style-only helpers (\citeauthor / \citeyear, groundable: false) are context, not insertion targets. If a key has no entry in meta, note it. The .bib lacks that key, so the agent has only the claim text to work from, and the result is likely a not-found TODO.
Ground each unique source, one agent per key, chunked. Author an inline grounding Workflow (see the reusable pattern below). Each agent receives the bundle for one key (its meta and its list of claims) and is told to:
url / eprint if present, or a user-supplied local file).source, so step 6 can check the quote against it.paywalled, abstract-only (only the abstract was reachable and it does not contain the support), book (no digital full text), not-found (the source could not be located), or source-does-not-support (the source was read but does not back the claim).Run the agents in slices of at most 8, staying within the client's available agent slots, so that a burst does not trip server-side rate limits. If delegation is unavailable, process the same per-source prompts sequentially. The run is resumable. Any source that errored or was skipped simply stays without a quote, so its site keeps the missing comment or the TODO verify stub and a later /ai-slop:ground picks it up and fills it.
Assemble the quotes file. Collect the agents' results into grounding-quotes.json, mapping each key to either {"quote": "<verbatim text>", "source": "<url or path>"} or {"todo": "<reason>"}. Write nothing for a key if its agent failed entirely. Leaving it absent keeps it for a future run.
Check the quotes against their sources. Run python3 "<skill-dir>/../../scripts/check_quotes.py" grounding-quotes.json --apply [--sources-dir <dir>]. For each quote it re-reads the named source (a local text file, or an HTML or plain-text URL) and confirms that the quote occurs in it after whitespace and punctuation normalization. A quote that does not occur is downgraded in place to {"todo": "unverified", "source": "<the same source>"}, and each verdict is printed as <key>\t<verdict>\t<detail>. A PDF, a binary, or an unreachable source comes back unverifiable or unreachable. Open that source yourself with the client's PDF reader or web tools, confirm the quote, and downgrade it by hand the same way when you cannot. Nothing goes into the paper that neither the script nor you have seen in the source.
Insert the comments. Run python3 "<skill-dir>/../../scripts/insert_grounding.py" grounding-cites.json grounding-quotes.json. It writes % GROUNDING: <key> -- "<quote>" (or the TODO verify -- <reason> form) after each groundable, ungrounded citation line, matching the indentation of that line. An existing quote-less TODO verify stub for the key is replaced in place. A site with a quote-backed comment for the key is left alone (idempotent), and each line is re-checked against the file before editing, so any site that moved is skipped. Use --dry-run first if the user wants to preview the edits.
Summarize. Tell the user, in plain terms:
unverified marks a returned quote that the check could not find in its source).source-does-not-support cases, called out first. Each one flags a likely miscitation (a wrong key, or a citation that claims more than the source says), because the source was read and does not back the claim. Report each one with its key and the claim so that the author can fix the citation, not just the comment..bib metadata.Stop. Leave the edits in the working tree. The user inspects them with git diff and commits when satisfied. Do not commit, and do not run a review.
The grounding fan-out is a chunked-parallel() workflow. The bundles of claims, one per source, are passed in as args.sources (built from by_key / meta). Each source gets one schema-validated agent, and the agents run in fixed-size slices to stay under rate limits. Author it inline:
export const meta = {
name: 'ground-citations',
description: 'Fetch each cited source and extract a verbatim supporting quote',
phases: [{ title: 'Ground' }],
}
// One bundle per key to ground, embedded from grounding-cites.json.
const SOURCES = args.sources // [{ key, meta: {...}, claims: [...] }]
const QUOTE = {
type: 'object',
properties: {
key: { type: 'string' },
status: { enum: ['quote', 'todo'] },
quote: { type: 'string' }, // verbatim, present iff status == 'quote'
source: { type: 'string' }, // the URL or local path read, present iff status == 'quote'
reason: { enum: ['paywalled', 'abstract-only', 'book', 'not-found', 'source-does-not-support'] },
},
required: ['key', 'status'],
}
const results = []
for (let i = 0; i < SOURCES.length; i += 8) { // slices of ~8 -> rate-limit safe
const slice = SOURCES.slice(i, i + 8)
const got = await parallel(slice.map(src => () =>
agent(
`Ground this citation. Source metadata: ${JSON.stringify(src.meta)}. ` +
`Claims the paper attributes to it: ${JSON.stringify(src.claims)}.\n` +
`Retrieve the source (DOI/title/URL, or a provided local file) and copy a short ` +
`verbatim quote that supports the claim(s). Return status:"quote" with the quote and the ` +
`URL or file you read as source ONLY if you actually retrieved the source text. If you ` +
`could not, return status:"todo" with ` +
`a reason: paywalled, abstract-only, book, not-found, or source-does-not-support. ` +
`Never return a quote from memory or a paraphrase.`,
{ label: `ground:${src.key}`, phase: 'Ground', schema: QUOTE },
).then(r => ({ ...r, key: src.key })) // pin the key, never trust the model to echo it
))
results.push(...got.filter(Boolean))
}
return results
Map each result to grounding-quotes.json: status: 'quote' becomes {quote, source}, and status: 'todo' becomes {todo: reason}. If the Workflow tool is unavailable in the client, fan the same per-source prompts out with individual sub-agents, or process them sequentially. The schema and the anti-fabrication rule are unchanged.
../../scripts/extract_cites.py: resolves the LaTeX root, follows \input / \include, and emits the sites / by_key / meta JSON. Shares its citation scanner with find_citation_issues.py (cite_scan.py) and its .bib parser with check_bib_fields.py / verify_references.py (bib_parse.py).../../scripts/check_quotes.py: checks each returned quote against the source that it names and downgrades each quote that it cannot find.../../scripts/insert_grounding.py: writes the % GROUNDING: comments back idempotently from the quotes JSON.../../scripts/find_latex_root.py, ../../scripts/detect_scope.py: locate the root and restrict the skill to LaTeX.../../shared/rules-latex.md: defines the % GROUNDING: convention that this skill fills. It is referenced as a fallback when the user asks why grounding matters.TODO verify -- <reason>. This rule has no exceptions.source-does-not-support as a finding. It marks a likely miscitation, not a missing quote. Report these prominently with the key and claim.% GROUNDING: lines. The skill also adds its two generated JSON files to the top-level .gitignore.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
9 skills in this plugin
/glossaryExtract or maintain GLOSSARY.md for a document and validate its terminology. Use when the user asks for a glossary, proposed definitions, a synonym audit, or a check that a paper or document uses one term for each concept. Flags competing names, conflicting meanings, undefined terms, and newly invented labels for existing concepts. Supports LaTeX, PDF, Markdown, and plain text, and finds the main document when no filename is supplied. Writes a glossary and a terminology report, validates an existing glossary with --check, or converts it to the format and to ISO 704 definitions with --convert. --ste adds the Simplified Technical English layer. Does not rewrite the document. For the text of a whole repository, use glossary-repo./glossary-repoBuild or maintain GLOSSARY.md for a whole repository and check its terminology. Use when the user asks for a glossary of a code base, a project, or a paper repository, or for a check that its documentation, code comments, user-facing messages, and LaTeX or Markdown files use one term for each concept. Reads every text file of the repository through the shared repository scan, including the comments and prose string literals of source code, and the identifiers that name each concept. Flags competing names, conflicting meanings, undefined terms, avoided vocabulary, and newly invented labels for existing concepts. Writes a glossary and a terminology report grouped by file, validates an existing glossary with --check, or converts it to the format and to ISO 704 definitions with --convert. --ste adds the Simplified Technical English layer. Does not change the repository files that it checks.npx claudepluginhub se-uhd/ai-slop-skill --plugin ai-slopOther plugins' skills for the same job