Skip to content

Commit 9989396

Browse files
authored
chore: Update Doistbot local review loop skill (#1055)
This file is automatically synced from the `shared-configs` repository. Source: https://github.com/doist/shared-configs/blob/main/
1 parent 9af8873 commit 9989396

1 file changed

Lines changed: 173 additions & 0 deletions

File tree

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
---
2+
name: doistbot-loop
3+
description: Run judgment-driven Doistbot local self-review loops against local git changes. Use when a user wants an agent to review and refine a branch before opening a pull request by running the Doistbot CLI, classifying findings for scope and relevance, fixing actionable issues, rerunning review, and stopping when remaining feedback is nits, out of scope, speculative, or no longer worth addressing.
4+
---
5+
6+
# Doistbot Loop
7+
8+
Use Doistbot CLI findings as review input, not as an automatic task list. The CLI's job is to propose findings; the agent's job is to exercise independent engineering judgment. Only change code when a finding is high quality, high impact, in scope for the current work, and likely to improve the PR's quality, stability, correctness, or maintainability.
9+
10+
## Prerequisites
11+
12+
Before doing any review work, verify the CLI is installed:
13+
14+
```bash
15+
doistbot --version
16+
```
17+
18+
If `doistbot` is not available, stop. Do not install it automatically. Tell the user:
19+
20+
```text
21+
Doistbot CLI is required for this skill. Install it first:
22+
23+
brew install Doist/tap/doistbot-cli
24+
doistbot setup
25+
26+
Or with npm:
27+
28+
npm install -g @doist/doistbot-cli
29+
doistbot setup
30+
31+
Then rerun the skill.
32+
```
33+
34+
Require `doistbot >= 1.0.3`, because earlier versions do not include the internal JSON review output this skill uses. Parse the semantic version from `doistbot --version`; if the installed version is `1.0.2` or older, stop. Do not upgrade it automatically. Tell the user:
35+
36+
```text
37+
Doistbot CLI 1.0.3 or newer is required for this skill. Upgrade it first:
38+
39+
brew update && brew upgrade doistbot-cli
40+
41+
Or with npm:
42+
43+
npm install -g @doist/doistbot-cli@latest
44+
45+
Then rerun the skill.
46+
```
47+
48+
Then check configuration:
49+
50+
```bash
51+
doistbot doctor
52+
```
53+
54+
If `doctor` reports missing auth or setup, stop and tell the user to run `doistbot setup` or `doistbot auth`.
55+
56+
## User Updates
57+
58+
Do not run long review/fix/review cycles silently. Post visible status updates through the current agent interface:
59+
60+
- before starting the first review
61+
- when each review round starts
62+
- after findings are classified
63+
- before editing a batch of files
64+
- after tests or checks complete
65+
- before starting another review round
66+
- when stopping with the final readiness summary
67+
68+
While a Doistbot review command is running, keep updates quiet. Post at most one or two brief waiting updates such as "Doistbot reviews can take a while, so I am waiting for the CLI to finish." Do not post repeated minute-by-minute chatter. For tests or edit work that runs longer than roughly 30-60 seconds, post concise progress updates with the current activity and next expected step.
69+
70+
## Review Loop
71+
72+
Start by checking the local change shape:
73+
74+
```bash
75+
git status --short
76+
```
77+
78+
Choose the initial review scope from `git status --short`:
79+
80+
- If the output is empty, the working tree is clean. Review the branch's committed changes against the repository base with:
81+
82+
```bash
83+
doistbot review --json
84+
```
85+
86+
- If there are unstaged or untracked files, stage all local files first, then review the staged snapshot:
87+
88+
```bash
89+
git add -A
90+
doistbot review staged --json
91+
```
92+
93+
- If there are already staged files and no unstaged or untracked files, review the staged snapshot:
94+
95+
```bash
96+
doistbot review staged --json
97+
```
98+
99+
When operating inside a sandboxed or approval-gated agent environment, request the approval needed for Doistbot review to reach its configured model providers before the first review command. Tell the user that the review may send the local diff/code to configured providers. Do not first run Doistbot in a restricted sandbox if that environment is expected to block provider access. If approval is denied, stop and ask the user to run the selected Doistbot JSON review command locally and share the output; do not substitute a manual/local-only review for the Doistbot loop.
100+
101+
Doistbot reviews can take several minutes. After starting a Doistbot JSON review command, wait for the CLI to exit naturally and rely on the CLI's own timeout. Do not interrupt, cancel, or kill the review process while it is still running. Keep posting concise status updates while waiting. If the CLI exits with its own timeout or another error, stop and report that exact failure.
102+
103+
After making any code, test, config, or documentation change, stage the changed files before continuing:
104+
105+
```bash
106+
git add -A
107+
```
108+
109+
Once the agent has edited, created, or deleted even one file during the loop, every following Doistbot round must review the staged snapshot:
110+
111+
```bash
112+
doistbot review staged --json
113+
```
114+
115+
Do not run another Doistbot review while agent-made edits remain unstaged. Do not keep rerunning `doistbot review staged --json` against an outdated staged snapshot after editing files.
116+
117+
In JSON mode, treat `review.findings` as the canonical feedback list and `review.count` as the derived finding total for reporting.
118+
119+
After every JSON review, inspect the review status before classifying findings.
120+
121+
If `providerFailures` is non-empty, stop the loop even when `status` is `reviewed`. Surface the specific provider failure messages to the user, explain that the review did not run with full provider coverage, and ask the user to run:
122+
123+
```bash
124+
doistbot doctor
125+
```
126+
127+
If `status` is `unverified` or `verified` is `false`, stop the loop. Surface `unverifiedReason`, include any provider failure messages, explain that the review cannot be trusted, and ask the user to run `doistbot doctor`. Do not classify findings, edit files, or start another review round until the user resolves the issue and reruns the skill.
128+
129+
If `status` is `skipped`, stop the loop and summarize `skipReason`. For `no_diff` or `empty_diff`, tell the user there are no local changes in the selected review scope.
130+
131+
Doistbot will return findings on every round. The agent must not treat findings as mandatory tasks or optimize for reaching `review.count: 0`. Before editing, carefully critique every finding for correctness, scope, expected impact, risk, and practical value. Be judicious and decisive: fix only feedback that is clearly valid, high quality, within the current work's scope, and reasonable to address immediately.
132+
133+
For each finding, ask:
134+
135+
- Is the finding factually correct after inspecting the code and relevant context?
136+
- Would fixing it materially improve quality, stability, correctness, security, performance, or maintainability?
137+
- Is it within the current diff's intended scope?
138+
- Can it be fixed surgically without changing broad ownership, architecture, or unrelated behavior?
139+
- Is the proposed fix safer and simpler than leaving the code as-is?
140+
141+
- `address`: high-quality and high-impact enough to fix now; actionable, in scope for the current diff, likely correct, and fixable without broad unrelated changes or architecture decisions
142+
- `defer`: valid but outside this PR, too broad, requires product/design judgment, or belongs in follow-up work
143+
- `dismiss`: speculative, incorrect, already handled, or not worth author attention
144+
- `nit`: optional polish; fix only when cheap and clearly beneficial
145+
146+
Fix only `address` findings. Omit `defer`, `dismiss`, and `nit` findings from the edit batch. When omitting a finding, say which finding is being omitted and why, either in the classification update or the final summary.
147+
148+
When several fixes are possible, choose the smallest conservative fix that preserves existing ownership, safety, and behavior. Do not introduce custom wrappers, broad ownership changes, cross-cutting refactors, or clever abstractions just to satisfy a finding. If a finding can only be addressed with a larger redesign, defer it and explain the tradeoff instead of expanding the loop.
149+
150+
After making edits, stage all changes and run targeted checks that match the touched files and repository conventions. If checks require follow-up edits, stage those edits too before the next Doistbot round. Then rerun Doistbot with `doistbot review staged --json`.
151+
152+
There is no fixed round cap, but the loop must stay surgical. Stop when no clearly addressable findings remain, even if Doistbot still reports feedback. A branch can be ready when the remaining findings are nits, deferred items, dismissed items, disputed tradeoffs, or scope-expanding suggestions.
153+
154+
Stop and summarize instead of continuing when:
155+
156+
- the next finding would expand the change beyond the current work's intended scope
157+
- the next finding requires touching broad/shared architecture, large ownership boundaries, or many unrelated files
158+
- the same finding repeats after a reasonable fix or explicit dismissal
159+
- the loop starts revisiting or reversing the same design tradeoff
160+
- new findings are only nits, preferences, or speculation
161+
- fixing requires user, product, design, or reviewer judgment
162+
- provider failures are reported in the JSON output
163+
- the agent is no longer making meaningful progress
164+
165+
## Final Summary
166+
167+
End with a concise readiness summary:
168+
169+
- review rounds run
170+
- feedback raised during the loop, grouped by fixed, omitted/deferred, dismissed, and nits
171+
- for every omitted/deferred/dismissed finding, a brief reason why it was not fixed
172+
- checks run and their result
173+
- whether the branch looks ready to open as a PR

0 commit comments

Comments
 (0)