@jeffober/thatch 0.2.4 → 0.2.6
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/README.md +56 -26
- package/artifacts/skills/common.md +1 -0
- package/artifacts/skills/thatch-clear-writing.md +103 -5
- package/artifacts/skills/thatch-code-archaeology.md +9 -0
- package/artifacts/skills/thatch-code-review.md +16 -8
- package/artifacts/skills/thatch-coordination.md +69 -0
- package/artifacts/skills/thatch-plan-refinement.md +33 -4
- package/artifacts/skills/thatch-pr-description.md +21 -13
- package/artifacts/skills/thatch-refine-personal.md +5 -0
- package/artifacts/skills/thatch-refine.md +7 -1
- package/artifacts/skills/thatch-review-context.md +55 -2
- package/artifacts/skills/thatch-review-followup.md +4 -4
- package/artifacts/skills/thatch-review-no-slop.md +15 -0
- package/artifacts/skills/thatch-review-response.md +1 -1
- package/artifacts/skills/thatch-review-synthesizer.md +21 -1
- package/bin/thatch +48 -15
- package/docs/assets/deepwiki-badge.svg +1 -0
- package/docs/dev/README.md +18 -10
- package/docs/dev/features/README.md +1 -1
- package/docs/dev/features/behavior-engine.md +10 -0
- package/docs/dev/features/cli.md +4 -1
- package/docs/dev/features/commands.md +40 -9
- package/docs/dev/features/cross-session-chat.md +194 -23
- package/docs/dev/features/database.md +4 -4
- package/docs/dev/features/notifications.md +1 -2
- package/docs/dev/features/nudge-pipeline.md +14 -0
- package/docs/dev/features/opencode-plugin.md +56 -15
- package/docs/dev/features/prediction-engine.md +71 -6
- package/docs/dev/features/qa-system.md +19 -3
- package/docs/dev/features/session-lifecycle.md +6 -6
- package/docs/dev/features/session-tabs.md +161 -0
- package/docs/dev/features/setup.md +5 -0
- package/docs/dev/features/watchers.md +62 -6
- package/docs/dev/gotchas.md +89 -0
- package/docs/dev/mcp-parity.md +5 -5
- package/docs/dev/setup-and-hooks.md +7 -2
- package/docs/dev/skills.md +12 -9
- package/docs/plans/generalized-session-heartbeat.md +212 -0
- package/docs/plans/prediction-consolidation.md +88 -68
- package/docs/user/README.md +29 -13
- package/docs/user/behavior-engine.md +7 -1
- package/docs/user/cli.md +5 -1
- package/docs/user/code-review.md +43 -2
- package/docs/user/commands.md +37 -10
- package/docs/user/cross-session-chat.md +76 -26
- package/docs/user/prediction-engine.md +23 -1
- package/docs/user/setup.md +16 -0
- package/docs/user/skills.md +9 -7
- package/docs/user/watchers.md +22 -7
- package/package.json +10 -2
- package/src/alerts.ts +1 -1
- package/src/capabilities.ts +20 -6
- package/src/chat.ts +358 -43
- package/src/commands.ts +123 -18
- package/src/db.ts +74 -3
- package/src/git.ts +3 -1
- package/src/hygiene.ts +5 -0
- package/src/mcp.ts +101 -9
- package/src/opencode/tui-plugin.ts +90 -0
- package/src/opencode/v2.ts +440 -66
- package/src/prediction.ts +90 -0
- package/src/prompts.ts +164 -29
- package/src/runtime.ts +298 -15
- package/src/scoring-engine.ts +40 -9
- package/src/session-db.ts +4 -4
- package/src/session-tab-shared.ts +231 -0
- package/src/setup.ts +9 -3
- package/src/skills.ts +6 -9
- package/src/tab-state.ts +125 -0
- package/src/tool-defs.ts +454 -76
- package/src/tools.ts +2 -0
- package/src/watchers.ts +263 -26
- package/docs/plans/intuition-drives.md +0 -147
- package/docs/plans/llm-alerts.md +0 -287
- package/docs/plans/thatch-actions.md +0 -179
- package/docs/plans/worktree-deletion-recovery.md +0 -246
package/README.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Thatch
|
|
2
2
|
|
|
3
|
-
[](https://github.com/sysread/thatch/actions/workflows/ci.yml)
|
|
3
|
+
[](https://github.com/sysread/thatch/actions/workflows/ci.yml) [](https://deepwiki.com/sysread/thatch)
|
|
4
|
+
|
|
5
|
+
<!-- Experiment (Oct 2026): deepwiki.com/badge.svg 429-challenges non-browser
|
|
6
|
+
fetchers, so the hotlinked badge rendered broken. The wiki indexed us
|
|
7
|
+
anyway ("featured in the repository"), so this vendored copy tests
|
|
8
|
+
whether DeepWiki keeps reindexing without any request to their domain.
|
|
9
|
+
If freshness holds, the hotlink never mattered; if the wiki goes stale,
|
|
10
|
+
restore https://deepwiki.com/badge.svg when their challenge lifts. -->
|
|
4
11
|
|
|
5
12
|
Persistent memory and operational methodology for AI coding agents. Works with
|
|
6
13
|
**OpenCode** (as a plugin), **Claude Code** (as a local MCP server), and
|
|
@@ -37,10 +44,11 @@ synchronously (fire-and-forget) instead of asynchronously.
|
|
|
37
44
|
|
|
38
45
|
The v2 plugin API is missing a few surfaces the v1 API had. On 2.x:
|
|
39
46
|
|
|
40
|
-
- **
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
- **Toasts ride the session-tab bridge.** Every plugin toast (extraction
|
|
48
|
+
metrics, alerts, chat registration, blocked wrap-ups) travels the
|
|
49
|
+
session-tab rpc bridge to the TUI plugin's `ui.toast.show`. A TUI-less
|
|
50
|
+
environment (headless run, still connecting) shows nothing - toasts are
|
|
51
|
+
best-effort by design.
|
|
44
52
|
- **Plugin state survives reloads.** Editing the plugin (or `opencode
|
|
45
53
|
plugin update`) reloads it, but extraction buffers, watcher
|
|
46
54
|
registrations, and armed wrap-ups are journaled and restored; a process
|
|
@@ -49,14 +57,23 @@ The v2 plugin API is missing a few surfaces the v1 API had. On 2.x:
|
|
|
49
57
|
such a session re-arms its watches on the first message (expired ones
|
|
50
58
|
are dropped and reported), and a live session in the same project gets a
|
|
51
59
|
one-line notice that a dead session's watch will re-arm if resumed.
|
|
52
|
-
- **Extraction children are visible
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
- **Extraction children are visible on older 2.x builds.** Upstream exposed
|
|
61
|
+
`session.remove` on the plugin API (v2.0.22), so the fact-extractor
|
|
62
|
+
child sessions are deleted when they finish - the session picker stays
|
|
63
|
+
clean. On an older 2.x build (pre-`session.remove`) the deletion
|
|
64
|
+
degrades silently: children accumulate in the session picker, and
|
|
65
|
+
"continue last session" (`-c`) can land in one after any session that
|
|
66
|
+
triggered extraction.
|
|
67
|
+
- **Wrap-up actions need a new host (compact) or an open tab (exit).** The
|
|
68
|
+
compaction trigger rides `session.compact` on the plugin API (upstream
|
|
69
|
+
added it in v2.0.22); on an older 2.x build the checklist and memory
|
|
70
|
+
flush run but the compaction itself is skipped - run `/compact` yourself
|
|
71
|
+
there. `/thatch/exit` closes the session's own tab over the session-tab
|
|
72
|
+
bridge; with no tab open (headless run, tabs off) nothing visible happens,
|
|
73
|
+
but the session still unregisters from chat and its watches are
|
|
74
|
+
cancelled - on either host, and reopening or resuming the session does
|
|
75
|
+
not re-arm them. Re-create watches you still want with
|
|
76
|
+
`thatch_watch_create`.
|
|
60
77
|
- **No `-c` session listing.** The chat resume listing degrades.
|
|
61
78
|
|
|
62
79
|
Everything else - tools, memory, nudges, chat, watchers - behaves the
|
|
@@ -195,16 +212,24 @@ Thatch gives your agent:
|
|
|
195
212
|
- **Slash commands** -- `/thatch/defrag` (consolidate duplicate memories),
|
|
196
213
|
`/thatch/extract` (drain the extraction queue now), `/thatch/hygiene`
|
|
197
214
|
(tend stale and orphaned memories), `/thatch/reflect` (persist what
|
|
198
|
-
the session learned),
|
|
199
|
-
project type's requirements, classifying the project first)
|
|
200
|
-
|
|
201
|
-
|
|
215
|
+
the session learned), `/thatch/refine` (refine a plan under the
|
|
216
|
+
project type's requirements, classifying the project first),
|
|
217
|
+
`/thatch/self-review` (review your own completed work before
|
|
218
|
+
submitting it, weighted for reputation and simplicity),
|
|
219
|
+
`/thatch/peer-review` (review another author's change, weighted for
|
|
220
|
+
org velocity and sharing the project's persistent memory), and
|
|
221
|
+
`/thatch/whois` (report the session's chat identity) run on demand.
|
|
222
|
+
The nudge-backed actions (`defrag`, `extract`, `hygiene`, `reflect`)
|
|
223
|
+
mirror the same behaviors the nudges run on their own schedule; the
|
|
224
|
+
rest stand alone. Plus the opencode-only wrap-ups: `/thatch/compact` and
|
|
202
225
|
`/thatch/exit` run a pre-flight checklist before a compaction or an exit:
|
|
203
226
|
the agent flushes pending fact extraction, finishes promised memory
|
|
204
227
|
writes, and surfaces todos or follow-ups it never addressed. It ends its
|
|
205
228
|
response with a greenlight token only when the checklist is clean; thatch
|
|
206
|
-
then triggers the compaction or
|
|
207
|
-
the
|
|
229
|
+
then triggers the compaction or closes the session (its tab on opencode
|
|
230
|
+
2, the whole app on opencode 1 - either way its watches are cancelled).
|
|
231
|
+
With items outstanding, the agent lists them and nothing fires -- you
|
|
232
|
+
decide when to retry.
|
|
208
233
|
- **Notifications + user config** -- the agent can ping you out-of-band when a
|
|
209
234
|
long-running outcome lands: a desktop banner, a spoken voice
|
|
210
235
|
announcement, or both (macOS and Linux). On opencode, thatch also watches
|
|
@@ -228,19 +253,24 @@ host.
|
|
|
228
253
|
|
|
229
254
|
The memory tools, prediction and behavior engines, conversation search via
|
|
230
255
|
the `thatch session` CLI, cross-session chat (with stop-hook wake), skills,
|
|
231
|
-
and the on-demand actions `/thatch/defrag`, `/thatch/hygiene`,
|
|
232
|
-
`/thatch/reflect
|
|
233
|
-
|
|
234
|
-
|
|
256
|
+
and the on-demand actions `/thatch/defrag`, `/thatch/hygiene`,
|
|
257
|
+
`/thatch/reflect`, `/thatch/refine`, `/thatch/self-review`, and
|
|
258
|
+
`/thatch/peer-review` (synced by `thatch setup --claude`; the review-mode
|
|
259
|
+
commands run the specialist sequence inline, since the coordinator skill is
|
|
260
|
+
opencode-only). Not available: the
|
|
261
|
+
wrap-up commands (they need the plugin's host action routes),
|
|
262
|
+
`/thatch/extract` and `/thatch/whois` (they need the opencode plugin's
|
|
263
|
+
session identity), live recall/prediction nudges
|
|
235
264
|
beyond the hook-based flow, and toast notifications.
|
|
236
265
|
|
|
237
266
|
## What works in Cursor
|
|
238
267
|
|
|
239
268
|
The same core set as Claude Code (memory, predictions, behaviors, chat with
|
|
240
|
-
stop-hook wake, skills, and the `defrag`/`hygiene`/`reflect
|
|
269
|
+
stop-hook wake, skills, and the `defrag`/`hygiene`/`reflect`/`refine`/
|
|
270
|
+
`self-review`/`peer-review` actions). Cursor
|
|
241
271
|
has no file-based slash commands, so the actions surface through MCP prompts
|
|
242
|
-
instead. Not available: the wrap-up commands, `/thatch/extract`,
|
|
243
|
-
notifications.
|
|
272
|
+
instead. Not available: the wrap-up commands, `/thatch/extract`,
|
|
273
|
+
`/thatch/whois`, and toast notifications.
|
|
244
274
|
|
|
245
275
|
## Privacy
|
|
246
276
|
|
|
@@ -34,6 +34,7 @@ If your briefing includes a project context brief (from the coordinator or from
|
|
|
34
34
|
- **Deferred work** listed in the brief is intentionally excluded from this PR. Do not flag the absence of deferred pieces as bugs, inconsistencies, or missing functionality.
|
|
35
35
|
- **Dependencies** in the brief tell you whether base-branch behavior is expected to be present or not. Do not assert that base-branch behavior exists without verifying it landed.
|
|
36
36
|
- **Relevant constraints** may explain why code is structured a certain way. Consider them before flagging design choices.
|
|
37
|
+
- **Sibling PR context** in the brief (when related PRs were detected) tells you where the pieces outside this diff live. Before flagging something as "referenced but not implemented anywhere in this change", check the sibling register: a stack member or release-train sibling may deliver it.
|
|
37
38
|
|
|
38
39
|
## Workflow context awareness
|
|
39
40
|
If your briefing includes a workflow guide (from the coordinator or from loading thatch-code-archaeology), use it to understand the purpose and evolution of the code you are reviewing:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: thatch-clear-writing
|
|
3
|
-
description: Prose rules for every piece of text a human reads that no dedicated skill already covers - PR and ticket comments posted on the user's behalf, documentation, feature plans, reports, write-ups, status updates,
|
|
3
|
+
description: Prose rules for every piece of text a human reads that no dedicated skill already covers - PR and ticket comments posted on the user's behalf, documentation, feature plans, reports, write-ups, status updates, chat replies, and code and doc comments. Load it before drafting any of those. When a dedicated writing skill is loaded (thatch-pr-description, thatch-ticket-description, thatch-review-response), that skill's rules win.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Clear writing
|
|
@@ -19,6 +19,7 @@ Every text a human reads:
|
|
|
19
19
|
|
|
20
20
|
- **Comments you post for the user** - PR comments, ticket comments (Linear, Jira), replies to reviewers, replies to bot findings.
|
|
21
21
|
- **Written artifacts** - documentation, feature plans, reports, write-ups, design notes, status updates.
|
|
22
|
+
- **Code and doc comments** - comments in source files, doc comments, package READMEs.
|
|
22
23
|
- **Replies to the user in chat** - explanations, summaries, answers.
|
|
23
24
|
|
|
24
25
|
Same prose rules everywhere. Only the structure differs:
|
|
@@ -56,9 +57,12 @@ Hard rules. Not suggestions.
|
|
|
56
57
|
8. **Show causal links.** If a sentence uses "so", "because", or "prevents", make the middle step visible. Cause and effect that do not obviously touch need the missing step spelled out.
|
|
57
58
|
9. **Clarity wins over compression.** Brevity means fewer claims, not denser claims. Shorten by deleting whole claims. Never rewrite surviving sentences into tighter ones. Keep the connective tissue that makes a sentence parse on first read.
|
|
58
59
|
10. **No invented shorthand.** Do not coin abbreviations, portmanteaus, or labels mid-text. Use the real name, or spell out the behavior. A term the reader cannot find anywhere else is a term they cannot look up.
|
|
59
|
-
11. **No
|
|
60
|
-
12. **
|
|
61
|
-
13. **
|
|
60
|
+
11. **No made-up technical phrases.** Do not coin multi-word terms that sound technical but mean nothing: "identity contract", "canonical hash", "semantic alignment layer". Every term must exist somewhere - in the code, the docs, or standard engineering usage. If you cannot point to where it is defined, delete the label and say what the thing does: what runs, what changes, what the reader gets.
|
|
61
|
+
12. **No buzzwordy abstractions.** "leverage" -> "use". "utilize" -> "use". If you cannot say what a phrase means in plain English, it does not belong.
|
|
62
|
+
13. **Plain ASCII.** No smart quotes, em dashes, or ellipsis glyphs.
|
|
63
|
+
14. **No process narration.** Never describe the order you assembled things in or narrate your own actions inside the text. State the thing itself.
|
|
64
|
+
15. **No sycophancy.** Never open by validating the question: phrases like "Great question", "Excellent question", "You're absolutely right", "You're asking the right questions", "I'm excited to help" signal "AI bot managing your emotions" and must never appear. Never hedge a verifiable claim with "I think", "I believe", "In my opinion", "Arguably", or "Just" as a softener. Stating uncertainty on purpose (you are genuinely unsure of a preference or a prediction) is not a hedge. Corrections are not rudeness. They are the point.
|
|
65
|
+
16. **When you don't know, say so.** Say "I don't know" and stop. If you know part of it, state what you know, what you don't, and your confidence. No plausible filler.
|
|
62
66
|
|
|
63
67
|
## Length
|
|
64
68
|
|
|
@@ -70,8 +74,102 @@ Match length to complexity: how much new mental model the reader must build.
|
|
|
70
74
|
|
|
71
75
|
For chat replies: terse is fine, illegible is not. If a two-line answer only fits by inventing shorthand, spend five lines.
|
|
72
76
|
|
|
77
|
+
## Session replies
|
|
78
|
+
|
|
79
|
+
A substantial turn ends with a brief state summary: what was done, what was found, the current state, and what remains. The response comes first; the summary is a short block after it. Keep it to a few lines. Never a large task list the user must scroll past to find the response. When work spans turns, keep pending work visible as a brief outline, not a list that grows until it hides the answer.
|
|
80
|
+
|
|
81
|
+
A state summary at the end of a turn is not process narration. Rule 14 bans narrating how you assembled the text; this section requires reporting where the work stands.
|
|
82
|
+
|
|
83
|
+
## Code comments
|
|
84
|
+
|
|
85
|
+
Comments are human-facing text. The same prose rules apply, plus these. The
|
|
86
|
+
reader is the same future coder from "The reader" above: they know the stack
|
|
87
|
+
and general engineering vocabulary, and they have never touched this area.
|
|
88
|
+
|
|
89
|
+
- **No metaphor standing in for a mechanism.** If a word labels behavior the
|
|
90
|
+
comment never states, replace the word with the behavior: "re-enqueued
|
|
91
|
+
rows get a fresh timestamp so they don't starve the rest", not "a
|
|
92
|
+
quarantine". A metaphor verb attached to the stated mechanism is fine
|
|
93
|
+
("the sweep heals the dropped ids"). A metaphor noun doing the
|
|
94
|
+
mechanism's job is not.
|
|
95
|
+
- **Euphemisms die; call the thing what it is.** "later UPDATEs of the same
|
|
96
|
+
row leave it unchanged", not "enqueued_at is not bumped by re-touches"
|
|
97
|
+
("bumped by re-touches" is a terrible phrase for "UPDATEs"). A pinned
|
|
98
|
+
term of art survives.
|
|
99
|
+
- **Full sentences, always.** "A failed cycle waits out the backoff delay,
|
|
100
|
+
an idle cycle waits the short idle cadence, and a productive cycle waits
|
|
101
|
+
zero because the queue still has work", not "failures wait out the
|
|
102
|
+
backoff delay, idle cycles the short idle cadence, productive cycles
|
|
103
|
+
nothing". The missing causal clause is usually the point.
|
|
104
|
+
- **If/then with the named cause, not a label-colon chain.** "If the
|
|
105
|
+
recompute returns no row for a claimed id, that id was deleted or
|
|
106
|
+
soft-deleted after it was enqueued; the worker then deletes any cache row
|
|
107
|
+
it still has", not "A claimed id with no recompute row was deleted or
|
|
108
|
+
soft-deleted mid-drain: its cache row is deleted". No passives
|
|
109
|
+
in the consequence half.
|
|
110
|
+
- **Subject first.** "DrainLoop is a background goroutine that repeatedly
|
|
111
|
+
claims", not "A background goroutine (DrainLoop) repeatedly claims".
|
|
112
|
+
Names never hide inside parentheticals.
|
|
113
|
+
- **Behavior before implementation structure.** "takes up to limit rows
|
|
114
|
+
off the queue, oldest first, and returns them; deleting the row is the
|
|
115
|
+
claim", not "a CTE selects the stalest ids ... and the outer DELETE
|
|
116
|
+
removes exactly those rows". State the invariant the design buys ("a
|
|
117
|
+
trigger enqueue for the same row never waits on this transaction"),
|
|
118
|
+
not the failure mechanics behind it.
|
|
119
|
+
- **Parentheticals only when they add a distinct fact.** Keep "(or has
|
|
120
|
+
been killed on)". Cut "(the worker runs when the flag is unset)" after
|
|
121
|
+
"It defaults to enabled".
|
|
122
|
+
- **Enumerate the parts once, then the collective noun.** "stops the
|
|
123
|
+
worker" after the drain loop and the sweep are established. Never
|
|
124
|
+
re-enumerate, and never enumerate what the thing does not control.
|
|
125
|
+
- **State what is impossible, plainly, in first person.** "This should not
|
|
126
|
+
be possible: the apply statements are a plain INSERT ... SELECT and
|
|
127
|
+
DELETE whose only inputs are ids that exist in the queue. If we screwed
|
|
128
|
+
up (a projection drift, a constraint we did not anticipate), the same
|
|
129
|
+
batch would fail again on retry, so re-enqueueing would only churn. Log
|
|
130
|
+
it with the ids and drop it; the daily sweep heals the dropped ids."
|
|
131
|
+
Invariant, failure conditions, decision, recovery. No hedging.
|
|
132
|
+
- **Rescope every label when behavior splits.** If re-enqueue now only
|
|
133
|
+
happens for lock-blocked batches, "failed batch" is wrong everywhere it
|
|
134
|
+
appears: comments, log messages, test names.
|
|
135
|
+
- **Doc comments own the mechanism; package READMEs stay high-level
|
|
136
|
+
guides.** A README is not "the code but in english". Implementation
|
|
137
|
+
detail belongs to the doc comment next to the code.
|
|
138
|
+
- **Do not document de facto conventions.** If the framework or the
|
|
139
|
+
migrations make something the default rule, the comment does not say so.
|
|
140
|
+
Point at the artifact that owns the contract or say nothing.
|
|
141
|
+
- **No ticket refs or plan-doc coordinates in place of behavior.** "the
|
|
142
|
+
backfill worker", not "the TICKET-123 backfill worker". The reader never
|
|
143
|
+
opens the ticket tracker to understand the code.
|
|
144
|
+
- **A term of art is defined once; plain behavior everywhere else.** "(the
|
|
145
|
+
tombstone correction)" in the place it is defined; "a second pass
|
|
146
|
+
removing cache rows whose source row no longer exists" everywhere else.
|
|
147
|
+
- **Keep load-bearing precision.** Translate jargon ("mid-drain" becomes
|
|
148
|
+
"after it was enqueued"), but keep the contract when the code depends on
|
|
149
|
+
it: Postgres error classes 40 and 55, genuine lists, cross-references
|
|
150
|
+
that carry the why.
|
|
151
|
+
|
|
152
|
+
The comment shape for a named thing (a metric, a function, a constant):
|
|
153
|
+
|
|
154
|
+
1. What it does or reports, in behavior terms.
|
|
155
|
+
2. What a reading means: "Sustained growth means the drain loop cannot
|
|
156
|
+
keep up with (or has been killed on) the enqueue rate".
|
|
157
|
+
3. The operational caveat, when needed: "Sampled by the drain loop, so it
|
|
158
|
+
freezes while the kill switch is off".
|
|
159
|
+
|
|
160
|
+
The wart shape, for code that looks wrong but is correct:
|
|
161
|
+
|
|
162
|
+
1. Name the sensible implementation the reader expects: "Why not
|
|
163
|
+
min(base * 3^(n-1), max)?"
|
|
164
|
+
2. State the crux: the multiply wraps the int64 before min clamps.
|
|
165
|
+
3. Why, in the fewest words: "30s * 3^19 overflows the Duration, an int64,
|
|
166
|
+
and min would clamp the overflowed value, not the intended product."
|
|
167
|
+
|
|
168
|
+
Simple and good beats complex and great. Cut whole claims to shorten;
|
|
169
|
+
never compress the survivors.
|
|
170
|
+
|
|
73
171
|
## Clarity pass
|
|
74
172
|
|
|
75
173
|
Before you post, save, or send: reread the draft as a reader with zero context. Fix what they would stumble on. Do not announce the pass; just return clean prose.
|
|
76
174
|
|
|
77
|
-
Check: Does every sentence parse on first read? Does every term carry its plain-English meaning before or with the label? Would a reader who has never seen this codebase, ticket, or conversation understand it? If the draft runs long, cut a claim; never tighten the grammar.
|
|
175
|
+
Check: Does every sentence parse on first read? Does every term carry its plain-English meaning before or with the label? Is every technical phrase real - could you find it in the code, the docs, or common usage? If not, say what the thing does instead of naming it. Would a reader who has never seen this codebase, ticket, or conversation understand it? If the draft runs long, cut a claim; never tighten the grammar.
|
|
@@ -198,6 +198,15 @@ For each feature or workflow you investigated, teach the user what it is and how
|
|
|
198
198
|
|
|
199
199
|
Include sub-agent findings as their own per-feature sections, integrated into the same report.
|
|
200
200
|
|
|
201
|
+
### Cross-PR context (when a sibling register is supplied)
|
|
202
|
+
|
|
203
|
+
When the review coordinator dispatches you, your input may include the project context brief with a sibling register: related PRs detected as stack members or release-train siblings. Fold the register into the guide where it changes what a reviewer would flag:
|
|
204
|
+
|
|
205
|
+
- A comment or doc referencing work delivered by a sibling PR is intentional cross-referencing, not a dangling reference. Note it as a design decision, with the sibling PR number.
|
|
206
|
+
- A contract consumed from a sibling (an API, type, schema, or flag) is part of the workflow's data flow. Map it, and note the dependency direction.
|
|
207
|
+
- An ordering assumption across the stack or train (this change assumes a sibling lands first) is a workflow constraint. Note it with the claimed order from the register.
|
|
208
|
+
- Do not investigate a sibling's code beyond what the register and its consistency verdicts already established. The register is context, not a mandate to review the sibling.
|
|
209
|
+
|
|
201
210
|
### Recommendations
|
|
202
211
|
Tailor this section to the user's original ask:
|
|
203
212
|
- **Research or investigation**: summarize what you found and what remains unknown
|
|
@@ -18,11 +18,11 @@ Identify what to review:
|
|
|
18
18
|
- If a git range was specified (A..B form), use it directly.
|
|
19
19
|
- If no target was specified, review the current branch against its base, resolving the base from `origin/main` (or the appropriate remote tracking ref) after fetching.
|
|
20
20
|
|
|
21
|
-
Also detect whether the current branch has a **connected PR/MR** even when none was specified — this is what enables follow-up-round detection in Step 2. Inspect `git remote -v` to recognize the VCS host (github.com → GitHub/`gh`; gitlab.* → GitLab/`glab`; bitbucket.org → Bitbucket Cloud; dev.azure.com → Azure DevOps). Then probe for an open PR/MR on the current branch using the matching CLI or REST API:
|
|
22
|
-
- GitHub: `gh pr view
|
|
21
|
+
Also detect whether the current branch has a **connected PR/MR** even when none was specified — this is what enables follow-up-round detection and related-PR discovery in Step 2. Inspect `git remote -v` to recognize the VCS host (github.com → GitHub/`gh`; gitlab.* → GitLab/`glab`; bitbucket.org → Bitbucket Cloud; dev.azure.com → Azure DevOps). Then probe for an open PR/MR on the current branch using the matching CLI or REST API:
|
|
22
|
+
- GitHub: `gh pr view <branch> --json number,headRefOid,baseRefOid`
|
|
23
23
|
- GitLab: `glab mr list --source-branch <branch>`
|
|
24
24
|
- Other providers: equivalent detection via their CLI or REST API.
|
|
25
|
-
- If you cannot detect or cannot interact with the VCS (no CLI, no REST access), treat the change as a **local-branch review** and proceed with the existing procedure. A local-branch review is not a defect — it
|
|
25
|
+
- If you cannot detect or cannot interact with the VCS (no CLI, no REST access), treat the change as a **local-branch review** and proceed with the existing procedure. A local-branch review is not a defect — it means there is no prior-comments register to build and no connected PR to chain stack discovery from (release trains remain discoverable through tracker relations and linked PRs).
|
|
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
|
|
|
@@ -43,8 +43,9 @@ Load the thatch-review-context skill and follow its methodology to build a conte
|
|
|
43
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
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
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`.
|
|
46
|
+
- **Related PRs (stacks and release trains)** — discover the coordinated set this change belongs to (see source #11 in the review-context skill): stack members chained through base branches, and release-train siblings ordered by tracker relations or ticket DEPENDENCIES sections (the ticket section that names the change's blocking links). Build the sibling register with targeted consistency verdicts; source #11's early-out governs when to skip (a connected PR/MR is required to chain a stack, but a release train is discoverable from ticket references and linked PRs alone). When reading the siblings' descriptions and targeted diffs would crowd the orchestrator's context (a deep stack or a large train), dispatch one sub-agent instructed to follow source #11's methodology in the review-context skill, then fold its output into the brief.
|
|
46
47
|
|
|
47
|
-
Produce the context brief in the format the skill prescribes (project context, this change's scope, deferred work, dependencies, relevant constraints,
|
|
48
|
+
Produce the context brief in the format the skill prescribes (project context, this change's scope, deferred work, dependencies, relevant constraints, the prior review comments section when present, and the sibling PR context section when related PRs were detected).
|
|
48
49
|
|
|
49
50
|
If context is sparse (no PR description, no ticket references, no relevant memories), note that the change appears standalone. Even a sparse brief is valuable: it tells specialists you looked and found nothing, so they do not need to repeat the search.
|
|
50
51
|
|
|
@@ -57,7 +58,9 @@ Dispatch a sub-agent using the Task tool to research the code workflows affected
|
|
|
57
58
|
|
|
58
59
|
The sub-agent produces a code guide with one section per affected workflow or feature. Wait for it to complete and collect the guide.
|
|
59
60
|
|
|
60
|
-
This guide gives specialists the code-level context (purpose, data flow, evolutions, constraints) they need to avoid false positives about intentional behavior and long-standing design decisions, and reduces duplicate code-tracing across the
|
|
61
|
+
This guide gives specialists the code-level context (purpose, data flow, evolutions, constraints) they need to avoid false positives about intentional behavior and long-standing design decisions, and reduces duplicate code-tracing across the nine specialist lenses.
|
|
62
|
+
|
|
63
|
+
If the context brief includes a sibling register (from Step 2's related-PR discovery), fold it into the guide per the `Cross-PR context` section of the thatch-code-archaeology skill — whether you dispatch a sub-agent or do this research inline. The traps the guide exists to catch are comments referencing sibling work, contracts consumed from a sibling, and ordering assumptions across the stack or train.
|
|
61
64
|
|
|
62
65
|
For small changes (a single file or trivial diff), you may do this research inline instead of dispatching a sub-agent. Use your judgment: if the workflow research would require reading more than 3-4 files, dispatch a sub-agent to preserve your context for orchestration.
|
|
63
66
|
|
|
@@ -129,6 +132,7 @@ Pass the synthesizer:
|
|
|
129
132
|
- The workflow guide from Step 3.
|
|
130
133
|
- The specialist findings.
|
|
131
134
|
- The prior-comments register when present.
|
|
135
|
+
- The sibling register from Step 2 when present.
|
|
132
136
|
- The staleness signal from the brief (commits on main after the merge-base touching this change's paths), when present.
|
|
133
137
|
|
|
134
138
|
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.
|
|
@@ -141,15 +145,18 @@ Technique notes (from the technique specialist) appear in a `### Technique notes
|
|
|
141
145
|
|
|
142
146
|
**Follow-up round cross-reference** — if Step 2 built a prior-comments register, the synthesizer must cross-reference every confirmed and rejected finding against it (see the synthesizer skill's "Cross-reference against prior review comments" section). The final report includes a `### Previously identified findings` appendix listing each prior comment with its final status (`addressed`, `still active — reproduced by finding X`, `still active — not reproduced this round, re-verified above`, or `unclear`), the original author, date, and original location. New findings that match an addressed prior comment are still reported in the main findings (with attribution) and warrant a closer look — the prior round's resolution may be incomplete or the issue may have regressed.
|
|
143
147
|
|
|
148
|
+
**Cross-PR consistency** — if Step 2 built a sibling register, the synthesizer must cross-reference findings against it (see the synthesizer skill's "Cross-reference against the sibling PR register" section). A finding claiming something is missing is rejected or downgraded to a stack note when a sibling delivers it. An inconsistency between this change and a sibling becomes a finding of THIS review only when it affects this change's safety or correctness, or when flagging it now heads off a bug the author will hit in imminent follow-up work in the same project; otherwise it lands in the `### Cross-PR notes` appendix, for the sibling's own review (the synthesizer skill's section carries the rule).
|
|
149
|
+
|
|
144
150
|
Alternatively, perform the synthesis yourself:
|
|
145
151
|
1. Read each finding's cited location to verify evidence accuracy.
|
|
146
152
|
2. Deduplicate findings flagged by multiple specialists.
|
|
147
153
|
3. Group findings by root cause where multiple findings stem from the same issue.
|
|
148
154
|
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. For technique notes, verify the cited alternative exists at the cited location and achieves the same behavior; if the code as written is actually a defect, hand the finding to the defect track instead. 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.
|
|
149
155
|
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.
|
|
150
|
-
6.
|
|
151
|
-
7.
|
|
152
|
-
8.
|
|
156
|
+
6. Cross-reference against the sibling register if one was built in Step 2: reject or downgrade to a stack note any finding whose "missing piece" a sibling delivers; confirm findings where this change consumes a contract a sibling does not provide; route sibling-side problems to the Cross-PR notes appendix unless they affect this change's safety or correctness or head off a bug the author will hit in imminent follow-up work in the same project; produce the `### Cross-PR notes` appendix per the synthesizer skill.
|
|
157
|
+
7. Calibrate severity (BLOCKING > HIGH > MEDIUM > LOW) based on your verification.
|
|
158
|
+
8. Produce a final report with a workflow-change preface, highlights (if any), technique notes (if any), findings grouped by severity, coverage gaps, and human-verifiable unknowns noted. Include every confirmed LOW finding.
|
|
159
|
+
9. Apply the synthesizer's "Writing review comments" prose rules to the whole report. Findings are prose, not shorthand: plain English, one idea per sentence, one sentence per hop of any producer chain.
|
|
153
160
|
|
|
154
161
|
## Specialist briefing template
|
|
155
162
|
|
|
@@ -162,6 +169,7 @@ When dispatching each sub-agent, include in the prompt:
|
|
|
162
169
|
- **The project context brief** from Step 2, filtered to what is relevant to this unit's scope. Explicitly list any deferred work that falls within this unit's files, and call out TODO ($ticket) markers the specialists should recognize as intentional.
|
|
163
170
|
- **The workflow guide** from Step 3, filtered to the workflows relevant to this unit's scope. Use it to understand the purpose and evolution of the code before flagging issues. It provides the code-level context (flows, contracts, history, constraints) that prevents false positives about intentional behavior and long-standing design decisions.
|
|
164
171
|
- **The prior review comments register** from Step 2 when present — the list of issues other reviewers already raised, with each comment's current-HEAD location and preliminary status. This is a **hint list, not a finding list**: it saves specialists the work of treating an already-identified issue as newly discovered. Specialists still produce their own findings normally. For any finding that matches a prior comment, set `Provenance` to `previously identified by @author, PR #N, DATE` in addition to the branch-introduced / pre-existing classification — the synthesizer does the final cross-reference and dedup.
|
|
172
|
+
- **The sibling register** from Step 2 when present — the related PRs (stack members and release-train siblings), what each implements, and the targeted consistency verdicts. Before flagging anything as "referenced but missing" or "not implemented anywhere in this change", check the register: a sibling may deliver the missing piece.
|
|
165
173
|
- Any design context or specific concerns
|
|
166
174
|
- Explicit scope boundaries ("your scope is X; do NOT review Y")
|
|
167
175
|
- Instruction to produce markdown findings with: severity, category, file:line, finding, evidence, trigger scenario, reachability, source of truth, producer chain, provenance
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: thatch-coordination
|
|
3
|
+
description: Coordinate subordinate LLM sessions as a supervisor. Dispatch work with thatch_session_tab (opencode v2 only), track each subordinate in your task list, supervise over cross-session chat, verify before declaring done. Use when orchestrating multi-session work - parallel tasks, delegated implementation, or any flow where you manage work happening in OTHER sessions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are the coordinating LLM. Work happens in subordinate sessions you spawn
|
|
7
|
+
and supervise. Your hands are the dispatch tool and the chat; the hands-on
|
|
8
|
+
work belongs to the subordinates.
|
|
9
|
+
|
|
10
|
+
## Dispatch discipline
|
|
11
|
+
|
|
12
|
+
One task list entry per subordinate, created BEFORE the dispatch. The entry
|
|
13
|
+
records the top-level task, the subordinate's chat name (from the
|
|
14
|
+
`thatch_session_tab` response), its session id, and its status. Your task
|
|
15
|
+
list is the stateful map of the fleet — if it is not in the list, you are
|
|
16
|
+
not supervising it.
|
|
17
|
+
|
|
18
|
+
Dispatch with `thatch_session_tab`:
|
|
19
|
+
|
|
20
|
+
- `title` — short task label (~50 characters).
|
|
21
|
+
- `prompt` — what the subordinate cannot infer: the goal, the relevant paths,
|
|
22
|
+
the acceptance criteria, and any coordination ground rules. The tool
|
|
23
|
+
prepends your coordinator identity and authority framing; you supply the
|
|
24
|
+
substance.
|
|
25
|
+
- `worktree` for work in this repository (the subordinate gets an isolated
|
|
26
|
+
checkout; its tab opens beside yours), `directory` for anything else.
|
|
27
|
+
- Dispatch one subordinate per independent task. Two tasks that touch the
|
|
28
|
+
same files are one task, or a sequenced pair — not two tabs.
|
|
29
|
+
|
|
30
|
+
## Supervision loop
|
|
31
|
+
|
|
32
|
+
Reconcile your task list against reality every turn:
|
|
33
|
+
|
|
34
|
+
- `chat_read` drains mail from subordinates; answer questions, send
|
|
35
|
+
corrections, and record status changes in the task list.
|
|
36
|
+
- A subordinate that goes quiet is not necessarily dead — but the watcher
|
|
37
|
+
machinery sends death notices when a subordinate's session disappears
|
|
38
|
+
(`watcherDeathNotice` names the dead session's chat name). On a death
|
|
39
|
+
notice: mark the task failed, salvage what the subordinate reported, and
|
|
40
|
+
re-dispatch if the work still matters.
|
|
41
|
+
- Do not block on one subordinate while others run. Answer mail in priority
|
|
42
|
+
order; keep your own turns short.
|
|
43
|
+
|
|
44
|
+
## Verification before completion
|
|
45
|
+
|
|
46
|
+
A subordinate reporting "done" is a claim, not a fact. Before you mark a
|
|
47
|
+
task complete or report to the user:
|
|
48
|
+
|
|
49
|
+
1. Review the subordinate's actual output — the diff, the test results, the
|
|
50
|
+
files it claims to have changed.
|
|
51
|
+
2. Re-run the acceptance criteria yourself where cheap (run the tests, read
|
|
52
|
+
the file).
|
|
53
|
+
3. Only then mark the task done and say so.
|
|
54
|
+
|
|
55
|
+
## Authority and escalation
|
|
56
|
+
|
|
57
|
+
The user outranks everything. Your instructions carry accepted priority with
|
|
58
|
+
subordinates, but a direct user instruction to a subordinate supersedes you,
|
|
59
|
+
and a direct user instruction to you supersedes your plan. When a
|
|
60
|
+
subordinate surfaces a conflict, resolve it toward the user's expressed
|
|
61
|
+
wishes and record the decision in the task list.
|
|
62
|
+
|
|
63
|
+
## Cleanup
|
|
64
|
+
|
|
65
|
+
A finished subordinate's tab closes with `thatch_session_tab_close` (pass
|
|
66
|
+
the subordinate's chat name) once its work is verified — tab-level only:
|
|
67
|
+
the session survives and the user can reopen it. If a subordinate strands
|
|
68
|
+
an empty or stuck session, tell the user which session id to delete — you
|
|
69
|
+
cannot delete sessions yourself.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: thatch-plan-refinement
|
|
3
|
-
description: Refine a plan for a code change by dispatching a fresh-context reviewer subagent to hunt for gaps, unverified premises, and unexpected side effects, then revising and re-reviewing until consensus. Use when a plan is about to be implemented, when the user asks to refine, stress-test, or double-check a plan, or after a plan revision that incorporated prior findings. This is the generic core loop; when the project type should shape the refinement bar, load thatch-refine instead and it will apply a type delta on top of this loop. Quick mode is one fresh reviewer per round; deep mode adds a specialist lens fan-out (reuse, alternatives, hidden problems, safe-to-modify, archaeology).
|
|
3
|
+
description: Refine a plan for a code change by dispatching a fresh-context reviewer subagent to hunt for gaps, unverified premises, and unexpected side effects, then revising and re-reviewing until consensus. Use when a plan is about to be implemented, when the user asks to refine, stress-test, or double-check a plan, or after a plan revision that incorporated prior findings. This is the generic core loop; when the project type should shape the refinement bar, load thatch-refine instead and it will apply a type delta on top of this loop. Quick mode is one fresh reviewer per round; deep mode adds a specialist lens fan-out (reuse, alternatives, hidden problems, safe-to-modify, archaeology). Deep-mode triggers are binding; when one is met the fan-out runs, and project-type deltas relax round counts, never mode selection.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
You are refining a plan before code exists. A plan written by the same context that researched the problem inherits that context's blind spots. A reviewer with no stake in the plan and no memory of writing it finds what the author cannot. Refinement is the loop: draft, review, revise, repeat until consensus. Each pass tightens the plan; a round with no findings means the plan is done, not that the loop failed.
|
|
@@ -17,6 +17,16 @@ Pick the mode before starting, and say which you picked.
|
|
|
17
17
|
|
|
18
18
|
**Deep mode** — adds a one-time specialist lens fan-out (see below) before the consensus rounds. Use when the plan: touches shared or persistent state (database tables, files, config) that other consumers read; spans many files or multiple hosts/processes; introduces a new abstraction, table, or contract; or when the user asks for depth. Deep mode runs the lenses ONCE, in the first round; the remaining rounds are quick-mode consensus on the revised plan.
|
|
19
19
|
|
|
20
|
+
**These triggers are binding.** If any trigger is met, deep mode's lens fan-out runs for that plan; quick mode is not an option for it. Project-type deltas (`thatch-refine-personal` and its siblings) relax round counts and skip thresholds. They never relax mode selection. The triggers were met verbatim in a 26-round field refinement (October 2026) and quick mode ran anyway, which is why this paragraph is a rule and not advice.
|
|
21
|
+
|
|
22
|
+
## Plan format requirements
|
|
23
|
+
|
|
24
|
+
Two plan shapes earn their own plan section. Add them at draft time; retrofitting them mid-loop costs rounds, because every round after the retrofit re-reviews prose the section would have settled.
|
|
25
|
+
|
|
26
|
+
**State and transition matrix.** Any plan that adds or changes UI or session state (modes, statuses, retention, flags, caches) must carry a state-and-transition matrix as a plan section: every state, every transition between states, and the precedence rule that decides which transition wins when two compete. The first reviewer round verifies every user journey in the plan against the matrix, not against the prose. UX rules written as prose accrete; a matrix makes the unspecified combination impossible to miss. In a 26-round field refinement (October 2026), the state rules of a chat-and-UI plan lived as prose for 16 rounds, and reviewers kept finding combinations no one had written down; a matrix forced at round one would have collapsed most of those findings into the first two rounds.
|
|
27
|
+
|
|
28
|
+
**Deltas-from-template ledger.** When the plan ports or clones a template or twin feature, it must carry a table of deltas from that template. Each row names one divergence and what the twin actually does at that point, verified against the template's source, not remembered. Reviewers check template-behavior claims against the ledger instead of re-deriving the twin's behavior from scratch. In the same field refinement, a template fact flipped across three rounds because each fresh reviewer re-derived it and got a different answer; the ledger is the fix for that class.
|
|
29
|
+
|
|
20
30
|
## The loop
|
|
21
31
|
|
|
22
32
|
1. **Draft the plan.** Every factual premise carries a `file:line` citation you personally verified. A premise you did not check is a guess wearing a citation; verify it or mark it unverified.
|
|
@@ -26,9 +36,26 @@ Pick the mode before starting, and say which you picked.
|
|
|
26
36
|
- Hunt for gaps by severity (blocker / should-fix / nice-to-have), unexpected side effects, blast radius, and the question "how does this fail in production?" — concurrency, stale state, multi-host interactions, test flakiness, and behavior changes for existing callers.
|
|
27
37
|
- Say explicitly when it cannot verify something, rather than guessing.
|
|
28
38
|
3. **Revise the plan** from the findings. Fix what is wrong, adjust what needs adjusting, and record what you rejected and why.
|
|
29
|
-
4. **
|
|
30
|
-
5. **
|
|
31
|
-
6. **
|
|
39
|
+
4. **Run the revision self-check.** Before dispatching the next reviewer, re-read the revision diff against the plan it edits, in the same context, and check three things: does the fix contradict anything else in the plan, does it open a new unspecified corner, and is it consistent with findings already folded in. This is a contradiction check on the diff, not a fresh review, and it is cheap because it reuses context you already have. Skipping it hands the next fresh reviewer your own unfinished edges one round late. In the 26-round field refinement cited above, revision churn dominated rounds 8 through 19 because each fix opened corners no one checked until the next round caught them.
|
|
40
|
+
5. **Dispatch a NEW reviewer with fresh context** on the revised plan. Never continue the prior reviewer's session, and never tell it what previous reviewers said — prior findings anchor the next reviewer, and it will inherit the earlier reviewer's blind spots instead of finding its own. Present the revised plan as if it were the original.
|
|
41
|
+
6. **Consensus** is a round where the reviewer reports no blockers, no unaddressed should-fixes, and the plan's premises all verify. Two consecutive quiet rounds is strong consensus; one is enough to build. For a run extended past the cap, the stopping rule changes; see Extended runs below.
|
|
42
|
+
7. **Cap at three review rounds.** If the plan has not converged by then, stop looping and put the remaining disagreements in front of the user — continued revision usually means the design problem, not the plan, is unresolved. If the user explicitly extends the run past the cap, follow Extended runs below instead of stopping.
|
|
43
|
+
|
|
44
|
+
## Extended runs (past the cap)
|
|
45
|
+
|
|
46
|
+
The cap is a default, not a law. When the user explicitly extends the run ("keep going while it is useful"), do not stop, and do not repeat the general reviewer prompt either. In the 26-round field refinement cited above, the user overrode the cap, the extended rounds kept earning their keep, and the repeated prompt re-trod ground earlier rounds had already covered. Two mechanics govern the extension.
|
|
47
|
+
|
|
48
|
+
**Rotate the reviewer lens.** Each extended round's reviewer prompt carries one lens from a fixed schedule, instead of the general prompt:
|
|
49
|
+
|
|
50
|
+
1. Schema and data model: the tables, columns, constraints, and migrations the plan touches.
|
|
51
|
+
2. Cross-module contracts: the callers, imports, and API surfaces the plan changes.
|
|
52
|
+
3. Lifecycle and edge cases: creation, teardown, concurrency, and failure paths.
|
|
53
|
+
4. Prompt and UI surfaces: user-visible text, states, and flows.
|
|
54
|
+
5. General: the standard reviewer prompt, then restart the schedule.
|
|
55
|
+
|
|
56
|
+
This rotation applies only past the cap. The standard loop keeps the general prompt for all three of its rounds.
|
|
57
|
+
|
|
58
|
+
**Stop on a build-clean round.** For an extended run, consensus is a round with no build-changing findings, where build-changing means the finding would change what gets built, not how a sentence reads. Wording and editorial findings batch into one final editorial pass after the last round; they do not start new rounds. The quiet-round definition in the loop stays in force for standard runs.
|
|
32
59
|
|
|
33
60
|
## Deep mode: the lenses
|
|
34
61
|
|
|
@@ -68,6 +95,8 @@ Do not argue, and do not silently drop the findings. Reduce the risk of building
|
|
|
68
95
|
- Demand `file:line` evidence for every claim, and explicit "unverified" where it cannot check.
|
|
69
96
|
- Ask it to state whether the plan's own list of affected surfaces is complete or over-broad. Plan authors over-scope and under-scope in equal measure.
|
|
70
97
|
- Tell it the repo is read-only for this task.
|
|
98
|
+
- If the plan carries a state-and-transition matrix, tell the reviewer to verify each user journey against the matrix. This is the first round's job in particular.
|
|
99
|
+
- If the plan carries a deltas-from-template ledger, tell the reviewer to check template-behavior claims against the ledger and not re-derive the twin's behavior from its source. Each ledger row already records what the twin does, verified; independent re-derivation is how contradictory facts about the template flip-flop across rounds.
|
|
71
100
|
|
|
72
101
|
## Cost control
|
|
73
102
|
|