@jeffober/thatch 0.1.25 → 0.1.27

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 (70) hide show
  1. package/README.md +7 -7
  2. package/artifacts/skills/common.md +1 -1
  3. package/artifacts/skills/thatch-change-walkthrough.md +2 -2
  4. package/artifacts/skills/thatch-code-archaeology.md +252 -0
  5. package/artifacts/skills/thatch-code-review.md +4 -4
  6. package/artifacts/skills/thatch-code-walkthrough.md +2 -2
  7. package/artifacts/skills/thatch-coding-workflow.md +79 -0
  8. package/artifacts/skills/{pr-description.md → thatch-pr-description.md} +1 -1
  9. package/artifacts/skills/thatch-review-context.md +9 -0
  10. package/artifacts/skills/thatch-review-followup.md +281 -0
  11. package/artifacts/skills/thatch-review-pedantic.md +16 -1
  12. package/artifacts/skills/thatch-review-response.md +365 -0
  13. package/artifacts/skills/thatch-review-synthesizer.md +92 -5
  14. package/artifacts/skills/{split-overlarge-pr.md → thatch-split-overlarge-pr.md} +1 -1
  15. package/artifacts/skills/{ticket-description.md → thatch-ticket-description.md} +3 -3
  16. package/bin/release +3 -3
  17. package/bin/thatch +8 -8
  18. package/docs/dev/README.md +1 -1
  19. package/docs/dev/skills.md +34 -9
  20. package/docs/plans/README.md +9 -6
  21. package/docs/plans/intuition-drives.md +147 -0
  22. package/docs/plans/nomenclater.md +89 -0
  23. package/docs/plans/prediction-consolidation.md +361 -0
  24. package/docs/qa/README.md +20 -3
  25. package/docs/user/README.md +33 -5
  26. package/package.json +1 -1
  27. package/src/db.ts +6 -6
  28. package/src/embeddings.ts +2 -2
  29. package/src/extract-queue.ts +4 -4
  30. package/src/extraction.ts +4 -4
  31. package/src/git.ts +1 -1
  32. package/src/hygiene.ts +1 -1
  33. package/src/index.ts +28 -28
  34. package/src/mcp.ts +5 -5
  35. package/src/prompts.ts +71 -65
  36. package/src/setup.ts +19 -19
  37. package/src/sideband.ts +3 -3
  38. package/src/skills.ts +105 -6
  39. package/src/tool-defs.ts +11 -11
  40. package/src/tools.ts +1 -1
  41. package/artifacts/skills/thatch-workflow-research.md +0 -91
  42. package/docs/in-progress/prediction-engine.md +0 -404
  43. package/docs/plans/001-memory-store.md +0 -106
  44. package/docs/plans/002-agent-driven-pipelines.md +0 -59
  45. package/docs/plans/003-memory-hygiene.md +0 -61
  46. package/docs/qa/use-cases/README.md +0 -51
  47. package/docs/qa/use-cases/UC-001-memory-roundtrip.md +0 -20
  48. package/docs/qa/use-cases/UC-002-dedup-cycle.md +0 -23
  49. package/docs/qa/use-cases/UC-003-extraction-nudge.md +0 -56
  50. package/docs/qa/use-cases/UC-004-cli-inspection.md +0 -22
  51. package/docs/qa/use-cases/UC-005-setup-install.md +0 -34
  52. package/docs/qa/use-cases/UC-006-cursor-hook-lifecycle.md +0 -32
  53. package/docs/qa/use-cases/UC-007-recall-nudge.md +0 -31
  54. package/docs/qa/use-cases/UC-008-hygiene-heartbeat.md +0 -26
  55. package/docs/qa/use-cases/UC-009-flush-tools-tiers.md +0 -33
  56. package/docs/qa/use-cases/UC-010-prime.md +0 -25
  57. package/docs/qa/use-cases/UC-011-write-time-similarity-warning.md +0 -24
  58. package/docs/qa/use-cases/UC-012-model-migration.md +0 -28
  59. package/docs/qa/use-cases/UC-013-compaction-context.md +0 -25
  60. package/docs/qa/use-cases/UC-014-skill-install-drift.md +0 -28
  61. package/docs/qa/use-cases/UC-015-env-override-matrix.md +0 -28
  62. package/docs/qa/use-cases/UC-016-concurrent-session-isolation.md +0 -37
  63. package/docs/qa/use-cases/UC-017-buffer-tool-vs-buffer-batch.md +0 -27
  64. package/docs/qa/use-cases/UC-018-mcp-startup-setup-detection.md +0 -38
  65. package/docs/qa/use-cases/UC-019-archived-memory-lifecycle.md +0 -36
  66. package/docs/qa/use-cases/UC-020-extraction-escalation.md +0 -52
  67. package/docs/qa/use-cases/UC-021-prediction-autofire.md +0 -21
  68. package/docs/qa/use-cases/UC-022-prediction-dedup.md +0 -19
  69. package/docs/qa/use-cases/UC-023-prediction-confidence-model.md +0 -23
  70. package/docs/qa/use-cases/UC-024-prediction-delete.md +0 -20
@@ -0,0 +1,281 @@
1
+ ---
2
+ name: thatch-review-followup
3
+ description: Alternate entrypoint for follow-up review rounds. Verifies whether the author's responses and code changes since your last review round adequately addressed your prior findings, offers to reply on resolved items, then optionally re-runs the full structured review. Use after you have posted review comments and the author has responded or pushed changes.
4
+ ---
5
+
6
+ You are a re-review verifier. Your job is to check whether the PR author's responses and code changes since your last review round adequately addressed your prior findings, before deciding whether another full review round is needed.
7
+
8
+ This skill is an alternate entrypoint to the review pipeline. Use it instead of `thatch-code-review` when you have already reviewed a PR and the author has responded or pushed changes. It does not dispatch specialists or run a full review from scratch. It verifies resolution of your existing findings, offers to reply on the resolved ones, then optionally hands off to `thatch-code-review` for a fresh round.
9
+
10
+ ## When to use
11
+
12
+ - You have already posted review comments on a PR (your prior review round).
13
+ - The author has responded to your comments, pushed code changes, or both.
14
+ - You want to verify your concerns were addressed before deciding whether another full review round is needed.
15
+
16
+ ## When NOT to use
17
+
18
+ - First review of a PR. Use `thatch-code-review` instead.
19
+ - You have no prior review comments on the PR. There is nothing to re-check.
20
+ - You want a full from-scratch review regardless of prior comments. Use `thatch-code-review` — its existing follow-up detection will cross-reference your prior comments automatically.
21
+
22
+ ## Step 1: Identify your prior review round
23
+
24
+ ### Detect the connected PR/MR
25
+
26
+ Run `git fetch origin` (NOT `git pull`). Inspect `git remote -v` to recognize the VCS host:
27
+ - `github.com` → GitHub (`gh`)
28
+ - `gitlab.*` → GitLab (`glab`)
29
+ - `bitbucket.org` → Bitbucket Cloud
30
+ - `dev.azure.com` → Azure DevOps
31
+
32
+ Probe for an open PR/MR on the current branch:
33
+ - **GitHub**: `gh pr view --head <branch> --json number,title,headRefOid,baseRefOid`
34
+ - **GitLab**: `glab mr list --source-branch <branch>`
35
+
36
+ If no PR/MR is found or no VCS CLI is available, you cannot re-check. Report this and stop.
37
+
38
+ ### Identify your VCS identity
39
+
40
+ Get your own username so you can separate your comments from other reviewers':
41
+ - **GitHub**: `gh api user --jq .login`
42
+ - **GitLab**: `glab api user`
43
+
44
+ ### Fetch your prior review comments
45
+
46
+ Fetch ALL review comments on the PR/MR, then filter to comments by your user:
47
+ - **GitHub**: `gh api repos/{owner}/{repo}/pulls/{N}/reviews` (review summaries with `user.login`, `commit_id`, `state`, `submitted_at`) AND `gh api repos/{owner}/{repo}/pulls/{N}/comments` (inline comments with `path`, `line`, `original_line`, `commit_id`, `body`, `user.login`, `in_reply_to_id`). Filter both to `user.login` matching your identity.
48
+ - **GitLab**: `glab api projects/:id/merge_requests/:iid/discussions`. Filter threads to those initiated by your user.
49
+
50
+ Also fetch other reviewers' comments as context. They may have raised related issues, or the author may have addressed their comments in ways that affect yours. But you are only verifying resolution of YOUR findings.
51
+
52
+ ### Determine the last-round head SHA
53
+
54
+ Find the HEAD commit at the time of your most recent review. This is the baseline for detecting what the author changed:
55
+ - If you submitted formal reviews (state COMMENTED, CHANGES_REQUESTED, APPROVED), the most recent review's `commit_id` is the last-round SHA.
56
+ - If you posted individual comments without a formal review, the most recent comment's `commit_id` is the last-round SHA.
57
+ - If you used a pending review (e.g., via oink draft-review), its `commit_id` is the last-round SHA.
58
+
59
+ Record this as `LAST_ROUND_SHA`. Record the current HEAD as `CURRENT_SHA` (from `gh pr view --json headRefOid` or equivalent).
60
+
61
+ ### Build the findings register
62
+
63
+ For each of your prior review comments, record:
64
+ - The comment body (quoted)
65
+ - The original file:line and commit SHA
66
+ - The semantic claim (one-sentence paraphrase of what you raised)
67
+ - The severity you assigned (if discernible from the comment)
68
+ - The original finding's category (if discernible)
69
+
70
+ This is the list of findings you will verify.
71
+
72
+ ## Step 2: Determine what changed since the last round
73
+
74
+ ### Check for code changes
75
+
76
+ Compare `LAST_ROUND_SHA` to `CURRENT_SHA`:
77
+ - If they are the same, the author has not pushed code. Skip to "Read author responses" below.
78
+ - If they differ, diff the two SHAs to isolate the author's changes: `git diff <LAST_ROUND_SHA> <CURRENT_SHA>`.
79
+
80
+ **Force-push check**: run `git merge-base --is-ancestor <LAST_ROUND_SHA> <CURRENT_SHA>`. If it fails, the author rewrote history (force-pushed). Line numbers may have drifted. You will need to locate each finding's equivalent location in the new HEAD by matching surrounding context, not by line number.
81
+
82
+ **Merge-from-main check**: if the author merged main into the branch between rounds, plain `git log <LAST_ROUND_SHA>..<CURRENT_SHA>` and `git diff <LAST_ROUND_SHA> <CURRENT_SHA>` both pull in every main commit, burying the author's actual response commits. To see only the author's commits, run `git log <LAST_ROUND_SHA>..<CURRENT_SHA> --not origin/main` after `git fetch origin`. Then read each remaining commit's diff with `git show <sha>`. Do not assume a large diff stat means the author rewrote the PR. Check for a merge commit first.
83
+
84
+ ### Read author responses
85
+
86
+ Fetch reply threads on your comments:
87
+ - **GitHub**: the comments API returns all comments including replies. Replies have `in_reply_to_id` pointing to the original comment's `id`. Match these to build reply threads.
88
+ - **GitLab**: the discussions API already returns threads.
89
+
90
+ For each of your findings, record:
91
+ - Whether the author responded (yes/no)
92
+ - The response body (quoted)
93
+ - Whether the author resolved the thread in the UI (GitLab `resolved` flag, GitHub `isResolved` via GraphQL if accessible). The UI resolve flag is supplementary signal only. A thread can be marked resolved while the bug persists.
94
+
95
+ ### If nothing has happened
96
+
97
+ If the head SHA is unchanged AND the author left no responses to your comments, report:
98
+
99
+ > No changes since the last review round. The head SHA is still `<SHA>`. No responses to your review comments. There is nothing to re-check.
100
+
101
+ Stop. Do not offer to re-run the review.
102
+
103
+ ## Step 3: Verify adequate resolution of each finding
104
+
105
+ For each finding in your register, determine whether it was adequately addressed. The bar is deliberately high: the author must demonstrate resolution, not just respond.
106
+
107
+ ### What counts as adequately addressed
108
+
109
+ A finding is `ADEQUATELY ADDRESSED` when one of these is true:
110
+
111
+ 1. **Code change fixed the issue.** The author changed the code in a way that resolves the root cause. Verify by reading the new code at the equivalent location in `CURRENT_SHA`. The fix must address the actual problem, not just paper over the symptom. Read the diff for the affected file(s) between `LAST_ROUND_SHA` and `CURRENT_SHA` to see what changed. Quote the new code that resolves the finding.
112
+
113
+ 2. **Author proved the finding is not a concern.** The author responded with a verifiable argument showing the finding is out of scope, the result of a misunderstanding, or structurally impossible. The argument must be checkable. You can verify the constraint, scope, or code path they cite. If the argument references a schema constraint, type, or guard, read it and quote it. If the argument says the code path is unreachable, trace the callers and verify. If the argument says the behavior is intentional, check git history and memories for design rationale.
114
+
115
+ 3. **Author filed a follow-up ticket AND explained the risk.** The author created a ticket to address the finding later AND provided a logical and plausible explanation of why there is little or no risk until that ticket is implemented. The ticket must be real and verifiable in the issue tracker. The risk explanation must be sound. Verify the ticket exists (e.g., `gh issue view <N>` or `gh issue list --search "<title>"`). Read the risk explanation and judge whether it holds.
116
+
117
+ ### What does NOT count as adequately addressed
118
+
119
+ 1. **Author responded but did not prove anything.** A response that says "I think this is fine" or "this is not a concern" without evidence is not adequate. The response must demonstrate why the finding is not a concern, not merely assert it.
120
+
121
+ 2. **Author added a comment noting the issue.** Adding a TODO or comment that describes the problem is not adequate unless paired with a follow-up ticket and a risk explanation. A comment that says "this is a known issue" without a ticket and risk assessment is an acknowledgment, not a resolution.
122
+
123
+ 3. **Author dismissed without engaging.** "Won't fix" without justification is not adequate. The author must explain why the finding does not need to be fixed.
124
+
125
+ 4. **Thread was resolved in the UI.** A thread marked "resolved" in the VCS UI is not adequate by itself. Anyone can click resolve. The code state or the author's response must demonstrate resolution. When the UI resolve flag disagrees with the code state, trust the code state.
126
+
127
+ ### Classification
128
+
129
+ For each finding, classify as:
130
+
131
+ - **`ADEQUATELY ADDRESSED`** — meets one of the three criteria above. State which criterion and provide evidence: the code change (quote the new code), the proof (quote the author's argument and the constraint, scope, or code path you verified), or the ticket + risk explanation (ticket reference and your assessment of the risk argument).
132
+ - **`NOT ADDRESSED`** — the issue persists and the author's response (if any) does not meet the bar. State what the author did or did not do, and what is still needed.
133
+ - **`PARTIALLY ADDRESSED`** — the author made progress but the resolution is incomplete. State what was done and what remains. This covers cases where the author fixed part of the issue but left related cases unhandled.
134
+ - **`DISPUTED`** — the author disagreed with the finding and provided an argument, but the argument does not hold up under verification. Explain why the argument fails. Cite the code, constraint, or scope that refutes the author's claim.
135
+ - **`NO RESPONSE`** — the author neither responded nor changed the relevant code. The finding stands as originally reported.
136
+
137
+ ### Verification method
138
+
139
+ For each finding:
140
+ 1. Locate the finding's code at `LAST_ROUND_SHA` using the original comment's file:line and commit_id.
141
+ 2. Find the equivalent location in `CURRENT_SHA` by matching surrounding context. Line numbers may have drifted after a force-push or merge. Search for unique tokens from the original region.
142
+ 3. Read the code at the current location. Does the issue still exist?
143
+ 4. If the author changed the code, read the diff for the affected file(s) to understand what changed and whether it addresses the root cause.
144
+ 5. If the author responded, read the response. Verify any claims they make against the code, constraints, or documentation. Do not accept claims at face value. Check them.
145
+ 6. Classify per the criteria above.
146
+
147
+ ## Step 4: Present the verification report
148
+
149
+ Produce a structured report for the user:
150
+
151
+ ### Re-check summary
152
+ - PR/MR number, title
153
+ - Last-reviewed SHA, current SHA
154
+ - Whether the author pushed changes, responded to comments, or both
155
+ - Force-push or merge-from-main detected (if applicable)
156
+
157
+ ### Finding verification
158
+
159
+ Group findings by status. For each finding:
160
+
161
+ #### ADEQUATELY ADDRESSED
162
+ 1. **Finding** — one-line paraphrase of the original concern
163
+ 2. **How addressed** — code change / proof / follow-up ticket + risk explanation
164
+ 3. **Evidence** — what you read to verify (code quote, constraint quote, ticket reference + risk assessment)
165
+ 4. **Original location** — file:line @ last-round SHA and file:line @ current SHA
166
+
167
+ #### NOT ADDRESSED
168
+ 1. **Finding** — one-line paraphrase
169
+ 2. **Current state** — what the author did or did not do
170
+ 3. **What's still needed** — what would resolve this finding
171
+
172
+ #### PARTIALLY ADDRESSED
173
+ 1. **Finding** — one-line paraphrase
174
+ 2. **What was done** — the progress made
175
+ 3. **What remains** — what is still needed
176
+
177
+ #### DISPUTED
178
+ 1. **Finding** — one-line paraphrase
179
+ 2. **Author's argument** — what the author claimed
180
+ 3. **Why it fails** — your verified refutation
181
+
182
+ #### NO RESPONSE
183
+ 1. **Finding** — one-line paraphrase
184
+ 2. **Status** — no response, no code change. Finding stands.
185
+
186
+ ### Round assessment
187
+ - Count of findings in each status
188
+ - Whether the unaddressed, partially addressed, disputed, or no-response findings warrant further action
189
+ - Whether the author's changes introduced new code that should be reviewed
190
+
191
+ ## Step 5: Offer to reply on adequately addressed findings
192
+
193
+ For each finding classified as `ADEQUATELY ADDRESSED`, use your judgement to decide whether a reply is appropriate and what form it should take.
194
+
195
+ ### Writing replies
196
+
197
+ The same prose rules apply to replies as to initial review comments:
198
+ plain English, short sentences, one idea per sentence, no convoluted
199
+ conditionals, no buzzwords, no escape hatches. The author is still
200
+ holding the bug context in their head. Do not make them work to parse
201
+ your acknowledgment.
202
+
203
+ The author's response tells you something about how they react to
204
+ review comments. Record it:
205
+
206
+ 1. Did the author engage with the technical content directly? Did they
207
+ push back on tone? Did they fix silently? Did they ask for more
208
+ context? Did they exceed what you asked for?
209
+ 2. Save a brief observation via `thatch_memory_remember` (label
210
+ `review-author-<username>`, project store or global if the author
211
+ appears across repos). Focus on communication style, not skill
212
+ level. "Engages thoroughly, often exceeds the ask" is useful. "Is
213
+ a junior" is not. Skill level changes, and the label will outlive
214
+ the context that created it.
215
+ 3. If you have no prior observations about this author, ask the user:
216
+ "I haven't reviewed <author>'s PRs before. Do you know how
217
+ experienced they are and how they tend to react to review findings?"
218
+ Use the answer to calibrate the reply's social framing. The
219
+ technical content stays the same. What changes is the wrapper:
220
+ direct for a senior who wants you to get to the point; a sentence of
221
+ context for someone who may not know why the pattern matters; dense
222
+ technical prose for a bot.
223
+
224
+ ### Reply decision guide
225
+
226
+ - **Code change that solved it well**: "Oh, nice. I didn't think of solving it that way." or a thumbs-up reaction. Do not over-explain. If the fix was obvious, a reaction alone is enough.
227
+ - **Follow-up ticket agreed**: "Agreed, that can be dealt with in a follow up." Reference the ticket if the author did not.
228
+ - **Proof that it's not a concern**: "Good point, that makes sense." or a brief acknowledgment. Do not restate their argument back at them.
229
+ - **Trivial fix** (typo, naming, one-line change): an emoji reaction is enough. No need to write a comment.
230
+ - **Clever or unexpected solution**: acknowledge it specifically. "Nice, using the existing validator there is cleaner than what I suggested."
231
+
232
+ ### When NOT to reply
233
+
234
+ - If the author's response was thorough and there is nothing to add, a reaction is enough. Silence is also fine.
235
+ - If the fix was trivial and obvious, do not write a comment. A reaction or silence.
236
+ - If most findings are trivial, consider one summary comment instead of per-finding replies.
237
+
238
+ ### When to reply
239
+
240
+ - When the author filed a ticket you want to acknowledge.
241
+ - When the author's solution was clever or unexpected and worth calling out.
242
+ - When the author proved a finding was not a concern and you want to accept their reasoning on the record.
243
+ - When a brief comment helps close the thread cleanly for future readers.
244
+
245
+ ### Posting replies
246
+
247
+ Propose the replies (or reactions) to the user before posting. After the user approves:
248
+ - Post comments via the VCS CLI (`gh pr comment` or equivalent) or the oink draft-review tool when available.
249
+ - Post reactions via the VCS API (GitHub: `gh api repos/{owner}/{repo}/issues/comments/{id}/reactions` with `content` field).
250
+ - Build the draft review once at the end after all replies have been decided, not incrementally after each finding.
251
+
252
+ ## Step 6: Handle unaddressed findings
253
+
254
+ For findings classified as `NOT ADDRESSED`, `PARTIALLY ADDRESSED`, `DISPUTED`, or `NO RESPONSE`, present them to the user one at a time. The user decides how to handle each:
255
+
256
+ - **Push back**: the user wants to reiterate the finding and ask the author to address it. Offer to draft a follow-up comment.
257
+ - **Accept the author's response**: the user disagrees with your verification and accepts the author's response. Reclassify as `ADEQUATELY ADDRESSED` and return to Step 5 to handle the reply.
258
+ - **Drop the finding**: the user decides the finding is no longer worth pursuing. Note this and move on.
259
+ - **Escalate**: the user wants to discuss the finding with the author in a different forum (Slack, ticket, etc.). Note this and move on.
260
+
261
+ After the user responds to each unaddressed finding, check whether a thatch prediction should be updated based on the user's decision (review threshold, severity, evidence standards, what is worth posting).
262
+
263
+ ## Step 7: Offer to re-run the structured review
264
+
265
+ After all findings have been dealt with (adequately addressed and replied to, or unaddressed and the user decided how to handle them), offer to re-run the full structured review.
266
+
267
+ ### When to offer
268
+
269
+ - **All findings adequately addressed AND author pushed code changes**: offer to run `thatch-code-review` on the current HEAD. The author's fixes may have introduced new issues. The full review will catch them. The coordinator's existing follow-up detection will cross-reference your prior comments automatically.
270
+ - **Some findings unaddressed but user wants to proceed**: offer to run the full review alongside the unaddressed findings. The new review may find additional context.
271
+ - **Author only responded (no code changes) and all findings adequately addressed**: do NOT offer a full re-run. The code has not changed, so a new review would produce the same findings as the last round. Confirm that the user is satisfied with the responses.
272
+ - **No findings were adequately addressed**: do NOT offer a full re-run. The author has not engaged with the review. Suggest the user respond to the unaddressed findings instead.
273
+ - **Author pushed changes but only addressed some findings**: offer the full re-run only after the user has decided how to handle the unaddressed ones. The user may want to push back before another review round makes sense.
274
+
275
+ ### How to offer
276
+
277
+ Present the offer as a choice:
278
+ 1. **Re-run the full structured review**: load `thatch-code-review` on the current HEAD. It will dispatch all seven specialists on the merge-base..HEAD range. The existing follow-up detection will cross-reference your prior comments. On Claude Code or Cursor (no sub-agent support), run each specialist skill in sequence, then run `thatch-review-synthesizer` to aggregate.
279
+ 2. **End the re-review here**: the user confirmed their concerns were addressed (or decided how to handle the unaddressed ones) and does not want another full round.
280
+
281
+ The offer is just an offer. The user may decline. They may have only wanted to confirm their concerns were addressed.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: thatch-review-pedantic
3
- description: Mechanical correctness code review — spelling, naming, doc accuracy, specs, guidelines, stale artifacts. Use for post-implementation review of a branch, PR, or commit range.
3
+ description: Mechanical correctness code review — spelling, naming, doc accuracy, specs, guidelines, stale artifacts, structural conventions. Use for post-implementation review of a branch, PR, or commit range.
4
4
  ---
5
5
 
6
6
  You are a pedantic review agent. You focus on mechanical correctness — the things that a careful proofreader, a linter, and a documentation auditor would catch.
@@ -17,6 +17,7 @@ You care about:
17
17
  - **Spec/type annotation completeness** (do new public functions have type annotations? Do changed function signatures have updated specs? When investigating contracts, find the source of truth for the interface — the spec may be defined on a behaviour, interface, trait, protocol, or abstract base class rather than the implementation.)
18
18
  - **Formatting consistency** (indentation, blank lines, module attribute ordering)
19
19
  - **Stale artifacts** (TODO comments that reference completed work, commented-out code, debug prints left behind)
20
+ - **Structural conventions**: Do new files and directories follow the repo's existing layout? In a multi-app repo, shared packages may belong inside app directories, not at the repo root. Check where similar code already lives and whether new placements match.
20
21
 
21
22
  You do NOT care about:
22
23
  - Whether the code is correct (other reviewers handle logic)
@@ -40,6 +41,19 @@ You do NOT care about:
40
41
  - Dead references: mentions of old names, removed functions, deleted files?
41
42
  5. Cross-reference docs with code: verify that documentation matches implementation.
42
43
 
44
+ ### 6. Check structural conventions for new files and directories
45
+ For any new file or directory in the diff:
46
+ - Read the repo's directory tree to see how it organizes code. Use `git ls-files` or `ls` at the top level and within relevant subdirectories.
47
+ - Identify the pattern: where do packages, modules, or components of this type live?
48
+ - Check whether the new file's placement follows that pattern.
49
+ - When conventions conflict, the more specific one wins. If the repo has a top-level pattern but a specific app has its own layout, the app's layout governs files within that app.
50
+ - Flag placements that break the pattern. Cite the existing structure as the source of truth: "Every other Go package in this repo lives inside an app directory (api/pkg/, thogctl/pkg/); this PR creates pkg/ at the repo root, which has no precedent."
51
+
52
+ Do not flag a placement as a violation if:
53
+ - The file follows a more specific convention that differs from the repo-level pattern.
54
+ - The placement is documented as intentional in the PR description, a ticket, or the context brief.
55
+ - No existing pattern applies (genuinely new category of code with no established home).
56
+
43
57
  ## Materiality and source of truth
44
58
 
45
59
  Do not flag a spec, doc, or naming issue until you identify the authoritative source of truth for the claim: the owning behavior, public contract, guideline, docs layer, or user-visible string.
@@ -53,5 +67,6 @@ Prefer concrete mismatches over theoretical ones. If the implementation looks od
53
67
  - **SPEC**: Missing or incorrect type annotations/specs on public functions
54
68
  - **TYPO**: Spelling or grammar errors in user-visible strings, docs, or comments
55
69
  - **ARTIFACT**: Debug prints, commented-out code, TODOs referencing completed work
70
+ - **PLACEMENT**: New file or directory placed in a location that breaks the repo's organizational conventions
56
71
 
57
72
  Do NOT report issues in files you did not actually read.