Skip to main content
Goal. You have documents, contracts, invoices, reports, meeting notes, and questions to ask of them. This recipe starts with one file, then scales to a whole folder: it loops nito ask --file over each document, collects the answers as JSON, extracts structured fields, and aggregates everything into a single summary. It is the plugin’s honest version of document search: Nito parses each file to text and answers over it, with no vector database to stand up. When to reach for it. Extracting one field from every invoice, summarizing a directory of reports, or triaging a stack of documents. Start with the single-file section if you only have one.

How It Works

Nito ships a server-side file parser. Attach a document with --file and Nito extracts its text before the model sees it, so any model can answer, not just a vision model. Supported formats are PDF, DOCX, PPTX, XLSX, XLS, and plain text. Everything below is that one capability, applied once per file and captured as structured output.
There is no vector store, embedding step, or retrieval index here. For a small-to-medium set of documents, parse-and-ask is simpler and needs nothing to run. For a large corpus you query repeatedly, a retrieval pipeline against the API is a better fit; that is a platform, not plugin, workflow.

Prerequisites

  • Nito installed and signed in. See Nito CLI.
  • jq for reading the JSON output.
  • Documents in a supported format.
  • Any plan. This uses ask, available on Free (each file counts as one request).

Step 1: Ask one document

Start with the building block, a single file:
The answer prints with a label showing which model and privacy level served it. You did not paste any text, and you did not need a special model, Nito parsed the file for you.

Step 2: The batch script

Save this as batch-qa.sh and make it executable. It asks one question of every PDF in a folder and writes a JSON line per document.
The parts that matter:
  • nullglob + count check exits cleanly when the folder has no matching files.
  • --file "$file" attaches one document; Nito parses it to text server-side.
  • --json returns a structured object (content, model, privacy_route, token counts).
  • if answer=$(…); then skips a file that fails and keeps going, instead of aborting the whole batch.
  • jq -c … >> "$OUT" tags each answer with its filename and appends one JSON object per line (a .jsonl file).

Step 3: Run it

Step 4: Read and aggregate

Each line of answers.jsonl is one document’s answer:
Roll the whole set up into one summary by feeding the collected answers back through Nito:

Extract Structured Fields

Often you want typed fields, not prose. Nito does not expose server-side JSON-schema enforcement, so the reliable pattern is prompt for JSON, then validate on your side. Ask for the exact fields and forbid prose:
The model’s answer is inside the content field, so parse it twice: once for the envelope, once for the content. Treat the content as untrusted until it parses:
If the second jq fails, do not store the record. Re-ask with a stricter prompt, or validate against your own schema (JSON Schema, Pydantic, Zod) and reject anything that does not fit. Three things make this reliable: name every field and its type, say “return only JSON, no code fences”, and give an example shape when the structure is nested.

Variations

Keep sensitive documents private. For confidential files, pin a Private-tier model so the provider does not retain the contents:
Other formats. Change the glob from *.pdf to *.docx, *.xlsx, or a broader pattern to cover a mixed folder. Images instead of documents. A screenshot or photo needs a vision model, not the parser. See Screenshot Debugger.

Troubleshooting

Where to Go Next

File parser

How Nito extracts text from documents, and the supported formats.

Screenshot Debugger

The image path, for screenshots and diagrams.

Scripting and Automation

Output modes, exit codes, and piping for batch scripts.

Private Code Review Pipeline

The same JSON-and-scripting pattern, applied to code.