Skip to content

Add PR-triggered documentation drift checks#90

Merged
oshorefueled merged 12 commits into
mainfrom
doc/drift-automation
Jun 18, 2026
Merged

Add PR-triggered documentation drift checks#90
oshorefueled merged 12 commits into
mainfrom
doc/drift-automation

Conversation

@oshorefueled

@oshorefueled oshorefueled commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Why

Our documentation drifts from product behavior as we build, creating a poor experience for people evaluating VectorLint and for existing users. As a small team, we need a way to catch that drift during PR review and either address it immediately or follow up on it intentionally.

What this PR covers

  • Add a PR-triggered documentation drift check that evaluates whether code changes invalidate existing docs or introduce undocumented user-facing behavior.
  • Post concise review feedback directly on the PR so the team can see the behavioral change, the affected documentation, and whether follow-up is needed.
  • Support a no-drift path as well, so reviewers get a clear signal when the current changes do not require documentation updates.
  • Add a local workflow test path so the doc-drift flow can be exercised and iterated on outside of GitHub.

Behavior impact

  • Reviewers can trigger a documentation drift check on a PR with /check-docs.
  • The workflow analyzes the PR diff against the current documentation set, and reports drift in a compact review format.
  • The result is a faster feedback loop for keeping docs aligned with product changes as the team builds.

Future improvements

  • Expand triggering beyond the repository owner by adding a safe maintainer authorization model for /check-docs.
  • Separate PR triggering/comment publishing from analysis execution if the workflow grows more complex and needs cleaner retry, permission, or operational boundaries.
  • Agent observability and monitoring to track cost and performance so we can make improvements.

How to test / verify

Manual verification

  • Run:

    act workflow_dispatch \
      -W tests/workflows/docs-drift-test.yml \
      --secret-file .secrets \
      --input base_ref=main \
      --input head_ref=doc/drift-automation \
      -P ubuntu-latest=catthehacker/ubuntu:act-latest \
      --pull=false \
      --bind
  • Confirm artifacts/doc-drift/ contains:

    • pr.diff
    • pi-message.txt
    • one or more .doc-drift-*.md files when findings are produced
  • On a GitHub PR, comment /check-docs as the repo owner and verify:

    • the comment gets an eyes reaction
    • the workflow posts either per-change drift comments or a concise no-drift comment
    • failures post the fallback failure comment

Summary by CodeRabbit

  • New Features

    • Added automated documentation drift detection triggered via /check-docs PR comments, identifying when code changes invalidate or lack corresponding documentation updates.
  • Documentation

    • Added comprehensive developer guidelines and architecture documentation.
    • Added implementation plan and design specification for the documentation checking system.
  • Tests

    • Added local workflow testing support with documentation and example configurations.
  • Chores

    • Updated build configuration and repository settings.

- Documents automated PR-triggered doc drift detection system
- GitHub Actions workflow with OWNER-only comment trigger (/check-docs)
- Pi agent skill with 5-phase decision tree (intent extraction → doc search
  → cross-reference → coverage assessment → report)
- Intent-based analysis (not per-file) with multi-term rg search strategy
- False negative guard: multiple search term sets before concluding absence
- Structured PR comment output with copy-pasteable agent fix prompt
- Two reference files: user-facing-criteria.md and comment.md
- Environment-aware: GitHub context posts comment, local context prompts user
- Covers both drift detected and undocumented user-facing change paths
- Remove 2-4 intent cap: agent extracts all behavioral changes, no ceiling
- Remove rg tool prescription: agent uses whatever search tools are available
- Replace numeric false negative guard with coverage-based stop signal
- Frame user-facing criteria list as illustrative, not exhaustive
- Rewrite fix prompts to be direct and concise (no redundant review step)
- Switch output model to one file per behavioral change, posted as separate
  PR comments; each finding gets its own fix prompt
- Replace 'intent' with 'behavioral change' in all user-facing output
- Add language note to comment.md: never use the word 'intent' in output
- Update edge cases table to match new per-change comment model
6 tasks: Pi skill, two reference files, GitHub Actions workflow,
setup notes, and end-to-end smoke test. Flags two TODOs that
need Pi CLI syntax confirmation before first CI run.
- Gate on OWNER author_association, react with 👀 on the triggering
  comment, and post a failure comment if the check errors
