Skip to content

The Research Pack

m4bwav edited this page Nov 1, 2026 · 3 revisions

A research pack is one folder that turns history research into something a 3D, film or image tool can build from. It holds the cited answer, the sources with their exact quotes, people and places with identifiers and dates, and a timeline. It also holds reference images from museum records and a list of anachronisms to avoid. The historywright-pack skill builds it; hw.py validate-pack checks it. The full contract is in contract.md.

A pack is also a valid polywright asset folder: manifest.json follows polywright's asset contract with a historywright block added, and the images sit in refs/.

The folder

File Holds
manifest.json polywright's asset manifest plus historywright: question, period, commercial, created date, and completeness
answer.md the answer with inline citations, the Confidence line, the Sources agree or disagree note, and the AI-researched line
sources.json every source read, each claim with its exact supporting quote, kind, tier and derived_from
entities.json people, polities and objects with QIDs and date objects (as_written, calendar, edtf, jdn, precision, qualifier, sources)
places.geojson an RFC 7946 FeatureCollection, [lon, lat]
timeline.json dated events, each with the source sentence it rests on and its JDN range
refs/index.json reference images from collection records, each with licence, accession number, institution, the object's date and place
anachronism.md what did not exist yet, what is often shown wrong, what the evidence says about colour, material and shape, each item cited
sources.csl.json optional: the sources as CSL-JSON for Zotero

Start a pack

python hw.py pack init legionary --question "What did a legionary in Gaul wear about 52 BC?" --period "52 BC"
{
 "ok": true,
 "pack": "legionary",
 "created": [
  "answer.md",
  "sources.json",
  "entities.json",
  "places.geojson",
  "timeline.json",
  "refs/index.json",
  "anachronism.md",
  "manifest.json"
 ]
}

--commercial marks a pack for commercial work, which keeps non-commercial images out of it.

For a machine, or a building with machinery, add --mechanism. The manifest then sets historywright.mechanism: true, and anachronism.md gets a section "Mechanism: what drives what, and where it must sit" with a "Water path" subsection for water-powered machines. It lists the dam or weir, head race, gate, where the water meets the wheel, turning direction and tail race, each a <fill: ...> placeholder. validate-pack fails until every placeholder is filled from the sources, or the water path is deleted for a machine that water does not drive. A fresh pack fails on every unedited template, which is the point:

python hw.py pack init sawmill --question "How did a water-powered sash sawmill work about 1800?" --period "1800" --mechanism
python hw.py validate-pack sawmill
{
 "ok": false,
 "pack": "sawmill",
 "problems": [
  "manifest.json historywright.completeness missing: list each part present or empty with a reason",
  "answer.md still holds the template placeholder <answer with inline citations [s1]>, <high|medium|low>, <what is uncertain and why>: write the answer",
  "sources.json needs a non-empty 'sources' list",
  "anachronism.md has 6 empty items (the template's '- ' lines): fill them or delete them",
  "anachronism.md still holds 10 template placeholders (<fill: ...>...): replace each with what the sources say, cited, or delete the water path if the machine is not water-powered"
 ],
 "warnings": []
}

A filled example, the 1790-1840 sawmill pack's water path cited to Evans 1795, HABS and Fairbairn 1864, is in mechanism-example.md.

Reference images

pack add-ref downloads an image, hashes it and records it in refs/index.json and the manifest. It takes --image (the file's URL), --page (the record page), --title, --licence, --object-date, --place, --accession and --institution. The rules validate-pack enforces:

  • Only collection records: a museum, archive or Commons file page, with the object's own date and an accession number or file page. Never an image search result, a film still or a generated picture.
  • A licence on every image. A non-commercial image needs nc: true and never enters a pack marked commercial.

Since 0.5.0 --image also takes a IIIF Presentation 2 or 3 manifest with --canvas N (1-based), or a IIIF Image API 2 or 3 service or its info.json. --ia ITEM --canvas N reads a page of an Internet Archive book through the archive's IIIF manifest and fills --page itself, so a book plate with no URL of its own can be added. --size caps the long side (default 2000 pixels, kept inside the service's limits), and the entry records the manifest, canvas, service and size under iiif. Page 301 of Evans 1795, a plate, added to the sawmill pack started above:

