Discover

From Chanw-research/claude-code-paper-writing · View interactive version

Discover is an AI agent skill from the GitHub repository Chanw-research/claude-code-paper-writing. Build a ranked shortlist of candidate papers (anchor-driven, topic-driven, or derived from current wiki state) that the user — or an upstream skill — may decide to feed into `/ingest`. Use whenever the user asks "what should I read next", "find papers similar to this one", "recommend related work",

How to use this skill

Skill file

/discover

Produce a ranked shortlist of paper candidates from one of three seed modes. Surface them to the user (or to the calling skill) with rationales. Never auto-ingest — /discover is a proposal stage, /ingest is the action stage.

Use these local references on demand:

Inputs

Exactly one of --anchor, --topic, --from-wiki must be given.

Outputs

/discover does not write anywhere else in wiki/ and does not touch raw/. Whether to actually pull a candidate into the wiki is the caller's decision (a follow-up /ingest).

Wiki Interaction

Reads

Writes

Graph edges created

Workflow

Pre-condition: working directory contains wiki/, raw/, and tools/. Resolve the Python interpreter once and reuse it:

if [ -x .venv/bin/python ]; then
  PYTHON_BIN=.venv/bin/python
elif [ -x .venv/Scripts/python.exe ]; then
  PYTHON_BIN=.venv/Scripts/python.exe
else
  PYTHON_BIN=python3
fi
export PYTHON_BIN

Step 1: Pick the seed mode

Translate the user's request into exactly one of from-anchors, from-topic, or from-wiki. The decision rule lives in references/seed-modes.md; the short version:

If the user supplied negatives ("not these"), include them via --negative in anchor mode only.

Step 2: Run the discovery tool

"$PYTHON_BIN" tools/discover.py from-anchors \
  --id <arxiv-id> [--id <arxiv-id>...] [--negative <id>...] \
  --wiki-root wiki \
  --limit 10 \
  --output-checkpoint .checkpoints/ \
  --markdown

Or for topic / wiki modes:

"$PYTHON_BIN" tools/discover.py from-topic "<query>" --wiki-root wiki --limit 10 --output-checkpoint .checkpoints/ --markdown
"$PYTHON_BIN" tools/discover.py from-wiki --wiki-root wiki --limit 10 --output-checkpoint .checkpoints/ --markdown

Anchor (and wiki) mode run three S2 channels per anchor by default — recommend + references + citations. This is what makes /discover meaningfully different from /daily-arxiv: references surface older canonical work the anchor built on, citations surface high-impact follow-ups. Pass --no-citation-expand only if API cost forces the narrower recommend-only path; the quality regression is sharp.

The tool handles candidate gathering, wiki dedup, ranking, and writes the checkpoint. Always pass --wiki-root wiki so already-ingested papers are filtered out — surfacing duplicates wastes the user's review time.

If S2 is unavailable in topic mode, the tool will continue with whatever sources responded; check the output and report degraded discovery to the user. If every channel fails, abort with a clear message rather than emitting an empty shortlist as if it were a real recommendation.

Step 3: Present the shortlist

Show the markdown output to the user. For each candidate, the user needs enough to decide whether to ingest:

Append a short "next step" hint:

To ingest a candidate: /ingest https://arxiv.org/abs/<arxiv-id>

Do not ingest anything yourself. The user picks.

Step 4: Log

"$PYTHON_BIN" tools/research_wiki.py log wiki "discover | mode=<anchors|topic|wiki> | seed=<short-desc> | shortlist=<N>"

Internal Callers

/discover is designed to be invoked both by users (manually) and by other skills (as a subroutine).

From `/ingest --discover`

When /ingest is invoked with the optional --discover flag (default off), it calls /discover after the final report, with the just-ingested paper's arXiv ID as the single anchor. The shortlist is appended to /ingest's report under a "Related papers you may want to ingest next" heading. /ingest never auto-ingests anything from this list.

From `/init`

/init does not call /discover. /init's planner (tools/init_discovery.py plan) has its own scoring that favors surveys, broad coverage, and seed anchors — appropriate for bootstrapping a wiki. /discover's ranking is intentionally different (no survey preference; weights anchor similarity and influential citations) and would dilute /init's shortlist if substituted in. Keep them separate.

Constraints

Error Handling

Dependencies

Tools (via Bash)

Skills

External APIs

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.