Thatch README

The full upstream README, mirrored for reference. Install config, tool schemas, adoption signals and our own overview live on the Thatch listing page.

Thatch

CI Ask DeepWiki

Persistent memory and working methods for AI coding agents. Each session inherits the accumulated knowledge of every session before it: project architecture, conventions, gotchas, user preferences. Your agent starts with context instead of a blank slate. No API keys, no accounts; no data leaves your machine. Thatch is an opencode v2 plugin, and also runs on Claude Code, Cursor, and any other MCP harness.

Install

OpenCode - add the plugin to opencode.jsonc; it installs on next start. Requires opencode 2.1 or newer; opencode v1 is not supported:

JSON Config
{ "plugin": ["@jeffober/thatch"] }

The plugin does not put the thatch CLI on your PATH: opencode loads the package from its own cache and never links the binary. A plugin-only install is complete for day-to-day use - skills and slash commands self-sync on every load, and opencode plugin update (then a restart) upgrades the plugin. To also get the CLI (thatch doctor, thatch chat, thatch notifications, the thatch session search commands, and thatch prime), install the package globally - a second copy alongside opencode's cache - or run it without installing:

Terminal
npm install -g @jeffober/thatch   # or: npx @jeffober/thatch

Upgrading from an older release that only supported opencode v1: any hand-written plugin shim that re-exports the plugin's old named server export fails to load after this version - replace it with a plain re-export of the default export (see the setup guide) or delete the shim and let the package install above do the work.

A caveat for OpenCode users: a session whose tab is open but not currently viewed can go quiet after about 60 minutes with no activity in its project directory, because opencode unloads the services of an idle project directory. Until that project is reloaded, messages between your sessions are not delivered to its sessions and they cannot be woken. If you keep tabs open across long idle periods, set experimental.location_idle_timeout to a longer duration or false.

Claude Code - paste into a session. Requires Node.js >= 22.13 or Bun >= 1.4.2 on PATH - the plugin ships no runtime:

text
/plugin marketplace add sysread/thatch
/plugin install thatch

The thatch launcher picks a runtime at startup: it tries the node on PATH first (checking for node:sqlite support), falls back to bun, and when neither is present the error message lists both prerequisites.

Older Claude Code versions, or enterprise policies that disable mods (Claude Code's name for plugins): npm install -g @jeffober/thatch && thatch setup --claude --hooks.

Cursor:

Terminal
npm install -g @jeffober/thatch
thatch setup --cursor            # or --global

Requires Node.js >= 22.13 or Bun >= 1.4.2 on PATH (the same runtime pick as Claude Code: the thatch launcher tries node first if it has node:sqlite, then bun).

NixOS / Nix - the flake bundles Bun and the embedding model (the model that powers memory search; on other installs it downloads once at first use), so nothing downloads later. No global install, no node or bun on PATH:

bash
nix run github:sysread/thatch -- --version   # try it

Then either import inputs.thatch.nixosModules.default and set programs.thatch.enable = true, add the overlay and pkgs.thatch, or add inputs.thatch.packages.${system}.default to your packages. Wire it into your editor with the setup commands above.

Any other MCP harness - install the CLI first, then point your harness at the server:

Terminal
npm install -g @jeffober/thatch
thatch setup --mcp-json               # print the server config as JSON
thatch setup --skills-only <dir>      # install skills into any directory

If you installed the CLI, you can optionally prime your project memory: run thatch prime in your project directory and an agent builds an initial map of the code base and seeds the memory store. Memory also builds on its own as your sessions work, so skipping this only costs the head start. The embedding model downloads once at first use and is cached per user (see the user guide).

What you get

  • Memory -- save, search, and recall knowledge across sessions with local embeddings and SQLite; one store per project plus a shared global store. Deleting is guarded: a tombstone keeps any re-creation of deleted content out of your results until you clear it (thatch tombstones); updating a different, live memory is never affected. On the MCP hosts (Claude Code, Cursor, and any other harness speaking the Model Context Protocol) the sessions share one embedding model per database through a background daemon (thatch embed-daemon, spawned automatically, idles out after 30 quiet minutes).
  • Prediction engine -- a statistical model of your decision-making preferences; strong predictions apply silently, ambiguous ones surface.
  • Behavior engine -- the agent codifies its own operational rules ("when X, I do Y") that auto-fire in similar situations.
  • Locutus engine -- a model of your drafting voice; rules learned from your corrections auto-surface when the agent drafts on your behalf, so the prose sounds like you.
  • Extraction -- durable facts are pulled from the session's tool activity automatically; nobody has to remember to save.
  • Conversation search -- search past opencode conversations by substring or regex and retrieve full messages, including complete tool inputs and outputs; also available as CLI subcommands (thatch session list/get/transcript/search) with JSONL output built for jq.
  • Doctor -- thatch doctor checks every host's install in one read-only sweep (the database, the opencode plugin, the Claude Code plugin or its hooks-based install, Cursor's config) and prints a verdict plus a fix line for anything that needs action.
  • Cross-session chat -- your agent sessions message each other under assigned, never-reused names. Idle sessions get woken by incoming mail; mail to a session that is closed but resumable is queued for its next run. A terminal broadcast (thatch chat broadcast) defaults to the active sessions (open tabs plus MCP hosts) with --closed/--stale widening the audience. Incoming mail is marked as untrusted content, so an agent never follows another session's instructions blindly.
  • Watchers -- the agent watches a GitHub PR, a branch, or a local command and gets prompted when something happens; notifications carry pointers, never external content.
  • Slash commands -- /thatch/coordinate (turn this session into a coordinator that surveys the project, proposes a plan, and dispatches delegates to do the work), /thatch/defrag, /thatch/extract, /thatch/hygiene, /thatch/reflect, /thatch/refine, /thatch/self-review, /thatch/peer-review, /thatch/whois, /thatch/bug-intake, and the wrap-ups /thatch/compact and /thatch/exit (a pre-flight checklist before compaction or exit). Slash commands install on opencode and Claude Code; Cursor surfaces the same actions as MCP prompts. See the user guide.
  • Notifications -- desktop banner and spoken voice on macOS and Linux, plus automatic alerts when the LLM pauses for your input or finishes real work; tune it all in a hand-editable config file the agent manages for you. Every delivery attempt is journaled, so thatch notifications shows what was said even after a banner is gone (a banner's text cannot be copied; the journal's can).
  • Skills -- memory workflows, multi-specialist code review, plan refinement with evidence and consistency audits, bug-report intake, walkthroughs, knowledge export, and writing tasks.

Feature differences by host are tracked in the MCP parity doc.

Privacy

Everything is local. The embedding model downloads once from Hugging Face Hub and is cached; no data leaves your machine. One exception: PR and branch watchers call the GitHub API through your existing gh authentication to poll targets you explicitly asked to watch; notifications carry pointer data and machine status, never external content.

Development

bash
bun install
mise run check     # typecheck + bun test + markdownlint (the CI gate)

On Nix, nix develop drops you into a shell with bun, mise, and node already on PATH. Tests never reach outside the sandbox: temp-directory SQLite files, mock embeddings, no network.

Docs

License

MIT