Skip to content
Development
Command

/research-acquire

Acquire research papers from acquisition queue, download PDFs, validate integrity, and organize artifacts

From plugin
aiwg
17623 skills199 agents23 commands
Install
$ npx -y skills add jmagly/aiwg --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/research-acquire

Context preview

What this command does when you run it.

Acquire research papers from acquisition queue, download PDFs, validate integrity, and organize artifacts

Command definition

research-acquire.md
description: Acquire research papers from acquisition queue, download PDFs, validate integrity, and organize artifacts
category: research-management
argument-hint: [--queue <file>] [--doi <identifier>] [--all] [--validate-only]
allowed-tools: Bash, Read, Write, Grep, Glob
model: claude-sonnet-4-6

Research Acquisition Command

Task

Download and validate research papers from acquisition queue. Retrieves PDFs from open access sources, institutional repositories, or DOI resolvers. Validates file integrity and organizes artifacts for documentation.

When invoked with `/research-acquire [options]`:

1. **Load** acquisition queue (from discovery or manual DOI list) 2. **Resolve** DOI URLs to PDF download locations 3. **Download** PDFs with retry logic and validation 4. **Verify** file integrity (checksum, PDF validity) 5. **Organize** files in `.aiwg/research/papers/` 6. **Update** acquisition status and metadata

Parameters

  • **`--queue <file>`** (optional): Custom acquisition queue (default: `.aiwg/research/discovery/acquisition-queue.json`)
  • **`--doi <identifier>`** (optional): Acquire single paper by DOI (e.g., `10.1145/example`)
  • **`--all`** (optional): Acquire all papers in queue (no confirmation)
  • **`--validate-only`** (optional): Validate existing downloads without re-downloading

Inputs

  • **Acquisition queue**: `.aiwg/research/discovery/acquisition-queue.json`
  • **Configuration**: `.aiwg/research/config.yaml` (download settings, retry limits)
  • **Manual DOI** (if --doi): User-provided DOI identifier

Outputs

  • **Downloaded PDFs**: `.aiwg/research/papers/{paper-id}.pdf`
  • **Metadata files**: `.aiwg/research/papers/{paper-id}.json`
  • **Acquisition log**: `.aiwg/research/logs/acquisition-{timestamp}.log`
  • **Updated queue**: Marks papers as `acquired`, `failed`, or `pending`

Workflow

Step 1: Load Acquisition Queue

# Read queue from discovery or custom file
QUEUE_FILE="${1:-.aiwg/research/discovery/acquisition-queue.json}"

if [ ! -f "$QUEUE_FILE" ]; then
  echo "Error: Acquisition queue not found: $QUEUE_FILE"
  echo "Run /research-discover first to create queue"
  exit 1
fi

# Parse paper list
PAPERS=$(jq -r '.papers[] | select(.status == "pending") | .paper_id' "$QUEUE_FILE")
TOTAL=$(echo "$PAPERS" | wc -l)

echo "Acquisition queue: $TOTAL papers pending"

Step 2: Resolve DOI to PDF

// DOI resolution strategy (priority order)
async function resolveDOI(doi: string): Promise<string> {
  // 1. Check Unpaywall API for open access PDFs
  const unpaywall = await fetchUnpaywall(doi);
  if (unpaywall.bestOaLocation?.pdfUrl) {
    return unpaywall.bestOaLocation.pdfUrl;
  }

  // 2. Try DOI.org resolver (may redirect to publisher)
  const doiUrl = `https://doi.org/${doi}`;
  const response = await fetch(doiUrl, { redirect: 'follow' });
  if (response.ok && isPDF(response)) {
    return response.url;
  }

  // 3. Check arXiv if paper has arXiv ID
  const arxivId = extractArxivId(doi);
  if (arxivId) {
    return `https://arxiv.org/pdf/${arxivId}.pdf`;
  }

  // 4. Check institutional repositories (if configured)
  const institutional = await checkInstitutionalRepos(doi);
  if (institutional) {
    return institutional;
  }

  throw new Error(`No open access PDF found for DOI: ${doi}`);
}

Step 3: Download PDF with Validation

**Security Note**: Download URLs from trusted sources only (Unpaywall, arXiv, DOI.org). Validate file integrity.

bash <<'EOF'
# Download paper PDF
DOI="10.1145/example"
PAPER_ID="abc123def456"
PDF_URL=$(resolve_doi "$DOI")

# Download with retry
for i in {1..3}; do
  curl -L -o ".aiwg/research/papers/${PAPER_ID}.pdf" "$PDF_URL" && break
  echo "Download failed, retry $i/3..."
  sleep 5
done

# Validate PDF integrity
if ! file ".aiwg/research/papers/${PAPER_ID}.pdf" | grep -q "PDF"; then
  echo "Error: Downloaded file is not a valid PDF"
  rm ".aiwg/research/papers/${PAPER_ID}.pdf"
  exit 1
fi

# Compute checksum
sha256sum ".aiwg/research/papers/${PAPER_ID}.pdf" > ".aiwg/research/papers/${PAPER_ID}.sha256"

echo "✓ Acquired: ${PAPER_ID}.pdf"
EOF

Step 4: Save Metadata

{
  "paper_id": "abc123def456",
  "doi": "10.1145/example",
  "title": "OAuth 2.0 Security Best Practices",
  "authors": ["Smith, J.", "Doe, A."],
  "year": 2023,
  "venue": "ACM CCS",
  "acquired_date": "2026-01-25T10:30:00Z",
  "source_url": "https://doi.org/10.1145/example",
  "pdf_path": ".aiwg/research/papers/abc123def456.pdf",
  "checksum_sha256": "abc123...",
  "file_size_bytes": 2048576,
  "status": "acquired"
}

Step 5: Update Acquisition Queue

// Mark paper as acquired in queue
function updateQueue(paperId: string, status: 'acquired' | 'failed') {
  const queue = JSON.parse(fs.readFileSync(QUEUE_FILE, 'utf-8'));
  const paper = queue.papers.find(p => p.paper_id === paperId);

  if (paper) {
    paper.status = status;
    paper.acquired_date = new Date().toISOString();
  }

  fs.writeFileSync(QUEUE_FILE, JSON.stringify(queue, null, 2));
}

Examples

Acquire All Papers in Queue

# Download all pending papers
aiwg research acquire --all

**Output**:

Acquisition queue: 10 papers pending

Acquiring papers...
✓ [1/10] abc123def456 - OAuth 2.0 Security Best Practices
✓ [2/10] def456ghi789 - Token Refresh Vulnerabilities
✗ [3/10] ghi789jkl012 - No open access PDF found
✓ [4/10] jkl012mno345 - PKCE Extension for OAuth 2.0
...

Summary:
  Acquired: 8 papers
  Failed: 2 papers (no open access)
  Total size: 45.2 MB

Failed papers:
  - ghi789jkl012: No open access PDF
  - xyz789abc123: Publisher paywall

Next steps:
  - Review acquired papers: ls .aiwg/research/papers/
  - Document papers: /research-document

Acquire Single Paper by DOI

# Download specific paper
aiwg research acquire --doi 10.1145/3491102.3501874

**Output**:

Resolving DOI: 10.1145/3491102.3501874
✓ Found open access PDF via Unpaywall
✓ Downloaded: abc123def456.pdf (2.1
Read more
Ships withaiwg

Multi-agent AI framework for Claude Code, Copilot, Cursor, Warp, and 6 more platforms 200+ agents, 109+ CLI commands, 400+ deployable agent/skill/command/rule artifacts, 8 core frameworks, 32 addons, and a 40-plugin Claude Code marketplace.

Get the whole plugin