/agent-loops:literature-surveyfrom agent-loops
Builds a structured evidence/contradiction matrix from iterative literature search until saturation. Outputs a map of consensus, disputes, and gaps with verbatim citations.
Ships in agent-loops. 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.
Read when SKILL.md points to them.
A search → extract → map → expand loop that builds an evidence/contradiction matrix and stops
at saturation. The artifact is the matrix (claims × sources, with each source's stance); the
feedback signal is how many new, matrix-changing sources a round adds — you keep expanding until
that falls below <min_new> for <patience> rounds. Unlike a one-shot summary, the loop deliberately
hunts contradictions and gaps and keeps pulling threads until the picture stops changing.
The discipline: every cell — a source's stance on a claim — is backed by a verbatim snippet from a real retrieval. The value is not a tidy narrative; it is an honest map of where the literature agrees, disagrees, and is silent.
Use this for a multi-source survey of a question where the deliverable is a structured map of the evidence, not a paragraph. Default: run the full expand→admit→map loop below until saturation. Escape hatch: if the user wants only a quick scan, run round 0 (seed) alone and hand back the seed matrix. Not for grading a written proposal against the literature, and not for proposing new hypotheses.
Resolve bindings interactively. If loop.run.yaml exists in the working dir, load it, confirm the
values in one line, and skip to the loop. Otherwise: on Claude Code (the AskUserQuestion tool is
available) infer a likely value for each binding and present it as the recommended option; on other
hosts ask each as a quoted plain-text prompt. Then write loop.run.yaml (format:
examples/run.example.yaml) and confirm every value plus the live/degraded literature tier before
creating any other files.
| binding | meaning | default | how to infer |
|---|---|---|---|
<question> | the survey question/topic, with any scope (years, sub-fields, inclusion criteria) | — | ask the user; restate the scope back for confirmation |
<eval_scale> | depth per round (low/medium/high, see below) | medium | — |
<matrix> | structured output matrix (validates schemas/matrix.schema.json); survey.md written alongside | <sandbox_root>/matrix.json | — |
<sandbox_root> | where the matrix, survey.md, ledger, and lit cache live | ./sandbox | — |
<budget> | max rounds | 6 | — |
<patience> | stop after this many consecutive "dry" rounds | 2 | — |
<min_new> | saturation threshold — a round is "dry" if it adds fewer than this many new, matrix-changing sources | 2 | — |
Evaluation depth dial (<eval_scale> caps per round — queries · citation-walks · fulltext reads ·
new-source admit cap):
| preset | queries · walks | fulltext reads | new-source cap |
|---|---|---|---|
| low | 2 · 0 | 0 (snippet/abstract only) | ~6 |
| medium (recommended) | 4 · 1 | 1 | ~10 |
| high | 6 · ≥2 | 3 | ~16 |
Literature toolchain. Paper search goes through the sibling literature-search skill: resolve
<lit_skill_dir> (it installs as a sibling, default ~/.claude/skills/literature-search/),
<lit_py> = python3, and <lit> = <lit_skill_dir>/tools/lit_search.py (note the tools/
segment); append --cache-dir <sandbox_root>/literature/.cache after a subcommand to reuse the cache.
Subcommands used here: search "<q>" (discover sources), snippet "<q>" (verbatim passage = the
evidence for a cell), cite <paperId> --direction references|citations|recommend (walk the citation
graph), fulltext <arxivId> (deep-read one key paper). Confirm <lit> --help works at setup; because
this loop is literature retrieval, do not silently proceed if the skill is missing — tell the user
and either install it or degrade all retrieval to WebSearch/WebFetch (no ranked snippets or
citation-graph expansion), tagging that evidence source:"web".
S2 key (optional, never block). A free S2_API_KEY makes snippet/cite reliable. Run
<lit> keys --init, have the user fill the printed keys.env themselves, never paste secrets into
chat; a missing key just degrades to the keyless pool → WebSearch. Record presence (booleans only) in
loop.run.yaml.
matrix = sources + claims + gaps (starts empty). dry = consecutive dry rounds (starts 0). <N>
starts at 0.
Copy this checklist and tick items off:
<question> into sub-topics; run one <lit> search each, admit the most relevant sources, extract each one's key claim(s) into the matrix with a verbatim snippet, note obvious gaps.<lit> search queries and walk the citation graph (<lit> cite) from the 1-2 most central papers. Honor the <eval_scale> caps.sources (by title/id); for each genuinely new source extract its key claim(s) + a verbatim snippet.is_contested when sources both support and contradict; add newly-exposed gaps.dry += 1 if fewer than <min_new>, else dry = 0. Steer the next round at whatever is still thin.N = N + 1; stop on saturation (dry == <patience>) or <budget>.On stop, write <matrix> (validates schemas/matrix.schema.json) and survey.md — a synthesis
organized as consensus (well-supported claims), disputes (the contested claims and who is on
each side), and gaps (open questions), each citing its sources, plus an honest coverage note
naming which sub-topics are well covered and which are thin.
The matrix is the schema-validated artifact; a compact generic instance (see
schemas/matrix.schema.json):
{
"question": "<question>",
"sources": [{"key": "S1", "title": "...", "source": "s2", "id": "...", "year": 2022}],
"claims": [{
"claim_id": "C1", "statement": "...", "is_contested": true,
"positions": [
{"source_key": "S1", "stance": "supports", "snippet": "verbatim passage ..."},
{"source_key": "S3", "stance": "contradicts", "snippet": "verbatim passage ..."}
]
}],
"gaps": ["open question the survey surfaced"]
}
source ∈ {s2, arxiv, web}; stance ∈ {supports, contradicts, qualifies}.
<sandbox_root>/ledger.tsv, tab-separated, never commas in the text. Header:
round queries new_sources total_sources new_claims contested dry
Example:
round queries new_sources total_sources new_claims contested dry
0 4 7 7 9 1 0
1 5 5 12 4 2 0
2 4 1 13 0 2 1
3 4 0 13 0 2 2
Report the new-sources trajectory so the reader sees saturation actually happen, not just the final count.
<lit> / WebFetch
retrieval that round, and snippets are verbatim; on {"error","fallback"}, use WebSearch/WebFetch
and tag the evidence source:"web" — the verbatim-snippet rule is what makes the matrix trustworthy.is_contested, both snippets); surfacing disputes is the point, not picking a winner.<min_new>, and report coverage honestly rather than implying completeness the search did not reach.literature-search skill is stdlib-only; never print or commit API keys
(keys.env stays gitignored at the project root). The sandbox is self-contained — no ../ escapes.The loop stops on the first of:
dry == <patience> (each of those rounds added fewer than <min_new> new sources).N == <budget> rounds reached.Always end with: the <matrix> path, the synthesis (consensus / disputes / gaps), the source count and
new-sources trajectory from ledger.tsv showing saturation, and the coverage note naming the thin spots.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub gaasher/agent-loop-skills --plugin agent-loops25 skills in this plugin
/alpha-evolveUse when the user wants to evolve an ML model/program through population-based search rather than a single sequential refine loop — a generational evolution where parallel proposers each apply one small SEARCH/REPLACE diff to a parent, scored by a cascade-evaluated training run, and children are kept in a MAP-Elites archive across islands (with migration + checkpointing) so diverse high performers survive. A finite, bounded-parallelism re-creation of AlphaEvolve/OpenEvolve, bent for ML autoresearch. Runs to a fixed compute budget or until interrupted. Not for the sequential single-thread autoresearch loops (one change → measure → keep/revert), and not for verifying a known bug or external claim — this is parallel, diversity-preserving search over a program.
/anomaly-investigationUse when the user has a known, already-observed anomaly in their data — a metric spike or drop, an outlier, an unexpected number — and wants its root cause diagnosed, not guessed. Forms a slate of candidate causes, tests each against the data, and eliminates the ones the data refutes, narrowing the live candidates until exactly one survives refutation and passes a positive confirming test. The result is an investigation log with the confirmed root cause and the evidence that ruled out the alternatives. Not for open-ended discovery over a dataset with no specific anomaly in hand (that is data-analysis), and not for checking an external claim against sources (that is claim-verify) — this is reactive diagnosis of one anomaly you already know about.
/blue-teamUse when the user has concrete failing cases in code or a guardrail/classifier/filter/prompt/API they own — a red-team failure catalogue OR a CI/CD test-failure report (failing pytest/JUnit tests) — and wants the target patched until those failures are closed without breaking what already works. It points straight at the failed cases (normalize any source with tools/ingest.py), fixes one root-cause class per iteration, and re-checks with tools/verify.py — oracle mode against a red-team oracle, or tests mode against the test suite — keeping a patch only if it closes a class while nothing that passed before regresses, else reverting; loops until every class is closed (dry) or the budget runs out, then opens a pull request with the patch set. The defensive fixer half of a find→fix setup. Not for discovering new failures (that is red-team), and not for editing the oracle, tests, or holdout that define ground truth.
/claim-verifyUse when the user has a results draft or a set of data-backed claims and wants each one adversarially verified against the underlying dataset before publishing — a pre-publication red-team of the findings. Extracts the discrete checkable claims from the draft, reproduces each claim's number against the data, stress-tests it against the threats most likely to kill it (outliers, confounds, Simpson's reversals, tiny subgroups, alternative specifications), and marks it verified, fragile, or refuted; fragile and refuted claims are revised — hedged, scoped, or retracted — until every claim is verified or appropriately qualified. The result is a draft where every surviving claim has been reproduced and survived a stress test. Not for open-ended discovery of new findings over a dataset (that is a data-analysis task), and not for diagnosing a single known anomaly or pipeline failure — this is a gate over an existing draft.
/data-analysisUse when the user wants an iterative, self-checking exploratory analysis of a dataset — surfacing findings that are each verified by re-running the computation, not asserted. Proposes one specific hypothesis at a time, writes and runs analysis code to test it, and records the finding only if the numbers support it at a meaningful effect size; loops until no new verified finding appears or the budget is hit. The result is a findings report where every claim is backed by a reproducible number. Not for diagnosing a single known anomaly or pipeline failure, and not for verifying an external claim against sources (that is a claim-verification task) — this is open-ended discovery over a bound dataset.
/dueling-autoresearchUse when the user wants two approaches raced head-to-head on a single shared metric — e.g. a classical/algorithmic lane vs an ML/learned lane, or any two strategies for the same task. Each lane runs its own analysis-first research loop confined to its lane, the lanes share a scoreboard and may borrow ideas across the boundary without abandoning their identity, and a shared eval keeps the head-to-head honest; loops until interrupted, reporting the current leader. Not for improving a single approach in isolation (use a single-track research loop), and not for picking between two finished artifacts in one shot (that is a one-time comparison).
Other plugins' skills for the same job