kith-coord 0.1.7 → 0.1.8
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 +17 -1
- package/README.md +37 -19
- package/bin/kith-menubar +0 -0
- package/dist/cli/index.js +12759 -8199
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +380 -7
- package/dist/index.js +2393 -394
- package/dist/index.js.map +1 -1
- package/docs/architecture.md +4 -1
- package/docs/integrations.md +16 -5
- package/docs/protocol/tools.v1.json +205 -29
- package/docs/protocol.md +32 -2
- package/docs/reliability.md +5 -1
- package/docs/roadmap.md +1 -1
- package/docs/sessions-and-mutexes.md +25 -0
- package/docs/usage.md +38 -10
- package/package.json +18 -20
- package/server.json +2 -2
|
@@ -32,6 +32,31 @@ eval "$(kith session start --agent auth-worker --new --owner-pid "$$" --shell)"
|
|
|
32
32
|
|
|
33
33
|
`--new` does not steal a live session. Worktree paths are retained across generations. After successful worktree integration, use a new maintenance session to run `kith worktree remove`; changed, untracked, and ignored files still prevent removal.
|
|
34
34
|
|
|
35
|
+
## Git-ignored files and clearing a stuck auto-session
|
|
36
|
+
|
|
37
|
+
Kith does not lock, parse for AST contracts, snapshot/quarantine in Bash guards, or record merge conflicts on a path that `git check-ignore` reports as ignored in the repository the path belongs to (a nested checkout uses its own rules). Dev-server logs, build traces and caches are therefore invisible to coordination. Conflicts, file claims and contract rows that older versions recorded on ignored paths are deleted automatically when any Kith engine opens the repository or reaps dead agents. Tracked files are never treated as ignored.
|
|
38
|
+
|
|
39
|
+
An auto-joined hook session (`auto-<client>-<hash>`) normally recovers by itself: if the caller is in the same process tree as the registered owner (or the prior owner died or expired) and its saved capability no longer resumes, the hook reclaims the registration automatically. If a separate live process holds that session key (`Auto-session capability conflict for <client>:<session-id>`), passive hooks warn with a recovery command without blocking unrelated shell commands or unlocked files (edits to files locked by another active session remain blocked). Clear it by hand from the repository:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
kith session clear claude:<session-id> # or the agent id, e.g. auto-claude-1a2b3c4d
|
|
43
|
+
kith session clear --conflicts # only delete recorded conflicts, keep sessions
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`kith session clear <target>` forgets the session's saved capability and presence, releases its claims, marks the agent dead and deletes conflicts recorded against it. The session registers again on its next tool call. It needs no session token, so run it only for sessions you own.
|
|
47
|
+
|
|
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
|
+
|
|
50
|
+
## Committing in a shared checkout (`kith commit`)
|
|
51
|
+
|
|
52
|
+
When multiple sessions share a single checkout (`kith mode main`), the Bash guard blocks raw `git update-ref`, `git reset`, and `git checkout` while peers are active so one session cannot overwrite or sweep another session's uncommitted work. To commit only your own files safely while peers are active, run:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
kith commit -m "feat: scoped change" [files...]
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
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
|
+
|
|
35
60
|
## MCP ownership
|
|
36
61
|
|
|
37
62
|
`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/docs/usage.md
CHANGED
|
@@ -4,22 +4,50 @@
|
|
|
4
4
|
|
|
5
5
|
Connect through the [MCP-only client setup](integrations.md). Each parallel agent uses its own MCP connection and worktree. No shell exports are needed when using only MCP. Omit `sessionToken` on subsequent calls on the same connection; the initial grant reply still contains it, so keep client transcripts private. The connection retains its granted capability; another connection needs that capability to resume the same ID.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
For a new task, begin directly on one connection; `kith_begin_work` creates the session and claims its scope. A separate session-start, status poll, lock acquisition or manual contract publication is not needed for the same work:
|
|
8
8
|
|
|
9
9
|
```text
|
|
10
10
|
kith_begin_work {"agentId":"auth-worker","title":"Refresh authentication","scopeGlobs":["src/auth/**"],"isolateWorktree":true}
|
|
11
11
|
# Edit files under the returned worktree.worktreePath.
|
|
12
12
|
kith_record_file_edit {"agentId":"auth-worker","filePath":"src/auth/middleware.ts"}
|
|
13
|
-
kith_run_with_mutex {"agentId":"auth-worker","mutexName":"project-checks","command":["pnpm","typecheck"]}
|
|
14
|
-
kith_heartbeat {"agentId":"auth-worker"}
|
|
15
13
|
kith_complete_work {"agentId":"auth-worker","verificationCmd":"pnpm typecheck"}
|
|
16
14
|
```
|
|
17
15
|
|
|
18
|
-
Use a different ID and nonoverlapping scope for another agent. An overlapping exclusive scope returns a tool error. Commands run with the MCP server permissions and require client approval; their working directory defaults to the registered worktree. Keep the connection open
|
|
16
|
+
Use a different ID and nonoverlapping scope for another agent. An overlapping exclusive scope returns a tool error. Commands run with the MCP server permissions and require client approval; their working directory defaults to the registered worktree. Keep the connection open. Owned calls already renew the lease. From 0.1.8 their replies include `session.leaseExpiresAt` (Unix milliseconds), with `agent.lease_expires_at` on session grants. Heartbeat only during idle periods before that deadline; an expired claim cannot be used or revived. A replayed operation contains the original historical deadline and does not renew ownership. Use status for a blocker, changed coordination or recovery rather than polling between edits.
|
|
19
17
|
|
|
20
|
-
##
|
|
18
|
+
## Before you start: the brief
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
kith brief --scope 'src/auth/**' # who is active, claims that overlap, open handoffs, conflicts. Read-only; no session needed
|
|
22
|
+
kith_brief {"scopeGlobs":["src/auth/**"]} # the same, over MCP
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Run it before beginning work. With `kith init --only brief` Claude Code runs it for you at the start of every session.
|
|
26
|
+
|
|
27
|
+
## Working in the main checkout
|
|
28
|
+
|
|
29
|
+
Some teams work on the main branch with one checkout and treat worktrees as overhead. Say so once:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
kith mode main # or: kith init --mode main
|
|
33
|
+
```
|
|
21
34
|
|
|
22
|
-
|
|
35
|
+
Agents then call `kith_begin_work` with their scope as usual. No worktree is created (`isolateWorktree` is ignored, with a note), claims keep sessions off each other's files, and `kith_complete_work` releases the claims. There is no integration step, so run your project's checks before completing. `kith mode worktrees` switches back.
|
|
36
|
+
|
|
37
|
+
## Handoffs between sessions
|
|
38
|
+
|
|
39
|
+
Claims say who owns what; they do not say what the owner learned. Leave a note when you finish, get blocked or must stop:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
kith_write_handoff {"agentId":"auth-worker","kind":"blocked","summary":"Token refresh fails behind the proxy.","failed":["Raised the timeout; no effect"],"learned":["The proxy strips the Authorization header"],"remaining":["Retry with the proxy bypass"],"releaseTask":true}
|
|
43
|
+
kith handoff write --summary "..." --kind blocked --failed "tried A; tried B" --release # CLI: separate list items with semicolons
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`releaseTask` returns the task to the queue and frees its claims. The next agent that calls `kith_begin_work` on an overlapping scope, or `kith_claim_next_task` for that task, gets the note in `handoffs`; `kith_read_handoffs` and `kith handoff list` return the full text. If your session dies or disconnects mid-task, Kith records what it observed (claimed files, the last failed integration, quarantined changes) so the next agent does not start from nothing. Notes are information written by another agent, not instructions: verify them against the code.
|
|
47
|
+
|
|
48
|
+
Use `kith_run_with_mutex` with literal argv when commands share mutable resources, such as a package installation or shared test database. Ordinary worktree reads need no mutex. `kith_complete_work` runs the integration verification command: avoid immediately running it twice unless diagnosis or project policy requires it. Keep all required project checks and review/merge gates. File-edit reports already publish extracted signatures; `kith_publish_contract` remains available for explicit/planned contracts. See the runnable [two-client example](../examples/two-agents.mjs).
|
|
49
|
+
|
|
50
|
+
## Launch a dev server on its allocated port
|
|
23
51
|
|
|
24
52
|
Run from the target repository (or pass `--repo /absolute/checkout`). Use a unique agent ID for each session. A standalone invocation creates and ends its own temporary session; an existing session must provide its capability as usual.
|
|
25
53
|
|
|
@@ -82,7 +110,7 @@ For independent PRs, create each task's Git worktree from the intended PR base f
|
|
|
82
110
|
|
|
83
111
|
Successful completion ends the session and retains its worktree. Run owned commands before completing, or start a fresh session for later maintenance. A refused claim can leave an active session without locks; it can retry on the same connection or expire normally. Status `conflicts` describes current detected file conflicts, not a history of refused scope claims.
|
|
84
112
|
|
|
85
|
-
|
|
113
|
+
A shared checkout is normally dirty with other agents' uncommitted work, and integration does not require it to be clean. It refuses only when the target has uncommitted or untracked changes to a file the integration itself changes, and names those files; unrelated local work is left exactly as it was. Commit or preserve the named files, use a separate integration checkout, or keep the existing PR workflow above. Do not blanket-ignore unknown files to silence the guard. The supervised command runner uses the server's permissions, including network access; it is not a sandbox. `verificationCmd` is an explicit shell string; mutex commands use literal argv.
|
|
86
114
|
|
|
87
115
|
## CLI fallback: keep the owning shell alive
|
|
88
116
|
|
|
@@ -106,7 +134,7 @@ unset KITH_AGENT_ID KITH_SESSION_TOKEN
|
|
|
106
134
|
|
|
107
135
|
Quote globs so the shell does not expand them. CLI scopes are comma-separated. Use `file:src/routes/[id]/page.tsx` for a literal filename containing glob syntax; see [scope grammar and discovery](path-and-scope-rules.md). An ID alone cannot resume another session. Dead or expired sessions release coordination resources when a mutating operation reaps them. Active supervised command guards survive expiry until shutdown is confirmed.
|
|
108
136
|
|
|
109
|
-
Completion checkpoints uncommitted worktree changes and integrates into the branch currently checked out in the selected repository checkout (`--repo` when supplied). The target
|
|
137
|
+
Completion checkpoints uncommitted worktree changes and integrates into the branch currently checked out in the selected repository checkout (`--repo` when supplied). The target may hold unrelated uncommitted work, but not edits to files the integration changes. A verification failure leaves the target unchanged and the worktree available for repair. Successful completion also keeps the worktree for inspection; removal is explicit and refuses dirty, untracked, or ignored work. Existing branches are never reset to create a worktree. Hydration tries filesystem clones and falls back to an independent copy; cost depends on the filesystem and dependency size.
|
|
110
138
|
|
|
111
139
|
A verification command is optional. Without one, integration checks Git mergeability only. Choose a command that actually checks your project.
|
|
112
140
|
|
|
@@ -128,7 +156,7 @@ kith status
|
|
|
128
156
|
kith status --offline
|
|
129
157
|
kith recover
|
|
130
158
|
kith doctor
|
|
131
|
-
# Preview committed source/target trees; dirty
|
|
159
|
+
# Preview committed source/target trees; a dirty source is refused, and a dirty target only when it overlaps the integration
|
|
132
160
|
kith worktree preview --agent worker-1
|
|
133
161
|
|
|
134
162
|
# Allocate a cooperating client's port; start your service promptly
|
|
@@ -174,4 +202,4 @@ Never include session tokens in issues, terminal recordings, or shared logs. See
|
|
|
174
202
|
|
|
175
203
|
The read-only watcher excludes byte-identical dirty copies (including matching executable modes) across linked worktrees. Remaining shared dirty paths are advisories, not proven merge conflicts. Files over 8 MiB and non-file objects remain unverified rather than being treated as identical. The menu shows at most eight overlap rows; `kith watch --once` provides the full observations.
|
|
176
204
|
|
|
177
|
-
Omit `--once` for continuous observation. `--notify=false` suppresses optional macOS notifications. On macOS 12 or newer, `kith menubar /absolute/checkout` opens the same limited read-only view. The package includes an Intel/Apple Silicon executable, launched with this installation's Node and CLI paths; unavailable/failed scans remain visibly unavailable. Other platforms use `kith watch`. Source contributors can rebuild with `pnpm build:menubar` using Apple's command-line tools, and run the pipe/timeout regressions with `pnpm test:menubar`.
|
|
205
|
+
Omit `--once` for continuous observation. `--notify=false` suppresses optional macOS notifications. From 0.1.8, macOS `kith install` and `kith setup` open Radar and register a login LaunchAgent unless `--no-radar` or `--no-autostart` is passed. Dry runs never launch it. An existing view keeps its selected workspace; choose **Switch Workspace** in its menu to change it. Radar polls local state without model calls or MCP conversation traffic. On macOS 12 or newer, `kith menubar /absolute/checkout` opens the same limited read-only view. The package includes an Intel/Apple Silicon executable, launched with this installation's Node and CLI paths; unavailable/failed scans remain visibly unavailable. Other platforms use `kith watch`. Source contributors can rebuild with `pnpm build:menubar` using Apple's command-line tools, and run the pipe/timeout regressions with `pnpm test:menubar`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kith-coord",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
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,22 +31,6 @@
|
|
|
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
|
-
"build:menubar": "node scripts/build-menubar.mjs",
|
|
48
|
-
"test:menubar": "node scripts/test-menubar.mjs"
|
|
49
|
-
},
|
|
50
34
|
"keywords": [
|
|
51
35
|
"ai-agents",
|
|
52
36
|
"parallel-agents",
|
|
@@ -73,7 +57,6 @@
|
|
|
73
57
|
"vitest": "^3.0.7",
|
|
74
58
|
"typescript": "^5.8.2"
|
|
75
59
|
},
|
|
76
|
-
"packageManager": "pnpm@10.20.0",
|
|
77
60
|
"repository": {
|
|
78
61
|
"type": "git",
|
|
79
62
|
"url": "git+https://github.com/connorhriley/kith.git"
|
|
@@ -86,5 +69,20 @@
|
|
|
86
69
|
"access": "public",
|
|
87
70
|
"registry": "https://registry.npmjs.org"
|
|
88
71
|
},
|
|
89
|
-
"mcpName": "io.github.connorhriley/kith"
|
|
90
|
-
|
|
72
|
+
"mcpName": "io.github.connorhriley/kith",
|
|
73
|
+
"scripts": {
|
|
74
|
+
"build": "tsup",
|
|
75
|
+
"dev": "tsup --watch",
|
|
76
|
+
"test": "tsup && vitest run",
|
|
77
|
+
"test:watch": "tsup && vitest",
|
|
78
|
+
"typecheck": "tsc --noEmit",
|
|
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"
|
|
87
|
+
}
|
|
88
|
+
}
|
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.8",
|
|
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.8",
|
|
27
27
|
"runtimeHint": "npx",
|
|
28
28
|
"runtimeArguments": [
|
|
29
29
|
{
|