fact-drift

agent
Security Audit
Fail
Health Warn
  • License — License: MIT
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Low visibility — Only 5 GitHub stars
Code Fail
  • exec() — Shell command execution in .github/workflows/validate-examples.yml
  • fs module — File system access in .github/workflows/validate-examples.yml
Permissions Pass
  • Permissions — No dangerous permissions requested

No AI report is available for this listing yet.

SUMMARY

A Claude Code skill that watches the source pages behind the facts you cite (prices, versions, limits, rules, deadlines) and updates every file that has gone out of date, once you approve.

README.md

fact-drift: keep the facts you cite current.

Claude Code skill License: MIT

fact-drift

A Claude Code skill (run it as /fact-drift) that catches when a fact you cite has changed at the source, verifies your local citation still matches the baseline, shows you what is now out of date, and fixes scoped files once you approve.

Most page monitors stop at "this page changed." fact-drift reads the actual value, checks the files where you cite it, and updates approved stale citations after you sign off.

The Problem

Your content quotes numbers from other people's websites: a government limit, a quota, a price, a deadline. Those numbers change, and nobody tells you. The source page updates, your article does not, and you find out when a reader does. Tools that watch pages can say "this page changed," but they cannot tell you the number went from 60 to 80, or which of your files now needs fixing.

Use cases

Anywhere your content repeats a fact that lives on a page you do not control:

  • Help guides and knowledge bases that quote government rules, fees, or deadlines, like visa, tax, or benefits guides. When a threshold changes, the skill flags the guide and offers to fix it.
  • Developer docs that pin versions ("requires Node 20+", "tested on Python 3.12"). Keep install and compatibility notes in step with upstream releases.
  • Pricing and comparison pages that cite a competitor's price or plan limits. When they change their pricing, your "X vs Y" page stops being quietly wrong.
  • Compliance and policy pages that track regulations: tax rates, minimum wage, filing deadlines, reporting limits.
  • Affiliate and review roundups that cite specs, prices, or ratings from product pages, the kind that goes stale the moment a product changes.
  • API and integration docs that reference a third party's rate limits, endpoints, or end-of-life dates.

Demo

A run that catches a change looks like this:

# fact-drift snapshot, 2026-05-28
| Target                   | Status | Current | Baseline | Source        |
| python-latest-stable     | OK     | 3.14.5  | 3.14.5   | python.org    |
| node-latest-stable       | DRIFT  | 26.1.0  | 24.9.0   | nodejs.org    |
| kubernetes-latest-stable | OK     | 1.36.1  | 1.36.1   | kubernetes.io |

DRIFT  node-latest-stable  24.9.0 -> 26.1.0
Found "24.9.0" in 2 files:
  docs/install.md:12
  README.md:40
Update both to "26.1.0"? [y/n]

Quick Start

Install as a plugin (recommended). From your shell:

claude plugin marketplace add hwajongpark/fact-drift
claude plugin install fact-drift@fact-drift

Or inside Claude Code:

/plugin marketplace add hwajongpark/fact-drift
/plugin install fact-drift@fact-drift

The plugin's skill runs as /fact-drift. Its full name is /fact-drift:fact-drift; use that if another skill or command already takes /fact-drift.

Or install it as a standalone skill:

git clone https://github.com/hwajongpark/fact-drift ~/fact-drift
mkdir -p ~/.claude/skills
cp -r ~/fact-drift/skills/fact-drift ~/.claude/skills/fact-drift

Updating from 0.2.0 or earlier as a standalone skill? Delete the old ~/.claude/commands/fact-drift.md. The skill now takes the flags itself.

The example configs and validate-config.js live at the repo root, not inside your project. The shell commands below assume a clone at ~/fact-drift (the standalone install above already made one; plugin users can make one with the git clone line, it is small). With the plugin installed, the same files sit in the plugin's install directory, two levels above the skill's SKILL.md, so the skill validates your config before each run.

Then, from your project root, point it at your sources and run it:

# Copy the example config into your project, then add your targets
cp ~/fact-drift/examples/rules.config.example.json ./rules.config.json

# Optional: sanity-check the config before the first run
node ~/fact-drift/validate-config.js rules.config.json
# In Claude Code: capture a baseline (first run)
/fact-drift --update-baseline

# Later, check for drift
/fact-drift

Flags (they combine, for example --update-baseline --target node-latest-stable):

