/survey
Generate a Related Work section ready for direct use in a paper, based on existing wiki knowledge.
Draw material from wiki/papers/, concepts/, topics/; group by research direction (not paper-by-paper listing).
End each group with a statement of how it differs from this work. Citations follow citation-verification.md;
writing follows academic-writing.md Related Work rules.
Supports LaTeX and Markdown output formats.
Inputs
query: one of:
- research question description (free text, e.g. "parameter-efficient fine-tuning for LLMs")
- list of claim slugs (from wiki/claims/, used to organize related work around specific claims)
- path to PAPER_PLAN.md (extract Related Work section definition from it)
--format (optional, default latex): output format
latex: \cite{key} citations, embeddable directly in a paper
markdown: [[slug]] wikilink citations, for wiki archiving
--max-papers (optional, default 30): maximum number of papers to cite
Outputs
wiki/outputs/related-work-{slug}-{date}.md — Related Work text (archived)
wiki/graph/edges.jsonl — derived_from edges (if a new output is created)
wiki/log.md — appended log entry
- Terminal output — Related Work body text (for direct copy-paste)
Wiki Interaction
Reads
wiki/papers/*.md — Problem, Key idea, Results, Related, My take
wiki/concepts/*.md — Definition, Variants, Comparison, Known limitations
wiki/topics/*.md — Overview, Timeline, Open problems, Seminal works
wiki/claims/*.md — Statement, source_papers (if input is claim slugs)
wiki/ideas/*.md — Motivation (understand this paper's positioning)
wiki/index.md — content catalog, filtered by importance
wiki/graph/context_brief.md — global context
wiki/graph/edges.jsonl — inter-paper semantic relationships (same_problem_as, similar_method_to, complementary_to, builds_on, compares_against, improves_on, challenges, surveys)
.claude/skills/shared-references/academic-writing.md — Related Work writing rules
.claude/skills/shared-references/citation-verification.md — citation discipline
Writes
wiki/outputs/related-work-{slug}-{date}.md — archived file
wiki/graph/edges.jsonl — derived_from edges
wiki/log.md — appended operation log
Graph edges created
derived_from: related-work output → source papers
Workflow
Precondition: confirm the working directory is the wiki project root (the directory containing wiki/, raw/, tools/).
Step 1: Locate Relevant Knowledge
- Parse input:
- If free text: extract keywords; match against tags and titles in wiki/index.md
- If claim slugs: read each claim's source_papers; collect related papers
- If PAPER_PLAN path: read the Related Work section's groupings and citations
- Read wiki/graph/context_brief.md for global context
- Read wiki/graph/edges.jsonl: extract inter-paper semantic relationships (same_problem_as, similar_method_to, complementary_to, builds_on, compares_against, improves_on, challenges, surveys)
- Build candidate paper list:
- Sort by importance descending from index.md
- Rank by tags and domain match
- Cap at
--max-papers papers
- If candidate papers < 5: warn "insufficient related papers; consider /ingest of more papers first"
Step 2: Deep-Read Related Pages
For each paper in the candidate list:
- Read
wiki/papers/{slug}.md: focus on Problem, Key idea, Results, My take
- Read linked
wiki/concepts/*.md: focus on Definition, Variants, Comparison
- Read related
wiki/topics/*.md: focus on Timeline, Open problems
Record for each paper:
- core contribution (one sentence)
- method category (which research direction it belongs to)
- relationship to this work (same problem / similar method / complementary / builds on / compares against / improves on / challenges / surveys)
- limitations (extracted from Limitations or My take)
Step 3: Thematic Grouping
Following the Related Work rules in shared-references/academic-writing.md:
- Group by research direction (not paper-by-paper listing):
- Extract natural groupings from wiki/topics/ and concepts/ classifications
- 3–8 papers per group
- Group headings describe research directions (e.g. "Parameter-Efficient Fine-Tuning"), not individual papers
- Determine group order:
- Broad to specific (major direction → sub-direction → most related methods)
- Or chronological (foundational → development → recent)
- Determine within-group order:
- Ascending by year (show progression)
- Important papers: 2–3 sentences; secondary papers: 1 sentence
- Annotate each group's relationship to this work:
- End each group with one sentence: "Unlike these approaches, our method..." or "We build upon X by..."
Step 4: Generate Paragraphs
Following shared-references/academic-writing.md:
One or two paragraphs per group:
- Opening: background and importance of the direction
- Body: expand on each paper's contribution in within-group order
- Closing: positioning relative to this work (required)
Citation format:
--format latex: \cite{key}, key generated from citation-verification.md naming rules
--format markdown: [[slug]]
Writing standards:
- No flat lists ("X did Y. Z did W.")
- Each paragraph has a topic sentence
- Use contrastive connectives ("While X focuses on..., Y addresses...")
- No AI-signature vocabulary (see de-AI list in academic-writing.md)
De-AI polish:
- Scan and replace AI-signature vocabulary
- Vary sentence openings
- Remove filler sentences
Step 5: BibTeX Preparation (--format latex only)
If output format is LaTeX, following shared-references/citation-verification.md:
- Collect all
\cite{key} citations
- For each key, attempt to fetch BibTeX: DBLP → CrossRef → S2
- Verified: record BibTeX
- Unverified: mark
[UNCONFIRMED]
- Output list of BibTeX entries (can be appended to paper/references.bib)
- Report citation coverage
Step 6: Archive
Generate slug:
python3 tools/research_wiki.py slug "<query-keywords>"
Write archive file:
Create wiki/outputs/related-work-{slug}-{date}.md:
---
title: "Related Work: {topic}"
type: related-work
format: {latex|markdown}
paper_count: {N}
date_generated: YYYY-MM-DD
---
Body is the complete Related Work text.
If latex format: append BibTeX entries as an appendix.
Add graph edges:
# output → each cited paper
python3 tools/research_wiki.py add-edge wiki/ \
--from "outputs/related-work-{slug}-{date}" --to "papers/{paper-slug}" \
--type derived_from --evidence "Cited in related work section"
Append log:
python3 tools/research_wiki.py log wiki/ \
"survey | {topic} | {N} papers, {G} groups, format: {format}"
Terminal output: complete Related Work body text + citation coverage statistics
Constraints
- Only cite papers already in the wiki: do not fabricate citations; every
\cite{} or [[slug]] must correspond to a page in wiki/papers/
- Group by theme, not as a flat list: each paragraph covers a research direction, not "Paper A did X. Paper B did Y."
- Every group must have a positioning sentence: state the relationship to this work (at the end — difference or inheritance)
- Warn when candidate papers < 5: prompt user to /ingest more papers first
- BibTeX follows citation-verification.md: do not generate from LLM memory (--format latex only)
- De-AI polish is mandatory: a polish pass must be applied after generation
- Archive to outputs/: do not directly modify wiki papers/concepts/topics pages
- Graph edges via tools/research_wiki.py: do not manually edit edges.jsonl
Error Handling
- Fewer than 3 wiki papers: error; suggest /ingest of enough papers first
- No matching papers: broaden search scope (relax tag matching); if still none, error
- All BibTeX fetches failed (latex format): use [UNCONFIRMED] placeholders; report count
- PAPER_PLAN format mismatch: ignore plan's grouping suggestions; use automatic grouping
- Slug conflict: append date suffix
Dependencies
Tools(via Bash)
python3 tools/research_wiki.py slug "<title>" — generate slug
python3 tools/research_wiki.py add-edge wiki/ ... — add graph edge
python3 tools/research_wiki.py log wiki/ "<message>" — append log
python3 tools/fetch_s2.py search "<title>" — BibTeX fallback (S2 search)
MCP Servers
- None (survey does not require Review LLM; use /review --focus writing for separate review)
Claude Code Native
Read — read wiki pages
Glob — find wiki pages
WebFetch — DBLP / CrossRef BibTeX fetch (--format latex only)
Shared References
.claude/skills/shared-references/academic-writing.md — Related Work writing rules + de-AI polish
.claude/skills/shared-references/citation-verification.md — BibTeX fetch and [UNCONFIRMED] protocol
Called by
/paper-draft Step 3 (Related Work section can be delegated to this skill)
- Manual user invocation
1---2name: survey3description: Generate a Related Work section for a paper from wiki knowledge — thematic grouping → narrative structure → LaTeX output, following citation-verification and academic-writing4---56# /survey78> Generate a Related Work section ready for direct use in a paper, based on existing wiki knowledge.9> Draw material from wiki/papers/, concepts/, topics/; group by research direction (not paper-by-paper listing).10> End each group with a statement of how it differs from this work. Citations follow citation-verification.md;11> writing follows academic-writing.md Related Work rules.12> Supports LaTeX and Markdown output formats.1314## Inputs1516- `query`: one of:17 - research question description (free text, e.g. "parameter-efficient fine-tuning for LLMs")18 - list of claim slugs (from wiki/claims/, used to organize related work around specific claims)19 - path to PAPER_PLAN.md (extract Related Work section definition from it)20- `--format` (optional, default `latex`): output format21 - `latex`: `\cite{key}` citations, embeddable directly in a paper22 - `markdown`: `[[slug]]` wikilink citations, for wiki archiving23- `--max-papers` (optional, default 30): maximum number of papers to cite2425## Outputs2627- `wiki/outputs/related-work-{slug}-{date}.md` — Related Work text (archived)28- `wiki/graph/edges.jsonl` — derived_from edges (if a new output is created)29- `wiki/log.md` — appended log entry30- **Terminal output** — Related Work body text (for direct copy-paste)3132## Wiki Interaction3334### Reads35- `wiki/papers/*.md` — Problem, Key idea, Results, Related, My take36- `wiki/concepts/*.md` — Definition, Variants, Comparison, Known limitations37- `wiki/topics/*.md` — Overview, Timeline, Open problems, Seminal works38- `wiki/claims/*.md` — Statement, source_papers (if input is claim slugs)39- `wiki/ideas/*.md` — Motivation (understand this paper's positioning)40- `wiki/index.md` — content catalog, filtered by importance41- `wiki/graph/context_brief.md` — global context42- `wiki/graph/edges.jsonl` — inter-paper semantic relationships (same_problem_as, similar_method_to, complementary_to, builds_on, compares_against, improves_on, challenges, surveys)43- `.claude/skills/shared-references/academic-writing.md` — Related Work writing rules44- `.claude/skills/shared-references/citation-verification.md` — citation discipline4546### Writes47- `wiki/outputs/related-work-{slug}-{date}.md` — archived file48- `wiki/graph/edges.jsonl` — derived_from edges49- `wiki/log.md` — appended operation log5051### Graph edges created52- `derived_from`: related-work output → source papers5354## Workflow5556**Precondition**: confirm the working directory is the wiki project root (the directory containing `wiki/`, `raw/`, `tools/`).5758### Step 1: Locate Relevant Knowledge59601. **Parse input**:61 - If free text: extract keywords; match against tags and titles in wiki/index.md62 - If claim slugs: read each claim's source_papers; collect related papers63 - If PAPER_PLAN path: read the Related Work section's groupings and citations642. **Read wiki/graph/context_brief.md** for global context653. **Read wiki/graph/edges.jsonl**: extract inter-paper semantic relationships (same_problem_as, similar_method_to, complementary_to, builds_on, compares_against, improves_on, challenges, surveys)664. **Build candidate paper list**:67 - Sort by importance descending from index.md68 - Rank by tags and domain match69 - Cap at `--max-papers` papers705. **If candidate papers < 5**: warn "insufficient related papers; consider /ingest of more papers first"7172### Step 2: Deep-Read Related Pages7374For each paper in the candidate list:75761. Read `wiki/papers/{slug}.md`: focus on Problem, Key idea, Results, My take772. Read linked `wiki/concepts/*.md`: focus on Definition, Variants, Comparison783. Read related `wiki/topics/*.md`: focus on Timeline, Open problems7980Record for each paper:81- core contribution (one sentence)82- method category (which research direction it belongs to)83- relationship to this work (same problem / similar method / complementary / builds on / compares against / improves on / challenges / surveys)84- limitations (extracted from Limitations or My take)8586### Step 3: Thematic Grouping8788Following the Related Work rules in `shared-references/academic-writing.md`:89901. **Group by research direction** (not paper-by-paper listing):91 - Extract natural groupings from wiki/topics/ and concepts/ classifications92 - 3–8 papers per group93 - Group headings describe research directions (e.g. "Parameter-Efficient Fine-Tuning"), not individual papers942. **Determine group order**:95 - Broad to specific (major direction → sub-direction → most related methods)96 - Or chronological (foundational → development → recent)973. **Determine within-group order**:98 - Ascending by year (show progression)99 - Important papers: 2–3 sentences; secondary papers: 1 sentence1004. **Annotate each group's relationship to this work**:101 - End each group with one sentence: "Unlike these approaches, our method..." or "We build upon X by..."102103### Step 4: Generate Paragraphs104105Following `shared-references/academic-writing.md`:1061071. **One or two paragraphs per group**:108 - Opening: background and importance of the direction109 - Body: expand on each paper's contribution in within-group order110 - Closing: positioning relative to this work (required)1111122. **Citation format**:113 - `--format latex`: `\cite{key}`, key generated from citation-verification.md naming rules114 - `--format markdown`: `[[slug]]`1151163. **Writing standards**:117 - No flat lists ("X did Y. Z did W.")118 - Each paragraph has a topic sentence119 - Use contrastive connectives ("While X focuses on..., Y addresses...")120 - No AI-signature vocabulary (see de-AI list in academic-writing.md)1211224. **De-AI polish**:123 - Scan and replace AI-signature vocabulary124 - Vary sentence openings125 - Remove filler sentences126127### Step 5: BibTeX Preparation (--format latex only)128129If output format is LaTeX, following `shared-references/citation-verification.md`:1301311. Collect all `\cite{key}` citations1322. For each key, attempt to fetch BibTeX: DBLP → CrossRef → S21333. Verified: record BibTeX1344. Unverified: mark `[UNCONFIRMED]`1355. Output list of BibTeX entries (can be appended to paper/references.bib)1366. Report citation coverage137138### Step 6: Archive1391401. **Generate slug**:141 ```bash142 python3 tools/research_wiki.py slug "<query-keywords>"143 ```1441452. **Write archive file**:146 Create `wiki/outputs/related-work-{slug}-{date}.md`:147 ```yaml148 ---149 title: "Related Work: {topic}"150 type: related-work151 format: {latex|markdown}152 paper_count: {N}153 date_generated: YYYY-MM-DD154 ---155 ```156 Body is the complete Related Work text.157 If latex format: append BibTeX entries as an appendix.1581593. **Add graph edges**:160 ```bash161 # output → each cited paper162 python3 tools/research_wiki.py add-edge wiki/ \163 --from "outputs/related-work-{slug}-{date}" --to "papers/{paper-slug}" \164 --type derived_from --evidence "Cited in related work section"165 ```1661674. **Append log**:168 ```bash169 python3 tools/research_wiki.py log wiki/ \170 "survey | {topic} | {N} papers, {G} groups, format: {format}"171 ```1721735. **Terminal output**: complete Related Work body text + citation coverage statistics174175## Constraints176177- **Only cite papers already in the wiki**: do not fabricate citations; every `\cite{}` or `[[slug]]` must correspond to a page in wiki/papers/178- **Group by theme, not as a flat list**: each paragraph covers a research direction, not "Paper A did X. Paper B did Y."179- **Every group must have a positioning sentence**: state the relationship to this work (at the end — difference or inheritance)180- **Warn when candidate papers < 5**: prompt user to /ingest more papers first181- **BibTeX follows citation-verification.md**: do not generate from LLM memory (--format latex only)182- **De-AI polish is mandatory**: a polish pass must be applied after generation183- **Archive to outputs/**: do not directly modify wiki papers/concepts/topics pages184- **Graph edges via tools/research_wiki.py**: do not manually edit edges.jsonl185186## Error Handling187188- **Fewer than 3 wiki papers**: error; suggest /ingest of enough papers first189- **No matching papers**: broaden search scope (relax tag matching); if still none, error190- **All BibTeX fetches failed** (latex format): use [UNCONFIRMED] placeholders; report count191- **PAPER_PLAN format mismatch**: ignore plan's grouping suggestions; use automatic grouping192- **Slug conflict**: append date suffix193194## Dependencies195196### Tools(via Bash)197- `python3 tools/research_wiki.py slug "<title>"` — generate slug198- `python3 tools/research_wiki.py add-edge wiki/ ...` — add graph edge199- `python3 tools/research_wiki.py log wiki/ "<message>"` — append log200- `python3 tools/fetch_s2.py search "<title>"` — BibTeX fallback (S2 search)201202### MCP Servers203- None (survey does not require Review LLM; use /review --focus writing for separate review)204205### Claude Code Native206- `Read` — read wiki pages207- `Glob` — find wiki pages208- `WebFetch` — DBLP / CrossRef BibTeX fetch (--format latex only)209210### Shared References211- `.claude/skills/shared-references/academic-writing.md` — Related Work writing rules + de-AI polish212- `.claude/skills/shared-references/citation-verification.md` — BibTeX fetch and [UNCONFIRMED] protocol213214### Called by215- `/paper-draft` Step 3 (Related Work section can be delegated to this skill)216- Manual user invocation