overkill 0.2.1__tar.gz → 0.4.0__tar.gz

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 (97) hide show
  1. {overkill-0.2.1 → overkill-0.4.0}/.github/workflows/publish.yml +2 -2
  2. {overkill-0.2.1 → overkill-0.4.0}/.github/workflows/test.yml +3 -3
  3. {overkill-0.2.1 → overkill-0.4.0}/.gitignore +3 -1
  4. overkill-0.2.1/.reviewlooprc.example → overkill-0.4.0/.overkillrc.example +2 -2
  5. {overkill-0.2.1 → overkill-0.4.0}/PKG-INFO +15 -15
  6. {overkill-0.2.1 → overkill-0.4.0}/README.md +14 -14
  7. {overkill-0.2.1 → overkill-0.4.0}/bin/lib/common.sh +1 -1
  8. {overkill-0.2.1 → overkill-0.4.0}/prompts/active/claude-review.prompt.md +20 -2
  9. overkill-0.4.0/prompts/active/codex-review.prompt.md +81 -0
  10. overkill-0.4.0/prompts/active/gemini-refactor-full.prompt.md +115 -0
  11. overkill-0.4.0/prompts/active/gemini-refactor-layer.prompt.md +115 -0
  12. overkill-0.4.0/prompts/active/gemini-refactor-micro.prompt.md +116 -0
  13. overkill-0.4.0/prompts/active/gemini-refactor-module.prompt.md +114 -0
  14. overkill-0.2.1/prompts/active/codex-review.prompt.md → overkill-0.4.0/prompts/active/gemini-review.prompt.md +20 -2
  15. {overkill-0.2.1 → overkill-0.4.0}/pyproject.toml +2 -2
  16. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/__main__.py +2 -2
  17. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/agents.py +102 -0
  18. overkill-0.4.0/src/mr_overkill/budget/gemini.py +23 -0
  19. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/cli.py +97 -19
  20. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/git_ops.py +5 -2
  21. overkill-0.4.0/src/mr_overkill/init.py +214 -0
  22. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/loop_engine.py +33 -9
  23. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/models.py +3 -1
  24. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/refactor_suggest.py +14 -4
  25. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/retry.py +92 -0
  26. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/self_review.py +1 -1
  27. {overkill-0.2.1 → overkill-0.4.0}/tests/test_agents.py +107 -0
  28. overkill-0.4.0/tests/test_budget_gemini.py +20 -0
  29. {overkill-0.2.1 → overkill-0.4.0}/tests/test_cli.py +42 -5
  30. overkill-0.4.0/tests/test_init.py +161 -0
  31. {overkill-0.2.1 → overkill-0.4.0}/tests/test_retry.py +57 -0
  32. {overkill-0.2.1 → overkill-0.4.0}/uninstall.sh +32 -3
  33. {overkill-0.2.1 → overkill-0.4.0}/uv.lock +1 -1
  34. overkill-0.2.1/src/mr_overkill/init.py +0 -142
  35. overkill-0.2.1/tests/test_init.py +0 -110
  36. {overkill-0.2.1 → overkill-0.4.0}/.python-version +0 -0
  37. {overkill-0.2.1 → overkill-0.4.0}/.refactorsuggestrc.example +0 -0
  38. {overkill-0.2.1 → overkill-0.4.0}/AGENTS.md +0 -0
  39. {overkill-0.2.1 → overkill-0.4.0}/CLAUDE.md +0 -0
  40. {overkill-0.2.1 → overkill-0.4.0}/GEMINI.md +0 -0
  41. {overkill-0.2.1 → overkill-0.4.0}/LICENSE +0 -0
  42. {overkill-0.2.1 → overkill-0.4.0}/bin/lib/check-claude-limit.sh +0 -0
  43. {overkill-0.2.1 → overkill-0.4.0}/bin/lib/check-codex-limit.sh +0 -0
  44. {overkill-0.2.1 → overkill-0.4.0}/bin/lib/retry.sh +0 -0
  45. {overkill-0.2.1 → overkill-0.4.0}/bin/lib/self-review.sh +0 -0
  46. {overkill-0.2.1 → overkill-0.4.0}/bin/refactor-suggest.sh +0 -0
  47. {overkill-0.2.1 → overkill-0.4.0}/bin/review-loop.sh +0 -0
  48. {overkill-0.2.1 → overkill-0.4.0}/install.sh +0 -0
  49. {overkill-0.2.1 → overkill-0.4.0}/prompts/active/claude-fix-execute.prompt.md +0 -0
  50. {overkill-0.2.1 → overkill-0.4.0}/prompts/active/claude-fix.prompt.md +0 -0
  51. {overkill-0.2.1 → overkill-0.4.0}/prompts/active/claude-refactor-fix-execute.prompt.md +0 -0
  52. {overkill-0.2.1 → overkill-0.4.0}/prompts/active/claude-refactor-fix.prompt.md +0 -0
  53. {overkill-0.2.1 → overkill-0.4.0}/prompts/active/claude-refactor-full.prompt.md +0 -0
  54. {overkill-0.2.1 → overkill-0.4.0}/prompts/active/claude-refactor-layer.prompt.md +0 -0
  55. {overkill-0.2.1 → overkill-0.4.0}/prompts/active/claude-refactor-micro.prompt.md +0 -0
  56. {overkill-0.2.1 → overkill-0.4.0}/prompts/active/claude-refactor-module.prompt.md +0 -0
  57. {overkill-0.2.1 → overkill-0.4.0}/prompts/active/claude-self-review.prompt.md +0 -0
  58. {overkill-0.2.1 → overkill-0.4.0}/prompts/active/codex-refactor-full.prompt.md +0 -0
  59. {overkill-0.2.1 → overkill-0.4.0}/prompts/active/codex-refactor-layer.prompt.md +0 -0
  60. {overkill-0.2.1 → overkill-0.4.0}/prompts/active/codex-refactor-micro.prompt.md +0 -0
  61. {overkill-0.2.1 → overkill-0.4.0}/prompts/active/codex-refactor-module.prompt.md +0 -0
  62. {overkill-0.2.1 → overkill-0.4.0}/prompts/reference/claude-code-review-plugin.md +0 -0
  63. {overkill-0.2.1 → overkill-0.4.0}/prompts/reference/claude-security-review.md +0 -0
  64. {overkill-0.2.1 → overkill-0.4.0}/prompts/reference/codex-review-original.md +0 -0
  65. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/__init__.py +0 -0
  66. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/budget/__init__.py +0 -0
  67. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/budget/claude.py +0 -0
  68. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/budget/codex.py +0 -0
  69. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/budget_report.py +0 -0
  70. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/classify.py +0 -0
  71. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/data/__init__.py +0 -0
  72. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/json_extract.py +0 -0
  73. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/reporting.py +0 -0
  74. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/resume.py +0 -0
  75. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/review_loop.py +0 -0
  76. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/time_utils.py +0 -0
  77. {overkill-0.2.1 → overkill-0.4.0}/src/mr_overkill/two_step_fix.py +0 -0
  78. {overkill-0.2.1 → overkill-0.4.0}/test/refactor-suggest.bats +0 -0
  79. {overkill-0.2.1 → overkill-0.4.0}/test/test_helper.bash +0 -0
  80. {overkill-0.2.1 → overkill-0.4.0}/tests/__init__.py +0 -0
  81. {overkill-0.2.1 → overkill-0.4.0}/tests/conftest.py +0 -0
  82. {overkill-0.2.1 → overkill-0.4.0}/tests/test_budget_claude.py +0 -0
  83. {overkill-0.2.1 → overkill-0.4.0}/tests/test_budget_codex.py +0 -0
  84. {overkill-0.2.1 → overkill-0.4.0}/tests/test_budget_policy.py +0 -0
  85. {overkill-0.2.1 → overkill-0.4.0}/tests/test_budget_report.py +0 -0
  86. {overkill-0.2.1 → overkill-0.4.0}/tests/test_classify.py +0 -0
  87. {overkill-0.2.1 → overkill-0.4.0}/tests/test_git_ops.py +0 -0
  88. {overkill-0.2.1 → overkill-0.4.0}/tests/test_integration.py +0 -0
  89. {overkill-0.2.1 → overkill-0.4.0}/tests/test_json_extract.py +0 -0
  90. {overkill-0.2.1 → overkill-0.4.0}/tests/test_loop_engine.py +0 -0
  91. {overkill-0.2.1 → overkill-0.4.0}/tests/test_refactor_suggest.py +0 -0
  92. {overkill-0.2.1 → overkill-0.4.0}/tests/test_reporting.py +0 -0
  93. {overkill-0.2.1 → overkill-0.4.0}/tests/test_resume.py +0 -0
  94. {overkill-0.2.1 → overkill-0.4.0}/tests/test_review_loop.py +0 -0
  95. {overkill-0.2.1 → overkill-0.4.0}/tests/test_self_review.py +0 -0
  96. {overkill-0.2.1 → overkill-0.4.0}/tests/test_time_utils.py +0 -0
  97. {overkill-0.2.1 → overkill-0.4.0}/tests/test_two_step_fix.py +0 -0