Flag What it does
(none) Check every due target, write a snapshot, offer to apply fixes
--ci Same checks, never edits content, writes fact-drift-snapshots/ci-status.json for a CI step to fail on
--update-baseline Capture or refresh baselines from readable source quotes (asks before replacing a different value)
--apply Check, then show scoped edits for each DRIFT and apply the ones you approve
--all Ignore cadence; check every target
--target <id> Restrict the run to one target id, ignoring its cadence

First run

  1. Run /fact-drift --update-baseline once. Every readable target gets a baseline in fact-drift-baseline/<id>.json.
  2. Inspect the baselines. Each one carries the value, the exact source quote, and where on the page it was found. If a value or quote looks wrong, fix the target's extract instruction and refresh just that one with /fact-drift --update-baseline --target <id>.
  3. Commit fact-drift-baseline/. The baseline is the memory the next run compares against. A CI runner starts from your repo, so without a committed baseline every target reports NEW on every scheduled run and the check never goes green.
  4. Run /fact-drift. With baselines in place and your citation files matching, every target should land OK.

How It Works

You give it a list. Each item is one fact: the web page it lives on, a plain-English note for what to pull ("find the latest version number"), and the files where you cite it.

When it runs, it opens each page, extracts the value with an exact source quote, compares the value to what it saw last time, and checks that your configured citation files still contain the expected value. If something changed, it shows you the old value, the new value, the source quote, and every scoped file that still has the old one. You check that list, and if it looks right, it updates the approved matches. Nothing changes until you say yes.

Under the hood it checks all the pages at once, so a long list still finishes fast.

Configuration

One entry per fact. The included examples/rules.config.example.json tracks the latest stable versions of Python, Node.js, and Kubernetes, each read from the project's own release page, so it runs out of the box.

{
  "targets": [
    {
      "id": "python-latest-stable",
      "name": "Python latest stable release",
      "url": "https://www.python.org/downloads/",
      "extract": "Find the latest stable Python release offered on the downloads page (for example 3.14.5). Return only the version string.",
      "citation_files": ["docs/requirements.md"],
      "notes": "Our setup docs pin a minimum Python version; bump them when a new stable lands."
    }
  ]
}

name and notes are optional labels for your own reports. Three more optional per-target fields:

  • "cadence": "monthly" | "quarterly" | "semiannual": how often the target is worth re-checking. Omit it and the target is checked on every run. A not-yet-due target is reported as SKIPPED and not fetched; /fact-drift --all checks everything regardless. The last check date lives in the target's baseline file, and a target only goes back to sleep when it comes back OK, so an unresolved drift keeps re-appearing until you deal with it.
  • "manual_check": true: for sources automated fetch can never read reliably (bot walls that block datacenter IPs, geo blocks, broken TLS, login-only portals). The target still gets attempted, but a failure reports MANUAL_CHECK instead of ERROR, never fails a scheduled run, and is listed in every report as a standing reminder to verify the source in a browser. Without this, one permanently unreachable page keeps your scheduled check red forever and you stop trusting it.
  • "listing_url": see "A pinned announcement can be quietly superseded" under Design Decisions.

Validate any config with the bundled dependency-free checker (path assumes the clone from Quick Start):

node ~/fact-drift/validate-config.js rules.config.json

It checks required fields and types, rejects unknown keys (so a typo like cadance or manual-check fails instead of being silently ignored; prefix a key with $, like $comment, to keep notes), requires ids that are safe as filenames (^[a-z0-9][a-z0-9._-]*$, unique even ignoring case), rejects absolute paths and .. segments in citation paths, and checks that listing_url is on the same site as url. Exit codes: 0 valid, 1 invalid, 2 usage or file read error.

Want a harder example? examples/advanced-korea-gov.config.json tracks government pages. Some of those need a full browser, so it also shows manual_check and cadence in action.

Design Decisions

Plain words, not code, to find the value. I tell it what to look for in plain English, like "find the latest version number." The other option is to point at an exact spot in the page's code. That is faster, but it breaks the moment someone redesigns the page, even when the number is still sitting right there. Plain words keep working through a redesign. Worth the small extra cost.

Point at the owner of the fact. Track the page that owns the fact, not an aggregator that repeats it. A wiki, a news article, or a roundup post is someone else's citation of the number, and it can lag or misquote; the issuing project's release page, the agency's own announcement, the vendor's own pricing page is where the number changes first and cannot be wrong about itself. The demo configs all point at owning sources for exactly this reason.