python hw.py pack add-ref sawmill --ia youngmillwrightm00evan --canvas 301 --title "Evans 1795, a plate" --licence "public domain" --object-date 1795 --place Philadelphia --accession youngmillwrightm00evan --institution "Internet Archive"
{
 "ok": true,
 "ref": {
  "file": "refs/internet-archive-youngmillwrightm00evan.jpg",
  "title": "Evans 1795, a plate",
  "object_date": "1795",
  "place": "Philadelphia",
  "accession": "youngmillwrightm00evan",
  "institution": "Internet Archive",
  "url": "https://archive.org/details/youngmillwrightm00evan/page/n300",
  "image_url": "https://iiif.archive.org/image/iiif/3/youngmillwrightm00evan%2Fyoungmillwrightm00evan_jp2.zip%2Fyoungmillwrightm00evan_jp2%2Fyoungmillwrightm00evan_0301.jp2/full/!2000,2000/0/default.jpg",
  "licence": "public domain",
  "author": null,
  "nc": false,
  "retrieved": "<today>",
  "sha256": "e1362f728392361e242afb0a584573e4e309cfa00581cf88e11cd1d444da0101",
  "bytes": 550396,
  "iiif": {
   "manifest": "https://iiif.archive.org/iiif/3/youngmillwrightm00evan/manifest.json",
   "canvas": 301,
   "service": "https://iiif.archive.org/image/iiif/3/youngmillwrightm00evan%2Fyoungmillwrightm00evan_jp2.zip%2Fyoungmillwrightm00evan_jp2%2Fyoungmillwrightm00evan_0301.jp2",
   "size": "!2000,2000"
  }
 }
}

The skill searches CC0 collections first (hw.py src met, cleveland, artic, getty), then Commons and Europeana. An empty search is a finding: it goes into completeness with the reason.

Validate

The repository's two test packs show what passes and what fails. The good one:

python hw.py validate-pack pack-good
{
 "ok": true,
 "pack": "pack-good",
 "problems": [],
 "warnings": []
}

The bad one breaks one rule per line, and validate-pack lists each, then exits 1:

python hw.py validate-pack pack-bad
{
 "ok": false,
 "pack": "pack-bad",
 "problems": [
  "missing anachronism.md",
  "completeness: places is empty without a reason",
  "answer.md has no 'Confidence:' line",
  "answer.md has no 'Sources disagree' / 'Sources agree' note",
  "answer.md does not say it was AI-researched",
  "s2: claim 'Caesar was born in 100 BC' has no supporting quote",
  "s3: https://en.wikipedia.org/wiki/Julius_Caesar is Wikipedia or a mirror; mark it tertiary and cite the source beneath it",
  "entity Julius Caesar: '1048' is not a QID",
  "entity Julius Caesar birth: a disputed date is a set or a range, never a point",
  "entity Julius Caesar birth: source s9 not in sources.json",
  "places.geojson has a 'crs' member (RFC 7946 removed it; coordinates are WGS 84 [lon, lat])",
  "feature 0 (Rome): coordinates are swapped relative to expected_coord",
  "feature 1 (open ring): a ring needs at least four positions",
  "timeline row 0: missing sentence",
  "timeline row 0: missing jdn",
  "timeline row 0: 'July 100 BC' is not EDTF",
  "ref refs/missing.jpg: missing object_date",
  "ref refs/missing.jpg: missing place",
  "ref refs/missing.jpg: missing accession",
  "ref refs/missing.jpg: missing institution",
  "ref refs/missing.jpg: non-commercial licence without nc: true",
  "ref refs/missing.jpg: non-commercial image in a pack marked commercial",
  "ref refs/missing.jpg: file missing",
  "ref refs/gen.png: missing url",
  "ref refs/gen.png: missing object_date",
  "ref refs/gen.png: missing place",
  "ref refs/gen.png: missing accession",
  "ref refs/gen.png: missing institution",
  "ref refs/gen.png: missing retrieved",
  "ref refs/gen.png: file missing",
  "ref refs/gen.png: generated images are not references (label them reconstructions elsewhere)"
 ],
 "warnings": []
}

Since 0.5.0 dates and timeline rows written as EDTF intervals are checked too: 1790/1840 (working years), 1790~/1840 (began about 1790), 1790/.. (still running) and ../1840 (start unknown) pass; an interval that ends before it starts fails, and so does a jdn range outside the days the EDTF covers (either calendar's reading of the bounds is accepted). A copy of the good pack with the timeline row's when set to 1840/1790 and Caesar's birth edtf set to 1790/1840, its jdn left at 100 BC:

python hw.py validate-pack pack-interval
{
 "ok": false,
 "pack": "pack-interval",
 "problems": [
  "entity Julius Caesar birth: jdn [1685091, 1685092] falls outside the days '1790/1840' covers [2374845, 2393483]",
  "timeline row 0: interval '1840/1790' ends before it starts"
 ],
 "warnings": []
}

0.4.0 passed the same pack.

validate-pack --network also re-reads every quote and DOI. verify sources checks the sources on their own (How claims are checked).

Export the sources

python hw.py pack csl pack-good
{
 "ok": true,
 "file": "pack-good/sources.csl.json",
 "items": 2
}

Hand-over

  • polywright reads manifest.json and refs/; its polywright-references skill starts from them, and pw.py manifest <pack> --validate passes on a pack (checked on 2026-10-17 with the end-to-end legionary pack, recorded in the repository's ai-docs/notes/2026-10-17-e2e-legionary.md).
  • Film and image tools read answer.md, refs/ and anachronism.md. Pictures generated from a pack are reconstructions, and the skill labels them so, never as evidence.
  • places.geojson feeds maps and polywright's pw.py place.

Clone this wiki locally