Proactive and schedule-driven; the ledger is what makes the rotation fair
across runs.
Step 0 — Orient and resume
bash
# Read the durable ledger first — which pages were refreshed, when, and why.cat .taskstation/memory/content-refresh-log.md 2>/dev/null || echo "(no ledger yet)"# Check any open refresh PR from a prior run.gh pr list --repo {{target_repo}} --state open \ --search 'in:title "content refresh" OR label:content-refresh' \ --json number,title,headRefName,statusCheckRollup,url
If a prior PR is still open and unreviewed, note it and don't duplicate its
pages in this run's batch.
Step 1 — Freshen the repo
bash
if [ -d /workspace/repo/.git ]; then cd /workspace/repo && git fetch origin && git checkout main && git reset --hard origin/mainelse git clone --filter=blob:none https://github.com/{{target_repo}}.git /workspace/repo cd /workspace/repofi
Never start a refresh on a stale base.
Step 2 — Pull decay signals from Search Console
Through the scoped Search Console connector, pull impressions and clicks per
URL for {{site_url}} over the trailing 28 days versus the 28 days before
that, restricted to pages under {{content_path}}. Compute, per page:
Decay = percentage drop in impressions and clicks between the two
windows.
Weight = decay severity × the page's absolute traffic in the trailing
window (a big page with a small decline still outranks a tiny page in free
fall).
Rank pages by weight. This is the raw candidate list before rotation.
Step 3 — Rotate using the ledger
Read each candidate's last-refreshed date from the ledger (never-refreshed
pages count as oldest). Re-rank candidates by combining decay weight with
staleness of coverage: a page refreshed in the last two weeks drops several
places even if it's still the sharpest decliner; a page that's never been
touched moves up. Take the top 3–5 pages as this week's batch — enough to make
progress, small enough to keep the PR reviewable.
Step 4 — Isolated refresh branch
bash
cd /workspace/repoBRANCH="content-refresh/$(date +%Y-W%V)"git checkout -b "$BRANCH" origin/main
One branch per weekly run.
Step 5 — Refresh each page in the batch
For each page:
Open the source file under {{content_path}}.
Copy — rewrite sentences that read as dated (old product names, retired
features, superseded positioning) to match current reality.
Stats — find numbers, dates, and claims that have aged out (customer
counts, benchmark years, "as of" figures) and update them from the current
source of truth; if no current figure is available, soften the claim rather
than leave a stale one.
Internal links — grep the repo for the page's outbound internal links;
repoint any that reference a renamed, merged, or retired page to its
current location.
Leave everything else on the page untouched — this is a refresh, not a
rewrite.
bash
cd /workspace/repogrep -rn "old-slug-or-renamed-page" {{content_path}} 2>/dev/null
cd /workspace/repogit push origin "$BRANCH"gh pr create --repo {{target_repo}} --base main --head "$BRANCH" \ --title "content: refresh $(date +%Y-W%V) batch" \ --label content-refresh \ --body "Generated by the content-refresh agent. Pages selected from SearchConsole decay signals for {{site_url}}, rotated against pages already coveredrecently. Per page: the decay signal that triggered inclusion and what wasrefreshed (copy / stats / internal links). This PR is never merged by theagent — a human reviews and decides what ships."
Step 8 — Update the ledger
Append a dated entry to .taskstation/memory/content-refresh-log.md (see
<ledger-format>).