A pinned announcement can be quietly superseded. Some facts live in dated announcements: this year's quota, this cycle's fee schedule. The trap is that the old announcement page never changes, so a plain check reports OK forever while a newer announcement has replaced the number. For targets like that, set listing_url to the board or news index the announcements are posted on; the checker makes one extra same-site fetch to confirm your pinned page is still the newest, and reports DRIFT when it has been superseded.

It remembers the last value, so it can spot a change. To know a number changed, you have to know what it was before. The first run writes down each value, where it found it, and the exact source quote. Every run after that compares now against last time. No memory, no way to catch a change. In CI, commit fact-drift-baseline/ or restore it before running the check.

It checks your content even when the source has not changed. A source can still match the baseline while your docs drifted by hand. OK means the upstream value matches the baseline and your configured citation scope still contains that value.

It does the fixing, you do the deciding. The point is not to hand you a to-do list, it is to do the boring work. When a value changes, it finds stale matches in the citation scope, prepares the edits, and applies them once you approve. It does the finding and the typing; you make the call.

It always shows the plan before it touches anything. Nothing changes until you have seen exactly what will change. A number like "60" can mean five different things across your files, and you are the one who knows which should actually update. So it searches the configured citation scope, shows you every match first, and lets you drop the ones that should stay.

It runs on the Claude Code you already have. Run locally, it uses your existing Claude Code plan, with no separate API key and no extra tool to pay for. A scheduled CI run is different: Claude Code runs headless on the runner with an API key or OAuth token, and that usage is billed to the account behind the key. The catch: it reads pages the simple way, so pages that need a full browser (heavy JavaScript, logins) will not work, and it says so plainly. Most pages are fine.

The trick is not the check, it is everything around it. Honestly, underneath this is just "go read a page," something you could do by hand. What makes it useful is the rest: a fixed list so you never forget a number, a saved history so it can spot changes, scoped edits after approval, and a check you can put on a schedule so drift gets caught without you remembering. It turns "remember to check this and fix it where cited" into a single yes.

Scheduling

