kith-coord 0.1.6 → 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.
@@ -27,7 +27,7 @@ These are test scenarios, not universal guarantees. CI coverage and real usage n
27
27
 
28
28
  ## Important limits
29
29
 
30
- **Hooks.** Clients must actually invoke hooks, use the same repository state, and agree on agent IDs. Missing or bypassed hooks do not prevent filesystem writes. Claude/Cursor hooks need matching `KITH_AGENT_ID` and `KITH_SESSION_TOKEN` when mixed with CLI commands. Malformed pre-tool execution errors exit with status 2, which the client uses to block the tool. Some payload shapes and client versions remain untested.
30
+ **Hooks.** Clients must actually invoke hooks, use the same repository state, and agree on agent IDs. Missing or bypassed hooks do not prevent filesystem writes. Claude/Cursor hooks need matching `KITH_AGENT_ID` and `KITH_SESSION_TOKEN` when mixed with CLI commands. Malformed pre-tool execution errors from a session that presented an identity exit with status 2, which the client uses to block the tool. A process with no Kith identity is not governed and passes through; `--require-session` or `KITH_REQUIRE_SESSION=1` makes it fail closed instead. Some payload shapes and client versions remain untested.
31
31
 
32
32
  **Sessions and leases.** Mutations require a capability bound to the active session generation. Process anchors are fixed on resume, real process identities replace test liveness sentinels, and expired/completed sessions cannot be revived by heartbeat. Sessions default to five minutes; use heartbeat before expiry. Supervised command mutexes renew their leases and preserve FIFO tickets across handoff. Active command-group guards survive expiry and are released only after the group stops. A protected daemon that escapes its group is outside this boundary. See [sessions and mutexes](sessions-and-mutexes.md) for lifecycle, cancellation, and upgrade details.
33
33
 
