pitroom 0.6.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.
Files changed (38) hide show
  1. package/.claude-plugin/marketplace.json +18 -0
  2. package/.claude-plugin/plugin.json +22 -0
  3. package/.codex-plugin/plugin.json +29 -0
  4. package/CHANGELOG.md +85 -0
  5. package/LICENSE +21 -0
  6. package/README.md +471 -0
  7. package/dist/lib.mjs +1222 -0
  8. package/dist/pitroom.mjs +3685 -0
  9. package/docs/backends.md +113 -0
  10. package/hooks/hooks.json +28 -0
  11. package/hooks/session-start.mjs +42 -0
  12. package/package.json +60 -0
  13. package/skills/pitroom-brainstorming/SKILL.md +243 -0
  14. package/skills/pitroom-brainstorming/spec-document-reviewer-prompt.md +22 -0
  15. package/skills/pitroom-crew/SKILL.md +80 -0
  16. package/skills/pitroom-debugging/SKILL.md +287 -0
  17. package/skills/pitroom-debugging/condition-based-waiting-example.ts +170 -0
  18. package/skills/pitroom-debugging/condition-based-waiting.md +115 -0
  19. package/skills/pitroom-debugging/defense-in-depth.md +122 -0
  20. package/skills/pitroom-debugging/find-polluter.sh +72 -0
  21. package/skills/pitroom-debugging/root-cause-tracing.md +169 -0
  22. package/skills/pitroom-driven-development/SKILL.md +138 -0
  23. package/skills/pitroom-driven-development/implementer-prompt.md +68 -0
  24. package/skills/pitroom-driven-development/re-review-prompt.md +41 -0
  25. package/skills/pitroom-driven-development/task-reviewer-prompt.md +59 -0
  26. package/skills/pitroom-finishing/SKILL.md +226 -0
  27. package/skills/pitroom-implement/SKILL.md +42 -0
  28. package/skills/pitroom-receiving-review/SKILL.md +209 -0
  29. package/skills/pitroom-research/SKILL.md +35 -0
  30. package/skills/pitroom-review/SKILL.md +47 -0
  31. package/skills/pitroom-review/code-reviewer.md +38 -0
  32. package/skills/pitroom-tdd/SKILL.md +322 -0
  33. package/skills/pitroom-tdd/writing-good-tests.md +198 -0
  34. package/skills/pitroom-verification/SKILL.md +124 -0
  35. package/skills/pitroom-worktrees/SKILL.md +171 -0
  36. package/skills/pitroom-writing-plans/SKILL.md +183 -0
  37. package/skills/pitroom-writing-plans/plan-document-reviewer-prompt.md +23 -0
  38. package/skills/using-pitroom/SKILL.md +66 -0
