@fro.bot/systematic 2.0.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agents/design/figma-design-sync.md +1 -1
- package/agents/document-review/coherence-reviewer.md +40 -0
- package/agents/document-review/design-lens-reviewer.md +46 -0
- package/agents/document-review/feasibility-reviewer.md +42 -0
- package/agents/document-review/product-lens-reviewer.md +50 -0
- package/agents/document-review/scope-guardian-reviewer.md +54 -0
- package/agents/document-review/security-lens-reviewer.md +38 -0
- package/agents/research/best-practices-researcher.md +2 -1
- package/agents/research/git-history-analyzer.md +1 -1
- package/agents/research/learnings-researcher.md +27 -26
- package/agents/research/repo-research-analyst.md +164 -9
- package/agents/review/api-contract-reviewer.md +49 -0
- package/agents/review/correctness-reviewer.md +49 -0
- package/agents/review/data-migrations-reviewer.md +53 -0
- package/agents/review/dhh-rails-reviewer.md +31 -52
- package/agents/review/julik-frontend-races-reviewer.md +27 -200
- package/agents/review/kieran-python-reviewer.md +29 -116
- package/agents/review/kieran-rails-reviewer.md +29 -98
- package/agents/review/kieran-typescript-reviewer.md +29 -107
- package/agents/review/maintainability-reviewer.md +49 -0
- package/agents/review/pattern-recognition-specialist.md +2 -1
- package/agents/review/performance-reviewer.md +51 -0
- package/agents/review/reliability-reviewer.md +49 -0
- package/agents/review/schema-drift-detector.md +12 -10
- package/agents/review/security-reviewer.md +51 -0
- package/agents/review/testing-reviewer.md +48 -0
- package/agents/workflow/pr-comment-resolver.md +99 -50
- package/agents/workflow/spec-flow-analyzer.md +60 -89
- package/dist/index.js +9 -0
- package/dist/lib/config-handler.d.ts +2 -0
- package/package.json +1 -1
- package/skills/agent-browser/SKILL.md +69 -48
- package/skills/ce-brainstorm/SKILL.md +2 -1
- package/skills/ce-compound/SKILL.md +126 -28
- package/skills/ce-compound-refresh/SKILL.md +181 -73
- package/skills/ce-ideate/SKILL.md +2 -1
- package/skills/ce-plan/SKILL.md +424 -414
- package/skills/ce-review/SKILL.md +379 -419
- package/skills/ce-review-beta/SKILL.md +506 -0
- package/skills/ce-review-beta/references/diff-scope.md +31 -0
- package/skills/ce-review-beta/references/findings-schema.json +128 -0
- package/skills/ce-review-beta/references/persona-catalog.md +50 -0
- package/skills/ce-review-beta/references/review-output-template.md +115 -0
- package/skills/ce-review-beta/references/subagent-template.md +56 -0
- package/skills/ce-work/SKILL.md +17 -8
- package/skills/ce-work-beta/SKILL.md +16 -9
- package/skills/claude-permissions-optimizer/SKILL.md +15 -14
- package/skills/claude-permissions-optimizer/scripts/extract-commands.mjs +9 -159
- package/skills/claude-permissions-optimizer/scripts/normalize.mjs +151 -0
- package/skills/deepen-plan/SKILL.md +348 -483
- package/skills/document-review/SKILL.md +160 -52
- package/skills/feature-video/SKILL.md +209 -178
- package/skills/file-todos/SKILL.md +72 -94
- package/skills/frontend-design/SKILL.md +243 -27
- package/skills/git-worktree/SKILL.md +37 -28
- package/skills/git-worktree/scripts/worktree-manager.sh +163 -0
- package/skills/lfg/SKILL.md +7 -7
- package/skills/orchestrating-swarms/SKILL.md +1 -1
- package/skills/reproduce-bug/SKILL.md +154 -60
- package/skills/resolve-pr-parallel/SKILL.md +19 -12
- package/skills/resolve-todo-parallel/SKILL.md +9 -6
- package/skills/setup/SKILL.md +8 -160
- package/skills/slfg/SKILL.md +11 -7
- package/skills/test-browser/SKILL.md +69 -145
- package/skills/test-xcode/SKILL.md +61 -183
- package/skills/triage/SKILL.md +10 -10
- package/skills/ce-plan-beta/SKILL.md +0 -571
- package/skills/deepen-plan-beta/SKILL.md +0 -323
|
@@ -1,560 +1,520 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ce:review
|
|
3
|
-
description:
|
|
4
|
-
argument-hint: '[PR number, GitHub URL, branch name
|
|
3
|
+
description: Structured code review using tiered persona agents, confidence-gated findings, and a merge/dedup pipeline. Use when reviewing code changes before creating a PR.
|
|
4
|
+
argument-hint: '[mode:autofix|mode:report-only] [PR number, GitHub URL, or branch name]'
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Review
|
|
7
|
+
# Code Review
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Reviews code changes using dynamically selected reviewer personas. Spawns parallel sub-agents that return structured JSON, then merges and deduplicates findings into a single report.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## When to Use
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
- Before creating a PR
|
|
14
|
+
- After completing a task during iterative implementation
|
|
15
|
+
- When feedback is needed on any code changes
|
|
16
|
+
- Can be invoked standalone
|
|
17
|
+
- Can run as a read-only or autofix review step inside larger workflows
|
|
14
18
|
|
|
15
|
-
##
|
|
19
|
+
## Mode Detection
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
- Git repository with GitHub CLI (`gh`) installed and authenticated
|
|
19
|
-
- Clean main/master branch
|
|
20
|
-
- Proper permissions to create worktrees and access the repository
|
|
21
|
-
- For document reviews: Path to a markdown file or document
|
|
22
|
-
</requirements>
|
|
21
|
+
Check `$ARGUMENTS` for `mode:autofix` or `mode:report-only`. If either token is present, strip it from the remaining arguments before interpreting the rest as the PR number, GitHub URL, or branch name.
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
| Mode | When | Behavior |
|
|
24
|
+
|------|------|----------|
|
|
25
|
+
| **Interactive** (default) | No mode token present | Review, present findings, ask for policy decisions when needed, and optionally continue into fix/push/PR next steps |
|
|
26
|
+
| **Autofix** | `mode:autofix` in arguments | No user interaction. Review, apply only policy-allowed `safe_auto` fixes, re-review in bounded rounds, write a run artifact, and emit residual downstream work when needed |
|
|
27
|
+
| **Report-only** | `mode:report-only` in arguments | Strictly read-only. Review and report only, then stop with no edits, artifacts, todos, commits, pushes, or PR actions |
|
|
25
28
|
|
|
26
|
-
###
|
|
29
|
+
### Autofix mode rules
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
- **Skip all user questions.** Never pause for approval or clarification once scope has been established.
|
|
32
|
+
- **Apply only `safe_auto -> review-fixer` findings.** Leave `gated_auto`, `manual`, `human`, and `release` work unresolved.
|
|
33
|
+
- **Write a run artifact** under `.context/systematic/ce-review/<run-id>/` summarizing findings, applied fixes, residual actionable work, and advisory outputs.
|
|
34
|
+
- **Create durable todo files only for unresolved actionable findings** whose final owner is `downstream-resolver`. Load the `todo-create` skill for the canonical directory path and naming convention.
|
|
35
|
+
- **Never commit, push, or create a PR** from autofix mode. Parent workflows own those decisions.
|
|
29
36
|
|
|
30
|
-
|
|
31
|
-
First, I need to determine the review target type and set up the code for analysis.
|
|
32
|
-
</thinking>
|
|
37
|
+
### Report-only mode rules
|
|
33
38
|
|
|
34
|
-
|
|
39
|
+
- **Skip all user questions.** Infer intent conservatively if the diff metadata is thin.
|
|
40
|
+
- **Never edit files or externalize work.** Do not write `.context/systematic/ce-review/<run-id>/`, do not create todo files, and do not commit, push, or create a PR.
|
|
41
|
+
- **Safe for parallel read-only verification.** `mode:report-only` is the only mode that is safe to run concurrently with browser testing on the same checkout.
|
|
42
|
+
- **Do not switch the shared checkout.** If the caller passes an explicit PR or branch target, `mode:report-only` must run in an isolated checkout/worktree or stop instead of running `gh pr checkout` / `git checkout`.
|
|
43
|
+
- **Do not overlap mutating review with browser testing on the same checkout.** If a future orchestrator wants fixes, run the mutating review phase after browser testing or in an isolated checkout/worktree.
|
|
35
44
|
|
|
36
|
-
|
|
45
|
+
## Severity Scale
|
|
37
46
|
|
|
38
|
-
|
|
39
|
-
- [ ] Check current git branch
|
|
40
|
-
- [ ] If ALREADY on the target branch (PR branch, requested branch name, or the branch already checked out for review) → proceed with analysis on current branch
|
|
41
|
-
- [ ] If DIFFERENT branch than the review target → offer to use worktree: "Use git-worktree skill for isolated Call `skill: git-worktree` with branch name"
|
|
42
|
-
- [ ] Fetch PR metadata using `gh pr view --json` for title, body, files, linked issues
|
|
43
|
-
- [ ] Set up language-specific analysis tools
|
|
44
|
-
- [ ] Prepare security scanning environment
|
|
45
|
-
- [ ] Make sure we are on the branch we are reviewing. Use gh pr checkout to switch to the branch or manually checkout the branch.
|
|
47
|
+
All reviewers use P0-P3:
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
| Level | Meaning | Action |
|
|
50
|
+
|-------|---------|--------|
|
|
51
|
+
| **P0** | Critical breakage, exploitable vulnerability, data loss/corruption | Must fix before merge |
|
|
52
|
+
| **P1** | High-impact defect likely hit in normal usage, breaking contract | Should fix |
|
|
53
|
+
| **P2** | Moderate issue with meaningful downside (edge case, perf regression, maintainability trap) | Fix if straightforward |
|
|
54
|
+
| **P3** | Low-impact, narrow scope, minor improvement | User's discretion |
|
|
48
55
|
|
|
49
|
-
|
|
56
|
+
## Action Routing
|
|
50
57
|
|
|
51
|
-
|
|
58
|
+
Severity answers **urgency**. Routing answers **who acts next** and **whether this skill may mutate the checkout**.
|
|
52
59
|
|
|
53
|
-
|
|
54
|
-
|
|
60
|
+
| `autofix_class` | Default owner | Meaning |
|
|
61
|
+
|-----------------|---------------|---------|
|
|
62
|
+
| `safe_auto` | `review-fixer` | Local, deterministic fix suitable for the in-skill fixer when the current mode allows mutation |
|
|
63
|
+
| `gated_auto` | `downstream-resolver` or `human` | Concrete fix exists, but it changes behavior, contracts, permissions, or another sensitive boundary that should not be auto-applied by default |
|
|
64
|
+
| `manual` | `downstream-resolver` or `human` | Actionable work that should be handed off rather than fixed in-skill |
|
|
65
|
+
| `advisory` | `human` or `release` | Report-only output such as learnings, rollout notes, or residual risk |
|
|
55
66
|
|
|
56
|
-
|
|
57
|
-
- `docs/plans/*.md` — Plan files created by `/ce:plan`. These are living documents that track implementation progress (checkboxes are checked off by `/ce:work`).
|
|
58
|
-
- `docs/solutions/*.md` — Solution documents created during the pipeline.
|
|
67
|
+
Routing rules:
|
|
59
68
|
|
|
60
|
-
|
|
61
|
-
|
|
69
|
+
- **Synthesis owns the final route.** Persona-provided routing metadata is input, not the last word.
|
|
70
|
+
- **Choose the more conservative route on disagreement.** A merged finding may move from `safe_auto` to `gated_auto` or `manual`, but never the other way without stronger evidence.
|
|
71
|
+
- **Only `safe_auto -> review-fixer` enters the in-skill fixer queue automatically.**
|
|
72
|
+
- **`requires_verification: true` means a fix is not complete without targeted tests, a focused re-review, or operational validation.**
|
|
62
73
|
|
|
63
|
-
|
|
74
|
+
## Reviewers
|
|
64
75
|
|
|
65
|
-
|
|
76
|
+
13 reviewer personas in layered conditionals, plus CE-specific agents. See [persona-catalog.md](./references/persona-catalog.md) for the full catalog.
|
|
66
77
|
|
|
67
|
-
|
|
78
|
+
**Always-on (every review):**
|
|
68
79
|
|
|
69
|
-
|
|
80
|
+
| Agent | Focus |
|
|
81
|
+
|-------|-------|
|
|
82
|
+
| `systematic:review:correctness-reviewer` | Logic errors, edge cases, state bugs, error propagation |
|
|
83
|
+
| `systematic:review:testing-reviewer` | Coverage gaps, weak assertions, brittle tests |
|
|
84
|
+
| `systematic:review:maintainability-reviewer` | Coupling, complexity, naming, dead code, abstraction debt |
|
|
85
|
+
| `systematic:review:agent-native-reviewer` | Verify new features are agent-accessible |
|
|
86
|
+
| `systematic:research:learnings-researcher` | Search docs/solutions/ for past issues related to this PR |
|
|
70
87
|
|
|
71
|
-
|
|
88
|
+
**Cross-cutting conditional (selected per diff):**
|
|
72
89
|
|
|
73
|
-
|
|
90
|
+
| Agent | Select when diff touches... |
|
|
91
|
+
|-------|---------------------------|
|
|
92
|
+
| `systematic:review:security-reviewer` | Auth, public endpoints, user input, permissions |
|
|
93
|
+
| `systematic:review:performance-reviewer` | DB queries, data transforms, caching, async |
|
|
94
|
+
| `systematic:review:api-contract-reviewer` | Routes, serializers, type signatures, versioning |
|
|
95
|
+
| `systematic:review:data-migrations-reviewer` | Migrations, schema changes, backfills |
|
|
96
|
+
| `systematic:review:reliability-reviewer` | Error handling, retries, timeouts, background jobs |
|
|
74
97
|
|
|
75
|
-
**
|
|
98
|
+
**Stack-specific conditional (selected per diff):**
|
|
76
99
|
|
|
77
|
-
|
|
100
|
+
| Agent | Select when diff touches... |
|
|
101
|
+
|-------|---------------------------|
|
|
102
|
+
| `systematic:review:dhh-rails-reviewer` | Rails architecture, service objects, session/auth choices, or Hotwire-vs-SPA boundaries |
|
|
103
|
+
| `systematic:review:kieran-rails-reviewer` | Rails application code where conventions, naming, and maintainability are in play |
|
|
104
|
+
| `systematic:review:kieran-python-reviewer` | Python modules, endpoints, scripts, or services |
|
|
105
|
+
| `systematic:review:kieran-typescript-reviewer` | TypeScript components, services, hooks, utilities, or shared types |
|
|
106
|
+
| `systematic:review:julik-frontend-races-reviewer` | Stimulus/Turbo controllers, DOM events, timers, animations, or async UI flows |
|
|
78
107
|
|
|
79
|
-
**
|
|
108
|
+
**CE conditional (migration-specific):**
|
|
80
109
|
|
|
81
|
-
|
|
110
|
+
| Agent | Select when diff includes migration files |
|
|
111
|
+
|-------|------------------------------------------|
|
|
112
|
+
| `systematic:review:schema-drift-detector` | Cross-references schema.rb against included migrations |
|
|
113
|
+
| `systematic:review:deployment-verification-agent` | Produces deployment checklist with SQL verification queries |
|
|
82
114
|
|
|
83
|
-
|
|
84
|
-
"Running review agents in serial mode (6+ agents configured). Use --parallel to override."
|
|
115
|
+
## Review Scope
|
|
85
116
|
|
|
86
|
-
|
|
117
|
+
Every review spawns all 3 always-on personas plus the 2 CE always-on agents, then adds whichever cross-cutting and stack-specific conditionals fit the diff. The model naturally right-sizes: a small config change triggers 0 conditionals = 5 reviewers. A Rails auth feature might trigger security + reliability + kieran-rails + dhh-rails = 9 reviewers.
|
|
87
118
|
|
|
88
|
-
|
|
119
|
+
## Protected Artifacts
|
|
89
120
|
|
|
90
|
-
|
|
121
|
+
The following paths are systematic pipeline artifacts and must never be flagged for deletion, removal, or gitignore by any reviewer:
|
|
91
122
|
|
|
92
|
-
|
|
123
|
+
- `docs/brainstorms/*` -- requirements documents created by ce:brainstorm
|
|
124
|
+
- `docs/plans/*.md` -- plan files created by ce:plan (living documents with progress checkboxes)
|
|
125
|
+
- `docs/solutions/*.md` -- solution documents created during the pipeline
|
|
93
126
|
|
|
94
|
-
|
|
127
|
+
If a reviewer flags any file in these directories for cleanup or removal, discard that finding during synthesis.
|
|
95
128
|
|
|
96
|
-
|
|
97
|
-
Task {agent-name}(PR content + review context from settings body)
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
**Serial mode (--serial flag, or auto for 6+ agents):**
|
|
101
|
-
|
|
102
|
-
Run configured review agents ONE AT A TIME. For each agent in the `review_agents` list, wait for it to complete before starting the next:
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
For each agent in review_agents:
|
|
106
|
-
1. Task {agent-name}(PR content + review context)
|
|
107
|
-
2. Wait for completion
|
|
108
|
-
3. Collect findings
|
|
109
|
-
4. Proceed to next agent
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
Always run these last regardless of mode:
|
|
113
|
-
- task systematic:review:agent-native-reviewer(PR content) - Verify new features are agent-accessible
|
|
114
|
-
- task systematic:research:learnings-researcher(PR content) - Search docs/solutions/ for past issues related to this PR's modules and patterns
|
|
115
|
-
|
|
116
|
-
</parallel_tasks>
|
|
117
|
-
|
|
118
|
-
#### Conditional Agents (Run if applicable):
|
|
119
|
-
|
|
120
|
-
<conditional_agents>
|
|
121
|
-
|
|
122
|
-
These agents are run ONLY when the PR matches specific criteria. Check the PR files list to determine if they apply:
|
|
123
|
-
|
|
124
|
-
**MIGRATIONS: If PR contains database migrations, schema.rb, or data backfills:**
|
|
125
|
-
|
|
126
|
-
- task systematic:review:schema-drift-detector(PR content) - Detects unrelated schema.rb changes by cross-referencing against included migrations (run FIRST)
|
|
127
|
-
- task systematic:review:data-migration-expert(PR content) - Validates ID mappings match production, checks for swapped values, verifies rollback safety
|
|
128
|
-
- task systematic:review:deployment-verification-agent(PR content) - Creates Go/No-Go deployment checklist with SQL verification queries
|
|
129
|
-
|
|
130
|
-
**When to run:**
|
|
131
|
-
- PR includes files matching `db/migrate/*.rb` or `db/schema.rb`
|
|
132
|
-
- PR modifies columns that store IDs, enums, or mappings
|
|
133
|
-
- PR includes data backfill scripts or rake tasks
|
|
134
|
-
- PR title/body mentions: migration, backfill, data transformation, ID mapping
|
|
135
|
-
|
|
136
|
-
**What these agents check:**
|
|
137
|
-
- `schema-drift-detector`: Cross-references schema.rb changes against PR migrations to catch unrelated columns/indexes from local database state
|
|
138
|
-
- `data-migration-expert`: Verifies hard-coded mappings match production reality (prevents swapped IDs), checks for orphaned associations, validates dual-write patterns
|
|
139
|
-
- `deployment-verification-agent`: Produces executable pre/post-deploy checklists with SQL queries, rollback procedures, and monitoring plans
|
|
140
|
-
|
|
141
|
-
</conditional_agents>
|
|
142
|
-
|
|
143
|
-
### 2. Ultra-Thinking Deep Dive Phases
|
|
144
|
-
|
|
145
|
-
<ultrathink_instruction> For each phase below, spend maximum cognitive effort. Think step by step. Consider all angles. Question assumptions. And bring all reviews in a synthesis to the user.</ultrathink_instruction>
|
|
146
|
-
|
|
147
|
-
<deliverable>
|
|
148
|
-
Complete system context map with component interactions
|
|
149
|
-
</deliverable>
|
|
150
|
-
|
|
151
|
-
#### Phase 1: Stakeholder Perspective Analysis
|
|
152
|
-
|
|
153
|
-
<thinking_prompt> ULTRA-THINK: Put yourself in each stakeholder's shoes. What matters to them? What are their pain points? </thinking_prompt>
|
|
154
|
-
|
|
155
|
-
<stakeholder_perspectives>
|
|
156
|
-
|
|
157
|
-
1. **Developer Perspective** <questions>
|
|
158
|
-
|
|
159
|
-
- How easy is this to understand and modify?
|
|
160
|
-
- Are the APIs intuitive?
|
|
161
|
-
- Is debugging straightforward?
|
|
162
|
-
- Can I test this easily? </questions>
|
|
163
|
-
|
|
164
|
-
2. **Operations Perspective** <questions>
|
|
165
|
-
|
|
166
|
-
- How do I deploy this safely?
|
|
167
|
-
- What metrics and logs are available?
|
|
168
|
-
- How do I troubleshoot issues?
|
|
169
|
-
- What are the resource requirements? </questions>
|
|
170
|
-
|
|
171
|
-
3. **End User Perspective** <questions>
|
|
172
|
-
|
|
173
|
-
- Is the feature intuitive?
|
|
174
|
-
- Are error messages helpful?
|
|
175
|
-
- Is performance acceptable?
|
|
176
|
-
- Does it solve my problem? </questions>
|
|
177
|
-
|
|
178
|
-
4. **Security Team Perspective** <questions>
|
|
179
|
-
|
|
180
|
-
- What's the attack surface?
|
|
181
|
-
- Are there compliance requirements?
|
|
182
|
-
- How is data protected?
|
|
183
|
-
- What are the audit capabilities? </questions>
|
|
184
|
-
|
|
185
|
-
5. **Business Perspective** <questions>
|
|
186
|
-
- What's the ROI?
|
|
187
|
-
- Are there legal/compliance risks?
|
|
188
|
-
- How does this affect time-to-market?
|
|
189
|
-
- What's the total cost of ownership? </questions> </stakeholder_perspectives>
|
|
190
|
-
|
|
191
|
-
#### Phase 2: Scenario Exploration
|
|
192
|
-
|
|
193
|
-
<thinking_prompt> ULTRA-THINK: Explore edge cases and failure scenarios. What could go wrong? How does the system behave under stress? </thinking_prompt>
|
|
194
|
-
|
|
195
|
-
<scenario_checklist>
|
|
196
|
-
|
|
197
|
-
- [ ] **Happy Path**: Normal operation with valid inputs
|
|
198
|
-
- [ ] **Invalid Inputs**: Null, empty, malformed data
|
|
199
|
-
- [ ] **Boundary Conditions**: Min/max values, empty collections
|
|
200
|
-
- [ ] **Concurrent Access**: Race conditions, deadlocks
|
|
201
|
-
- [ ] **Scale Testing**: 10x, 100x, 1000x normal load
|
|
202
|
-
- [ ] **Network Issues**: Timeouts, partial failures
|
|
203
|
-
- [ ] **Resource Exhaustion**: Memory, disk, connections
|
|
204
|
-
- [ ] **Security Attacks**: Injection, overflow, DoS
|
|
205
|
-
- [ ] **Data Corruption**: Partial writes, inconsistency
|
|
206
|
-
- [ ] **Cascading Failures**: Downstream service issues </scenario_checklist>
|
|
207
|
-
|
|
208
|
-
### 3. Multi-Angle Review Perspectives
|
|
209
|
-
|
|
210
|
-
#### Technical Excellence Angle
|
|
129
|
+
## How to Run
|
|
211
130
|
|
|
212
|
-
|
|
213
|
-
- Engineering best practices
|
|
214
|
-
- Technical documentation quality
|
|
215
|
-
- Tooling and automation assessment
|
|
131
|
+
### Stage 1: Determine scope
|
|
216
132
|
|
|
217
|
-
|
|
133
|
+
Compute the diff range, file list, and diff. Minimize permission prompts by combining into as few commands as possible.
|
|
218
134
|
|
|
219
|
-
|
|
220
|
-
- Performance impact on users
|
|
221
|
-
- Cost-benefit analysis
|
|
222
|
-
- Time-to-market considerations
|
|
135
|
+
**If a PR number or GitHub URL is provided as an argument:**
|
|
223
136
|
|
|
224
|
-
|
|
137
|
+
If `mode:report-only` is active, do **not** run `gh pr checkout <number-or-url>` on the shared checkout. Tell the caller: "mode:report-only cannot switch the shared checkout to review a PR target. Run it from an isolated worktree/checkout for that PR, or run report-only with no target argument on the already checked out branch." Stop here unless the review is already running in an isolated checkout.
|
|
225
138
|
|
|
226
|
-
|
|
227
|
-
- Operational risk evaluation
|
|
228
|
-
- Compliance risk verification
|
|
229
|
-
- Technical debt accumulation
|
|
139
|
+
First, verify the worktree is clean before switching branches:
|
|
230
140
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
- Knowledge sharing effectiveness
|
|
235
|
-
- Collaboration patterns
|
|
236
|
-
- Mentoring opportunities
|
|
237
|
-
|
|
238
|
-
### 4. Simplification and Minimalism Review
|
|
141
|
+
```
|
|
142
|
+
git status --porcelain
|
|
143
|
+
```
|
|
239
144
|
|
|
240
|
-
|
|
145
|
+
If the output is non-empty, inform the user: "You have uncommitted changes on the current branch. Stash or commit them before reviewing a PR, or use standalone mode (no argument) to review the current branch as-is." Do not proceed with checkout until the worktree is clean.
|
|
241
146
|
|
|
242
|
-
|
|
147
|
+
Then check out the PR branch so persona agents can read the actual code (not the current checkout):
|
|
243
148
|
|
|
244
|
-
|
|
149
|
+
```
|
|
150
|
+
gh pr checkout <number-or-url>
|
|
151
|
+
```
|
|
245
152
|
|
|
246
|
-
|
|
153
|
+
Then fetch PR metadata. Capture the base branch name and the PR base repository identity, not just the branch name:
|
|
247
154
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
</thinking>
|
|
155
|
+
```
|
|
156
|
+
gh pr view <number-or-url> --json title,body,baseRefName,headRefName,url
|
|
157
|
+
```
|
|
252
158
|
|
|
253
|
-
|
|
159
|
+
Use the repository portion of the returned PR URL as `<base-repo>` (for example, `marcusrbrown/systematic` from `https://github.com/marcusrbrown/systematic/pull/348`).
|
|
254
160
|
|
|
255
|
-
-
|
|
256
|
-
- [ ] Surface learnings-researcher results: if past solutions are relevant, flag them as "Known Pattern" with links to docs/solutions/ files
|
|
257
|
-
- [ ] Discard any findings that recommend deleting or gitignoring files in `docs/brainstorms/`, `docs/plans/`, or `docs/solutions/` (see Protected Artifacts above)
|
|
258
|
-
- [ ] Categorize by type: security, performance, architecture, quality, etc.
|
|
259
|
-
- [ ] Assign severity levels: 🔴 CRITICAL (P1), 🟡 IMPORTANT (P2), 🔵 NICE-TO-HAVE (P3)
|
|
260
|
-
- [ ] Remove duplicate or overlapping findings
|
|
261
|
-
- [ ] Estimate effort for each finding (Small/Medium/Large)
|
|
161
|
+
Then compute a local diff against the PR's base branch so re-reviews also include local fix commits and uncommitted edits. Substitute the PR base branch from metadata (shown here as `<base>`) and the PR base repository identity derived from the PR URL (shown here as `<base-repo>`). Resolve the base ref from the PR's actual base repository, not by assuming `origin` points at that repo:
|
|
262
162
|
|
|
263
|
-
|
|
163
|
+
```
|
|
164
|
+
PR_BASE_REMOTE=$(git remote -v | awk 'index($2, "github.com:<base-repo>") || index($2, "github.com/<base-repo>") {print $1; exit}')
|
|
165
|
+
if [ -n "$PR_BASE_REMOTE" ]; then PR_BASE_REMOTE_REF="$PR_BASE_REMOTE/<base>"; else PR_BASE_REMOTE_REF=""; fi
|
|
166
|
+
PR_BASE_REF=$(git rev-parse --verify "$PR_BASE_REMOTE_REF" 2>/dev/null || git rev-parse --verify <base> 2>/dev/null || true)
|
|
167
|
+
if [ -z "$PR_BASE_REF" ]; then
|
|
168
|
+
if [ -n "$PR_BASE_REMOTE_REF" ]; then
|
|
169
|
+
git fetch --no-tags "$PR_BASE_REMOTE" <base>:refs/remotes/"$PR_BASE_REMOTE"/<base> 2>/dev/null || git fetch --no-tags "$PR_BASE_REMOTE" <base> 2>/dev/null || true
|
|
170
|
+
PR_BASE_REF=$(git rev-parse --verify "$PR_BASE_REMOTE_REF" 2>/dev/null || git rev-parse --verify <base> 2>/dev/null || true)
|
|
171
|
+
else
|
|
172
|
+
if git fetch --no-tags https://github.com/<base-repo>.git <base> 2>/dev/null; then
|
|
173
|
+
PR_BASE_REF=$(git rev-parse --verify FETCH_HEAD 2>/dev/null || true)
|
|
174
|
+
fi
|
|
175
|
+
if [ -z "$PR_BASE_REF" ]; then PR_BASE_REF=$(git rev-parse --verify <base> 2>/dev/null || true); fi
|
|
176
|
+
fi
|
|
177
|
+
fi
|
|
178
|
+
if [ -n "$PR_BASE_REF" ]; then BASE=$(git merge-base HEAD "$PR_BASE_REF" 2>/dev/null) || BASE=""; else BASE=""; fi
|
|
179
|
+
```
|
|
264
180
|
|
|
265
|
-
|
|
181
|
+
```
|
|
182
|
+
if [ -n "$BASE" ]; then echo "BASE:$BASE" && echo "FILES:" && git diff --name-only $BASE && echo "DIFF:" && git diff -U10 $BASE && echo "UNTRACKED:" && git ls-files --others --exclude-standard; else echo "ERROR: Unable to resolve PR base branch <base> locally. Fetch the base branch and rerun so the review scope stays aligned with the PR."; fi
|
|
183
|
+
```
|
|
266
184
|
|
|
267
|
-
|
|
185
|
+
Extract PR title/body, base branch, and PR URL from `gh pr view`, then extract the base marker, file list, diff content, and `UNTRACKED:` list from the local command. Do not use `gh pr diff` as the review scope after checkout -- it only reflects the remote PR state and will miss local fix commits until they are pushed. If the base ref still cannot be resolved from the PR's actual base repository after the fetch attempt, stop instead of falling back to `git diff HEAD`; a PR review without the PR base branch is incomplete.
|
|
268
186
|
|
|
269
|
-
**
|
|
187
|
+
**If a branch name is provided as an argument:**
|
|
270
188
|
|
|
271
|
-
|
|
189
|
+
Check out the named branch, then diff it against the base branch. Substitute the provided branch name (shown here as `<branch>`).
|
|
272
190
|
|
|
273
|
-
-
|
|
274
|
-
- All findings in parallel for speed
|
|
275
|
-
- Use standard template from `.opencode/skills/file-todos/assets/todo-template.md`
|
|
276
|
-
- Follow naming convention: `{issue_id}-pending-{priority}-{description}.md`
|
|
191
|
+
If `mode:report-only` is active, do **not** run `git checkout <branch>` on the shared checkout. Tell the caller: "mode:report-only cannot switch the shared checkout to review another branch. Run it from an isolated worktree/checkout for `<branch>`, or run report-only on the current checkout with no target argument." Stop here unless the review is already running in an isolated checkout.
|
|
277
192
|
|
|
278
|
-
|
|
193
|
+
First, verify the worktree is clean before switching branches:
|
|
279
194
|
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
task() - Create todos for first finding
|
|
283
|
-
task() - Create todos for second finding
|
|
284
|
-
task() - Create todos for third finding
|
|
285
|
-
etc. for each finding.
|
|
195
|
+
```
|
|
196
|
+
git status --porcelain
|
|
286
197
|
```
|
|
287
198
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
- Process multiple findings simultaneously
|
|
291
|
-
- Write detailed todo files with all sections filled
|
|
292
|
-
- Organize findings by severity
|
|
293
|
-
- Create comprehensive Proposed Solutions
|
|
294
|
-
- Add acceptance criteria and work logs
|
|
295
|
-
- Complete much faster than sequential processing
|
|
199
|
+
If the output is non-empty, inform the user: "You have uncommitted changes on the current branch. Stash or commit them before reviewing another branch, or provide a PR number instead." Do not proceed with checkout until the worktree is clean.
|
|
296
200
|
|
|
297
|
-
|
|
201
|
+
```
|
|
202
|
+
git checkout <branch>
|
|
203
|
+
```
|
|
298
204
|
|
|
299
|
-
|
|
300
|
-
2. Group findings by severity
|
|
301
|
-
3. Launch 3 parallel sub-agents (one per severity level)
|
|
302
|
-
4. Each sub-agent creates its batch of todos using the file-todos skill
|
|
303
|
-
5. Consolidate results and present summary
|
|
205
|
+
Then detect the review base branch before computing the merge-base. When the branch has an open PR, resolve the base ref from the PR's actual base repository (not just `origin`), mirroring the PR-mode logic for fork safety. Fall back to `origin/HEAD`, GitHub metadata, then common branch names:
|
|
304
206
|
|
|
305
|
-
|
|
207
|
+
```
|
|
208
|
+
REVIEW_BASE_BRANCH=""
|
|
209
|
+
PR_BASE_REPO=""
|
|
210
|
+
if command -v gh >/dev/null 2>&1; then
|
|
211
|
+
PR_META=$(gh pr view --json baseRefName,url 2>/dev/null || true)
|
|
212
|
+
if [ -n "$PR_META" ]; then
|
|
213
|
+
REVIEW_BASE_BRANCH=$(echo "$PR_META" | jq -r '.baseRefName // empty')
|
|
214
|
+
PR_BASE_REPO=$(echo "$PR_META" | jq -r '.url // empty' | sed -n 's#https://github.com/\([^/]*/[^/]*\)/pull/.*#\1#p')
|
|
215
|
+
fi
|
|
216
|
+
fi
|
|
217
|
+
if [ -z "$REVIEW_BASE_BRANCH" ]; then REVIEW_BASE_BRANCH=$(git symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null | sed 's#^origin/##'); fi
|
|
218
|
+
if [ -z "$REVIEW_BASE_BRANCH" ] && command -v gh >/dev/null 2>&1; then REVIEW_BASE_BRANCH=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name' 2>/dev/null); fi
|
|
219
|
+
if [ -z "$REVIEW_BASE_BRANCH" ]; then
|
|
220
|
+
for candidate in main master develop trunk; do
|
|
221
|
+
if git rev-parse --verify "origin/$candidate" >/dev/null 2>&1 || git rev-parse --verify "$candidate" >/dev/null 2>&1; then
|
|
222
|
+
REVIEW_BASE_BRANCH="$candidate"
|
|
223
|
+
break
|
|
224
|
+
fi
|
|
225
|
+
done
|
|
226
|
+
fi
|
|
227
|
+
if [ -n "$REVIEW_BASE_BRANCH" ]; then
|
|
228
|
+
if [ -n "$PR_BASE_REPO" ]; then
|
|
229
|
+
PR_BASE_REMOTE=$(git remote -v | awk "index(\$2, \"github.com:$PR_BASE_REPO\") || index(\$2, \"github.com/$PR_BASE_REPO\") {print \$1; exit}")
|
|
230
|
+
if [ -n "$PR_BASE_REMOTE" ]; then
|
|
231
|
+
git rev-parse --verify "$PR_BASE_REMOTE/$REVIEW_BASE_BRANCH" >/dev/null 2>&1 || git fetch --no-tags "$PR_BASE_REMOTE" "$REVIEW_BASE_BRANCH" 2>/dev/null || true
|
|
232
|
+
BASE_REF=$(git rev-parse --verify "$PR_BASE_REMOTE/$REVIEW_BASE_BRANCH" 2>/dev/null || true)
|
|
233
|
+
fi
|
|
234
|
+
fi
|
|
235
|
+
if [ -z "$BASE_REF" ]; then
|
|
236
|
+
git rev-parse --verify "origin/$REVIEW_BASE_BRANCH" >/dev/null 2>&1 || git fetch --no-tags origin "$REVIEW_BASE_BRANCH" 2>/dev/null || true
|
|
237
|
+
BASE_REF=$(git rev-parse --verify "origin/$REVIEW_BASE_BRANCH" 2>/dev/null || git rev-parse --verify "$REVIEW_BASE_BRANCH" 2>/dev/null || true)
|
|
238
|
+
fi
|
|
239
|
+
if [ -n "$BASE_REF" ]; then BASE=$(git merge-base HEAD "$BASE_REF" 2>/dev/null) || BASE=""; else BASE=""; fi
|
|
240
|
+
else BASE=""; fi
|
|
241
|
+
```
|
|
306
242
|
|
|
307
|
-
|
|
243
|
+
```
|
|
244
|
+
if [ -n "$BASE" ]; then echo "BASE:$BASE" && echo "FILES:" && git diff --name-only $BASE && echo "DIFF:" && git diff -U10 $BASE && echo "UNTRACKED:" && git ls-files --others --exclude-standard; else echo "ERROR: Unable to resolve review base branch locally. Fetch the base branch and rerun, or provide a PR number so the review scope can be determined from PR metadata."; fi
|
|
245
|
+
```
|
|
308
246
|
|
|
309
|
-
|
|
310
|
-
- Write detailed Problem Statement and Findings
|
|
311
|
-
- Create 2-3 Proposed Solutions with pros/cons/effort/risk
|
|
312
|
-
- Estimate effort (Small/Medium/Large)
|
|
313
|
-
- Add acceptance criteria and work log
|
|
247
|
+
If the branch has an open PR, the detection above uses the PR's base repository to resolve the merge-base, which handles fork workflows correctly. You may still fetch additional PR metadata with `gh pr view` for title, body, and linked issues, but do not fail if no PR exists. If the base branch still cannot be resolved after the detection and fetch attempts, stop instead of falling back to `git diff HEAD`; a branch review without the base branch would only show uncommitted changes and silently miss all committed work.
|
|
314
248
|
|
|
315
|
-
|
|
249
|
+
**If no argument (standalone on current branch):**
|
|
316
250
|
|
|
317
|
-
|
|
318
|
-
skill: file-todos
|
|
319
|
-
```
|
|
251
|
+
Detect the review base branch before computing the merge-base. When the current branch has an open PR, resolve the base ref from the PR's actual base repository (not just `origin`), mirroring the PR-mode logic for fork safety. Fall back to `origin/HEAD`, GitHub metadata, then common branch names:
|
|
320
252
|
|
|
321
|
-
|
|
253
|
+
```
|
|
254
|
+
REVIEW_BASE_BRANCH=""
|
|
255
|
+
PR_BASE_REPO=""
|
|
256
|
+
if command -v gh >/dev/null 2>&1; then
|
|
257
|
+
PR_META=$(gh pr view --json baseRefName,url 2>/dev/null || true)
|
|
258
|
+
if [ -n "$PR_META" ]; then
|
|
259
|
+
REVIEW_BASE_BRANCH=$(echo "$PR_META" | jq -r '.baseRefName // empty')
|
|
260
|
+
PR_BASE_REPO=$(echo "$PR_META" | jq -r '.url // empty' | sed -n 's#https://github.com/\([^/]*/[^/]*\)/pull/.*#\1#p')
|
|
261
|
+
fi
|
|
262
|
+
fi
|
|
263
|
+
if [ -z "$REVIEW_BASE_BRANCH" ]; then REVIEW_BASE_BRANCH=$(git symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null | sed 's#^origin/##'); fi
|
|
264
|
+
if [ -z "$REVIEW_BASE_BRANCH" ] && command -v gh >/dev/null 2>&1; then REVIEW_BASE_BRANCH=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name' 2>/dev/null); fi
|
|
265
|
+
if [ -z "$REVIEW_BASE_BRANCH" ]; then
|
|
266
|
+
for candidate in main master develop trunk; do
|
|
267
|
+
if git rev-parse --verify "origin/$candidate" >/dev/null 2>&1 || git rev-parse --verify "$candidate" >/dev/null 2>&1; then
|
|
268
|
+
REVIEW_BASE_BRANCH="$candidate"
|
|
269
|
+
break
|
|
270
|
+
fi
|
|
271
|
+
done
|
|
272
|
+
fi
|
|
273
|
+
if [ -n "$REVIEW_BASE_BRANCH" ]; then
|
|
274
|
+
if [ -n "$PR_BASE_REPO" ]; then
|
|
275
|
+
PR_BASE_REMOTE=$(git remote -v | awk "index(\$2, \"github.com:$PR_BASE_REPO\") || index(\$2, \"github.com/$PR_BASE_REPO\") {print \$1; exit}")
|
|
276
|
+
if [ -n "$PR_BASE_REMOTE" ]; then
|
|
277
|
+
git rev-parse --verify "$PR_BASE_REMOTE/$REVIEW_BASE_BRANCH" >/dev/null 2>&1 || git fetch --no-tags "$PR_BASE_REMOTE" "$REVIEW_BASE_BRANCH" 2>/dev/null || true
|
|
278
|
+
BASE_REF=$(git rev-parse --verify "$PR_BASE_REMOTE/$REVIEW_BASE_BRANCH" 2>/dev/null || true)
|
|
279
|
+
fi
|
|
280
|
+
fi
|
|
281
|
+
if [ -z "$BASE_REF" ]; then
|
|
282
|
+
git rev-parse --verify "origin/$REVIEW_BASE_BRANCH" >/dev/null 2>&1 || git fetch --no-tags origin "$REVIEW_BASE_BRANCH" 2>/dev/null || true
|
|
283
|
+
BASE_REF=$(git rev-parse --verify "origin/$REVIEW_BASE_BRANCH" 2>/dev/null || git rev-parse --verify "$REVIEW_BASE_BRANCH" 2>/dev/null || true)
|
|
284
|
+
fi
|
|
285
|
+
if [ -n "$BASE_REF" ]; then BASE=$(git merge-base HEAD "$BASE_REF" 2>/dev/null) || BASE=""; else BASE=""; fi
|
|
286
|
+
else BASE=""; fi
|
|
287
|
+
```
|
|
322
288
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
- All required sections: Problem Statement, Findings, Solutions, etc.
|
|
289
|
+
```
|
|
290
|
+
if [ -n "$BASE" ]; then echo "BASE:$BASE" && echo "FILES:" && git diff --name-only $BASE && echo "DIFF:" && git diff -U10 $BASE && echo "UNTRACKED:" && git ls-files --others --exclude-standard; else echo "ERROR: Unable to resolve review base branch locally. Fetch the base branch and rerun, or provide a PR number so the review scope can be determined from PR metadata."; fi
|
|
291
|
+
```
|
|
327
292
|
|
|
328
|
-
|
|
293
|
+
Parse: `BASE:` = merge-base SHA, `FILES:` = file list, `DIFF:` = diff, `UNTRACKED:` = files excluded from review scope because they are not staged. Using `git diff $BASE` (without `..HEAD`) diffs the merge-base against the working tree, which includes committed, staged, and unstaged changes together. If the base branch cannot be resolved after the detection and fetch attempts, stop instead of falling back to `git diff HEAD`; a standalone review without the base branch would only show uncommitted changes and silently miss all committed work on the branch.
|
|
329
294
|
|
|
330
|
-
|
|
331
|
-
{next_id}-pending-{priority}-{description}.md
|
|
332
|
-
```
|
|
295
|
+
**Untracked file handling:** Always inspect the `UNTRACKED:` list, even when `FILES:`/`DIFF:` are non-empty. Untracked files are outside review scope until staged. If the list is non-empty, tell the user which files are excluded. If any of them should be reviewed, stop and tell the user to `git add` them first and rerun. Only continue when the user is intentionally reviewing tracked changes only.
|
|
333
296
|
|
|
334
|
-
|
|
297
|
+
### Stage 2: Intent discovery
|
|
335
298
|
|
|
336
|
-
|
|
337
|
-
001-pending-p1-path-traversal-vulnerability.md
|
|
338
|
-
002-pending-p1-api-response-validation.md
|
|
339
|
-
003-pending-p2-concurrency-limit.md
|
|
340
|
-
004-pending-p3-unused-parameter.md
|
|
341
|
-
```
|
|
299
|
+
Understand what the change is trying to accomplish. The source of intent depends on which Stage 1 path was taken:
|
|
342
300
|
|
|
343
|
-
|
|
301
|
+
**PR/URL mode:** Use the PR title, body, and linked issues from `gh pr view` metadata. Supplement with commit messages from the PR if the body is sparse.
|
|
344
302
|
|
|
345
|
-
**
|
|
303
|
+
**Branch mode:** Run `git log --oneline ${BASE}..<branch>` using the resolved merge-base from Stage 1.
|
|
346
304
|
|
|
347
|
-
|
|
305
|
+
**Standalone (current branch):** Run:
|
|
348
306
|
|
|
349
|
-
|
|
350
|
-
-
|
|
351
|
-
|
|
352
|
-
- **Proposed Solutions**: 2-3 options, each with pros/cons/effort/risk
|
|
353
|
-
- **Recommended Action**: (Filled during triage, leave blank initially)
|
|
354
|
-
- **Technical Details**: Affected files, components, database changes
|
|
355
|
-
- **Acceptance Criteria**: Testable checklist items
|
|
356
|
-
- **Work Log**: Dated record with actions and learnings
|
|
357
|
-
- **Resources**: Links to PR, issues, documentation, similar patterns
|
|
307
|
+
```
|
|
308
|
+
echo "BRANCH:" && git rev-parse --abbrev-ref HEAD && echo "COMMITS:" && git log --oneline ${BASE}..HEAD
|
|
309
|
+
```
|
|
358
310
|
|
|
359
|
-
|
|
311
|
+
Combined with conversation context (plan section summary, PR description, caller-provided description), write a 2-3 line intent summary:
|
|
360
312
|
|
|
361
313
|
```
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
Examples:
|
|
365
|
-
- 001-pending-p1-security-vulnerability.md
|
|
366
|
-
- 002-pending-p2-performance-optimization.md
|
|
367
|
-
- 003-pending-p3-code-cleanup.md
|
|
314
|
+
Intent: Simplify tax calculation by replacing the multi-tier rate lookup
|
|
315
|
+
with a flat-rate computation. Must not regress edge cases in tax-exempt handling.
|
|
368
316
|
```
|
|
369
317
|
|
|
370
|
-
|
|
318
|
+
Pass this to every reviewer in their spawn prompt. Intent shapes *how hard each reviewer looks*, not which reviewers are selected.
|
|
371
319
|
|
|
372
|
-
|
|
373
|
-
- `ready` - Approved by manager, ready to work
|
|
374
|
-
- `complete` - Work finished
|
|
320
|
+
**When intent is ambiguous:**
|
|
375
321
|
|
|
376
|
-
**
|
|
322
|
+
- **Interactive mode:** Ask one question using the platform's interactive question tool (question in OpenCode, request_user_input in Codex): "What is the primary goal of these changes?" Do not spawn reviewers until intent is established.
|
|
323
|
+
- **Autofix/report-only modes:** Infer intent conservatively from the branch name, diff, PR metadata, and caller context. Note the uncertainty in Coverage or Verdict reasoning instead of blocking.
|
|
377
324
|
|
|
378
|
-
|
|
379
|
-
- `p2` - Important (should fix, architectural/performance)
|
|
380
|
-
- `p3` - Nice-to-have (enhancements, cleanup)
|
|
325
|
+
### Stage 3: Select reviewers
|
|
381
326
|
|
|
382
|
-
|
|
327
|
+
Read the diff and file list from Stage 1. The 3 always-on personas and 2 CE always-on agents are automatic. For each cross-cutting and stack-specific conditional persona in [persona-catalog.md](./references/persona-catalog.md), decide whether the diff warrants it. This is agent judgment, not keyword matching.
|
|
383
328
|
|
|
384
|
-
|
|
329
|
+
Stack-specific personas are additive. A Rails UI change may warrant `kieran-rails` plus `julik-frontend-races`; a TypeScript API diff may warrant `kieran-typescript` plus `api-contract` and `reliability`.
|
|
385
330
|
|
|
386
|
-
|
|
331
|
+
For CE conditional agents, check if the diff includes files matching `db/migrate/*.rb`, `db/schema.rb`, or data backfill scripts.
|
|
387
332
|
|
|
388
|
-
|
|
389
|
-
## ✅ Code Review Complete
|
|
333
|
+
Announce the team before spawning:
|
|
390
334
|
|
|
391
|
-
|
|
335
|
+
```
|
|
336
|
+
Review team:
|
|
337
|
+
- correctness (always)
|
|
338
|
+
- testing (always)
|
|
339
|
+
- maintainability (always)
|
|
340
|
+
- agent-native-reviewer (always)
|
|
341
|
+
- learnings-researcher (always)
|
|
342
|
+
- security -- new endpoint in routes.rb accepts user-provided redirect URL
|
|
343
|
+
- kieran-rails -- controller and Turbo flow changed in app/controllers and app/views
|
|
344
|
+
- dhh-rails -- diff adds service objects around ordinary Rails CRUD
|
|
345
|
+
- data-migrations -- adds migration 20260303_add_index_to_orders
|
|
346
|
+
- schema-drift-detector -- migration files present
|
|
347
|
+
```
|
|
392
348
|
|
|
393
|
-
|
|
349
|
+
This is progress reporting, not a blocking confirmation.
|
|
394
350
|
|
|
395
|
-
|
|
396
|
-
- **🔴 CRITICAL (P1):** [count] - BLOCKS MERGE
|
|
397
|
-
- **🟡 IMPORTANT (P2):** [count] - Should Fix
|
|
398
|
-
- **🔵 NICE-TO-HAVE (P3):** [count] - Enhancements
|
|
351
|
+
### Stage 4: Spawn sub-agents
|
|
399
352
|
|
|
400
|
-
|
|
353
|
+
Spawn each selected persona reviewer as a parallel sub-agent using the template in [subagent-template.md](./references/subagent-template.md). Each persona sub-agent receives:
|
|
401
354
|
|
|
402
|
-
|
|
355
|
+
1. Their persona file content (identity, failure modes, calibration, suppress conditions)
|
|
356
|
+
2. Shared diff-scope rules from [diff-scope.md](./references/diff-scope.md)
|
|
357
|
+
3. The JSON output contract from [findings-schema.json](./references/findings-schema.json)
|
|
358
|
+
4. Review context: intent summary, file list, diff
|
|
403
359
|
|
|
404
|
-
-
|
|
405
|
-
- `002-pending-p1-{finding}.md` - {description}
|
|
360
|
+
Persona sub-agents are **read-only**: they review and return structured JSON. They do not edit files or propose refactors.
|
|
406
361
|
|
|
407
|
-
**
|
|
362
|
+
Read-only here means **non-mutating**, not "no shell access." Reviewer sub-agents may use non-mutating inspection commands when needed to gather evidence or verify scope, including read-oriented `git` / `gh` usage such as `git diff`, `git show`, `git blame`, `git log`, and `gh pr view`. They must not edit files, change branches, commit, push, create PRs, or otherwise mutate the checkout or repository state.
|
|
408
363
|
|
|
409
|
-
-
|
|
410
|
-
- `004-pending-p2-{finding}.md` - {description}
|
|
364
|
+
Each persona sub-agent returns JSON matching [findings-schema.json](./references/findings-schema.json):
|
|
411
365
|
|
|
412
|
-
|
|
366
|
+
```json
|
|
367
|
+
{
|
|
368
|
+
"reviewer": "security",
|
|
369
|
+
"findings": [...],
|
|
370
|
+
"residual_risks": [...],
|
|
371
|
+
"testing_gaps": [...]
|
|
372
|
+
}
|
|
373
|
+
```
|
|
413
374
|
|
|
414
|
-
-
|
|
375
|
+
**CE always-on agents** (agent-native-reviewer, learnings-researcher) are dispatched as standard Agent calls in parallel with the persona agents. Give them the same review context bundle the personas receive: entry mode, any PR metadata gathered in Stage 1, intent summary, review base branch name when known, `BASE:` marker, file list, diff, and `UNTRACKED:` scope notes. Do not invoke them with a generic "review this" prompt. Their output is unstructured and synthesized separately in Stage 6.
|
|
415
376
|
|
|
416
|
-
|
|
377
|
+
**CE conditional agents** (schema-drift-detector, deployment-verification-agent) are also dispatched as standard Agent calls when applicable. Pass the same review context bundle plus the applicability reason (for example, which migration files triggered the agent). For schema-drift-detector specifically, pass the resolved review base branch explicitly so it never assumes `main`. Their output is unstructured and must be preserved for Stage 6 synthesis just like the CE always-on agents.
|
|
417
378
|
|
|
418
|
-
|
|
419
|
-
- security-sentinel
|
|
420
|
-
- performance-oracle
|
|
421
|
-
- architecture-strategist
|
|
422
|
-
- agent-native-reviewer
|
|
423
|
-
- [other agents]
|
|
379
|
+
### Stage 5: Merge findings
|
|
424
380
|
|
|
425
|
-
|
|
381
|
+
Convert multiple reviewer JSON payloads into one deduplicated, confidence-gated finding set.
|
|
426
382
|
|
|
427
|
-
1. **
|
|
383
|
+
1. **Validate.** Check each output against the schema. Drop malformed findings (missing required fields). Record the drop count.
|
|
384
|
+
2. **Confidence gate.** Suppress findings below 0.60 confidence. Record the suppressed count. This matches the persona instructions: findings below 0.60 are noise and should not survive synthesis.
|
|
385
|
+
3. **Deduplicate.** Compute fingerprint: `normalize(file) + line_bucket(line, +/-3) + normalize(title)`. When fingerprints match, merge: keep highest severity, keep highest confidence with strongest evidence, union evidence, note which reviewers flagged it.
|
|
386
|
+
4. **Separate pre-existing.** Pull out findings with `pre_existing: true` into a separate list.
|
|
387
|
+
5. **Normalize routing.** For each merged finding, set the final `autofix_class`, `owner`, and `requires_verification`. If reviewers disagree, keep the most conservative route. Synthesis may narrow a finding from `safe_auto` to `gated_auto` or `manual`, but must not widen it without new evidence.
|
|
388
|
+
6. **Partition the work.** Build three sets:
|
|
389
|
+
- in-skill fixer queue: only `safe_auto -> review-fixer`
|
|
390
|
+
- residual actionable queue: unresolved `gated_auto` or `manual` findings whose owner is `downstream-resolver`
|
|
391
|
+
- report-only queue: `advisory` findings plus anything owned by `human` or `release`
|
|
392
|
+
7. **Sort.** Order by severity (P0 first) -> confidence (descending) -> file path -> line number.
|
|
393
|
+
8. **Collect coverage data.** Union residual_risks and testing_gaps across reviewers.
|
|
394
|
+
9. **Preserve CE agent artifacts.** Keep the learnings, agent-native, schema-drift, and deployment-verification outputs alongside the merged finding set. Do not drop unstructured agent output just because it does not match the persona JSON schema.
|
|
428
395
|
|
|
429
|
-
|
|
430
|
-
- Implement fixes or request exemption
|
|
431
|
-
- Verify fixes before merging PR
|
|
396
|
+
### Stage 6: Synthesize and present
|
|
432
397
|
|
|
433
|
-
|
|
434
|
-
```bash
|
|
435
|
-
ls todos/*-pending-*.md # View all pending todos
|
|
436
|
-
/triage # Use slash command for interactive triage
|
|
437
|
-
```
|
|
398
|
+
Assemble the final report using the template in [review-output-template.md](./references/review-output-template.md):
|
|
438
399
|
|
|
439
|
-
|
|
400
|
+
1. **Header.** Scope, intent, mode, reviewer team with per-conditional justifications.
|
|
401
|
+
2. **Findings.** Grouped by severity (P0, P1, P2, P3). Each finding shows file, issue, reviewer(s), confidence, and synthesized route.
|
|
402
|
+
3. **Applied Fixes.** Include only if a fix phase ran in this invocation.
|
|
403
|
+
4. **Residual Actionable Work.** Include when unresolved actionable findings were handed off or should be handed off.
|
|
404
|
+
5. **Pre-existing.** Separate section, does not count toward verdict.
|
|
405
|
+
6. **Learnings & Past Solutions.** Surface learnings-researcher results: if past solutions are relevant, flag them as "Known Pattern" with links to docs/solutions/ files.
|
|
406
|
+
7. **Agent-Native Gaps.** Surface agent-native-reviewer results. Omit section if no gaps found.
|
|
407
|
+
8. **Schema Drift Check.** If schema-drift-detector ran, summarize whether drift was found. If drift exists, list the unrelated schema objects and the required cleanup command. If clean, say so briefly.
|
|
408
|
+
9. **Deployment Notes.** If deployment-verification-agent ran, surface the key Go/No-Go items: blocking pre-deploy checks, the most important verification queries, rollback caveats, and monitoring focus areas. Keep the checklist actionable rather than dropping it into Coverage.
|
|
409
|
+
10. **Coverage.** Suppressed count, residual risks, testing gaps, failed/timed-out reviewers, and any intent uncertainty carried by non-interactive modes.
|
|
410
|
+
11. **Verdict.** Ready to merge / Ready with fixes / Not ready. Fix order if applicable.
|
|
440
411
|
|
|
441
|
-
|
|
442
|
-
/resolve_todo_parallel # Fix all approved items efficiently
|
|
443
|
-
```
|
|
412
|
+
Do not include time estimates.
|
|
444
413
|
|
|
445
|
-
|
|
446
|
-
- Rename file when status changes: pending → ready → complete
|
|
447
|
-
- Update Work Log as you work
|
|
448
|
-
- Commit todos: `git add todos/ && git commit -m "refactor: add code review findings"`
|
|
414
|
+
## Quality Gates
|
|
449
415
|
|
|
450
|
-
|
|
416
|
+
Before delivering the review, verify:
|
|
451
417
|
|
|
452
|
-
|
|
418
|
+
1. **Every finding is actionable.** Re-read each finding. If it says "consider", "might want to", or "could be improved" without a concrete fix, rewrite it with a specific action. Vague findings waste engineering time.
|
|
419
|
+
2. **No false positives from skimming.** For each finding, verify the surrounding code was actually read. Check that the "bug" isn't handled elsewhere in the same function, that the "unused import" isn't used in a type annotation, that the "missing null check" isn't guarded by the caller.
|
|
420
|
+
3. **Severity is calibrated.** A style nit is never P0. A SQL injection is never P3. Re-check every severity assignment.
|
|
421
|
+
4. **Line numbers are accurate.** Verify each cited line number against the file content. A finding pointing to the wrong line is worse than no finding.
|
|
422
|
+
5. **Protected artifacts are respected.** Discard any findings that recommend deleting or gitignoring files in `docs/brainstorms/`, `docs/plans/`, or `docs/solutions/`.
|
|
423
|
+
6. **Findings don't duplicate linter output.** Don't flag things the project's linter/formatter would catch (missing semicolons, wrong indentation). Focus on semantic issues.
|
|
453
424
|
|
|
454
|
-
-
|
|
455
|
-
- Data corruption risks
|
|
456
|
-
- Breaking changes
|
|
457
|
-
- Critical architectural issues
|
|
425
|
+
## Language-Aware Conditionals
|
|
458
426
|
|
|
459
|
-
|
|
427
|
+
This skill uses stack-specific reviewer agents when the diff clearly warrants them. Keep those agents opinionated. They are not generic language checkers; they add a distinct review lens on top of the always-on and cross-cutting personas.
|
|
460
428
|
|
|
461
|
-
|
|
462
|
-
- Significant architectural concerns
|
|
463
|
-
- Major code quality problems
|
|
464
|
-
- Reliability issues
|
|
429
|
+
Do not spawn them mechanically from file extensions alone. The trigger is meaningful changed behavior, architecture, or UI state in that stack.
|
|
465
430
|
|
|
466
|
-
|
|
431
|
+
## After Review
|
|
467
432
|
|
|
468
|
-
-
|
|
469
|
-
- Code cleanup
|
|
470
|
-
- Optimization opportunities
|
|
471
|
-
- Documentation updates
|
|
472
|
-
````
|
|
433
|
+
### Mode-Driven Post-Review Flow
|
|
473
434
|
|
|
474
|
-
|
|
435
|
+
After presenting findings and verdict (Stage 6), route the next steps by mode. Review and synthesis stay the same in every mode; only mutation and handoff behavior changes.
|
|
475
436
|
|
|
476
|
-
|
|
437
|
+
#### Step 1: Build the action sets
|
|
477
438
|
|
|
478
|
-
**
|
|
439
|
+
- **Clean review** means zero findings after suppression and pre-existing separation. Skip the fix/handoff phase when the review is clean.
|
|
440
|
+
- **Fixer queue:** final findings routed to `safe_auto -> review-fixer`.
|
|
441
|
+
- **Residual actionable queue:** unresolved `gated_auto` or `manual` findings whose final owner is `downstream-resolver`.
|
|
442
|
+
- **Report-only queue:** `advisory` findings and any outputs owned by `human` or `release`.
|
|
443
|
+
- **Never convert advisory-only outputs into fix work or todos.** Deployment notes, residual risks, and release-owned items stay in the report.
|
|
479
444
|
|
|
480
|
-
|
|
481
|
-
|-----------|--------------|
|
|
482
|
-
| `*.xcodeproj`, `*.xcworkspace`, `Package.swift` (iOS) | iOS/macOS |
|
|
483
|
-
| `Gemfile`, `package.json`, `app/views/*`, `*.html.*` | Web |
|
|
484
|
-
| Both iOS files AND web files | Hybrid (test both) |
|
|
445
|
+
#### Step 2: Choose policy by mode
|
|
485
446
|
|
|
486
|
-
|
|
447
|
+
**Interactive mode**
|
|
487
448
|
|
|
488
|
-
|
|
449
|
+
- Ask a single policy question only when actionable work exists.
|
|
450
|
+
- Recommended default:
|
|
489
451
|
|
|
490
|
-
|
|
452
|
+
```
|
|
453
|
+
What should I do with the actionable findings?
|
|
454
|
+
1. Apply safe_auto fixes and leave the rest as residual work (Recommended)
|
|
455
|
+
2. Apply safe_auto fixes only
|
|
456
|
+
3. Review report only
|
|
457
|
+
```
|
|
491
458
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
**"Want to run browser tests on the affected pages?"**
|
|
495
|
-
1. Yes - run `/test-browser`
|
|
496
|
-
2. No - skip
|
|
497
|
-
```
|
|
459
|
+
- Tailor the prompt to the actual action sets. If the fixer queue is empty, do not offer "Apply safe_auto fixes" options. Ask whether to externalize the residual actionable work or keep the review report-only instead.
|
|
460
|
+
- Only include `gated_auto` findings in the fixer queue after the user explicitly approves the specific items. Do not widen the queue based on severity alone.
|
|
498
461
|
|
|
499
|
-
**
|
|
500
|
-
```markdown
|
|
501
|
-
**"Want to run Xcode simulator tests on the app?"**
|
|
502
|
-
1. Yes - run `/xcode-test`
|
|
503
|
-
2. No - skip
|
|
504
|
-
```
|
|
462
|
+
**Autofix mode**
|
|
505
463
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
2. iOS only - run `/xcode-test`
|
|
511
|
-
3. Both - run both commands
|
|
512
|
-
4. No - skip
|
|
513
|
-
```
|
|
464
|
+
- Ask no questions.
|
|
465
|
+
- Apply only the `safe_auto -> review-fixer` queue.
|
|
466
|
+
- Leave `gated_auto`, `manual`, `human`, and `release` items unresolved.
|
|
467
|
+
- Prepare residual work only for unresolved actionable findings whose final owner is `downstream-resolver`.
|
|
514
468
|
|
|
515
|
-
|
|
469
|
+
**Report-only mode**
|
|
516
470
|
|
|
517
|
-
|
|
471
|
+
- Ask no questions.
|
|
472
|
+
- Do not build a fixer queue.
|
|
473
|
+
- Do not create residual todos or `.context` artifacts.
|
|
474
|
+
- Stop after Stage 6. Everything remains in the report.
|
|
518
475
|
|
|
519
|
-
|
|
476
|
+
#### Step 3: Apply fixes with one fixer and bounded rounds
|
|
520
477
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
478
|
+
- Spawn exactly one fixer subagent for the current fixer queue in the current checkout. That fixer applies all approved changes and runs the relevant targeted tests in one pass against a consistent tree.
|
|
479
|
+
- Do not fan out multiple fixers against the same checkout. Parallel fixers require isolated worktrees/branches and deliberate mergeback.
|
|
480
|
+
- Re-review only the changed scope after fixes land.
|
|
481
|
+
- Bound the loop with `max_rounds: 2`. If issues remain after the second round, stop and hand them off as residual work or report them as unresolved.
|
|
482
|
+
- If any applied finding has `requires_verification: true`, the round is incomplete until the targeted verification runs.
|
|
483
|
+
- Do not start a mutating review round concurrently with browser testing on the same checkout. Future orchestrators that want both must either run `mode:report-only` during the parallel phase or isolate the mutating review in its own checkout/worktree.
|
|
524
484
|
|
|
525
|
-
|
|
526
|
-
1. Identify pages affected by the PR
|
|
527
|
-
2. Navigate to each page and capture snapshots (using Playwright MCP or agent-browser CLI)
|
|
528
|
-
3. Check for console errors
|
|
529
|
-
4. Test critical interactions
|
|
530
|
-
5. Pause for human verification on OAuth/email/payment flows
|
|
531
|
-
6. Create P1 todos for any failures
|
|
532
|
-
7. Fix and retry until all tests pass
|
|
485
|
+
#### Step 4: Emit artifacts and downstream handoff
|
|
533
486
|
|
|
534
|
-
|
|
487
|
+
- In interactive and autofix modes, write a per-run artifact under `.context/systematic/ce-review/<run-id>/` containing:
|
|
488
|
+
- synthesized findings
|
|
489
|
+
- applied fixes
|
|
490
|
+
- residual actionable work
|
|
491
|
+
- advisory-only outputs
|
|
492
|
+
- In autofix mode, create durable todo files only for unresolved actionable findings whose final owner is `downstream-resolver`. Load the `todo-create` skill for the canonical directory path, naming convention, YAML frontmatter structure, and template. Each todo should map the finding's severity to the todo priority (`P0`/`P1` -> `p1`, `P2` -> `p2`, `P3` -> `p3`) and set `status: ready` since these findings have already been triaged by synthesis.
|
|
493
|
+
- Do not create todos for `advisory` findings, `owner: human`, `owner: release`, or protected-artifact cleanup suggestions.
|
|
494
|
+
- If only advisory outputs remain, create no todos.
|
|
495
|
+
- Interactive mode may offer to externalize residual actionable work after fixes, but it is not required to finish the review.
|
|
535
496
|
|
|
536
|
-
####
|
|
497
|
+
#### Step 5: Final next steps
|
|
537
498
|
|
|
538
|
-
|
|
499
|
+
**Interactive mode only:** after the fix-review cycle completes (clean verdict or the user chose to stop), offer next steps based on the entry mode. Reuse the resolved review base/default branch from Stage 1 when known; do not hard-code only `main`/`master`.
|
|
539
500
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
501
|
+
- **PR mode (entered via PR number/URL):**
|
|
502
|
+
- **Push fixes** -- push commits to the existing PR branch
|
|
503
|
+
- **Exit** -- done for now
|
|
504
|
+
- **Branch mode (feature branch with no PR, and not the resolved review base/default branch):**
|
|
505
|
+
- **Create a PR (Recommended)** -- push and open a pull request
|
|
506
|
+
- **Continue without PR** -- stay on the branch
|
|
507
|
+
- **Exit** -- done for now
|
|
508
|
+
- **On the resolved review base/default branch:**
|
|
509
|
+
- **Continue** -- proceed with next steps
|
|
510
|
+
- **Exit** -- done for now
|
|
543
511
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
2. Discover project and schemes
|
|
547
|
-
3. Build for iOS Simulator
|
|
548
|
-
4. Install and launch app
|
|
549
|
-
5. Take screenshots of key screens
|
|
550
|
-
6. Capture console logs for errors
|
|
551
|
-
7. Pause for human verification (Sign in with Apple, push, IAP)
|
|
552
|
-
8. Create P1 todos for any failures
|
|
553
|
-
9. Fix and retry until all tests pass
|
|
512
|
+
If "Create a PR": first publish the branch with `git push --set-upstream origin HEAD`, then use `gh pr create` with a title and summary derived from the branch changes.
|
|
513
|
+
If "Push fixes": push the branch with `git push` to update the existing PR.
|
|
554
514
|
|
|
555
|
-
**
|
|
515
|
+
**Autofix and report-only modes:** stop after the report, artifact emission, and residual-work handoff. Do not commit, push, or create a PR.
|
|
556
516
|
|
|
557
|
-
|
|
517
|
+
## Fallback
|
|
558
518
|
|
|
559
|
-
|
|
519
|
+
If the platform doesn't support parallel sub-agents, run reviewers sequentially. Everything else (stages, output format, merge pipeline) stays the same.
|
|
560
520
|
|