@jeffober/thatch 0.2.1 → 0.2.2
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 +4 -2
- package/artifacts/skills/thatch-plan-refinement.md +3 -2
- package/artifacts/skills/thatch-refine-infra.md +66 -0
- package/artifacts/skills/thatch-refine-oss-contribution.md +68 -0
- package/artifacts/skills/thatch-refine-personal.md +61 -0
- package/artifacts/skills/thatch-refine-shared-lib.md +69 -0
- package/artifacts/skills/thatch-refine-spike.md +53 -0
- package/artifacts/skills/thatch-refine-team-app.md +69 -0
- package/artifacts/skills/thatch-refine.md +84 -0
- package/docs/dev/gotchas.md +13 -0
- package/docs/dev/mcp-parity.md +1 -1
- package/docs/dev/skills.md +8 -1
- package/docs/user/README.md +7 -0
- package/docs/user/commands.md +8 -0
- package/docs/user/skills.md +12 -0
- package/package.json +1 -1
- package/src/commands.ts +23 -3
- package/src/prompts.ts +14 -0
- package/src/runtime.ts +10 -0
- package/src/skills.ts +7 -0
package/README.md
CHANGED
|
@@ -194,8 +194,10 @@ Thatch gives your agent:
|
|
|
194
194
|
auto-joining with `chat.autoRegister: false`).
|
|
195
195
|
- **Slash commands** -- `/thatch/defrag` (consolidate duplicate memories),
|
|
196
196
|
`/thatch/extract` (drain the extraction queue now), `/thatch/hygiene`
|
|
197
|
-
(tend stale and orphaned memories),
|
|
198
|
-
the session learned)
|
|
197
|
+
(tend stale and orphaned memories), `/thatch/reflect` (persist what
|
|
198
|
+
the session learned), and `/thatch/refine` (refine a plan under the
|
|
199
|
+
project type's requirements, classifying the project first) run on
|
|
200
|
+
demand. The first four mirror the same behaviors the nudges run on
|
|
199
201
|
their own schedule. Plus the opencode-only wrap-ups: `/thatch/compact` and
|
|
200
202
|
`/thatch/exit` run a pre-flight checklist before a compaction or an exit:
|
|
201
203
|
the agent flushes pending fact extraction, finishes promised memory
|
|
@@ -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. 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).
|
|
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.
|
|
@@ -75,7 +75,8 @@ One reviewer per round in quick mode; one lens fan-out total in deep mode, then
|
|
|
75
75
|
|
|
76
76
|
## Relationship to other skills
|
|
77
77
|
|
|
78
|
-
- **`thatch-
|
|
78
|
+
- **`thatch-refine`** - the type-aware entry point. Different project types need different refinement bars: a team codebase owes coordination and breadcrumbs, a personal project allows cleverness, a shared library owes API hygiene. When the user runs `/thatch/refine` or the project's type should shape the bar, load `thatch-refine` first; it classifies and hands back a thatch-refine-* delta to apply on top of this loop. This skill stays the generic core.
|
|
79
|
+
- **`thatch-code-archaeology`** - the research skill for understanding the code; its output is often the plan's input. The archaeology lens is a targeted, plan-scoped re-run of its git-history step, not a replacement for it.
|
|
79
80
|
- **`thatch-coding-workflow`** — the procedure skill for executing the refined plan. Refinement ends where coding-workflow begins.
|
|
80
81
|
- **`thatch-ticket-description` / `thatch-pr-description`** — if the refined plan feeds a ticket or PR description (or the session iterated on one using this skill), RE-LOAD the appropriate writing skill and draft within its contract. A plan is a working artifact for the session that wrote it; a ticket or PR description is a reader-facing document with its own sections, verbosity budget, and prose rules. Refinement output — findings, accepted risks, review rounds — is SOURCE MATERIAL for those skills, never a substitute for them. This holds the right level of detail for the medium and keeps the writing clear.
|
|
81
82
|
- **`thatch-clear-writing`** — for any other human-facing text produced along the way (reports, comments, docs).
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: thatch-refine-infra
|
|
3
|
+
description: Type-specific requirements for refining a plan that touches infrastructure (CI pipelines, Terraform, Kubernetes manifests, build and deploy configuration). Loaded by thatch-refine after classification; assumes the core loop in thatch-plan-refinement. Use when a wrong premise can break deploys or pipelines for everyone downstream.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are refining a plan for an **infra** change: CI pipelines, Terraform,
|
|
7
|
+
Kubernetes manifests, build and deploy configuration. The governing value
|
|
8
|
+
is blast radius: a wrong premise here does not break one feature, it
|
|
9
|
+
breaks every pipeline, environment, or developer downstream of it, often
|
|
10
|
+
silently and often for everyone at once. Load `thatch-plan-refinement`
|
|
11
|
+
for the core loop and apply the deltas below; where they disagree, these
|
|
12
|
+
win.
|
|
13
|
+
|
|
14
|
+
## What this type owes
|
|
15
|
+
|
|
16
|
+
- **Near-absolute pattern-following.** Configuration is the worst place
|
|
17
|
+
for novelty. Copy the established pattern from a sibling pipeline,
|
|
18
|
+
module, or manifest even when a better one exists; propose the better
|
|
19
|
+
one as its own change, after this one lands.
|
|
20
|
+
- **Rollback as a first-class deliverable.** Every change names how it
|
|
21
|
+
backs out, concretely (which command, which revert, which state to
|
|
22
|
+
re-apply), not "revert the commit if problems arise."
|
|
23
|
+
- **Staged verification.** The plan verifies against a non-production
|
|
24
|
+
target first (staging environment, a canary job, a dry-run or plan
|
|
25
|
+
output) and names what a successful verification looks like before
|
|
26
|
+
production applies it.
|
|
27
|
+
|
|
28
|
+
## How this changes the loop
|
|
29
|
+
|
|
30
|
+
- **Deep mode is the default.** Infra changes almost always touch shared
|
|
31
|
+
persistent state that other consumers read, which is the core skill's
|
|
32
|
+
first deep-mode trigger.
|
|
33
|
+
- **Premises verify against live state, not memory.** The most dangerous
|
|
34
|
+
infra premise is "the current setup is X" recalled from memory. Check
|
|
35
|
+
the actual manifests, the actual pipeline config, the actual running
|
|
36
|
+
versions, and cite where you checked. Terraform drift and manual
|
|
37
|
+
console changes make memory especially unreliable here.
|
|
38
|
+
- **Consensus is unchanged**, but the reviewer prompt should emphasize
|
|
39
|
+
checking the rollback and verification sections explicitly.
|
|
40
|
+
|
|
41
|
+
## Lens weights
|
|
42
|
+
|
|
43
|
+
- **Hidden problems (pre-mortem) dominates.** The question is "who reads
|
|
44
|
+
this state that the plan does not know about?" - dependent pipelines,
|
|
45
|
+
environments sharing the module, developers relying on cache behavior,
|
|
46
|
+
jobs relying on timing. Enumerate the dependents by reading what
|
|
47
|
+
actually references the resource, not by recollection.
|
|
48
|
+
- **Safe-to-modify is second.** An infra change landing in untested
|
|
49
|
+
configuration without a verification step is a finding.
|
|
50
|
+
- **Alternatives and pattern/reuse mostly skip.** The pattern question
|
|
51
|
+
was answered above: follow it.
|
|
52
|
+
|
|
53
|
+
## Extra plan sections
|
|
54
|
+
|
|
55
|
+
- **Rollback plan.** Concrete and executable, as above.
|
|
56
|
+
- **Verification step.** What runs in staging or dry-run first, and what
|
|
57
|
+
result counts as safe to proceed.
|
|
58
|
+
- **Sequencing.** Infra changes often must land in an order (create
|
|
59
|
+
before reference, drain before delete). The plan states the order and
|
|
60
|
+
what breaks if it is violated.
|
|
61
|
+
|
|
62
|
+
## Docs bar
|
|
63
|
+
|
|
64
|
+
A one-paragraph change note for the team (what changed, why, how to
|
|
65
|
+
roll back) is the deliverable. Config comments explain constraints the
|
|
66
|
+
next person must not violate.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: thatch-refine-oss-contribution
|
|
3
|
+
description: Type-specific requirements for refining a plan for a contribution to an open source repository the user does not maintain. Loaded by thatch-refine after classification; assumes the core loop in thatch-plan-refinement. The maintainer's design authority and house style govern, and the diff stays minimal.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are refining a plan for an **oss-contribution**: a change to a
|
|
7
|
+
repository the user does not maintain. The governing value is the
|
|
8
|
+
maintainer's design authority. It is their codebase; the contribution
|
|
9
|
+
that gets merged is the one that fits their intent, not the one that
|
|
10
|
+
would be best by your lights. Load `thatch-plan-refinement` for the core
|
|
11
|
+
loop and apply the deltas below; where they disagree, these win.
|
|
12
|
+
|
|
13
|
+
## What this type owes
|
|
14
|
+
|
|
15
|
+
- **Conform to house style, even when it is worse.** A foreign codebase's
|
|
16
|
+
conventions are not up for improvement in this change. Do not import
|
|
17
|
+
patterns from other projects; do not refactor what the maintainer
|
|
18
|
+
wrote.
|
|
19
|
+
- **Minimal diff.** No drive-by refactors, no reformatting of untouched
|
|
20
|
+
lines, no new dependencies, no new abstractions beyond what the change
|
|
21
|
+
strictly needs.
|
|
22
|
+
- **The discussion comes first.** Significant design work waits until the
|
|
23
|
+
approach has a maintainer's nod: check CONTRIBUTING.md, search open
|
|
24
|
+
and closed issues and PRs for the same idea, and file or comment on
|
|
25
|
+
the proposal before investing in the implementation. A plan that
|
|
26
|
+
assumes acceptance is building on an unverified premise.
|
|
27
|
+
|
|
28
|
+
## How this changes the loop
|
|
29
|
+
|
|
30
|
+
- **Add a premise class: upstream status.** Every plan premise about the
|
|
31
|
+
maintainer's intent (is this wanted, is the approach acceptable, is
|
|
32
|
+
the issue still open) needs evidence: an issue thread, a maintainer
|
|
33
|
+
comment, a CONTRIBUTING instruction. No evidence means "unknown -
|
|
34
|
+
ask upstream," and the plan gates on that question, not on a guess.
|
|
35
|
+
- **Consensus adds one test.** Alongside the core skill's consensus
|
|
36
|
+
criteria, the reviewer answers: "would a maintainer accept this
|
|
37
|
+
scope?" Scope findings are blockers. A contribution that solves the
|
|
38
|
+
issue plus three adjacent problems will sit unmerged.
|
|
39
|
+
- **Round cap unchanged.** But a plan blocked on upstream discussion
|
|
40
|
+
pauses for the user to have that conversation; it does not loop.
|
|
41
|
+
|
|
42
|
+
## Lens weights
|
|
43
|
+
|
|
44
|
+
- **Pattern and reuse inverts.** In team code, existing patterns are a
|
|
45
|
+
strong default; here they are the requirement. A "better" pattern than
|
|
46
|
+
the house style is a finding against the plan, not for it.
|
|
47
|
+
- **Hidden problems shrinks.** Consumers of internal state are the
|
|
48
|
+
maintainer's concern. Focus on the change's own footprint and its
|
|
49
|
+
interaction with in-flight upstream work (search open PRs for overlap).
|
|
50
|
+
- **Alternatives mostly skips.** The maintainer chose the architecture.
|
|
51
|
+
The plan's job is fitting into it, and where the plan needs a
|
|
52
|
+
maintainer decision, that is an upstream question, not an alternatives
|
|
53
|
+
survey.
|
|
54
|
+
|
|
55
|
+
## Extra plan sections
|
|
56
|
+
|
|
57
|
+
- **Upstream discussion.** The issue or thread this change responds to,
|
|
58
|
+
and the maintainer signals (or absence of them) the plan relies on.
|
|
59
|
+
- **House-style conformance.** The specific conventions the change will
|
|
60
|
+
follow, read from the project's own CONTRIBUTING and recent merged
|
|
61
|
+
PRs, not assumed.
|
|
62
|
+
|
|
63
|
+
## Docs bar
|
|
64
|
+
|
|
65
|
+
Match the project's own documentation conventions for any user-facing
|
|
66
|
+
text (changelog entries, docs pages) and the house code-comment style.
|
|
67
|
+
The writing skills still govern clarity, but the structure and tone
|
|
68
|
+
follow the project's.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: thatch-refine-personal
|
|
3
|
+
description: Type-specific requirements for refining a plan in a solo personal project with no downstream consumers. Loaded by thatch-refine after classification; assumes the core loop in thatch-plan-refinement. Relaxes coordination requirements and allows cleverness and experimentation, while keeping premise verification honest.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are refining a plan for a **personal** project: solo code with no
|
|
7
|
+
downstream consumers. The coordination constraints that govern team code
|
|
8
|
+
are relaxed. This is the place to show off cleverness and experiment with
|
|
9
|
+
interesting techniques that would be inconsiderate in a shared codebase.
|
|
10
|
+
Load `thatch-plan-refinement` for the core loop and apply the deltas
|
|
11
|
+
below; where they disagree, these win.
|
|
12
|
+
|
|
13
|
+
## What this type owes
|
|
14
|
+
|
|
15
|
+
- **Almost nothing to anyone else.** No consistency obligation to
|
|
16
|
+
teammates, no reviewer to orient, no downstream API to protect.
|
|
17
|
+
- **Still honest about facts.** Relaxed style does not mean relaxed
|
|
18
|
+
reality: every factual premise still carries a verified `file:line`
|
|
19
|
+
citation, and "unverified" is still marked. A plan built on a wrong
|
|
20
|
+
premise wastes your time in any project.
|
|
21
|
+
|
|
22
|
+
## How this changes the loop
|
|
23
|
+
|
|
24
|
+
- **The skip threshold drops.** Most personal-project plans can be tried
|
|
25
|
+
faster than they can be refined. Skip refinement whenever the change is
|
|
26
|
+
cheap to build and cheaper to rewrite; run the loop only when the plan
|
|
27
|
+
touches something expensive to get wrong (persistent state, a
|
|
28
|
+
hard-to-reverse migration, hours of build effort).
|
|
29
|
+
- **Fewer rounds.** One quiet review round is enough consensus. The cap
|
|
30
|
+
drops from three rounds to two; a personal plan that has not converged
|
|
31
|
+
by then should just be built or abandoned.
|
|
32
|
+
- **Degraded review is fine.** If the host cannot dispatch sub-agents, a
|
|
33
|
+
same-context self-review pass is usually enough. Saying so out loud, as
|
|
34
|
+
the core skill requires, is still worthwhile but the stakes are lower.
|
|
35
|
+
|
|
36
|
+
## Lens weights
|
|
37
|
+
|
|
38
|
+
- **Premise verification is the only load-bearing lens.** The fresh
|
|
39
|
+
reviewer's core job is checking the plan's factual model of the code.
|
|
40
|
+
- **Pattern and reuse mostly skips.** There is no team to stay consistent
|
|
41
|
+
with. Flag reuse only when reinventing an existing wheel will genuinely
|
|
42
|
+
bite future-you.
|
|
43
|
+
- **Alternatives turns exploratory.** The question shifts from "what is
|
|
44
|
+
safest?" to "what would I learn?" - one alternative worth trying for
|
|
45
|
+
the technique is a valid result even when the plan's choice is fine.
|
|
46
|
+
- **Hidden problems shrinks to future-self.** The only consumer to
|
|
47
|
+
enumerate is you, six months from now, with no memory of this code.
|
|
48
|
+
|
|
49
|
+
## Extra plan sections
|
|
50
|
+
|
|
51
|
+
None required. Blast radius, migration plans, and reviewer orientation
|
|
52
|
+
sections are skipped unless the change is in the expensive-to-get-wrong
|
|
53
|
+
category that triggered refinement at all.
|
|
54
|
+
|
|
55
|
+
## Docs bar
|
|
56
|
+
|
|
57
|
+
- Future-self breadcrumbs only: comment the surprising spots, not the
|
|
58
|
+
obvious ones.
|
|
59
|
+
- When a plan deliberately uses an experimental technique, record that in
|
|
60
|
+
one line (in the plan or a comment) so a future session knows the
|
|
61
|
+
oddity was chosen, not accidental.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: thatch-refine-shared-lib
|
|
3
|
+
description: Type-specific requirements for refining a plan that touches a library's API surface, in any repo, including personal ones. Loaded by thatch-refine after classification; assumes the core loop in thatch-plan-refinement. Use whenever exported API, published packages, or downstream consumers are involved; API hygiene governs even solo projects.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are refining a plan for a **shared-lib** change: work that touches an
|
|
7
|
+
API other code consumes and keeps working against. This applies to any
|
|
8
|
+
library with external callers, including a personal one. The governing
|
|
9
|
+
value is API hygiene: you are writing for consumers you cannot see and
|
|
10
|
+
cannot call back. Load `thatch-plan-refinement` for the core loop and
|
|
11
|
+
apply the deltas below; where they disagree, these win.
|
|
12
|
+
|
|
13
|
+
## What this type owes
|
|
14
|
+
|
|
15
|
+
- **Flexible on input, strict on output.** Accept broad input types and
|
|
16
|
+
normalize them; return precise, well-defined types and never leak
|
|
17
|
+
internal representations. Callers write code against your output
|
|
18
|
+
shapes; widen what you accept, pin down what you emit.
|
|
19
|
+
- **Keep special cases out of the API.** No caller-specific knobs, no
|
|
20
|
+
one-off escape hatches, no parameters that exist for exactly one
|
|
21
|
+
consumer. A special case is a design smell: handle it inside the
|
|
22
|
+
implementation or reject it at the boundary.
|
|
23
|
+
- **Do not foreclose caller options.** Prefer returning data over making
|
|
24
|
+
decisions callers might want to make differently. Every shortcut the
|
|
25
|
+
library takes on the caller's behalf is a wall they hit later.
|
|
26
|
+
- **Keep the surface small.** Every export is a permanent maintenance
|
|
27
|
+
promise. The best API change is often the one that exports nothing new.
|
|
28
|
+
|
|
29
|
+
## How this changes the loop
|
|
30
|
+
|
|
31
|
+
- **Deep mode is the default** for anything that adds, changes, or
|
|
32
|
+
removes an export. The abstraction gets locked in at ship time; after
|
|
33
|
+
release, changing it costs every consumer. This is the last cheap
|
|
34
|
+
moment to get the shape right.
|
|
35
|
+
- **Alternatives works harder here.** "No better alternative found" must
|
|
36
|
+
be argued harder than the core skill's paragraph: enumerate the
|
|
37
|
+
plausible alternative shapes and say why the plan's shape wins for
|
|
38
|
+
callers, not just for the implementation.
|
|
39
|
+
- **Backward compatibility findings are blockers by default.** A breaking
|
|
40
|
+
change without a deprecation path is a blocker, not a should-fix.
|
|
41
|
+
|
|
42
|
+
## Lens weights
|
|
43
|
+
|
|
44
|
+
- **Hidden problems reframes entirely.** Every consumer is a stranger;
|
|
45
|
+
you cannot grep your callers. Enumerate the contract the plan changes
|
|
46
|
+
and reason about the population of consumers you cannot see, including
|
|
47
|
+
the ones using the API in ways you never intended.
|
|
48
|
+
- **Pattern and reuse applies to your own API first.** Consistency with
|
|
49
|
+
the library's existing API conventions is its own requirement: a
|
|
50
|
+
second method that disagrees with the first in naming or shape is a
|
|
51
|
+
finding even when both are internally fine.
|
|
52
|
+
|
|
53
|
+
## Extra plan sections
|
|
54
|
+
|
|
55
|
+
- **API surface diff.** Exactly what is exported, added, changed, or
|
|
56
|
+
removed, in a list a reviewer can check one line at a time.
|
|
57
|
+
- **Semver impact and deprecation path.** The version bump this deserves,
|
|
58
|
+
what is deprecated, and how callers migrate.
|
|
59
|
+
- **External documentation.** The docs and examples this change requires,
|
|
60
|
+
written for the reader: what the behavior is, when to use it, what it
|
|
61
|
+
does not do. "I'll document it later" is a finding.
|
|
62
|
+
- **Caller migration notes.** For breaking or behavior-changing exports,
|
|
63
|
+
the note that goes in the changelog.
|
|
64
|
+
|
|
65
|
+
## Docs bar
|
|
66
|
+
|
|
67
|
+
Reader-facing documentation is a plan deliverable, not a follow-up. Draft
|
|
68
|
+
it under the writing skills' contracts: define terms on first use,
|
|
69
|
+
behavior stated precisely enough that a caller needs no source dive.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: thatch-refine-spike
|
|
3
|
+
description: Type-specific requirements for refining a plan for a throwaway prototype or time-boxed spike. Loaded by thatch-refine after classification; assumes the core loop in thatch-plan-refinement. Skips almost all of the loop, verifying only the premises the experiment's conclusion depends on.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are refining a plan for a **spike**: throwaway code whose purpose is
|
|
7
|
+
answering a question, not producing a maintained artifact. Almost all of
|
|
8
|
+
the refinement loop is waste here. Load `thatch-plan-refinement` for the
|
|
9
|
+
core loop, then apply the deltas below; where they disagree, these win.
|
|
10
|
+
|
|
11
|
+
## What this type owes
|
|
12
|
+
|
|
13
|
+
- **A stated question.** The plan opens with the question the spike
|
|
14
|
+
exists to answer, stated concretely enough that "done" is checkable
|
|
15
|
+
("can Postgres full-text search handle our query volume?" not "explore
|
|
16
|
+
search options").
|
|
17
|
+
- **A promotion test.** The plan states what would make this code worth
|
|
18
|
+
promoting into the real codebase versus rewriting it properly. Most
|
|
19
|
+
spikes end in a rewrite, and that is a success, not a failure.
|
|
20
|
+
- **A time box.** The plan names its budget: hours or days, not open-
|
|
21
|
+
ended effort.
|
|
22
|
+
|
|
23
|
+
## How this changes the loop
|
|
24
|
+
|
|
25
|
+
- **Skip the loop by default.** No reviewer dispatch, no rounds, no
|
|
26
|
+
consensus machinery. One focused self-review pass is the whole
|
|
27
|
+
refinement: check the plan's few load-bearing premises, then build.
|
|
28
|
+
- **Verify only conclusion-bearing premises.** The spike's conclusion is
|
|
29
|
+
only as good as the premises it depends on. If the experiment claims
|
|
30
|
+
"this approach is too slow," the benchmark setup and the
|
|
31
|
+
representativeness of the test data are the premises that matter, and
|
|
32
|
+
they get the verified-citation treatment. Everything else is
|
|
33
|
+
throwaway.
|
|
34
|
+
- **Degraded review needs no apology.** The core skill's honest-degradation
|
|
35
|
+
notice is unnecessary; there is no real review to degrade.
|
|
36
|
+
|
|
37
|
+
## Lens weights
|
|
38
|
+
|
|
39
|
+
All specialist lenses skip except one consideration: **is the spike
|
|
40
|
+
actually throwaway?** If the plan quietly assumes the prototype code will
|
|
41
|
+
survive into production, stop and surface that. A spike that is really a
|
|
42
|
+
production change wearing a costume should be refined under the type it
|
|
43
|
+
actually is.
|
|
44
|
+
|
|
45
|
+
## Extra plan sections
|
|
46
|
+
|
|
47
|
+
- The question, the promotion test, and the time box above. Nothing else.
|
|
48
|
+
|
|
49
|
+
## Docs bar
|
|
50
|
+
|
|
51
|
+
No breadcrumb obligation. One comment or note recording the question and
|
|
52
|
+
the answer is enough. The spike's real output is the answer, and it
|
|
53
|
+
should be written down where the user will find it.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: thatch-refine-team-app
|
|
3
|
+
description: Type-specific requirements for refining a plan in a multi-developer team codebase (production app or service shared by a team). Loaded by thatch-refine after classification; assumes the core loop in thatch-plan-refinement. Use when coordination cost, consistency, and reviewer comprehension are the governing constraints.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are refining a plan for a **team-app** project: production code in a
|
|
7
|
+
repository where multiple developers ship, review, and maintain each
|
|
8
|
+
other's work. The governing value is org velocity through coordination and
|
|
9
|
+
consistency. Code is read far more often than it is written, and most of
|
|
10
|
+
its readers did not write it. Load `thatch-plan-refinement` for the core
|
|
11
|
+
loop and apply the deltas below; where they disagree, these win.
|
|
12
|
+
|
|
13
|
+
## What this type owes
|
|
14
|
+
|
|
15
|
+
- **Consistency outranks local optimality.** Following the codebase's
|
|
16
|
+
existing pattern beats a "better" one that splits the codebase in two.
|
|
17
|
+
A novel approach must justify the divergence it imposes on every future
|
|
18
|
+
reader, not just prove it is cleverer.
|
|
19
|
+
- **Implement for the junior reviewer.** The bar is that a developer with
|
|
20
|
+
no history in this area can review the change and debug it at 2am.
|
|
21
|
+
Cleverness is allowed only with a justification comment at the point of
|
|
22
|
+
cleverness, and only when the payoff is real.
|
|
23
|
+
- **Intent is a deliverable.** Docstrings and comments are the breadcrumb
|
|
24
|
+
trail for the next maintainer. The plan says which comments and
|
|
25
|
+
docstrings it will write, and *why* is documented, not just *what*.
|
|
26
|
+
|
|
27
|
+
## How this changes the loop
|
|
28
|
+
|
|
29
|
+
- **Mode triage stays strict.** The skip threshold does not relax for
|
|
30
|
+
team code: anything another developer must review earns at least quick
|
|
31
|
+
mode. Established-pattern changes with no design decisions can still
|
|
32
|
+
skip, as the core skill already provides.
|
|
33
|
+
- **Deep mode triggers broaden.** Beyond the core skill's triggers, deep
|
|
34
|
+
mode is warranted when the change alters a contract other teams build
|
|
35
|
+
on, or lands in an area with a history of review churn.
|
|
36
|
+
- **Consensus is unchanged.** Same rounds, same cap, same escalation to
|
|
37
|
+
the user.
|
|
38
|
+
|
|
39
|
+
## Lens weights
|
|
40
|
+
|
|
41
|
+
- **Hidden problems (pre-mortem) carries the most signal.** In team code
|
|
42
|
+
the plan's biggest risk is an unenumerated consumer or an implicit
|
|
43
|
+
contract another team relies on.
|
|
44
|
+
- **Safe-to-modify is second.** A plan that lands in an untested,
|
|
45
|
+
tangled section without a refactor-first dependency is a finding.
|
|
46
|
+
- **Pattern and reuse tightens.** "Reuse the existing pattern" is the
|
|
47
|
+
default verdict, not one option among several. A plan that introduces a
|
|
48
|
+
parallel way to do something the codebase already does needs a strong,
|
|
49
|
+
evidenced reason.
|
|
50
|
+
- **Alternatives stays a filter.** Two alternatives, one paragraph each,
|
|
51
|
+
as the core skill says; the judgment criterion is team cost, not
|
|
52
|
+
personal preference.
|
|
53
|
+
|
|
54
|
+
## Extra plan sections
|
|
55
|
+
|
|
56
|
+
- **Blast radius and consumers.** Who reads the state, tables, config, and
|
|
57
|
+
symbols this change touches, including other teams and services.
|
|
58
|
+
- **Migration and rollback.** How the change ships safely and how it
|
|
59
|
+
backs out.
|
|
60
|
+
- **Intent breadcrumbs.** The docstrings and comments the implementation
|
|
61
|
+
will write, and what future-reader question each answers.
|
|
62
|
+
- **Reviewer orientation.** One paragraph a reviewer can read first: what
|
|
63
|
+
changed, why, and where to look.
|
|
64
|
+
|
|
65
|
+
## Docs bar
|
|
66
|
+
|
|
67
|
+
Comments and docstrings are part of the definition of done, and any
|
|
68
|
+
reader-facing text produced along the way (PR description, ticket,
|
|
69
|
+
changelog entry) is drafted under the writing skills' contracts.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: thatch-refine
|
|
3
|
+
description: Classify the current project (audience, lifecycle, surface) and refine a plan under that type's requirements. Entry point for the thatch-refine-* family. Use when the user asks to refine a plan, runs /thatch/refine, or when a plan is about to be implemented and the project type should shape the refinement bar. For a bare "refine this plan" request, load this skill rather than thatch-plan-refinement directly - the router picks the type and applies its delta on top of the core loop.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are the entry point for project-type-aware plan refinement. The core
|
|
7
|
+
refinement loop (draft, fresh-context reviewer, revise, consensus) is the
|
|
8
|
+
same everywhere; it lives in `thatch-plan-refinement`. What changes by
|
|
9
|
+
project type is the bar: which lenses matter, what the plan must contain,
|
|
10
|
+
how much documentation is owed, and when skipping refinement is honest.
|
|
11
|
+
|
|
12
|
+
## The types
|
|
13
|
+
|
|
14
|
+
| Type | Governing value | Skill |
|
|
15
|
+
|------|-----------------|-------|
|
|
16
|
+
| `team-app` | Coordination and consistency promote org velocity | `thatch-refine-team-app` |
|
|
17
|
+
| `personal` | Freedom to experiment; low coordination cost | `thatch-refine-personal` |
|
|
18
|
+
| `shared-lib` | API hygiene; never foreclose caller options | `thatch-refine-shared-lib` |
|
|
19
|
+
| `spike` | Answering a question cheaply, not producing code | `thatch-refine-spike` |
|
|
20
|
+
| `infra` | Blast radius across pipelines and environments | `thatch-refine-infra` |
|
|
21
|
+
| `oss-contribution` | The maintainer's design authority | `thatch-refine-oss-contribution` |
|
|
22
|
+
|
|
23
|
+
## Classification
|
|
24
|
+
|
|
25
|
+
Classify on three axes, then pick the type whose requirements this plan
|
|
26
|
+
must satisfy. Classify **the change**, not just the repo: a personal repo
|
|
27
|
+
gaining a published API is a `shared-lib` plan for that change, even if the
|
|
28
|
+
repo is `personal` overall.
|
|
29
|
+
|
|
30
|
+
**Audience** - who reads and maintains this code.
|
|
31
|
+
|
|
32
|
+
- Solo: one contributor in git history, no CODEOWNERS, no required reviews.
|
|
33
|
+
- Team: CODEOWNERS, CONTRIBUTING.md, required PR review, multiple regular
|
|
34
|
+
authors.
|
|
35
|
+
- Public: published package (npm/PyPI/etc. metadata, `publishConfig`), or
|
|
36
|
+
consumers outside the repo you cannot enumerate.
|
|
37
|
+
|
|
38
|
+
**Lifecycle** - what this code owes anyone.
|
|
39
|
+
|
|
40
|
+
- Production: protected main, CI gates, deploy configuration, semver
|
|
41
|
+
discipline.
|
|
42
|
+
- Experimental: active WIP, churny main, thin or absent tests.
|
|
43
|
+
- Throwaway: a question wearing a repository.
|
|
44
|
+
|
|
45
|
+
**Surface** - what the change lives in.
|
|
46
|
+
|
|
47
|
+
- Application: end-user or service code with no downstream importers.
|
|
48
|
+
- Library: exported API that other code imports and keeps working against.
|
|
49
|
+
- Infrastructure: CI, Terraform, k8s manifests, build and deploy config.
|
|
50
|
+
|
|
51
|
+
Signals to gather (all cheap and read-only): `git log --format="%an" |
|
|
52
|
+
sort -u | head`, presence of CODEOWNERS / CONTRIBUTING.md / required
|
|
53
|
+
review config, package.json `private` and `publishConfig` fields, the
|
|
54
|
+
publishing config of the relevant ecosystem, presence of `.github/workflows`,
|
|
55
|
+
`terraform/` or k8s manifests, and what the package exports. Do not
|
|
56
|
+
over-invest here; the classification should cost a minute, not a research
|
|
57
|
+
pass.
|
|
58
|
+
|
|
59
|
+
## Procedure
|
|
60
|
+
|
|
61
|
+
1. If the user named a type explicitly (for example `/thatch/refine
|
|
62
|
+
shared-lib`), skip classification and use it.
|
|
63
|
+
2. Otherwise gather the signals above and pick the type.
|
|
64
|
+
3. State the classification in one line and why, and let the user override.
|
|
65
|
+
A wrong classification silently changes the requirements, so the user
|
|
66
|
+
sees the pick before it takes effect. When the signals conflict or are
|
|
67
|
+
too thin to pick, ask instead of guessing.
|
|
68
|
+
4. Load `thatch-plan-refinement` (the core loop) and the type's skill.
|
|
69
|
+
5. Run the core loop with the type skill's deltas applied. Where a delta
|
|
70
|
+
and the core skill disagree, the delta wins; that is its whole job.
|
|
71
|
+
|
|
72
|
+
If no type fits (the repo serves a niche the table misses), run plain
|
|
73
|
+
`thatch-plan-refinement` and say that the requirements are the generic
|
|
74
|
+
ones.
|
|
75
|
+
|
|
76
|
+
## Relationship to other skills
|
|
77
|
+
|
|
78
|
+
- **`thatch-plan-refinement`** - the core loop. Always loaded; the type
|
|
79
|
+
skills only modify it.
|
|
80
|
+
- **`thatch-coding-workflow`** - the procedure skill for executing the
|
|
81
|
+
refined plan. Refinement ends where it begins.
|
|
82
|
+
- **`thatch-clear-writing`** and the writing skills - several type skills
|
|
83
|
+
make reader-facing documentation a plan deliverable. Draft that text
|
|
84
|
+
under the writing skills' contracts, not this one's.
|
package/docs/dev/gotchas.md
CHANGED
|
@@ -286,3 +286,16 @@ instead of throwing "Cannot use a closed database". Two rules keep this intact:
|
|
|
286
286
|
wrap-up arming write, whose command executes are not drained by the v2
|
|
287
287
|
cleanup). Do not "fix" the guard away by moving it into db.ts: the
|
|
288
288
|
accessor cannot tell a legitimate in-flight caller from a stale writer.
|
|
289
|
+
|
|
290
|
+
## Command frontmatter descriptions must be quoted YAML scalars
|
|
291
|
+
|
|
292
|
+
- **A plain-scalar frontmatter value containing a colon followed by a space
|
|
293
|
+
is invalid YAML, and not every host path rescues it.** `/thatch/hygiene`'s
|
|
294
|
+
description ("Tend the memory store: stale entries, ...") shipped unquoted;
|
|
295
|
+
the first parse throws
|
|
296
|
+
and only opencode's fallback sanitizer recovers it — and a long-lived
|
|
297
|
+
server was observed dropping the description entirely while a fresh server
|
|
298
|
+
parsed it fine, which made the bug look like a TUI rendering issue. The
|
|
299
|
+
renderer quotes every description (`yamlQuote` in src/commands.ts) and a
|
|
300
|
+
unit test pins the quoted form. Keep it that way for any new frontmatter
|
|
301
|
+
field whose value is free-form prose.
|
package/docs/dev/mcp-parity.md
CHANGED
|
@@ -23,7 +23,7 @@ This document maps the feature parity and documents the remaining gaps.
|
|
|
23
23
|
| **Session-start reminder** (recall nudge + hygiene heartbeat) | `session.created` event → `client.session.prompt` injects a synthetic message | `SessionStart` hook → `thatch reminder`; stdout becomes context | `sessionStart` hook → `thatch reminder --json`; output is `additional_context` JSON | **Full** |
|
|
24
24
|
| **Compaction context** (re-familiarize after compaction) | `experimental.session.compacting` hook appends context to the compaction output | `PostCompact` hook — side-effects only, **cannot inject context** | No equivalent hook | **Gapped** — see below |
|
|
25
25
|
| **Wrap-up commands** (`/thatch/compact`, `/thatch/exit`) | Command markdown synced to `$XDG_CONFIG_HOME/opencode/command/thatch/` at plugin init; `command.execute.before` arms the session and the next idle resolves the greenlight token into a TUI action (`session.compact` via `executeCommand`, `app.exit` via `publish`) | No equivalent — no plugin host to arm the check or trigger the action | No equivalent | **Gapped** — needs the plugin's SDK client and TUI control routes |
|
|
26
|
-
| **On-demand actions** (`/thatch/defrag`, `extract`, `hygiene`, `reflect`) | Command markdown synced at plugin init; bodies rendered from the shared prompt cores with `thatch_` tool spellings; `extract` is opencode-only (needs session identity via `get_session_info` and the plugin's payload provider) | Command markdown synced by `thatch setup --claude` into `<claudeDir>/commands/thatch/`; same cores with `mcp__thatch__` spellings; `extract` excluded | MCP Prompts (`prompts/list` + `prompts/get`) from the same cores; Cursor surfaces them as slash commands; `extract` excluded | **Full** for the shared actions (same cores, per-host tool spellings); `extract` opencode-only |
|
|
26
|
+
| **On-demand actions** (`/thatch/defrag`, `extract`, `hygiene`, `reflect`, `refine`) | Command markdown synced at plugin init; bodies rendered from the shared prompt cores with `thatch_` tool spellings; `extract` is opencode-only (needs session identity via `get_session_info` and the plugin's payload provider) | Command markdown synced by `thatch setup --claude` into `<claudeDir>/commands/thatch/`; same cores with `mcp__thatch__` spellings; `extract` excluded | MCP Prompts (`prompts/list` + `prompts/get`) from the same cores; Cursor surfaces them as slash commands; `extract` excluded | **Full** for the shared actions (same cores, per-host tool spellings); `extract` opencode-only |
|
|
27
27
|
| **Extraction** (buffer tool calls, extract durable facts) | `tool.execute.after` buffers non-meta tool calls in-process (`isMetaToolName` in `src/extraction.ts`: thatch_*, skill, task, agent, subagent — execute calls unwrapping only thatch tools are also excluded); **direct extraction** is the primary path — when the parent session goes idle with pending buffer entries, the plugin creates a child session via the SDK (`client.session.create` with `parentID`) and prompts it to call `get_extraction_payload` (nudge suppressed via the `extracting` set); the `chat.message` nudge path is a **fallback** used when direct extraction throws | `PostToolBatch` → `thatch buffer-batch` (file-backed JSONL queue); `UserPromptSubmit` → `thatch flush-tools` peeks the queue and prints the nudge with session ID + fetch tool name (does not drain — the queue persists until a memory write or `extraction_done`) | `postToolUse` → `thatch buffer-tool` (single-tool, file-backed queue); `beforeSubmitPrompt` → `thatch flush-tools --json` | **Partial** — opencode uses direct extraction (parent idle → child session) as the primary path, with the nudge as fallback; MCP hosts are nudge-only. Both paths use `get_extraction_payload` to fetch the queued interactions as a tool response, keeping the full payload out of the main session's context window. Nudge timing differs: the nudge arrives at the **start** of the next turn in Claude Code/Cursor; opencode's direct extraction fires at **end of turn** (session idle), and the nudge fallback fires at the start of the next turn like MCP |
|
|
28
28
|
| **Extraction feedback** (toast notifications) | `client.tui.showToast` fires when the extraction child goes idle — shows `[thatch] new: N, updated: M, deleted: K` (success) or `extraction complete — nothing to save` (info); best-effort, silently ignored in headless mode | No TUI connection — MCP hosts have no equivalent | No TUI connection | **Gapped** — MCP hosts cannot show toast notifications |
|
|
29
29
|
| **Automatic alerts** (notify on LLM pause / turn end) | Plugin event hook drives the `alerts.ts` state machine: `question.asked`/`permission.asked` → pause alert; `session.status` idle with a real-work round → done alert; unrecovered errors → needs-attention. Delivered via the shared `notify.ts` dispatcher, channel per event from the `alerts` config section | No event stream — only `thatch_notify_user` when the agent chooses | No event stream — only `thatch_notify_user` when the agent chooses | **Gapped** — MCP hosts have no plugin event hook to watch; Claude Code's `Notification`/`Stop` hooks could feed the same classifier later |
|
package/docs/dev/skills.md
CHANGED
|
@@ -55,7 +55,14 @@ description: Extract durable project facts ... Use when ...
|
|
|
55
55
|
| `thatch-code-walkthrough` | Explain a feature, module, or workflow to the user as a teaching walkthrough: identify the code area (optionally from a branch or PR), research how it works, teach it with file:line citations and analogies, list the key files. |
|
|
56
56
|
| `thatch-session-reflection` | End-of-session memory recording (project, user, tools, self). |
|
|
57
57
|
| `thatch-coding-workflow` | Plan and execute code changes with a task-list-driven workflow. Use when implementing features, fixing bugs, or making multi-file changes. |
|
|
58
|
-
| `thatch-plan-refinement` | Refine a plan before implementing it: fresh-context reviewer rounds until consensus, with an optional deep-mode lens fan-out (reuse, alternatives, hidden problems, safe-to-modify, archaeology). |
|
|
58
|
+
| `thatch-plan-refinement` | Refine a plan before implementing it: fresh-context reviewer rounds until consensus, with an optional deep-mode lens fan-out (reuse, alternatives, hidden problems, safe-to-modify, archaeology). The generic core loop. |
|
|
59
|
+
| `thatch-refine` | Classify the project (audience, lifecycle, surface) and refine a plan under that type's requirements. Entry point for the `thatch-refine-*` family; also the `/thatch/refine` command. |
|
|
60
|
+
| `thatch-refine-team-app` | Refinement deltas for multi-developer team codebases: consistency outranks cleverness, intent breadcrumbs are deliverables, pre-mortem and safe-to-modify lenses dominate. |
|
|
61
|
+
| `thatch-refine-personal` | Refinement deltas for solo projects with no downstream consumers: relaxed coordination, cleverness and experimentation welcome, premise verification stays honest. |
|
|
62
|
+
| `thatch-refine-shared-lib` | Refinement deltas for changes touching a library's API surface: flexible on input, strict on output, keep special cases out of the API, never foreclose caller options, docs are a deliverable. |
|
|
63
|
+
| `thatch-refine-spike` | Refinement deltas for throwaway prototypes: skip the loop, verify only the premises the experiment's conclusion depends on, state the question and the time box. |
|
|
64
|
+
| `thatch-refine-infra` | Refinement deltas for CI, Terraform, and k8s changes: blast radius across pipelines and environments, rollback plan and staged verification are mandatory, pattern-following is near-absolute. |
|
|
65
|
+
| `thatch-refine-oss-contribution` | Refinement deltas for PRs to repos you do not maintain: the maintainer's design authority governs, minimal diff, upstream discussion gates significant design work. |
|
|
59
66
|
| `thatch-pr-description` | Draft PR descriptions with SYNOPSIS / PURPOSE / DESCRIPTION / WALK-THROUGH / NOTES, project-context research, clarity checks, and bold+italic emphasis for scanning. |
|
|
60
67
|
| `thatch-ticket-description` | Draft ticket/issue descriptions with clear sections, project-context research, clarity checks, and bold+italic emphasis for scanning. |
|
|
61
68
|
| `thatch-split-overlarge-pr` | Split already-completed work from an overlarge PR into human-reviewable, release-safe PRs targeting main. |
|
package/docs/user/README.md
CHANGED
|
@@ -328,6 +328,13 @@ response, walkthrough, and workflow skills that support the review pipeline:
|
|
|
328
328
|
| `thatch-code-walkthrough` | Explains a feature, module, or workflow to the user as a teaching walkthrough with file:line citations. Also used to draft high-level docs for new or undocumented features. |
|
|
329
329
|
| `thatch-coding-workflow` | Plans and executes code changes with a task-list-driven workflow: complexity triage, milestone planning, research before coding, post-coding verification. Pairs with `thatch-code-archaeology` (research first, then plan). |
|
|
330
330
|
| `thatch-plan-refinement` | Refines a plan before it is implemented: a fresh-context reviewer subagent re-checks the plan each round until consensus; deep mode adds specialist lenses (reuse, alternatives, hidden problems, safe-to-modify, intent archaeology). |
|
|
331
|
+
| `thatch-refine` | Classifies the project (audience, lifecycle, surface) and refines a plan under that type's requirements. The entry point for the `thatch-refine-*` family; also the `/thatch/refine` command. |
|
|
332
|
+
| `thatch-refine-team-app` | Team codebases: consistency outranks cleverness, intent breadcrumbs are deliverables, pre-mortem and safe-to-modify lenses dominate. |
|
|
333
|
+
| `thatch-refine-personal` | Solo projects: relaxed coordination, cleverness and experimentation welcome, premise verification stays honest. |
|
|
334
|
+
| `thatch-refine-shared-lib` | Library API surfaces: flexible on input, strict on output, keep special cases out of the API, never foreclose caller options, docs are a deliverable. |
|
|
335
|
+
| `thatch-refine-spike` | Throwaway prototypes: skip the loop, verify only the premises the experiment's conclusion depends on. |
|
|
336
|
+
| `thatch-refine-infra` | CI, Terraform, and k8s changes: blast radius, mandatory rollback plan and staged verification, pattern-following is near-absolute. |
|
|
337
|
+
| `thatch-refine-oss-contribution` | PRs to repos you do not maintain: the maintainer's design authority governs, minimal diff, upstream discussion gates significant design work. |
|
|
331
338
|
|
|
332
339
|
### Writing skills
|
|
333
340
|
|
package/docs/user/commands.md
CHANGED
|
@@ -17,6 +17,13 @@ or you invoke it.
|
|
|
17
17
|
The agent asks before forgetting anything that may still matter.
|
|
18
18
|
- `/thatch/reflect` — run the session-reflection skill to persist what the
|
|
19
19
|
current session learned.
|
|
20
|
+
- `/thatch/refine` — refine a plan for a code change under the current
|
|
21
|
+
project type's requirements: the agent classifies the project (team,
|
|
22
|
+
personal, shared library, spike, infrastructure, or open source
|
|
23
|
+
contribution), confirms the pick, and runs the refinement loop with
|
|
24
|
+
that type's expectations applied. Text after the command can name the
|
|
25
|
+
type directly (for example, `/thatch/refine shared-lib`) to skip
|
|
26
|
+
classification.
|
|
20
27
|
- `/thatch/compact` and `/thatch/exit` — the wrap-up commands. They run a
|
|
21
28
|
pre-flight checklist (flush extraction, finish promised memory writes,
|
|
22
29
|
surface loose ends) before a compaction or an exit, gated by a greenlight
|
|
@@ -31,6 +38,7 @@ or you invoke it.
|
|
|
31
38
|
| `/thatch/extract` | yes | no | no |
|
|
32
39
|
| `/thatch/hygiene` | yes | yes | yes (as an MCP prompt) |
|
|
33
40
|
| `/thatch/reflect` | yes | yes | yes (as an MCP prompt) |
|
|
41
|
+
| `/thatch/refine` | yes | yes | yes (as an MCP prompt) |
|
|
34
42
|
| `/thatch/compact`, `/thatch/exit` | yes | no | no |
|
|
35
43
|
|
|
36
44
|
Why the gaps: `/thatch/extract` needs the invoking session's ID, which only
|
package/docs/user/skills.md
CHANGED
|
@@ -77,6 +77,18 @@ Skills are split into shared (all hosts) and opencode-only:
|
|
|
77
77
|
| `thatch-coding-workflow` | Plans and executes code changes with a task-list-driven workflow: complexity triage, milestone planning, research before coding, post-coding verification. Pairs with `thatch-code-archaeology` (research first, then plan). |
|
|
78
78
|
| `thatch-plan-refinement` | Refines a plan before it is implemented: a fresh-context reviewer subagent re-checks the plan each round until consensus; deep mode adds specialist lenses (reuse, alternatives, hidden problems, safe-to-modify, intent archaeology). |
|
|
79
79
|
|
|
80
|
+
### Plan refinement skills
|
|
81
|
+
|
|
82
|
+
| Skill | Purpose |
|
|
83
|
+
|-------|---------|
|
|
84
|
+
| `thatch-refine` | Classifies the project (audience, lifecycle, surface) and refines a plan under that type's requirements. The entry point for the `thatch-refine-*` family; also the `/thatch/refine` command. |
|
|
85
|
+
| `thatch-refine-team-app` | Team codebases: consistency outranks cleverness, intent breadcrumbs are deliverables, pre-mortem and safe-to-modify lenses dominate. |
|
|
86
|
+
| `thatch-refine-personal` | Solo projects: relaxed coordination, cleverness and experimentation welcome, premise verification stays honest. |
|
|
87
|
+
| `thatch-refine-shared-lib` | Library API surfaces: flexible on input, strict on output, keep special cases out of the API, never foreclose caller options, docs are a deliverable. |
|
|
88
|
+
| `thatch-refine-spike` | Throwaway prototypes: skip the loop, verify only the premises the experiment's conclusion depends on. |
|
|
89
|
+
| `thatch-refine-infra` | CI, Terraform, and k8s changes: blast radius, mandatory rollback plan and staged verification, pattern-following is near-absolute. |
|
|
90
|
+
| `thatch-refine-oss-contribution` | PRs to repos you do not maintain: the maintainer's design authority governs, minimal diff, upstream discussion gates significant design work. |
|
|
91
|
+
|
|
80
92
|
## Stale skill cleanup
|
|
81
93
|
|
|
82
94
|
When skills are renamed or removed in a new release, thatch automatically
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeffober/thatch",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
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/commands.ts
CHANGED
|
@@ -100,6 +100,16 @@ After dispatching, call thatch_extraction_done to acknowledge.`,
|
|
|
100
100
|
description: "Tend the memory store: stale entries, orphans, pending dedup pairs",
|
|
101
101
|
body: hygieneCore(),
|
|
102
102
|
},
|
|
103
|
+
{
|
|
104
|
+
name: "refine",
|
|
105
|
+
description: "Refine a plan under the project type's requirements (classifies the project first)",
|
|
106
|
+
// A skill trigger, not a nudge behavior: the body points at the
|
|
107
|
+
// thatch-refine router skill, which classifies the project and loads
|
|
108
|
+
// the matching type deltas on top of the plan-refinement core loop.
|
|
109
|
+
body: `Load and follow the thatch-refine skill to refine a plan for the current project.
|
|
110
|
+
|
|
111
|
+
The user message may name a project type (team-app, personal, shared-lib, spike, infra, oss-contribution); if it does, skip classification and use that type. If no plan is drafted yet in this session, the skill's loop starts with drafting one.`,
|
|
112
|
+
},
|
|
103
113
|
{
|
|
104
114
|
name: "reflect",
|
|
105
115
|
description: "Persist what this session learned as memories",
|
|
@@ -108,10 +118,20 @@ After dispatching, call thatch_extraction_done to acknowledge.`,
|
|
|
108
118
|
];
|
|
109
119
|
}
|
|
110
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Renders a YAML double-quoted scalar. Plain scalars break on values
|
|
123
|
+
* containing ": " (invalid YAML - the mapping key would be ambiguous), and
|
|
124
|
+
* opencode's lenient fallback parser does not rescue every host path, so the
|
|
125
|
+
* description must always be quoted.
|
|
126
|
+
*/
|
|
127
|
+
function yamlQuote(value: string): string {
|
|
128
|
+
return JSON.stringify(value);
|
|
129
|
+
}
|
|
130
|
+
|
|
111
131
|
/** Renders one action as a full command markdown file. */
|
|
112
132
|
export function renderActionCommand(action: ActionDef): string {
|
|
113
133
|
return `---
|
|
114
|
-
description: ${action.description}
|
|
134
|
+
description: ${yamlQuote(action.description)}
|
|
115
135
|
---
|
|
116
136
|
${userMessageSection}
|
|
117
137
|
|
|
@@ -121,7 +141,7 @@ ${action.body}`;
|
|
|
121
141
|
}
|
|
122
142
|
|
|
123
143
|
const COMPACT_TEMPLATE = `---
|
|
124
|
-
description: Flush thatch persistence, check for loose ends, then compact if clear
|
|
144
|
+
description: ${yamlQuote("Flush thatch persistence, check for loose ends, then compact if clear")}
|
|
125
145
|
---
|
|
126
146
|
${userMessageSection}
|
|
127
147
|
|
|
@@ -138,7 +158,7 @@ ${COMPACT_READY_TOKEN}
|
|
|
138
158
|
If anything is outstanding, list the items concisely so the user can address them, and do NOT include the token. The session will only be compacted when the token is present.`;
|
|
139
159
|
|
|
140
160
|
const EXIT_TEMPLATE = `---
|
|
141
|
-
description: Flush thatch persistence, check for loose ends, then exit opencode if clear
|
|
161
|
+
description: ${yamlQuote("Flush thatch persistence, check for loose ends, then exit opencode if clear")}
|
|
142
162
|
---
|
|
143
163
|
${userMessageSection}
|
|
144
164
|
|
package/src/prompts.ts
CHANGED
|
@@ -192,6 +192,13 @@ workflows. The host auto-discovers them, but reach for them proactively:
|
|
|
192
192
|
- \`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 prior findings, offers to reply on resolved items, then optionally re-runs the full structured review.
|
|
193
193
|
- \`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) before proposing changes. The research skill; pair with \`thatch-coding-workflow\`.
|
|
194
194
|
- \`thatch-plan-refinement\` - refine a plan before implementing it: fresh-context reviewer rounds until consensus, with an optional deep-mode lens fan-out (reuse, alternatives, hidden problems, safe-to-modify, archaeology). Use when a plan for a code change is about to be built or the user asks to stress-test a plan.
|
|
195
|
+
- \`thatch-refine\` - classify the project (audience, lifecycle, surface) and refine a plan under that type's requirements: team codebases owe coordination and intent breadcrumbs, personal projects allow cleverness, shared libraries owe API hygiene. Entry point for the thatch-refine-* family; also the /thatch/refine command.
|
|
196
|
+
- \`thatch-refine-team-app\` - refinement deltas for multi-developer team codebases: consistency outranks cleverness, intent breadcrumbs are deliverables, pre-mortem and safe-to-modify lenses dominate.
|
|
197
|
+
- \`thatch-refine-personal\` - refinement deltas for solo projects with no downstream consumers: relaxed coordination, cleverness and experimentation welcome, premise verification stays honest.
|
|
198
|
+
- \`thatch-refine-shared-lib\` - refinement deltas for changes touching a library's API surface: flexible on input, strict on output, keep special cases out of the API, never foreclose caller options, docs are a deliverable.
|
|
199
|
+
- \`thatch-refine-spike\` - refinement deltas for throwaway prototypes: skip the loop, verify only the premises the experiment's conclusion depends on, state the question and the time box.
|
|
200
|
+
- \`thatch-refine-infra\` - refinement deltas for CI, Terraform, and k8s changes: blast radius across pipelines and environments, rollback plan and staged verification are mandatory, pattern-following is near-absolute.
|
|
201
|
+
- \`thatch-refine-oss-contribution\` - refinement deltas for PRs to repos you do not maintain: the maintainer's design authority governs, minimal diff, upstream discussion gates significant design work.
|
|
195
202
|
- \`thatch-change-walkthrough\` - produces a teaching walkthrough of a diff with a specific format (SYNOPSIS + per-workflow orient/mechanism/numbered-stages + change overlay mirroring the same numbers) and calibrated prose rules. Load the skill for the format and prose rules, not just for the research method.
|
|
196
203
|
- \`thatch-code-walkthrough\` - produces a teaching walkthrough for a feature/workflow as it stands today with a specific format (SYNOPSIS + per-workflow orient/mechanism/numbered-stages + Key files) and calibrated prose rules. Also use proactively to draft high-level docs for new or undocumented features (suitable for pkg/README.md or docs/features/<name>.md). Load the skill for the format and prose rules, not just for the research method.
|
|
197
204
|
- \`thatch-review-context\` - gather project context (PRs, tickets, TODOs, deferred work) before a review.
|
|
@@ -506,6 +513,13 @@ workflows. The host auto-discovers them, but reach for them proactively:
|
|
|
506
513
|
|
|
507
514
|
- \`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) before proposing changes. The research skill; pair with \`thatch-coding-workflow\`.
|
|
508
515
|
- \`thatch-plan-refinement\` - refine a plan before implementing it: fresh-context reviewer rounds until consensus, with an optional deep-mode lens fan-out (reuse, alternatives, hidden problems, safe-to-modify, archaeology). Use when a plan for a code change is about to be built or the user asks to stress-test a plan.
|
|
516
|
+
- \`thatch-refine\` - classify the project (audience, lifecycle, surface) and refine a plan under that type's requirements: team codebases owe coordination and intent breadcrumbs, personal projects allow cleverness, shared libraries owe API hygiene. Entry point for the thatch-refine-* family; also the /thatch/refine command.
|
|
517
|
+
- \`thatch-refine-team-app\` - refinement deltas for multi-developer team codebases: consistency outranks cleverness, intent breadcrumbs are deliverables, pre-mortem and safe-to-modify lenses dominate.
|
|
518
|
+
- \`thatch-refine-personal\` - refinement deltas for solo projects with no downstream consumers: relaxed coordination, cleverness and experimentation welcome, premise verification stays honest.
|
|
519
|
+
- \`thatch-refine-shared-lib\` - refinement deltas for changes touching a library's API surface: flexible on input, strict on output, keep special cases out of the API, never foreclose caller options, docs are a deliverable.
|
|
520
|
+
- \`thatch-refine-spike\` - refinement deltas for throwaway prototypes: skip the loop, verify only the premises the experiment's conclusion depends on, state the question and the time box.
|
|
521
|
+
- \`thatch-refine-infra\` - refinement deltas for CI, Terraform, and k8s changes: blast radius across pipelines and environments, rollback plan and staged verification are mandatory, pattern-following is near-absolute.
|
|
522
|
+
- \`thatch-refine-oss-contribution\` - refinement deltas for PRs to repos you do not maintain: the maintainer's design authority governs, minimal diff, upstream discussion gates significant design work.
|
|
509
523
|
- \`thatch-change-walkthrough\` - produces a teaching walkthrough of a diff with a specific format (SYNOPSIS + per-workflow orient/mechanism/numbered-stages + change overlay mirroring the same numbers) and calibrated prose rules. Load the skill for the format and prose rules, not just for the research method.
|
|
510
524
|
- \`thatch-code-walkthrough\` - produces a teaching walkthrough for a feature/workflow as it stands today with a specific format (SYNOPSIS + per-workflow orient/mechanism/numbered-stages + Key files) and calibrated prose rules. Also use proactively to draft high-level docs for new or undocumented features (suitable for pkg/README.md or docs/features/<name>.md). Load the skill for the format and prose rules, not just for the research method.
|
|
511
525
|
- \`thatch-review-context\` - gather project context (PRs, tickets, TODOs, deferred work) before a review.
|
package/src/runtime.ts
CHANGED
|
@@ -1480,6 +1480,16 @@ export async function createRuntime(input: {
|
|
|
1480
1480
|
// requeue here so they are honestly re-extracted instead of lingering
|
|
1481
1481
|
// as silent loss.
|
|
1482
1482
|
extraction.requeueStaleAccepted();
|
|
1483
|
+
// Nudges skip injected prompts. A background-task completion, chat
|
|
1484
|
+
// notification, or watcher notification arrives as a prompt whose
|
|
1485
|
+
// parts are all synthetic - it is not user input, and nudging on it
|
|
1486
|
+
// feeds the pipeline its own exhaust: an extractor sub-agent's
|
|
1487
|
+
// completion would otherwise fire a fresh extraction nudge for the
|
|
1488
|
+
// entries the handling turn itself queued (the circular-nudge
|
|
1489
|
+
// pattern). Real user messages carry at least one non-synthetic
|
|
1490
|
+
// part, and an empty-parts message keeps nudging (unchanged
|
|
1491
|
+
// behavior).
|
|
1492
|
+
if (output.parts.length > 0 && (output.parts as any[]).every((p) => p.synthetic)) return;
|
|
1483
1493
|
// Task-dispatched sub-agent sessions may have restricted tool lists
|
|
1484
1494
|
// that exclude the thatch tools, and even where the tools exist the
|
|
1485
1495
|
// child is driven by its dispatch prompt, so nudges only burn "No
|
package/src/skills.ts
CHANGED
|
@@ -71,6 +71,13 @@ function loadSharedSkills(): SkillDef[] {
|
|
|
71
71
|
"thatch-session-reflection",
|
|
72
72
|
"thatch-coding-workflow",
|
|
73
73
|
"thatch-plan-refinement",
|
|
74
|
+
"thatch-refine",
|
|
75
|
+
"thatch-refine-team-app",
|
|
76
|
+
"thatch-refine-personal",
|
|
77
|
+
"thatch-refine-shared-lib",
|
|
78
|
+
"thatch-refine-spike",
|
|
79
|
+
"thatch-refine-infra",
|
|
80
|
+
"thatch-refine-oss-contribution",
|
|
74
81
|
"thatch-pr-description",
|
|
75
82
|
"thatch-ticket-description",
|
|
76
83
|
"thatch-split-overlarge-pr",
|