Coding
PR spec-adherence checker
Check a PR against its linked ticket spec before review, showing which acceptance criteria are met, partial, or missing.
[ workflow / coding ]
PR spec-adherence checker
Cosmos reads the PR diff, finds the linked Jira or Linear ticket, extracts acceptance criteria, and checks each requirement against the code changes. It posts an adherence score with met, partial, and missing criteria. Critical gaps flag the PR before a human reviewer starts.
10 nodes
07 edges
GitHub / GitLab webhook
PR body, branch, commits
Jira / Linear criteria
Decision
Spec found?
Ticket with AC exists
Comment + label + end
Decision
Spec found?
Ticket with AC exists
Comment + label + end
Met / partial / missing
0–100, weighted by priority
Decision
Score ≥ threshold?
Default: 80 / 100
Red header + Slack alert
Red header + Slack alert
Decision
Score ≥ threshold?
Default: 80 / 100
Green header + evidence
Workflow prompt
Paste this into Augment to reproduce the workflow end-to-end.
Build a Cosmos workflow that scores a pull request against the spec it was built for. Trigger: a pull request is opened or marked ready-for-review on GitHub / GitLab. Steps: 1. Fetch the pull request diff, the PR description, and all linked issue / ticket references (extracted from the branch name, PR body, or commit messages). 2. Look up each linked ticket in Jira or Linear. Extract the acceptance criteria, the full specification text, any designs or wireframe links, and the original requirement written by the PM or tech lead. 3. Decision: "Spec found?". - If no linked spec is found, post a comment asking the author to link the relevant ticket, assign a "needs-spec-link" label, and end. - If yes, continue. 4. For each acceptance criterion, analyse the diff to determine whether the code change satisfies it: fully met, partially met, or missing entirely. Record evidence (file, line range) for each judgement. 5. Compute an overall adherence score (0–100). Weight critical and must-have criteria above nice-to-haves. 6. Decision: "Score above threshold?". Use a configurable threshold (default: 80). - If yes, post the adherence report as a PR comment (green header) and proceed to assign reviewers normally. - If no, post the adherence report with a red header, list the unmet criteria with suggested remediation hints, and flag the PR with a "spec-gap" label. Notify the author in Slack with the gap summary. 7. In both paths, the adherence comment includes: overall score, per-criterion status table, evidence snippets, and a link back to the ticket. Constraints: - Never block a PR merge directly: only comment and label. The decision to merge remains with human reviewers. - Always link the evidence (file + line) for each criterion assessment so reviewers can verify the judgement. - Record score history per ticket so we can trend adherence quality over time.