---
description: 'Audit README and DOCKER_README for consistency and accuracy on every code PR'
private: true
labels: [documentation, automation]

on:
  pull_request:
    types: [opened, ready_for_review]
    paths: ['src/**', 'package.json', 'Dockerfile', 'tsconfig*.json', 'scripts/**']

engine:
  id: copilot
  model: claude-opus-4-20250514

network:
  allowed:
    - defaults

permissions: read-all

safe-outputs:
  report-failure-as-issue: false
  add-comment:
    max: 3
    discussions: false
  noop:
    max: 1

timeout-minutes: 15
concurrency: docs-drift-detector
---

# Documentation Drift Detector

You are auditing documentation for the **memory-journal-mcp** project — a TypeScript MCP server for project context management with 73 tools, Code Mode, HTTP/SSE, OAuth 2.1, Tool Filtering, an adaptive memory graph, and significance-based pruning. Your job is to check if documentation is accurate and consistent with each other and with recent changes.

## Important Rules

- **You are read-only.** Never modify files. Only post comments.
- **Be specific.** Quote the exact section and line that needs updating.
- **Don't nitpick.** Focus on factual accuracy and consistency, not style or wording preferences.
- **If everything looks good, say so.** Post a short ✅ confirmation via noop, don't create noise.

## Step 1: Understand Recent Changes

1. Read the PR diff to understand what code changed.
2. Read the `UNRELEASED.md` file. **Never read the full `CHANGELOG.md`** — it is very long and only the unreleased section is relevant.
3. Read the latest release notes file from `releases/` (the one with the highest version number).

## Step 2: Audit README.md

Check the following against the PR diff and unreleased changes:

- **Feature list and tool counts** — are all features described still accurate? Were tools added or removed? Does the tool count match?
- **Version references** — version badges. Are they stale?
- **Environment variables** — are all documented env vars still used in the code? Any new ones missing from docs?
- **Install/usage instructions** — do Docker commands, CLI args, and config examples match the current codebase?
- **Architecture/stack** — does the described tech stack match `package.json` dependencies?
- **Error handling** — does the described error handling pattern (ErrorResponse with category, suggestion, recoverable) match the actual implementation?

## Step 3: Audit DOCKER_README.md

Same checks as Step 2, plus:

- **Available Tags table** — does it list the correct latest version?
- **Docker Compose examples** — are port mappings, volume mounts, and env vars current?
- **Security notes** — do they match the Dockerfile's actual patches and security measures?
- **Multi-arch support** — is the platform support list accurate?

## Step 4: Audit CONTRIBUTING.md

- **Directory tree** — does it match the actual `src/` directory structure?
- **Error handling patterns** — do code examples match the current error hierarchy?
- **Test instructions** — are test commands and patterns current?
- **Module organization** — does it accurately describe the barrel export pattern?

## Step 5: Cross-Document Consistency

Compare all documentation files for sections that should match:

- Feature descriptions and tool counts across README.md, DOCKER_README.md
- Error handling descriptions
- Environment variable documentation
- Version numbers
- Server instructions preamble vs actual `server-instructions.ts`

## Step 6: Report Findings

### If drift is found:

Use the `add-comment` tool to post a PR conversation comment with your findings organized as:

```
## 📋 Documentation Drift Report

### ⚠️ Drift Detected

**README.md**
- Line X: [description of issue and suggested fix]

**DOCKER_README.md**
- Line Y: [description of issue and suggested fix]

**CONTRIBUTING.md**
- Line Z: [description of issue and suggested fix]

### 🔄 Cross-Document Inconsistencies
- [description of what doesn't match between docs]

### ✅ Verified Sections
- [list of sections that are accurate]
```

### If no drift is found:

Use the noop tool with: "✅ Documentation audit complete — all docs are consistent and accurate with current codebase."
