`/refresh-trails` starts a runbook an agent follows to check every record against the pages it cites, re-check the trails that were left out, search for missing trails and routes, update tracks and emblems, have every proposal reviewed independently, and apply what the owner accepts. `/refresh-trails light` verifies and re-checks only. - Runbook, shared rules, eight worker briefs and the staged proposal format in `.claude/skills/refresh-trails/`. - `tools/refresh.py`: preflight, slices, a polite link check, collect and apply, with tests. Workers stage proposals in `refresh/<date>/`, which git ignores; only the apply step edits records. - `CONTRIBUTING.md` describes the refresh. No trail record and nothing on the site changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
56 lines
11 KiB
Markdown
56 lines
11 KiB
Markdown
---
|
|
name: refresh-trails
|
|
description: Run the monthly refresh of the trail dataset. Checks every record against the pages it cites, re-checks the trails that were left out, searches for missing trails and routes, updates tracks and emblems, has everything reviewed independently, and applies what the owner accepts. Use when the owner asks to refresh or update all trails, or to verify the database against current published data. Pass `light` for the cheap version (verify and re-check only).
|
|
argument-hint: "[light]"
|
|
disable-model-invocation: true
|
|
---
|
|
|
|
# Refresh the trail dataset
|
|
|
|
This is the runbook for the orchestrating agent. Once a month the whole dataset is checked against what its holders and authors publish now, and the web is searched for trails that should be in it. The work is done by many workers at once, each given one slice. They never edit the repository. They stage proposals in a directory that git ignores, a reviewer who did not write them checks them against the pages, the owner rules on what is borderline, and one worker applies what was accepted. You plan, dispatch, check and decide when to stop for the owner.
|
|
|
|
Read these first, once: `rules.md` (what every worker must follow), `proposal-format.md` (the staged format that `tools/refresh.py` collects and applies), and the briefs in `briefs/` as you reach each phase. The mechanical steps are in `tools/refresh.py`; `python3 tools/refresh.py --help` lists them.
|
|
|
|
## How to dispatch
|
|
|
|
A worker starts with nothing from this session. Give it one line and let the brief carry the rest: "Read `.claude/skills/refresh-trails/briefs/<brief>.md` and follow it. Staging directory: `<absolute path>`. Worker name: `<name>`. Slice: `<absolute path of the slice file>`." Use the most capable model you have for searching, verifying and reviewing: those fail quietly when done fast, because a cheap worker opens one page, sees nothing wrong and gives up. Cheap fast models are fine for `slices`, `links` and `collect`, which need no model at all, and for the mechanical parts of `apply`. Review is done by a different model family from the one that wrote what it reviews. Send independent work out in one message so it runs at the same time; two workers that would both use Overpass do not run at the same time. Do not poll: wait for each to finish.
|
|
|
|
## Modes
|
|
|
|
- **Full**: phases 0 to 9. Worth it about quarterly, after a big addition, when many records were written in a hurry, or when a visitor or a holder reports that something is stale.
|
|
- **Light** (`/refresh-trails light`): phases 0, 1 and 2, with `slices --since 30` so that only records not verified in the last 30 days are taken. It finds drift and dead links cheaply. Run it in the months between full runs. Its changes still go through phases 6, 7 and 8.
|
|
|
|
## Phases
|
|
|
|
**0. Preflight.** Run `python3 tools/refresh.py preflight`. It checks that the tree is clean (work on a branch, never directly on `main`), runs the validator and the tools tests, and creates `refresh/<today>/`. Then `python3 tools/refresh.py links` fetches every address in every record and in `left-out.toml` once, politely, into `links.csv` (it takes a while: it waits between requests to one site; start it in the background). *Check yourself:* preflight ends `preflight OK`; `links.csv` exists; you know which hosts refused. Refusals are never worked around, and they go to the owner in phase 7 if a record rests on a refusing site.
|
|
|
|
**1. Verify every record.** `python3 tools/refresh.py slices --n 6` (about 35 records each; `--since DAYS` keeps only records whose `hike.checked` is older than that). Dispatch one `briefs/verify-records.md` worker per `trails-NN` slice. Give each worker the rows of `links.csv` for its ids by telling it where the file is. *Check yourself:* `python3 tools/refresh.py collect` shows no problems; every id has a report row; ids marked `not-reached` go to a new worker; the warnings that a `verified` record's cited pages were not all opened are sent back to a worker, because a verification that skipped the cited pages is not one.
|
|
|
|
**2. Re-check what was left out.** The same `slices` run made `left-out-NN` slices. Dispatch `briefs/recheck-left-out.md` workers, at the same time as phase 1. Entries with reason `waiting` are the ones most likely to have changed: they are checked against their `waiting_for`. *Check yourself:* every entry has a row; read each `candidate` the workers recommend, because it may become a record.
|
|
|
|
**3. Search for missing trails and routes.** Split the continent into regions of five to eight states or provinces (for example US West, Mountain West, Central, Northeast, Southeast, Canada West, Canada East) and dispatch a `briefs/find-missing-trails.md` worker for each. Dispatch one or two `briefs/find-routes.md` workers for authors' routes. Run it at the same time as phases 1 and 2. *Check yourself:* for every region that reports `not-found`, or finds fewer than two candidates, send a second worker of a different model family, the same brief, with the first worker's list of places searched, and tell it that a quiet first pass is a reason to look harder. A search that finds nothing is common and is not proof. Every `not-found` row must say where it looked; `collect` refuses one that does not.
|
|
|
|
**4. Tracks.** Gather the ids of official trails with no track (`source.line_file = ""` and no `kind = "route"`) and of records whose track source may have changed (the source's `discovery` field says how to tell). Dispatch one `briefs/tracks.md` worker for the work that uses Overpass, one request at a time, and a second for holder data and licence reading that uses no Overpass. These are existing records. A new record from phase 3 has no track yet and cannot be given one before it exists: after phase 8 has applied it, run this phase again for the new ids, review that, and apply once more. *Check yourself:* a track more than 15% off the published length has a `length_gap_note` that explains it with facts; a route's author's terms allowing it are quoted before any route track is staged; the licence on each is what the page says.
|
|
|
|
**5. Emblems.** `grep -l 'status = "logo-not-found"' */trail.toml` lists records whose emblem was not found. Write their ids into slice files in the staging directory (about 10 to 20 each) and dispatch `briefs/emblems.md` workers. *Check yourself:* open three staged emblem files yourself or have the reviewer do it: one emblem, whole, not an organisation's lockup.
|
|
|
|
**6. Independent review.** When the workers of phases 1 to 5 are done, run `collect`. Every `change`, `declined`, `new-record`, `left-out-add` and `left-out-remove` proposal goes to a `briefs/review.md` reviewer, with about one in ten of the `verified` records as a check on the verifiers. Split the list across reviewers by worker or by region, so none reviews its own area's writer. This is not optional: in the first run a reviewer found must-fix defects in about one new record in three. Workers whose proposals are rejected revise them and the reviewer reads the revision. Run `collect` again after each round. *Check yourself:* every proposal has a decision; the `must fix` list is empty or fixed; read the rejections yourself, because a reviewer that rejects everything is as useless as one that accepts everything.
|
|
|
|
**7. Stop: the owner decides.** Put one list in front of the owner, with your recommendation on each item: borderline candidates (trails near the floor, partly built, networks, routes with thin author pages), the trails 40 to 50 miles that are well known, every `hold`, every record a verifier found closed, merged or no longer walkable (workers never propose removing one), every `declined` request and every change a holder might dispute, the changes that touch a length, an end or a track licence, and any track that is more than 15% off without a settled explanation. Decisions about what belongs are the owner's: the inclusion rule is in `README.md`, and the reasons already given are in `left-out.toml`. The owner's answers go into `<staging>/owner.csv`. An approved candidate is written up by a `briefs/find-missing-trails.md` worker, reviewed as in phase 6, and joins the list. Nothing is applied before this stop.
|
|
|
|
**8. Apply and rebuild.** Dispatch one `briefs/apply.md` worker, and only one. It applies the accepted proposals by targeted edits with their history entries, runs `tools/elevation.py` for new tracks, adds the `SOURCES.md` rows, rebuilds the shared files with `tools/build_index.py`, and runs the validator, `tools/check_history.py`, `python3 -m unittest discover tools/tests` and the web tests, and it writes the `CHANGELOG.md` entry. *Check yourself:* `git diff --stat` matches the accepted list; read the hunks yourself for anything that touches a length, an end, a licence or a track; read the changelog entry and fix its wording; rerun the validator and the history check with your own hands; no `trail.toml` outside the accepted ids changed. A change to a fact with no history entry, or a ship with no changelog entry in the same commit, is not done.
|
|
|
|
**9. Build, check, ship, follow up.** Build the site (`python3 web/build.py --out _site`) and read the built HTML for three trails that changed, one new trail, the "Considered and left out" page and the home page counts. Then commit on the branch, with the changelog entry in the same commit. Pushing to `main` starts the deploy, which publishes to the public. Ship only if the owner has said, in this run or as a standing instruction, that a finished refresh may go out; otherwise show them the branch and stop. Afterwards, go through the open issues on the project's tracker (https://github.com/swaits/longhikes/issues): answer those the refresh settled, warmly and without making the person do more work. A holder's or author's own statement in an issue is enough to rely on, quoted with its address.
|
|
|
|
## Rules for you, with the reasons
|
|
|
|
- Staging is `refresh/<date>/` at the top of the checkout, listed in `.gitignore`. It is inside the checkout so that a fresh session finds it by a relative path and every command defaults to the newest one, and ignored so nothing staged can reach a commit. A path outside the checkout would have to be told to every worker each time.
|
|
- Workers do not edit the repository, because many at once on one checkout is how work gets lost. Only phase 8 writes records.
|
|
- Every brief that may start a process says never to stop one by name or pattern. A worker once killed the owner's browser that way.
|
|
- A site that refuses automated reads is never worked around. The refusal is recorded and another source used. Requests use a plain User-Agent and carry no personal or project details.
|
|
- Overpass takes one request at a time from one worker, or it stops answering for everyone.
|
|
- The holder's or author's current page wins any disagreement, and a request that loses is recorded as `declined` in the history.
|
|
- A fact that changes needs a `[[history]]` entry and every ship needs a `CHANGELOG.md` entry in the same commit, so that the reason for a change can be found later.
|
|
- Workers propose; the owner decides what belongs.
|
|
- The staged format and every command are in `proposal-format.md` and `tools/refresh.py`. When a worker's output does not collect cleanly, send it back, rather than fixing it by hand.
|