fact-drift is a command, so you schedule it the way you schedule any command: point a timer at it. A weekly GitHub Action that runs the check and fails the job if any target is NEW, DRIFT, ERROR, or CONTENT_MISMATCH (MANUAL_CHECK and SKIPPED never fail it). It needs an ANTHROPIC_API_KEY secret (or an OAuth token, per Claude Code's headless docs), and each run is billed to that account:

# .github/workflows/fact-drift.yml
name: fact-drift
on:
  schedule:
    - cron: "0 8 * * 1"   # 08:00 UTC every Monday
  workflow_dispatch: {}
permissions:
  contents: write   # only for the optional baseline commit step; use "read" if you drop it
jobs:
  check:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@v7
      # Claude Code needs Node.js 22 or newer.
      - uses: actions/setup-node@v7
        with:
          node-version: 24
      # The runner starts with no plugins installed. Clone fact-drift and load it
      # with --plugin-dir below.
      - name: Get fact-drift
        run: git clone --depth 1 https://github.com/hwajongpark/fact-drift /tmp/fact-drift
      - name: Validate the config
        run: node /tmp/fact-drift/validate-config.js rules.config.json
      # Clear any stale verdict and record when this run started, so the check
      # below can prove ci-status.json was written by this run.
      - name: Prepare
        run: |
          rm -f fact-drift-snapshots/ci-status.json
          echo "RUN_STARTED_AT=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_ENV"
      # Requires committed fact-drift-baseline/ files, or a previous step that restores them.
      # The permissions flag is fine here because the runner is disposable.
      # To cap spend per run, add --max-budget-usd with an amount you choose.
      - name: Run the check
        env:
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
          # Or authenticate with an OAuth token from `claude setup-token` instead:
          # CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
        run: >-
          npx -y @anthropic-ai/claude-code
          --plugin-dir /tmp/fact-drift
          --dangerously-skip-permissions
          --max-turns 60
          -p "/fact-drift:fact-drift --ci"
      # `claude -p` exits 0 whenever the session completes, whether or not the check
      # found drift, so the verdict cannot ride on the agent's exit code. Instead,
      # --ci ends by writing a machine-readable status file, and this plain shell
      # step fails the job from that data. It does not trust the agent's own
      # "failing" list: it recomputes it from "statuses", and it fails closed if the
      # file is missing, stale, or leaves out any configured target.
      - name: Fail on drift
        run: |
          set -euo pipefail
          f=fact-drift-snapshots/ci-status.json
          test -f "$f" || { echo "No $f: the run did not finish" >&2; exit 1; }
          jq -e --arg t "$RUN_STARTED_AT" '(.generated_at | type) == "string" and .generated_at >= $t' "$f" >/dev/null \
            || { echo "$f is not from this run (generated_at older than $RUN_STARTED_AT)" >&2; exit 1; }
          missing=$(jq -r --slurpfile s "$f" '.targets[].id as $id | select(($s[0].statuses // {}) | has($id) | not) | $id' rules.config.json)
          if [ -n "$missing" ]; then echo "Targets missing from statuses: $missing" >&2; exit 1; fi
          unknown=$(jq -r '.statuses | to_entries[] | select(.value | IN("OK","DRIFT","NEW","ERROR","CONTENT_MISMATCH","MANUAL_CHECK","SKIPPED") | not) | "\(.key)=\(.value)"' "$f")
          if [ -n "$unknown" ]; then echo "Unknown statuses: $unknown" >&2; exit 1; fi
          failing=$(jq -r '.statuses | to_entries[] | select(.value | IN("NEW","DRIFT","ERROR","CONTENT_MISMATCH")) | "\(.key)=\(.value)"' "$f")
          if [ -n "$failing" ]; then echo "Not OK:"; echo "$failing"; exit 1; fi
          echo "All targets OK"
      # Optional: keep cadence state between runs. --ci refreshes last_checked_at on
      # targets that landed OK, but the runner is thrown away, so without this step
      # every cadence target is due on every run. Delete this step (and set
      # permissions to "read") if you prefer that, or upload and restore the
      # directory as an artifact or cache instead.
      - name: Commit refreshed baselines
        if: success()
        run: |
          git config user.name "github-actions[bot]"
          git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
          [ -d fact-drift-baseline ] || exit 0
          git add fact-drift-baseline
          git diff --cached --quiet || { git commit -m "chore: refresh fact-drift last_checked_at"; git push; }

Four things to know before you rely on it:

  • Schedule the check, approve the fixes. fact-drift never edits a file without showing you the plan first, so an unattended run detects drift and fails/reports it; you run --apply to approve the edits. Fixing a target hands-off is a choice you make per target, not the default.
  • Keep the baseline available to CI. If CI starts without fact-drift-baseline/, targets are NEW, not verified. Commit the baseline directory or restore it before the check (see First run).
  • Cadence state only persists if CI saves it. --ci never edits your content and never changes a baseline's value, but it does refresh last_checked_at on targets that come back OK. That refresh is lost with the runner unless the workflow commits fact-drift-baseline/ back (the optional last step above) or uploads and restores it.
  • Only pages that load as plain text are good schedule targets. A page behind heavy JavaScript or a login returns ERROR on the cheap path. For a page that will never fetch cleanly from a runner (bot wall, geo block, broken certificate), mark it manual_check: true: it stops failing the schedule but stays in every report as a reminder to re-check it by hand, or run a real browser for it (a separate path).

What It Does Not Do

  • It does not change anything without your approval. You see every edit before it touches a file, and you can drop any of them.
  • It does not handle pages behind a login, or pages that need heavy JavaScript to load. If a page will not load as plain text, that target reports ERROR (or MANUAL_CHECK if you opted the target in) and needs a real browser, which is a separate path.
  • It does not read PDFs. A fact that lives inside a PDF needs a different source page that carries the same number, or a manual_check: true target as a standing reminder to check the PDF by hand.
  • It does not commit to git. It edits the files and updates the baseline; committing is yours.
  • It does not treat an unreadable page as a valid baseline. Unreadable and not-found results fail closed.

Contributing

Contributions are welcome. Bug reports (a page it misreads) and useful real-world target configs help most. If you have a config for a public source worth tracking, a pull request adding it alongside examples/advanced-korea-gov.config.json gives the next person a head start. Please run node validate-config.js over any config you add, and node test/validate-config.test.js if you change the validator (add a fixture under examples/invalid/ with a $expect message for any new rule). If you change the skill or the manifests, also run claude plugin validate .. CI runs all three on every push and pull request.

License

MIT

Reviews (0)

No results found