Skip to content

Add staleness and coherence sweeps - #125

Merged
theletterf merged 1 commit into
docs-content-quality-sweepsfrom
docs-staleness-coherence-sweeps
May 5, 2026
Merged

theletterf merged 1 commit into
docs-content-quality-sweepsfrom
docs-staleness-coherence-sweeps

Conversation

@theletterf

@theletterf theletterf commented May 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Two more sweeps in the docs-quality-sweep family, stacked on #124.

gh-aw-docs-staleness-sweep

  • Stale content — pages whose latest commit is older than stale-content-months (default 24).
  • Stale screenshots — image references where the image's last commit predates the doc's by at least stale-screenshot-min-gap-months (default 6).
  • Broken external links — non-Elastic external URLs that fail HTTP via lychee. Internal Elastic domains are excluded by default.
  • Unsupported version mentions — references to EOL product versions, identified via the Elastic Docs MCP server (search_docs + get_document_by_url against the support matrix). Release-notes and upgrade pages are exempted.

A python pre-step computes git ages and image references; lychee is downloaded as a release binary and run on the in-scope slice.

gh-aw-docs-coherence-sweep

  • Detects duplicate, near-duplicate, and contradictory content vs. published Elastic docs.
  • For each in-scope page: focused query → find_related_docs (capped at max-related-per-page, default 3) → get_document_by_url for the comparison set → LLM classification.
  • Smaller default target-batch-size (50) because each page produces multiple MCP fetches and LLM comparisons.
  • The agent calls noop if the MCP server is unreachable for more than half the run, rather than emit unreliable findings.

Orchestrator update

agentic-workflows/docs-quality-sweep/example.yml adds two more parallel jobs and two new inputs (staleness-content-months, coherence-batch-size).

Stacked on #124 — merge that first.

Where this is meant to run

Same as #123 / #124: install in elastic/docs-content-internal, audit source-repo: elastic/docs-content, fix-issues land in the calling repo. Only COPILOT_GITHUB_TOKEN needed.

Test plan

  • make compile passes with 0 errors / 0 warnings.
  • make lint passes for the new files.
  • Staleness sweep on a sandbox: confirm the python pre-step produces a valid staleness.json and lychee outputs a lychee.json with at least one expected broken URL.
  • Staleness sweep correctly skips the elastic.co domain in lychee output.
  • Coherence sweep on a sandbox: confirm at most max-related-per-page * in-scope-pages MCP fetches occur.
  • Coherence sweep falls back to `noop` when the MCP server is unreachable.
  • Both sweeps file issues in the calling repo with the correct labels.
  • `gh workflow run docs-quality-sweep.yml -f sweeps=staleness,coherence` only fans out to those two jobs.

🤖 Generated with Claude Code

@theletterf
theletterf requested a review from a team as a code owner May 5, 2026 07:55
@theletterf
theletterf requested a review from cotti May 5, 2026 07:55
@theletterf theletterf self-assigned this May 5, 2026
@theletterf theletterf added the enhancement New feature or request label May 5, 2026
@theletterf
theletterf force-pushed the docs-content-quality-sweeps branch from 1b19641 to 3bf2b7d Compare May 5, 2026 08:16
Two more sweeps in the docs-quality-sweep family. Both are heavier
than the existing five and benefit from isolated review.

`gh-aw-docs-staleness-sweep`:

- Stale content (page's latest commit older than `stale-content-months`,
  default 24).
- Stale screenshots (image's last commit predates the doc by at least
  `stale-screenshot-min-gap-months`, default 6).
- Broken external links via `lychee` in a pre-step. Internal Elastic
  domains are excluded by default.
- Mentions of EOL product versions, identified via the elastic-docs MCP
  server (`search_docs` + `get_document_by_url` against the support
  matrix). Release-notes and upgrade pages are exempted.

`gh-aw-docs-coherence-sweep`:

- Detects duplicate / near-duplicate / contradictory content vs.
  published Elastic docs. Each in-scope page → focused query →
  `find_related_docs` (capped at `max-related-per-page`, default 3) →
  `get_document_by_url` for the comparison set.
