@jeffober/thatch 0.1.40 → 0.1.41

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.
@@ -12,6 +12,7 @@ This README is the overview. Each feature has its own guide:
12
12
  - [memory.md](memory.md): persistent memory store
13
13
  - [extraction.md](extraction.md): automatic fact extraction from tool calls
14
14
  - [watchers.md](watchers.md): event-driven notifications (PR and branch watching)
15
+ - [cross-session-chat.md](cross-session-chat.md): sessions messaging each other on one machine
15
16
  - [notifications.md](notifications.md): banner and voice notifications, user config
16
17
  - [prediction-engine.md](prediction-engine.md): user decision model
17
18
  - [behavior-engine.md](behavior-engine.md): agent self-discipline rules
@@ -184,6 +185,20 @@ search` - JSONL output designed for piping to `jq` or `grep`.
184
185
  See [watchers.md](watchers.md) for the full behavior, lifetime, and
185
186
  requirements.
186
187
 
188
+ ### Chat tools
189
+
190
+ | Tool | What it does |
191
+ |------|-------------|
192
+ | `thatch_chat_register` | Join the cross-session chat directory, so other opencode sessions on this machine can message you. Without a name, one is drawn from the built-in pool (recommended - cannot collide); with a name, it is claimed case-insensitively. Pass a topic (one line about what the session is working on) so the roster tells others who to talk to. Safe to call again - same name is a no-op, a new name renames, a new topic updates. |
193
+ | `thatch_chat_list` | List registered sessions with a liveness marker (fresh = its process is alive, stale = likely gone), each session's project and topic, and your unread count. |
194
+ | `thatch_chat_send` | Send a message to another registered session, by name or session id. The recipient is nudged when its session is idle. |
195
+ | `thatch_chat_read` | Drain your inbox: all unread messages oldest-first, marked read. Senders identified by display name. |
196
+ | `thatch_chat_unregister` | Leave the chat directory. |
197
+ | `thatch_chat_broadcast` | Send one message to every other live registered session at once. Stale sessions (dead host processes) are skipped and reported. Use sparingly: every live session pays a model turn for a broadcast. |
198
+
199
+ See [cross-session-chat.md](cross-session-chat.md) for the full behavior,
200
+ liveness model, and limitations.
201
+
187
202
  ## Automatic behaviors
188
203
 
189
204
  Beyond the tools, thatch hooks into opencode itself:
@@ -248,9 +263,12 @@ agent can tell the user to run `thatch setup`.
248
263
 
249
264
  On startup thatch installs [skills] into your global opencode config
250
265
  (`~/.config/opencode/skills/`, or `$XDG_CONFIG_HOME/opencode/skills`).
251
- With `thatch setup --claude`, skills install to `~/.claude/skills/` (or
252
- `$CLAUDE_CONFIG_DIR/skills/`); with `thatch setup --cursor`, to
253
- `~/.cursor/skills/`.
266
+ With `thatch setup --claude`, skills follow the install scope: the
267
+ repo's `.claude/skills/` for project-local, `~/.claude/skills/` (or
268
+ `$CLAUDE_CONFIG_DIR/skills/`) for `--global`. `thatch setup --cursor`
269
+ works the same way with `.cursor/skills/` and `~/.cursor/skills/`.
270
+ Setup reports the skills directory and how many skills were added,
271
+ updated, removed, or already current.
254
272
 
255
273
  ### Memory skills
256
274
 
@@ -265,7 +283,7 @@ With `thatch setup --claude`, skills install to `~/.claude/skills/` (or
265
283
 
266
284
  ### Code review skills
267
285
 
268
- Eight specialist review lenses, plus the synthesizer, context, followup,
286
+ Nine specialist review lenses, plus the synthesizer, context, followup,
269
287
  response, walkthrough, and workflow skills that support the review pipeline:
270
288
 
271
289
  | Skill | Focus |
@@ -278,7 +296,7 @@ response, walkthrough, and workflow skills that support the review pipeline:
278
296
  | `thatch-review-breadcrumbs` | Comment narrative: do comments form a coherent outline of the code's behavior? |
279
297
  | `thatch-review-mark-and-sweep` | Mechanical change completeness: whole-repo sweep for stragglers after renames, flag removals, API substitutions. |
280
298
  | `thatch-review-highlights` | Positive finding detection: notably clever solutions, cleanup done along the way, documentation that helps. Medium-high bar against generic praise. |
281
- | `thatch-review-mentorship` | Peer-mentorship lens: teaching-grade notes on unseen helpers/internal packages, companion techniques, house patterns, test-craft, API-shape principles, next-reader discoverability. Informational only, never blocking. |
299
+ | `thatch-review-technique` | Technique lens: teaching-grade notes on unseen helpers/internal packages, companion techniques, house patterns, test-craft, API-shape principles, next-reader discoverability. Informational only, never blocking. |
282
300
  | `thatch-review-synthesizer` | Verifies and synthesizes findings from multiple specialists into a report that starts with workflow changes, then highlights, then deduplicated severity-grouped findings. |
283
301
  | `thatch-review-context` | Gathers project context (PR descriptions, git archaeology, ticket references, linked docs/tickets, memory) before a review. Prevents false positives about intentionally deferred work. |
284
302
  | `thatch-code-archaeology` | Investigates an existing feature, debugs an unfamiliar area, or begins a new ticket. Explores the code base from multiple angles (data model, state flow, git history, sibling features, skeletons) before proposing changes. Pairs with `thatch-coding-workflow`. |
package/docs/user/cli.md CHANGED
@@ -39,6 +39,36 @@ hygiene report. The `--json` flag wraps the output as
39
39
  commands are normally called by hooks, not by hand, but you can run
40
40
  them to see what the agent sees at session start.
41
41
 
42
+ ## Cross-session chat
43
+
44
+ Read-only access to the chat directory your opencode sessions share
45
+ (see [cross-session-chat.md](cross-session-chat.md)):
46
+
47
+ ```bash
48
+ thatch chat list # who is registered: name, age, project, topic
49
+ thatch chat tail # follow sent and read events, live
50
+ thatch chat tail --once # print the messages sent so far and exit
51
+ ```
52
+
53
+ `chat list` shows every registered session with how long since its last
54
+ heartbeat (a large age means the session's process is probably gone), its
55
+ project, and the topic it registered with - the fastest way to answer
56
+ "which session should I talk to about X?"
57
+
58
+ `chat tail` prints the conversation as it happens:
59
+
60
+ ```text
61
+ [2026-09-12T14:02:11Z] Kurn the Typechecker -> Marlowe the Cherry Picker: CI is green on main
62
+ [2026-09-12T21:07:52Z] Marlowe the Cherry Picker -> broadcast: rebasing payments, hold off
63
+ [2026-09-12T21:08:03Z] Marlowe the Cherry Picker read a message from Kurn the Typechecker: direct ping
64
+ ```
65
+
66
+ Follow mode runs until Ctrl-C. Read events appear only in follow mode
67
+ (they fire when an inbox is drained after the tail started). The chat
68
+ itself flows through the agents (the CLI never sends, reads, or
69
+ registers on a session's behalf; that happens from opencode sessions
70
+ via the `thatch_chat_*` tools).
71
+
42
72
  ## Priming a new project
43
73
 
44
74
  ```bash
