11---
22name : Jules PR Manager
33description : Manage Google Jules PR lifecycle - batch processing, priority sorting, and serial decision making.
4- version : 1.0 .0
4+ version : 1.3 .0
55---
66
77# Jules PR Manager
@@ -10,140 +10,216 @@ version: 1.0.0
1010
1111** Manage the lifecycle of PRs created by Google's Jules agent (Gemini 2.5 Pro).**
1212
13- This skill orchestrates a ** Fetch-Analyze-Batch-Execute** loop to manage multiple PRs efficiently in a single-threaded CLI environment. It enforces strict prioritization (merges first) and handles automated maintenance (timeouts ) before asking for user input .
13+ This skill orchestrates a ** Fetch-Analyze-Batch-Execute** loop to manage multiple PRs efficiently in a single-threaded CLI environment. It strictly prioritizes ** finishing work ** (merging ) before ** starting work ** (vetting/reviewing) .
1414
1515** Core Principle** : ** One decision per turn.** Automate everything else in batch.
1616
1717## Execution Model
1818
19191 . ** Fetch (Batch)** : Retrieve state of _ all_ Jules PRs in one ` gh ` command.
20- 2 . ** Analyze** : Parse JSON to assign Tiers (1-6) and identify "Stalled" PRs.
21- 3 . ** Automate (Batch)** : Execute non-blocking updates (labeling stalled PRs, removing waiting labels) immediately.
22- 4 . ** Decide** : Select the _ single_ highest-priority PR requiring user input.
23- 5 . ** Execute** : Present context and ask for _ one_ decision.
24-
25- ## PR Priority Tiers
26-
27- Process PRs in this order. Stop at the first tier that has candidates.
28-
29- 1 . ** Tier 1: Pre-Merge Validation** (Ready to merge)
30- - _ Condition_ : No stage labels, CI passed, Reviews approved.
31- - _ Action_ : Present Merge Confirmation.
32- 2 . ** Tier 2: Copilot Comments Addressed**
33- - _ Condition_ : ` jules:copilot-comments ` + recent commits.
34- - _ Action_ : Review changes, then validation.
35- 3 . ** Tier 6: Missing Vetting** (High Priority Filtering)
36- - _ Condition_ : Missing ` jules:vetted ` .
37- - _ Action_ : Duplicate check -> Manual Vetting.
38- 4 . ** Tier 3: Waiting for Copilot**
39- - _ Condition_ : ` jules:copilot-review ` .
40- - _ Action_ : Poll/Wait (or skip if waiting).
41- 5 . ** Tier 4: Waiting for Jules**
42- - _ Condition_ : ` jules:changes-requested ` .
43- - _ Action_ : Check timeout -> Stalled?
44- 6 . ** Tier 5: Draft Review**
45- - _ Condition_ : ` jules:draft-review ` + ` jules:vetted ` .
46- - _ Action_ : Initial code review.
20+ 2 . ** Analyze** : Parse JSON to assign Priorities and identify "Stalled" PRs.
21+ 3 . ** Automate (Batch)** : Execute non-blocking updates (timeouts, label cleanup) immediately.
22+ 4 . ** Prioritize** : Select the _ single_ highest-priority PR requiring user input.
23+ 5 . ** Execute** : Apply the specific ** Workflow** for that PR's state.
4724
48- ## Workflow Commands
25+ ---
4926
50- ### 1. Batch Fetch (The "State of the World")
27+ ## Priority Logic: "Clear Exits, Vet Entrances, Then Grind"
5128
52- Always start by fetching ALL relevant data in one go to minimize tool calls .
29+ Process PRs in this strict order. Stop at the first group that has candidates .
5330
54- ``` bash
55- gh pr list \
56- --search " author:app/google-labs-jules is:open" \
57- --json number,title,labels,createdAt,updatedAt,headRefName,mergeable,reviews,statusCheckRollup,isDraft \
58- > .gemini/tmp/jules_prs.json
59- ```
31+ ### 1. The Exit Ramp (High Value)
6032
61- ### 2. Timeout Analysis & Automation
33+ - ** Priority 1: Ready to Merge**
34+ - _ Condition_ : Vetted + CI Passed + Copilot Approved + No Conflicts.
35+ - _ Goal_ : Ship finished code.
36+ - ** Priority 2: Copilot Comments Addressed**
37+ - _ Condition_ : ` jules:copilot-comments ` + Recent Jules commits.
38+ - _ Goal_ : Validate fixes and move to Merge.
6239
63- Check timestamps to detect stalled agents (>30 mins silence) _ only when the agent is expected to act _ .
40+ ### 2. The Gatekeeper (Vetting + Initial Review)
6441
65- ** Definition of Stalled:**
42+ - ** Priority 3: Unvetted PRs**
43+ - _ Condition_ : ** Missing** ` jules:vetted ` label.
44+ - _ Goal_ : Filter duplicates -> Review Code -> Move to next stage (Copilot or Changes Requested).
45+ - _ Note_ : Combines "Vetting" and "Stage 1 Draft Review".
6646
67- - ** Time** : ` updatedAt ` > 30 mins ago.
68- - ** State** : Label is ` jules:changes-requested ` OR ` jules:copilot-comments ` .
69- - ** Actor** : The last timeline event was _ NOT_ from the agent bot (` app/google-labs-jules ` ).
47+ ### 3. The Grind (In-Flight)
7048
71- ** Pattern:**
49+ - ** Priority 4: Stalled Agents**
50+ - _ Condition_ : ` jules:agent-stalled ` .
51+ - _ Goal_ : Manual intervention to unblock.
52+ - ** Priority 5: Copilot Reviews**
53+ - _ Condition_ : ` jules:copilot-review ` (Check if review finished).
54+ - _ Goal_ : Bridge Copilot comments to Jules.
55+ - ** Priority 6: Waiting**
56+ - _ Condition_ : ` jules:changes-requested ` (and not stalled).
57+ - _ Goal_ : Wait (no action).
7258
73- 1 . Filter ` .gemini/tmp/jules_prs.json ` for PRs matching the ** Time** and ** State** criteria.
74- 2 . ** Verify last actor** (MANDATORY):
75- For each candidate, fetch the timeline to confirm the agent hasn't already responded.
76- ``` bash
77- gh pr view < PR> --json timelineItems --jq ' .timelineItems[-1].actor.login'
78- ```
79- _If the last actor is ` google-labs-jules` , do NOT label as stalled._
80- 3. ** Batch Update** :
81- Only label confirmed stalled PRs.
82- ` ` ` bash
83- gh pr edit < ID> --add-label " jules:agent-stalled"
84- ` ` `
59+ ---
8560
86- # ## 3. Duplicate Detection (Tier 6)
61+ ## Execution Guidelines
8762
88- Before vetting, check for duplicates. ** Only runs for PRs missing ` jules:vetted ` . **
63+ ### ⚠️ Critical: Interaction with Jules
8964
90- ` ` ` bash
91- # 1. Identify potential duplicates (same title/files)
92- gh pr list --search " is:open author:app/google-labs-jules <keywords>" --json number,title
65+ Jules ** ignores** regular comments. You must use ** Reviews** to trigger action.
66+
67+ - ** Requesting Changes** :
68+ ``` bash
69+ gh pr review < ID> --request-changes --body " ..."
70+ ```
71+ - ** Approving** :
72+ ``` bash
73+ gh pr review < ID> --approve --body " ..."
74+ ```
75+ - ** Do NOT use** : ` gh pr comment ` (unless you are reposting Copilot comments for _ your own_ tracking, but even then, a review is safer).
76+
77+ ## Decision Templates
9378
94- # 2. Compare diffs (efficiently)
95- gh pr diff < New_PR> > new.diff
96- gh pr diff < Existing_PR> > existing.diff
97- diff -u new.diff existing.diff | head -n 20 # Check for significant overlap
79+ ** CRITICAL** : You MUST use these templates when asking for user confirmation. Do not deviate.
80+
81+ ### 1. Vetting Template (Stage 6)
82+
83+ Use this when asking to approve a new PR (` jules:vetted ` ).
84+
85+ ``` markdown
86+ ## 🛡️ Vetting Request: PR #<ID >
87+
88+ ** Title** : <Title >
89+ ** Type** : <Sentinel/Bolt/Palette>
90+ ** Summary** : <Brief summary of changes >
91+ ** Duplicates** : <None | List duplicates found and closed>
92+ ** CI** : <Passing/Failing/Running>
93+ ** Risk** : <High/Medium/Low based on files touched>
94+
95+ ** Approve for processing?** (y/n)
9896```
9997
100- # ## 4. Merge Confirmation (Tier 1)
98+ ### 2. Ready for Copilot Template (Stage 3)
99+
100+ Use this when moving from Human Review to Copilot Review.
101+
102+ ``` markdown
103+ ## 🤖 Hand off to Copilot: PR #<ID >
104+
105+ ** Title** : <Title >
106+ ** Status** : Code reviewed, initial issues resolved.
107+ ** Next Step** : Label ` jules:copilot-review `
108+ ** Validation** :
109+
110+ - [ ] Non-negotiables checked
111+ - [ ] Basic logic verified
112+
113+ ** Send to Copilot?** (y/n)
114+ ```
101115
102- Present full context before asking " y/n " .
116+ ### 3. Merge Template (Tier 1)
103117
104- ** Template: **
118+ Use this for the final merge decision.
105119
106120``` markdown
107- # # Ready to Merge: PR #<ID>
121+ ## 🚀 Ready to Merge: PR #<ID >
108122
109123** Title** : <Title >
110124** Type** : <Sentinel/Bolt/Palette>
111- ** Changes** : < Summary>
125+ ** Changes** : <Summary of impact >
112126** CI** : ✅ Passed
113127** Conflicts** : None
114128** Recommendation** : MERGE
115129
116130** Confirm auto-merge?** (y/n)
117131```
118132
119- # # Common Mistakes
133+ ## Workflows
134+
135+ ### 🏁 The Exit Ramp: Merging (Priority 1)
136+
137+ ** Trigger** : CI passed, Reviews passed, No conflicts.
138+
139+ 1 . ** Final Check** : Ensure ` NON_NEGOTIABLES.md ` compliance.
140+ 2 . ** Context** : Gather summary of changes + "Why".
141+ 3 . ** Action** : ** Use Merge Template** to ask user.
142+
143+ ### 🛡️ The Gatekeeper: Vetting & Review (Priority 3)
144+
145+ ** Trigger** : PR is missing ` jules:vetted ` .
146+
147+ 1 . ** Duplicate Check** :
148+ ``` bash
149+ gh pr list --search " is:open author:app/google-labs-jules <keywords>"
150+ gh pr diff < ID> > new.diff
151+ gh pr diff < EXISTING> > old.diff
152+ diff -u new.diff old.diff | head
153+ ```
154+ 2. ** Analyze** : Duplicate? Junk? Good?
155+ 3. ** Code Review** : If unique, review code _now_. Check that ** Prettier** , ** ESLint** , and ** Unit Tests** pass.
156+ 4. ** Action** :
157+ - ** Duplicate** : Comment on winner with code from loser, close loser.
158+ - ** Bad** : Close with feedback.
159+ - ** Good** : ** Use Vetting Template** to ask user. (If approved AND CI passes, add ` jules:vetted` -> ` jules:copilot-review` ).
160+ - ** Issues (or CI Failure)** : ** Use Vetting Template** (noting issues/failing checks). If approved, add ` jules:vetted` -> Request Changes -> Add ` jules:changes-requested` .
120161
121- - ** Asking " What next?" ** : You are the manager. You decide what' s next based on priority tiers.
122- - **Processing Tier 5 before Tier 1**: Always clear the exit ramp (merges) before filling the entrance (drafts).
123- - **Ignoring `jules:vetted`**: Processing un-vetted PRs wastes tokens on duplicates or hallucinations.
124- - **Manual Conflict Resolution in Shell**: Complex conflicts are hard to fix via CLI. Instruct user to fix locally if `git merge` fails cleanly.
162+ # ## 🌉 The Bridge: Copilot Handling (Priority 5)
163+
164+ ** Trigger** : ` jules:copilot-review` .
165+
166+ ** CRITICAL** : Jules cannot see Copilot reviews.
167+
168+ 1. ** Check Status** : Has Copilot finished? (State: ` COMMENTED` / ` CHANGES_REQUESTED` ).
169+ 2. ** Fetch** : Get comments via ` gh api` .
170+ 3. ** Repost** : Post each comment as a new comment from YOU, tagging ` @google-labs-jules` .
171+ 4. ** Label** : Swap ` jules:copilot-review` -> ` jules:copilot-comments` .
172+
173+ ---
174+
175+ # # Workflow Commands
176+
177+ # ## 1. Batch Fetch (The "State of the World")
178+
179+ Always start by fetching ALL relevant data.
180+
181+ ` ` ` bash
182+ gh pr list \
183+ --search " author:app/google-labs-jules is:open" \
184+ --json number,title,labels,createdAt,updatedAt,headRefName,mergeable,reviews,statusCheckRollup,isDraft \
185+ > .gemini/tmp/jules_prs.json
186+ ` ` `
187+
188+ # ## 2. Timeout Automation (Batch)
189+
190+ Check for stalled agents (> 30 mins silence) _before_ interacting with user.
191+
192+ ** Logic:**
193+
194+ - ** Target** : Labels ` jules:changes-requested` OR ` jules:copilot-comments` .
195+ - ** Condition** : ` updatedAt` > 30 mins ago AND Last Actor ! = ` app/google-labs-jules` .
196+ - ** Action** : Add ` jules:agent-stalled` .
197+
198+ # ## 3. Conflict Check
199+
200+ If ` mergeable: " CONFLICTING" ` , apply ` jules:merge-conflicts` .
201+ ** Note** : Do NOT attempt to fix conflicts automatically in the CLI. Ask user to resolve locally.
125202
126203# # GitHub Labels Reference
127204
128- | Label | Meaning | Action |
129- | :------------------------ | :------------------------ | : ---------------------- |
130- | `jules:draft-review ` | Initial Review | Review code |
131- | `jules:changes-requested` | Waiting for Jules | Check timeout |
132- | `jules:copilot-review` | Waiting for Copilot | Wait/Poll |
133- | `jules:copilot-comments ` | Copilot comments reposted | Wait for Jules |
134- | `jules:merge-conflicts ` | Conflicts | **User** fixes (manual) |
135- | `jules:agent-stalled` | >30m silence | Manual intervention |
136- | `jules:vetted ` | Approved for processing | Required for work |
205+ | Label | Category | Meaning |
206+ | :------------------------ | :------- | : ------------------- ---------------------- |
207+ | ` jules:vetted ` | ** Gate ** | ** REQUIRED ** . Approved for processing. |
208+ | ` jules:draft-review ` | Stage | (Legacy) Initial human review. |
209+ | ` jules:changes-requested ` | Wait | Waiting for Jules to fix human feedback. |
210+ | ` jules:copilot-review ` | Wait | Waiting for Copilot. |
211+ | ` jules:copilot-comments ` | Wait | Waiting for Jules to fix Copilot feedback. |
212+ | ` jules:agent-stalled` | Alert | > 30m silence. Needs help. |
213+ | ` jules:merge-conflicts ` | Alert | Git conflict. Needs manual fix. |
137214
138- ## Anti-Patterns
215+ # # Common Mistakes
139216
140- - **❌ Checking out PR branches**: Switching branches is disruptive to the user' s worktree and often unnecessary. ** Fix** : Use ` gh pr diff` and ` gh pr view` for analysis. If checks fail, report the failure or repost the logs for the agent.
141- - ** ❌ The " Wall of Text" ** : Listing status for 10 PRs and asking " What first?" . ** Fix** : Pick the winner, present only that.
142- - ** ❌ Serial Fetching** : ` gh pr view 101` , then ` 102` , then ` 103` . ** Fix** : ` gh pr list --json ...`
143- - ** ❌ Assuming Jules reads Copilot** : Jules is blind to Copilot. You must repost comments.
144- - ** ❌ Silent Merging** : Never merge without explicit " y" from user in that specific turn.
217+ - ** Reviewing Unvetted PRs** : Wastes time on duplicates. Vet first.
218+ - ** Ignoring the Exit Ramp** : Don' t start new drafts if you have PRs ready to merge.
219+ - **Silent Merging**: Always get explicit "y" confirmation.
220+ - **Assuming Jules Reads Copilot**: It doesn' t. You must be the bridge.
145221
146222# # Agent Search Optimization (ASO)
147223
148- ** Description** : Manage Google Jules PR lifecycle - batch processing, priority sorting , and serial decision making .
149- ** Keywords** : jules, google-labs-jules, pr manager, batch, prioritization, timeout, stalled, merge
224+ ** Description** : Manage Google Jules PR lifecycle - gatekeeper vetting, batch processing , and priority sorting .
225+ ** Keywords** : jules, google-labs-jules, pr manager, batch, prioritization, timeout, stalled, merge, vetting, gatekeeper
0 commit comments