- Guide a Pi agent through 5 phases: extract behavioral changes from
  the diff, search docs/ with a multi-term strategy, cross-reference
  claims, assess user-facing coverage, write per-change report files
- Add VectorLint-specific user-facing criteria and output format
  references covering drift, undocumented changes, and clean pass
  in both GitHub Actions and local contexts
- Expand documentation search targets from docs/*.mdx only to also
  cover README.md, CLAUDE.md, and AGENTS.md
- split authorization into its own job so the doc drift pipeline only runs once the owner check passes

- replace inline workflow Python with a checked-in TypeScript helper for building the Pi prompt

- confirm the Pi CLI invocation and move the doc-drift skill under .agents/skills
- add AGENTS.md so harnesses that prefer AGENTS instructions read the same repository guidance

- replace CLAUDE.md with a symlink to AGENTS.md to keep Claude Code compatibility without duplicating content
- switch the production doc drift workflow from Anthropic envs to

  Amazon Bedrock provider wiring and explicit model selection

- add an act-only workflow harness under tests/workflows so branch

  diffs can be exercised locally without enabling another GitHub

  Actions workflow

- add a .secrets example and ignore the real .secrets file to make

  local workflow testing easy without risking committed credentials
- rename the model secret to PI_MODEL in the production and local

  doc drift workflows so it matches the existing Pi env naming

- remove the unused GitHub CLI installation from the act-only test

  workflow because the local harness builds diffs with git and uploads

  artifacts instead of calling GitHub APIs
- run the doc-drift workflow from separate main and PR checkouts,
  and pass the diff path into the agent instead of embedding the
  full diff in the prompt
- split doc-drift output templates into GitHub and non-GitHub
  structures, including the shorter no-drift comment and
  environment-specific detail formatting
- persist local workflow test artifacts under artifacts/doc-drift
  and document the act-based test flow for iterating on the
  workflow locally
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@oshorefueled, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 10 minutes and 30 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3968b07a-b1e1-4417-8bcd-3d9204ca2f12

📥 Commits

Reviewing files that changed from the base of the PR and between 878db49 and 6e3de1c.

📒 Files selected for processing (7)
  • .github/scripts/build-doc-drift-message.ts
  • .github/workflows/doc-drift.yml
  • .gitignore
  • AGENTS.md
  • docs/plans/2026-03-31-agent-mode-ux-reliability-fixes-plan.md
  • tests/workflows/README.md
  • tests/workflows/docs-drift-test.yml
📝 Walkthrough

Walkthrough

Introduces a complete "doc drift" checking system for VectorLint. A /check-docs PR comment triggers a GitHub Actions workflow that runs a Pi AI agent skill, which extracts behavioral changes from the PR diff, searches documentation for each change, detects invalidated doc claims or undocumented user-facing changes, and posts structured per-finding reports as PR comments. Includes the Pi skill definition, output templates, a TypeScript message-builder script, a manual test workflow, design/plan documentation, and repo housekeeping (AGENTS.md replacing CLAUDE.md, secrets config).

Changes

Doc Drift Checker

Layer / File(s) Summary
Pi skill: decision tree and output templates
.agents/skills/doc-drift/SKILL.md, .agents/skills/doc-drift/references/comment.md, .agents/skills/doc-drift/references/user-facing-criteria.md
SKILL.md defines the five-phase decision tree (extract behavioral changes, search docs with false-negative guard, cross-reference drift, check user-facing criteria, write reports). comment.md provides structured output templates for GitHub vs non-GitHub contexts. user-facing-criteria.md enumerates what counts as user-facing.
Diff message builder script and tsconfig
.github/scripts/build-doc-drift-message.ts, tsconfig.json
New CLI script validates diffPath/outputPath/GITHUB_WORKSPACE, interpolates them into the Pi instruction prompt, and writes the result. tsconfig.json gains a .github/scripts/**/*.ts include glob.
Production GitHub Actions workflow
.github/workflows/doc-drift.yml, .secrets.example, .gitignore
doc-drift.yml adds an OWNER-only auth gate on /check-docs comments, then a dependent job that checks out branches, fetches the PR diff, runs build-doc-drift-message.ts, invokes Pi against Amazon Bedrock, and posts one PR comment per generated .doc-drift-N.md report file. .secrets.example adds Bedrock credential placeholders; .gitignore ignores .secrets.
Manual test workflow and local testing docs
tests/workflows/docs-drift-test.yml, tests/workflows/README.md
docs-drift-test.yml is a workflow_dispatch workflow for local act testing: generates a base-to-head diff, builds the Pi prompt, runs the skill, and persists artifacts. README.md documents prerequisites and the example act invocation.
Design spec and implementation plan
docs/superpowers/specs/2026-06-17-doc-drift-design.md, docs/plans/2026-06-17-doc-drift-checker.md
Design spec covers full system architecture, workflow and skill contracts, reference file templates, and edge-case handling. Implementation plan provides task-by-task instructions with embedded file contents, smoke-test steps, and a pre-merge CI checklist.
Repo agent guidelines and secrets config
AGENTS.md, CLAUDE.md
AGENTS.md is added with full repository guidelines for AI agents (module map, commands, conventions, architecture principles). CLAUDE.md is removed.