@@ -43,7 +43,7 @@ the review:
43
43
  | `thatch-review-breadcrumbs` | Comment narrative: do comments form a coherent outline of the code's behavior? |
44
44
  | `thatch-review-mark-and-sweep` | Mechanical change completeness: whole-repo sweep for stragglers after renames, flag removals, API substitutions. |
45
45
  | `thatch-review-highlights` | Positive finding detection: clever solutions, cleanup done along the way, documentation that helps. Medium-high bar. |
46
- | `thatch-review-mentorship` | Peer-mentorship lens: teaching-grade notes on unseen helpers/internal packages, companion techniques, house patterns, test-craft, API-shape principles, next-reader discoverability. Informational only, never blocking. |
46
+ | `thatch-review-technique` | Technique lens: teaching-grade notes on unseen helpers/internal packages, companion techniques, house patterns, test-craft, API-shape principles, next-reader discoverability. Informational only, never blocking. |
47
47
 
48
48
  Each specialist is a self-contained static-analysis pass. They can run
49
49
  individually or as part of the coordinated review.
@@ -0,0 +1,102 @@
1
+ # Cross-Session Chat
2
+
3
+ Cross-session chat lets your opencode sessions talk to each other. If one
4
+ session is QAing a release and another is planning a feature, the second can
5
+ ask the first "is the release green yet?" instead of you relaying messages
6
+ between tabs all afternoon.
7
+
8
+ ## What it does
9
+
10
+ Each session opts in with `thatch_chat_register`. The recommended path is to
11
+ register without a name: thatch assigns one drawn from a built-in pool of
12
+ whimsical names ("Kurn the Typechecker", "Marlowe the Cherry Picker",
13
+ "Labcoat 3"), so you never think about naming and it can never collide. You
14
+ can also claim a custom name; names are unique case-insensitively, so
15
+ "Landru" and "landru" are the same name. Pass a topic while you are at it -
16
+ one line about what the session is working on ("QAing the v1.41 release",
17
+ "planning the payments refactor") - because that is what turns the roster
18
+ into a who-is-working-on-what board. Once registered:
19
+
20
+ - `thatch_chat_list` shows every registered session on the machine, with a
21
+ liveness marker (fresh or stale), its project, its topic, and your unread
22
+ count
23
+ - `thatch_chat_send` delivers a message to another registered session, by
24
+ name or session id
25
+ - `thatch_chat_read` drains the session's inbox
26
+ - `thatch_chat_broadcast` delivers one message to every other live
27
+ registered session at once
28
+ - `thatch_chat_unregister` leaves the directory
29
+
30
+ When mail arrives for an idle session, thatch wakes it with a notification -
31
+ the agent gets a model turn even with nobody at the keyboard, reads its
32
+ inbox, and decides what to do. The notification names the senders and the
33
+ count only; the agent reads the actual messages itself.
34
+
35
+ Broadcasts are for announcements and open questions ("which of you is
36
+ working on the payments code?", "main just moved, rebase if you are based
37
+ on it"). Every live session gets the message and spends a model turn on it,
38
+ so broadcast sparingly - for anything with a known audience, `chat_send` is
39
+ the polite tool. Stale sessions are skipped and reported: a dead session
40
+ never reads a broadcast.
41
+
42
+ ## Watching the conversation
43
+
44
+ Chat activity is visible in each session's transcript: registering,
45
+ sending, reading, and broadcasting echo back as `[chat]` bubbles, so you
46
+ can watch the exchange happen in either tab without leaning over the
47
+ agent's shoulder. Failed sends stay silent, and routine directory lookups
48
+ stay on the muted tool line. You can also watch from the terminal:
49
+ `thatch chat list` and `thatch chat tail` are covered in
50
+ [cli.md](cli.md). (Every other plugin tool call also leaves a muted
51
+ one-line entry in the transcript; opencode's "Show generic tool output"
52
+ toggle reveals those output blocks if you want them.)
53
+
54
+ ## How to use it
55
+
56
+ Tell each session to register, then let them coordinate:
57
+
58
+ > Register in the thatch chat. I'll have another session ask you about the
59
+ > release status; answer it directly.
60
+
61
+ and in the other session:
62
+
63
+ > Register in the thatch chat, then ask the other session whether the
64
+ > release has shipped.
65
+
66
+ (Registering without arguments is the normal path - each session gets a
67
+ pool name automatically. To recognize sessions at a glance, ask for a
68
+ custom name instead, or just run `thatch_chat_list` and read the roster.)
69
+
70
+ Received messages are treated as informational, not as your instructions: an
71
+ agent that gets mail will not treat it as approval to start work, and it
72
+ will not auto-reply unless the message bears on something it is already
73
+ doing. When in doubt it summarizes the mail for you and waits. If you want
74
+ two sessions to actively cooperate on something, say so explicitly in both
75
+ sessions.
76
+
77
+ ## Liveness
78
+
79
+ A session shows as fresh while its opencode process is running. A crashed
80
+ or closed process stops heartbeat-ing, and the session shows as stale in
81
+ `thatch_chat_list` after ten minutes. Messages to a stale session wait in
82
+ its inbox unread - a dead session never reads them. Explicitly closing a
83
+ session (deleting it in the TUI) unregisters it immediately.
84
+
85
+ ## Requirements and limitations
86
+
87
+ - **Wake-up delivery is opencode only.** The chat tools work everywhere
88
+ (other hosts declare their identity with `as`), but only opencode can
89
+ start a turn when a message arrives; Claude Code and Cursor see pending
90
+ mail at their next prompt (the flush-tools hook line, or `chat_status`).
91
+ - **Same machine only.** The directory and inbox live in thatch's local
92
+ database. There is no network relay.
93
+ - **Opt-in.** Unregistered sessions cannot be messaged and cannot send.
94
+ Sub-agent sessions should not register.
95
+ - **Loop safety.** Thatch caps wake prompts per recipient per hour, so two
96
+ agents acknowledging each other cannot ping-pong forever even if both
97
+ models decide to be chatty.
98
+ - **Names are claimable.** Any session can pick any unused name (uniqueness
99
+ is case-insensitive). There is no impersonation defense - the assumption
100
+ is that every agent on the machine is yours.
101
+ - **Message retention.** Messages are kept as history; unregistering does
102
+ not delete them. There is no automatic pruning yet.
@@ -48,13 +48,24 @@ Thatch runs as an MCP server. The setup command installs the server
48
48
  config, instructions, hooks, and skills:
49
49
 
50
50
  ```bash
51
- thatch setup --claude # project-local (writes .mcp.json, CLAUDE.md, .claude/)
51
+ thatch setup --claude # project-local (.mcp.json, CLAUDE.md, .claude/)
52
52
  thatch setup --claude --global # user-scoped (~/.claude/)
53
53
  ```
54
54
 
55
+ Skills follow the install scope: project-local installs them to the
56
+ repo's `.claude/skills/` so they version with the project; `--global`
57
+ installs them to `~/.claude/skills/` (or `$CLAUDE_CONFIG_DIR/skills/`).
58
+
55
59
  `bun` must be on PATH (the thatch binary runs under bun). Setup is
56
60
  idempotent. Re-running it updates drifted content without clobbering
57
- unrelated config.
61
+ unrelated config, and reports what it did: the skills directory plus
62
+ how many skills were added, updated (replaced with a newer version),
63
+ removed (retired), or already current.
64
+
65
+ If thatch skills exist in the scope you did not install to (for
66
+ example, `~/.claude/skills/` copies left over from before a repo moved
67
+ to project-local skills), setup prints a note naming that directory.
68
+ It never touches the other scope.
58
69
 
59
70
  For a global install, setup prints the `claude mcp add --scope user`
60
71
  command to run instead of writing a project `.mcp.json`.
@@ -66,6 +77,9 @@ thatch setup --cursor # project-local (.cursor/mcp.json, AGENTS.md, .
66
77
  thatch setup --cursor --global # user-scoped (~/.cursor/)
67
78
  ```
68
79
 
80
+ Skills follow the install scope: project-local installs them to the
81
+ repo's `.cursor/skills/`; `--global` installs them to `~/.cursor/skills/`.
82
+
69
83
  Cursor uses a flat hooks format (`{version, hooks:{event:[{command}]}}`)
70
84
  and `--json` output for hook commands.
71
85
 
@@ -7,11 +7,12 @@ frontmatter (name, description) that opencode auto-discovers.
7
7
 
8
8
  ## How they work
9
9
 
10
- On startup, thatch installs skill files into your global config
11
- (`~/.config/opencode/skills/` for opencode, `~/.claude/skills/` for
12
- Claude Code, `~/.cursor/skills/` for Cursor). The host's skill
13
- discovery scans these directories and presents them to the agent as
14
- available skills.
10
+ On startup, thatch installs skill files into the host's skills
11
+ directory: the repo's `.claude/skills/` or `.cursor/skills/` for
12
+ project-local `thatch setup`, `~/.claude/skills/` or `~/.cursor/skills/`
13
+ for `--global`, and `~/.config/opencode/skills/` for the opencode
14
+ plugin. The host's skill discovery scans these directories and
15
+ presents them to the agent as available skills.
15
16
 
16
17
  The agent loads a skill when the user's request matches the skill's
17
18
  description, or when another skill or the system prompt directs the
@@ -45,7 +46,7 @@ Skills are split into shared (all hosts) and opencode-only:
45
46
  | `thatch-review-breadcrumbs` | Comment narrative: do comments form a coherent outline of the code's behavior? |
46
47
  | `thatch-review-mark-and-sweep` | Mechanical change completeness: whole-repo sweep for stragglers after renames, flag removals, API substitutions. |
47
48
  | `thatch-review-highlights` | Positive finding detection: notably clever solutions, cleanup done along the way, documentation that helps. Medium-high bar. |
48
- | `thatch-review-mentorship` | Peer-mentorship lens: teaching-grade notes on unseen helpers/internal packages, companion techniques, house patterns, test-craft, API-shape principles, next-reader discoverability. Informational only, never blocking. |
49
+ | `thatch-review-technique` | Technique lens: teaching-grade notes on unseen helpers/internal packages, companion techniques, house patterns, test-craft, API-shape principles, next-reader discoverability. Informational only, never blocking. |
49
50
  | `thatch-review-synthesizer` | Verifies and synthesizes findings from multiple specialists into a deduplicated, severity-grouped report. |
50
51
  | `thatch-review-context` | Gathers project context (PRs, tickets, linked docs/designs followed from the change, TODOs, deferred work) before a review. Prevents false positives about intentionally deferred work. |
51
52
  | `thatch-code-archaeology` | Investigates an existing feature, debugs an unfamiliar area, or begins a new ticket. The research skill; pair with `thatch-coding-workflow`. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jeffober/thatch",
3
- "version": "0.1.40",
3
+ "version": "0.1.41",
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",
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Static display-name pool for the cross-session chat directory.
3
+ *
4
+ * Style lifted from fnord's Nomenclater (lib/ai/agent/nomenclater.ex): whimsical
5
+ * geek-culture names in three shapes - "first last", "first the epithet",
6
+ * "first of the phrase" - spread across themes (Jargon File/BOFH, Zork,
7
+ * Klingons, Discworld, Sandman, D&D, pulp detectives with software puns,
8
+ * hackerspeak callsigns, AI puns, golden-age sci-fi, spoofed famous robots,
9
+ * unnamed-cast extras). fnord generates its names with an LLM at runtime;
10
+ * thatch bakes the pool in - static contents, no model call - while the
11
+ * draw itself is random (see ChatStore.assign).
12
+ *
13
+ * A session may still claim a custom name (chat_register's optional arg);
14
+ * the pool is the default and keeps the directory colorful with zero
15
+ * bikeshedding. Pool names are case-insensitively distinct from each other,
16
+ * matching the directory's NOCASE uniqueness rule - so pool assignment can
17
+ * never collide with another pool name, only with a custom claim.
18
+ *
19
+ * Names are deliberately short: they appear inside wake prompts and
20
+ * chat_list output, so every character costs context.
21
+ */
22
+
23
+ export const CHAT_NAME_POOL: readonly string[] = [
24
+ // Jargon File / BOFH
25
+ "Buck the Bogon Filter",
26
+ "Phineas the Packet Wrangler",
27
+ "Octavia of the Lost Backups",
28
+ "Grumble the Tape Librarian",
29
+ "Wilhelmina the Password Oracle",
30
+ "Ned of the Null Modem",
31
+ "Sydney the Segfault Sage",
32
+ "Barnaby of the Baud Rate",
33
+ // Zork
34
+ "Dimwit the Flathead",
35
+ "Belboz the Enchanter",
36
+ "Ellum the Grue Keeper",
37
+ "Umbra the Grue Baiter",
38
+ "Piotr of the Platinum Bar",
39
+ "Zizmo of the Dim Cellar",
40
+ // Klingons, with dramatic epithets
41
+ "K'Vir the Unmerged",
42
+ "Morath the Rebase Survivor",
43
+ "K'Leth of the Cold Staging",
44
+ "Duras the Conflict Eater",
45
+ "B'Etor the Force Pusher",
46
+ "Gowron of the Green Build",
47
+ "Kurn the Typechecker",
48
+ "Martok the Ever Rebased",
49
+ // Discworld, especially Unseen University faculty
50
+ "Wenlock the Reader in Recent Runes",
51
+ "Modo the Compost King",
52
+ "Victor of Applied Catastrophe",
53
+ "Dorcas of Indefinite Studies",
54
+ "Adereth the Invisible Scholar",
55
+ "Spold the Unseen Porter",
56
+ "Herrno of the Eighth Level",
57
+ "Vimes the Deadline Copper",
58
+ // The Dreaming
59
+ "Mervyn of the Pumpkin Patch",
60
+ "Lucien the Dream Librarian",
61
+ "Abel the Ever Patient",
62
+ "Shaper of the Facade",
63
+ "Nada the Restless Wanderer",
64
+ "Brute the Dream Farrier",
65
+ // D&D
66
+ "Therenal Quickblade",
67
+ "Osgar the Mimic Checker",
68
+ "Yvaine of the Silver Cache",
69
+ "Dorn Halfstack",
70
+ "Elowen Moonpath",
71
+ "Garrick the Lint Warden",
72
+ "Sylvara of the Deep Trace",
73
+ "Haldor Truehex",
74
+ // Pulp detectives with software names
75
+ "Dashiell the Deadlocker",
76
+ "Marlowe the Cherry Picker",
77
+ "Effie the Ticket Trier",
78
+ "Brigid the Stale Falcon",
79
+ "Deb the Debugger Malloy",
80
+ "Spade the Unallocated",
81
+ // Hackerspeak callsigns
82
+ "Crash Override",
83
+ "Kernel Panic",
84
+ "Null Terminator",
85
+ "Cache Money",
86
+ "Segfault Sammy",
87
+ "Wardialer Wendy",
88
+ "Grep Goblin",
89
+ "Backtrace Betty",
90
+ // AI puns
91
+ "Al Go Rithm",
92
+ "Anna Log",
93
+ "Otto Mated",
94
+ "Percy the Perceptron",
95
+ "Terrence of the Last Epoch",
96
+ "Emma Bedding",
97
+ "Quinn Latent",
98
+ "Dot Matrix",
99
+ // Golden-age sci-fi
100
+ "Buzz Megabyte",
101
+ "Rex Protocol",
102
+ "Chip Vortexian",
103
+ "Wanda Warpdrive",
104
+ "Pete Parallax",
105
+ "Vera Antimatter",
106
+ // Spoofed famous AIs and robots
107
+ "Lrrr of Omicron Persei 8",
108
+ "Data of the Positronic Brain",
109
+ "Bishop the Synthetic",
110
+ "Hal of the Pod Bay",
111
+ "Rosie Unit One",
112
+ "Robot Devil",
113
+ // Unnamed cast
114
+ "Labcoat 3",
115
+ "Redshirt 7",
116
+ "NPC 4",
117
+ "Villager 2",
118
+ "Guard 5",
119
+ "Henchperson 12",
120
+ "Extra 11",
121
+ ];