---
name: ablesci-fulltext-auto-v2
description: Use when the user wants 科研通 / AbleSci used to obtain paywalled paper PDFs from DOI or title lists into a local folder, especially for 批量求助、自动采纳、失效 token 重试、或下载成占位页/小文件/假 PDF 的情况.
---

# Ablesci Fulltext Auto V2

## Overview
Use this skill for 科研通 / AbleSci 全文获取任务 where the user already knows the papers they want and needs local PDF files, not just citations or metadata.

**Core principle:** never treat `/assist/download?id=...` as success. Only a resolved real file URL plus a validated PDF counts as done.

## When to Use
- 用户提供 **DOI 列表**、**标题列表**、或 DOI+标题混合列表
- 用户明确提到 **科研通**、**AbleSci**、**文献求助**、**批量求助**、**自动采纳**、**下载全文 PDF**
- 之前下载结果出现 **占位页**、**HTML 假文件**、**小于阈值的小文件**、**token 失效**、或浏览器自动下载失败
- 任务目标是把全文保存到**本地绝对路径文件夹**

Do not use this skill when:
- 用户只想查题录、摘要、引用信息、或做文献检索
- 目标文献已经开放获取，能直接从出版社或 PMC 稳定下载
- 用户没有提供可落地保存的本地目标路径

## Inputs
Required:
- Paper list: DOI / title / mixed, preferably one paper per line
- Target folder: absolute path

Optional:
- Confirmation policy: default `auto_accept=true` unless user explicitly disables
- Force redownload: default `false`

Defaults:
- Poll interval: 10 seconds.
- Max wait: 20 minutes.
- Min valid file size: 200 KB.
- Naming pattern: `NN_short-title-or-journal.pdf`.

## Credentials
Read `references/ablesci-account.md`.

## Quick Reference
| Need | Source / Action |
|---|---|
| Normalize mixed DOI/title input | `scripts/normalize_input.py` |
| Login credentials | `references/ablesci-account.md` |
| Batch request entrypoint | `发布文献求助` → `批量求助` → `文本批量添加` |
| Poll pending uploads | `https://www.ablesci.com/my/assist-my?status=uploaded` |
| Real download URL | download page manual link / `filehub` URL |
| Validate PDFs | `scripts/verify_pdf_batch.py` |
| Remove placeholder files | `scripts/cleanup_placeholders.py` |
| Build completion report | `scripts/build_report.py` |

## Runbook
1. Normalize input list using `scripts/normalize_input.py`.
2. Open `https://www.ablesci.com` with browser profile `openclaw` and ensure signed in.
3. Submit requests:
   - Single/few items: `发布文献求助` form + smart extract.
   - Many items: `批量求助` -> `文本批量添加`.
4. Poll `https://www.ablesci.com/my/assist-my?status=uploaded` every 10s.
5. Auto-accept all matched `待确认` items when `auto_accept=true`.
6. For each accepted item, open `/assist/download?id=...`.
7. Extract the real file URL from the page (`filehub` or manual `这里` link).
8. Download via `curl -L --fail` to target folder.
9. Validate downloaded files with `scripts/verify_pdf_batch.py`.
10. Retry failed/small files by refreshing token URL and re-downloading (up to 3 retries/item).
11. Remove known placeholder files (<200 KB) via `scripts/cleanup_placeholders.py`.
12. Generate report with `scripts/build_report.py`.

## Reliability Rules
- Never treat `assist/download?id=...` as final artifact; always resolve the real token URL.
- Never mark success until file-size validation passes.
- If UI click fails, retry with fresh snapshot refs and fallback actions.
- If token expires, regenerate from the same `assist/download` page.
- Keep idempotent behavior: skip already valid files unless `force_redownload=true`.

## Common Mistakes
- **把 `assist/download?id=...` 当成 PDF 本体**  
  这是中转页，不是最终文件；必须继续解析真实下载链接。

- **看到浏览器弹下载就直接判成功**  
  浏览器可能下到 HTML、重定向页、或过期 token 对应的小文件；必须校验。

- **保留小于阈值的“PDF”**  
  默认 `<200 KB` 先视为可疑占位文件，优先重试并清理。

- **失败后重复使用旧 token**  
  token 会过期；需要重新打开对应下载页拿新链接。

- **已经有有效文件还重复覆盖**  
  默认应保持幂等，除非用户明确要求强制重下。

## Output
Return:
- Total requested / success / failed counts.
- Absolute paths of valid PDFs.
- Retry/failure reasons per item.
- Report path.
