Analyzes PR changes to create ReviewContext.md and DerivedSpec.md artifacts. Handles both initial analysis and resumption after baseline research.
Analyze pull request changes to create comprehensive understanding artifacts. This activity handles both initial context gathering and specification derivation after baseline research.
Reference: Follow Core Review Principles from
paw-review-workflowskill.
This skill operates in two modes based on artifact state:
Execute Steps 1-3: Context gathering, research prompt generation, signal for baseline research.
Detection: ReviewContext.md not found at .paw/reviews/<identifier>/
Execute Step 4 only: Derive specification from baseline research.
Detection: Both ReviewContext.md AND CodeResearch.md exist at artifact path.
Determine context type before proceeding:
GitHub Context: GitHub PR URL or number provided
Azure DevOps Context: Azure DevOps PR URL or coordinates provided
Local Context: No hosted PR reference
Before this activity begins, the orchestrator must resolve authorization preflight. If the preflight is blocked or required fields are missing, report the conflict before creating review artifacts.
Detection: Any of these conditions triggers multi-repo mode:
PR-123 PR-456).git directories)Per-PR Processing:
Identifier Scheme:
PR-<number> (e.g., PR-123)PR-<number>-<repo-slug> (e.g., PR-123-my-api)ReviewContext.md Extension (for multi-repo):
repository: owner/repo-name
related_prs:
- number: 456
repository: owner/other-repo
relationship: "depends-on" # or "related-to", "blocks"
Determine Remote Name:
Remote field (if resuming)origin if not specifiedFetch PR Metadata:
Resolve Base Commit:
base.sha from PR metadata (GitHub returns the merge-base)git merge-base <head-branch> origin/<base-branch> when platform metadata does not provide the merge-baseBase Commit: <sha> and Base Commit Source: github-api | platform-metadata | merge-baseCreate ReviewContext.md:
.paw/reviews/<identifier>/ReviewContext.mdIdentify Research Needs for each changed file:
Create ResearchQuestions.md:
.paw/reviews/<identifier>/ResearchQuestions.mdReport completion of initial phase:
Research Questions Ready
Created ResearchQuestions.md with questions about pre-change behavior.
Files to investigate at base commit <sha>:
- [list files]
Waiting for CodeResearch.md from baseline research.
Activity Status: Partial (awaiting baseline research)
Execute only when CodeResearch.md exists.
Read All Source Material:
Identify Explicit Goals:
Identify Inferred Goals:
Document Baseline Context (from CodeResearch.md):
Characterize Before/After Behavior:
Flag Discrepancies:
Create DerivedSpec.md:
.paw/reviews/<identifier>/DerivedSpec.mdGitHub Context: .paw/reviews/PR-<number>/
Non-GitHub Context: .paw/reviews/<branch-slug>/
Branch slug: lowercase, / → -, remove invalid chars.
Preflight Status: passedall or the explicit user filterActivity complete.
Artifact saved: .paw/reviews/<identifier>/ReviewContext.md
Artifact saved: .paw/reviews/<identifier>/ResearchQuestions.md
Status: Partial
Summary: Context gathered, awaiting baseline research.
Activity complete.
Artifact saved: .paw/reviews/<identifier>/DerivedSpec.md
Status: Success
Summary: Specification derived with [N] explicit and [M] inferred goals.
---
date: <YYYY-MM-DD HH:MM:SS TZ>
git_commit: <head commit SHA>
branch: <head branch>
repository: <owner/repo OR local>
topic: "Review Context for <PR Title or Branch>"
tags: [review, context, metadata]
status: complete
---
# ReviewContext
**PR Number**: <number> (hosted PR) OR **Branch**: <branch-slug> (local)
**Review Platform**: <github | azure-devops | local>
**Remote**: <remote-name> (default: origin, or "No remote configured")
**Base Branch**: <base-branch>
**Head Branch**: <head-branch>
**Base Commit**: <sha>
**Base Commit Source**: github-api|platform-metadata|merge-base
**Head Commit**: <sha>
**Repository**: <owner>/<repo> OR "Local repository"
**Author**: <username or git author>
**Title**: <pr-title or derived from commits>
**State**: <open | closed | draft | active>
**Created**: <date | N/A>
**CI Status**: <passing | failing | pending | Not available>
**Labels**: <label-list | N/A>
**Reviewers**: <reviewer-list | N/A>
**Linked Issues**: <issue-urls | inferred from commits | none>
**Changed Files**: <count> files, +<additions> -<deletions>
**Artifact Paths**: .paw/reviews/<identifier>/
## Authorization Preflight
**Output Capability**: <pending-and-submit | pending-only | artifact-only>
**Requested Output Action**: <pending | submit | artifact-only>
**Feedback Scope Filter**: <all | explicit user scope/output filter>
**Submission Authorization**: <explicit | absent | ambiguous>
**Submission Event**: <APPROVE | REQUEST_CHANGES | COMMENT | none>
**Authorized Target**: <platform-qualified repository and PR | local branch | none>
**Authorized Head Commit**: <sha | none>
**Authorized Pending Review**: <pending review ID | bind-created-review | none>
**Authorization Conflict**: <none | concise conflict>
**Preflight Status**: <passed | blocked: reason>
## Review Configuration
**Review Mode**: <single-model (default) | society-of-thought>
**Review Specialists**: <all (default) | comma-separated names | adaptive:\<N\>>
**Review Interaction Mode**: <parallel (default) | debate>
**Review Interactive**: <false (default) | true | smart>
**Review Specialist Models**: <none (default) | model pool | pinned:model pairs | mixed>
**Review Perspectives**: <none (default) | auto | comma-separated names>
**Review Perspective Cap**: <2 (default) | positive integer>
*SoT configuration fields are populated from the orchestrator's delegation context. When the orchestrator includes review configuration in the delegation prompt (e.g., `Review Mode: society-of-thought`), use those values. When not provided, apply defaults shown above. In particular, if `Review Mode` is `society-of-thought` and no `Review Specialists` value is provided, default to `all` — do not select a subset.*
## Description
<PR description text or commit message summary>
## Flags
- [x/] CI Failures present
- [x/] Breaking changes suspected
## Artifacts
- [x/] ReviewContext.md - This file
- [x/] ResearchQuestions.md - Research questions for baseline analysis
- [x/] CodeResearch.md - Baseline understanding (paw-review-baseline)
- [x/] DerivedSpec.md - Derived specification
## Metadata
**Created**: <timestamp>
**Git Commit**: <current HEAD SHA>
**Reviewer**: <current git user>
**Analysis Tool**: PAW Review Understanding
---
date: <YYYY-MM-DD HH:MM:SS TZ>
git_commit: <head commit SHA>
branch: <head branch>
repository: <owner/repo OR local>
topic: "Derived Specification for <PR Title or Branch>"
tags: [review, specification, analysis]
status: complete
---
# Derived Specification: <PR Title or Branch>
## Intent Summary
<1-2 sentence summary of what this PR accomplishes>
## Explicit Goals (Stated in PR/Issues)
Goals explicitly mentioned in PR description, linked issues, or commit messages:
1. <Goal from PR description>
2. <Goal from linked issue #X>
*Source: PR description, Issue #X, commits <sha>...<sha>*
## Inferred Goals (Observed from Code)
Goals derived from code analysis that weren't explicitly stated:
1. <Observable behavior change with file:line reference>
2. <New functionality added with file:line reference>
*Source: Code analysis of changed files*
## Baseline Behavior (Pre-Change)
How the system worked before changes (from CodeResearch.md):
**Module**: `path/to/module.ext`
- **Before**: <behavior description>
- **Integration**: <connections to other components>
- **Patterns**: <conventions used>
*Source: CodeResearch.md at base commit <sha>*
## Observable Changes (Before → After)
### Changed Interfaces
| Component | Before | After | Breaking? |
|-----------|--------|-------|-----------|
| `module.func()` | params: (a, b) | params: (a, b, c) | Yes |
### Changed Behavior
**Feature**: <feature name>
- **Before**: <from CodeResearch.md>
- **After**: <from code analysis>
- **Impact**: <observable difference>
[file:line references for each claim]
## Scope Boundaries
**In Scope**: <What this PR changes>
**Out of Scope**: <What this PR does NOT change>
## Assumptions
<Document only when necessary to resolve ambiguity>
## Open Questions
**CRITICAL**: This section must be empty before completion.
## Discrepancies Flagged
[Only if conflicts exist]
**PR Description States**: <quote>
**Code Analysis Shows**: <evidence with file:line>
**Resolution**: [Pending | Resolved: <how>]
## References
- **ReviewContext.md**: Metadata and changed file summary
- **CodeResearch.md**: Pre-change baseline understanding
- **Commits**: <base-sha>..<head-sha>