kith-coord 0.1.8 → 0.2.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0 — 2026-11-23
4
+
5
+ - Worktree adoption. Kith can register a linked worktree an agent is already using, instead of creating one under `.coord/worktrees`. Claude Code `--worktree`, `EnterWorktree`, and subagent `isolation: worktree` checkouts live at `.claude/worktrees/<name>` (branch `worktree-<name>` by default). A joined hook adopts that checkout when its `cwd` is unambiguously that worktree, including the Claude Code plugin command `kith hook pre|post --client claude --auto`. `kith adopt [path]`, `kith worktree adopt [path]`, `kith begin --adopt [path]`, MCP `kith_adopt_worktree`, and `adoptWorktree` / `worktreePath` on begin and claim do the same for any `git worktree list` entry. Provenance is stored in an optional `worktree_registrations` table (`created` / `adopted`, source `kith`, `claude-code`, or `external`). Older binaries ignore the table. A dirty tree is left as it is. A detached HEAD can take `kith commit` and is refused at integration until a branch is checked out. A branch checked out in another worktree is refused for both `kith commit` and integration. An adopted branch that is unique still integrates only through the existing merge train and verification command. `kith gc` never deletes or prunes a worktree Kith did not create. `kith worktree remove` refuses an adopted directory unless `--delete-adopted` is passed, and that still refuses a dirty tree. `kith status` and `kith doctor` name adopted worktrees. The full MCP list adds `kith_adopt_worktree` (18 tools). Compact `kith_work` accepts `action: "adopt"`.
6
+ - README and Claude Code plugin. The README leads with file ownership for agents you already run, and the comparison section says Kith adopts worktrees from Claude Code, Claude Squad, CCManager, Orca, and Orchestrator.inc instead of launching those tools. Install and workflow detail lives in `docs/install.md` and `docs/usage.md`. Claude Code can install Kith as a plugin (`/plugin marketplace add connorhriley/kith`, then `/plugin install kith@kith`). The plugin is `plugins/kith`: hooks and the compact MCP server run `npx -y kith-coord`. Plugin hooks defer when `kith install` has already registered the same hook, so a tool call is checked once. The plugin manifests are version `0.2.0`.
7
+ - Short mutex leases on macOS. A 300 ms `kith_run_with_mutex` lease could expire before the command started when process inspection (`ps`) was slower than the lease, so the borrowed-session test and the cancellation test never saw a pid file. Renewal is armed before that inspection. The worker repeats its ready message until the command arrives, and a macOS process group that is only zombies is treated as stopped so the mutex is released.
8
+ - Dependencies. `@modelcontextprotocol/sdk` is 1.32.2. Vitest is 5.1.1. The editor extension keeps its safe dependency bumps, including esbuild 0.28.2, and Node 26 type majors are ignored. `pnpm/action-setup` in CI is 6.1.1.
9
+ - After upgrading, run `kith install` so hooks and client entries use this runtime. Protocol stays 1.6.0. The storage schema stays 3. There is no database migration. Opening the database creates the optional `worktree_registrations` table; binaries from 0.1.6 through 0.1.9 ignore it and keep working. Stop existing Kith connections first, and upgrade every coordinator that shares a repository together. The editor extension ships as 0.2.0 in lockstep with this package.
10
+
11
+ ## 0.1.9 — 2026-11-16
12
+
13
+ - Hook messages sent back to the model are capped at 2,000 characters. That includes notices, warnings, shared-checkout refusals, and revert warnings, both before and after a tool call. The text is cut on a line boundary. The ready-to-run `kith commit` line in a refusal or revert is kept whole; other text is dropped first so the total stays within 2,000 whenever that line fits. A command longer than the budget is returned intact rather than cut into a command that would not run. The shorter conflict footer from 0.1.8 stays separately bounded and counts toward that total.
14
+ - False conflicts from temporary-index commits are pruned. A stored conflict is dropped when one side is already the current commit, when both sides are the same content, or when the recorded changes merge cleanly. Cleanup runs when HEAD changes, including after `kith commit`, and is cached so a later status read does not re-check every conflict. Probe files are created outside the repository and removed immediately. A real overlap stays reported, including between Claude Code subagents that share a process. A missing process id is not treated as the same agent.
15
+ - Temporary-index commits are allowed in a shared checkout and in your own worktree while other agents are active, under the new firewall rules. In a shared checkout, `git update-ref` of `HEAD` or the branch checked out there is allowed only as a compare-and-swap of exactly one commit, and only when every changed file is one you have claimed, locked, or recorded the way `kith commit` records files. Literal commit ids are checked before the command runs. When that same command uses shell variables or a command substitution, Kith does not run them ahead of time: after the commit lands it checks the result and moves the ref back if a path belongs to another agent, the commit is a merge, or it jumps more than one commit. In your own worktree, the same commit is allowed on `HEAD` or your own branch while a peer is active elsewhere. Updates to the integration branch, another agent's branch, or a `HEAD` move in a shared checkout that does not meet those rules stay blocked, as do deleting a ref you do not own, `--stdin` batches, and ref commands Kith cannot classify. `symbolic-ref` stays blocked except for a read or for pointing your own `HEAD` at your own branch. A refusal names the reason and includes `kith commit -m "<message>" <recorded files>` when you have recorded files.
16
+ - `kith doctor` detects hooks and client entries pinned to a stale runtime. It fails when a Claude hook config, Cursor `hooks.json`, Codex config, Claude Desktop config, or another client MCP entry points at a different Kith than the CLI you just ran, and the failure tells you to run `kith install`. A hook whose retained runtime is older than the `kith` binary on `PATH` says so once per process.
17
+ - `kith install` prunes old runtimes. It deletes retained copies under `~/.local/share/kith/runtimes/` that no live hook, MCP entry, or login agent still names, and keeps a runtime any of those configs still point at. A damaged selected runtime is still refused rather than overwritten.
18
+ - After upgrading, run `kith install` so hooks and client entries use this runtime. Protocol stays 1.6.0. The storage schema stays 3. There is no database migration. Stop existing Kith connections first, and upgrade every coordinator that shares a repository together.
19
+
3
20
  ## 0.1.8 — 2026-11-15
