sv-lit
Skill29 starsChanged 7 days agoApache-2.0View on GitHub
Survey real related work for a SocioVerse2 study. Two tiers — a fast default across OpenAlex / Semantic Scholar / CrossRef / PubMed / arXiv (+ Chinese-native sources) via the vendored paper-search-pro engine, and an opt-in deep tier (deep-research lit-review) that adds multi-agent synthesis and per-reference verification but is markedly slower and more expensive, so ask first. Either way, write per-paper relevance notes tied to THIS study and produce literature/literature.json + references.bib for the dashboard's Literature tab and /sv-paper's Related Work. Usable any time after sv-init; /sv-paper REQUIRES it to have run.
- Installs packages
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- paper-search-proSkill
- research-paper-writingSkill
- sv-build-environmentSkill
- sv-build-modelSkill
- sv-build-populationSkill
- sv-initSkill
- sv-iterateSkill
- sv-paperSkill
- sv-reportSkill
- sv-runSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
NEVER fabricate a reference: Every paper in the output must come from a retrieval call in this session.
- Distinctive: line 36
When the user proactively says "go deeper / be more comprehensive / check the citations for me", go straight to the deep tier.
- Very specific: line 38
How to run the deep tier: read .claude/skills/deep-research/SKILL.md and drive it in lit-review mode, with this study's research_question …
- Very specific: line 173
Never pad a thin result with papers you "know" — /sv-paper cites these bibkeys, and a fabricated entry there is the single worst failure …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
sv-lit — survey related work (real papers, per-paper relevance)
Ground the study in the actual literature: retrieve REAL papers, judge each one's relevance to this study specifically, and leave a citable trail.
Strict contract
- Read
study.yaml(+grounding/grounding.json,reports/report.mdif present). - Write
literature/literature.json+literature/references.bib(helpers:skills/sv_lit.py). - NEVER fabricate a reference. Every paper in the output must come from a retrieval call in this session. If retrieval fails entirely, report that and stop — an empty honest result beats an invented bibliography. Do not "recall" papers from memory into the artifact; memory may only help you choose search queries.
Two tiers — pick one, and let the user pick when it matters
| Fast tier (default) | Deep tier (on request) | |
| Engine | paper-search-pro (5 sources searched together) | deep-research in lit-review mode |
| What it does | retrieve → federated dedup → heuristic ranking; you write the judgments and notes | adds: multi-agent division of labor, per-reference verification (Semantic Scholar match / DOI resolution / WebSearch spot checks), cross-paper synthesis |
| Time | about 8 minutes (measured: 4 queries, 18 tool calls, about 460 candidates after dedup) | still not finished after 13 minutes (measured, then interrupted; 90 tool calls, 5 retrieval sub-agents) |
| Cost | about $1.0 (same measured run, with the candidate-screening discipline below already applied) | $4.93 and unfinished (measured). This is not a ceiling; it is the floor of an interrupted run |
| When to use | almost always; it is enough for /sv-paper's prerequisite gate | the user explicitly wants "more complete / more rigorous", a systematic review, or a pass that checks every citation before the paper is submitted |
Both tiers' numbers are measured, not estimates. Do not treat the fast tier as "nearly free" — it is also on the order of $1: the retrieval subprocess itself is cheap; what costs money is the agent reading abstracts, making judgments, and writing a dozen or so relevance notes specific to this study. The screening discipline below keeps it near $1 instead of $3–5, but it cannot bring it to zero. And
/sv-paperhard-requires this stage to have run first, so every paper pays this cost at least once — state it at this order of magnitude to the user at the spending gate.
Default to the fast tier; do not upgrade on your own initiative. Ask before the deep tier: tell the user it is slower, more expensive, and where the cost comes from ("several agents split the work, and every citation is checked back against a database"), and run it only after they agree. When the user proactively says "go deeper / be more comprehensive / check the citations for me", go straight to the deep tier.
How to run the deep tier: read .claude/skills/deep-research/SKILL.md and drive it in lit-review mode,
with this study's research_question and the themes already chosen as input. It produces an annotated bibliography + review prose;
the output must still land in this skill's format (literature/literature.json + references.bib, see step 5) —
do not leave a copy in its own report format inside the study; the dashboard only reads this one.
Its source-verification verdicts (S2_VERIFIED / DOI_VERIFIED / PLAUSIBLE) are worth writing into each paper's note:
that is exactly what the deep tier's extra cost buys.
⚠️ Check that it exists before deciding whether to offer it. The deep tier is not distributed with this repository (its upstream license is CC BY-NC, which is incompatible with this repository's
Apache-2.0); only environments that installed it themselves into .claude/skills/deep-research/ have it. So:
test -f .claude/skills/deep-research/SKILL.md && echo deep-tier-availableIf it does not exist, treat the tier as nonexistent and do not mention it to the user — offering it and then being unable to run it is worse than not having it. The fast tier must always be able to complete the whole stage on its own: the deep tier is an enhancement, not a prerequisite.
The fast tier's two layers
Finding the papers is delegated to the vendored paper-search-pro skill
(.claude/skills/paper-search-pro/, Apache-2.0 — see its VENDOR.md): OpenAlex ·
Semantic Scholar · CrossRef · PubMed · arXiv, plus native-Chinese sources (NSSD,
yiigle), with federated dedup and a saturation signal. This skill owns what the
papers mean for this study — selection, the per-paper relevance note, themes,
and the artifact the dashboard and /sv-paper consume.
Drive it through its agent channel, not the human 14-step recipe. Read
.claude/skills/paper-search-pro/references/agent_mode.md once before your first
call — it is the contract for the JSON envelope, the flags, and the error codes.
Its own north star applies here verbatim: the heuristic score it returns is a
floor, not a verdict. Ranking by it and stopping is the failure mode; you read
the abstracts and judge relevance yourself (step 3).
Steps
- Derive 2–4 search queries from
research_question/domain/ key mechanisms — English keyword style (e.g. "cafeteria price increase food choice students", "LLM agent social simulation"). Cover: ① the substantive phenomenon, ② the closest empirical/experimental literature, ③ the method (LLM/ABM social simulation). For a China-context study also run one Chinese query with--lang zh— the English indexes will not surface CSSCI / Chinese core-journal work. Retrieve. First check the engine's dependencies — with the same interpreter you would run the engine with — before any engine call:
python - <<'EOF' import importlib.util deps = ("pyalex", "semanticscholar", "requests", "arxiv", "Bio") # the [lit] extra's search clients print("lit deps missing:", [m for m in deps if importlib.util.find_spec(m) is None] or "none") EOFAnything missing → do not run the engine (it would only fail on import). Tell the user once that the multi-source engine needs
pip install -e ".[lit]"in this environment, and go straight to the stdlib fallback below. If they install the extra later, re-run the survey with the engine. Preferred path, when nothing is missing — the multi-source engine (its Python deps come with thelitextra:pip install -e ".[lit]"; use the interpreter of that environment):PSP=.claude/skills/paper-search-pro PYTHONPATH=$PSP python -m scripts.agent_search \ "<query>" > /tmp/psp_<n>.json # one call per querydatais the deduped paper list; each entry carries doi / openalex_id / title / abstract / authors(+affiliation) / year / venue / citation_count / topics /relevance.score.meta.countsreports retrieved→dedup→returned, andmeta.saturationtells you whether another query is still finding new work — iterate until it flattens, don't stop at one call. Fallback (engine unavailable — the dependency check above found something missing, or the engine errors at run time): the zero-dependency stdlib path, which is OpenAlex-only and thinner:from skills import sv_lit found = [] for q in queries: found += sv_lit.oa_search(q, n=8) try: found += sv_lit.s2_search(queries[0], n=8) except Exception: pass # S2 anonymous pool is often 429 — skip silently papers = sv_lit.dedupe(found)Say which path you used in the summary — a fallback run is a narrower survey and the user should know.
⚠️ Do not dump the retrieval results into the conversation context — this is the single biggest cost of this stage. One
agent_searchcall returns 100+ papers, each with its full abstract; a singlecatis tens of thousands of tokens, while only a dozen or so actually need your reading. So: write the results to files, then use a script to screen them down to one screenful, and when you need full abstracts, read only the few papers on the shortlist.python3 - <<'EOF' import json, glob seen, rows = set(), [] for f in sorted(glob.glob("/tmp/psp_*.json")): d = json.load(open(f)) for p in (d.get("data") or []): k = (p.get("doi") or p.get("openalex_id") or p["title"]).lower() if k in seen: continue seen.add(k); rows.append(p) rows.sort(key=lambda x: -(x.get("relevance", {}).get("score") or 0)) for p in rows[:25]: # look at the top 25 only, abstracts cut to 160 chars print(f'{p.get("year")} | {p.get("citation_count"):>5} | {p.get("doi")}') print(f' {p["title"][:95]}') print(f' {(p.get("abstract") or "")[:160]}') EOFLikewise: when
sv_lit.savewrites to disk, do not stuff all candidates intopapers— only the 6–12 you decided to keep.- Select 6–12 papers worth keeping: prefer directly-comparable empirical work, then mechanism/theory anchors, then method references. Recency and citations are tie-breakers, not the criterion. Read the abstracts you retrieved — selection must be justified by them.
- Write a relevance note per kept paper (
note, 1–3 sentences, study-specific): WHICH parameter / mechanism / comparison in THIS study the paper anchors — e.g. "price-elasticity range -0.6 to -1.1, the empirical anchor for this study's P-side sensitivity parameter", never a generic abstract paraphrase. Setrelevance(0–1, your judgment). Group into 2–4themes. - Save:
sv_lit.save("studies/<id>", { "summary": "<one paragraph: what was searched, what the three main threads are, which 1-2 papers matter most for this study>", "themes": [{"name": "...", "n": 3}, ...], "papers": papers_kept, # each: title/authors/year/venue/citations/url/doi/abstract + note + relevance "queries": queries, })references.bibis generated from the kept papers automatically (bibkey= first-author+year+word; /sv-paper cites these keys). - (Optional, when a paper anchors a load-bearing modeling choice) add it to
grounding/grounding.jsonas animplementation_refviaskills/sv_grounding.py— the grounding card then shows it too.
Pause & confirm
Present the themes + the kept papers (one line each: title · year · note), then stop for the user's direction — they may prune, redirect ("find more from a Chinese context"), or extend ("add a methodology thread"). A follow-up request re-enters at step 1 with the new queries and MERGES (dedupe) into the existing artifact — don't discard previously-kept papers unless asked.
Failure honesty
- Retrieval engine unavailable → try the stdlib fallback (step 2); if that also fails, write NOTHING and tell the user retrieval is unavailable right now.
- Sparse results for a niche topic → say so; a 4-paper honest survey is fine.
- Never pad a thin result with papers you "know" —
/sv-papercites these bibkeys, and a fabricated entry there is the single worst failure this pipeline can produce.
Dashboard narrative (optional, non-blocking — L2)
python3 dashboard/hooks/sv_emit.py narrative --study <study_id> --stage sv-lit \
--text "Surveyed related work: 8 papers across 3 themes; Zhang & Kumar (2019) is the closest natural experiment."Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

