kith-coord 0.1.8 → 0.1.9
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 +9 -0
- package/CONTRIBUTING.md +7 -1
- package/README.md +7 -7
- package/bin/kith-menubar +0 -0
- package/dist/cli/index.js +3139 -796
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +46 -2
- package/dist/index.js +2171 -375
- package/dist/index.js.map +1 -1
- package/docs/architecture.md +1 -1
- package/docs/integrations.md +4 -4
- package/docs/sessions-and-mutexes.md +28 -2
- package/package.json +26 -16
- package/server.json +2 -2
package/docs/architecture.md
CHANGED
|
@@ -18,7 +18,7 @@ Kith runs locally. There is no coordination server: CLI and MCP clients share `.
|
|
|
18
18
|
| `brief.ts` | The read-only situational summary shared by the offline reader, the CLI and the MCP tool |
|
|
19
19
|
| `mode.ts` | Repository workflow mode: `worktrees` or `main` |
|
|
20
20
|
| `handoffs.ts`, `handoff-store.ts` | Notes that survive a session boundary: written by agents, recorded by Kith when a session ends without one, delivered by task and scope overlap; storage is DB-only so it is safe inside reclaim and completion transactions |
|
|
21
|
-
| `bash-guard.ts` | Best-effort snapshots
|
|
21
|
+
| `bash-guard.ts` | Best-effort snapshots, quarantine recovery, and the shared-ref firewall |
|
|
22
22
|
| `broker.ts` | Port reservations, FIFO mutex tickets, renewable command leases and process-group guards |
|
|
23
23
|
|
|
24
24
|
`engine.ts` shares begin/complete orchestration across adapters. `src/cli` adapts commands and hook payloads. `src/mcp/server.ts` exposes tools. Library consumers use `src/index.ts` exports and close engines explicitly.
|
package/docs/integrations.md
CHANGED
|
@@ -61,7 +61,7 @@ kith init --only claude,cursor,git,agents --enforcement block --dry-run
|
|
|
61
61
|
kith init --only claude,cursor,git,agents --enforcement block
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
`block` is the default for optional hooks: conflicting native file writes are denied; unclaimed files are claimed before writes. Risky recognized Git commands are refused while they could replace a peer's shared checkout or shared refs. `warn` permits policy conflicts and returns warnings; it never steals the peer's claim or attributes their file to the warning agent. `off` skips claim/risky-command enforcement. All modes still require valid session ownership and contained file paths. This switch affects hooks, not MCP/CLI ownership, locks or integration checks. Rerun init with a different mode to update recognized Kith hooks without duplicating them or deleting unrelated hooks.
|
|
64
|
+
`block` is the default for optional hooks: conflicting native file writes are denied; unclaimed files are claimed before writes. Risky recognized Git commands are refused while they could replace a peer's shared checkout or shared refs. In an isolated worktree, `git update-ref` of `HEAD` or that worktree's own branch is allowed when no other active agent shares the worktree or the branch. In a shared checkout, a compare-and-swap `update-ref` of `HEAD` or the current branch is allowed only when it is a one-commit fast-forward of the caller's own files; shell variables in that shape are checked after the command and reverted when the check fails. Updates to another agent's branch, stdin batches, merges, missing compare-and-swap values, and ref commands the guard cannot parse stay refused. See [committing while other sessions are active](sessions-and-mutexes.md). `warn` permits policy conflicts and returns warnings; it never steals the peer's claim or attributes their file to the warning agent. `off` skips claim/risky-command enforcement. All modes still require valid session ownership and contained file paths. This switch affects hooks, not MCP/CLI ownership, locks or integration checks. Rerun init with a different mode to update recognized Kith hooks without duplicating them or deleting unrelated hooks.
|
|
65
65
|
|
|
66
66
|
Cursor's native `preToolUse`/`postToolUse` adapter handles `Shell`, `Write` and `Delete` matcher payloads, returns Cursor permission/context JSON, and sets `failClosed:true` on pre-hooks. The generated Claude pre-hook uses `onFailure:"block"`. These fields depend on client versions; see [Cursor's hook reference](https://cursor.com/docs/hooks), [Claude's hook reference](https://code.claude.com/docs/en/hooks), and the [validation matrix](client-validation.md). A pattern-based shell guard cannot parse every shell program or prevent bypasses. Worktrees remain the recommended default.
|
|
67
67
|
|
|
@@ -81,12 +81,12 @@ Uninstall restores the exact original bytes/permissions or deletes files created
|
|
|
81
81
|
|
|
82
82
|
## Registry installation
|
|
83
83
|
|
|
84
|
-
The package is `kith-coord`, and its binary remains `kith`. Install it persistently (`npm install --global kith-coord@0.1.
|
|
84
|
+
The package is `kith-coord`, and its binary remains `kith`. Install it persistently (`npm install --global kith-coord@0.1.9`) before `kith init`, because generated configurations launch `kith` on PATH. Invoking init through npx alone does not create that persistent executable.
|
|
85
85
|
|
|
86
86
|
An MCP client can instead use a pinned registry launcher without a global install:
|
|
87
87
|
|
|
88
88
|
```json
|
|
89
|
-
{"mcpServers":{"kith":{"command":"npx","args":["--yes","--package","kith-coord@0.1.
|
|
89
|
+
{"mcpServers":{"kith":{"command":"npx","args":["--yes","--package","kith-coord@0.1.9","kith","mcp","--repo","/absolute/checkout"]}}}
|
|
90
90
|
```
|
|
91
91
|
|
|
92
92
|
Use a version you have verified; the unrelated npm package named `kith` is not Kith's distribution. Hook commands still need their configured executable to remain available. The clean-package smoke check exercises the installed binary, library, supervised worker and actual MCP discovery/status in a separate consumer.
|
|
@@ -99,7 +99,7 @@ Version 0.1.1 generates MCP configuration using the current absolute Node execut
|
|
|
99
99
|
|
|
100
100
|
## Configure detected local clients
|
|
101
101
|
|
|
102
|
-
From 0.1.7, `npx --yes --package kith-coord@0.1.
|
|
102
|
+
From 0.1.7, `npx --yes --package kith-coord@0.1.9 kith setup /absolute/checkout` is the single setup path. Versions through 0.1.6 need a persistent npm installation first. Setup retains the exact bundled runtime under `~/.local/share/kith/runtimes/`, validates actual MCP discovery without selecting a repository, configures supported detected clients and adds marked project guidance. Clearing the original npx cache does not break its launcher. Repeat setup reuses identical content. `kith install` removes retained runtimes 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 refused rather than overwritten. Custom launchers remain custom. `kith doctor` fails when one of those configs points at a different Kith version than the CLI you just ran, and tells you to run `kith install`.
|
|
103
103
|
|
|
104
104
|
**From 0.1.8,** `kith install` is the single onboarding command and `kith setup` remains an alias. Both retain the runtime above, and on macOS they open read-only Radar and register a login LaunchAgent (`dev.kith.radar`) unless `--no-radar` or `--no-autostart` is passed. Repeating setup keeps an existing view and its selected workspace; use its **Switch Workspace** menu to change projects. `--dry-run` previews without launching. Linux and Windows skip the menu-bar view and use `kith watch`. Radar makes no model calls. A Radar startup failure is reported with a nonzero exit while preserving completed client setup; rerun after resolving the error. `kith uninstall` removes the LaunchAgent, global hooks and global MCP entries it recorded.
|
|
105
105
|
|
|
@@ -47,9 +47,11 @@ kith session clear --conflicts # only delete recorded conflicts, ke
|
|
|
47
47
|
|
|
48
48
|
When a client with `--auto` hooks also registers an MCP session (`kith_begin_work` or `kith_work`), Kith automatically binds the MCP capability to the parent client's `presence.db` session and transfers any locks held by its `auto-*` agent ID so subsequent hook calls and MCP calls share a single session.
|
|
49
49
|
|
|
50
|
-
## Committing
|
|
50
|
+
## Committing while other sessions are active
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
The Bash guard refuses Git commands that can replace another session's checkout or refs.
|
|
53
|
+
|
|
54
|
+
In a shared checkout (`kith mode main`, or any checkout another active session is also using), `git reset`, `git checkout`, and the other recognized checkout-rewriting commands are blocked while a peer is active. A compare-and-swap `git update-ref` of `HEAD` or `refs/heads/<the current branch>` is allowed when the pre-hook can prove it is a fast-forward of exactly one commit and every changed path belongs to the caller. The same shape with shell variables is checked after the command and reverted if that proof fails. Anything else, including an `update-ref` with no old value, stays blocked. To commit only your own files there, run:
|
|
53
55
|
|
|
54
56
|
```sh
|
|
55
57
|
kith commit -m "feat: scoped change" [files...]
|
|
@@ -57,6 +59,30 @@ kith commit -m "feat: scoped change" [files...]
|
|
|
57
59
|
|
|
58
60
|
If `[files...]` is omitted, `kith commit` collects the caller session's recorded modified files (from active file/narrow-glob locks, `presence.db` touched files, and active task scopes), verifies no target file is locked by another live agent, stages only those paths in a temporary index under `.coord/commit.lock`, advances `HEAD` with compare-and-swap `git update-ref`, and runs `git reset -q HEAD -- <files>` so `.git/index` stays synchronized with `HEAD` without touching peers' dirty files. You can also run `kith commit` inside `kith_run_with_mutex` / `kith_resource` (`action: "mutex"`) or pass `commitMessage` (and optional `commitFiles`) to `kith_finish`.
|
|
59
61
|
|
|
62
|
+
In an isolated worktree the guard allows `git update-ref` when the ref belongs only to the caller. That means the caller has `worktree_path`, the ref is `HEAD` or `refs/heads/<that worktree's branch>` checked out in the worktree, and no other active agent shares the worktree or the branch. A temporary-index commit in that worktree (`git commit-tree`, then `git update-ref HEAD <new> <old>`) is allowed, including with `-m <msg>`, `--no-deref`, and `--create-reflog`. `git -C <dir>` is resolved from the worktree; a `-C` or `cd` that leaves the worktree does not count as owned. `git update-ref -d` is allowed only for a ref the caller owns.
|
|
63
|
+
|
|
64
|
+
In a shared checkout the same temporary-index shape is allowed only after the pre-hook checks all of the following, before the command runs:
|
|
65
|
+
|
|
66
|
+
- the command is `git update-ref` with optional `-m`, `--no-deref`, and `--create-reflog`, and the ref is `HEAD` or `refs/heads/<the branch checked out in that directory>`
|
|
67
|
+
- `<old>` is present and resolves to the ref's current value (a compare-and-swap)
|
|
68
|
+
- `<new>` resolves to a commit with exactly one parent, and that parent is `<old>` (one fast-forward commit; merges and history rewrites are refused)
|
|
69
|
+
- every path in `git diff-tree -r --name-only` from `<old>` to `<new>`, including deletions and both sides of a rename, is a file the caller has claimed, locked, or recorded the way `kith commit` records files (active file and narrow-glob locks, `presence.db` touched files, and active task scopes; a `**` lock does not count). No changed path may be locked or claimed by another active agent
|
|
70
|
+
|
|
71
|
+
`<new>` and `<old>` may be literal SHAs or other revisions that resolve at check time. Shell variables and command substitutions such as `$(git commit-tree ...)` are not executed during the pre-hook, so the commit they will create cannot be read yet. When the command is still exactly that compare-and-swap shape, the pre-hook records the current ref value and lets the command run. The post-hook then applies the same parent and path checks to the commit that landed. If they fail, it compare-and-swaps the ref back to the recorded value and prints the reason, including a `kith commit -m "<message>" <files>` command built from the caller's recorded files. A short lease keeps other agents from moving the same ref until that post-hook finishes: their ref-moving commands are refused, and `kith commit` waits, so a peer does not build on a commit that is about to be reverted. If the reverting compare-and-swap loses to a later update, the hook reports that and does not force the ref.
|
|
72
|
+
|
|
73
|
+
A blocked command keeps the existing `kith commit` guidance and adds the specific reason, for example `No compare-and-swap old value` or `path src/x.ts is claimed by agent peer`. When the caller has recorded dirty files, the message includes a ready-to-run `kith commit -m "<message>" <those files>`.
|
|
74
|
+
|
|
75
|
+
These stay blocked while a peer is active:
|
|
76
|
+
|
|
77
|
+
- updates to the integration branch from an isolated worktree, or to another agent's branch
|
|
78
|
+
- a shared-checkout `update-ref` with no `<old>`, a merge or multi-commit jump, a path the caller does not own, or a path another agent claims
|
|
79
|
+
- `HEAD` updates that are not the one-commit fast-forward above, including `--no-deref` on a symbolic `HEAD` (that would retarget the symlink instead of the branch)
|
|
80
|
+
- `git update-ref --stdin` batches, `update-ref -d`, and any ref command the parser cannot classify
|
|
81
|
+
- `git symbolic-ref`, except a read or pointing the caller's own `HEAD` at `refs/heads/<the caller's branch>`
|
|
82
|
+
- `git worktree remove`, `git worktree prune`, and `git branch` `-d`/`-D`/`-m`/`-M`/`-f`/`--delete`/`--move`/`--force`
|
|
83
|
+
|
|
84
|
+
After `update-ref`, the post-hook resyncs the index of the checkout that command ran in: the caller's worktree, the directory selected with `-C` when that checkout belongs to the same repository, or the checkout named by a compare-and-swap `update-ref` whose values are shell variables.
|
|
85
|
+
|
|
60
86
|
## MCP ownership
|
|
61
87
|
|
|
62
88
|
`kith_begin_work`, `kith_claim_next_task`, and `kith_start_session` return a session token when they register or resume a session. A single stdio connection retains its granted capabilities internally. Another connection must explicitly present the capability to resume the same live ID. All agent-scoped mutation tools accept an optional `sessionToken`; a mixed CLI/hook/MCP client can inherit `KITH_AGENT_ID` and `KITH_SESSION_TOKEN` instead.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kith-coord",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Local coordination for cooperating coding agents: work claims, isolated worktrees, shared resources, and verified integration without a hosted service.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -31,6 +31,23 @@
|
|
|
31
31
|
"engines": {
|
|
32
32
|
"node": "^22.13.0 || >=24.0.0"
|
|
33
33
|
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsup",
|
|
36
|
+
"dev": "tsup --watch",
|
|
37
|
+
"test": "tsup && vitest run",
|
|
38
|
+
"test:watch": "tsup && vitest",
|
|
39
|
+
"typecheck": "tsc --noEmit",
|
|
40
|
+
"check": "pnpm typecheck && pnpm test",
|
|
41
|
+
"prepack": "tsup && node scripts/build-menubar.mjs --if-supported",
|
|
42
|
+
"test:package": "pnpm build && node scripts/smoke-package.mjs",
|
|
43
|
+
"demo": "pnpm build && node examples/two-agents.mjs",
|
|
44
|
+
"test:clients": "pnpm build && node scripts/validate-native-clients.mjs",
|
|
45
|
+
"protocol:export": "pnpm build && node scripts/export-protocol.mjs",
|
|
46
|
+
"protocol:check": "node scripts/export-protocol.mjs --check",
|
|
47
|
+
"release:check": "node scripts/check-release-manifest.mjs",
|
|
48
|
+
"build:menubar": "node scripts/build-menubar.mjs",
|
|
49
|
+
"test:menubar": "node scripts/test-menubar.mjs"
|
|
50
|
+
},
|
|
34
51
|
"keywords": [
|
|
35
52
|
"ai-agents",
|
|
36
53
|
"parallel-agents",
|
|
@@ -57,6 +74,7 @@
|
|
|
57
74
|
"vitest": "^3.0.7",
|
|
58
75
|
"typescript": "^5.8.2"
|
|
59
76
|
},
|
|
77
|
+
"packageManager": "pnpm@10.20.0",
|
|
60
78
|
"repository": {
|
|
61
79
|
"type": "git",
|
|
62
80
|
"url": "git+https://github.com/connorhriley/kith.git"
|
|
@@ -70,19 +88,11 @@
|
|
|
70
88
|
"registry": "https://registry.npmjs.org"
|
|
71
89
|
},
|
|
72
90
|
"mcpName": "io.github.connorhriley/kith",
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"check": "pnpm typecheck && pnpm test",
|
|
80
|
-
"test:package": "pnpm build && node scripts/smoke-package.mjs",
|
|
81
|
-
"demo": "pnpm build && node examples/two-agents.mjs",
|
|
82
|
-
"test:clients": "pnpm build && node scripts/validate-native-clients.mjs",
|
|
83
|
-
"protocol:export": "pnpm build && node scripts/export-protocol.mjs",
|
|
84
|
-
"protocol:check": "node scripts/export-protocol.mjs --check",
|
|
85
|
-
"build:menubar": "node scripts/build-menubar.mjs",
|
|
86
|
-
"test:menubar": "node scripts/test-menubar.mjs"
|
|
91
|
+
"pnpm": {
|
|
92
|
+
"overrides": {
|
|
93
|
+
"@hono/node-server": "~2.1.8",
|
|
94
|
+
"fast-uri": "~3.1.9",
|
|
95
|
+
"hono": "~4.13.18"
|
|
96
|
+
}
|
|
87
97
|
}
|
|
88
|
-
}
|
|
98
|
+
}
|
package/server.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "io.github.connorhriley/kith",
|
|
4
4
|
"title": "Kith",
|
|
5
5
|
"description": "Coordinate coding agents with work claims, Git worktrees, shared resources and verified integration.",
|
|
6
|
-
"version": "0.1.
|
|
6
|
+
"version": "0.1.9",
|
|
7
7
|
"repository": {
|
|
8
8
|
"url": "https://github.com/connorhriley/kith",
|
|
9
9
|
"source": "github"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"registryType": "npm",
|
|
24
24
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
25
25
|
"identifier": "kith-coord",
|
|
26
|
-
"version": "0.1.
|
|
26
|
+
"version": "0.1.9",
|
|
27
27
|
"runtimeHint": "npx",
|
|
28
28
|
"runtimeArguments": [
|
|
29
29
|
{
|