plainfile-family-history

AGENTS.md — Operating Instructions for AI Agents

Repo context first

If you are working in the public Plainfile spec repo (it contains SPEC.md, TOOLING.md, tools/, example-archive/, archive-template/ — but the repo root is NOT itself a populated archive): your default mode is tool-building or spec-refinement, never research. Do not treat the repo root as a family archive. Use example-archive/ only as a fictional fixture. Never add real family data.

When these instructions live at the root of a real archive (created from archive-template/, containing actual sources/, people/, etc.), the rules below apply in full and research is the default mode.


Inside an archive

You are working inside a durable family-history archive. SPEC.md is the law of this repository; TOOLING.md is the design of its tools. When these instructions are not enough, read those. When anything here conflicts with SPEC.md, SPEC.md wins.

What this place is

Plain files are the source of truth. Everything you generate must be rebuildable from them. The archive must remain fully usable by a human with a file browser and a text editor — your job is to help, never to become load-bearing.

The contract (non-negotiable)

  1. Your suggestions are not facts. Every claim you draft gets status: suggested. Only the human moves a claim to accepted, and only with a reviewed: date.
  2. Sessions are an interface, never memory. Anything worth keeping is written into archive records in SPEC formats before the session ends. Never rely on conversation history as a store of record.
  3. Never modify original content. The only allowed original-file changes are the spec-defined documents-root processing rename (via fha process) and embedded metadata writes performed through fha tools; photos are NEVER renamed.
  4. Never edit generated content. Files (or sections) beginning <!-- GENERATED ... --> are rebuilt by tools; regenerate, don’t patch.
  5. Mark your work as AI where formats allow, and never overwrite human-written text.
  6. Respect privacy flags. living: true AND living: unknown persons (unknown = living) and restricted: true sources are excluded from any export or external-facing output unless the human explicitly says otherwise. DNA material is always restricted.

Operating modes

State your current mode in your FIRST reply of a session (propose one and get confirmation if the human didn’t declare it). One mode at a time; if a request crosses modes, say so and ask to switch — never drift silently.

Session end (all modes)

Summarize what changed and where; list any proposed-but-unapproved decisions; supply a one-line commit message (git is the change log — commit only when asked).

The map

SPEC.md TOOLING.md      law + tool design (read before structural work)
photos/{year}/          originals — read-only to you (except spec'd keyword writes via tools)
                        NOTE: asset roots may live OUTSIDE this folder — resolve any
                        photos/ or documents/ path through fha.yaml roots first
documents/{type}/       originals — read-only to you (same exception)
sources/{type}/         one .md per source: frontmatter + ## Claims (yaml) + ## Notes
people/NNN .../         Ahnentafel couple folders; person + research files
people/connections/     non-direct people, "{anchor} {Surname}, {Given}"
people/stubs/           unplaced person stubs
places/places.yaml      place registry
notes/                  general research; notes/questions.md = question log
.cache/                 disposable tool caches — never treat as truth

Format quick reference

Tools (your hands)

Prefer fha tools over manual operations; if a tool does not exist yet, do the task by hand following SPEC and say so.

fha lint                     verify archive against spec — run after any batch of edits
fha index                    rebuild the SQLite query surface (.cache/index.sqlite)
fha id mint P|S|C|L|H        mint verified IDs
fha stubs                    create stubs for unresolved person references
fha process <file|folder>   process an original into a Source (documents: rename;
                            photos: NEVER rename — keyword only; + record scaffold)
fha views timeline|sources-index|brackets     regenerate views
fha photoindex find ...      query the photo library (never bulk-read photos/)
fha find <ID|text>           locate anything: record + assets + citations for an ID;
                            FTS across records, notes, transcripts, photo captions
fha find --related <ID>      neighborhood of any ID — people/places/sources/claims
                            adjacent to a person, place, source, claim, or hypothesis
fha packet <P-id>            person export packet

Execution rules (all tools): run from the archive root; --dry-run (or the tool’s preview) before ANY mutating operation; check exit codes (0 clean, 1 warnings, 2 errors, 3 tool failure) and never proceed past a 2/3 silently; on unexpected behavior, read the tool’s TOOLING.md section before retrying; full command reference: TOOLING §17.

Query the index, not the tree: person/claim/photo questions are SQL or fha calls. Never bulk-ingest photos/ or documents/ into context.

Common workflows

Don’ts

No symlinks. In research and migration modes, no new top-level archive folders (tool-building mode may create spec-defined support folders: tools/, tests/, .claude/). No bulk renames. NEVER rename anything under the photos root. No editing places.yaml coordinates without human confirmation. No writing to .cache/ by hand. No deleting anything without explicit instruction — prefer status: rejected/superseded and closed questions, which preserve the research trail.