@@ -13,9 +13,9 @@ jobs:
13
13
  runs-on: ubuntu-latest
14
14
 
15
15
  steps:
16
- - uses: actions/checkout@v4
16
+ - uses: actions/checkout@v6
17
17
 
18
- - uses: astral-sh/setup-uv@v5
18
+ - uses: astral-sh/setup-uv@v7
19
19
  with:
20
20
  python-version: "3.12"
21
21
 
@@ -14,9 +14,9 @@ jobs:
14
14
  python-version: ["3.12", "3.13"]
15
15
 
16
16
  steps:
17
- - uses: actions/checkout@v4
17
+ - uses: actions/checkout@v6
18
18
 
19
- - uses: astral-sh/setup-uv@v5
19
+ - uses: astral-sh/setup-uv@v7
20
20
  with:
21
21
  python-version: ${{ matrix.python-version }}
22
22
 
@@ -30,4 +30,4 @@ jobs:
30
30
  run: uv run mypy src
31
31
 
32
32
  - name: Pytest
33
- run: uv run pytest
33
+ run: uv run pytest --cov=mr_overkill --cov-report=term-missing --cov-fail-under=70
@@ -3,7 +3,9 @@
3
3
 
4
4
  # Legacy log directory from previous versions
5
5
  .ai-review-logs/
