Skip to content

runtsang/RebuttalStudio / skills/document-memory/summarize

document-memory-summarize

Verified

Summarize extracted paper text into concise Markdown memory for later Stage 2 and Stage 4 background use, with fixed section headings and no fabricated claims.

FileKindSize
SKILL.mdskill md1.1 KB
scripts/extract_pdf_text.pyscript1.4 KB

scripts/extract_pdf_text.py

View on GitHub
#!/usr/bin/env python3
"""Extract plain text from a PDF using pypdf."""

from __future__ import annotations

import io
import sys
from pathlib import Path

from pypdf import PdfReader


def extract_text(pdf_path: Path) -> str:
    reader = PdfReader(str(pdf_path))
    parts = []
    for page in reader.pages:
        page_text = page.extract_text() or ""
        page_text = page_text.strip()
        if page_text:
            parts.append(page_text)
    return "\n\n".join(parts).strip()


def main() -> int:
    if len(sys.argv) != 2:
        print("Usage: extract_pdf_text.py <pdf_path>", file=sys.stderr)
        return 2

    pdf_path = Path(sys.argv[1]).expanduser().resolve()
    if not pdf_path.exists():
        print(f"PDF file not found: {pdf_path}", file=sys.stderr)
        return 1

    try:
        text = extract_text(pdf_path)
    except Exception as exc:  # pragma: no cover - surface raw extraction failures
        print(f"PDF extraction failed: {exc}", file=sys.stderr)
        return 1

    if not text:
        print(
            "PDF extraction returned empty text. The PDF may be image-based or missing a readable text layer.",
            file=sys.stderr,
        )
        return 1

    buffer = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", write_through=True)
    buffer.write(text)
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
add-product-e2e-evalpaperclipai/paperclipAdd or extend a Paperclip full-stack runner E2E workflow, fixture, matcher, or report evidence path for local or Daytona execution.Stars: 115kUpdated Claude CodeCodexVerifiedInstall
add-runner-evalpaperclipai/paperclipAdd or extend a Paperclip Runner protocol evaluation definition, roster, assertion, or report fixture with provenance and narrow validation.Stars: 115kUpdated Claude CodeCodexVerifiedInstall
diagnose-why-work-stoppedpaperclipai/paperclipCompatibility entry point for failed, stalled, looping, or over-recovered Paperclip work. Use fix-failed-paperclip-run for the full diagnosis, regression, repair, real verification, and green-PR workflow; honor an explicitly requested diagnosis-only scope.Stars: 115kUpdated Claude CodeCodexVerifiedInstall
fix-failed-paperclip-runpaperclipai/paperclipDiagnose and fix failed, stuck, slow, or incorrectly blocked Paperclip tasks and runs. Use with a task/run URL or failure report to trace the root cause, prove a regression red then green, check second-order effects, verify the real workflow, and deliver a PR with passing checks.Stars: 115kUpdated Claude CodeCodexVerifiedInstall