# NanoResearch

> An autonomous research pipeline that takes a topic through literature search, experiment code, real GPU or SLURM runs, figures and review to a LaTeX paper built on the measured results

- Category: Science & Biomedical AI / Scientific Workflow Orchestration
- Language: Python
- Licence: MIT
- Repository: https://github.com/OpenRaiser/NanoResearch
- Canonical page: https://ai-tldr.dev/tools/nanoresearch/

## In short

NanoResearch is an open-source Python pipeline that automates the whole paper-production loop. It sits in the Scientific Workflow Orchestration category of the Science & Biomedical AI tools and is open-source, written in Python and licensed MIT. To get started: install.

## Overview

NanoResearch is an open-source Python pipeline that automates the whole paper-production loop. You give it a research topic; it searches and synthesises the literature, proposes an experiment blueprint, generates a runnable experiment project, executes it, analyses the outputs, draws figures, writes a LaTeX paper and then reviews and revises it. The nine stages — IDEATION, PLANNING, SETUP, CODING, EXECUTION, ANALYSIS, FIGURE_GEN, WRITING, REVIEW — end in an exported bundle with `paper.pdf`, `paper.tex`, `references.bib`, figures, code and data.

What separates it from AI writing tools that stop at an outline is the EXECUTION stage. It detects local GPUs or generates sbatch scripts and submits them to a SLURM cluster, monitors the jobs and training logs, and when a run fails it reads the error log, fixes the code and re-executes. The ANALYSIS stage parses the real training logs and metrics into structured evidence, and the writing stage consumes that evidence; the README states that when a class of experiment produced no real artifact, the system narrows its claims or records a limitation rather than filling in synthetic numbers.

Every run lives in a resumable workspace under `~/.nanoresearch/workspace/research/<session_id>/` with a `manifest.json` that tracks stage state, so a failed stage can be resumed without starting over and every intermediate artifact stays inspectable. Models are routed per stage through OpenAI-compatible endpoints, so ideation, coding, writing and review can each use a different model. Beyond the CLI (with a full-screen TUI or plain streaming logs), the same pipeline can be driven from Claude Code slash commands, from Codex via the repository's `AGENTS.md`, or from a built-in Feishu (Lark) chat bot. An `evo` pipeline adds skill, memory and feedback-driven adaptation across repeated research runs.

## What it does

- A nine-stage, checkpointed pipeline from topic to exported LaTeX paper, resumable from any failed stage with `nanoresearch resume`
- Real experiment execution on local GPUs or SLURM clusters, with sbatch generation, job monitoring, and automatic debug-and-retry on failure
- Evidence-grounded writing: figures, tables and numbers come from parsed training logs and metrics, and literature comes from OpenAlex and Semantic Scholar
- Per-stage model routing over OpenAI-compatible endpoints, plus execution profiles (`fast_draft`, `local_quick`, `cluster_full`) and NeurIPS / ICML / arXiv templates
- Several front ends over one workspace format: CLI with TUI, Claude Code `/project:*` commands, Codex via `AGENTS.md`, and a Feishu bot that sends back the finished PDF
- An `evo` self-evolving pipeline that reuses skills and project memory across runs, with optional SDPO LoRA adapter training on the collected feedback

## Getting started

NanoResearch needs Python 3.10+, an OpenAI-compatible API endpoint for the text-model stages, and `tectonic` or `pdflatex` to compile the PDF (the project recommends `tectonic`). Image-model access is optional and only used for some figures. Literature search works anonymously; free OpenAlex and Semantic Scholar keys raise the rate limits.

1. Install

```bash
git clone https://github.com/OpenRaiser/NanoResearch.git
cd NanoResearch
pip install -e ".[dev]"
```

2. Point it at your model endpoint

   Create `~/.nanoresearch/config.json` with your own `base_url` and `api_key`. Each stage (`ideation`, `planning`, `code_gen`, `writing`, `review`, the figure stages) can name its own model; the README's full example sets all of them. `NANORESEARCH_BASE_URL`, `NANORESEARCH_API_KEY` and `NANORESEARCH_TIMEOUT` override the file.

```json
{
  "research": {
    "base_url": "https://your-openai-compatible-endpoint/v1/",
    "api_key": "your-api-key",
    "template_format": "neurips2025",
    "execution_profile": "local_quick",
    "writing_mode": "hybrid",
    "max_retries": 2,
    "ideation": { "model": "your-model", "temperature": 0.5, "max_tokens": 16384, "timeout": 600.0 },
    "writing": { "model": "your-model", "temperature": 0.4, "max_tokens": 16384, "timeout": 600.0 }
  }
}
```

3. Validate, then run the full pipeline

   A dry run checks the configuration before anything expensive starts.

```bash
nanoresearch run --topic "Adaptive Sparse Attention Mechanisms" --dry-run

nanoresearch run --topic "Adaptive Sparse Attention Mechanisms" --format neurips2025 --verbose
```

4. Resume a failed stage and export the paper

   `nanoresearch status` and `nanoresearch inspect` show each stage's state and artifacts for a workspace.

```bash
nanoresearch resume --workspace ~/.nanoresearch/workspace/research/{session_id} --verbose

nanoresearch export --workspace ~/.nanoresearch/workspace/research/{session_id} --output ./my_paper
```

5. Or drive it from Claude Code

   In Claude Code mode no API key is configured: Claude Code does the literature search, runs the experiments and compiles the LaTeX. Individual stages are available as `/project:ideation`, `/project:planning`, `/project:experiment`, `/project:analysis`, `/project:writing` and `/project:review`, and the workspaces are compatible with the Python CLI.

```bash
git clone https://github.com/OpenRaiser/NanoResearch.git
cd NanoResearch
claude
/project:research "your research topic"
```

## When to use it

- Turning a research idea into a complete experiment-and-paper workspace quickly, to see whether it holds up before investing weeks by hand
- Letting a GPU box or SLURM allocation run generated experiments unattended, with automatic retries, while the results feed straight into analysis and figures
- Producing a LaTeX first draft grounded in real experiment artifacts — the project itself describes the output as a high-quality draft that still needs human review and revision
- Keeping an auditable research log, since every run leaves its plans, code, results, figures, drafts and logs in one inspectable workspace