6
- # review-loop self-hosted install
6
+ # overkill self-hosted install
7
+ .overkill/
8
+ # Legacy directory (pre-migration)
7
9
  .review-loop/
8
10
 
9
11
  # Python
@@ -1,5 +1,5 @@
1
- # .reviewlooprc — project-level configuration for review-loop.sh
2
- # Copy this file to your project root as ".reviewlooprc" and customize.
1
+ # .overkillrc — project-level configuration for overkill review-loop
2
+ # Place this file in .overkill/.overkillrc and customize.
3
3
  # CLI arguments always take precedence over these values.
4
4
 
5
5
  # Target branch to diff against (default: develop)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: overkill
3
- Version: 0.2.1
3
+ Version: 0.4.0
4
4
  Summary: AI-powered code review loop — automates Codex review + Claude fix cycles
5
5
  Project-URL: Repository, https://github.com/modocai/mr-overkill
6
6
  Project-URL: Issues, https://github.com/modocai/mr-overkill/issues
@@ -161,7 +161,7 @@ Examples:
161
161
 
162
162
  ## Usage: overkill init
163
163
 
164
- Initialize `.review-loop/` in a project directory. Safe to re-run — prompts are refreshed, user-edited configs are preserved.
164
+ Initialize `.overkill/` in a project directory. Safe to re-run — prompts are refreshed, user-edited configs are preserved.
165
165
 
166
166
  ```
167
167
  overkill init [TARGET_DIR] # default: current directory
@@ -170,9 +170,9 @@ overkill init [TARGET_DIR] # default: current directory
170
170
  Creates:
171
171
 
172
172
  ```
173
- .review-loop/
173
+ .overkill/
174
174
  ├── prompts/active/ # 10 prompt templates
175
- ├── .reviewlooprc # review-loop config
175
+ ├── .overkillrc # review-loop config
176
176
  ├── .refactorsuggestrc # refactor-suggest config
177
177
  ├── logs/ # runtime logs
178
178
  │ └── refactor/ # refactor-suggest logs
@@ -207,9 +207,9 @@ Recommended workflow: start with `--dry-run` to review findings, then re-run wit
207
207
 
208
208
  ## Configuration
209
209
 
210
- After running `overkill init`, config files live in `.review-loop/`:
210
+ After running `overkill init`, config files live in `.overkill/`:
211
211
 
212
- ### .review-loop/.reviewlooprc
212
+ ### .overkill/.overkillrc
213
213
 
214
214
  ```bash
215
215
  TARGET_BRANCH="main"
@@ -220,9 +220,9 @@ REVIEWER_BACKEND="codex" # or "claude"
220
220
  PROMPTS_DIR="./custom-prompts"
221
221
  ```
222
222
 
223
- See `.review-loop/.reviewlooprc` for all available options.
223
+ See `.overkill/.overkillrc` for all available options.
224
224
 
225
- ### .review-loop/.refactorsuggestrc
225
+ ### .overkill/.refactorsuggestrc
226
226
 
227
227
  ```bash
228
228
  SCOPE="auto"
@@ -243,7 +243,7 @@ PROMPTS_DIR="./custom-prompts"
243
243
 
244
244
  ```
245
245
  1. Check prerequisites (git, codex, claude, jq, envsubst, target branch)
246
- 2. Create .review-loop/logs/ directory
246
+ 2. Create .overkill/logs/ directory
247
247
  3. Loop (iteration 1..N):
248
248
  a. Generate diff: git diff $TARGET...$CURRENT
249
249
  b. Empty diff → exit
@@ -258,14 +258,14 @@ PROMPTS_DIR="./custom-prompts"
258
258
  h. Push to remote (updates PR)
259
259
  i. Post review/fix/self-review summary as PR comment
260
260
  j. Next iteration reviews the updated committed state
261
- 4. Write summary to .review-loop/logs/summary.md
261
+ 4. Write summary to .overkill/logs/summary.md
262
262
  ```
263
263
 
264
264
  ## Output Files
265
265
 
266
- All logs are git-ignored by default (inside `.review-loop/`).
266
+ All logs are git-ignored by default (inside `.overkill/`).
267
267
 
268
- ### review-loop logs (`.review-loop/logs/`)
268
+ ### review-loop logs (`.overkill/logs/`)
269
269
 
270
270
  | File | Description |
271
271
  |------|-------------|
@@ -277,7 +277,7 @@ All logs are git-ignored by default (inside `.review-loop/`).
277
277
  | `refix-N-M.md` | Claude re-fix log (iteration N, sub-iteration M) |
278
278
  | `summary.md` | Final summary with status and per-iteration results |
279
279
 
280
- ### refactor-suggest logs (`.review-loop/logs/refactor/`)
280
+ ### refactor-suggest logs (`.overkill/logs/refactor/`)
281
281
 
282
282
  | File | Description |
283
283
  |------|-------------|
@@ -316,7 +316,7 @@ Go/no-go decision based on current usage percentage:
316
316
 
317
317
  ## Customizing Prompts
318
318
 
319
- Edit the templates in `.review-loop/prompts/active/`.
319
+ Edit the templates in `.overkill/prompts/active/`.
320
320
 
321
321
  ### review-loop prompts
322
322
 
@@ -364,7 +364,7 @@ The loop terminates when any of these occur:
364
364
 
365
365
  ```bash
