From ef195f98d4cc84b2e7cb3ebd0fec18cee094e535 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 01:03:44 +0000 Subject: [PATCH 1/4] Add use-case explainer: fact-checking agent-drafted project reports Most docs assume literature references (PMID, DOI). This page shows LRV checking a PM's monthly report against non-literature sources: meeting notes, Google Docs exports, GitHub issue snapshots and scripted metrics, all as local markdown files for v1. Covers a [source: ""] claim convention checked with the existing `validate text-file --regex`, snapshot scripts for GitHub issues and counts, what a pass does and doesn't establish, the regex's silent skips and a lint for them, a deterministic strip step for the stakeholder copy, a draft agent skill, and possible future gdoc:/gh: prefixes. All LRV outputs shown come from real runs. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VjkEiwfjfgydYqJ3iMEQkR --- docs/index.md | 4 + docs/use-cases/project-reports.md | 598 ++++++++++++++++++++++++++++++ mkdocs.yml | 2 + 3 files changed, 604 insertions(+) create mode 100644 docs/use-cases/project-reports.md diff --git a/docs/index.md b/docs/index.md index a699af1b..334be547 100644 --- a/docs/index.md +++ b/docs/index.md @@ -21,6 +21,10 @@ linkml-reference-validator ensures that text excerpts in your data accurately ma - **[How It Works](concepts/how-it-works.md)** - Understanding the validation process - **[Editorial Conventions](concepts/editorial-conventions.md)** - Using brackets and ellipsis +## Use Cases + +- [Fact-Checking Project Reports](use-cases/project-reports.md) - Check an agent-drafted status report against meeting notes, GitHub issues and other non-literature sources + ## Tutorials - [Getting Started (CLI)](notebooks/01_getting_started.ipynb) - Validate quotes from the command line diff --git a/docs/use-cases/project-reports.md b/docs/use-cases/project-reports.md new file mode 100644 index 00000000..16d13551 --- /dev/null +++ b/docs/use-cases/project-reports.md @@ -0,0 +1,598 @@ +# Fact-Checking Project Reports + +Most of these docs assume your references are papers: PMIDs, DOIs, PMC full +text. LRV doesn't need them to be. All it checks is whether an excerpt appears, +word for word, in the source you cite. That check works just as well when the +sources are meeting notes, GitHub issues, a Google Doc and a metrics dump. + +This page walks through one such case: a project manager who uses an agent to +draft monthly status reports and wants a guardrail against hallucinated status +claims. The example project, `acme/disease-db`, is made up, but every LRV +output shown comes from running the current CLI on the files shown. Parts that +LRV doesn't provide yet, such as the helper script and the skill, are marked +**Proposed**. + +## The problem + +Each month the PM asks an agent to read the meeting notes, the shared Google +Docs and the project's GitHub repos, and draft a report. The agent writes: + +> Issue 234 is blocked because Ann is waiting for Bob to merge the schema change. + +This is plausible, and maybe true. But where does it come from? Did Ann say it +in a meeting, or did the agent put a `blocked` label together with an unrelated +comment? If it's wrong, it reaches stakeholders under the PM's name, about named +colleagues. + +To catch that, each factual statement carries the source it came from and the +exact words it rests on. Then a deterministic tool, not another model, confirms +those words are really there before the report goes out. + +## The workflow + +```mermaid +flowchart LR + A[Google Docs
GitHub
metrics
web] -->|export tools| B[sources/*.md
snapshots] + B --> C[Agent drafts
report.md
with source markers] + C --> D{lint + LRV} + D -->|fail| C + D -->|pass| E[PM reviews
claim vs excerpt] + E --> F[Strip markers] + F --> G[Stakeholder
report] +``` + +1. **Snapshot** every source into the PM's project repo as markdown, using + export tools rather than the agent. +2. **Draft**: the agent writes the report in markdown and tags each fact with a + `[source: ...]` marker. +3. **Check**: a lint step confirms every marker is well formed, then LRV + confirms every excerpt is in its source. +4. **Review**: the PM reads each claim beside its excerpt, which takes far less + time than rereading the sources. +5. **Publish**: a script strips the markers to produce the copy for + stakeholders. + +Google Docs is where many PMs would rather work, but LRV can't read a Google +Doc yet. So v1 works from **local markdown files**, and Google Docs come in as +exports (see [below](#google-docs)). + +## 1. The claim convention + +A claim is ordinary prose followed by a marker: + +```text + [source: ""] +``` + +The issue 234 sentence makes two claims, so it gets two markers: + +```markdown +- Issue 234 (loading MONDO synonyms) is blocked [source: file:sources/github/acme-disease-db/issue-234.md "labels: loader, blocked"] because Ann is waiting for Bob to merge the synonym-type schema change [source: file:sources/meetings/2026-11-18-weekly-sync.md "Ann can't start the MONDO loader until Bob merges the schema change for synonym types"]. +``` + +### Rules + +| Rule | Why | +| --- | --- | +| `REFERENCE` is an LRV reference ID: `file:` for a snapshot in the repo (the v1 default), `url:` for a public web page, or any other prefix LRV knows. | The marker is passed to LRV unchanged. A bare path gets `No source found for reference type`. | +| `EXCERPT` is copied word for word, in straight `"..."` or curly `“...”` quotes. It may use `...` and `[editorial notes]` (see [Editorial Conventions](../concepts/editorial-conventions.md)). | LRV ignores differences in case, punctuation and spacing. Any other change in wording fails. | +| An excerpt cannot contain a double quote. | It would end the excerpt early. Quote around it, or use `...`. | +| The whole marker stays on one line, and reports are not hard-wrapped. | `validate text-file` reads one line at a time. Set your editor or formatter to keep each paragraph on one line (Prettier: `proseWrap: never`). | +| One marker per fact. A *because* sentence usually needs two. | The excerpt can only vouch for the part of the sentence it covers. | +| The excerpt includes the words that identify the fact, not just the number: `"Diseases: 200"`, not `"200"`. | `"200"` could match any 200 in the file. | +| Numbers are quoted as the source writes them: `"Synonyms: 1,431"`, not `"1431"`. | A match must start and end on whole words, so `"Open issues: 1"` correctly fails against `Open issues: 12`, but this also means a reformatted number fails. | +| Opinions, forecasts and recommendations are tagged `[assessment]` instead of a source. **Proposed.** | The tag makes it explicit that the PM chose to leave the statement unsourced, and the lint step can enforce that every bullet has one or the other. | + +The syntax is meant to read like a citation in plain markdown. It doesn't +collide with markdown links (`[text](url)`), because it must start with +`[source:`. And a single regular expression pulls it out. + +## 2. Snapshot sources into the project repo + +Every source the agent may cite is saved as a markdown file in the PM's +project repo: + +```text +project-repo/ +├── sources/ +│ ├── meetings/2026-11-18-weekly-sync.md +│ ├── gdrive/1AbCdEfGhIjK--roadmap.md +│ ├── github/acme-disease-db/issue-234.md +│ ├── metrics/2026-11-30-db-stats.md +│ └── metrics/2026-11-30-github.md +└── reports/ + └── 2026-11-monthly.md +``` + +Snapshots, rather than live lookups, because: + +- **The check is reproducible.** The report is checked against what the agent + read on report day. Live sources change: an issue is relabelled, the meeting + notes are tidied, and a check next week fails, or passes, for reasons that + have nothing to do with the report. +- **It works for every source today.** LRV has no Google Docs source and no + GitHub-issue source, but it reads local markdown files. +- **It stays private.** LRV never writes `file:` content to its cache (see + [Using Local Files](../how-to/use-local-files-and-urls.md#local-files-are-not-cached)), + so meeting notes don't get copied into a committed `references_cache/`. + +**The snapshot must come from an export tool, never from the agent.** If the +agent retypes or summarises a Google Doc into `sources/`, it is checking its +claims against its own writing, and the check proves nothing. + +Each snapshot starts with a small header saying where it came from. LRV reads +the header as ordinary text, which does no harm, and the publish step can use +`source_url` to turn markers into links. + +```markdown +--- +source_url: https://github.com/acme/disease-db/issues/234 +retrieved: 2026-11-30 +--- +``` + +### Google Docs + +In Google Docs, use **File → Download → Markdown (.md)**. Name the file after +the document ID in the doc's URL (`docs.google.com/document/d//edit`) so +it can be traced back, and add the header: + +```markdown +--- +source_url: https://docs.google.com/document/d/1AbCdEfGhIjK/edit +retrieved: 2026-11-30 +--- +``` + +To automate this, export through the Google Drive API, which can export a Doc +as Markdown. Whichever way you export, the export tool must write the file, not +the agent. + +### GitHub issues + +This script writes an issue and its comments to +`sources/github/-/issue-.md`, with the state, labels and +assignees on their own lines so they can be quoted: + +```bash +#!/usr/bin/env bash +# Usage: snapshot_issue.sh OWNER/REPO NUMBER +set -euo pipefail +repo=$1; num=$2 +out=sources/github/${repo/\//-}/issue-$num.md +mkdir -p "$(dirname "$out")" +{ + gh api "repos/$repo/issues/$num" --jq '"---\nsource_url: \(.html_url)\nretrieved: \(now|strftime("%Y-%m-%d"))\n---\n\n# \(.title) (#\(.number))\n\nstate: \(.state)\nlabels: \([.labels[].name]|join(", "))\nassignees: \([.assignees[].login]|join(", "))\n\n\(.body // "")\n"' + gh api "repos/$repo/issues/$num/comments?per_page=100" \ + --jq '.[] | "\n---\n\n**\(.user.login)** commented on \(.created_at[0:10]):\n\n\(.body)\n"' +} > "$out" +echo "$out" +``` + +The result looks like this: + +```markdown +--- +source_url: https://github.com/acme/disease-db/issues/234 +retrieved: 2026-11-30 +--- + +# Load MONDO synonyms (#234) + +state: open +labels: loader, blocked +assignees: ann + +Load exact and related synonyms from MONDO into the synonym table. + +--- + +**ann** commented on 2026-11-19: + +Blocked on the synonym-type schema change (#229). +``` + +### Counts and other GitHub metadata + +**Never let the agent count.** "37 open issues" doesn't appear in any document, +so a script has to write it into one, and the agent then quotes it: + +```bash +repo=acme/disease-db +count() { gh api -X GET search/issues -f q="repo:$repo $1" --jq .total_count; } +out=sources/metrics/$(date +%F)-github.md +{ + printf -- '---\ngenerated: %s\n---\n\n' "$(date -u +%FT%TZ)" + printf '# GitHub metrics for %s, %s\n\n' "$repo" "$(date +%F)" + printf 'Open issues: %s\n' "$(count 'is:issue is:open')" + printf 'Open pull requests: %s\n' "$(count 'is:pr is:open')" + printf 'Issues closed in November: %s\n' "$(count 'is:issue closed:2026-11-01..2026-11-30')" +} > "$out" +``` + +Database statistics work the same way. A `db_stats.py` script writes +`Diseases: 200`, and the report says +`The database holds 200 diseases [source: file:sources/metrics/2026-11-30-db-stats.md "Diseases: 200"]`. + +### Web pages + +A `url:` reference works directly in a marker: + +```markdown +The vendor's plan includes 10 seats [source: url:https://example.com/pricing "Team plan includes 10 seats"]. +``` + +LRV caches the page it fetches in `cache_dir`, and that cached copy is your +snapshot. For a page that changes often, save a copy under `sources/web/` +instead and cite it with `file:`. + +### Alternative: GitHub issues fetched live + +An issue can also be fetched live as a [JSON API source](../how-to/add-reference-source.md), +with no snapshot step. Put this in `.linkml-reference-validator-sources.yaml`: + +```yaml +sources: + GHISSUE: + url_template: "https://api.github.com/repos/{id}" + fields: + title: "$.title" + content: "$.body" +``` + +Then cite, for example, `GHISSUE:acme/disease-db/issues/234`. This works +today, with limits: + +- Only the title and body are read. A JSON API source fills `content` from one + JSONPath match, so labels, state and comments are left out. Several fields per + source is requested in + [linkml/linkml-reference-validator#179](https://github.com/linkml/linkml-reference-validator/issues/179). +- A private repo needs `headers: {Authorization: "Bearer ${GITHUB_TOKEN}"}`. +- Unlike `file:` content, the issue body is written to `cache_dir`. Don't commit + that cache for a private repo. +- The check is not reproducible: next month the issue may say something else. + +For v1, use snapshots. + +## 3. Check the report + +Here is the agent's draft. Two of its claims are wrong: + +```markdown +# Disease DB: November 2026 report + +## Highlights + +- The database now holds 200 diseases [source: file:sources/metrics/2026-11-30-db-stats.md "Diseases: 200"]. +- Issue 234 (loading MONDO synonyms) is blocked [source: file:sources/github/acme-disease-db/issue-234.md "labels: loader, blocked"] because Ann is waiting for Bob to merge the synonym-type schema change [source: file:sources/meetings/2026-11-18-weekly-sync.md "Ann can't start the MONDO loader until Bob merges the schema change for synonym types"]. +- The December release moves to 12 Dec [source: file:sources/meetings/2026-11-18-weekly-sync.md "slip the December release to 12 Dec"]. + +## Risks + +- Bob expects to merge the schema change by 20 Nov [source: file:sources/meetings/2026-11-18-weekly-sync.md "Bob expects to merge it by 20 Nov"]. +- Carla has already approved the loader PR [source: file:sources/meetings/2026-11-18-weekly-sync.md "Carla approved the loader PR"]. +- Loader work may slip into January [assessment]. +``` + +The meeting notes it cites say: + +```markdown +## Loader + +- Ann can't start the MONDO loader until Bob merges the schema change for + synonym types. Bob expects to merge it by 25 Nov. +- Carla will review the loader PR once it exists. +``` + +Run `validate text-file` with a regex for the marker. The reference is capture +group 1 and the excerpt is group 2: + +```bash +linkml-reference-validator validate text-file reports/2026-11-monthly.md \ + --regex '\[source:[ \t]*(\S+)[ \t]+["“]([^"“”\n]+)["”]\]' \ + --ref-group 1 --text-group 2 +``` + +Output (header trimmed): + +```text +Found 6 match(es) to validate + +Line 5: - The database now holds 200 diseases [source: file:sources/metrics/2026-11-30-d... + ✓ VALID: Supporting text validated successfully in file:sources/metrics/2026-11-30-db-stats.md + +Line 6: - Issue 234 (loading MONDO synonyms) is blocked [source: file:sources/github/acm... + ✓ VALID: Supporting text validated successfully in file:sources/github/acme-disease-db/issue-234.md + +Line 6: - Issue 234 (loading MONDO synonyms) is blocked [source: file:sources/github/acm... + ✓ VALID: Supporting text validated successfully in file:sources/meetings/2026-11-18-weekly-sync.md + +Line 7: - The December release moves to 12 Dec [source: file:sources/meetings/2026-11-18... + ✓ VALID: Supporting text validated successfully in file:sources/meetings/2026-11-18-weekly-sync.md + +Line 11: - Bob expects to merge the schema change by 20 Nov [source: file:sources/meeting... + ✗ INVALID: Text part not found as substring: 'Bob expects to merge it by 20 Nov' + +Line 12: - Carla has already approved the loader PR [source: file:sources/meetings/2026-1... + ✗ INVALID: Text part not found as substring: 'Carla approved the loader PR' + +============================================================ +Validation Summary: + Total validations: 6 + Valid: 4 + Invalid: 2 + Errors: 2 + +✗ Some validations failed +``` + +The exit status is 1. One failure is a misremembered date. The other is an +approval that never happened: the notes say Carla *will* review the PR. If the +agent cites a meeting that never took place, the file doesn't exist and LRV +says so: + +```text + ✗ INVALID: Could not fetch reference: file:sources/meetings/2026-11-25-sync.md +``` + +The agent fixes each failure by going back to the source, never by editing the +excerpt until it passes. Then it reruns the check: + +```text +Validation Summary: + Total validations: 5 + Valid: 5 + Invalid: 0 + Errors: 0 + +✓ All validations passed! +``` + +## 4. What a pass means + +| Problem | Caught by | +| --- | --- | +| Invented excerpt, or an excerpt from a different file | LRV: `not found as substring` | +| Wrong number, date or name inside the excerpt | LRV | +| Cited source doesn't exist | LRV: `Could not fetch reference` | +| Marker typo, an excerpt containing `"`, or a marker split across lines | Nothing: the regex skips it without a warning. See [the lint step](#5-the-regex-is-brittle-lint-for-it). | +| Bullet with no marker at all | The lint step. In running prose, only the PM's review. | +| Real excerpt, wrong claim | The PM's review | +| The source itself is wrong or out of date | Nobody. The snapshot's `retrieved` date makes it visible. | + +The "real excerpt, wrong claim" row is the one to understand. This passes: + +```markdown +- Bob will merge by 20 Nov [source: file:sources/meetings/2026-11-18-weekly-sync.md "Bob expects to merge it by 25 Nov"]. +``` + +LRV checked the excerpt, not the sentence before it. That gap is why step 4 is +a human reading each claim beside its excerpt. An LLM check of whether the +excerpt supports the claim could flag cases like this, but it would be a second +probabilistic check, not a guarantee. + +LRV catches the failure that worries PMs most: a confident, specific statement +with nothing behind it. What's left is a claim that misreads a real excerpt, +and the PM can spot that by reading the two side by side. + +## 5. The regex is brittle: lint for it + +`validate text-file` reports on the markers it extracts and says nothing about +the ones it doesn't. In a test file with 8 markers it found 5. These three were +skipped without a warning: + +```markdown +- Case typo [Source: file:sources/meetings/2026-11-18-weekly-sync.md "Carla approved the loader PR"]. +- Inner quote [source: file:sources/github/acme-disease-db/issue-234.md "the "synonym-type" schema change"]. +- Hard wrapped [source: file:sources/meetings/2026-11-18-weekly-sync.md "Carla + approved the loader PR"]. +``` + +Two of those three excerpts are false. So the regex check needs a companion +that counts loose matches of `[source` against strict ones. + +**Proposed:** `report_claims.py`, a single script that lints markers, strips +them, and builds a review table. It keeps its regex identical to the one passed +to LRV: + +```python +"""Lint, strip, or tabulate [source: ...] claim markers in a markdown report. + +Usage: python report_claims.py {lint|strip|review} REPORT.md +""" +import re +import sys + +# Keep this identical to the --regex passed to `validate text-file`. +CLAIM = re.compile(r'\[source:[ \t]*(\S+)[ \t]+["“]([^"“”\n]+)["”]\]') +LOOSE = re.compile(r"\[\s*sources?\b", re.IGNORECASE) +ASSESSMENT = "[assessment]" +BULLET = re.compile(r"^\s*(?:[-*+]|\d+\.)\s+") + + +def lint(text: str) -> list[str]: + """Report markers the regex will skip, and bullets with no marker.""" + problems = [] + for n, line in enumerate(text.splitlines(), start=1): + strict = len(CLAIM.findall(line)) + loose = len(LOOSE.findall(line)) + if loose > strict: + problems.append(f"line {n}: malformed [source: ...] marker (will not be checked)") + elif BULLET.match(line) and not strict and ASSESSMENT not in line: + problems.append(f"line {n}: bullet has no [source: ...] and no {ASSESSMENT}") + return problems + + +def strip(text: str) -> str: + """Remove every marker and [assessment] tag, leaving the prose untouched.""" + text = re.sub(r"[ \t]*" + CLAIM.pattern, "", text) + return re.sub(r"[ \t]*" + re.escape(ASSESSMENT), "", text) + + +def review(text: str) -> str: + """One table row per marker: the claim it follows, and what it rests on.""" + rows = ["| Line | Claim | Excerpt | Source |", "| --- | --- | --- | --- |"] + for n, line in enumerate(text.splitlines(), start=1): + start = 0 + for m in CLAIM.finditer(line): + claim = strip(BULLET.sub("", line[start : m.start()])).strip() + cells = [str(n), claim, m.group(2), f"`{m.group(1)}`"] + rows.append("| " + " | ".join(c.replace("|", "\\|") for c in cells) + " |") + start = m.end() + return "\n".join(rows) + "\n" + + +if __name__ == "__main__": + mode, path = sys.argv[1], sys.argv[2] + text = open(path, encoding="utf-8").read() + problems = lint(text) + for p in problems: + print(f"{path}: {p}", file=sys.stderr) + if problems: + sys.exit(1) + if mode == "strip": + sys.stdout.write(strip(text)) + elif mode == "review": + sys.stdout.write(review(text)) +``` + +On the test file: + +```bash +python report_claims.py lint reports/brittle.md +``` + +```text +reports/brittle.md: line 6: malformed [source: ...] marker (will not be checked) +reports/brittle.md: line 7: malformed [source: ...] marker (will not be checked) +reports/brittle.md: line 8: malformed [source: ...] marker (will not be checked) +``` + +Wrap the two checks in one script that the agent runs before saying the report +is done: + +```bash +#!/usr/bin/env bash +# scripts/check-report.sh REPORT.md +set -euo pipefail +python scripts/report_claims.py lint "$1" +linkml-reference-validator validate text-file "$1" \ + --regex '\[source:[ \t]*(\S+)[ \t]+["“]([^"“”\n]+)["”]\]' \ + --ref-group 1 --text-group 2 +``` + +## 6. Review and publish + +### Review table + +`review` mode gives the PM one row per claim to check by eye: + +| Line | Claim | Excerpt | Source | +| --- | --- | --- | --- | +| 5 | The database now holds 200 diseases | Diseases: 200 | `file:sources/metrics/2026-11-30-db-stats.md` | +| 6 | Issue 234 (loading MONDO synonyms) is blocked | labels: loader, blocked | `file:sources/github/acme-disease-db/issue-234.md` | +| 6 | because Ann is waiting for Bob to merge the synonym-type schema change | Ann can't start the MONDO loader until Bob merges the schema change for synonym types | `file:sources/meetings/2026-11-18-weekly-sync.md` | +| 7 | The December release moves to 12 Dec | slip the December release to 12 Dec | `file:sources/meetings/2026-11-18-weekly-sync.md` | +| 11 | Bob expects to merge the schema change by 25 Nov | Bob expects to merge it by 25 Nov | `file:sources/meetings/2026-11-18-weekly-sync.md` | + +### Stakeholder copy + +The copy that goes out is the checked report with the markers removed, and +nothing else changed: + +```bash +python scripts/report_claims.py strip reports/2026-11-monthly.md > reports/2026-11-monthly.stakeholder.md +``` + +```markdown +# Disease DB: November 2026 report + +## Highlights + +- The database now holds 200 diseases. +- Issue 234 (loading MONDO synonyms) is blocked because Ann is waiting for Bob to merge the synonym-type schema change. +- The December release moves to 12 Dec. + +## Risks + +- Bob expects to merge the schema change by 25 Nov. +- Loader work may slip into January. +``` + +**Use a script to strip, not the agent.** An agent asked to "tidy up the report +for stakeholders" will also rephrase it, and can put back exactly the kind of +claim you just checked. If the prose needs changing, change the checked report +and run the check again. + +Other ways to publish, depending on the audience: + +- **Strip** (above), for external stakeholders. +- **Footnotes**, for internal readers: replace each marker with `[^n]` and link + the footnote to the snapshot's `source_url`. **Proposed.** +- **Keep the markers**, for the team, who may want to follow them. + +### A skill for the agent (Proposed) + +A skill puts the convention and the checks into one set of instructions the +agent follows every month. A draft: + +```markdown +--- +name: project-report-claims +description: Draft, check and publish project status reports whose factual statements carry [source: ...] markers checked by linkml-reference-validator. Use when writing a weekly or monthly report from meeting notes, GitHub issues, Google Docs exports or metrics snapshots, or when preparing the stakeholder copy of such a report. +--- + +# Project report claims + +## Draft +- Cite only files under sources/. If a fact's source isn't there, ask the PM + for a snapshot. Never cite a live document or your memory, and never write + files in sources/ yourself. +- End every factual statement with [source: file: ""]. Copy the + excerpt from the file; never paraphrase inside the quotes. +- One marker per fact. A "because" sentence usually needs two. +- Tag opinions, forecasts and recommendations with [assessment]. +- Keep each paragraph or bullet on one line. + +## Check +Run scripts/check-report.sh . For each failure, reopen the source and +then fix the excerpt to the real wording, fix the claim to match the source, +or delete the claim. Never edit a snapshot to make a check pass. Rerun until +it passes. + +## Hand over +Show the PM the output of `scripts/report_claims.py review ` and say +how many claims were checked and how many statements are tagged [assessment]. + +## Publish +Only after the check passes and the PM has reviewed the table, run +`scripts/report_claims.py strip > .stakeholder.md`. +Don't edit or rephrase the stripped copy. If the wording must change, change +the checked report and check again. +``` + +## What LRV could add + +These would make the convention less fragile. None of them exist yet. + +- **A built-in claim syntax** (for example `validate markdown`) so users don't + have to write the regex. It could report malformed markers instead of + skipping them, accept markers that wrap across lines, and count coverage. +- **A `gdoc:` reference prefix.** It would look for an exported snapshot + in a configured directory first, so v1 `file:sources/gdrive/--*.md` + citations can become `gdoc:` without changing anything else, and + optionally fetch through the Drive API. +- **A `gh:owner/repo#234` reference prefix** that reads the body, comments, + labels and state as one text. +- **Several fields per JSON API source** + ([linkml/linkml-reference-validator#179](https://github.com/linkml/linkml-reference-validator/issues/179)), + a lighter way to get the same result for GitHub and similar APIs. +- **Working in Google Docs directly:** markers in the doc, exported and checked, + with failures posted back as comments on the doc. + +## See also + +- [Using Local Files and URLs](../how-to/use-local-files-and-urls.md) +- [Editorial Conventions](../concepts/editorial-conventions.md) +- [Adding a Custom Reference Source](../how-to/add-reference-source.md) +- [`validate text-file`](../reference/cli.md#validate-text-file) diff --git a/mkdocs.yml b/mkdocs.yml index c757541d..7c23d36a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -48,6 +48,8 @@ nav: - Adding a New Reference Source: how-to/add-reference-source.md - Skipping Unsupported References: how-to/skip-unsupported-references.md - Repairing Validation Errors: how-to/repair-validation-errors.md + - Use Cases: + - Fact-Checking Project Reports: use-cases/project-reports.md - Concepts: - How It Works: concepts/how-it-works.md - Content Types: concepts/content-types.md From 01a9297c7082ff040544b6bf8fbe7c5c61734e18 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 01:36:04 +0000 Subject: [PATCH 2/4] Explain regex vs HTML span conventions in the project-reports page Adds why `validate text-file --regex` is today's only route for prose reports and where it is awkward (linkml/linkml-reference-validator#40), compares the bracket marker with an inline HTML span form, including how each fares in Google Docs, and points to the span proposal in linkml/linkml-reference-validator#91. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VjkEiwfjfgydYqJ3iMEQkR --- docs/use-cases/project-reports.md | 43 ++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/docs/use-cases/project-reports.md b/docs/use-cases/project-reports.md index 16d13551..316aef76 100644 --- a/docs/use-cases/project-reports.md +++ b/docs/use-cases/project-reports.md @@ -87,6 +87,45 @@ The syntax is meant to read like a citation in plain markdown. It doesn't collide with markdown links (`[text](url)`), because it must start with `[source:`. And a single regular expression pulls it out. +### Why a regex, and what else is possible + +LRV has two ways in. `validate data` reads YAML or JSON records against a +LinkML schema, which suits curated datasets but not a report people read. +`validate text-file` pulls quotes out of any text file with a regular +expression you supply. For a report in markdown, the regex is the only option +today. + +It works, but it's awkward. You write and maintain the regex yourself. It reads +one line at a time, it's case-sensitive, it can't cope with a double quote +inside an excerpt, and anything it doesn't match is skipped without a warning +(see [the lint step](#5-the-regex-is-brittle-lint-for-it)). Other projects hit +the same limits: +[linkml/linkml-reference-validator#40](https://github.com/linkml/linkml-reference-validator/issues/40) +comes from markdown that cites papers as `@ref PMID:… "title" excerpt: "…"`, +where checking both the title and the excerpt takes two runs. + +The alternative is an HTML span. Markdown allows inline HTML, so the claim +itself can be wrapped: + +```html +Issue 234 is blocked +``` + +| | Bracket marker | HTML span | +| --- | --- | --- | +| For | Works with LRV today. Reads as plain text in any editor, including a Google Doc, so it survives a move to Docs. | Read with an HTML parser, not a regex: it can wrap across lines, an excerpt can hold `"`, and broken markup can be reported instead of skipped. Marks exactly which words the claim covers. Hidden when the report is rendered, although the raw file still needs stripping. | +| Against | Needs a hand-written regex, with the limits above. Doesn't say where the claim starts: the review table guesses, from the end of the previous marker. | Noisy to write and to read in raw markdown. Google Docs has no inline HTML, so in a doc the tags are typed text that every reader sees. LRV can't read claims from spans in a document yet. | + +The nearest existing proposal is +[linkml/linkml-reference-validator#91](https://github.com/linkml/linkml-reference-validator/issues/91) +(open). It puts spans to a different use: `` inside an excerpt, +marking which words support which part of a claim, with LRV removing the tags +before matching. It's aimed at excerpts in data files rather than whole +documents. But it targets the gap this page leaves to the PM's review, a real +excerpt behind a wrong claim (see [What a pass means](#4-what-a-pass-means)), by +making each link between claim and evidence explicit. + ## 2. Snapshot sources into the project repo Every source the agent may cite is saved as a markdown file in the PM's @@ -577,7 +616,9 @@ These would make the convention less fragile. None of them exist yet. - **A built-in claim syntax** (for example `validate markdown`) so users don't have to write the regex. It could report malformed markers instead of - skipping them, accept markers that wrap across lines, and count coverage. + skipping them, accept markers that wrap across lines, and count coverage. It + could accept the bracket marker, the + [span form](#why-a-regex-and-what-else-is-possible), or both. - **A `gdoc:` reference prefix.** It would look for an exported snapshot in a configured directory first, so v1 `file:sources/gdrive/--*.md` citations can become `gdoc:` without changing anything else, and From ead19b00514470b9b474a7490357812a54495114 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 01:38:49 +0000 Subject: [PATCH 3/4] Project-reports page: skill and hook entry points, gdrive: prefix idea Says up front that the PM runs the check through the skill or a Claude Code PostToolUse hook rather than typing commands, with a tested hook script. Calls the Google Docs export step clunky and sketches a gdrive: prefix (with a tab for Sheets) in place of the earlier gdoc: idea. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VjkEiwfjfgydYqJ3iMEQkR --- docs/use-cases/project-reports.md | 67 ++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/docs/use-cases/project-reports.md b/docs/use-cases/project-reports.md index 316aef76..8639c297 100644 --- a/docs/use-cases/project-reports.md +++ b/docs/use-cases/project-reports.md @@ -187,6 +187,10 @@ To automate this, export through the Google Drive API, which can export a Doc as Markdown. Whichever way you export, the export tool must write the file, not the agent. +This is clunky: one export per doc, every month. It should be easy to teach LRV +a convention so a marker names the file directly, such as `gdrive:` for +a Doc, plus a tab for a Sheet. See [What LRV could add](#what-lrv-could-add). + ### GitHub issues This script writes an issue and its comments to @@ -295,6 +299,12 @@ For v1, use snapshots. ## 3. Check the report +**The PM doesn't type any of this.** They ask the agent to "check the November +report", and the [skill](#a-skill-for-the-agent-proposed) runs the commands. Or +a [Claude Code hook](#run-it-automatically-with-a-claude-code-hook) runs the +check every time the agent writes or edits a report, whether anyone asked or +not. The commands are here so you can see what runs. + Here is the agent's draft. Two of its claims are wrong: ```markdown @@ -520,6 +530,47 @@ linkml-reference-validator validate text-file "$1" \ --ref-group 1 --text-group 2 ``` +### Run it automatically with a Claude Code hook + +A Claude Code hook is a command that Claude Code itself runs at a fixed point, +such as after every file edit. The agent can't forget or skip it, as it might a +step in a skill. This hook checks a report each time the agent writes or edits +one. When the check fails, the hook exits with status 2, and Claude Code passes +the failures back to the agent to fix. In `.claude/settings.json`: + +```json +{ + "hooks": { + "PostToolUse": [ + { + "matcher": "Write|Edit", + "hooks": [ + { "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/scripts/check-report-hook.sh" } + ] + } + ] + } +} +``` + +```bash +#!/usr/bin/env bash +# scripts/check-report-hook.sh: check a report whenever the agent writes or edits one. +cd "${CLAUDE_PROJECT_DIR:-.}" +f=$(jq -r '.tool_input.file_path // empty') +case "$f" in + *.stakeholder.md) exit 0 ;; + */reports/*.md | reports/*.md) ;; + *) exit 0 ;; +esac +scripts/check-report.sh "$f" >&2 || exit 2 +``` + +Tried on the example files: it exits 2 with the failures for the draft and for +the file with malformed markers, and exits 0 for the fixed report and for files +outside `reports/`. A Stop hook, which runs when the agent tries to finish, can +act as a final gate in the same way. + ## 6. Review and publish ### Review table @@ -573,7 +624,9 @@ Other ways to publish, depending on the audience: ### A skill for the agent (Proposed) A skill puts the convention and the checks into one set of instructions the -agent follows every month. A draft: +agent follows every month. With it, the PM works in plain words ("draft the +November report", "check it", "make the stakeholder copy") and never types a +command. A draft: ```markdown --- @@ -619,10 +672,14 @@ These would make the convention less fragile. None of them exist yet. skipping them, accept markers that wrap across lines, and count coverage. It could accept the bracket marker, the [span form](#why-a-regex-and-what-else-is-possible), or both. -- **A `gdoc:` reference prefix.** It would look for an exported snapshot - in a configured directory first, so v1 `file:sources/gdrive/--*.md` - citations can become `gdoc:` without changing anything else, and - optionally fetch through the Drive API. +- **A `gdrive:` reference prefix**: `gdrive:` for a Doc, and something + like `gdrive:#` for one tab of a Sheet. It would look for an + exported snapshot in a configured directory first, so v1 + `file:sources/gdrive/--*.md` citations can switch over without other + changes. Otherwise it would fetch the text itself, as Markdown for a Doc and + as rows for a Sheet tab, which removes the manual export. It's a small source + plugin of the kind LRV already has for DOIs and URLs. Tab names would need a + form without spaces to fit in a marker. - **A `gh:owner/repo#234` reference prefix** that reads the body, comments, labels and state as one text. - **Several fields per JSON API source** From 6bd66865a97b70d5544ce61c555e6cdc992e803a Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 01:48:41 +0000 Subject: [PATCH 4/4] Add how-to: checking a markdown report against local sources A step-by-step guide for the PM use case that assumes every source is a local markdown file: lay out sources/, add [source: file:... "..."] markers, run validate text-file with the marker regex, fix each failure message, lint for markers the regex skips, wrap both in one script, review claims beside excerpts, and strip markers for the stakeholder copy. Ends with extensions (url:, Google Docs, GitHub issues, a built-in claim syntax). Every file and command was extracted from the page and run in a fresh folder; outputs shown are real. Linked from the How-To nav and from the project-reports use case. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VjkEiwfjfgydYqJ3iMEQkR --- docs/how-to/check-markdown-reports.md | 443 ++++++++++++++++++++++++++ docs/use-cases/project-reports.md | 3 + mkdocs.yml | 1 + 3 files changed, 447 insertions(+) create mode 100644 docs/how-to/check-markdown-reports.md diff --git a/docs/how-to/check-markdown-reports.md b/docs/how-to/check-markdown-reports.md new file mode 100644 index 00000000..2fd5f9a6 --- /dev/null +++ b/docs/how-to/check-markdown-reports.md @@ -0,0 +1,443 @@ +# Checking a Markdown Report Against Local Sources + +This guide shows how to check the factual claims in a markdown report, such as a +monthly status report, against markdown source files kept in the same project. +Each claim quotes the source it came from, and `validate text-file` confirms the +quote is really there. + +This is most useful when an agent drafts the report: an invented claim, a wrong +date or a quote from the wrong file fails the check before the report goes out. +For the background and the reasoning behind the conventions, see +[Fact-Checking Project Reports](../use-cases/project-reports.md). + +This guide assumes every source is a local markdown file. Other kinds of +source are covered under [Going further](#going-further). + +## Before you start + +You need: + +- LRV installed (`pip install linkml-reference-validator`), so that + `linkml-reference-validator --help` works +- Python 3, for the small helper script in step 5 +- A project folder, ideally a git repository, that you run every command from + +## 1. Put your sources in one folder + +Keep everything a report may cite under `sources/`, and the reports themselves +under `reports/`: + +```text +my-project/ +├── sources/ +│ ├── meetings/2026-11-18-weekly-sync.md +│ ├── issues/issue-234.md +│ └── metrics/2026-11-30-db-stats.md +├── reports/ +│ └── 2026-11-monthly.md +└── scripts/ +``` + +Any markdown or plain-text file works as a source: meeting notes, a decision +log, a design doc, a copy of an issue, or numbers written out by a script. For +example, `sources/meetings/2026-11-18-weekly-sync.md`: + +```markdown +# Weekly sync, 18 Nov 2026 + +Attendees: Ann, Bob, Carla + +## Loader + +- Ann can't start the MONDO loader until Bob merges the schema change for + synonym types. Bob expects to merge it by 25 Nov. +- Carla will review the loader PR once it exists. + +## Release + +- Agreed to slip the December release to 12 Dec. +``` + +`sources/issues/issue-234.md`: + +```markdown +# Load MONDO synonyms (#234) + +state: open +labels: loader, blocked +assignees: ann + +Load exact and related synonyms from MONDO into the synonym table. +``` + +`sources/metrics/2026-11-30-db-stats.md`: + +```markdown +# Database statistics, 30 Nov 2026 + +Diseases: 200 +Synonyms: 1,431 +Genes: 512 +``` + +Three rules for this folder: + +- **Never let the agent write or edit files in `sources/`.** If it does, the + agent is checking its claims against its own writing. Sources come from + people, or from export scripts. +- **Write numbers into a file with a script.** Don't let the agent count. A + claim like "200 diseases" should quote a file that a script generated. +- **Don't edit a source to make a check pass.** If a source is wrong, fix it + for its own sake and record why. + +LRV reads `file:` references straight from disk and never copies them into its +cache, so private notes stay in your project (see +[Using Local Files](use-local-files-and-urls.md#local-files-are-not-cached)). + +## 2. Add a source marker to each claim + +In the report, follow each factual claim with a marker giving the file and the +exact words the claim rests on: + +```text + [source: file: ""] +``` + +For example, `reports/2026-11-monthly.md`: + +```markdown +# Disease DB: November 2026 report + +## Highlights + +- The database now holds 200 diseases [source: file:sources/metrics/2026-11-30-db-stats.md "Diseases: 200"]. +- Issue 234 (loading MONDO synonyms) is blocked [source: file:sources/issues/issue-234.md "labels: loader, blocked"] because Ann is waiting for Bob to merge the synonym-type schema change [source: file:sources/meetings/2026-11-18-weekly-sync.md "Ann can't start the MONDO loader until Bob merges the schema change for synonym types"]. +- The December release moves to 12 Dec [source: file:sources/meetings/2026-11-18-weekly-sync.md "slip the December release to 12 Dec"]. + +## Risks + +- Bob expects to merge the schema change by 20 Nov [source: file:sources/meetings/2026-11-18-weekly-sync.md "Bob expects to merge it by 20 Nov"]. +- Carla has already approved the loader PR [source: file:sources/meetings/2026-11-18-weekly-sync.md "Carla approved the loader PR"]. +- Loader work may slip into January [assessment]. +``` + +Two of these claims are wrong. Step 3 finds them. + +Follow these rules when writing markers: + +- **Start the path with `file:`** and write it relative to the project root. +- **Copy the excerpt word for word**, in straight `"..."` or curly `“...”` + quotes. Differences in case, punctuation and spacing are ignored. You can use + `...` to skip words and `[...]` for an editorial note, as described in + [Editorial Conventions](../concepts/editorial-conventions.md). +- **Don't put a double quote inside an excerpt.** Quote around it, or use `...`. +- **Keep each marker on one line.** The check reads one line at a time, so + don't hard-wrap reports. With Prettier, set `proseWrap: never`. +- **Use one marker per fact.** A "because" sentence usually needs two. +- **Include the identifying words**: `"Diseases: 200"`, not `"200"`. +- **Quote numbers as the source writes them**: `"Synonyms: 1,431"`, not + `"1431"`. +- **Tag opinions and forecasts with `[assessment]`** instead of a source. The + check in step 5 then knows the statement was left unsourced on purpose. + +## 3. Run the check + +From the project root: + +```bash +linkml-reference-validator validate text-file reports/2026-11-monthly.md \ + --regex '\[source:[ \t]*(\S+)[ \t]+["“]([^"“”\n]+)["”]\]' \ + --ref-group 1 --text-group 2 +``` + +The regex finds each marker. Capture group 1 is the reference and group 2 is +the excerpt. The output (header trimmed): + +```text +Found 6 match(es) to validate + +Line 5: - The database now holds 200 diseases [source: file:sources/metrics/2026-11-30-d... + ✓ VALID: Supporting text validated successfully in file:sources/metrics/2026-11-30-db-stats.md + +Line 6: - Issue 234 (loading MONDO synonyms) is blocked [source: file:sources/issues/iss... + ✓ VALID: Supporting text validated successfully in file:sources/issues/issue-234.md + +Line 6: - Issue 234 (loading MONDO synonyms) is blocked [source: file:sources/issues/iss... + ✓ VALID: Supporting text validated successfully in file:sources/meetings/2026-11-18-weekly-sync.md + +Line 7: - The December release moves to 12 Dec [source: file:sources/meetings/2026-11-18... + ✓ VALID: Supporting text validated successfully in file:sources/meetings/2026-11-18-weekly-sync.md + +Line 11: - Bob expects to merge the schema change by 20 Nov [source: file:sources/meeting... + ✗ INVALID: Text part not found as substring: 'Bob expects to merge it by 20 Nov' + +Line 12: - Carla has already approved the loader PR [source: file:sources/meetings/2026-1... + ✗ INVALID: Text part not found as substring: 'Carla approved the loader PR' + +============================================================ +Validation Summary: + Total validations: 6 + Valid: 4 + Invalid: 2 + Errors: 2 + +✗ Some validations failed +``` + +The command exits with status 0 when every marker it found passes, and 1 +otherwise. + +## 4. Fix the failures + +Fix a failure by going back to the source, never by editing the excerpt until +it passes. + +| Message | Cause | What to do | +| --- | --- | --- | +| `Text part not found as substring: '...'` | The excerpt isn't in the file. | Reopen the source. Copy the real words into the excerpt, correct the claim to match, or delete the claim. | +| `Text part occurs only inside longer words: '...'` | The excerpt starts or ends partway through a word or number, for example `"Open issues: 1"` against `Open issues: 12`. | Quote whole words and whole numbers. | +| `Could not fetch reference: file:...`, after `File not found: ...` | The file doesn't exist at that path. | Fix the path, or run the command from the project root. If the cited file was never written, the claim has no source. | +| `Could not fetch reference: sources/...`, after `No source found for reference type: ...` | The path has no `file:` prefix. | Add `file:`. | +| `No matches found in file.` | The regex found no markers at all. | Check the marker syntax with step 5. This case exits with status 0, so it can look like a pass. | + +In the example, the meeting notes say Bob expects to merge "by 25 Nov", and +that Carla "will review the loader PR once it exists". So correct the date in +the claim and the excerpt, and delete the Carla claim. Then run the check +again: + +```text +Validation Summary: + Total validations: 5 + Valid: 5 + Invalid: 0 + Errors: 0 + +✓ All validations passed! +``` + +## 5. Catch markers the check skips + +The check only reports on markers its regex matches. A marker it doesn't match +is skipped without a warning, so a false claim can get through. These three are +all skipped: + +```markdown +- [Source: file:sources/meetings/2026-11-18-weekly-sync.md "Carla approved the loader PR"] +- [source: file:sources/issues/issue-234.md "the "synonym-type" schema change"] +- [source: file:sources/meetings/2026-11-18-weekly-sync.md "Carla + approved the loader PR"] +``` + +The first has a capital S, the second has a double quote inside the excerpt, +and the third is split across two lines. + +Save this script as `scripts/report_claims.py`. Its `lint` mode finds markers +the check would skip, and bullets that have neither a marker nor +`[assessment]`. Its other two modes are used in steps 7 and 8. + +```python +"""Lint, strip, or tabulate [source: ...] claim markers in a markdown report. + +Usage: python3 scripts/report_claims.py {lint|strip|review} REPORT.md +""" +import re +import sys + +# Keep this identical to the --regex passed to `validate text-file`. +CLAIM = re.compile(r'\[source:[ \t]*(\S+)[ \t]+["“]([^"“”\n]+)["”]\]') +LOOSE = re.compile(r"\[\s*sources?\b", re.IGNORECASE) +ASSESSMENT = "[assessment]" +BULLET = re.compile(r"^\s*(?:[-*+]|\d+\.)\s+") + + +def lint(text: str) -> list[str]: + """Report markers the regex will skip, and bullets with no marker.""" + problems = [] + for n, line in enumerate(text.splitlines(), start=1): + strict = len(CLAIM.findall(line)) + loose = len(LOOSE.findall(line)) + if loose > strict: + problems.append(f"line {n}: malformed [source: ...] marker (will not be checked)") + elif BULLET.match(line) and not strict and ASSESSMENT not in line: + problems.append(f"line {n}: bullet has no [source: ...] and no {ASSESSMENT}") + return problems + + +def strip(text: str) -> str: + """Remove every marker and [assessment] tag, leaving the prose untouched.""" + text = re.sub(r"[ \t]*" + CLAIM.pattern, "", text) + return re.sub(r"[ \t]*" + re.escape(ASSESSMENT), "", text) + + +def review(text: str) -> str: + """One table row per marker: the claim it follows, and what it rests on.""" + rows = ["| Line | Claim | Excerpt | Source |", "| --- | --- | --- | --- |"] + for n, line in enumerate(text.splitlines(), start=1): + start = 0 + for m in CLAIM.finditer(line): + claim = strip(BULLET.sub("", line[start : m.start()])).strip() + cells = [str(n), claim, m.group(2), f"`{m.group(1)}`"] + rows.append("| " + " | ".join(c.replace("|", "\\|") for c in cells) + " |") + start = m.end() + return "\n".join(rows) + "\n" + + +if __name__ == "__main__": + mode, path = sys.argv[1], sys.argv[2] + text = open(path, encoding="utf-8").read() + problems = lint(text) + for p in problems: + print(f"{path}: {p}", file=sys.stderr) + if problems: + sys.exit(1) + if mode == "strip": + sys.stdout.write(strip(text)) + elif mode == "review": + sys.stdout.write(review(text)) +``` + +Run it on a report with those three markers: + +```bash +python3 scripts/report_claims.py lint reports/skipped.md +``` + +```text +reports/skipped.md: line 1: malformed [source: ...] marker (will not be checked) +reports/skipped.md: line 2: malformed [source: ...] marker (will not be checked) +reports/skipped.md: line 3: malformed [source: ...] marker (will not be checked) +``` + +It exits with status 1 when it finds a problem. + +## 6. Run both checks with one command + +Save this as `scripts/check-report.sh` and make it executable +(`chmod +x scripts/check-report.sh`): + +```bash +#!/usr/bin/env bash +# Usage: scripts/check-report.sh reports/2026-11-monthly.md +set -euo pipefail +cd "$(dirname "$0")/.." +python3 scripts/report_claims.py lint "$1" +linkml-reference-validator validate text-file "$1" \ + --regex '\[source:[ \t]*(\S+)[ \t]+["“]([^"“”\n]+)["”]\]' \ + --ref-group 1 --text-group 2 +``` + +The script moves to the project root first, so the `file:` paths resolve +wherever it's called from. Give it a report path relative to the project root, +or an absolute one: + +```bash +scripts/check-report.sh reports/2026-11-monthly.md +``` + +It exits with status 0 only when the lint and the check both pass. + +## 7. Review each claim beside its excerpt + +A pass means every excerpt is in its source. It doesn't mean every claim +follows from its excerpt. This passes, because the excerpt is real: + +```markdown +- Bob will merge by 20 Nov [source: file:sources/meetings/2026-11-18-weekly-sync.md "Bob expects to merge it by 25 Nov"]. +``` + +So before sending, someone reads each claim beside its excerpt. The `review` +mode lists them: + +```bash +python3 scripts/report_claims.py review reports/2026-11-monthly.md +``` + +| Line | Claim | Excerpt | Source | +| --- | --- | --- | --- | +| 5 | The database now holds 200 diseases | Diseases: 200 | `file:sources/metrics/2026-11-30-db-stats.md` | +| 6 | Issue 234 (loading MONDO synonyms) is blocked | labels: loader, blocked | `file:sources/issues/issue-234.md` | +| 6 | because Ann is waiting for Bob to merge the synonym-type schema change | Ann can't start the MONDO loader until Bob merges the schema change for synonym types | `file:sources/meetings/2026-11-18-weekly-sync.md` | +| 7 | The December release moves to 12 Dec | slip the December release to 12 Dec | `file:sources/meetings/2026-11-18-weekly-sync.md` | +| 11 | Bob expects to merge the schema change by 25 Nov | Bob expects to merge it by 25 Nov | `file:sources/meetings/2026-11-18-weekly-sync.md` | + +This takes far less time than rereading the sources. + +## 8. Make the copy to send + +Strip the markers with the script: + +```bash +python3 scripts/report_claims.py strip reports/2026-11-monthly.md > reports/2026-11-monthly.stakeholder.md +``` + +```markdown +# Disease DB: November 2026 report + +## Highlights + +- The database now holds 200 diseases. +- Issue 234 (loading MONDO synonyms) is blocked because Ann is waiting for Bob to merge the synonym-type schema change. +- The December release moves to 12 Dec. + +## Risks + +- Bob expects to merge the schema change by 25 Nov. +- Loader work may slip into January. +``` + +Only the markers are removed, so the copy says exactly what was checked. Don't +ask an agent to tidy or reword it: that can put back the kind of claim you just +removed. To change the wording, edit the checked report, run steps 6 to 8 +again, and strip it again. + +## Let the agent run the steps + +Nobody needs to remember these commands. + +- **A skill** tells the agent to add markers while drafting, run + `scripts/check-report.sh`, fix failures from the sources, show the review + table, and strip the markers only after the check passes. The PM just asks it + to "check the November report". See the + [draft skill](../use-cases/project-reports.md#a-skill-for-the-agent-proposed). +- **A Claude Code hook** runs `scripts/check-report.sh` every time the agent + writes or edits a file in `reports/`, and hands any failures back to the + agent. The agent can't skip a hook. See + [Run it automatically with a Claude Code hook](../use-cases/project-reports.md#run-it-automatically-with-a-claude-code-hook). + +## Going further + +Some of these work today and some are proposals. All of them reduce the manual +work of keeping sources in `sources/`. + +**Web pages (works today).** A marker can cite a public page with `url:`, for +example `[source: url:https://example.com/pricing "Team plan includes 10 seats"]`. +LRV fetches the page and caches it in `cache_dir`. See +[Validating URLs](validate-urls.md). + +**Google Docs (clunky today).** Download a doc with **File → Download → +Markdown (.md)** into `sources/`, named after the document ID in its URL, and +cite that file. Exporting every doc every month is tedious. A proposed +`gdrive:` prefix, with a tab name for a Sheet, would let a marker name +the document directly and have LRV fetch it. + +**GitHub issues (partly possible today).** Save an issue as markdown with a +`gh api` script, as shown in +[Fact-Checking Project Reports](../use-cases/project-reports.md#github-issues). +Or define a `GHISSUE` [JSON API source](add-reference-source.md) to fetch an +issue live, which reads only its title and body. A proposed +`gh:owner/repo#234` prefix would read the body, comments, labels and state +together. + +**A built-in claim syntax (proposed).** A command such as `validate markdown` +could recognize the marker itself, so no one writes a regex. It could also +report malformed markers instead of skipping them, accept markers that wrap +across lines, and perhaps accept an HTML span form. See +[Why a regex, and what else is possible](../use-cases/project-reports.md#why-a-regex-and-what-else-is-possible). + +## See also + +- [Fact-Checking Project Reports](../use-cases/project-reports.md): the use + case and the reasoning behind these conventions +- [Using Local Files and URLs](use-local-files-and-urls.md) +- [Editorial Conventions](../concepts/editorial-conventions.md) +- [`validate text-file`](../reference/cli.md#validate-text-file) diff --git a/docs/use-cases/project-reports.md b/docs/use-cases/project-reports.md index 8639c297..8dc7c79a 100644 --- a/docs/use-cases/project-reports.md +++ b/docs/use-cases/project-reports.md @@ -12,6 +12,9 @@ output shown comes from running the current CLI on the files shown. Parts that LRV doesn't provide yet, such as the helper script and the skill, are marked **Proposed**. +For step-by-step instructions that use only local markdown files, see +[Checking a Markdown Report Against Local Sources](../how-to/check-markdown-reports.md). + ## The problem Each month the PM asks an agent to read the meeting notes, the shared Google diff --git a/mkdocs.yml b/mkdocs.yml index 7c23d36a..d4ec7846 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -42,6 +42,7 @@ nav: - Validating Wikipedia Articles: how-to/validate-wikipedia.md - Validating Reference Titles: how-to/validate-titles.md - Using Local Files and URLs: how-to/use-local-files-and-urls.md + - Checking Markdown Reports: how-to/check-markdown-reports.md - Fetching Full Text and PDFs: how-to/fetch-full-text-and-pdfs.md - Using Signed Excerpts: how-to/use-signed-excerpts.md - Exporting a Cache to Zotero: how-to/export-cache-to-zotero.md