- Smaller default `target-batch-size` (50) because each page produces
  multiple MCP fetches and LLM comparisons.
- The agent calls `noop` if the MCP server is unreachable for more
  than half the run, rather than emit unreliable findings.

Both file fix-issues in `elastic/docs-content-internal` (via
`DOCS_FIX_ISSUES_TOKEN`) under labels `docs-fix:staleness` and
`docs-fix:coherence`.

The `docs-quality-sweep` orchestrator picks up two new jobs and two
new inputs (`staleness-content-months`, `coherence-batch-size`).

Stacked on docs-content-quality-sweeps.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@theletterf
theletterf force-pushed the docs-staleness-coherence-sweeps branch from 7ed4b6f to 546c6f0 Compare May 5, 2026 08:18
@theletterf
theletterf merged commit 2ace079 into docs-content-quality-sweeps May 5, 2026
3 checks passed
@theletterf
theletterf deleted the docs-staleness-coherence-sweeps branch May 5, 2026 08:51
theletterf added a commit that referenced this pull request May 5, 2026
Two more sweeps in the docs-quality-sweep family. Both are heavier
than the existing five and benefit from isolated review.

`gh-aw-docs-staleness-sweep`:

- Stale content (page's latest commit older than `stale-content-months`,
  default 24).
- Stale screenshots (image's last commit predates the doc by at least
  `stale-screenshot-min-gap-months`, default 6).
- Broken external links via `lychee` in a pre-step. Internal Elastic
  domains are excluded by default.
- Mentions of EOL product versions, identified via the elastic-docs MCP
  server (`search_docs` + `get_document_by_url` against the support
  matrix). Release-notes and upgrade pages are exempted.

`gh-aw-docs-coherence-sweep`:

- Detects duplicate / near-duplicate / contradictory content vs.
  published Elastic docs. Each in-scope page → focused query →
  `find_related_docs` (capped at `max-related-per-page`, default 3) →
  `get_document_by_url` for the comparison set.
- Smaller default `target-batch-size` (50) because each page produces
  multiple MCP fetches and LLM comparisons.
- The agent calls `noop` if the MCP server is unreachable for more
  than half the run, rather than emit unreliable findings.

Both file fix-issues in `elastic/docs-content-internal` (via
`DOCS_FIX_ISSUES_TOKEN`) under labels `docs-fix:staleness` and
`docs-fix:coherence`.

The `docs-quality-sweep` orchestrator picks up two new jobs and two
new inputs (`staleness-content-months`, `coherence-batch-size`).

Stacked on docs-content-quality-sweeps.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
theletterf added a commit that referenced this pull request May 5, 2026
Two more sweeps in the docs-quality-sweep family. Both are heavier
than the existing five and benefit from isolated review.

`gh-aw-docs-staleness-sweep`:

- Stale content (page's latest commit older than `stale-content-months`,
  default 24).
- Stale screenshots (image's last commit predates the doc by at least
  `stale-screenshot-min-gap-months`, default 6).
- Broken external links via `lychee` in a pre-step. Internal Elastic
  domains are excluded by default.
- Mentions of EOL product versions, identified via the elastic-docs MCP
  server (`search_docs` + `get_document_by_url` against the support
  matrix). Release-notes and upgrade pages are exempted.

`gh-aw-docs-coherence-sweep`:

- Detects duplicate / near-duplicate / contradictory content vs.
  published Elastic docs. Each in-scope page → focused query →
  `find_related_docs` (capped at `max-related-per-page`, default 3) →
  `get_document_by_url` for the comparison set.
- Smaller default `target-batch-size` (50) because each page produces
  multiple MCP fetches and LLM comparisons.
- The agent calls `noop` if the MCP server is unreachable for more
  than half the run, rather than emit unreliable findings.

Both file fix-issues in `elastic/docs-content-internal` (via
`DOCS_FIX_ISSUES_TOKEN`) under labels `docs-fix:staleness` and
`docs-fix:coherence`.

The `docs-quality-sweep` orchestrator picks up two new jobs and two
new inputs (`staleness-content-months`, `coherence-batch-size`).