4
21
 
5
22
  - Handoffs. Coordination state used to lose everything an agent learned when its session ended: claims were released and the task requeued as if untouched. `kith_write_handoff` (and `kith handoff write`) leaves a note with what is done, what remains, what failed and what was learned, plus the files changed from Git and a pointer to the full transcript; `releaseTask` hands the task back to the queue. Kith records an `abandoned` note itself when a session dies or disconnects mid-task (claimed files, last failed integration, quarantined changes) and a completion note when none was written. `kith_begin_work` and `kith_claim_next_task` return relevant notes by task and exact scope overlap, `kith_get_status` lists open ones, `kith_read_handoffs` returns full text, and siblings see new notes in their live delta. Notes are labelled untrusted, stripped of control characters and bounded. A note is superseded only by a later completion that exists. Abandoned notes point at the branch, and its worktree when that still exists.
package/CONTRIBUTING.md CHANGED
@@ -44,4 +44,10 @@ The public entrypoint is `src/index.ts`. `KithEngine` assembles storage, agent l
44
44
 
45
45
  `pnpm test:package` builds and packs the distribution, installs it in an empty consumer project, and checks the CLI, packaged supervised worker, and library API. It needs registry access for runtime dependencies.
46
46
 
47
- Native client checks are opt-in: see [client validation](docs/client-validation.md). They require installed authenticated clients and consume model usage. CI uses no model credentials. Establish monitored security contacts before public launch or configuring a release workflow.
47
+ Native client checks are opt-in: see [client validation](docs/client-validation.md). They require installed authenticated clients and consume model usage. CI uses no model credentials.
48
+
49
+ ## Releasing
50
+
51
+ Publish by pushing a `vX.Y.Z` tag after the release commit is on `main`. The release workflow checks that the tag, `package.json`, `src/version.ts`, and `server.json` agree, runs the same Linux, macOS, and Windows checks as pull requests, then publishes. It uses npm trusted publishing, so there is no `NPM_TOKEN`. The one-time npmjs.com values, the GitHub `release` environment, and the optional editor-marketplace secrets are in [RELEASING.md](RELEASING.md).
52
+
53
+ Run `pnpm release:check` before tagging. Report security issues through [private vulnerability reporting](https://github.com/connorhriley/kith/security/advisories/new), as described in [SECURITY.md](SECURITY.md).
package/README.md CHANGED
@@ -3,204 +3,143 @@
3
3
  </p>
4
4
 
5
5
  <p align="center">
6
- <a href="https://github.com/connorhriley/kith/actions/workflows/ci.yml"><img src="https://github.com/connorhriley/kith/actions/workflows/ci.yml/badge.svg" alt="CI status"></a>
7
- <a href="https://github.com/connorhriley/kith/actions/workflows/windows.yml"><img src="https://github.com/connorhriley/kith/actions/workflows/windows.yml/badge.svg" alt="Windows validation"></a>
8
6
  <a href="https://www.npmjs.com/package/kith-coord"><img src="https://img.shields.io/npm/v/kith-coord" alt="npm version"></a>
9
- <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-22C55E" alt="MIT license"></a>
7
+ <a href="https://www.npmjs.com/package/kith-coord"><img src="https://img.shields.io/npm/dm/kith-coord" alt="npm downloads"></a>
8
+ <a href="https://github.com/connorhriley/kith/actions/workflows/ci.yml"><img src="https://github.com/connorhriley/kith/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
9
+ <a href="https://github.com/connorhriley/kith/actions/workflows/windows.yml"><img src="https://github.com/connorhriley/kith/actions/workflows/windows.yml/badge.svg" alt="Windows validation"></a>
10
+ <a href="LICENSE"><img src="https://img.shields.io/badge/licence-MIT-22C55E" alt="MIT licence"></a>
11
+ <a href="https://registry.modelcontextprotocol.io/v0.1/servers/io.github.connorhriley%2Fkith/versions/latest"><img src="https://img.shields.io/badge/MCP%20Registry-io.github.connorhriley%2Fkith-6b4fbb" alt="MCP Registry"></a>
10
12
  </p>
11
13
 
12
14
  <p align="center">
13
- <a href="#quick-start">Quick start</a> · <a href="https://marketplace.visualstudio.com/items?itemName=kith-coord.kith">VS Code</a> · <a href="https://open-vsx.org/extension/kith-coord/kith">Cursor / Open VSX</a> · <a href="#see-it-work">Demo</a> · <a href="docs/integrations.md">Integrations</a> · <a href="docs/usage.md">CLI &amp; API</a> · <a href="CONTRIBUTING.md">Contribute</a>
15
+ <a href="#quick-start">Quick start</a> · <a href="#demo">Demo</a> · <a href="#why-not-just-git-worktrees">Why not worktrees</a> · <a href="#how-kith-compares">Compare</a> · <a href="docs/install.md">Install</a> · <a href="https://marketplace.visualstudio.com/items?itemName=kith-coord.kith">VS Code</a> · <a href="https://open-vsx.org/extension/kith-coord/kith">Cursor / Open VSX</a> · <a href="docs/integrations.md">Integrations</a> · <a href="docs/usage.md">CLI &amp; API</a> · <a href="CONTRIBUTING.md">Contribute</a>
14
16
  </p>
15
17
 
16
- **Local coordination for cooperating coding agents.**
17
-
18
- Claim work, isolate changes with Git worktrees, share local resources, and verify integration—without a hosted service.
19
-
20
- One agent changes an interface while another builds against it. Two agents edit the same file. Separate worktrees still compete for a dev-server port or a package install.
21
-
22
- Kith gives cooperating agents shared local state: who owns a task, which files are claimed, and which commands need to wait. Agents use its MCP server; CLI commands support local inspection and maintenance. Coordination lives in SQLite on your machine; Kith itself needs no hosted service or model API key.
23
-
24
- ## What Kith does
25
-
26
- | Need | Kith provides |
27
- | --- | --- |
28
- | Keep tasks from overlapping | Scoped claims with conflict responses |
29
- | Give agents separate working files | Git worktrees with an explicit integration step |
30
- | Check work before integration | Your project's verification command |
31
- | Share local tools | Port reservations and supervised command mutexes |
32
- | Know what is going on before you start | `kith brief`: who is active on what, overlapping claims, open handoffs and conflicts. Read-only, no session needed |
33
- | Work the way you do | Worktree isolation, or one shared checkout with scope claims (`kith mode main`) |
34
- | Keep what an agent learned | Handoff notes that survive a session boundary and reach whoever works the same scope next |
35
- | See what is happening | Session/task state through CLI/MCP; optional read-only editor and worktree views |
36
-
37
- Kith fits workflows where you already launch multiple coding agents and want them to coordinate. It does not choose models, write prompts, or launch a fleet for you. Worktrees separate files; Kith adds shared ownership and resource coordination.
18
+ Kith does not launch agents. It is the ownership layer under the ones you already run: Claude Code, Codex, Cursor, and any other MCP client.
38
19
 
39
- The [reliability contract](docs/reliability.md) defines ownership, verification, recovery and enforcement boundaries. Claims coordinate cooperating clients; hooks do not sandbox filesystem access. Scope matching follows a [documented grammar](docs/path-and-scope-rules.md). Contract-change reports and exact-name reuse hints are advisory.
20
+ Those agents share file claims, a dev-server port, and one-at-a-time commands such as a package install. When you supply a check, a worktree integrates only after that check passes; a failure leaves the target unchanged. There is no account and no coordination server. The macOS menu bar from `kith install` is an optional read-only status view, not a launcher.
40
21
 
41
22
  ## Quick start
42
23
 
43
- Requires **Git 2.38+** and **Node.js 22.13+ on 22.x or Node.js 24+**. Full workflows target macOS and Linux. Native Windows MCP checks cover claims, worktrees, ports, integration and recovery; supervised mutex commands and shell hooks require macOS/Linux or WSL. See the [support evidence](docs/client-validation.md#native-windows).
44
-
45
- Git recording and integration require a commit identity configured for the repository (`user.name` and `user.email`). Kith does not change your global Git identity.
46
-
47
- **Upgrading to 0.1.8:** Stop existing Kith connections first. Back up stopped coordination state (including SQLite sidecars) and retain worktrees; upgrade all coordinators sharing a repository together. The storage schema stays 3. Databases already on schema 3 open without a version migration. The first open with 0.1.8 creates an optional `handoffs` table; binaries from 0.1.6 and 0.1.7 ignore that table and keep working, but they do not read or write handoff notes. An upgrade from schema 2 still applies the 0.1.6 migration to schema 3, which older binaries refuse. Hooks no longer block a process that has not joined a session, and integration refuses only dirty files the merge itself changes. Existing custom launchers are preserved; review their pinned version before reconnecting. On macOS, `kith install` and `kith setup` register a login LaunchAgent unless `--no-autostart` or `--no-radar` is passed. See [recovery guidance](docs/reliability.md#recovery).
48
-
49
- ### VS Code or Cursor
50
-
51
- Install **Kith** (`kith-coord.kith`) from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=kith-coord.kith) or [Cursor / Open VSX](https://open-vsx.org/extension/kith-coord/kith). You can also search for `kith-coord.kith` in the editor's Extensions view.
52
-
53
- To select release **0.1.8** explicitly with an editor CLI already on your `PATH`:
24
+ Requires **Git 2.38+** and **Node.js 22.13+ on 22.x, or Node.js 24+**.
54
25
 
55
26
  ```sh
56
- code --install-extension kith-coord.kith@0.1.8
57
- cursor --install-extension kith-coord.kith@0.1.8
27
+ npm i -g kith-coord && kith install
58
28
  ```
59
29
 
60
- Use the command for your editor. A marketplace lookup can temporarily select an older version; the [extension guide](extensions/editor/README.md#install) also links the published 0.1.8 VSIX.
30
+ `kith install` puts `kith` on your `PATH` and keeps that runtime outside the npx cache. It writes a global MCP entry for each detected client (`kith mcp --compact`) and installs silent-solo `--auto` hooks for Claude Code and Cursor. One agent stays at **Watching only**. When another writer overlaps, the hooks join Kith. Install does not claim any files. Codex has no native tool hooks, so it uses the MCP tools. Linux and Windows skip the menu bar; use `kith watch`.
61
31
 
62
- Open a trusted local Git checkout and approve Kith's MCP server through the editor. The extension bundles the coordination server, detects Node, and preserves existing MCP entries, hooks and tool permissions. **No global npm install is needed.** It registers the compact tool profile (`kith.mcp.profile`, `compact` by default, or `full`), shows a read-only global hook status note in Output, and adds **Kith: Install Global Hooks & Autostart** (`kith.installGlobal`). The bundled extension does not include the macOS menu-bar helper; run `kith install` from the CLI on macOS for Radar login autostart. Each agent still needs to use Kith's tools; installing the extension alone does not enforce claims on other writers.
32
+ A directory that scans a repository for an MCP server reads the committed [`.mcp.json`](.mcp.json): `npx -y kith-coord mcp` over stdio. That entry does not pin a checkout and does not install hooks. Upgrades, the editor extension, and the client matrix are in [Install](docs/install.md).
63
33
 
64
- Start with a scoped task:
34
+ ### Claude Code plugin
65
35
 
66
- ```text
67
- Use Kith to begin an isolated task in this repository with a unique agent ID.
68
- Claim only the files this task needs, edit the returned worktree, and report edits.
69
- Run the project checks and complete through Kith with that verification command.
70
- ```
71
-
72
- The [extension guide](extensions/editor/README.md) covers settings and existing configurations; [recorded editor checks](docs/client-validation.md#editor-marketplaces-and-signed-in-chats) distinguish installation, native MCP registration and signed-in task results.
73
-
74
- ### CLI and other MCP clients
36
+ When Claude Code is the only client, install the plugin instead of a global npm package. In Claude Code:
75
37
 
76
- Published **0.1.7** configures detected clients and adds project instructions with:
77
-
78
- ```sh
79
- npx --yes --package kith-coord@0.1.8 kith setup
38
+ ```text
39
+ /plugin marketplace add connorhriley/kith
40
+ /plugin install kith@kith
80
41
  ```
81
42
 
82
- **`kith install`** is the one-command onboarding path. `kith setup` remains a compatible alias:
43
+ The plugin runs `npx -y kith-coord` for the same hooks and for an MCP server (`kith mcp --compact`). It does not configure Cursor, Codex, or the menu bar. Using it together with `kith install` is safe: the plugin hooks exit when those Claude hooks are already registered, and `kith doctor` does not treat that as a fault. [Which to use](docs/install.md#which-to-use).
83
44
 
84
- - Configures global MCP servers with the concise **`--compact`** tool profile by default (`kith mcp --compact`, or `--full` for the complete surface).
85
- - Installs global silent-solo `--auto` hooks for **Claude Code** (`~/.claude/settings.json`) and **Cursor** (`~/.cursor/hooks.json`). Solo work stays zero-write (`Watching only`); when concurrent activity overlaps, hooks auto-join Kith and isolate writers into worktrees or leases.
86
- - On **macOS**, installs and starts a login `LaunchAgent` (`dev.kith.radar`) for background menu-bar Radar, and opens the read-only view. `--no-autostart` or `--no-radar` skips the login item. Repeat setup keeps the existing workspace.
87
- - **`kith uninstall`** removes the macOS `LaunchAgent`, global Kith hooks, global MCP entries, retained runtimes and launcher symlinks.
45
+ ## Demo
88
46
 
89
- Note the platform and client boundaries: **Codex CLI** does not expose native pre/post tool hooks, so it coordinates through `--compact` MCP tools and Radar/watcher observations rather than automatic hook interception. **Linux and Windows** skip macOS menu-bar autostart and use `kith watch` for passive supervision.
47
+ ![auth claims src/auth.mjs, billing is refused, auth commits, and kith status lists the claim](assets/demo/claims.gif)
90
48
 
91
- Durable setup starts with **0.1.7** (retaining an exact self-contained runtime outside npx's cache, verifying MCP discovery, and backing up modified files). Existing custom Kith launchers, peer servers, hooks and permissions are preserved. Reconnect the client and approve its MCP server through the client's normal controls.
49
+ Recorded from the real `kith` CLI in a temporary repository. `auth` (Claude Code) claims `src/auth.mjs`. `billing` (Cursor) claims the same path and is refused. `auth` edits the file and `kith commit` records only that file. `kith status` lists both sessions and the claim. Both sessions use this terminal's process id, because the CLI is driving them; two editor processes would show two ids. The claim is still per agent: `billing` does not receive the lock.
92
50
 
93
- Day to day, run `kith` (a read-only status overview in a terminal), `kith status`, `kith brief`, `kith run`, `kith gc`, `kith doctor [path]`, or `kith help --all`. The view says **Watching only** until a task or concurrent overlap is recorded. `kith install --dry-run` and `kith setup --dry-run` preview without writes.
94
-
95
- For source installation and the disposable demo, use the pinned **pnpm 10.20.0**:
51
+ Each `kith begin` is one line from the CLI's claim fields ([`claim.jq`](assets/demo/claim.jq)); the session token is not printed. The owner pid, client, and title are set in the hidden setup, so the typed commands stay short. Reproduce it from a built checkout:
96
52
 
97
53
  ```sh
98
- git clone https://github.com/connorhriley/kith.git
99
- cd kith
100
- corepack enable
101
- pnpm install --frozen-lockfile
102
- pnpm build
103
- ```
104
-
105
- ### See it work
106
-
107
- ```sh
108
- pnpm demo
109
- ```
110
-
111
- The demo starts **two real MCP clients**, gives each a separate Git worktree in a temporary repository, refuses an overlapping claim, records their edits, runs commands under a mutex, and verifies/integrates both changes. It removes the temporary repository afterward. No model calls or client credentials are needed.
112
-
113
- ```text
114
- auth: claimed src/auth.mjs in an isolated worktree
115
- billing: overlapping claim on src/auth.mjs refused
116
- billing: claimed src/billing.mjs in an isolated worktree
117
- auth: checked its worktree through the MCP command supervisor
118
- auth: isolated edit reported, verified, and integrated
119
- billing: checked its worktree through the MCP command supervisor
120
- billing: isolated edit reported, verified, and integrated
121
- Two real MCP clients completed work in separate worktrees. Disposable example passed.
54
+ pnpm build && vhs assets/demo/claims.tape
122
55
  ```
123
56
 
124
- The implementation is in [examples/two-agents.mjs](examples/two-agents.mjs). This demonstrates the coordination protocol; [native-client validation](docs/client-validation.md) separately exercises installed coding clients.
57
+ ## How it works
125
58
 
126
- ### Client support
59
+ Each agent has an id and claims the paths it will change. Kith stores that claim in SQLite under the repository (`.coord/`). An exclusive claim that overlaps a live claim is refused, and no lock is taken. In the default worktrees mode, `--worktree` (MCP `isolateWorktree: true`) checks out a separate Git worktree for the task. `kith mode main` keeps every agent in the shared checkout and still enforces the claims.
127
60
 
128
- The editor extension bundles the server and offers it through native MCP registration; no global npm install is needed. Installing an extension or writing MCP configuration alone does not enforce claims on writers that do not call Kith tools unless global `--auto` hooks are installed for that client. Existing custom Kith entries retain precedence.
129
-
130
- | Client | Setup and behavior |
131
- | --- | --- |
132
- | VS Code / Cursor | Marketplace extension with `kith.mcp.profile` set to `compact` by default; **Kith: Install Global Hooks & Autostart** runs `kith install` |
133
- | Claude Code and Cursor | Detected client configuration through `kith install` or `kith setup`; silent-solo `--auto` hooks join when work overlaps |
134
- | Codex CLI | Detected global MCP configuration (`--compact` by default). Codex CLI has no native tool hooks, so coordination uses MCP tools and Radar or `kith watch` |
135
- | Claude Desktop | Detected MCP configuration via `kith install` / `kith setup` |
136
- | Other MCP clients | stdio server via `kith mcp` (`--compact` or `--full`); client-specific validation required |
61
+ Ports and other shared local resources are separate from file claims. `kith dev` reserves a port, scanning from 3000 unless you set a base. `kith port` reserves one too, scanning from 3100. `kith mutex` runs one command at a time under a named lock, for a package install or a database. `kith commit` commits only the calling session's files, through a temporary Git index, so a shared checkout does not pick up another agent's edits.
137
62
 
138
- Native evidence is version-specific. See [client validation](docs/client-validation.md), [advanced integration setup](docs/integrations.md) and [session ownership](docs/sessions-and-mutexes.md). The npm package is **`kith-coord`** and the command is **`kith`**; the unrelated npm package `kith` is not this project.
63
+ Finishing a worktree task checkpoints the work and integrates through a staging worktree. Pass the project's check. If it fails, or if it changes the staging tree, the integration target is left unchanged and the source worktree remains for repair. With no check, a clean Git merge is the gate. Claims coordinate clients that call Kith, or whose auto hooks have joined. They are not a sandbox for every process on the machine.
139
64
 
140
- ## Dev servers and shared config
141
-
142
- `kith dev` runs a server with its allocated `PORT` and supports explicit `{port}` arguments. File claims also accept an optional bounded wait:
143
-
144
- ```sh
145
- kith dev --agent web-a -- npm run dev -- --port '{port}'
146
- # Within an existing owned session:
147
- kith lock acquire --agent worker-1 --scope package.json --wait --wait-ms 30000
65
+ ```mermaid
66
+ sequenceDiagram
67
+ participant A as Agent A
68
+ participant K as Kith
69
+ participant B as Agent B
70
+ A->>K: claim src/auth.mjs
71
+ K-->>A: exclusive claim, optional worktree
72
+ B->>K: claim src/auth.mjs
73
+ K-->>B: refused, overlap
74
+ A->>K: kith commit, then verify
75
+ K-->>A: integrate, or leave the target unchanged
148
76
  ```
149
77
 
150
- See [dev-server launch and waiting claims](docs/usage.md#launch-a-dev-server-on-its-allocated-port) for framework flags, session setup, cancellation, and MCP usage.
78
+ Coordination stays on this machine. Kith does not call a model API and does not run a hosted service. CLI and MCP clients share `.coord/state.db`. There is no coordination server to leave running.
151
79
 
152
- ## Read-only Radar
80
+ ## Why not just git worktrees?
153
81
 
154
- From 0.1.8, macOS `kith install` and `kith setup` load a `LaunchAgent` (`dev.kith.radar`) so menu-bar Radar runs in the background and restarts across logins for the selected checkout or workspace. It uses the retained installation, so clearing the npx cache does not break it. Repeat runs keep an existing Radar workspace selected. Use **Switch Workspace** in its menu to change it.
82
+ A Git worktree gives each agent a directory and a branch. It does not record who owns a path, so two agents can edit the same files and only collide when someone merges. It does not reserve a dev-server port, serialise a package install, or hold a shared database. It does not run your check before the result is integrated, and it does not carry a note to the next session.
155
83
 
156
- `kith install --no-autostart` (or `--no-radar`) configures MCP and hooks without loading the macOS login agent (useful on headless machines); `--dry-run` never writes or launches anything. Linux and Windows skip the macOS menu-bar app and `LaunchAgent`, using `kith watch` for passive monitoring instead (external IDE `presence.db` discovery is opt-in via `--include-presence`). Remove the login item anytime with `kith uninstall`, or inspect manually with:
84
+ Kith still uses worktrees when you want separate files. The extra state is the claim, the mutex, and the checked integration. `kith mode main` is the same claims without a worktree, for a checkout you would rather share.
157
85
 
158
- ```sh
159
- kith watch /path/to/workspace --once --json
160
- kith menubar /path/to/workspace # macOS 12+, Intel or Apple Silicon
161
- ```
86
+ | | Git worktrees | Kith |
87
+ | --- | --- | --- |
88
+ | Separate working files | One directory and branch per checkout | Optional worktree per task. `kith mode main` stays in one checkout |
89
+ | Overlapping edits | Found when you merge | Exclusive claim refused before the second agent edits |
90
+ | Dev-server ports | Not handled | `kith port` and `kith dev` reserve a port |
91
+ | Shared commands and databases | Not handled | `kith mutex` serialises them |
92
+ | Check before integration | You arrange it | Your check, when you supply one. Failure leaves the target unchanged |
93
+ | Who is working | `git worktree list` | `kith status` and `kith brief`: claims, waits, handoffs |
94
+ | Next session | Nothing carried across | Handoff notes for the same scope |
95
+ | Hosted service | None | None |
162
96
 
163
- The menu and editor lead with recorded tasks, current file claims, shared-resource waits and integrations that need inspection. A registered session without a task is shown separately. Saved checkouts and path comparisons stay in details; nothing is automatically deleted. The menu's default view omits the file-timestamp feed.
97
+ ## How Kith compares
164
98
 
165
- **Watching only** means no active Kith task is recorded. Shared dirty paths are files to review before integration, not a proven merge conflict. **Status unavailable** remains explicit when state cannot be inspected safely. Reads use private snapshots without renewing owners or migrating the original database. See [observation limits](docs/usage.md#optional-read-only-worktree-observations).
99
+ Most multi-agent tools solve the problem by keeping agents apart: a worktree, a container or a VM each. That stops two agents typing into the same directory. It does not stop them changing the same file on different branches, fighting over port 3000, running two package installs at once, or integrating work that has not passed a check. Kith is the layer that handles those, underneath whichever agents and launcher you already use.
166
100
 
167
- ## How a task moves through Kith
101
+ | If you use… | It gives you | Kith adds |
102
+ | --- | --- | --- |
103
+ | [Claude Code `--worktree`](https://code.claude.com/docs/en/worktrees) | A worktree per session under `.claude/worktrees/<name>`, and messages between sessions | That checkout, adopted instead of a second worktree. File claims shared with Codex, Cursor and other MCP clients; port and command locks; integration only after the check you supply passes |
104
+ | [Orca](https://github.com/stablyai/orca), [Orchestrator.inc](https://github.com/OrchestratorInc/agent-orchestrator), [Claude Squad](https://github.com/smtg-ai/claude-squad), [CCManager](https://github.com/kbwo/ccmanager) | An app or TUI that launches agents, each in its own worktree | Adoption of each linked worktree, then ownership of files *across* them, so an overlapping claim is refused before the second cooperating agent edits |
105
+ | [container-use](https://github.com/dagger/container-use) | A container and branch per agent | The same claims and checked integration, without containers. container-use isolates more strongly; Kith only binds agents that cooperate |
106
+ | [claude-bulkhead](https://github.com/dooly6276/claude-bulkhead) | Hooks that block cross-session kills, port clashes, `git add -A` sweeps and RAM overload | Exclusive file claims, a per-agent `kith commit` that records only that session's files, and checked integration. bulkhead covers process and machine safety that Kith does not; they work side by side |
107
+ | [MCP Agent Mail](https://github.com/Dicklesworthstone/mcp_agent_mail_rust) | Agent identities, inboxes and advisory file reservations through a local server | Enforced claims through hooks, worktree isolation and checked integration, with no coordination server to leave running. Agent Mail does messaging; Kith does not |
168
108
 
169
- 0. **Look first.** `kith brief` (or `kith_brief`) shows who is active on what, claims that overlap your scope, open handoffs and conflicts. It is read-only and needs no session.
170
- 1. **Begin through MCP.** Call `kith_begin_work` with a unique `agentId`, explicit `scopeGlobs`, and `isolateWorktree: true`. The connection retains session ownership; no shell exports are needed for this MCP-only workflow.
171
- 2. **Claim a scope.** Cooperating clients receive a conflict when an exclusive claim overlaps another claim.
172
- 3. **Do the work.** Edit the returned `worktree.worktreePath`, report edits with `kith_record_file_edit`, and use `kith_run_with_mutex` for serialized commands. Heartbeat before expiry and keep the owning connection open.
173
- 4. **Leave a handoff.** When you finish, get blocked or must stop, call `kith_write_handoff` with what is done, what remains, what failed and what you learned. `releaseTask` hands the task back to the queue. If a session ends without a note, Kith records what it observed. The next agent on the same scope receives these notes from `kith_begin_work` or `kith_claim_next_task`, labelled as untrusted information to verify.
174
- 5. **Verify and complete.** For a worktree, Kith checkpoints changes and integrates through a separate staging worktree. The target may hold unrelated uncommitted work, but not edits to files the integration changes. Supply a verification command to check more than Git mergeability.
109
+ What Kith isn't: it does not launch agents, choose models or provide a control dashboard, and it is not a sandbox. The menu bar and editor views are read-only status. Claims bind agents that call Kith or whose hooks have joined. Native edit-blocking hooks are for Claude Code and Cursor; other clients use the MCP tools. Kith adopts a worktree another tool already created when that session is inside it, or when you run `kith adopt`. It does not delete that directory. A claim stays on the repository path, so two worktrees cannot both own the same file. Kith can still create its own worktree when you ask it to.
175
110
 
176
- Failed verification leaves the target unchanged and keeps the worktree for repair. Successful integration also retains the worktree until explicit cleanup. External Git writers must still coordinate.
111
+ A port or command lock applies when the agent uses `kith dev`, `kith port`, or `kith mutex` (or the optional package-manager shims). The hook does not take that lock for an ordinary shell command. With no check supplied, worktree integration still requires a clean Git merge and leaves the target unchanged when that merge conflicts. The commands are in [Adopt a worktree](docs/usage.md#adopt-a-worktree-that-already-exists).
177
112
 
178
- Inspect through `kith_get_status` or `kith status`: worktree paths/branches, dirty-file overlap, ahead/behind, heartbeat/commit age and FIFO waiters are included. Use `kith_preview_integrate` for committed-tree conflict paths before completing. Normal status may reap expired owners. For non-mutating recovery inspection use:
113
+ ## What Kith does
179
114
 
180
- ```sh
181
- kith status --offline
182
- kith recover
183
- kith doctor
184
- ```
115
+ | Need | Kith provides |
116
+ | --- | --- |
117
+ | Keep tasks from overlapping | Scoped claims with conflict responses |
118
+ | Give agents separate working files | A worktree Kith creates, or one it adopts from Claude Code, Claude Squad, CCManager, Orca, or Orchestrator.inc |
119
+ | Check work before integration | Your project's check, when you supply one |
120
+ | Share local tools | Port reservations and supervised command mutexes |
121
+ | Know what is going on before you start | `kith brief`: who is active on what, overlapping claims, open handoffs and conflicts. Read-only, no session needed |
122
+ | Work the way you do | Worktree isolation, or one shared checkout with scope claims (`kith mode main`) |
123
+ | Keep what an agent learned | Handoff notes that survive a session boundary and reach whoever works the same scope next |
124
+ | See what is happening | Session and task state through CLI and MCP; optional read-only editor and menu-bar views |
185
125
 
186
- Optional Claude/Cursor hooks support `--enforcement block` (default), `warn` and `off`; see [setup and safe uninstall](docs/integrations.md). The [versioned protocol](docs/protocol.md) records the tool schemas and ownership semantics.
126
+ The [reliability contract](docs/reliability.md) is the boundary: ownership, checks, recovery, and what is not enforced. Scope matching follows a [documented grammar](docs/path-and-scope-rules.md). Contract-change reports and exact-name reuse hints are advisory.
187
127
 
188
- For MCP, CLI and library examples, see [workflows](docs/usage.md).
128
+ Day to day: `kith`, `kith status`, `kith brief`, `kith run`, `kith gc`, `kith doctor`, or `kith help --all`. A task moves through begin, claim, edit, handoff, and complete; the commands are in [Workflows](docs/usage.md#how-a-task-moves-through-kith). Dev servers, waiting claims, and Radar are in [Install](docs/install.md) and [Usage](docs/usage.md).
189
129
 
190
130
  ## Project status
191
131
 
192
- The suite exercises process contention, session ownership, command cancellation and disconnects, generated hooks, MCP workflows, and worktree integration. Clean-package checks install the built distribution in a separate consumer project. Native-client reports include exact versions and outcomes.
193
-
194
- The CI badge links to current hosted results; local tests and recorded native runs do not establish that every platform or client release passes. Repository discovery, physical path checks, exact supported glob matching and Git conflict refusal have dedicated regressions. Recovery checks cover interrupted upgrades, stopped database/WAL backups and retained worktree continuation. The [reliability contract](docs/reliability.md) records the boundaries of those scenarios; native-client coverage is listed above.
132
+ The suite exercises process contention, session ownership, command cancellation and disconnects, generated hooks, MCP workflows, and worktree integration. The CI badge is the current hosted result. Local tests do not establish that every platform or client release passes.
195
133
 
196
- - [Reliability contract](docs/reliability.md): behavior, boundaries, and recovery
134
+ - [Reliability contract](docs/reliability.md): behaviour, boundaries, and recovery
197
135
  - [Architecture](docs/architecture.md): storage, adapters, and Git integration
198
136
  - [Roadmap](docs/roadmap.md): priorities and completion gates
199
- - [Changelog](CHANGELOG.md): behavior changes and migration notes
137
+ - [Changelog](CHANGELOG.md): behaviour changes and migration notes
138
+ - [Client validation](docs/client-validation.md): version-specific native evidence
200
139
 
201
140
  ## Contributing
202
141
 
203
- The most useful contributions reproduce a concrete failure or improve a real multi-agent workflow. Include a disposable fixture, expected behavior, and a way to verify the change. Start with [contributor setup and entry points](CONTRIBUTING.md).
142
+ The most useful contributions reproduce a concrete failure or improve a real multi-agent workflow. Include a disposable fixture, expected behaviour, and a way to verify the change. Start with [contributor setup and entry points](CONTRIBUTING.md).
204
143
 
205
144
  For bugs, use the [bug report form](https://github.com/connorhriley/kith/issues/new?template=bug_report.yml). For a proposed workflow, use the [feature request form](https://github.com/connorhriley/kith/issues/new?template=feature_request.yml). Keep tokens, source snapshots, and `.coord` state out of public diagnostics; use the [security reporting guidance](SECURITY.md) for sensitive reports.
206
145
 
@@ -0,0 +1,5 @@
1
+ if .ok then
2
+ "✓ claimed: \(.locks[0].pattern) (\(.locks[0].mode), \(.locks[0].owner_agent_id))"
3
+ else
4
+ "✗ refused: \(.lockConflicts[0].requestedPattern) is held by \(.lockConflicts[0].ownerAgentName) (\"\(.lockConflicts[0].ownerIntent)\")"
5
+ end
Binary file
@@ -0,0 +1,59 @@
1
+ # Short CLI recording for the README.
2
+ #
3
+ # From the repository root, after `pnpm build` (needs vhs, ttyd, git, node, jq):
4
+ # vhs assets/demo/claims.tape
5
+ #
6
+ # Visible commands stay short. assets/demo/prepare.sh (sourced inside Hide)
7
+ # creates /tmp/shop, selects main mode, and wraps `kith begin` so the owner
8
+ # pid, client, and title are not typed. claim.jq prints one line from the
9
+ # real claim JSON and drops the session token. Commit and status are the
10
+ # CLI's own human text. The file edit happens in that hidden setup.
11
+
12
+ Output assets/demo/claims.gif
13
+
14
+ Require node
15
+ Require git
16
+ Require jq
17
+
18
+ Set Shell "bash"
19
+ Set FontFamily "JetBrains Mono"
20
+ Set FontSize 24
21
+ Set LineHeight 1.2
22
+ Set Width 1280
23
+ Set Height 760
24
+ Set Padding 28
25
+ Set Theme "Catppuccin Mocha"
26
+ Set TypingSpeed 50ms
27
+ Set Framerate 20
28
+ Set WindowBar Colorful
29
+
30
+ Hide
31
+ Type "source assets/demo/prepare.sh"
32
+ Enter
33
+ Type "clear"
34
+ Enter
35
+ Show
36
+
37
+ Type "# agent auth"
38
+ Enter
39
+ Type "kith begin --agent auth --scope src/auth.mjs"
40
+ Enter
41
+ Sleep 1.1s
42
+
43
+ Type "# agent billing"
44
+ Enter
45
+ Type "kith begin --agent billing --scope src/auth.mjs"
46
+ Enter
47
+ Sleep 1.8s
48
+ Screenshot assets/demo/refusal.png
49
+
50
+ Type "# agent auth"
51
+ Enter
52
+ Type "kith commit --agent auth -m 'Add a login check' src/auth.mjs"
53
+ Enter
54
+ Sleep 1.3s
55
+
56
+ Type "kith status"
57
+ Enter
58
+ Sleep 4.5s
59
+ Screenshot assets/demo/status.png
@@ -0,0 +1,63 @@
1
+ # Sourced from the repository root by assets/demo/claims.tape.
2
+ # Expects dist/cli/index.js from `pnpm build`. Prepares /tmp/shop.
3
+ # Do not execute this file: the kith wrapper has to stay in the tape's shell.
4
+ #
5
+ # The wrapper keeps the typed commands short. For `kith begin` it adds the
6
+ # owner pid, client, and title, then prints one line from the CLI JSON.
7
+ # Commit and status go to the real CLI, which already prints human text on a TTY.
8
+
9
+ if [[ ! -f dist/cli/index.js ]]; then
10
+ echo "Build the CLI first: pnpm build" >&2
11
+ return 1 2>/dev/null || exit 1
12
+ fi
13
+
14
+ export KITH_SRC=$PWD
15
+ mkdir -p /tmp/kith-bin
16
+ cat > /tmp/kith-bin/kith << EOF
17
+ #!/bin/sh
18
+ exec node "$KITH_SRC/dist/cli/index.js" "\$@"
19
+ EOF
20
+ chmod +x /tmp/kith-bin/kith
21
+ export PATH="/tmp/kith-bin:$PATH"
22
+
23
+ unset PROMPT_COMMAND
24
+ PS1='shop $ '
25
+
26
+ cd /tmp
27
+ rm -rf shop
28
+ mkdir shop
29
+ cd shop
30
+ git init -q -b main
31
+ git config user.email "demo@kith.local"
32
+ git config user.name "Kith demo"
33
+ mkdir -p src
34
+ printf '%s\n' 'export function login() { return false; }' > src/auth.mjs
35
+ printf '%s\n' 'export function charge() { return 0; }' > src/billing.mjs
36
+ printf '%s\n' '.coord/' > .gitignore
37
+ git add .
38
+ git commit -q -m "Initial modules"
39
+ kith mode main >/dev/null
40
+ # Auth's later commit records this edit. It stays off screen so the typed steps are the claims, the commit, and status.
41
+ printf '%s\n' 'export function login() { return true; }' > src/auth.mjs
42
+
43
+ kith() {
44
+ if [[ "${1:-}" == begin ]]; then
45
+ shift
46
+ local agent="" scope="" title="Active work" client="cli"
47
+ while [[ $# -gt 0 ]]; do
48
+ case "$1" in
49
+ --agent) agent=$2; shift 2 ;;
50
+ --scope) scope=$2; shift 2 ;;
51
+ *) shift ;;
52
+ esac
53
+ done
54
+ case "$agent" in
55
+ auth) title="Add a login check"; client="claude-code" ;;
56
+ billing) title="Change the login check"; client="cursor" ;;
57
+ esac
58
+ command kith begin --agent "$agent" --client "$client" --owner-pid "$$" --title "$title" --scope "$scope" \
59
+ | jq -r -f "$KITH_SRC/assets/demo/claim.jq"
60
+ return "${PIPESTATUS[0]}"
61
+ fi
62
+ command kith "$@"
63
+ }
package/bin/kith-menubar CHANGED
File without changes