Mid-flight scope check — compare current uncommitted and committed changes against the original ticket acceptance criteria to flag drift, missed items, or unplanned work.
Compare current changes against the original ticket to detect scope drift, missed acceptance criteria, or unplanned work.
TEAM=CDIN
LINEAR_TEAM=CDIN
LINEAR_URL_BASE=https://linear.app/klaviyo/issue
Get the current branch:
git branch --show-current
Extract ticket ID from the branch metadata or ask the user.
Fetch the ticket's acceptance criteria via Glean:
Tool: mcp__glean_default__chat
Question: "What are the acceptance criteria for Linear ticket CDIN-{number}? List them as bullet points."
If Glean fails, ask the user to paste the AC.
Get the merge base:
git merge-base origin/master HEAD
Get all committed changes in this branch:
git diff $(git merge-base origin/master HEAD)...HEAD --stat
git diff $(git merge-base origin/master HEAD)...HEAD --name-only
Get uncommitted changes:
git diff --stat
git diff --cached --stat
Read the actual diffs for context:
git diff $(git merge-base origin/master HEAD)...HEAD
For each acceptance criterion from the ticket:
Determine status: Does the current diff address this criterion?
Cite evidence: Reference specific files and changes that address (or fail to address) each criterion.
Identify changes that do NOT map to any acceptance criterion:
## Scope Check — CDIN-{number}
### Acceptance Criteria Status
| # | Criterion | Status | Evidence |
|---|-----------|--------|----------|
| 1 | {AC text} | DONE | `{file}`: {what was done} |
| 2 | {AC text} | PARTIAL | `{file}`: {what's done, what's missing} |
| 3 | {AC text} | NOT STARTED | — |
### Unplanned Changes
| File | Classification | Reason |
|------|---------------|--------|
| `{file}` | NECESSARY | {why} |
| `{file}` | DRIFT | {what it does — suggest splitting} |
### Summary
- **AC coverage:** {X}/{Y} criteria addressed
- **Scope drift:** {None / Minor / Significant}
- **Recommendation:** {Continue / Split unrelated changes / Refocus on missing AC items}
Based on the report:
/diff:diff-check for a self-review before committing."