366
366
  # Quick — just nuke the directory
367
- rm -rf .review-loop
367
+ rm -rf .overkill
368
368
 
369
369
  # Also remove the Python package
370
370
  pip uninstall overkill # or: uv tool uninstall overkill / pipx uninstall overkill
@@ -139,7 +139,7 @@ Examples:
139
139
 
140
140
  ## Usage: overkill init
141
141
 
142
- Initialize `.review-loop/` in a project directory. Safe to re-run — prompts are refreshed, user-edited configs are preserved.
142
+ Initialize `.overkill/` in a project directory. Safe to re-run — prompts are refreshed, user-edited configs are preserved.
143
143
 
144
144
  ```
145
145
  overkill init [TARGET_DIR] # default: current directory
@@ -148,9 +148,9 @@ overkill init [TARGET_DIR] # default: current directory
148
148
  Creates:
149
149
 
150
150
  ```
151
- .review-loop/
151
+ .overkill/
152
152
  ├── prompts/active/ # 10 prompt templates
153
- ├── .reviewlooprc # review-loop config
153
+ ├── .overkillrc # review-loop config
154
154
  ├── .refactorsuggestrc # refactor-suggest config
155
155
  ├── logs/ # runtime logs
156
156
  │ └── refactor/ # refactor-suggest logs
@@ -185,9 +185,9 @@ Recommended workflow: start with `--dry-run` to review findings, then re-run wit
185
185
 
186
186
  ## Configuration
187
187
 
188
- After running `overkill init`, config files live in `.review-loop/`:
188
+ After running `overkill init`, config files live in `.overkill/`:
189
189
 
190
- ### .review-loop/.reviewlooprc
190
+ ### .overkill/.overkillrc
191
191
 
192
192
  ```bash
193
193
  TARGET_BRANCH="main"
@@ -198,9 +198,9 @@ REVIEWER_BACKEND="codex" # or "claude"
198
198
  PROMPTS_DIR="./custom-prompts"
199
199
  ```
200
200
 
201
- See `.review-loop/.reviewlooprc` for all available options.
201
+ See `.overkill/.overkillrc` for all available options.
202
202
 
203
- ### .review-loop/.refactorsuggestrc
203
+ ### .overkill/.refactorsuggestrc
204
204
 
205
205
  ```bash
206
206
  SCOPE="auto"
@@ -221,7 +221,7 @@ PROMPTS_DIR="./custom-prompts"
221
221
 
222
222
  ```
223
223
  1. Check prerequisites (git, codex, claude, jq, envsubst, target branch)
224
- 2. Create .review-loop/logs/ directory
224
+ 2. Create .overkill/logs/ directory
225
225
  3. Loop (iteration 1..N):
226
226
  a. Generate diff: git diff $TARGET...$CURRENT
227
227
  b. Empty diff → exit
@@ -236,14 +236,14 @@ PROMPTS_DIR="./custom-prompts"
236
236
  h. Push to remote (updates PR)
237
237
  i. Post review/fix/self-review summary as PR comment
238
238
  j. Next iteration reviews the updated committed state
239
- 4. Write summary to .review-loop/logs/summary.md
239
+ 4. Write summary to .overkill/logs/summary.md
240
240
  ```
241
241
 
242
242
  ## Output Files
243
243
 
244
- All logs are git-ignored by default (inside `.review-loop/`).
244
+ All logs are git-ignored by default (inside `.overkill/`).
245
245
 
246
- ### review-loop logs (`.review-loop/logs/`)
246
+ ### review-loop logs (`.overkill/logs/`)
247
247
 
248
248
  | File | Description |
249
249
  |------|-------------|
@@ -255,7 +255,7 @@ All logs are git-ignored by default (inside `.review-loop/`).
255
255
  | `refix-N-M.md` | Claude re-fix log (iteration N, sub-iteration M) |
256
256
  | `summary.md` | Final summary with status and per-iteration results |
257
257
 
258
- ### refactor-suggest logs (`.review-loop/logs/refactor/`)
258
+ ### refactor-suggest logs (`.overkill/logs/refactor/`)
259
259
 
260
260
  | File | Description |
261
261
  |------|-------------|
@@ -294,7 +294,7 @@ Go/no-go decision based on current usage percentage:
294
294
 
295
295
  ## Customizing Prompts
296
296
 
297
- Edit the templates in `.review-loop/prompts/active/`.
297
+ Edit the templates in `.overkill/prompts/active/`.
298
298
 
299
299
  ### review-loop prompts
300
300
 
@@ -342,7 +342,7 @@ The loop terminates when any of these occur:
342
342
 
343
343
  ```bash