Stacked on docs-content-quality-sweeps.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
theletterf added a commit that referenced this pull request May 5, 2026
…estrator (#124)

* Add applies-to / openings / style / typos sweeps + quality-sweep orchestrator

Builds on the foundational pattern established by docs-frontmatter-sweep:

- `gh-aw-docs-applies-to-sweep` — validates `applies_to` correctness via
  `docs-applies-to-tagging` skill in audit-only mode.
- `gh-aw-docs-openings-sweep` — vague-H1 / weak-opening / missing
  "Before you begin" via `docs-page-opening-optimizer`. Wires the
  `elastic-docs` MCP server so the agent can cross-check H1
  distinctiveness against sibling pages on the public docs.
- `gh-aw-docs-style-sweep` — Vale + Elastic style guide via
  `docs-check-style`. Categories include `tortured-sentence` for
  unambiguously bad construction (nested negations, garden-paths,
  deeply nested clauses) where reasonable rewrites are obvious.
- `gh-aw-docs-typos-sweep` — deterministic codespell scan over the
  whole corpus (no rotation needed). Split out from style sweep so each
  fix-issue carries a single, routable category label
  (`docs-fix:typos` vs `docs-fix:style`); gh-aw treats
  `safe-outputs.create-issue.labels` as a per-workflow literal so they
  cannot be set per-call.
- `agentic-workflows/docs-quality-sweep/` — orchestrator trigger
  template that fans out to all five sweeps as parallel
  `workflow_call` jobs, with an `inputs.sweeps` filter so consumers
  can run subsets via `gh workflow run docs-quality-sweep.yml -f
  sweeps=frontmatter,typos`.

All sweeps file fix-issues in `elastic/docs-content-internal` via the
`DOCS_FIX_ISSUES_TOKEN` secret. Each carries the `docs-quality-sweep`
parent label plus a per-category `docs-fix:<category>` label, with
`close-older-issues: true` so the issue tracker doesn't accumulate
stale runs.

Stacked on docs-frontmatter-sweep; merge that first.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* Add staleness and coherence sweeps (#125)

Two more sweeps in the docs-quality-sweep family. Both are heavier
than the existing five and benefit from isolated review.

`gh-aw-docs-staleness-sweep`:

- Stale content (page's latest commit older than `stale-content-months`,
  default 24).
- Stale screenshots (image's last commit predates the doc by at least
  `stale-screenshot-min-gap-months`, default 6).
- Broken external links via `lychee` in a pre-step. Internal Elastic
  domains are excluded by default.
- Mentions of EOL product versions, identified via the elastic-docs MCP
  server (`search_docs` + `get_document_by_url` against the support
  matrix). Release-notes and upgrade pages are exempted.

`gh-aw-docs-coherence-sweep`:

- Detects duplicate / near-duplicate / contradictory content vs.
  published Elastic docs. Each in-scope page → focused query →
  `find_related_docs` (capped at `max-related-per-page`, default 3) →
  `get_document_by_url` for the comparison set.
- Smaller default `target-batch-size` (50) because each page produces
  multiple MCP fetches and LLM comparisons.
- The agent calls `noop` if the MCP server is unreachable for more
  than half the run, rather than emit unreliable findings.

Both file fix-issues in `elastic/docs-content-internal` (via
`DOCS_FIX_ISSUES_TOKEN`) under labels `docs-fix:staleness` and
`docs-fix:coherence`.

The `docs-quality-sweep` orchestrator picks up two new jobs and two
new inputs (`staleness-content-months`, `coherence-batch-size`).

Stacked on docs-content-quality-sweeps.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
theletterf added a commit that referenced this pull request May 5, 2026
Every APM-importing reusable workflow in this repo currently caches its
skill bundle under the constant key `apm-copilot-` when called from
elastic/docs-content. The cache key formula
`apm-${engine}-${hashFiles('.github/workflows/*.lock.yml')}` is evaluated
in the caller's workspace, which has no lock files — so the hash segment
is empty for every workflow.

While only docs-review used APM this was benign. Once the sweeps landed
(#123-#125), every additional workflow with a different `packages:` list
started overwriting the same cache slot. The next workflow to run hit
the previous one's bundle and got `Skill not found` for the skills it
actually imports — with the agent ultimately falling back to manual
analysis ("All skills are unavailable. I'll review the changes using my
own judgment now.").

Workaround: align every APM-importing workflow's `packages:` to the
union of all skills used across the repo, so all five workflows pack
the same bundle and cache collisions are no-ops. Adds a small per-run
download cost (each workflow pulls all seven skills, uses one or two)
but restores correctness.

Filed upstream as github/gh-aw#30365 — when fixed there, we can revert
each workflow's `packages:` back to its minimum set.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
theletterf added a commit that referenced this pull request May 5, 2026
Every APM-importing reusable workflow in this repo currently caches its
skill bundle under the constant key `apm-copilot-` when called from
elastic/docs-content. The cache key formula
`apm-${engine}-${hashFiles('.github/workflows/*.lock.yml')}` is evaluated
in the caller's workspace, which has no lock files — so the hash segment
is empty for every workflow.

While only docs-review used APM this was benign. Once the sweeps landed
(#123-#125), every additional workflow with a different `packages:` list
started overwriting the same cache slot. The next workflow to run hit
the previous one's bundle and got `Skill not found` for the skills it
actually imports — with the agent ultimately falling back to manual
analysis ("All skills are unavailable. I'll review the changes using my
own judgment now.").

Workaround: align every APM-importing workflow's `packages:` to the
union of all skills used across the repo, so all five workflows pack
the same bundle and cache collisions are no-ops. Adds a small per-run
download cost (each workflow pulls all seven skills, uses one or two)
but restores correctness.

Filed upstream as github/gh-aw#30365 — when fixed there, we can revert
each workflow's `packages:` back to its minimum set.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
theletterf added a commit that referenced this pull request May 5, 2026
* Pack identical APM skill bundle across all reusable workflows

Every APM-importing reusable workflow in this repo currently caches its
skill bundle under the constant key `apm-copilot-` when called from
elastic/docs-content. The cache key formula
`apm-${engine}-${hashFiles('.github/workflows/*.lock.yml')}` is evaluated
in the caller's workspace, which has no lock files — so the hash segment
is empty for every workflow.

While only docs-review used APM this was benign. Once the sweeps landed
(#123-#125), every additional workflow with a different `packages:` list
started overwriting the same cache slot. The next workflow to run hit
the previous one's bundle and got `Skill not found` for the skills it
actually imports — with the agent ultimately falling back to manual
analysis ("All skills are unavailable. I'll review the changes using my
own judgment now.").

Workaround: align every APM-importing workflow's `packages:` to the
union of all skills used across the repo, so all five workflows pack
the same bundle and cache collisions are no-ops. Adds a small per-run
download cost (each workflow pulls all seven skills, uses one or two)
but restores correctness.

Filed upstream as github/gh-aw#30365 — when fixed there, we can revert
each workflow's `packages:` back to its minimum set.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* Make docs agent workflows autonomous

Embed the docs review and sweep rules directly in the agent prompts so the workflows no longer depend on runtime Elastic Docs Skills, while keeping Elastic docs MCP as the bounded source for published-doc verification.

Co-authored-by: OpenAI GPT-5.5 <[email protected]>
Co-authored-by: Cursor <[email protected]>

* Run Vale before docs review

Add deterministic Vale output to the docs-review workflow so style findings are grounded in elastic/vale-rules instead of runtime skills or model-only judgment.

Co-authored-by: OpenAI GPT-5.5 <[email protected]>
Co-authored-by: Cursor <[email protected]>

* Carry over docs skill review guidance

Embed the high-value style, jargon, frontmatter, content-type, applies_to, and page-opening guidance from Elastic Docs Skills into the autonomous workflow prompts while keeping Vale and MCP as evidence sources.

Co-authored-by: OpenAI GPT-5.5 <[email protected]>
Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Co-authored-by: OpenAI GPT-5.5 <[email protected]>
Co-authored-by: Cursor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant