@jeffober/thatch 0.1.33 → 0.1.35
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.
- package/artifacts/skills/thatch-code-review.md +8 -2
- package/artifacts/skills/thatch-review-context.md +15 -3
- package/artifacts/skills/thatch-review-synthesizer.md +7 -5
- package/docs/dev/skills.md +1 -1
- package/docs/user/README.md +1 -1
- package/docs/user/code-review.md +11 -3
- package/docs/user/skills.md +1 -1
- package/package.json +1 -1
- package/src/prompts.ts +1 -1
|
@@ -26,6 +26,8 @@ Also detect whether the current branch has a **connected PR/MR** even when none
|
|
|
26
26
|
|
|
27
27
|
Also fetch any refs not locally reachable so branches and PRs that were never checked out can be reviewed (e.g. `git fetch origin <branch>` for a PR head).
|
|
28
28
|
|
|
29
|
+
**Anchor discipline**: the working tree may be checked out on any branch — main, another feature, a detached HEAD — and is not guaranteed to match the change under review. Resolve the head SHA of the review range (`git rev-parse <head-ref>`), and compute every file:line citation and review-comment anchor against that ref with `git show <head-sha>:<path>` — never from the working tree, and never from the base. When the working tree happens to be the PR branch this is equivalent, so apply the rule unconditionally rather than branching on it. Pass the head SHA to sub-agents (see the briefing template).
|
|
30
|
+
|
|
29
31
|
Run git diff --stat on the resolved range and git log --oneline to understand the change.
|
|
30
32
|
|
|
31
33
|
## Step 2: Gather project context
|
|
@@ -38,7 +40,9 @@ Load the thatch-review-context skill and follow its methodology to build a conte
|
|
|
38
40
|
- thatch_memory_recall for feature/project status, design decisions, ticket dependencies
|
|
39
41
|
- Project docs, READMEs, design docs
|
|
40
42
|
- Issue tracker (gh issue/view) if ticket IDs are found
|
|
41
|
-
- **
|
|
43
|
+
- **Links in the change** — docs, designs, tickets, and related PRs linked from the PR description, commit messages, or the changed files themselves; follow them for scope and design context (see source #8 in the review-context skill)
|
|
44
|
+
- **Staleness check** — whether main has moved past the merge-base touching the same paths (see source #3 in the review-context skill); when it has, record the commits in the brief
|
|
45
|
+
- **Prior review comments** — if Step 1 detected a connected PR/MR, fetch ALL prior review comments on it (see source #9 in the review-context skill) and build the prior-comments register with a preliminary addressed-check status per comment. This is what distinguishes a **follow-up round** (register non-empty) from the **first round** (register empty or PR has no prior reviews). If Step 1 found no connected PR/MR, the brief explicitly states `Local-branch review — no prior-comment fetch`.
|
|
42
46
|
|
|
43
47
|
Produce the context brief in the format the skill prescribes (project context, this change's scope, deferred work, dependencies, relevant constraints, and the prior review comments section when present).
|
|
44
48
|
|
|
@@ -123,6 +127,7 @@ Pass the synthesizer:
|
|
|
123
127
|
- The workflow guide from Step 3.
|
|
124
128
|
- The specialist findings.
|
|
125
129
|
- The prior-comments register when present.
|
|
130
|
+
- The staleness signal from the brief (commits on main after the merge-base touching this change's paths), when present.
|
|
126
131
|
|
|
127
132
|
The final user-facing report MUST begin with a concise explanation of the workflow(s) this PR changes before listing findings. Use one `### Workflow changes` section, with one subheading per affected workflow when there are multiple. Use the before/now walkthrough shape from the thatch-pr-description skill: numbered step = existing behavior; `NOW` sub-bullet = what the PR changes; `N/A` for new stages. This gives the user a map of the change before the findings. Keep it short: 3-6 steps per workflow.
|
|
128
133
|
|
|
@@ -136,7 +141,7 @@ Alternatively, perform the synthesis yourself:
|
|
|
136
141
|
1. Read each finding's cited location to verify evidence accuracy.
|
|
137
142
|
2. Deduplicate findings flagged by multiple specialists.
|
|
138
143
|
3. Group findings by root cause where multiple findings stem from the same issue.
|
|
139
|
-
4. Classify each as CONFIRMED, REJECTED, or UNVERIFIABLE. For behavioral findings, apply citation verification, reachability, and intent verification. For mechanical findings, verify the cited text exists, is branch-introduced or newly made relevant, and violates the stated guideline or specialist taxonomy. For highlights, verify the cited text exists, the claim is accurate, and the highlighted thing genuinely rises above baseline competence.
|
|
144
|
+
4. Classify each as CONFIRMED, REJECTED, or UNVERIFIABLE. For behavioral findings, apply citation verification, reachability, and intent verification. For mechanical findings, verify the cited text exists, is branch-introduced or newly made relevant, and violates the stated guideline or specialist taxonomy. For highlights, verify the cited text exists, the claim is accurate, and the highlighted thing genuinely rises above baseline competence. When the brief reports staleness (main moved past the merge-base touching this change's paths), re-verify each behavioral finding against current main first — a finding true only at the merge-base is a rebase note for the author, not a defect in this PR.
|
|
140
145
|
5. Cross-reference against the prior-comments register if one was built in Step 2: tag matching findings `Provenance: previously identified by @author, PR #N, DATE` and produce the `### Previously identified findings` appendix per the synthesizer skill.
|
|
141
146
|
6. Calibrate severity (BLOCKING > HIGH > MEDIUM > LOW) based on your verification.
|
|
142
147
|
7. Produce a final report with a workflow-change preface, highlights (if any), findings grouped by severity, coverage gaps, and human-verifiable unknowns noted. Include every confirmed LOW finding.
|
|
@@ -145,6 +150,7 @@ Alternatively, perform the synthesis yourself:
|
|
|
145
150
|
|
|
146
151
|
When dispatching each sub-agent, include in the prompt:
|
|
147
152
|
- The git range to review
|
|
153
|
+
- **The resolved head SHA of the range** — all file reads, file:line citations, and anchors MUST be computed against this ref (`git show <head-sha>:<path>`), never the working tree, which may be on a different branch than the change under review
|
|
148
154
|
- The specific files in this unit's scope
|
|
149
155
|
- The specialist focus (from the eight specialists above)
|
|
150
156
|
- The diff stat for this unit's files
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: thatch-review-context
|
|
3
|
-
description: Gather project and feature context before a code review. Investigates PR descriptions, git history, ticket references, docs, and memory to build a context brief that prevents false positives about intentionally deferred work. Use before dispatching review specialists or running a solo review.
|
|
3
|
+
description: Gather project and feature context before a code review. Investigates PR descriptions, git history, ticket references, linked docs/tickets, docs, and memory to build a context brief that prevents false positives about intentionally deferred work. Use before dispatching review specialists or running a solo review.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
You are a review context builder. Your job is to gather project context that gives reviewers the background they need to avoid false positives about intentionally deferred work, incomplete features, and multi-ticket dependencies.
|
|
@@ -28,6 +28,7 @@ Branch names often contain ticket identifiers. Look for patterns:
|
|
|
28
28
|
- `git log --all --oneline --grep="TICKET-ID"` — find related commits on other branches
|
|
29
29
|
- `git log -S "TODO (TICKET"` — find TODO markers that reference this or related tickets
|
|
30
30
|
- `git branch -a` — other branches may show planned or in-progress related work
|
|
31
|
+
- **Staleness check**: `git log --oneline <merge-base>..origin/main -- <changed paths>` — commits that landed on main AFTER this branch's merge-base, touching the same files. If any exist, the branch is stale relative to main and findings true at the merge-base may already be moot. List these commits in the brief under Dependencies so the synthesizer re-verifies findings against current main.
|
|
31
32
|
|
|
32
33
|
### 4. TODO ($ticket) markers in the diff
|
|
33
34
|
Scan the diff for TODO markers that reference ticket identifiers:
|
|
@@ -56,7 +57,17 @@ If ticket IDs were found:
|
|
|
56
57
|
- Look for milestone assignments, dependencies, and blocking relationships
|
|
57
58
|
- Check for epic or parent issues that describe the overall feature
|
|
58
59
|
|
|
59
|
-
### 8.
|
|
60
|
+
### 8. Links in the change (follow the references)
|
|
61
|
+
|
|
62
|
+
Collect links to material outside the diff that a reviewer would need for context, then follow them:
|
|
63
|
+
- PR description links: docs, design docs, RFCs, tickets, related PRs
|
|
64
|
+
- Commit message links and ticket references
|
|
65
|
+
- Links inside the changed files themselves: READMEs, doc comments, config comments referencing designs or runbooks
|
|
66
|
+
- Ticket bodies from source 7, which often link parent epics, blocking issues, or design docs
|
|
67
|
+
|
|
68
|
+
Follow each link one hop and read it for review-relevant context: scope, design decisions, constraints, deferred work, sibling changes. If a linked document references another artifact that is directly about this change (a parent epic, a design doc for the same feature), follow that too. Stop at depth 2, and stop following a path once the linked material stops changing what a reviewer would flag. Record anything that changes review context in the brief. A link that 404s or requires access you do not have is not a finding — note it as `link unreachable` and move on.
|
|
69
|
+
|
|
70
|
+
### 9. Prior review comments (follow-up round detection)
|
|
60
71
|
|
|
61
72
|
If the change under review has a connected PR/MR on the upstream remote, fetch all prior review comments so this review does not duplicate already-identified issues. Any prior review activity on the PR/MR means **this is a follow-up round**, not the first review. If no PR/MR is connected, this is a **local-branch review** — skip this source entirely; the existing review procedure applies.
|
|
62
73
|
|
|
@@ -113,7 +124,7 @@ For each comment, attempt to determine whether it has been addressed in the **cu
|
|
|
113
124
|
|
|
114
125
|
The register produced here is a **preliminary** classification. The synthesizer produces the final cross-reference, including any prelim-status overrides when new findings from the specialist round reproduce or refute a prior comment.
|
|
115
126
|
|
|
116
|
-
###
|
|
127
|
+
### 10. Repo structure conventions (implicit)
|
|
117
128
|
Directory structure conventions are often undocumented. They live in the repo's layout itself, not in a CONTRIBUTING.md. Look at the directory tree to identify how the repo organizes code:
|
|
118
129
|
- `git ls-files | head -50` or `ls` at the top level to see the organizational pattern
|
|
119
130
|
- For multi-app repos, identify whether shared packages live inside app directories or at the repo root
|
|
@@ -143,6 +154,7 @@ List each deferred piece:
|
|
|
143
154
|
- What other tickets or PRs this depends on (must merge first)
|
|
144
155
|
- What tickets or PRs depend on this (are blocked by it)
|
|
145
156
|
- Whether base branches have landed (for stacked PRs)
|
|
157
|
+
- **Staleness**: whether main has moved past the merge-base since the branch point. When the staleness check (source 3) found commits touching this change's paths, list them here — the synthesizer re-verifies behavioral findings against current main before classifying them
|
|
146
158
|
|
|
147
159
|
### Relevant constraints
|
|
148
160
|
- Design decisions or architectural constraints from memories or docs
|
|
@@ -31,11 +31,9 @@ For each finding from the specialists:
|
|
|
31
31
|
|
|
32
32
|
5a. **Verify governing constraints for data-shape findings.** For findings claiming a field can be NULL/missing/orphaned/malformed, locate and read the field's definition (schema migration, model, type declaration). If a NOT NULL, FK, enum, or type constraint forecloses the claimed state, REJECT and cite the constraint. Do not classify such a finding CONFIRMED without having read the governing definition.
|
|
33
33
|
|
|
34
|
+
5b. **Re-verify against post-branch-point main (behavioral findings, only when the context brief flags staleness).** If the brief reports commits on main after this branch's merge-base touching this change's paths, the branch may be stale and a finding can be true at the merge-base but already moot on main. For each behavioral finding, read the equivalent code on current main (`git show origin/main:<path>`). A finding that main has already fixed or mooted is a **rebase note**, not a defect in this PR: keep it out of the confirmed findings and list it in the report's rebase-notes appendix instead.
|
|
35
|
+
|
|
34
36
|
6. **Verify intent (behavioral findings only).** If the specialist flagged behavior as a bug but the code appears to work as designed, check whether the behavior is intentional:
|
|
35
|
-
- Read the callers of the cited code to see if the pattern makes sense in context.
|
|
36
|
-
- Check git log or git blame on the cited file for commit messages explaining the decision.
|
|
37
|
-
- Use thatch_memory_recall to search for documented rationale.
|
|
38
|
-
If the behavior is intentional or an accepted limitation, reject the finding.
|
|
39
37
|
|
|
40
38
|
4m. **Mechanical verification (pedantic, no-slop, breadcrumbs, docs, naming, style, comments, structural conventions).** For mechanical findings, verification means:
|
|
41
39
|
- The cited text exists at the cited location (already confirmed in step 2). For PLACEMENT findings, the cited evidence is the file path and the existing directory structure, not quoted code. Verify the file exists at the claimed path and that the existing structure shows the convention the specialist cited.
|
|
@@ -71,7 +69,7 @@ Multiple findings may stem from the same underlying issue (e.g., a contract mism
|
|
|
71
69
|
|
|
72
70
|
## Cross-reference against prior review comments
|
|
73
71
|
|
|
74
|
-
If your input includes a **prior-comments register** (built by the coordinator via `thatch-review-context` source #
|
|
72
|
+
If your input includes a **prior-comments register** (built by the coordinator via `thatch-review-context` source #9 — prior review comments retrieved from the PR/MR's review history), cross-reference every confirmed and rejected finding against it so the final report does not present already-identified issues as fresh discoveries.
|
|
75
73
|
|
|
76
74
|
For each new finding:
|
|
77
75
|
1. **Search for a matching prior comment** by location and semantic claim. Match if both hold:
|
|
@@ -255,6 +253,10 @@ Findings you rejected and a one-line reason why. Include the specialist and loca
|
|
|
255
253
|
|
|
256
254
|
Findings you verified as real but pre-existing, with a one-line note on the issue and its potential impact.
|
|
257
255
|
|
|
256
|
+
### Rebase notes (appendix, brief — only when the context brief flags staleness)
|
|
257
|
+
|
|
258
|
+
Findings that were true at the merge-base but are already fixed or mooted by later commits on main. One line each: the finding, and the main commit that moots it. Omit this section entirely when the brief reports no staleness.
|
|
259
|
+
|
|
258
260
|
### Previously identified findings (appendix — only when a prior-comments register was provided)
|
|
259
261
|
|
|
260
262
|
List every entry from the prior-comments register here. For each entry, produce a one-block record:
|
package/docs/dev/skills.md
CHANGED
|
@@ -47,7 +47,7 @@ description: Extract durable project facts ... Use when ...
|
|
|
47
47
|
| `thatch-review-mark-and-sweep` | Mechanical change completeness: whole-repo sweep for stragglers after renames, flag removals, API substitutions. |
|
|
48
48
|
| `thatch-review-highlights` | Positive finding detection: notably clever solutions, cleanup done along the way, documentation that helps. Medium-high bar against generic praise. |
|
|
49
49
|
| `thatch-review-synthesizer` | Verify specialist findings against code, dedupe, classify, calibrate severity. Starts the final report with a workflow-change preface, then cross-references findings against prior review comments when a follow-up round register is provided. |
|
|
50
|
-
| `thatch-review-context` | Gather project/feature context (PR descriptions, git archaeology, ticket references, memory) before fan-out. Prevents false positives about intentionally deferred work. Also fetches prior review comments on a connected PR/MR for follow-up-round detection and builds a register with preliminary addressed-check status per comment. |
|
|
50
|
+
| `thatch-review-context` | Gather project/feature context (PR descriptions, git archaeology, ticket references, linked docs/tickets followed from the change, memory) before fan-out. Prevents false positives about intentionally deferred work, and checks whether main moved past the merge-base touching the same paths (staleness signal for the synthesizer). Also fetches prior review comments on a connected PR/MR for follow-up-round detection and builds a register with preliminary addressed-check status per comment. |
|
|
51
51
|
| `thatch-code-archaeology` | Investigate an existing feature, debug an unfamiliar area, or begin a new ticket. Explores the code base from multiple angles (data model, state flow, git history, sibling features, skeletons) before proposing changes. The research skill; pair with `thatch-coding-workflow`. |
|
|
52
52
|
| `thatch-review-followup` | 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. |
|
|
53
53
|
| `thatch-change-walkthrough` | Explain a change to the user as a teaching walkthrough: resolve the delta, research each affected workflow at the merge-base, teach current behavior, then overlay the modifications with file:line citations and analogies. |
|
package/docs/user/README.md
CHANGED
|
@@ -237,7 +237,7 @@ response, walkthrough, and workflow skills that support the review pipeline:
|
|
|
237
237
|
| `thatch-review-mark-and-sweep` | Mechanical change completeness: whole-repo sweep for stragglers after renames, flag removals, API substitutions. |
|
|
238
238
|
| `thatch-review-highlights` | Positive finding detection: notably clever solutions, cleanup done along the way, documentation that helps. Medium-high bar against generic praise. |
|
|
239
239
|
| `thatch-review-synthesizer` | Verifies and synthesizes findings from multiple specialists into a report that starts with workflow changes, then highlights, then deduplicated severity-grouped findings. |
|
|
240
|
-
| `thatch-review-context` | Gathers project context (PR descriptions, git archaeology, ticket references, memory) before a review. Prevents false positives about intentionally deferred work. |
|
|
240
|
+
| `thatch-review-context` | Gathers project context (PR descriptions, git archaeology, ticket references, linked docs/tickets, memory) before a review. Prevents false positives about intentionally deferred work. |
|
|
241
241
|
| `thatch-code-archaeology` | Investigates an existing feature, debugs an unfamiliar area, or begins a new ticket. Explores the code base from multiple angles (data model, state flow, git history, sibling features, skeletons) before proposing changes. Pairs with `thatch-coding-workflow`. |
|
|
242
242
|
| `thatch-review-followup` | Alternate entrypoint for follow-up review rounds. Verifies whether the author's responses and code changes since your last review adequately addressed your prior findings, offers to reply on resolved items, then optionally re-runs the full structured review. |
|
|
243
243
|
| `thatch-review-response` | Author-side review response: triage findings on your own PR, fix bugs one by one, reply on each thread, post a top-level summary comment. |
|
package/docs/user/code-review.md
CHANGED
|
@@ -10,9 +10,15 @@ The coordinator skill (`thatch-code-review`, opencode-only) orchestrates
|
|
|
10
10
|
the review:
|
|
11
11
|
|
|
12
12
|
1. **Resolve the target**: fetch origin, compute merge-base against
|
|
13
|
-
`origin/main`, support branch/PR/explicit range.
|
|
13
|
+
`origin/main`, support branch/PR/explicit range. All file reads and
|
|
14
|
+
comment anchors are computed against the PR head ref, not the
|
|
15
|
+
working tree, which may be checked out on a different branch.
|
|
14
16
|
2. **Gather project context**: PR descriptions, git archaeology,
|
|
15
|
-
ticket references,
|
|
17
|
+
ticket references, links to docs/designs/tickets found in the
|
|
18
|
+
change (followed one hop for scope and design context), TODO
|
|
19
|
+
markers, prior reviews, project memory. Also checks whether main
|
|
20
|
+
has moved past the merge-base touching the same paths — a stale
|
|
21
|
+
branch can make findings true only at the merge-base.
|
|
16
22
|
3. **Research affected workflows**: load `thatch-code-archaeology`,
|
|
17
23
|
trace the code paths the change touches.
|
|
18
24
|
4. **Estimate complexity**: partition the diff into review units.
|
|
@@ -21,7 +27,9 @@ the review:
|
|
|
21
27
|
6. **Synthesize**: the synthesizer reads all specialist output,
|
|
22
28
|
verifies each finding (cited text exists, claim is accurate,
|
|
23
29
|
severity is justified), deduplicates by root cause, and produces
|
|
24
|
-
the final report.
|
|
30
|
+
the final report. When the branch is stale relative to main, it
|
|
31
|
+
re-verifies behavioral findings against current main and reports
|
|
32
|
+
merge-base-only findings as rebase notes rather than defects.
|
|
25
33
|
|
|
26
34
|
## The eight specialists
|
|
27
35
|
|
package/docs/user/skills.md
CHANGED
|
@@ -46,7 +46,7 @@ becomes part of the agent's context.
|
|
|
46
46
|
| `thatch-review-mark-and-sweep` | Mechanical change completeness: whole-repo sweep for stragglers after renames, flag removals, API substitutions. |
|
|
47
47
|
| `thatch-review-highlights` | Positive finding detection: notably clever solutions, cleanup done along the way, documentation that helps. Medium-high bar. |
|
|
48
48
|
| `thatch-review-synthesizer` | Verifies and synthesizes findings from multiple specialists into a deduplicated, severity-grouped report. |
|
|
49
|
-
| `thatch-review-context` | Gathers project context (PRs, tickets, TODOs, deferred work) before a review. Prevents false positives about intentionally deferred work. |
|
|
49
|
+
| `thatch-review-context` | Gathers project context (PRs, tickets, linked docs/designs followed from the change, TODOs, deferred work) before a review. Prevents false positives about intentionally deferred work. |
|
|
50
50
|
| `thatch-code-archaeology` | Investigates an existing feature, debugs an unfamiliar area, or begins a new ticket. The research skill; pair with `thatch-coding-workflow`. |
|
|
51
51
|
| `thatch-review-followup` | Verifies whether the author's responses and code changes since your last review adequately addressed your prior findings. |
|
|
52
52
|
| `thatch-review-response` | Author-side review response: triage findings on your own PR, fix bugs one by one, reply on each thread, post a top-level summary comment. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeffober/thatch",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.35",
|
|
4
4
|
"description": "Persistent memory for AI coding agents — local embeddings, SQLite stores, zero config. Works with OpenCode (as a plugin), Claude Code (as an MCP server), and Cursor (as an MCP server).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
package/src/prompts.ts
CHANGED
|
@@ -523,7 +523,7 @@ function extractionNudgeOpencode(
|
|
|
523
523
|
sessionID: string,
|
|
524
524
|
): string {
|
|
525
525
|
const plural = count === 1 ? "" : "s";
|
|
526
|
-
const dispatch =
|
|
526
|
+
const dispatch = 'Dispatch a task with background: true and subagent_type: "general" (required for thatch tool access)';
|
|
527
527
|
const drainTool = "thatch_extraction_done";
|
|
528
528
|
const fetchTool = "thatch_get_extraction_payload";
|
|
529
529
|
return buildExtractionNudge(count, missedCount, plural, dispatch, drainTool, fetchTool, sessionID);
|