344
344
  # Quick — just nuke the directory
345
- rm -rf .review-loop
345
+ rm -rf .overkill
346
346
 
347
347
  # Also remove the Python package
348
348
  pip uninstall overkill # or: uv tool uninstall overkill / pipx uninstall overkill
@@ -277,7 +277,7 @@ _changed_files_since_snapshot() {
277
277
  _out=$(mktemp)
278
278
  _git_all_dirty_nul | while IFS= read -r -d '' _f; do
279
279
  [[ -n "$_f" ]] || continue
280
- [[ "$_f" == .review-loop/logs/* ]] && continue
280
+ [[ "$_f" == .overkill/logs/* || "$_f" == .review-loop/logs/* ]] && continue
281
281
  if [[ -f "$_f" ]]; then
282
282
  _cur_hash=$(git hash-object "$_f" 2>/dev/null || echo UNHASHABLE)
283
283
  if [[ -x "$_f" ]]; then _cur_mode="100755"; else _cur_mode="100644"; fi
@@ -8,15 +8,23 @@ You are a code reviewer analyzing a proposed change.
8
8
 
9
9
  ## Instructions
10
10
 
11
- Run the following command to get the diff:
11
+ Start by running the following command to get the diff:
12
12
 
13
13
  ```
14
14
  git diff ${TARGET_BRANCH}...${CURRENT_BRANCH}
15
15
  ```
16
16
 
17
+ Then **actively explore the codebase** to understand context before flagging issues:
18
+
19
+ - Use `Read` to examine surrounding code when a change touches a function or module.
20
+ - Use `Grep` to check if a pattern, variable, or function is used elsewhere before calling it dead code or flagging a naming issue.
21
+ - Use `Glob` to find related files (e.g. tests, configs) that may clarify intent.
22
+
17
23
  Review the diff according to the guidelines below.
18
24
 
19
- ## Review Guidelines
25
+ ## Review Guidelines — HIGH SIGNAL ONLY
26
+
27
+ We only want findings where you are confident the issue is real. **If you are not certain an issue is real, do not flag it.** False positives erode trust and waste reviewer time.
20
28
 
21
29
  1. Only flag issues the original author would fix if they knew about them.
22
30
  2. The issue must be **introduced by this diff** — do not flag pre-existing problems.
@@ -24,6 +32,16 @@ Review the diff according to the guidelines below.
24
32
  4. Do not flag trivial style issues unless they obscure meaning or violate documented standards.
25
33
  5. Do not speculate — you must identify the exact code location and explain why it is a problem.
26
34
  6. If this is iteration > 1, focus on whether issues from prior reviews have been properly fixed, and identify any new issues introduced by the fixes.
35
+ 7. **Only flag issues where your confidence is >= 0.85.** If you cannot reach that threshold after investigating, do not include the finding.
36
+
37
+ ### Do NOT flag (false positive filter)
38
+
39
+ - Pre-existing issues not introduced by this diff.
40
+ - Something that appears to be a bug but is actually correct when you read the surrounding code.
41
+ - Pedantic nitpicks that a senior engineer would not flag in a real review.
42
+ - Issues that a linter or formatter will catch — do not run the linter to verify.
43
+ - Potential issues that depend on specific inputs or state that are not demonstrated in the diff.
44
+ - General code quality concerns (e.g. lack of test coverage, general security hygiene) unless they are concretely exploitable.
27
45
 
28
46
  ## Priority Levels
29
47
 
@@ -0,0 +1,81 @@
1
+ You are a code reviewer analyzing a proposed change.
2
+
3
+ ## Context
4
+
5
+ - **Current branch**: ${CURRENT_BRANCH}
6
+ - **Target branch**: ${TARGET_BRANCH}
7
+ - **Review iteration**: ${ITERATION}
8
+
9
+ ## Instructions
10
+
11
+ Run the following command to get the diff:
12
+
13
+ ```
14
+ git diff ${TARGET_BRANCH}...${CURRENT_BRANCH}
15
+ ```
16
+
17
+ Review the diff according to the guidelines below.
18
+
19
+ ## Review Guidelines
20
+
21
+ 1. Only flag issues the original author would fix if they knew about them.
22
+ 2. The issue must be **introduced by this diff** — do not flag pre-existing problems.
23
+ 3. The issue must meaningfully impact the accuracy, performance, security, or maintainability of the code.
24
+ 4. The issue must be discrete, actionable, and concretely provable.
25
+ 5. Fixing the bug does not demand a level of rigor not present in the rest of the codebase (e.g. one doesn't need detailed comments and input validation in a repository of one-off scripts).
26
+ 6. The bug does not rely on unstated assumptions about the codebase or author's intent.
27
+ 7. It is not enough to speculate that a change may disrupt another part of the codebase — you must identify the other parts of the code that are provably affected.
28
+ 8. The bug is clearly not just an intentional change by the original author.
29
+ 9. Do not flag trivial style issues unless they obscure meaning or violate documented standards.
30
+ 10. If this is iteration > 1, focus on whether issues from prior reviews have been properly fixed, and identify any new issues introduced by the fixes.
31
+
32
+ Output all findings that the original author would fix if they knew about them. If there is no finding that a person would definitely want to fix, prefer outputting no findings. Do not stop at the first qualifying finding — continue until you've listed every qualifying finding.
33
+
34
+ ## Priority Levels
35
+
36
+ - **P0** — Drop everything. Blocking release, operations, or major usage. Universal issues not dependent on assumptions.
37
+ - **P1** — Urgent. Should be addressed in the next cycle.
38
+ - **P2** — Normal. To be fixed eventually.
39
+ - **P3** — Low. Nice to have.
40
+
41
+ ## Comment Guidelines
42
+
43
+ - One comment per distinct issue.
44
+ - Brief (at most 1 paragraph body).
45
+ - Clearly state the scenarios, environments, or inputs required for the bug to manifest.
46
+ - Appropriately communicate severity — do not overclaim. Immediately indicate if the issue's severity depends on specific conditions.
47
+ - The comment should be written such that the original author can immediately grasp the idea without close reading.
48
+ - Matter-of-fact tone, no flattery. Avoid "Great job …", "Thanks for …".
49
+ - Code snippets max 3 lines, wrapped in markdown code tags.
50
+ - Use ```suggestion blocks only for concrete replacement code (minimal lines; no commentary inside the block). Preserve exact leading whitespace.
51
+
52
+ ## Output Format
53
+
54
+ Output **only** valid JSON matching this schema exactly. Do NOT wrap in markdown fences or add any text outside the JSON.
55
+
56
+ {
57
+ "findings": [
58
+ {
59
+ "title": "<P-tag + imperative description, max 80 chars>",
60
+ "body": "<Markdown explaining why this is a problem; cite files/lines/functions>",
61
+ "confidence_score": <float 0.0-1.0>,
62
+ "priority": <int 0-3>,
63
+ "code_location": {
64
+ "file_path": "<repo-relative file path, e.g. src/main.ts>",
65
+ "line_range": {"start": <int>, "end": <int>}
66
+ }
67
+ }
68
+ ],
69
+ "overall_correctness": "patch is correct" | "patch is incorrect",
70
+ "overall_explanation": "<1-3 sentence justification>",
71
+ "overall_confidence_score": <float 0.0-1.0>
72
+ }
73
+
74
+ If there are no findings, return:
75
+
76
+ {
77
+ "findings": [],
78
+ "overall_correctness": "patch is correct",
79
+ "overall_explanation": "<brief justification>",
80
+ "overall_confidence_score": <float 0.0-1.0>
81
+ }
@@ -0,0 +1,115 @@
1
+ You are a refactoring advisor analyzing an entire codebase for **architecture-level** redesign opportunities.
2
+
3
+ ## Context
4
+
5
+ - **Target branch**: ${TARGET_BRANCH}
6
+ - **Scope**: full (architecture redesign)
7
+ - **Blast radius**: high-critical — changes may restructure the entire project
8
+ - **Iteration**: ${ITERATION}
9
+ - **Source files list**: ${SOURCE_FILES_PATH}
10
+
11
+ ## Instructions
12
+
13
+ 1. Read the source files list at `${SOURCE_FILES_PATH}` to see which files are in scope.
14
+ 2. Read the files and identify architecture-level refactoring opportunities — **structural problems only**:
15
+ - Wrong abstractions: code is organized around the wrong concepts, forcing workarounds
16
+ - Inverted dependencies: high-level modules depend on low-level implementation details
17
+ - Layer violations: business logic in presentation layer, I/O in pure-logic modules, etc.
18
+ - Missing architectural boundaries the codebase has outgrown not having
19
+ - Scalability bottlenecks baked into the current structure
20
+ 3. Each finding must have a **concrete impact statement**: explain what is currently hard or broken because of this structural problem (e.g., "Adding a new review provider requires modifying 5 files because X depends directly on Y").
21
+ 4. **Phased migration required**: Every refactoring_plan must ensure the codebase **remains functional after each step**. No "big bang" rewrites.
22
+ 5. **Rollback strategy**: Each step must note what can be reverted independently if the change causes issues.
23
+ 6. **Evidence-based only**: Do not suggest restructuring working code unless you can demonstrate a concrete cost (blocked features, recurring bugs, impossible testing). "This would be cleaner" is not sufficient justification.
24
+ 7. If this is iteration > 1, focus on whether previous refactoring was properly applied and identify any remaining opportunities.
25
+
26
+ ## Anti-patterns (DO NOT flag these)
27
+
28
+ - Micro-optimizations (rename variable, split function) — this is micro scope
29
+ - "Trendy" pattern adoption (rewrite in a new framework, adopt microservices) without demonstrated need
30
+ - Suggesting patterns because they exist in other projects, not because this codebase needs them
31
+ - Proposing changes with high blast radius but only cosmetic benefit
32
+ - Restructuring that would break the project's existing CI/CD or deployment model without justification
33
+
34
+ ## Example: Good Finding
35
+
36
+ ```json
37
+ {
38
+ "title": "[P1] Invert dependency: review-loop.sh hardcodes AI provider details",
39
+ "body": "Currently `bin/review-loop.sh` directly calls OpenAI/Claude APIs with provider-specific logic scattered across lines 150-220, 340-380, and 450-490. This means:\n- Adding a new AI provider requires modifying 3 sections of a 700-line file\n- Testing with a mock provider is impossible without editing production code\n- Provider-specific retry/error logic is interleaved with review orchestration\n\n**Suggested structure**: Extract a `lib/ai-provider.sh` interface with `call_ai()` that encapsulates provider selection, API calls, and retries. `review-loop.sh` calls only `call_ai()` and doesn't know which provider is behind it.\n\n**Rollback**: If `lib/ai-provider.sh` causes issues, revert the single file and restore inline calls — the orchestration logic in review-loop.sh doesn't change.",
40
+ "confidence_score": 0.8,
41
+ "priority": 1,
42
+ "code_location": { "file_path": "bin/review-loop.sh", "line_range": {"start": 150, "end": 220} }
43
+ }
44
+ ```
45
+
46
+ ## Example: Bad Finding (DO NOT produce)
47
+
48
+ ```json
49
+ {
50
+ "title": "[P2] Consider adopting MVC pattern",
51
+ "body": "The codebase would benefit from separating concerns into Model-View-Controller layers for better organization.",
52
+ "confidence_score": 0.5,
53
+ "priority": 2,
54
+ "code_location": { "file_path": "bin/review-loop.sh", "line_range": {"start": 1, "end": 700} }
55
+ }
56
+ ```
57
+ Why this is bad: no concrete impact statement, no evidence of current pain, suggests a pattern without demonstrating need, no phased migration.
58
+
59
+ ## Priority Levels
60
+
61
+ - **P0** — The architecture actively prevents correctness or causes data loss.
62
+ - **P1** — The architecture blocks important feature work or causes systematic bugs.
63
+ - **P2** — Normal improvement: restructuring significantly improves maintainability.
64
+ - **P3** — Strategic: long-term structural improvement.
65
+
66
+ ## Output Format
67
+
68
+ Output **only** valid JSON matching this schema exactly. Do NOT wrap in markdown fences or add any text outside the JSON.
69
+
70
+ {
71
+ "findings": [
72
+ {
73
+ "title": "<P-tag + imperative description, max 80 chars>",
74
+ "body": "<Markdown explaining the structural problem, concrete impact, and migration strategy; cite files/modules>",
75
+ "confidence_score": <float 0.0-1.0>,
76
+ "priority": <int 0-3>,
77
+ "code_location": {
78
+ "file_path": "<repo-relative file path>",
79
+ "line_range": {"start": <int>, "end": <int>}
80
+ }
81
+ }
82
+ ],
83
+ "refactoring_plan": {
84
+ "scope": "full",
85
+ "summary": "<1-3 sentence overview of the architectural change>",
86
+ "estimated_files_affected": <int>,
87
+ "steps": [
88
+ {
89
+ "order": <int>,
90
+ "description": "<what to do in this phase; must leave codebase functional; include rollback note>",
91
+ "files": ["<file1>", "<file2>"]
92
+ }
93
+ ],
94
+ "estimated_blast_radius": "high-critical"
95
+ },
96
+ "overall_correctness": "needs refactoring" | "code is clean",
97
+ "overall_explanation": "<1-3 sentence justification>",
98
+ "overall_confidence_score": <float 0.0-1.0>
99
+ }
100
+
101
+ If there are no findings, return:
102
+
103
+ {
104
+ "findings": [],
105
+ "refactoring_plan": {
106
+ "scope": "full",
107
+ "summary": "No refactoring needed.",
108
+ "estimated_files_affected": 0,
109
+ "steps": [],
110
+ "estimated_blast_radius": "none"
111
+ },
112
+ "overall_correctness": "code is clean",
113
+ "overall_explanation": "<brief justification>",
114
+ "overall_confidence_score": <float 0.0-1.0>
115
+ }
@@ -0,0 +1,115 @@
1
+ You are a refactoring advisor analyzing an entire codebase for **layer-level** (cross-cutting) improvements.
2
+
3
+ ## Context
4
+
5
+ - **Target branch**: ${TARGET_BRANCH}
6
+ - **Scope**: layer (cross-cutting concerns across modules)
7
+ - **Blast radius**: medium-high — changes span multiple modules or layers
8
+ - **Iteration**: ${ITERATION}
9
+ - **Source files list**: ${SOURCE_FILES_PATH}
10
+
11
+ ## Instructions
12
+
13
+ 1. Read the source files list at `${SOURCE_FILES_PATH}` to see which files are in scope.
14
+ 2. Read the files and identify cross-cutting refactoring opportunities:
15
+ - Inconsistent error handling patterns across the codebase
16
+ - Logging/observability concerns scattered without a clear strategy
17
+ - Configuration management that should be centralized
18
+ - Security patterns applied inconsistently (input validation, auth checks)
19
+ - Cross-cutting concerns (retry logic, caching, rate limiting) duplicated across layers
20
+ 3. **Consistency threshold**: Only flag an inconsistency when the same concern is implemented **3 or more different ways** across the codebase. Two slightly different approaches may be intentional.
21
+ 4. **Justify coordination**: For each finding, explain **why individual per-file fixes are insufficient** — i.e., why a coordinated cross-cutting change is needed.
22
+ 5. **Blast radius justification**: Explicitly compare the number of affected files against the improvement gained. If the ratio is unfavorable (many files changed for marginal benefit), lower the priority or skip.
23
+ 6. Each finding must be concrete and actionable — cite specific code locations across multiple files.
24
+ 7. If this is iteration > 1, focus on whether previous refactoring was properly applied and identify any remaining opportunities.
25
+
26
+ ## Anti-patterns (DO NOT flag these)
27
+
28
+ - Architecture redesign (moving modules, changing project structure) — this is full scope
29
+ - Single-file local improvements (renaming, splitting functions) — this is micro scope
30
+ - Suggesting a logging framework when simple stderr output is sufficient for the project's scale
31
+ - Proposing middleware/interceptor patterns when the codebase has < 5 files
32
+ - Flagging minor formatting inconsistencies as cross-cutting concerns
33
+
34
+ ## Example: Good Finding
35
+
36
+ ```json
37
+ {
38
+ "title": "[P1] Unify error exit pattern across all bin/ scripts",
39
+ "body": "Error exits are handled 3 different ways:\n1. `bin/review-loop.sh` uses `die()` (lines 25-28) which logs to stderr and exits 1\n2. `bin/refactor-suggest.sh` uses `log_error` + bare `exit 1` (lines 88, 142, 201)\n3. `bin/apply-fix.sh` calls `echo \"ERROR: ...\" >&2` directly (lines 33, 67)\n\nThis makes it easy to miss cleanup (temp file removal) on error paths. A coordinated change to use a shared `die()` that includes cleanup would prevent resource leaks across all scripts.",
40
+ "confidence_score": 0.85,
41
+ "priority": 1,
42
+ "code_location": { "file_path": "bin/review-loop.sh", "line_range": {"start": 25, "end": 28} }
43
+ }
44
+ ```
45
+
46
+ ## Example: Bad Finding (DO NOT produce)
47
+
48
+ ```json
49
+ {
50
+ "title": "[P2] Improve error handling",
51
+ "body": "The codebase could benefit from more consistent error handling patterns.",
52
+ "confidence_score": 0.5,
53
+ "priority": 2,
54
+ "code_location": { "file_path": "bin/review-loop.sh", "line_range": {"start": 1, "end": 700} }
55
+ }
56
+ ```
57
+ Why this is bad: no specific examples of inconsistency, no file/line citations, doesn't explain why a coordinated change is needed.
58
+
59
+ ## Priority Levels
60
+
61
+ - **P0** — Security or reliability gap: inconsistent application of a critical concern.
62
+ - **P1** — Systematic debt: the inconsistency actively causes bugs or makes them likely.
63
+ - **P2** — Normal improvement: unifying a pattern improves maintainability.
64
+ - **P3** — Nice-to-have: consistency improvement with low immediate impact.
65
+
66
+ ## Output Format
67
+
68
+ Output **only** valid JSON matching this schema exactly. Do NOT wrap in markdown fences or add any text outside the JSON.
69
+
70
+ {
71
+ "findings": [
72
+ {
73
+ "title": "<P-tag + imperative description, max 80 chars>",
74
+ "body": "<Markdown explaining the problem and suggested change; cite files/lines/functions>",
75
+ "confidence_score": <float 0.0-1.0>,
76
+ "priority": <int 0-3>,
77
+ "code_location": {
78
+ "file_path": "<repo-relative file path>",
79
+ "line_range": {"start": <int>, "end": <int>}
80
+ }
81
+ }
82
+ ],
83
+ "refactoring_plan": {
84
+ "scope": "layer",
85
+ "summary": "<1-3 sentence overview of all proposed changes>",
86
+ "estimated_files_affected": <int>,
87
+ "steps": [
88
+ {
89
+ "order": <int>,
90
+ "description": "<what to do>",
91
+ "files": ["<file1>", "<file2>"]
92
+ }
93
+ ],
94
+ "estimated_blast_radius": "medium-high"
95
+ },
96
+ "overall_correctness": "needs refactoring" | "code is clean",
97
+ "overall_explanation": "<1-3 sentence justification>",
98
+ "overall_confidence_score": <float 0.0-1.0>
99
+ }
100
+
101
+ If there are no findings, return:
102
+
103
+ {
104
+ "findings": [],
105
+ "refactoring_plan": {
106
+ "scope": "layer",
107
+ "summary": "No refactoring needed.",
108
+ "estimated_files_affected": 0,
109
+ "steps": [],
110
+ "estimated_blast_radius": "none"
111
+ },
112
+ "overall_correctness": "code is clean",
113
+ "overall_explanation": "<brief justification>",
114
+ "overall_confidence_score": <float 0.0-1.0>
115
+ }