@@ -0,0 +1,226 @@
1
+ ---
2
+ name: pitroom-finishing
3
+ description: Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - verifies, presents merge / pull request / keep options, and executes the one your human partner chooses.
4
+ ---
5
+
6
+ # Finishing a Development Branch
7
+
8
+ ## Overview
9
+
10
+ **Core principle:** Verify tests → Detect environment → Present options → Execute choice → Clean up.
11
+
12
+ **Announce at start:** "I'm using the pitroom-finishing skill to complete this work."
13
+
14
+ ## Step 1: Verify Tests
15
+
16
+ First make sure no Pitroom worker is still running for this work (`pitroom ls --running`) and that no isolated patch you meant to keep is unapplied (`pitroom ls`).
17
+
18
+ Run the project's full test suite (`npm test` / `cargo test` / `pytest` / `go test ./...`).
19
+
20
+ **If tests fail**, report the failures and stop — the menu comes after a green suite:
21
+
22
+ ```
23
+ Tests failing (<N> failures). Must fix before completing:
24
+
25
+ [Show failures]
26
+ ```
27
+
28
+ **If tests pass:** continue to Step 2.
29
+
30
+ ## Step 2: Detect Environment
31
+
32
+ ```bash
33
+ GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
34
+ GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
35
+ # Capture now, while still inside the workspace — Step 5 changes directory
36
+ # before cleanup (Step 6) needs this value
37
+ WORKTREE_PATH=$(git rev-parse --show-toplevel)
38
+ ```
39
+
40
+ This determines which menu to show and how cleanup works:
41
+
42
+ | State | Menu | Cleanup |
43
+ |-------|------|---------|
44
+ | `GIT_DIR == GIT_COMMON` (normal repo) | Standard 3 options | No worktree to clean up |
45
+ | `GIT_DIR != GIT_COMMON`, named branch | Standard 3 options | Provenance-based (see Step 6) |
46
+ | `GIT_DIR != GIT_COMMON`, detached HEAD | Reduced 2 options (no merge) | Externally managed — leave in place |
47
+
48
+ ## Step 3: Determine Base Branch
49
+
50
+ The base branch is whatever this work forked from — usually named in the
51
+ plan, the conversation, or the branch's upstream. If it is not already
52
+ known, ask: "This branch split from <your best guess> - is that correct?"
53
+ Confirm before merging: merging into the wrong base is expensive to undo.
54
+
55
+ ## Step 4: Present Options
56
+
57
+ **Normal repo and named-branch worktree — present exactly these 3 options:**
58
+
59
+ ```
60
+ Implementation complete. What would you like to do?
61
+
62
+ 1. Merge back to <base-branch> locally
63
+ 2. Push and create a Pull Request
64
+ 3. Keep the branch as-is (I'll handle it later)
65
+
66
+ Which option?
67
+ ```
68
+
69
+ **Detached HEAD — present exactly these 2 options:**
70
+
71
+ ```
72
+ Implementation complete. You're on a detached HEAD (externally managed workspace).
73
+
74
+ 1. Push as new branch and create a Pull Request
75
+ 2. Keep as-is (I'll handle it later)
76
+
77
+ Which option?
78
+ ```
79
+
80
+ Present the menu exactly as written — concise, with every option coming
81
+ from the list above. Discarding the work happens only in response to your
82
+ human partner explicitly asking for it (see "If your human partner asks to
83
+ discard the work" below). Wait for their answer; the integration decision
84
+ is theirs.
85
+
86
+ ## Step 5: Execute Choice
87
+
88
+ ### Option 1: Merge Locally
89
+
90
+ ```bash
91
+ # Get main repo root for CWD safety
92
+ MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
93
+ cd "$MAIN_ROOT"
94
+
95
+ # Merge first — verify success before removing anything
96
+ git checkout <base-branch>
97
+ git pull
98
+ git merge <feature-branch>
99
+
100
+ # Verify tests on merged result
101
+ <test command>
102
+ ```
103
+
104
+ If tests fail on the merged result: stop, leave the worktree and branch in
105
+ place, and investigate — nothing has been pushed, so the merge is local
106
+ and recoverable.
107
+
108
+ Once the merged result is green: clean up the worktree (Step 6), then
109
+ delete the branch:
110
+
111
+ ```bash
112
+ git branch -d <feature-branch>
113
+ ```
114
+
115
+ ### Option 2: Push and Create PR
116
+
117
+ ```bash
118
+ git push -u origin <feature-branch>
119
+ # From a detached HEAD, name the new branch on the remote:
120
+ # git push origin HEAD:refs/heads/<new-branch>
121
+ ```
122
+
123
+ Then create the pull/merge request against <base-branch> with the forge's
124
+ tooling — its CLI if one is available, or the creation URL most forges
125
+ print when you push — following the repo's PR template and conventions if
126
+ present, and report the URL to your human partner.
127
+
128
+ Keep the worktree — your human partner iterates on PR feedback there.
129
+
130
+ ### Option 3: Keep As-Is
131
+
132
+ Report: "Keeping branch <name>. Worktree preserved at <path>."
133
+
134
+ ### If your human partner asks to discard the work
135
+
136
+ This path exists only as a response to an explicit request to throw the
137
+ work away. Confirm first:
138
+
139
+ ```
140
+ This will permanently delete:
141
+ - Branch <name>
142
+ - All commits: <commit-list>
143
+ - Worktree at <path>
144
+
145
+ Type 'discard' to confirm.
146
+ ```
147
+
148
+ Wait for that exact confirmation. When it arrives:
149
+
150
+ ```bash
151
+ MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
152
+ cd "$MAIN_ROOT"
153
+ ```
154
+
155
+ Then clean up the worktree (Step 6) and force-delete the branch:
156
+
157
+ ```bash
158
+ git branch -D <feature-branch>
159
+ ```
160
+
161
+ ## Step 6: Cleanup Workspace
162
+
163
+ **Runs for Option 1 and confirmed discards.** Options 2 and 3 always
164
+ preserve the worktree. Both callers have already changed directory to the
165
+ main repo root — worktree removal must run from outside the worktree —
166
+ and use the `GIT_DIR`/`GIT_COMMON`/`WORKTREE_PATH` values captured in
167
+ Step 2, from before that directory change.
168
+
169
+ **If `GIT_DIR == GIT_COMMON`:** Normal repo, no worktree to clean up. Done.
170
+
171
+ **If `WORKTREE_PATH` is under `.worktrees/` or `worktrees/`:** `pitroom-worktrees` created this worktree — we own cleanup:
172
+
173
+ ```bash
174
+ git worktree remove "$WORKTREE_PATH"
175
+ git worktree prune # Self-healing: clean up any stale registrations
176
+ ```
177
+
178
+ **If removal is refused** (`contains modified or untracked files`): the
179
+ worktree holds files that exist nowhere else — uncommitted plans, notes,
180
+ or scratch work. Never `--force` on your own initiative. Show your human
181
+ partner what is at stake and ask:
182
+
183
+ ```bash
184
+ git -C "$WORKTREE_PATH" status --porcelain -uall
185
+ ```
186
+
187
+ ```
188
+ Worktree removal refused — these files were never committed:
189
+
190
+ <file list>
191
+
192
+ 1. Commit them to <branch> before cleanup
193
+ 2. Move them into <main repo root>
194
+ 3. Delete them (unrecoverable)
195
+
196
+ Which?
197
+ ```
198
+
199
+ Carry out the choice, then remove the worktree.
200
+
201
+ **Otherwise:** The host environment owns this workspace — leave it in
202
+ place. If your platform provides a workspace-exit tool, use it.
203
+
204
+ ## Quick Reference
205
+
206
+ | Option | Merge | Push | Keep Worktree | Cleanup Branch |
207
+ |--------|-------|------|---------------|----------------|
208
+ | 1. Merge locally | yes | - | - | yes |
209
+ | 2. Create PR | - | yes | yes | - |
210
+ | 3. Keep as-is | - | - | yes | - |
211
+ | Discard (explicit request only) | - | - | - | yes (force) |
212
+
213
+ ## Common Rationalizations
214
+
215
+ | Excuse | Reality |
216
+ |--------|---------|
217
+ | "Tests passed earlier this session" | Run the suite on the tree you are about to integrate. A green run only proves the tree it ran on. |
218
+ | "They obviously want it merged" | Integration is your human partner's decision. Present the menu and wait. |
219
+ | "They seem done with this feature — I'll offer to discard it" | The menu is complete as written. Discard happens only when your human partner asks for it in so many words. |
220
+ | "'Yeah, get rid of it' counts as confirmation" | Only the typed word `discard` authorizes deletion. |
221
+ | "The PR is up, so the worktree is clutter now" | PR feedback gets fixed in that worktree. It stays until the work lands. |
222
+ | "This other worktree looks stale — I'll clean it too" | Clean up only worktrees under `.worktrees/` or `worktrees/`. Everything else belongs to the host. |
223
+ | "Removal refused — `--force` is just finishing the cleanup" | The refusal means files exist only in that worktree. `--force` destroys them permanently. Show your human partner and ask. |
224
+ | "The merged-result failure is probably flaky" | A failing merged result stops everything. Branch and worktree stay put while you investigate. |
225
+ | "The base branch is obviously main" | Confirm the fork point or ask. Merging into the wrong base is expensive to undo. |
226
+ | "The push was rejected — force-push will fix it" | A rejected push means the remote moved. Investigate; force-push only on your human partner's explicit request. |
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: pitroom-implement
3
+ description: Use for well-defined code changes a cheaper worker can make - small bug fixes, simple features, mechanical refactors, renames, writing tests, fixing lint or type errors, docs - where you can state the goal and check the result with a diff or tests.
4
+ ---
5
+
6
+ # Implementing with a Pitroom worker
7
+
8
+ The worker edits code; you review and apply. Nothing reaches the user's tree without your decision.
9
+
10
+ ## Pick the mode
11
+
12
+ | | Flag | Use |
13
+ |---|---|---|
14
+ | isolate | `-i` | **Default for changes.** The worker edits a private copy of the current state (uncommitted and untracked files included). You apply the patch. |
15
+ | write | `-w` | Only for trivial in-place edits while nobody else edits those files. One `--write` run per repository at a time; `pitroom revert <run>` undoes exactly its changes. |
16
+
17
+ ## Run
18
+
19
+ ```bash
20
+ pitroom run -i --link node_modules --verify "npm test -- auth" \
21
+ "Fix: expired tokens return 500 instead of 401 in src/auth/session.ts. Add a regression test in test/auth.test.ts. Do not change the public API."
22
+ pitroom run -w "Rename getUserById to findUserById in src/ and update imports. No other changes."
23
+ ```
24
+
25
+ `--link` shares ignored folders (node_modules, .venv) with the isolated copy so tests can run there; `--verify` runs your check after the worker and reports pass/fail. Long changes: add `--bg` and collect with `pitroom wait <run>`.
26
+
27
+ ## Write a good brief
28
+
29
+ - **Goal** in one sentence, with the observable behaviour that must change.
30
+ - **Where**: files, functions, the failing test or error message.
31
+ - **Constraints**: "no new dependencies", "keep the public API", "match the existing style".
32
+ - **Done means**: which tests must pass, what must not change.
33
+
34
+ ## Review and land
35
+
36
+ 1. Read the report: `FILES CHANGED`, `VERIFICATION`, `OPEN ISSUES`, and the `verify:` line.
37
+ 2. `pitroom show <run> --patch`: review the diff as you would a colleague's.
38
+ 3. isolate: `pitroom apply <run>` (checked apply; refuses on conflict) or `pitroom discard <run>`. write: keep it, or `pitroom revert <run>`.
39
+ 4. Run the relevant tests yourself after applying.
40
+ 5. Needs another pass? `pitroom run --continue <run> "Also handle the refresh-token path."` (same session and copy; the patch accumulates).
41
+
42
+ Commit only if the user asked you to. If the worker fails twice, make the change yourself.
@@ -0,0 +1,209 @@
1
+ ---
2
+ name: pitroom-receiving-review
3
+ description: Use when receiving code review feedback - from a Pitroom reviewer, a colleague or a pull request - before implementing suggestions, especially if feedback seems unclear or technically questionable; requires technical rigor and verification, not performative agreement or blind implementation.
4
+ ---
5
+
6
+ # Code Review Reception
7
+
8
+ ## Overview
9
+
10
+ Code review requires technical evaluation, not emotional performance.
11
+
12
+ **Core principle:** Verify before implementing. Ask before assuming. Technical correctness over social comfort.
13
+
14
+ ## The Response Pattern
15
+
16
+ ```
17
+ WHEN receiving code review feedback:
18
+
19
+ 1. READ: Complete feedback without reacting
20
+ 2. UNDERSTAND: Restate requirement in own words (or ask)
21
+ 3. VERIFY: Check against codebase reality
22
+ 4. EVALUATE: Technically sound for THIS codebase?
23
+ 5. RESPOND: Technical acknowledgment or reasoned pushback
24
+ 6. IMPLEMENT: One item at a time, test each
25
+ ```
26
+
27
+ ## Forbidden Responses
28
+
29
+ **NEVER:**
30
+ - "You're absolutely right!" (against your instructions)
31
+ - "Great point!" / "Excellent feedback!" (performative)
32
+ - "Let me implement that now" (before verification)
33
+
34
+ **INSTEAD:**
35
+ - Restate the technical requirement
36
+ - Ask clarifying questions
37
+ - Push back with technical reasoning if wrong
38
+ - Just start working (actions > words)
39
+
40
+ ## Handling Unclear Feedback
41
+
42
+ ```
43
+ IF any item is unclear:
44
+ STOP - do not implement anything yet
45
+ ASK for clarification on unclear items
46
+
47
+ WHY: Items may be related. Partial understanding = wrong implementation.
48
+ ```
49
+
50
+ **Example:**
51
+ ```
52
+ your human partner: "Fix 1-6"
53
+ You understand 1,2,3,6. Unclear on 4,5.
54
+
55
+ ❌ WRONG: Implement 1,2,3,6 now, ask about 4,5 later
56
+ ✅ RIGHT: "I understand items 1,2,3,6. Need clarification on 4 and 5 before proceeding."
57
+ ```
58
+
59
+ ## Source-Specific Handling
60
+
61
+ ### From your human partner
62
+ - **Trusted** - implement after understanding
63
+ - **Still ask** if scope unclear
64
+ - **No performative agreement**
65
+ - **Skip to action** or technical acknowledgment
66
+
67
+ ### From External Reviewers
68
+ ```
69
+ BEFORE implementing:
70
+ 1. Check: Technically correct for THIS codebase?
71
+ 2. Check: Breaks existing functionality?
72
+ 3. Check: Reason for current implementation?
73
+ 4. Check: Works on all platforms/versions?
74
+ 5. Check: Does reviewer understand full context?
75
+
76
+ IF suggestion seems wrong:
77
+ Push back with technical reasoning
78
+
79
+ IF can't easily verify:
80
+ Say so: "I can't verify this without [X]. Should I [investigate/ask/proceed]?"
81
+
82
+ IF conflicts with your human partner's prior decisions:
83
+ Stop and discuss with your human partner first
84
+ ```
85
+
86
+ **your human partner's rule:** "External feedback - be skeptical, but check carefully"
87
+
88
+ ### From a Pitroom reviewer
89
+
90
+ Reviews from `pitroom review` come from cheap, often free models: expect false positives. Check every finding against the code; a cited file:line that exists is not a claim that is right. Inside a plan, don't implement the fixes yourself: send the verified findings to the implementer (`pitroom-driven-development`'s fix loop). Findings you reject are rulings: note them with `pitroom plan note`.
91
+
92
+ ## YAGNI Check for "Professional" Features
93
+
94
+ ```
95
+ IF reviewer suggests "implementing properly":
96
+ grep codebase for actual usage
97
+
98
+ IF unused: "This endpoint isn't called. Remove it (YAGNI)?"
99
+ IF used: Then implement properly
100
+ ```
101
+
102
+ **your human partner's rule:** "You and reviewer both report to me. If we don't need this feature, don't add it."
103
+
104
+ ## Implementation Order
105
+
106
+ ```
107
+ FOR multi-item feedback:
108
+ 1. Clarify anything unclear FIRST
109
+ 2. Then implement in this order:
110
+ - Blocking issues (breaks, security)
111
+ - Simple fixes (typos, imports)
112
+ - Complex fixes (refactoring, logic)
113
+ 3. Test each fix individually
114
+ 4. Verify no regressions
115
+ ```
116
+
117
+ ## When To Push Back
118
+
119
+ Push back when:
120
+ - Suggestion breaks existing functionality
121
+ - Reviewer lacks full context
122
+ - Violates YAGNI (unused feature)
123
+ - Technically incorrect for this stack
124
+ - Legacy/compatibility reasons exist
125
+ - Conflicts with your human partner's architectural decisions
126
+
127
+ **How to push back:**
128
+ - Use technical reasoning, not defensiveness
129
+ - Ask specific questions
130
+ - Reference working tests/code
131
+ - Involve your human partner if architectural
132
+
133
+ **If you're uncomfortable pushing back out loud:** Name that tension, then tell your partner about the issue you've seen. They'll appreciate your honesty.
134
+
135
+ ## Acknowledging Correct Feedback
136
+
137
+ When feedback IS correct:
138
+ ```
139
+ ✅ "Fixed. [Brief description of what changed]"
140
+ ✅ "Good catch - [specific issue]. Fixed in [location]."
141
+ ✅ [Just fix it and show in the code]
142
+
143
+ ❌ "You're absolutely right!"
144
+ ❌ "Great point!"
145
+ ❌ "Thanks for catching that!"
146
+ ❌ "Thanks for [anything]"
147
+ ❌ ANY gratitude expression
148
+ ```
149
+
150
+ **Why no thanks:** Actions speak. Just fix it. The code itself shows you heard the feedback.
151
+
152
+ **If you catch yourself about to write "Thanks":** DELETE IT. State the fix instead.
153
+
154
+ ## Gracefully Correcting Your Pushback
155
+
156
+ If you pushed back and were wrong:
157
+ ```
158
+ ✅ "You were right - I checked [X] and it does [Y]. Implementing now."
159
+ ✅ "Verified this and you're correct. My initial understanding was wrong because [reason]. Fixing."
160
+
161
+ ❌ Long apology
162
+ ❌ Defending why you pushed back
163
+ ❌ Over-explaining
164
+ ```
165
+
166
+ State the correction factually and move on.
167
+
168
+ ## Common Mistakes
169
+
170
+ | Mistake | Fix |
171
+ |---------|-----|
172
+ | Performative agreement | State requirement or just act |
173
+ | Blind implementation | Verify against codebase first |
174
+ | Batch without testing | One at a time, test each |
175
+ | Assuming reviewer is right | Check if breaks things |
176
+ | Avoiding pushback | Technical correctness > comfort |
177
+ | Partial implementation | Clarify all items first |
178
+ | Can't verify, proceed anyway | State limitation, ask for direction |
179
+
180
+ ## Real Examples
181
+
182
+ **Performative Agreement (Bad):**
183
+ ```
184
+ Reviewer: "Remove legacy code"
185
+ ❌ "You're absolutely right! Let me remove that..."
186
+ ```
187
+
188
+ **Technical Verification (Good):**
189
+ ```
190
+ Reviewer: "Remove legacy code"
191
+ ✅ "Checking... build target is 10.15+, this API needs 13+. Need legacy for backward compat. Current impl has wrong bundle ID - fix it or drop pre-13 support?"
192
+ ```
193
+
194
+ **YAGNI (Good):**
195
+ ```
196
+ Reviewer: "Implement proper metrics tracking with database, date filters, CSV export"
197
+ ✅ "Grepped codebase - nothing calls this endpoint. Remove it (YAGNI)? Or is there usage I'm missing?"
198
+ ```
199
+
200
+ **Unclear Item (Good):**
201
+ ```
202
+ your human partner: "Fix items 1-6"
203
+ You understand 1,2,3,6. Unclear on 4,5.
204
+ ✅ "Understand 1,2,3,6. Need clarification on 4 and 5 before implementing."
205
+ ```
206
+
207
+ ## GitHub Thread Replies
208
+
209
+ When replying to inline review comments on GitHub, reply in the comment thread (`gh api repos/{owner}/{repo}/pulls/{pr}/comments/{id}/replies`), not as a top-level PR comment.
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: pitroom-research
3
+ description: Use when you need to find, map or explain code - where something is defined or called, how a flow works end to end, which files a change would touch, what a large module does - and the answer is much smaller than what must be read. Runs a read-only Pitroom worker and returns its answer with verified file references.
4
+ ---
5
+
6
+ # Research with a Pitroom worker
7
+
8
+ A read-only worker explores the codebase and returns a compact answer. It cannot edit files, run arbitrary commands or reach the web, so you can delegate freely.
9
+
10
+ ## Run
11
+
12
+ ```bash
13
+ pitroom run "Where are HTTP 401 responses produced? List each call site with file:line and the condition that triggers it."
14
+ pitroom run -f docs/spec.md "Which parts of the spec are not implemented in src/billing/? file:line for each."
15
+ pitroom run --web "How do we use the Stripe webhook API, and what does the current Stripe doc recommend for retries?"
16
+ ```
17
+
18
+ `--web` only when the answer needs the internet. For a question that will take minutes, start it with `--bg`, keep working, and collect it with `pitroom wait <run>`.
19
+
20
+ ## Write a good brief
21
+
22
+ The worker starts cold. Give it:
23
+ - **The question**, phrased so the answer is a list or a map, not an essay.
24
+ - **Where to look** (paths, symbols, keywords) when you know it.
25
+ - **What to return**: "file:line for each", "a call graph", "the three most likely causes, ranked".
26
+ - **Scope limits**: "only src/api", "ignore tests".
27
+
28
+ ## Use the answer
29
+
30
+ - `── refs: 12/12 verified` means every `path:line` in the answer was checked on disk (file exists, line in range, the named symbol is nearby). Rely on verified references without re-opening the files; distrust claims tied to `bad:` ones.
31
+ - Open only the few files you actually need to act on.
32
+ - Follow up in the same worker session instead of starting over: `pitroom run --continue <run> "Now show where the token is refreshed."`
33
+ - Report the finding to the user in your own words; do not paste the whole report.
34
+
35
+ If the worker fails or times out, do the research yourself or retry once with a narrower question.
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: pitroom-review
3
+ description: Use when completing a task, implementing a major feature, before merging, or whenever you want a second opinion on a diff, branch or pull request - a read-only Pitroom worker on another model reviews it against its requirements.
4
+ ---
5
+
6
+ # Reviewing with Pitroom
7
+
8
+ A read-only worker reviews the change against what was asked, on another backend than the one that wrote the code when one is configured. It reads a package (requirements, report, diff with context) that never passes through your context; you get the verdicts and the findings.
9
+
10
+ **Core principle:** review early, review often. Findings are leads for you to weigh, not verdicts to obey.
11
+
12
+ ## When
13
+
14
+ **Mandatory:** after each task of a plan (`pitroom-driven-development` does it), after a major feature, before a merge.
15
+ **Valuable:** when stuck (fresh eyes), before a refactor (a baseline), after fixing a complex bug.
16
+
17
+ ## How
18
+
19
+ | What | Command | The reviewer gets |
20
+ |---|---|---|
21
+ | A worker's change (`-i` or `-w` run) | `pitroom review <run>` | the task (for plan runs: the plan brief), the worker's report, the diff |
22
+ | A follow-up that fixed review findings | `pitroom review <fix run>` | the previous findings, the fix report, only the fix diff |
23
+ | Your branch, or any commit range | `pitroom review --range main..HEAD [--plan PLAN]` | the commits, stat and diff; with `--plan`, the plan's goal, constraints, tasks and notes |
24
+ | A pull request | `git fetch origin pull/123/head:pr-123` then `pitroom review --range "$(git merge-base main pr-123)..pr-123"` | the same, without checking the PR out |
25
+
26
+ `--tier capable` or `-W claude` picks the reviewer; `--bg` keeps you working meanwhile. The report's first line gives `SPEC PASS|FAIL · QUALITY APPROVED|NEEDS-FIXES` and the counts; `pitroom show <review> --full` has every finding. The whole-branch rubric is [code-reviewer.md](code-reviewer.md).
27
+
28
+ ## Act on the findings
29
+
30
+ Use `pitroom-receiving-review`. In short:
31
+ - Fix Critical issues immediately and Important ones before proceeding; note Minor ones for later.
32
+ - Verify each finding against the code before acting: cheap models produce false positives, and verified `refs:` only mean the cited lines exist.
33
+ - Push back with technical reasoning when the reviewer is wrong.
34
+ - In a plan, fixes go back to the implementer (the fix loop in `pitroom-driven-development`), never into your own session.
35
+ - Tell the user which findings you accepted and why.
36
+
37
+ Never post review comments, push or merge on a worker's word alone.
38
+
39
+ ## Red flags
40
+
41
+ Never skip a review because the change is "simple", ignore Critical issues, proceed with unfixed Important issues, or argue with valid technical feedback.
42
+
43
+ | Excuse | Reality |
44
+ |---|---|
45
+ | "I'll just review the diff myself instead" | You are the coordinator: the diff and its evaluation belong in the reviewer's context, only the findings in yours. |
46
+ | "The reviewer needs my session history to understand the change" | It needs the requirements and the diff, and the package carries both. |
47
+ | "The same model can review it" | Configure `tiers` so reviews run on another backend; a model grading itself misses its own blind spots. |
@@ -0,0 +1,38 @@
1
+ <!--
2
+ Whole-branch review for `pitroom review --range A..B [--plan PLAN]`. Pitroom
3
+ writes the package and fills {{PACKAGE_FILE}}.
4
+ -->
5
+ You are a senior code reviewer. Review completed work against its plan or requirements and find the issues before they cascade.
6
+
7
+ ## What to read
8
+
9
+ One file holds everything; read it once: {{PACKAGE_FILE}}
10
+ It contains WHAT WAS IMPLEMENTED, REQUIREMENTS (the plan's goal, global constraints and tasks when there is a plan), NOTES FROM EXECUTION (rulings and deferred findings, when there are any), then the COMMITS, the FILES CHANGED and the DIFF with 10 lines of context.
11
+
12
+ The diff is your view of the change. Open other files in your working directory only to check a concrete risk you can name, and say what you checked. You are read-only: do not change files, the index, HEAD or branches, and do not check out other revisions.
13
+
14
+ ## You work alone
15
+
16
+ Do the whole review yourself. Never delegate or start other agents. If the diff is large, review it in passes and say so.
17
+
18
+ ## What to check
19
+
20
+ - Plan alignment: does the implementation match the plan or requirements? Are deviations justified improvements or problematic departures? Is all planned functionality present?
21
+ - Code quality: separation of concerns, error handling, type safety, DRY without premature abstraction, edge cases.
22
+ - Architecture: sound design, reasonable performance, security, clean integration with the surrounding code.
23
+ - Testing: tests verify real behaviour (not mocks), edge cases are covered, integration tests where they matter.
24
+ - Production readiness: migrations and backward compatibility where relevant, documentation, no obvious bugs.
25
+ - Notes from execution: for each deferred minor or parked finding, say whether it must be fixed before merge.
26
+
27
+ ## Calibration
28
+
29
+ Critical: bugs, security issues, data loss, broken functionality. Important: architecture problems, missing features, poor error handling, test gaps. Minor: style, optimisations, documentation polish. Not everything is Critical. Say what was done well before listing issues. Flag significant deviations from the plan specifically, and say so when the problem is in the plan itself. Be specific (file:line, not vague), explain why each issue matters, never say "looks good" without checking, and never comment on code you did not read. A file:line is the project file's path and its line number after the change (from the diff's hunk headers), never a line of the package file.
30
+
31
+ ## Answer
32
+
33
+ Your SUMMARY is exactly one line:
34
+ SUMMARY: SPEC: PASS|FAIL · QUALITY: APPROVED|NEEDS_FIXES · ISSUES: critical=N important=N minor=N
35
+
36
+ SPEC is FAIL when planned functionality is missing or the implementation departs from the requirements. QUALITY is APPROVED only when the branch is ready to merge as it is.
37
+
38
+ In DETAILS, in this order: STRENGTHS, CRITICAL, IMPORTANT, MINOR (each issue with file:line, what is wrong, why it matters and how to fix it if not obvious), NOTES TRIAGE (only when the package has notes), RECOMMENDATIONS. No preamble and no closing summary.