ai4scientist/nano-scientist/auto-paper-improvement-loop
Claude Code and agent skill by ai4scientist/nano-scientist
- community
Checking that the SKILL.md file is still in the repository.
Autonomously improve a generated paper via GPT-5.4 xhigh review → implement fixes → recompile, for 2 rounds. Use when user says \"改论文\", \"improve paper\", \"论文润色循环\", \"auto improve\", or wants to iteratively polish a generated paper.
Install
npx vskill@latest install ai4scientist/nano-scientist/auto-paper-improvement-loopSKILL.md
Auto Paper Improvement Loop: Review → Fix → Recompile
Autonomously improve the paper at: $ARGUMENTS
Context
This skill is designed to run after Workflow 3 (/paper-plan → /paper-figure → /paper-write → /paper-compile). It takes a compiled paper and iteratively improves it through external LLM review.
Unlike /auto-review-loop (which iterates on research — running experiments, collecting data, rewriting narrative), this skill iterates on paper writing quality — fixing theoretical inconsistencies, softening overclaims, adding missing content, and improving presentation.
Constants
- MAX_ROUNDS = 2 — Two rounds of review→fix→recompile. Empirically, Round 1 catches structural issues (4→6/10), Round 2 catches remaining presentation issues (6→7/10). Diminishing returns beyond 2 rounds for writing-only improvements.
- REVIEWER_MODEL = `gpt-5.4` — Model used via Codex MCP for paper review.
- REVIEWER_BIAS_GUARD = true — When
true, every review round uses a freshmcp__codex__codexthread with no prior review context. Never usemcp__codex__codex-replyfor review rounds. Set tofalseonly for deliberate debugging of the legacy behavior. Empirical evidence: running the same paper withcodex-reply+ "since last round we did X" prompts inflated scores from real 3/10 → fake 8/10 across multiple rounds; switching to fresh threads recovered the true 3/10 assessment. - REVIEW_LOG = `PAPER_IMPROVEMENT_LOG.md` — Cumulative log of all rounds, stored in paper directory.
- HUMAN_CHECKPOINT = false — When
true, pause after each round's review and present score + weaknesses to the user. The user can approve fixes, provide custom modification instructions, skip specific fixes, or stop early. Whenfalse(default), runs fully autonomously. - EDIT_WHITELIST = `null` — Optional path to a YAML/JSON whitelist file constraining which paths and operations the fix-implementation step may touch. When
null(default), all edits proceed unconstrained. When set via— edit-whitelist <path>(also accepts— edit_whitelist <path>), the loop loads the file at startup and consults it before each edit; rejected edits are logged toPAPER_IMPROVEMENT_LOG.mdrather than silently dropped. See "Optional: Edit Whitelist" below.
💡 Override:/auto-paper-improvement-loop "paper/" — human checkpoint: true
Optional: Style reference (— style-ref: <source>, opt-in)
Lets the user steer structural fixes only during improvement (section reordering hints, paragraph length nudges, figure density adjustments) toward a reference paper. Default OFF — when the user does not pass `— style-ref`, do nothing differently from before.
Only when — style-ref: <source> appears in $ARGUMENTS, run the helper FIRST, before the loop starts:
Sources accepted: local TeX dir / file, local PDF, arXiv id, http(s) URL. Overleaf URLs/IDs are rejected — clone via /overleaf-sync setup <id> first and pass the local clone path.
Strict rules (full contract in tools/extract_paper_style.py docstring):
- Use
style_profile.mdonly during the fix-implementation phase, to nudge structural choices when applying reviewer feedback. Reviewer feedback always takes precedence; style ref is tie-breaker for how to apply a fix, not whether to apply it. - Never copy prose, claims, examples, or terminology from anything reachable through the cache when implementing fixes.
- Never pass `— style-ref` (or the cache contents) to the GPT-5.4 reviewer sub-agent. The Reviewer Independence Protocol below requires reviewers see only the artifact and the user's prompt — leaking the style ref would contaminate the review with author-side context. This is the most critical invariant in this skill.
Optional: Edit Whitelist (— edit-whitelist <path>, opt-in)
Lets the caller hard-constrain which files and operations the fix-implementation step (Step 3 / Step 6) is allowed to touch. Default OFF — when the user does not pass `— edit-whitelist` (or the alias `— edit_whitelist`), the loop applies all reviewer-driven edits without restriction, exactly as before.
This is the parameter that upstream pipelines (e.g. /resubmit-pipeline Phase 2) use to enforce text-only resubmit microedits: no .bib mutations, no .sty / .bst mutations, no edits to prior-submission directories, no new \cite{...}, no new theorem environments, no new numerical claims.
Schema
The whitelist file is YAML or JSON. All four sections are optional:
Resolution rules
- `allowed_paths` empty AND `forbidden_paths` empty → whitelist is a no-op (advisory: the file is loaded and
rationaleechoed to the log, but no path filtering is applied). - `allowed_paths` empty, `forbidden_paths` non-empty → all paths NOT matched by
forbidden_pathsare mutable. - `allowed_paths` non-empty, `forbidden_paths` empty → only paths matching
allowed_pathsare mutable. - Both non-empty → an edit is allowed iff the target matches
allowed_pathsAND does NOT matchforbidden_paths.forbidden_pathsalways wins on overlap. - `forbidden_operations` missing or empty → no operation-level guard; only path-level filtering applies.
Glob semantics
Use bash extglob / Python fnmatch.fnmatch semantics. ** matches any depth (zero or more directory segments). Patterns are matched against the path relative to the paper directory (e.g. paper/sec/intro.tex matches sec/*.tex when paper-directory is paper/).
Forbidden-operation detectors
For each candidate edit's diff (the new lines being added — deletions are exempt), the loop runs these regex checks and rejects if any forbidden operation matches:
| Operation | Detector (added lines only) | ||||
|---|---|---|---|---|---|
new_cite | \\cite[a-zA-Z]*\{[^}]+\} (catches \cite, \citep, \citet, \citeauthor, \citeyear, \citealp, etc.) | ||||
new_bibitem | \\bibitem\{[^}]+\} | ||||
new_theorem_env | `\\begin\{(theorem | lemma | proposition | corollary)\*?\}` | |
numerical_claim | New token matching \b\d+(\.\d+)?%?\b that did NOT appear in the deleted/replaced lines (i.e. genuinely new numbers, not edits to existing ones) |
Behavior at loop start (before Round 1 fix-implementation)
- If
— edit-whitelist <path>is present in$ARGUMENTS, setEDIT_WHITELIST = <path>. - Load the file (
yaml.safe_load; if it fails, fall back tojson.loads). On load failure, abort the loop with a clear error — do NOT silently proceed unconstrained. - Echo
rationale(if present) intoPAPER_IMPROVEMENT_LOG.mdunder a new "Edit Whitelist" preamble section so the audit trail records why edits were constrained.
Behavior during fix-implementation (Steps 3 and 6)
Before applying each proposed edit:
- Resolve target file path relative to the paper directory.
- Path check: if
allowed_pathsis non-empty, target must match at least one pattern. Then ifforbidden_pathsis non-empty, target must NOT match any pattern. If either fails → reject aspathviolation. - Operation check: build the unified diff (or just the set of newly-added lines) for the proposed edit. For each entry in
forbidden_operations, run its detector on the added lines. If any detector matches → reject asoperationviolation. - If all checks pass, apply the edit normally.
- If rejected, append an entry to
PAPER_IMPROVEMENT_LOG.mdunder a## Rejected by edit_whitelist (Round N)heading with this schema:
```
- file: <relative path>
reason: path | operation pattern: <the offending forbidden_path glob, OR the offending forbidden_operation name + the matched substring> reviewer_concern: <the original Round-N weakness that motivated this edit> ```
- Continue with the remaining edits in the round. Do NOT abort the whole round on a single rejection.
End-of-round surfacing
At the end of each round (after the recompile, before moving to the next round), if any edits were rejected during that round's fix step:
- Print a one-line summary to the round's checkpoint output:
Edit whitelist rejected N edits this round (M path, K operation). See PAPER_IMPROVEMENT_LOG.md "Rejected by edit_whitelist (Round N)". - If
HUMAN_CHECKPOINT = true, include the rejection list in the checkpoint shown to the user before they approve next-round fixes.
Example invocations
Rationale
Without a whitelist, the loop's reviewer-driven fix step is free to add citations, introduce new theorem environments, or tweak numerical claims — all of which are reasonable for first-submission polish but forbidden in resubmit / camera-ready / rebuttal-only modes where the paper structure is frozen by external constraint. Routing those constraints through a first-class parameter (rather than relying on the LLM to "remember" not to do them) makes the constraint enforceable, auditable via PAPER_IMPROVEMENT_LOG.md, and visible to the user at each round's checkpoint.
Inputs
- Compiled paper —
paper/main.pdf+ LaTeX source files - All section `.tex` files — concatenated for review prompt
State Persistence (Compact Recovery)
If the context window fills up mid-loop, Claude Code auto-compacts. To recover, this skill writes PAPER_IMPROVEMENT_STATE.json after each round:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/auto-paper-improvement-loop/SKILL.md
Popularity
- Repository stars
- 100
- Repository forks
- 16
- 7-day trend score
- 23
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ai4scientist/nano-scientist/auto-paper-improvement-loop)