Sequence Diagram(s)

sequenceDiagram
    participant Owner as PR Owner
    participant GHA as GitHub Actions
    participant Pi as Pi Agent (Bedrock)
    participant Docs as docs/*.mdx
    participant PR as Pull Request

    Owner->>GHA: Comment "/check-docs"
    GHA->>GHA: Validate OWNER association
    GHA->>GHA: gh pr diff → diff.patch
    GHA->>GHA: build-doc-drift-message.ts → message.txt
    GHA->>Pi: pi run --skill doc-drift --message message.txt
    Pi->>Pi: Extract behavioral changes from src/ diff
    Pi->>Docs: Search for each behavioral change
    Docs-->>Pi: Matched doc sections (or no match)
    Pi->>Pi: Cross-reference: are claims invalidated?
    Pi->>Pi: Check user-facing-criteria.md for unmatched changes
    Pi-->>GHA: Write .doc-drift-N.md per finding
    GHA->>PR: Post one comment per report file
    GHA-->>PR: Post failure comment on error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 Sniff, sniff — what's this in the diff?
A skill to catch docs gone astray!
The rabbit checks every behavioural whiff,
And posts a neat comment straightaway.
No drift shall escape my watchful ear,
For AGENTS.md guides the way! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a GitHub Actions workflow for PR-triggered documentation drift detection. It is concise, specific, and clearly summarizes the primary functionality being introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch doc/drift-automation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (3)
docs/plans/2026-06-17-doc-drift-checker.md (1)

257-257: 💤 Low value

Add language specifiers to code blocks.

Code blocks on lines 257, 495, 509, and 539 lack language specifiers. Use bash, markdown, or appropriate language tags.

Also applies to: 495-495, 509-509, 539-539

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/plans/2026-06-17-doc-drift-checker.md` at line 257, The code blocks on
lines 257, 495, 509, and 539 are missing language specifiers in their markdown
syntax. For each code block that currently uses triple backticks without a
language identifier (just ```), add the appropriate language specifier
immediately after the opening backticks (such as bash for shell commands,
markdown for markdown content, or other relevant language tags). This improves
syntax highlighting and readability in the documentation.

Source: Linters/SAST tools

docs/superpowers/specs/2026-06-17-doc-drift-design.md (1)

24-24: 💤 Low value

Add language specifiers to code blocks.

Five code blocks (lines 24, 77, 112, 297, 325) lack language specifiers. Use yaml, text, or markdown as appropriate to aid syntax highlighting.

Also applies to: 77-77, 112-112, 297-297, 325-325

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/specs/2026-06-17-doc-drift-design.md` at line 24, Add
language specifiers to the five code blocks in the document that currently lack
them. For each code block starting at the locations indicated (lines 24, 77,
112, 297, 325), modify the opening fence from triple backticks with no language
identifier to include the appropriate language specifier such as yaml, text, or
markdown (e.g., change ``` to ```yaml or ```text or ```markdown as appropriate
for the content). This will enable proper syntax highlighting for each code
block.

Source: Linters/SAST tools

tests/workflows/docs-drift-test.yml (1)

35-56: Pin workflow CLI tool versions for reproducible local test runs.

Lines 36 and 55 currently pull latest tool versions at runtime, which can make manual workflow tests drift unexpectedly across runs. Pin @earendil-works/pi-coding-agent to a specific version (current: 0.79.6) and add tsx version pinning with npx --yes tsx@<PINNED_VERSION> (current: 4.22.4).

Suggested change
-      - name: Install Pi
-        run: npm install -g `@earendil-works/pi-coding-agent`
+      - name: Install Pi
+        run: npm install -g `@earendil-works/pi-coding-agent`@0.79.6

@@
-          npx tsx .github/scripts/build-doc-drift-message.ts "$GITHUB_WORKSPACE/.doc-drift-input.diff" /tmp/pi-message.txt
+          npx --yes tsx@4.22.4 .github/scripts/build-doc-drift-message.ts "$GITHUB_WORKSPACE/.doc-drift-input.diff" /tmp/pi-message.txt
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/workflows/docs-drift-test.yml` around lines 35 - 56, Pin the npm
package versions in the workflow to ensure reproducible test runs. In the
Install Pi step, add the version specifier to the npm install command for
`@earendil-works/pi-coding-agent` by appending `@0.79.6` to the package name. In the
Build agent message step, replace the npx tsx command with npx --yes tsx@4.22.4
to pin the tsx tool to version 4.22.4 instead of using the latest available
version at runtime.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/scripts/build-doc-drift-message.ts:
- Line 3: The const variable declarations on lines 3, 9, and 15 use camelCase
naming (diffPath, workspace, message) which violates the ESLint naming
convention rule requiring UPPER_CASE for const variables. Rename diffPath to
DIFF_PATH, workspace to WORKSPACE, and message to MESSAGE in their respective
const declarations, then update all references to these variables throughout the
file to use the new UPPER_CASE names to comply with the project's linting rules.

In @.github/workflows/doc-drift.yml:
- Line 27: Pin all GitHub Actions references in the workflow file to specific
commit hashes instead of version tags for security compliance. Replace the six
unpinned action references (actions/github-script@v7 on lines 27, 57, and 69;
actions/checkout@v4 on lines 80 and 87; and actions/setup-node@v4 on line 94)
with their full commit SHA hashes by visiting each action's releases page on
GitHub and copying the complete commit hash for the desired version tag (e.g.,
actions/checkout@a5ac7e51b41094c5145c72f7b3c3d9be72cb94a8).
- Around line 79-84: Add the `persist-credentials: false` parameter to both
checkout steps in the workflow. For the first checkout step named "Checkout main
branch" (which uses actions/checkout@v4 with ref pointing to the default
branch), add `persist-credentials: false` as a new line in the with section.
Similarly, add the same parameter to the second checkout step that is also
mentioned in the comment (lines 86-91). This ensures the GitHub token is not
persisted as a git credential after checkout.
- Around line 16-20: The check-docs job declares pull-requests permission as
read, but the job uses gh pr comment to post comments to pull requests, which
requires write permission. Update the pull-requests permission in the
permissions block of the check-docs job from read to write. This ensures the
workflow has the necessary permissions to execute the gh pr comment command
successfully.

In `@AGENTS.md`:
- Line 154: The line describing Anthropic models incorrectly includes "Codex
models" which are actually OpenAI's model family. Remove the "Codex models"
reference from the Anthropic line and ensure it correctly attributes only Claude
(Opus, Sonnet, Haiku) to Anthropic. Update the Anthropic entry to accurately
reflect that Anthropic produces the Claude model family, not Codex.

In `@docs/superpowers/specs/2026-06-17-doc-drift-design.md`:
- Around line 347-366: The documentation contains a duplicated "Local context
(no GITHUB_ACTIONS)" section that appears twice consecutively with identical
content, creating confusion about whether there are differences in behavior
between them. Remove the second occurrence of the entire "Local context (no
GITHUB_ACTIONS)" block that repeats the instructions about printing behavioral
changes, prompting the user for documentation updates, and handling responses -
retain only the first instance of this section to eliminate the duplication.

In `@tests/workflows/README.md`:
- Around line 6-7: The sentence in the workflow test rationale contains an
awkward and grammatically incorrect phrase "create dirty commit on iteration".
Reword this phrase to be grammatically correct and more clearly convey that
running tests locally avoids cluttering the repository history with unnecessary
commits during development iteration. The corrected sentence should flow
naturally and be easily understood by contributors reading the README.

---

Nitpick comments:
In `@docs/plans/2026-06-17-doc-drift-checker.md`:
- Line 257: The code blocks on lines 257, 495, 509, and 539 are missing language
specifiers in their markdown syntax. For each code block that currently uses
triple backticks without a language identifier (just ```), add the appropriate
language specifier immediately after the opening backticks (such as bash for
shell commands, markdown for markdown content, or other relevant language tags).
This improves syntax highlighting and readability in the documentation.

In `@docs/superpowers/specs/2026-06-17-doc-drift-design.md`:
- Line 24: Add language specifiers to the five code blocks in the document that
currently lack them. For each code block starting at the locations indicated
(lines 24, 77, 112, 297, 325), modify the opening fence from triple backticks
with no language identifier to include the appropriate language specifier such
as yaml, text, or markdown (e.g., change ``` to ```yaml or ```text or
```markdown as appropriate for the content). This will enable proper syntax
highlighting for each code block.

In `@tests/workflows/docs-drift-test.yml`:
- Around line 35-56: Pin the npm package versions in the workflow to ensure
reproducible test runs. In the Install Pi step, add the version specifier to the
npm install command for `@earendil-works/pi-coding-agent` by appending `@0.79.6` to
the package name. In the Build agent message step, replace the npx tsx command
with npx --yes tsx@4.22.4 to pin the tsx tool to version 4.22.4 instead of using
the latest available version at runtime.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 08f522aa-9461-4211-ac57-5f15ee15375c

📥 Commits

Reviewing files that changed from the base of the PR and between 762c8b6 and 878db49.

📒 Files selected for processing (15)
  • .agents/skills/doc-drift/SKILL.md
  • .agents/skills/doc-drift/references/comment.md
  • .agents/skills/doc-drift/references/user-facing-criteria.md
  • .github/scripts/build-doc-drift-message.ts
  • .github/workflows/doc-drift.yml
  • .gitignore
  • .secrets.example
  • AGENTS.md
  • CLAUDE.md
  • CLAUDE.md
  • docs/plans/2026-06-17-doc-drift-checker.md
  • docs/superpowers/specs/2026-06-17-doc-drift-design.md
  • tests/workflows/README.md
  • tests/workflows/docs-drift-test.yml
  • tsconfig.json

Comment thread .github/scripts/build-doc-drift-message.ts Outdated
Comment thread .github/workflows/doc-drift.yml
Comment thread .github/workflows/doc-drift.yml Outdated
Comment thread .github/workflows/doc-drift.yml
Comment thread AGENTS.md Outdated
Comment thread docs/superpowers/specs/2026-06-17-doc-drift-design.md Outdated
Comment thread tests/workflows/README.md Outdated
- rename local bindings in the doc-drift message builder to match the repo naming convention
- keep the workflow prompt builder behavior the same while allowing eslint --fix and the pre-commit hook to pass cleanly
- pin GitHub Action SHAs and workflow tool versions so doc-drift runs
  stay reproducible and less exposed to upstream drift
- correct the Anthropic provider description and improve the local
  workflow test wording for contributors
- remove tracked planning artifacts from docs/plans and
  docs/superpowers, then ignore those directories so local planning
  files stay out of version control
@oshorefueled oshorefueled merged commit a55ea70 into main Jun 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant