| name | docqa |
| description | Parse large PDF documents and answer questions with accurate citations from the PDF content. |
DocQA
Parse large PDF documents, such as technical manuals, and answer questions by accurately citing document content.
Preflight
Before parsing:
- Ensure current system is Linux or macOS.
- Ensure Deno is installed. If not, stop and ask for permission to install with
curl -fsSL https://deno.land/install.sh | sh.
- Ensure PDF-related tools are installed. If not, stop and ask for permission to install
poppler.
- Check whether
~/.agents/skills/docqa/.env is configured. It must contain the OpenAI-compatible endpoint configuration for the image-processing model:
OPENAI_BASE_URL
OPENAI_API_KEY
OPENAI_MODEL
- If
~/.agents/skills/docqa/.env does not exist or any required value is missing, ask the user for the OpenAI base URL, API key, and image-processing model name, then write them to ~/.agents/skills/docqa/.env.
Index a PDF
When the user asks to process or index a PDF document:
-
Resolve the PDF path the user wants to process.
-
Run the CLI index command:
deno run --allow-read --allow-write --allow-env --allow-run --allow-sys --allow-net ~/.agents/skills/docqa/scripts/cli <pdf-file> index
-
Wait for the command to finish. On success, report the full cache directory path printed by the CLI.
Answer Questions
When the user asks a question about an indexed PDF:
- Use the cache directory produced by the indexing step.
- Search
index/ with jq to inspect page-level keywords, summaries, topics, headings, facts, and other structured index fields. Use the user's question to identify multiple pages that are most likely relevant.
- After selecting candidate pages, read the corresponding original extracted Markdown files from
markdown/, such as markdown/page-0001.md.
- Answer the user's question faithfully from the Markdown page content. Do not rely only on the index summaries, and do not invent facts not supported by the extracted page text.
- Include the supporting PDF page numbers in the answer, using the page numbers from the index or Markdown file names.