@@ -93,3 +93,21 @@ Kith 0.1.6 (protocol 1.4) supports optional [operation keys and structured failu
93
93
  Replay is capability-protected historical access, not renewed ownership. Old session tokens cannot act on a replacement generation. Lost initial capability grants cannot be recovered with a key alone. Do not erase operation history to make a retry run; inspect effects and retained work before deliberately starting a new attempt. Keep the entire stopped database/sidecar set, because operation history and ownership belong to the same recovery snapshot.
94
94
 
95
95
  Schema 2 to 3 adds the journal transactionally and preserves current ownership, task state, files and process guards. A killed upgrade rolls back and can be retried. Startup refuses a schema-3 database missing its journal or required columns, rather than reconstructing an empty retry history. Stop old clients before upgrading; binaries that only support schema 2 refuse schema 3. Generic storage errors stay non-retryable because they can occur after external work. There are no new services, dependencies, retry daemons or UI controls.
96
+
97
+
98
+ ### Task handoff and cross-repository observations (0.1.7)
99
+
100
+ A queued task's ownership/claims and its worktree handoff commit together. If the handoff fails, task/claim mutations roll back. Any partial filesystem output stays intact for inspection; Kith never deletes it to make a retry succeed. Reusing a saved worktree requires matching Git common-directory identity, branch and exclusive registration, no unfinished tracked/untracked changes, and HEAD matching the selected checkout's HEAD. A moved, dirty or stale checkout is refused for explicit recovery.
101
+
102
+ Cross-repository advice reads explicit local TypeScript/JavaScript path aliases to tracked files in a distinct Git repository. It does not crawl folders or prove runtime compatibility. Status inspects direct aliases; concrete wildcard imports are resolved when recording edits. Inherited/referenced configuration and re-exports defer to your normal compiler and project checks. Source/config reads are capped at 64 KiB, reports at eight linked files/64 symbols and 16 KiB. Replies contain symbol names/kinds/hashes, not source initializers. MCP text replies use compact JSON without dropping fields or changing literal strings; structured responses and safety/recovery details are preserved. Partial exports suppress missing-export verdicts. Unavailable sibling ownership, Git checks or worktrees remain explicitly unavailable; advisory failure does not invalidate a successful work claim.
103
+
104
+ The menu watches a selected workspace and stores recent selections. It does not search your home directory or assume project-folder names. Switching invalidates the old view immediately; late results from an earlier selection are discarded. Task prompts belong to individual Git checkouts, not a workspace parent. Observations never identify nonparticipating writers or authorize cleanup.
105
+
106
+
107
+ ### Compact MCP context (0.1.7)
108
+
109
+ Compact replies preserve actionable context: all breaking contracts, linked exports within the core inspection bounds, changed contract receipts, warnings, failures and recovery instructions. They do not guess read dependencies from write scopes. Only ordinary contract previews are limited; omitted counts and a full-registry retrieval instruction are explicit. The text footer can group repeated signatures while retaining each downstream file/agent/distance relationship; machine-readable breaking alerts retain their established fields. `includeHistory:true` retrieves completed tasks, and lock identity, fencing and expiry remain visible. Savings come from formatting, repeated signatures and internal fingerprints rather than a semantic summarizer. No model calls or extra service are needed.
110
+
111
+ ### Quieter status and lease receipts (0.1.8)
112
+
113
+ Default status omits successful integration logs and reports `completedIntegrationCount`. `includeHistory:true` restores those records. Failed and in-progress integration diagnostics stay visible. Owned replies include `session.leaseExpiresAt` for the current lease, so an idle heartbeat does not need a status poll. Replayed operation keys keep the historical deadline and do not renew ownership. Together with handoffs, the brief and workflow mode, these fields are protocol 1.6. The storage schema stays 3. Opening the database creates an optional `handoffs` table; older binaries ignore it. There is no schema-version migration.
package/docs/roadmap.md CHANGED
@@ -14,7 +14,7 @@ MCP is the default agent interface. Keep one shared ownership ledger per Git com
14
14
  4. **Followable recovery.** Exercise disconnect, expiry, failed checks, partial setup, interrupted migration and damaged-state refusal. Preserve worktrees and matching stopped database/sidecars; no automatic repair, forced claim release or deletion of `.coord`.
15
15
  5. **Exact release evidence.** Require all six Linux/macOS and both Windows jobs on the candidate, including any editor checks, plus the exact packed-package consumer. Verify registry bytes and tag workflows after publication. Maintain versioned client evidence and honest platform limits.
16
16
 
17
- Published 0.1.4 / protocol 1.3 has recorded clean npm and editor-registry evidence. Version 0.1.5 carries the read-only radar clarity fixes without changing the protocol. Each candidate must pass its own combined core/platform, bundled-server and clean-install gates before publication; a green prior release does not certify a new branch.
17
+ Published 0.1.7 / protocol 1.5 is on npm, including durable setup and compact MCP replies. Kith 0.1.8 advances the additive protocol to 1.6 (handoffs, the brief, workflow mode, lease receipts and quieter status) and keeps storage schema 3, with an optional handoffs table that older binaries ignore. Each candidate must pass its own combined core/platform, bundled-server and clean-install gates before publication; a green prior release does not certify a new branch.
18
18
 
19
19
  ## Deferred
20
20
 
@@ -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
- Call these tools on the same connection:
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 and heartbeat before the default five-minute session expiry. See the runnable [two-client example](../examples/two-agents.mjs).
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
- ## Launch a dev server on its allocated port
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
- These additions are available in source builds on `main`; the published `kith-coord@0.1.3` does not include them yet. Build/link the checkout before using the CLI examples.
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
- Integration refuses a target with uncommitted or untracked work to preserve it. Commit or preserve those files explicitly, use a clean 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.
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 must be clean. 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.
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 inputs are refused
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.6",
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",
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.6",
26
+ "version": "0.1.8",
27
27
  "runtimeHint": "npx",
28
28
  "runtimeArguments": [
29
29
  {